Browse Source

更改商家钱包

Panda 14 hours ago
parent
commit
18395e5513
1 changed files with 13 additions and 8 deletions
  1. 13 8
      application/common/business/ShopWalletBusiness.php

+ 13 - 8
application/common/business/ShopWalletBusiness.php

@@ -37,16 +37,18 @@ class ShopWalletBusiness extends BusinessResult
      * 主表订单对应各自店铺表
      */
     public const LOG_TABLE = [
-        'hotel_wallet'            => 'hotel_money_log',
-        'hotel_canteen_wallet'    => 'hotel_canteen_money_log',
-        'university_event_wallet' => 'university_event_money_log',
-        'offline_shop_wallet'     => 'offline_shop_money_log',
-        'travel_wallet'           => 'travel_money_log',
+        'hotel_wallet'            => 'hotel',
+        'hotel_canteen_wallet'    => 'hotel_canteen',
+        'university_event_wallet' => 'university_event',
+        'offline_shop_wallet'     => 'offline_shop',
+        'travel_wallet'           => 'travel',
     ];
 
     // 操作钱包余额类型
     const money_type = [
-        'money' => '余额',
+        'money' => '40期收益',
+        'balance' => '余额',
+        'points' => '让利积分',
     ];
 
     protected string $walletName = '';
@@ -80,7 +82,7 @@ class ShopWalletBusiness extends BusinessResult
     {
         //获取小数点
         $point = 0;
-        if(in_array($accountType,['money','bean'])){
+        if(in_array($accountType,array_keys(self::money_type))){
             $point = 2;
         }
         bcscale($point);
@@ -120,7 +122,10 @@ class ShopWalletBusiness extends BusinessResult
         if ($upWallet === false) {
             return $this->error("更新账户余额失败!");
         }
-        $logTableName = self::LOG_TABLE[$this->walletName];
+
+        // 插入日志
+        $left_table = self::LOG_TABLE[$this->walletName];
+        $logTableName = "{$left_table}_{$accountType}_log";
         if (!Db::name($logTableName)->insertGetId($data)) {
             return $this->error("更新财务记录失败!");
         }