| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | 
							- <?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','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();
 
-     }
 
- }
 
 
  |