更新银行

This commit is contained in:
mkm 2024-01-04 10:10:00 +08:00
parent d8a6083247
commit 5357e9fa08
2 changed files with 41 additions and 46 deletions

View File

@ -41,33 +41,34 @@ class FinancialRepository extends BaseRepository
Elm::radio('financial_type', '转账类型', $merchant->financial_type)
->setOptions([
['value' => 1, 'label' => '银行卡'],
['value' => 2, 'label' => '微信'],
['value' => 3, 'label' => '支付宝'],
// ['value' => 2, 'label' => '微信'],
// ['value' => 3, 'label' => '支付宝'],
])->control([
[
'value' => 1,
'rule'=> [
Elm::input('name', '姓名')->value($merchant->financial_bank->name??'')->required(),
Elm::input('name', '公司名称')->value($merchant->financial_bank->name??'')->required(),
Elm::input('bank', '开户银行')->value($merchant->financial_bank->bank??'')->required(),
Elm::input('bank_code', '银行卡号')->value($merchant->financial_bank->bank_code??'')->required(),
]
],
[
'value' => 2,
'rule'=> [
Elm::input('name', '姓名')->value($merchant->financial_wechat->name??'')->required(),
Elm::input('wechat', '微信号')->value($merchant->financial_wechat->wechat??'')->required(),
Elm::frameImage('wechat_code', '收款二维码', '/' . config('admin.merchant_prefix') . '/setting/uploadPicture?field=wechat_code&type=1')->value($merchant->financial_wechat->wechat_code??'')->modal(['modal' => false])->width('896px')->height('480px'),
]
],
[
'value' => 3,
'rule'=> [
Elm::input('name', '姓名')->value($merchant->financial_alipay->name??'')->required(),
Elm::input('alipay', '支付宝账号')->value($merchant->financial_alipay->alipay??'')->required(),
Elm::frameImage('alipay_code', '收款二维码', '/' . config('admin.merchant_prefix') . '/setting/uploadPicture?field=alipay_code&type=1')->value($merchant->financial_alipay->alipay_code??'')->modal(['modal' => false])->width('896px')->height('480px'),
Elm::input('bank_code', '对公账号')->value($merchant->financial_bank->bank_code??'')->required(),
Elm::input('bank_branch', '开户网点')->value($merchant->financial_bank->bank_branch??'')->required(),
]
],
// [
// 'value' => 2,
// 'rule'=> [
// Elm::input('name', '姓名')->value($merchant->financial_wechat->name??'')->required(),
// Elm::input('wechat', '微信号')->value($merchant->financial_wechat->wechat??'')->required(),
// Elm::frameImage('wechat_code', '收款二维码', '/' . config('admin.merchant_prefix') . '/setting/uploadPicture?field=wechat_code&type=1')->value($merchant->financial_wechat->wechat_code??'')->modal(['modal' => false])->width('896px')->height('480px'),
// ]
// ],
// [
// 'value' => 3,
// 'rule'=> [
// Elm::input('name', '姓名')->value($merchant->financial_alipay->name??'')->required(),
// Elm::input('alipay', '支付宝账号')->value($merchant->financial_alipay->alipay??'')->required(),
// Elm::frameImage('alipay_code', '收款二维码', '/' . config('admin.merchant_prefix') . '/setting/uploadPicture?field=alipay_code&type=1')->value($merchant->financial_alipay->alipay_code??'')->modal(['modal' => false])->width('896px')->height('480px'),
// ]
// ],
]),
]);
@ -93,24 +94,24 @@ class FinancialRepository extends BaseRepository
'bank_code' => $data['bank_code'],
];
break;
case 2:
$key = 'financial_wechat' ;
$update = [
'name' => $data['name'],
//'idcard' => $data['idcard'],
'wechat' => $data['wechat'],
'wechat_code' => $data['wechat_code'],
];
break;
case 3:
$key = 'financial_alipay' ;
$update = [
'name' => $data['name'],
//'idcard' => $data['idcard'],
'alipay' => $data['alipay'],
'alipay_code' => $data['alipay_code'],
];
break;
// case 2:
// $key = 'financial_wechat' ;
// $update = [
// 'name' => $data['name'],
// //'idcard' => $data['idcard'],
// 'wechat' => $data['wechat'],
// 'wechat_code' => $data['wechat_code'],
// ];
// break;
// case 3:
// $key = 'financial_alipay' ;
// $update = [
// 'name' => $data['name'],
// //'idcard' => $data['idcard'],
// 'alipay' => $data['alipay'],
// 'alipay_code' => $data['alipay_code'],
// ];
// break;
}
return app()->make(MerchantRepository::class)->update($merId,[$key => json_encode($update),'financial_type' => $data['financial_type']]);
}

View File

@ -45,9 +45,7 @@ class paySuccessOrderOther
$commission_rate = ($event['order']['commission_rate'] / 100);
//该笔订单平台总手续费
$realPrice = bcsub((string)$event['order']['total_price'], (string)$event['order']['extension_one'], 2);
$realPrice = bcsub($realPrice, (string)$event['order']['extension_two'], 2);
$this->totalAmount = bcmul($realPrice, (string)$commission_rate, 2);
$this->totalAmount = bcmul((string)$event['order']['total_price'], (string)$commission_rate, 2);
$this->remain = $this->totalAmount;
// $typeTownServerId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeTownServer'])->value('mer_type_id');
@ -82,11 +80,7 @@ class paySuccessOrderOther
}
Db::commit();
} catch (\Exception $e) {
if ($e->getCode() == 200) {
Db::commit();
} else {
Db::rollback();
}
Db::rollback();
Log::error('订单分润出错', ['code' => $e->getCode(), 'message' => $e->getMessage(), 'trace' => $e->getTraceAsString()]);
DingTalk::exception($e, '订单分润出错');
}