更新相关文件,优化提现逻辑及商户、采购类目等逻辑。

This commit is contained in:
mkm 2024-05-23 13:57:41 +08:00
parent 358dfe078b
commit f5ec7fced5

View File

@ -95,6 +95,20 @@ class MerchantWithdrawLogic extends BaseLogic
'fail_msg' => $params['fail_msg'] ?? '',
'admin_id' => $admin_id
]);
if($params['is_check'] == 2){
if (!empty($data['mer_id'])) {
$merchant = Merchant::where('mer_id', $data['mer_id'])->findOrEmpty();
$merchant->where('mer_id', $data['mer_id'])->update([
'mer_money' => bcadd($merchant['mer_money'], $data['amount'], 2)
]);
}
if (!empty($data['supplier_id'])) {
$supplier = Supplier::where('id', $data['supplier_id'])->findOrEmpty();
$supplier->where('id', $data['supplier_id'])->update([
'mer_money' => bcadd($supplier['mer_money'], $data['amount'], 2)
]);
}
}
Db::commit();
return true;
} catch (\Exception $e) {
@ -133,18 +147,6 @@ class MerchantWithdrawLogic extends BaseLogic
'arrival_proof' => $params['arrival_proof'] ? json_encode($params['arrival_proof']) : null,
'arrival_user' => $admin_id
]);
if(!empty($data['mer_id'])){
$merchant = Merchant::where('mer_id',$data['mer_id'])->findOrEmpty();
$merchant->where('mer_id',$data['mer_id'])->update([
'mer_money' => bcsub($merchant['mer_money'],$data['amount'],2)
]);
}
if(!empty($data['supplier_id'])){
$supplier = Supplier::where('id',$data['supplier_id'])->findOrEmpty();
$supplier->where('id',$data['supplier_id'])->update([
'mer_money' => bcsub($supplier['mer_money'],$data['amount'],2)
]);
}
Db::commit();
return true;
} catch (\Exception $e) {