update 微信支付-子商户管理

This commit is contained in:
chenbo 2023-11-10 17:17:30 +08:00
parent 3bad1c1183
commit bdc728dce6
2 changed files with 103 additions and 77 deletions

View File

@ -18,6 +18,7 @@ namespace app\adminapi\lists;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\SubMerchant;
use app\common\lists\ListsSearchInterface;
use think\facade\Db;
/**
@ -39,6 +40,7 @@ class SubMerchantLists extends BaseAdminDataLists implements ListsSearchInterfac
{
return [
'=' => ['sub_merchant_name', 'sub_mch_id', 'province', 'city', 'area', 'street', 'village'],
];
}
@ -58,6 +60,18 @@ class SubMerchantLists extends BaseAdminDataLists implements ListsSearchInterfac
->field(['id', 'sub_merchant_name', 'sub_mch_id', 'province', 'city', 'area', 'street', 'village'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->withAttr('province',function($value,$data){
return Db::name('geo_province')->where('province_code',$value)->value('province_name');
})
->withAttr('city',function($value,$data){
return Db::name('geo_city')->where('city_code',$value)->value('city_name');
})
->withAttr('area',function($value,$data){
return Db::name('geo_area')->where('area_code',$value)->value('area_name');
})
->withAttr('street',function($value,$data){
return Db::name('geo_street')->where('street_code',$value)->value('street_name');
})
->select()
->toArray();
}

View File

@ -113,6 +113,18 @@ class SubMerchantLogic extends BaseLogic
*/
public static function detail($params): array
{
return SubMerchant::findOrEmpty($params['id'])->toArray();
return SubMerchant::findOrEmpty($params['id']) ->withAttr('province',function($value,$data){
return Db::name('geo_province')->where('province_code',$value)->value('province_name');
})
->withAttr('city',function($value,$data){
return Db::name('geo_city')->where('city_code',$value)->value('city_name');
})
->withAttr('area',function($value,$data){
return Db::name('geo_area')->where('area_code',$value)->value('area_name');
})
->withAttr('street',function($value,$data){
return Db::name('geo_street')->where('street_code',$value)->value('street_name');
})
->toArray();
}
}