Kaynağa Gözat

送礼物优化

lizhen_gitee 1 yıl önce
ebeveyn
işleme
74eb0bb5b0

+ 18 - 4
application/api/controller/Party.php

@@ -1586,29 +1586,43 @@ class Party extends Common
      * 全麦/单独赠送礼物
      */
     public function giveGiftToYou() {
-        $is_back = $this->request->request("is_back",0);// 是否背包赠送: 1=是,0=否
+        // 是否背包赠送: 1=是,0=否
+        $is_back = $this->request->request("is_back",0);
 
         // 接口防并发
         if($is_back){
             if (!$this->apiLimit(50, 1000)) {
+                //1000毫秒50次
                 $this->error(__('Operation frequently'));
             }
         }else{
             if (!$this->apiLimit(10, 1000)) {
+                //1000毫秒10次
                 $this->error(__('Operation frequently'));
             }
         }
+
+        //送礼物权限
+        if($this->auth->power['give_gift'] == 1){
+            $this->error('您已被限制:赠送礼物,请联系管理员');
+        }
+
+        //接收参数
         $user_ids = $this->request->request("user_id");// 赠送对象
-        $gift_id = $this->request->request("gift_id");// 礼物ID
+        $gift_id = $this->request->request("gift_id");// 礼物ID。如果是背包赠送,则是gift_back表的id,这样不合理,但是已经不好改了
         $party_id = $this->request->request("party_id",0);// 派对ID
         $room_type = $this->request->request('room_type',1); // 房间类型
         $number = $this->request->request("number");// 赠送数量
 
-        if (!$user_ids || !in_array($is_back,[0,1]) || !$gift_id || !$number || !in_array($room_type,[1,2])) $this->error(__('Invalid parameters'));
+        if (!$user_ids || !in_array($is_back,[0,1]) || !$gift_id || !$number || !in_array($room_type,[1,2]))
+        {
+            $this->error(__('Invalid parameters'));
+        }
+
+        //处理参数
         $user_id_arr = explode(",",$user_ids);
         $userCount = count($user_id_arr);
         $userauthid = $this->auth->id;
-        //$soundCoinRate = config("site.giftCoin"); // 声币兑换比例
         $money_to_jewel = config('site.money_to_jewel') ?: 10; //余额兑换钻石
         $userModel = new \app\common\model\User();
 

+ 7 - 2
application/index/controller/Plantask.php

@@ -8,6 +8,10 @@ use app\common\library\Tlssigapiv2;
 use think\Db;
 class Plantask extends Controller
 {
+    //关于计划任务
+    //只有 public 方法,auto_开头的才是计划任务,其他private 方法都是工具方法
+
+
     //主动拉取im群组内 聊天记录
     public function auto_imgroup(){
         $im_config = config('tencent_im');
@@ -174,7 +178,7 @@ class Plantask extends Controller
         return $json_path;
     }
 
-    //读取json并分析
+    //读取json并分析,c2c
     private function readjson($json_path = ''){
         $newMsgList = [];
         $json_content = file_get_contents($json_path);
@@ -242,7 +246,7 @@ class Plantask extends Controller
         return $newMsgList;
     }
 
-    //读取json并分析
+    //读取json并分析,group
     private function readjson_group($json_path = ''){
         $newMsgList = [];
         $json_content = file_get_contents($json_path);
@@ -296,6 +300,7 @@ class Plantask extends Controller
         return $newMsgList;
     }
 
+    //请求im的签名
     private function usersig($sdkappid,$key,$identifier){
         $api = new TLSSigAPIv2($sdkappid,$key );
         $sig = $api->genUserSig($identifier);