Commit 3f2880b5 authored by hujun's avatar hujun

门店列表分页数据

parent 9d32afdd
...@@ -58,7 +58,8 @@ class Store extends Basic ...@@ -58,7 +58,8 @@ class Store extends Basic
$join = 1; $join = 1;
} }
$store = new AStore(); $store = new AStore();
$this->data = $this->data = $store->getStoreList($pageNo, $pageSize, 'id DESC', $field, $where, $join); $this->data['list'] = $store->getStoreList($pageNo, $pageSize, 'id DESC', $field, $where, $join);
$this->data['total'] = $store->getStoreListTotal($where, $join);
$return = $this->response($this->code, $this->msg, $this->data); $return = $this->response($this->code, $this->msg, $this->data);
} else { } else {
//总监列表 //总监列表
......
...@@ -90,6 +90,8 @@ class AStore extends BaseModel ...@@ -90,6 +90,8 @@ class AStore extends BaseModel
} }
/** /**
* 门店列表
*
* @param int $pageNo * @param int $pageNo
* @param int $pageSize * @param int $pageSize
* @param string $order_ * @param string $order_
...@@ -137,4 +139,27 @@ class AStore extends BaseModel ...@@ -137,4 +139,27 @@ class AStore extends BaseModel
return $data; return $data;
} }
/**
* 门店列表总数
*
* @param $params
* @param int $join
* @return int|string
*/
public function getStoreListTotal($params, $join = 0) {
if ($join) {
$where['b.status'] = 0;
$where['b.level'] = ['in',[20,40]];
$store_num = $this->alias('a')->join('a_agents b','a.id=b.store_id','left')
->where($params)
->count();
} else {
$store_num = $this->alias('a')
->where($params)
->count();
}
return $store_num;
}
} }
\ No newline at end of file
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