Browse Source

三个通话前配置接口

lizhen_gitee 10 months ago
parent
commit
30d8cd4b6a
1 changed files with 34 additions and 0 deletions
  1. 34 0
      application/api/controller/Match.php

+ 34 - 0
application/api/controller/Match.php

@@ -54,6 +54,40 @@ class Match extends Api
         $this->success(1,$list);
     }
 
+    //三个通话前的配置
+    public function match_config(){
+        $user_id = input('user_id',0);
+        if(!$user_id){$this->error();}
+
+        if($this->auth->gender == 1){
+            //拿男用户的三个免费额度
+            $man_wallet = Db::name('user_wallet')->field('gold,jewel,audio_sec,video_sec,typing_times')->where('user_id',$this->auth->id)->find();
+            $man_wallet['goldtotal'] = bcadd($man_wallet['gold'],$man_wallet['jewel'],1);
+            unset($man_wallet['gold']);
+            unset($man_wallet['jewel']);
+
+            //女用户的三个价格
+            $woman_price = Db::name('user')->field('match_video_price,match_audio_price,match_typing_price')->where('id',$user_id)->find();
+        }else{
+            //拿男用户的三个免费额度
+            $man_wallet = Db::name('user_wallet')->field('gold,jewel,audio_sec,video_sec,typing_times')->where('user_id',$user_id)->find();
+            $man_wallet['goldtotal'] = bcadd($man_wallet['gold'],$man_wallet['jewel'],1);
+            unset($man_wallet['gold']);
+            unset($man_wallet['jewel']);
+
+            //女用户的三个价格
+            $woman_price = Db::name('user')->field('match_video_price,match_audio_price,match_typing_price')->where('id',$this->auth->id)->find();
+        }
+
+        $result = [
+            'avatar' => localpath_to_netpath(Db::name('user')->where('id',$user_id)->value('avatar')),
+            'man_wallet' => $man_wallet,
+            'woman_price' => $woman_price,
+        ];
+
+        $this->success(1,$result);
+    }
+
     //视频通话每分钟调用一次
     public function video_onemin(){
         if ($this->auth->gender == 0) { //女生不花钱