update 商户列表

This commit is contained in:
chenbo 2023-12-19 14:35:50 +08:00
parent ece5b572cf
commit 7e33d707a4

View File

@ -2,6 +2,7 @@
namespace app\controller\api\dataview;
use app\common\dao\system\merchant\MerchantDao;
use app\common\model\store\order\StoreOrderProduct;
use app\common\model\store\product\Product as model;
use app\common\model\user\UserVisit;
@ -45,7 +46,28 @@ class Merchant extends BaseController
{
[$page, $limit] = $this->getPage();
$where = $this->request->params([ 'status', 'statusTag', 'is_trader', 'category_id', 'type_id', 'area_id', 'street_id']);
return app('json')->success($this->repository->lst($where, $page, $limit));
$dao = new MerchantDao();
$query = $dao->search($where);
$count = $query->count($dao->getPk());
$list = $query->page($page, $limit)->setOption('field', [])
->where(function ($query) {
if ($this->streetCode != '') {
$query->where('street_id', $this->streetCode);
} else {
$query->where('area_id', $this->areaCode);
}
})
->with([
'admin' => function ($query) {
$query->field('mer_id,account');
},
'merchantCategory',
'merchantType'
])
->order('mer_id','desc')
->field('sort, mer_id, mer_name, real_name, mer_phone, mer_address, mark, status, create_time,is_best,is_trader,type_id,category_id,copy_product_num,export_dump_num,is_margin,margin,mer_avatar')->select();
return app('json')->success(compact('count', 'list'));
}
// 商户统计