diff --git a/app/controller/admin/system/merchant/Merchant.php b/app/controller/admin/system/merchant/Merchant.php index cb184416..4f006c3f 100644 --- a/app/controller/admin/system/merchant/Merchant.php +++ b/app/controller/admin/system/merchant/Merchant.php @@ -190,7 +190,7 @@ class Merchant extends BaseController */ public function checkParam(MerchantValidate $validate, $isUpdate = false) { - $data = $this->request->params([['area_id',0],['street_id',0],['village_id',0],['category_id', 0], ['type_id', 0], 'mer_name', 'commission_rate', 'real_name', 'mer_phone', 'mer_keyword', 'mer_address', 'mark', ['sort', 0], ['status', 0], ['is_audit', 0], ['is_best', 0], ['is_bro_goods', 0], ['is_bro_room', 0], ['is_trader', 0],'sub_mchid', 'auto_margin_rate', 'paid_margin']); + $data = $this->request->params([['area_id',0],['street_id',0],['village_id',0],['category_id', 0], ['type_id', 0], 'mer_name', 'commission_rate', 'real_name', 'mer_phone', 'mer_keyword', 'mer_address', 'mark', ['sort', 0], ['status', 0], ['is_audit', 0], ['is_best', 0], ['is_bro_goods', 0], ['is_bro_room', 0], ['is_trader', 0],'sub_mchid', 'auto_margin_rate', 'paid_margin', 'first_margin']); if (!$isUpdate) { $data += $this->request->params(['mer_account', 'mer_password']); }else { diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index bd0a4424..93b140a2 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -280,13 +280,9 @@ class Auth extends BaseController if (!$merchant) { return app('json')->fail('用户店铺异常'); } - $merchantTypeInfo = Db::name('merchant_type')->where('mer_type_id', $merchant['type_id'])->find(); - if ($merchantTypeInfo['first_margin'] > 0) { - if (!$merchant['first_margin_status']) { - $merchant['margin'] = $merchantTypeInfo['first_margin']; - } + if ($merchant['first_margin'] > 0 && $merchant['first_margin_status'] == 0) { + $merchant['margin'] = $merchant['first_margin']; } - $repository = app()->make(StoreOrderRepository::class); $orderSn = "bzj" . date('YmdHis') . uniqid(); Db::name('margin_order')->insert([ diff --git a/app/controller/api/store/merchant/Merchant.php b/app/controller/api/store/merchant/Merchant.php index 8bf7c8ba..c6c31de9 100644 --- a/app/controller/api/store/merchant/Merchant.php +++ b/app/controller/api/store/merchant/Merchant.php @@ -264,18 +264,15 @@ class Merchant extends BaseController if(empty($id)){ return app('json')->fail('参数不能为空'); } - $merchantInfo = Db::name('merchant')->where('mer_id',$id)->field('uid,mer_id,type_id,mer_name,margin,paid_margin,is_margin,first_margin_status')->find(); + $merchantInfo = Db::name('merchant')->where('mer_id',$id)->field('uid,mer_id,type_id,mer_name,margin,paid_margin,is_margin,first_margin,first_margin_status')->find(); if(empty($merchantInfo)){ return app('json')->fail('参数错误'); } $merchantInfo['unpaid_margin'] = $merchantInfo['margin']; - $merchantTypeInfo = Db::name('merchant_type')->where('mer_type_id', $merchantInfo['type_id'])->find(); - if ($merchantTypeInfo['first_margin'] > 0) { - if ($merchantInfo['first_margin_status']) { - $merchantInfo['margin'] = $merchantInfo['margin']; - } else { - $merchantInfo['margin'] = $merchantTypeInfo['first_margin']; - } + if ($merchant['first_margin'] > 0 && $merchant['first_margin_status'] == 0) { + $merchantInfo['margin'] = $merchantInfo['first_margin']; + } else { + $merchantInfo['margin'] = $merchantTypeInfo['margin']; } return app('json')->success($merchantInfo); } diff --git a/app/listener/paySuccessMargin.php b/app/listener/paySuccessMargin.php index 1281a286..63dc7e83 100644 --- a/app/listener/paySuccessMargin.php +++ b/app/listener/paySuccessMargin.php @@ -31,9 +31,9 @@ class paySuccessMargin Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->update([ 'margin' => $marginAmount ]); - $merchantTypeInfo = Db::name('merchant_type')->where('mer_type_id', $merchantInfo['type_id'])->find(); - if ($merchantTypeInfo['first_margin'] > 0) { - if (!$merchantInfo['first_margin_status'] && ($marginInfo['total_price'] <= $merchantTypeInfo['first_margin'])) { + + if ($merchantInfo['first_margin'] > 0 && $merchantInfo['first_margin_status'] == 0) { + if ($marginInfo['total_price'] <= $merchantTypeInfo['first_margin']) { Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->update([ 'first_margin_status' => 1 ]); diff --git a/public/index.html b/public/index.html index 1b842b3f..7c53bab1 100644 --- a/public/index.html +++ b/public/index.html @@ -2,4 +2,4 @@ document.write('') if(window.location.protocol == 'https:'){ document.write('') - }