Browse Source

送礼物总上限

lizhen_gitee 10 months ago
parent
commit
4402a49f3c
2 changed files with 12 additions and 3 deletions
  1. 8 2
      application/api/controller/Gift.php
  2. 4 1
      application/api/controller/Pay.php

+ 8 - 2
application/api/controller/Gift.php

@@ -196,9 +196,9 @@ class Gift extends Api
         }
 
         //总共的
-        if($this->auth->wealth_value + $giftvalue > $limit_info['gift_total']){
+        /*if($this->auth->wealth_value + $giftvalue > $limit_info['gift_total']){
             return '您已经达到送礼物总上限';
-        }
+        }*/
 
         //今日的
         $today = date('Y-m-d');
@@ -210,6 +210,12 @@ class Gift extends Api
             return '您今天已经达到送礼物上限';
         }
 
+        //总共的
+        $total_sum = Db::name('gift_user_typing')->where('user_id',$this->auth->id)->sum('total_price');
+        if($total_sum + $giftvalue >= $limit_info['gift_total']){
+            return '您已经达到送礼物总上限';
+        }
+
         return true;
 
     }

+ 4 - 1
application/api/controller/Pay.php

@@ -124,6 +124,9 @@ class Pay extends Api
         //赋值money
         if($rc_id){
             $recharge_config = Db::name('paygold_webcon')->where('id',$rc_id)->find();
+            if(empty($recharge_config)){
+                $this->error('请选择正确的充值金额');
+            }
             $money = $recharge_config['money'] ?: 0;
             $gold  = $recharge_config['gold'] ?: 0;
         }
@@ -218,7 +221,7 @@ class Pay extends Api
             ->where('order_status',1)
             ->sum('order_amount');
         if($total_sum + $money >= $limit_info['recharge_total']){
-            return '您今天已经达到充值上限';
+            return '您已经达到充值上限';
         }
 
         return true;