瀏覽代碼

优化,防重复处理

lizhen_gitee 1 年之前
父節點
當前提交
701c7b75b5
共有 1 個文件被更改,包括 7 次插入6 次删除
  1. 7 6
      app/Jobs/GiftJob.php

+ 7 - 6
app/Jobs/GiftJob.php

@@ -99,7 +99,7 @@ class GiftJob implements ShouldQueue
         if($data->getvalue > 0){
             $getMoney = bcdiv($data->getvalue,$jewel_to_money,2);
             if($getMoney > 0){
-                $rs_wallet = $this->lockChangeAccountRemain($user_id,$getMoney,'+',0,"{$authuser_info}送你{$data->gift_name}x{$data->number}",101,'money');
+                $rs_wallet = $this->lockChangeAccountRemain($user_id,$getMoney,'+',0,"{$authuser_info}送你{$data->gift_name}x{$data->number}",101,'money',$this->msgid);
                 if($rs_wallet['status'] == false){
                     Db::rollback();
                     return false;
@@ -112,7 +112,7 @@ class GiftJob implements ShouldQueue
             $guilderMoney = $data->guildermoney;
             if($guilderMoney > 0){
                 $touserInfo    = DB::table('hx_user')->where('id',$user_id)->value('nickname');
-                $rs_wallet = $this->lockChangeAccountRemain($partyInfo->user_id,$guilderMoney,'+',0,"{$authuser_info}送礼物{$data->gift_name}x{$data->number}给{$touserInfo},房间礼物抽成",102,'money');
+                $rs_wallet = $this->lockChangeAccountRemain($partyInfo->user_id,$guilderMoney,'+',0,"{$authuser_info}送礼物{$data->gift_name}x{$data->number}给{$touserInfo},房间礼物抽成",102,'money',$this->msgid);
                 if($rs_wallet['status'] == false){
                     Db::rollback();
                     return false;
@@ -149,7 +149,7 @@ class GiftJob implements ShouldQueue
      * @return array[log_table]
      * @return array[log_id]
      */
-    public function lockChangeAccountRemain($user_id,$money,$mode,$before = 0,$remark='',$logtype,$accountType='money',$extend = [])
+    public function lockChangeAccountRemain($user_id,$money,$mode,$before = 0,$remark='',$logtype,$accountType='money',$msgid = 0)
     {
         //初始化
         $result = array(
@@ -216,9 +216,10 @@ class GiftJob implements ShouldQueue
             $data['detail'] = $remark;
             $data['createtime'] = time();
             $data['type'] = $logtype;
-            if ($accountType == 'jewel') {
-                $data['cityname'] = isset($extend['cityname']) ? $extend['cityname'] : '';
-            }
+
+            $data['msgid'] = $msgid;
+
+
             //新的方式
             $rs1 = DB::table('hx_user_wallet')->where('user_id',$user_id)->update([$accountType => $data['balance']]);