فهرست منبع

礼物统一表

lizhen_gitee 8 ماه پیش
والد
کامیت
001a176db7
2فایلهای تغییر یافته به همراه19 افزوده شده و 9 حذف شده
  1. 10 5
      application/api/controller/Gift.php
  2. 9 4
      application/api/controller/Topicdongtai.php

+ 10 - 5
application/api/controller/Gift.php

@@ -86,14 +86,12 @@ class Gift extends Api
                 {
                     $this->error("您的金币不足");
                 }
-                $log_table = 'gift_user_typing';
             }else{
                 $user_jewel = model('wallet')->getWallet($this->auth->id,'jewel');
                 if($user_jewel < $giftvalue)
                 {
                     $this->error("您的钻石不足");
                 }
-                $log_table = 'gift_user_typing_jewel';
             }
 
 
@@ -104,10 +102,17 @@ class Gift extends Api
                 'gift_id' => $giftinfo['id'],
                 'gift_name' => $giftinfo['name'],
                 'number' => $number,
-                'price' => $giftvalue,
+
                 'createtime' => time(),
+                'wallettype' => $giftinfo['wallettype'],
             ];
-            $log_id = Db::name($log_table)->insertGetId($data);
+            if($giftinfo['wallettype'] == 1){
+                $data['price'] = $giftvalue;
+            }else{
+                $data['jewel'] = $giftvalue;
+            }
+
+            $log_id = Db::name('gift_user_typing')->insertGetId($data);
             if(!$log_id){
                 Db::rollback();
                 $this->error('赠送失败');
@@ -166,7 +171,7 @@ class Gift extends Api
                         }*/
                     }
                 }else{
-                    $wallet_rs = model('wallet')->lockChangeAccountRemain($this->auth->id,$user_id,'jewel',-$giftvalue,33,'赠送礼物:'.$giftinfo["name"] . '*' . $number,'gift_user_typing_jewel',$log_id);
+                    $wallet_rs = model('wallet')->lockChangeAccountRemain($this->auth->id,$user_id,'jewel',-$giftvalue,33,'赠送礼物:'.$giftinfo["name"] . '*' . $number,'gift_user_typing',$log_id);
                     if($wallet_rs['status'] === false){
                         Db::rollback();
                         $this->error($wallet_rs['msg']);

+ 9 - 4
application/api/controller/Topicdongtai.php

@@ -598,13 +598,11 @@ class Topicdongtai extends Api
             if($user_gold < $giftvalue) {
                 $this->error("您的金币不足");
             }
-            $log_table = 'gift_user_dongtai';
         }else{
             $user_jewel = model('wallet')->getWallet($this->auth->id,'jewel');
             if($user_jewel < $giftvalue) {
                 $this->error("您的钻石不足");
             }
-            $log_table = 'gift_user_dongtai_jewel';
         }
 
         Db::startTrans();
@@ -616,10 +614,17 @@ class Topicdongtai extends Api
             'gift_id' => $giftinfo['id'],
             'gift_name' => $giftinfo['name'],
             'number' => $number,
-            'price' => $giftvalue,
+
             'createtime' => time(),
+            'wallettype' => $giftinfo['wallettype'],
         ];
-        $log_id = Db::name($log_table)->insertGetId($data);
+        if($giftinfo['wallettype'] == 1){
+            $data['price'] = $giftvalue;
+        }else{
+            $data['jewel'] = $giftvalue;
+        }
+
+        $log_id = Db::name('gift_user_dongtai')->insertGetId($data);
         if(!$log_id){
             Db::rollback();
             $this->error('赠送失败');