Sfoglia il codice sorgente

用户设置,语音,视频的开关和是否免费

lizhen_gitee 3 anni fa
parent
commit
4e2f2ca8e7

+ 5 - 2
application/api/controller/Usercenter.php

@@ -288,9 +288,12 @@ class Usercenter extends Api
         //给出备选用户
         $map = [
             'status' =>1,
-            //'gender' => $this->auth->gender == 1 ? 0 : 1,
-            //'real_status' => 1,
+            'gender' => $this->auth->gender == 1 ? 0 : 1,
+            'real_status' => 1,
+            'idcard_status' => 1,
             //打开视频开关的
+            'open_match_video' => 1,
+
             'id' => ['neq',$this->auth->id]
 
         ];

+ 67 - 0
application/api/controller/Userset.php

@@ -0,0 +1,67 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+use think\Db;
+
+/**
+ * 用户设置,从user拿出来
+ */
+class Userset extends Api
+{
+    protected $noNeedLogin = [];
+    protected $noNeedRight = '*';
+
+    //用户详细资料
+    public function userinfo(){
+        $field = [
+            'id','real_status','idcard_status','open_match_video','open_match_audio','open_match_typing','free_video','free_audio','free_typing'
+        ];
+        $info = Db::name('user')->field($field)->where('id',$this->auth->id)->find();
+
+        $rs['userinfo'] = $info;
+        $rs['video_min_price'] = config('site.video_min_price');
+        $rs['audio_min_price'] = config('site.audio_min_price');
+        $rs['typing_min_price'] = config('site.typing_min_price');
+        $this->success('success',$rs);
+    }
+
+    /**
+     * 修改会员状态信息
+     */
+    public function set_status_switch()
+    {
+        if($this->auth->idcard_status != 1){
+            $this->error('未通过实名认证');
+        }
+
+        if($this->auth->real_status != 1){
+            $this->error('未通过真人认证');
+        }
+
+        //开始
+        $field_array = ['open_match_video','open_match_audio','open_match_typing','free_video','free_audio','free_typing'];
+
+        $data = [];
+
+        $field = input_post('switch','default');
+        $value = input_post('switch_value',0);
+
+        if(!in_array($field,$field_array)){
+            $this->error();
+        }
+
+        if(!empty($field)){
+            $data[$field] = $value;
+        }
+
+        if(empty($data)){
+            $this->error('没有任何改变');
+        }
+
+        Db::name('user')->where('id',$this->auth->id)->update($data);
+        $this->success();
+    }
+
+}