diff --git a/app/common/repositories/system/merchant/MerchantIntentionRepository.php b/app/common/repositories/system/merchant/MerchantIntentionRepository.php index beda1718..c4f5c0a6 100644 --- a/app/common/repositories/system/merchant/MerchantIntentionRepository.php +++ b/app/common/repositories/system/merchant/MerchantIntentionRepository.php @@ -116,7 +116,7 @@ class MerchantIntentionRepository extends BaseRepository $margin = app()->make(MerchantTypeRepository::class)->get($intention['mer_type_id']); $data['is_margin'] = $margin['is_margin'] ?? -1; - $data['margin'] = 0; + $data['margin'] = $margin['margin'] ?? 0; $merData = []; if ($create) { $password = substr($intention['phone'], -6); @@ -138,9 +138,7 @@ class MerchantIntentionRepository extends BaseRepository 'mer_password' => $password, 'is_margin' => $margin['is_margin'] ?? -1, // 用户需缴纳保证金 - 'recharge_margin' => $margin['margin'] ?? 0, - // 用户已缴纳保证金 - 'margin' => 0, + 'margin' => $margin['margin'] ?? 0, 'uid' => $intention['uid'], 'reg_admin_id' => $autoCreate ? 0: request()->adminId(), 'mer_intention_id' => $id diff --git a/app/common/repositories/system/serve/ServeOrderRepository.php b/app/common/repositories/system/serve/ServeOrderRepository.php index dc0f14e2..be43a534 100644 --- a/app/common/repositories/system/serve/ServeOrderRepository.php +++ b/app/common/repositories/system/serve/ServeOrderRepository.php @@ -98,7 +98,7 @@ class ServeOrderRepository extends BaseRepository $arr = [ 'type_id' => $ret['type_id'], 'is_margin' => $ret['is_margin'], - 'margin' => $ret['recharge_margin'], + 'margin' => $ret['margin'], ]; $param = [ 'status' => 0, @@ -109,7 +109,7 @@ class ServeOrderRepository extends BaseRepository 'pay_type' => $data['pay_type'], 'attach' => 'meal', 'order_info' => json_encode($arr,JSON_UNESCAPED_UNICODE), - 'pay_price' => $ret['recharge_margin'], + 'pay_price' => $ret['margin'], ]; return compact('key', 'param'); diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index b25e2989..0f44370b 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -286,7 +286,7 @@ class Auth extends BaseController 'uid' => $user['uid'], 'mer_id' => $merchant['mer_id'], 'order_sn' => $orderSn, - 'total_price' => $merchant['recharge_margin'], + 'total_price' => $merchant['margin'], 'pay_type' => 1, 'create_time' => date('Y-m-d H:i:s') ]); @@ -296,10 +296,10 @@ class Auth extends BaseController "mer_id" => $merchant['mer_id'], "pay_type" => 1, "attach" => "margin", - "order_info" => '{"is_margin":1,"margin":"' . $merchant['recharge_margin'] . '"}', - "pay_price" => $merchant['recharge_margin'], + "order_info" => '{"is_margin":1,"margin":"' . $merchant['margin'] . '"}', + "pay_price" => $merchant['margin'], "order_sn" => $orderSn, - "body" => $merchant['mer_name'] . ' - ' . $merchant['recharge_margin'], + "body" => $merchant['mer_name'] . ' - ' . $merchant['margin'], ]; $payType = 'weixinApp'; $service = new PayService($payType, $param); diff --git a/app/controller/api/store/merchant/Merchant.php b/app/controller/api/store/merchant/Merchant.php index 2f4c188c..1539d9fd 100644 --- a/app/controller/api/store/merchant/Merchant.php +++ b/app/controller/api/store/merchant/Merchant.php @@ -264,7 +264,7 @@ class Merchant extends BaseController if(empty($id)){ return app('json')->fail('参数错误'); } - $data = Db::name('merchant')->where('mer_id',$id)->field('uid,mer_id,mer_name,margin,recharge_margin,is_margin')->find(); + $data = Db::name('merchant')->where('mer_id',$id)->field('uid,mer_id,mer_name,margin,paid_margin,is_margin')->find(); return app('json')->success($data); } diff --git a/app/listener/paySuccessMargin.php b/app/listener/paySuccessMargin.php index 2124ea2f..535db236 100644 --- a/app/listener/paySuccessMargin.php +++ b/app/listener/paySuccessMargin.php @@ -26,11 +26,11 @@ class paySuccessMargin Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->update([ 'margin' => $marginAmount ]); - $rechargeAmount = (float)$merchantInfo['recharge_margin'] - (float)$marginInfo['total_price']; + $paidAmount = (float)$merchantInfo['paid_margin'] - (float)$marginInfo['total_price']; Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->update([ - 'recharge_margin' => $rechargeAmount + 'paid_margin' => $paidAmount ]); - if ($rechargeAmount <= 0) { + if ($paidAmount <= 0) { Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->update([ 'is_margin' => 10 ]);