Pārlūkot izejas kodu

搭讪与音视频通话扣费

lizhen_gitee 10 mēneši atpakaļ
vecāks
revīzija
2bbee2198c

+ 3 - 0
application/api/controller/Baseconfig.php

@@ -23,6 +23,9 @@ class Baseconfig extends Api
             'zhanghaozhuxiao'            => config('site.zhanghaozhuxiao'),//账号注销
             'tuiguang_rule'            => config('site.tuiguang_rule'),//邀请推广须知
             'match_bg_music'            => localpath_to_netpath(config('site.match_bg_music')),//音视频匹配背景音乐
+
+            'man_index_dashan_pushtimes' => config('site.man_index_dashan_pushtimes'),//男性用户每日【与你有缘】推送次数
+            'woman_index_dashan_pushtimes' => config('site.woman_index_dashan_pushtimes'),//女性用户每日【与你有缘】推送次数
         ];
 
         $this->success('success',$config);

+ 51 - 1
application/api/controller/Match.php

@@ -74,6 +74,7 @@ class Match extends Api
         if(in_array($to_user_id,explode(',',$kefu_ids)) || in_array($this->auth->id,explode(',',$kefu_ids))){
             $rs = [
                 'get_jewel_value' => 0,
+                'next_minute' => 1, //1=足够下一分钟,0=不足够下一分钟
             ];
             $this->success('success',$rs);
         }
@@ -91,15 +92,21 @@ class Match extends Api
 
         //检查剩余分钟数
         $task_status = 0;//任务状态
+        $next_minute = 0;//默认不足下一分钟
+
         $user_wallet = Db::name('user_wallet')->where('user_id',$this->auth->id)->lock(true)->find();
         if($user_wallet['video_sec'] >= 1){
             //扣分钟数
             $price = 0;
             //补贴给对方0.1金币
             $money = 0.1;
+
+            if($user_wallet['video_sec'] > 1){
+                $next_minute = 1;
+            }
         }else{
             $task_status = 1;
-            //需要扣别人的钱,判断钱是否购
+            //需要扣别人的钱,判断钱是否足够
             if($price > 0){
                 $goldtotal = model('wallet')->getWallettotal($this->auth->id);
                 if(bccomp($price,$goldtotal) == 1){
@@ -107,6 +114,10 @@ class Match extends Api
                     $this->error('金币不足');
                 }
             }
+
+            if($goldtotal - $price > $price){
+                $next_minute = 1;
+            }
         }
 
         //查询是否有匹配记录
@@ -210,8 +221,10 @@ class Match extends Api
         }
 
         Db::commit();
+
         $rs = [
             'get_jewel_value' => $data['money'],
+            'next_minute' => $next_minute,
         ];
         $this->success('success',$rs);
     }
@@ -236,6 +249,7 @@ class Match extends Api
         if(in_array($to_user_id,explode(',',$kefu_ids)) || in_array($this->auth->id,explode(',',$kefu_ids))){
             $rs = [
                 'get_jewel_value' => 0,
+                'next_minute' => 1, //1=足够下一分钟,0=不足够下一分钟
             ];
             $this->success('success',$rs);
         }
@@ -253,12 +267,18 @@ class Match extends Api
 
         //检查剩余分钟数
         $task_status = 0;//任务状态
+        $next_minute = 0;//默认不足下一分钟
+
         $user_wallet = Db::name('user_wallet')->where('user_id',$this->auth->id)->lock(true)->find();
         if($user_wallet['audio_sec'] >= 1){
             //扣分钟数
             $price = 0;
             //补贴给对方0.1金币
             $money = 0.1;
+
+            if($user_wallet['video_sec'] > 1){
+                $next_minute = 1;
+            }
         }else{
             $task_status = 1;
             //需要扣别人的钱,判断钱是否购
@@ -269,6 +289,10 @@ class Match extends Api
                     $this->error('金币不足');
                 }
             }
+
+            if($goldtotal - $price > $price){
+                $next_minute = 1;
+            }
         }
 
         //查询是否有匹配记录
@@ -374,6 +398,7 @@ class Match extends Api
 
         $rs = [
             'get_jewel_value' => $data['money'],
+            'next_minute' => $next_minute,
         ];
         $this->success('success',$rs);
     }
@@ -396,6 +421,7 @@ class Match extends Api
         if(in_array($to_user_id,explode(',',$kefu_ids)) || in_array($this->auth->id,explode(',',$kefu_ids))){
             $rs = [
                 'get_jewel_value' => 0,
+                'next_minute' => 1, //1=足够下一分钟,0=不足够下一分钟
             ];
             $this->success('success',$rs);
         }
@@ -412,12 +438,18 @@ class Match extends Api
         Db::startTrans();
 
         //检查剩余分钟数
+        $next_minute = 0;//默认不足下一分钟
+
         $user_wallet = Db::name('user_wallet')->where('user_id',$this->auth->id)->lock(true)->find();
         if($user_wallet['typing_times'] >= 1){
             //扣分钟数
             $price = 0;
             //补贴给对方0.1金币
             $money = 0.1;
+
+            if($user_wallet['video_sec'] > 1){
+                $next_minute = 1;
+            }
         }else{
             //需要扣别人的钱,判断钱是否购
             if($price > 0){
@@ -427,6 +459,10 @@ class Match extends Api
                     $this->error('金币不足');
                 }
             }
+
+            if($goldtotal - $price > $price){
+                $next_minute = 1;
+            }
         }
 
 
@@ -495,6 +531,7 @@ class Match extends Api
 
         $rs = [
             'get_jewel_value' => $money,
+            'next_minute' => $next_minute,
         ];
         $this->success('success',$rs);
     }
@@ -506,12 +543,16 @@ class Match extends Api
             $this->error('该功能暂未开启');
         }
 
+        //客服
+        $kefu_ids = config('site.kefu_user_ids');
+
         //给出备选用户
         $map = [
             'user.status' =>1,                                       //未封禁用户
             'user.gender' => $this->auth->gender == 1 ? 0 : 1,       //异性
             'user.is_active' => 1,                                   //在线的
             'user.open_match_audio' => 1,                            //打开语聊开关
+            'user.id' => ['NOTIN',$kefu_ids],                        //排除客服
         ];
 
         if($this->auth->gender == 0){
@@ -558,12 +599,17 @@ class Match extends Api
         if(config('site.index_match_video_switch') != 1){
             $this->error('该功能暂未开启');
         }
+
+        //客服
+        $kefu_ids = config('site.kefu_user_ids');
+
         //给出备选用户
         $map = [
             'user.status' =>1,                                       //未封禁用户
             'user.gender' => $this->auth->gender == 1 ? 0 : 1,       //异性
             'user.is_active' => 1,                                   //在线的
             'user.open_match_video' => 1,                            //打开语聊开关
+            'user.id' => ['NOTIN',$kefu_ids],                        //排除客服
         ];
 
         if($this->auth->gender == 0){
@@ -695,10 +741,14 @@ class Match extends Api
 
     //与你有缘 推送搭讪人
     public function getindex_dashan(){
+        //客服
+        $kefu_ids = config('site.kefu_user_ids');
+
         //强制条件
         $map = [
             'user.status' =>1,                                       //未封禁用户
             'user.gender' => $this->auth->gender == 1 ? 0 : 1,       //异性
+            'user.id' => ['NOTIN',$kefu_ids],                        //排除客服
         ];
 
         //找到没聊过的人