|
@@ -48,11 +48,10 @@ class ShopWalletBusiness extends BusinessResult
|
|
|
'money' => '余额',
|
|
|
];
|
|
|
|
|
|
- protected int $userId = 0;
|
|
|
- protected string $tableName = '';
|
|
|
+ protected string $walletName = '';
|
|
|
|
|
|
- public function __construct($tableName) {
|
|
|
- $this->tableName = $tableName;
|
|
|
+ public function __construct($orderName) {
|
|
|
+ $this->walletName = self::WALLET_TABLE[$orderName];
|
|
|
}
|
|
|
|
|
|
//获取钱包名称
|
|
@@ -94,7 +93,7 @@ class ShopWalletBusiness extends BusinessResult
|
|
|
}
|
|
|
|
|
|
//检测
|
|
|
- if (!$wallet = Db::name($this->tableName)->lock(true)->where(['shop_id' => $shop_id])->find()) {
|
|
|
+ if (!$wallet = Db::name($this->walletName)->lock(true)->where(['shop_id' => $shop_id])->find()) {
|
|
|
return $this->error('不存在的用户');
|
|
|
}
|
|
|
|
|
@@ -116,11 +115,11 @@ class ShopWalletBusiness extends BusinessResult
|
|
|
'updatetime' => time(),
|
|
|
];
|
|
|
//新的方式
|
|
|
- $upWallet = Db::name($this->tableName)->where(['shop_id' => $shop_id])->update([$accountType => $data['remain']]);
|
|
|
+ $upWallet = Db::name($this->walletName)->where(['shop_id' => $shop_id])->update([$accountType => $data['remain']]);
|
|
|
if ($upWallet === false) {
|
|
|
return $this->error("更新账户余额失败!");
|
|
|
}
|
|
|
- $logTableName = self::LOG_TABLE[$this->tableName];
|
|
|
+ $logTableName = self::LOG_TABLE[$this->walletName];
|
|
|
if (!Db::name($logTableName)->insertGetId($data)) {
|
|
|
return $this->error("更新财务记录失败!");
|
|
|
}
|