diff --git a/app/controller/api/server/StoreOrder.php b/app/controller/api/server/StoreOrder.php index 571d5182..7feaef9f 100755 --- a/app/controller/api/server/StoreOrder.php +++ b/app/controller/api/server/StoreOrder.php @@ -405,14 +405,14 @@ class StoreOrder extends BaseController return app('json')->success($list); } - + /** * 获取商户押金列表 */ public function getOrderAutoMarginList($merId){ [$page, $limit] = $this->getPage(); - $select= Db::name('financial_record')->where('mer_id',$merId)->where('type',1) - ->where('financial_type','auto_margin')->where('financial_pm',0) + $select= Db::name('financial_record')->where('mer_id',$merId) + ->where('financial_type','auto_margin') ->page($page)->limit($limit)->order('financial_record_id','desc')->select(); return app('json')->success($select); diff --git a/app/controller/api/store/merchant/Merchant.php b/app/controller/api/store/merchant/Merchant.php index a0b046a4..fe71060d 100755 --- a/app/controller/api/store/merchant/Merchant.php +++ b/app/controller/api/store/merchant/Merchant.php @@ -301,10 +301,10 @@ class Merchant extends BaseController if (empty($merchantInfo)) { return app('json')->fail('参数错误'); } - $margin = Db::name('MerchantType')->where('mer_type_id', $merchantInfo['type_id'])->value('margin'); - $merchantInfo['unpaid_margin'] = bcsub($margin, $merchantInfo['paid_margin'], 2); - if ($merchantInfo['margin'] == 0) { - $merchantInfo['margin'] = $merchantInfo['unpaid_margin']; + $merchantInfo['unpaid_margin'] = bcsub($merchantInfo['margin'], $merchantInfo['paid_margin'], 2); + if ($merchantInfo['margin'] <= 0) { + $merchantInfo['unpaid_margin'] = 0; + $merchantInfo['paid_margin'] = 0; } return app('json')->success($merchantInfo); }