Browse Source

赠送判断

afa 10 months ago
parent
commit
202e5de4ba

+ 2 - 2
application/api/controller/Order.php

@@ -210,10 +210,10 @@ class Order extends Api
             $order_info = $productOrder->where('id', $params['order_id'])->where('status', $productOrder::Paid)->find();
             if(empty($order_info)) throw new Exception(__("参数有误,无可用产品"));
 
-          
             $user = $userModel->getByAddress($params['address']);
             if(empty($user)) throw new Exception(__("赠送用户不存在"));    
-            
+            if($user['id'] == $this->auth->id) throw new Exception(__("赠送用户不能是自己"));  
+
             $chabao = $ledgerWalletModel::getWalletChaBao($this->auth->id);
             $fees   = bcmul($order_info['price'], getConfig('giveaway'), 2);   
             if(bccomp($fees, $chabao, 2) > 0) throw new Exception(__("余额不足请前往充值"));

+ 1 - 0
application/api/lang/en/order.php

@@ -15,6 +15,7 @@ return [
       '赠送'                                  => 'Giveaway',
       '关闭'                                  => 'Closure',
       '赠送用户不存在'                         => 'The gift user does not exist',
+      '赠送用户不能是自己'                     => 'The user who sends the gift cannot be yourself' 
 
 
 

+ 1 - 0
application/api/lang/zh-cn/order.php

@@ -15,5 +15,6 @@ return [
       '赠送'                  => '赠送',
       '关闭'                  => '关闭',
       '赠送用户不存在'         => '赠送用户不存在',
+      '赠送用户不能是自己'      => '赠送用户不能是自己'
       
 ];