afa преди 4 месеца
родител
ревизия
3baa2a4c13

+ 4 - 3
application/api/controller/Order.php

@@ -101,8 +101,8 @@ class Order extends Api
         Db::startTrans();
         try {
 
-            //$amount = $ledgerWalletModel::getWalletTotalChaBao($this->auth->id);
-            //if(bccomp($order_info->freight, $amount, 2) > 0) throw new Exception(__("余额不足请前往充值"), 15001);
+            $amount = $ledgerWalletModel::getWalletChaBao($this->auth->id);
+            if(bccomp($order_info->freight, $amount, 2) > 0) throw new Exception(__("余额不足请前往充值"), 15001);
 
             // 生成订单
             $userArea->create(['name'=>$params['name'], 'type_id'=>$userArea::TakeAdders, 'phone'=>$params['phone'],'address'=>$params['address'],'order_id'=>$params['order_id']]);
@@ -111,7 +111,8 @@ class Order extends Api
             if(!empty($order_info->is_show) && $order_info->popular_price > config('min_rwa_price')) $userModel::updateForRwaNum($order_info->user_id, $userModel::getByParentId($order_info->user_id), 1, '-');
             
             //扣除运费
-            //if($order_info->freight > 0) $ledgerWalletModel->setChangeFrozen($this->auth->id, $order_info->freight, LedgerFrozenChangeModel::Freight, '-');
+            if($order_info->freight > 0) $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$order_info->freight, LedgerTokenChangeModel::Freight, $this->auth->id);
+
   
             $order_info->type_id = $productOrder::Popular;
             $order_info->status  = $productOrder::Shipped; 

+ 3 - 1
application/common/model/LedgerTokenChangeModel.php

@@ -38,6 +38,7 @@ class LedgerTokenChangeModel extends Model
     const Promotion         = 24; //推广奖励
     const TransferFee       = 25; //转让手续费 3
     const SharingFees       = 26; //手续费分润
+    const Freight           = 27; //运费
 
 
     /*
@@ -68,7 +69,6 @@ class LedgerTokenChangeModel extends Model
         self::Promotion         => '推广奖励',
     ];
 
-           
     public static function getStatusList()
     {
         return [
@@ -99,6 +99,8 @@ class LedgerTokenChangeModel extends Model
             self::Promotion => __('推广奖励'),
             self::TransferFee => __('转让手续费'),
             self::SharingFees => __('手续费分润'),
+            self::Freight => __('运费'),
+
 
            ];
     }

+ 1 - 0
public/assets/js/backend/ledger/ledger_token_change.js

@@ -60,6 +60,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                 24: '推广奖励',
                                 25: '转让手续费',
                                 26: '手续费分润',
+                                27: '运费',
 
                             }, operate: 'FIND_IN_SET', formatter: Table.api.formatter.label
                         },