40 lines
1.1 KiB
PHP

<?php
namespace app\controller\api\dataview;
use crmeb\basic\BaseController;
use app\common\repositories\system\merchant\MerchantRepository as repository;
use think\App;
use think\exception\ValidateException;
class Merchant extends BaseController
{
/**
* @var repository
*/
protected $repository;
public $areaCode; // 区县地区码
public $streetCode; // 镇街道地区码
public function __construct(App $app, repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
$this->areaCode = $this->request->param('areaCode', '');
$this->streetCode = $this->request->param('streetCode', '');
if ($this->areaCode == '' && $this->streetCode == '') {
throw new ValidateException('请选择地区');
}
}
// 商户列表
public function merchantList()
{
[$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));
}
}