Merge pull request 'dev' (#15) from dev into preview

Reviewed-on: #15
This commit is contained in:
mkm 2023-09-25 14:00:19 +08:00
commit f6479968b5
2 changed files with 10 additions and 4 deletions

View File

@ -196,7 +196,7 @@ class MerchantIntention extends BaseController
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
$res = $this->sendMerIntentionApply($sendData, $postUrl);
if (!$res['ok']) {
Db::name('merchant_integntion')->where('mer_intention_id', $intentionId)->delete();
Db::name('merchant_intention')->where('mer_intention_id', $intentionId)->delete();
throw new ValidateException('商户交易申请失败,' . $res['msg']);
}
Db::name('merchant')->where('uid', $this->userInfo->uid)->where('status', 1)->update(['business_status'=>1]);

View File

@ -21,10 +21,16 @@ class paySuccessMargin
'paid' => 1,
'pay_time' => date('Y-m-d H:i:s')
]);
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->inc('margin',$marginInfo['total_price']);
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->dec('recharge_margin',$marginInfo['total_price']);
$merchantInfo = Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->find();
if ($merchantInfo['recharge_margin'] <= 0) {
$marginAmount = (float)$merchantInfo['margin'] + (float)$marginInfo['total_price'];
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->update([
'margin' => $marginAmount
]);
$rechargeAmount = (float)$marginInfo['recharge_margin'] - (float)$merchantInfo['total_price'];
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->update([
'recharge_margin' => $rechargeAmount
]);
if ($rechargeAmount <= 0) {
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->update([
'is_margin' => 10
]);