增加$is_check参数处理,优化银行账户查询逻辑。
This commit is contained in:
parent
e5115f374b
commit
b994cf7521
@ -24,11 +24,12 @@ class MerchantController extends BaseApiController
|
|||||||
public function amount_account()
|
public function amount_account()
|
||||||
{
|
{
|
||||||
$merchant = $this->request->userInfo['merchant'];
|
$merchant = $this->request->userInfo['merchant'];
|
||||||
|
$is_check = $this->request->get('is_check',1);
|
||||||
if (!$merchant) {
|
if (!$merchant) {
|
||||||
return $this->fail('当前用户非商户');
|
return $this->fail('当前用户非商户');
|
||||||
}
|
}
|
||||||
if (!$merchant->isEmpty()) {
|
if (!$merchant->isEmpty()) {
|
||||||
$res=MerchantLogic::amount_account($merchant);
|
$res=MerchantLogic::amount_account($merchant,$is_check);
|
||||||
if(MerchantLogic::hasError()){
|
if(MerchantLogic::hasError()){
|
||||||
return $this->fail(MerchantLogic::getError());
|
return $this->fail(MerchantLogic::getError());
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,17 @@ class MerchantLogic extends BaseLogic
|
|||||||
/**
|
/**
|
||||||
* 获取用户余额和绑定银行账户信息
|
* 获取用户余额和绑定银行账户信息
|
||||||
*/
|
*/
|
||||||
public static function amount_account($merchant)
|
public static function amount_account($merchant,$is_check=1)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$mer_money = Merchant::where('mer_id', $merchant['mer_id'])->value('mer_money');
|
$mer_money = Merchant::where('mer_id', $merchant['mer_id'])->value('mer_money');
|
||||||
$bank_list = MerchantBank::where('mer_id', $merchant['mer_id'])->where('is_check', 1)->select()->each(function ($data) {
|
$where=['mer_id'=>$merchant['mer_id']];
|
||||||
|
if($is_check==1){
|
||||||
|
$where[]=['is_check','=',1];
|
||||||
|
}elseif($is_check==0){
|
||||||
|
$where[]=['is_check','=',0];
|
||||||
|
}
|
||||||
|
$bank_list = MerchantBank::where($where)->select()->each(function ($data) {
|
||||||
$bank_info = Bank::where('id', $data['bank_id'])->findOrEmpty();
|
$bank_info = Bank::where('id', $data['bank_id'])->findOrEmpty();
|
||||||
$data['bank_name'] = !$bank_info->isEmpty() ? $bank_info['name'] : '';
|
$data['bank_name'] = !$bank_info->isEmpty() ? $bank_info['name'] : '';
|
||||||
$data['bank_image'] = !$bank_info->isEmpty() ? $bank_info['image'] : '';
|
$data['bank_image'] = !$bank_info->isEmpty() ? $bank_info['image'] : '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user