Browse Source

客服不收钱

lizhen_gitee 11 months ago
parent
commit
625d381db4
2 changed files with 98 additions and 56 deletions
  1. 84 56
      application/api/controller/Match.php
  2. 14 0
      application/api/controller/Usercenter.php

+ 84 - 56
application/api/controller/Match.php

@@ -68,6 +68,16 @@ class Match extends Api
         if(!$to_user_info){
             $this->error('不存在的用户');
         }
+
+        //客服不收钱
+        $kefu_ids = config('site.kefu_user_ids');
+        if(in_array($to_user_id,$kefu_ids)){
+            $rs = [
+                'get_jewel_value' => 0,
+            ];
+            $this->success('success',$rs);
+        }
+
         if ($to_user_info['gender'] != 0) {
             $this->error('同性不能聊天~');
         }
@@ -213,6 +223,16 @@ class Match extends Api
         if(!$to_user_info){
             $this->error('不存在的用户');
         }
+
+        //客服不收钱
+        $kefu_ids = config('site.kefu_user_ids');
+        if(in_array($to_user_id,$kefu_ids)){
+            $rs = [
+                'get_jewel_value' => 0,
+            ];
+            $this->success('success',$rs);
+        }
+
         if ($to_user_info['gender'] != 0) {
             $this->error('同性不能聊天~');
         }
@@ -356,6 +376,16 @@ class Match extends Api
         if(!$to_user_info){
             $this->error('不存在的用户');
         }
+
+        //客服不收钱
+        $kefu_ids = config('site.kefu_user_ids');
+        if(in_array($to_user_id,$kefu_ids)){
+            $rs = [
+                'get_jewel_value' => 0,
+            ];
+            $this->success('success',$rs);
+        }
+
         if ($to_user_info['gender'] != 0) {
             $this->error('同性不能聊天~');
         }
@@ -554,62 +584,6 @@ class Match extends Api
         $this->success('success',$lists);
     }
 
-    //聊天匹配
-    //没有用到
-    public function gettypinguser(){
-
-        //给出备选用户
-        $map = [
-            'user.status' =>1,                                       //未封禁用户
-            'user.gender' => $this->auth->gender == 1 ? 0 : 1,       //异性
-        ];
-
-        if($this->auth->gender == 0){
-
-            //或者未首充用户,且还有免费分钟数
-            $map2['user.is_shouchong'] = 0;
-            $map2['uw.typing_times'] = ['gt',0];
-
-            //男性要有最少一分钟的钱
-            $map3['uw.gold'] = ['egt',$this->auth->match_typing_price];
-
-        }else{
-            $my_gold = Db::name('user_wallet')->where('user_id',$this->auth->id)->value('gold');
-            $map2['user.match_typing_price'] = ['elt',$my_gold];
-        }
-
-        $lists = Db::name('user')->alias('user')->field('user.id')
-            ->join('user_wallet uw','user.id = uw.user_id','LEFT')
-            ->where($map)->where($map2)->order('user.logintime desc')->page($this->page,100)->select();
-
-        if(empty($lists) && $this->auth->gender == 0){
-            $lists = Db::name('user')->alias('user')->field('user.id')
-                ->join('user_wallet uw','user.id = uw.user_id','LEFT')
-                ->where($map)->where($map3)->order('user.logintime desc')->page($this->page,100)->select();
-        }
-
-        $this->success('success',$lists);
-    }
-
-    //过滤规则
-    private function fliter_user($lists){
-
-        if(empty($lists)){
-            return $lists;
-        }
-
-
-        //过滤掉通话中的
-        foreach($lists as $key => $val){
-            if(redis_matching_get($val['id']) == 1){
-                unset($lists[$key]);
-            }
-        }
-
-
-        return $lists;
-    }
-
     //亲密度等级信息
     public function intimacylevel() {
         $user_id = input('user_id', 0, 'intval'); //对方id
@@ -699,7 +673,61 @@ class Match extends Api
         $this->success('亲密度等级信息', $data);
     }
 
+//////////////////////////////////////////////////////////////
+    //聊天匹配
+    public function gettypinguser(){
+
+        //给出备选用户
+        $map = [
+            'user.status' =>1,                                       //未封禁用户
+            'user.gender' => $this->auth->gender == 1 ? 0 : 1,       //异性
+        ];
+
+        if($this->auth->gender == 0){
+
+            //或者未首充用户,且还有免费分钟数
+            $map2['user.is_shouchong'] = 0;
+            $map2['uw.typing_times'] = ['gt',0];
+
+            //男性要有最少一分钟的钱
+            $map3['uw.gold'] = ['egt',$this->auth->match_typing_price];
+
+        }else{
+            $my_gold = Db::name('user_wallet')->where('user_id',$this->auth->id)->value('gold');
+            $map2['user.match_typing_price'] = ['elt',$my_gold];
+        }
+
+        $lists = Db::name('user')->alias('user')->field('user.id')
+            ->join('user_wallet uw','user.id = uw.user_id','LEFT')
+            ->where($map)->where($map2)->order('user.logintime desc')->page($this->page,100)->select();
+
+        if(empty($lists) && $this->auth->gender == 0){
+            $lists = Db::name('user')->alias('user')->field('user.id')
+                ->join('user_wallet uw','user.id = uw.user_id','LEFT')
+                ->where($map)->where($map3)->order('user.logintime desc')->page($this->page,100)->select();
+        }
+
+        $this->success('success',$lists);
+    }
+
+    //过滤规则
+    private function fliter_user($lists){
+
+        if(empty($lists)){
+            return $lists;
+        }
+
 
+        //过滤掉通话中的
+        foreach($lists as $key => $val){
+            if(redis_matching_get($val['id']) == 1){
+                unset($lists[$key]);
+            }
+        }
+
+
+        return $lists;
+    }
 
 
 

+ 14 - 0
application/api/controller/Usercenter.php

@@ -109,6 +109,13 @@ class Usercenter extends Api
         //登录用户的金币余额
         $userinfo['my_goldtotal'] = model('wallet')->getWallettotal($this->auth->id);
 
+        //是否客服
+        $userinfo['is_kefu'] = 0;
+        $kefu_ids = config('site.kefu_user_ids');
+        if(in_array($uid,$kefu_ids)){
+            $userinfo['is_kefu'] = 1;
+        }
+
 
         $this->success('success',$userinfo);
     }
@@ -280,6 +287,13 @@ class Usercenter extends Api
             $userinfo['wealth_level'] = '';
         }
 
+        //是否客服
+        $userinfo['is_kefu'] = 0;
+        $kefu_ids = config('site.kefu_user_ids');
+        if(in_array($uid,$kefu_ids)){
+            $userinfo['is_kefu'] = 1;
+        }
+
         $this->success('success',$userinfo);
 
     }