Commit 27d9f962 authored by hujun's avatar hujun

通过部门id获得门店列表

parent 133badac
......@@ -32,7 +32,7 @@ class Store extends Basic
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$field = 'a.id,a.district_id,a.store_name,a.create_time';
$where['a.status'] = 0;
$join = 0;
//门店名
if (!empty($this->params['store_name'])) {
$where['store_name'] = ['LIKE',$this->params['store_name'].'%'];
......@@ -95,8 +95,8 @@ class Store extends Basic
* @throws \think\exception\DbException
*/
public function getStoreById() {
$district = new AStore();
if ($this->params['id']) {
$district = new AStore();
$this->data = $district->getStoreById($this->params['id']);
} else {
$this->code = 101;
......@@ -105,4 +105,29 @@ class Store extends Basic
return $this->response($this->code, $this->msg, $this->data);
}
/**
* 通过部门id获取门店列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getStoreByDistrictId() {
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
if ($this->params['id']) {
$store = new AStore();
$field = 'id,district_id,store_name,create_time';
$where['district_id'] = $this->params['id'];
$where['status'] = 0;
$this->data = $store->getStoreList($pageNo, $pageSize, 'id DESC', $field, $where);
} else {
$this->code = 101;
$this->msg = 'id is null';
}
return $this->response($this->code, $this->msg, $this->data);
}
}
\ No newline at end of file
......@@ -131,6 +131,7 @@ Route::group('index', [
'storeList' => ['index/Store/index',['method'=>'get']], //门店列表
'addStore' => ['index/Store/addStore',['method'=>'get|post']], //添加门店
'getStoreById' => ['index/Store/getStoreById',['method'=>'get']], //通过id获得门店信息
'getDistrictStoreList' => ['index/Store/getStoreByDistrictId',['method'=>'get']], //通过部门id获得门店列表
]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment