Commit f383d40f authored by hujun's avatar hujun

总监列表

parent 7ae97ce9
......@@ -174,15 +174,27 @@ class Broker extends Basic
* 总监列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getDistrictList () {
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$agents = new AAgents();
$field = 'id,name,create_time,phone';
$where['level'] = ['IN','30,40'];
$field = 'id,name,create_time,phone,district_id';
$where['level'] = 40;
$where['status'] = 0;
$this->data = $agents->getList($pageNo, $pageSize, '', $field, '',$where);
if (isset($this->params['name'])) {
$where['name'] = ['LIKE',$this->params['name'].'%'];
}
if (isset($this->params['phone'])) {
$where['phone'] = ['LIKE',$this->params['phone'].'%'];
}
$this->data = $agents->getListDistrict($pageNo, $pageSize, 'id DESC', $field, $where);
return $this->response($this->code, $this->msg, $this->data);
}
}
\ No newline at end of file
......@@ -62,48 +62,38 @@ class Basic extends Controller
}
$this->userAuth($requestPath);
}
/**
* 权限判定
*
* @param $requestPath
* @return Response
*/
public function userAuth($requestPath){
$session= Session::get("userinfo.nav");
$r=0;
//判断当前控制器用户是否拥有进入权限
foreach ($session as $v){
//不区分大小写
if(strcasecmp(trim($v['name']),$requestPath)==0){
$r=$v;
$session = Session::get("userinfo.nav");
$rule = 0;
if ($session != NULL) {
//判断当前控制器用户是否拥有进入权限
foreach ($session as $v){
//不区分大小写
if (strcasecmp(trim($v['name']), $requestPath) == 0){
$rule = $v;
}
}
}
if($r=='0'){
if($this->request->isAjax()){
return $this->response('300','没有权限');
}else{
// $this->error('没有当前页面权限');
if ($rule == 0){
if ($this->request->isAjax()){
return $this->response('300','没有权限');
} else {
// $this->error('没有当前页面权限');
}
}else{
Session::set("userRule",$r);
} else {
Session::set("userRule",$rule);
}
//print_r($r);
}
/**
* 验证登录时效
*/
......@@ -135,11 +125,11 @@ class Basic extends Controller
return Response::create($result, $type);
}
public function navigation(){
public function navigation(){
$table=New AuthGroup;
$data=$table->where("pid=1")->select();
return $this->response(200, '', $data);
}
$data=$table->where("pid=1")->select();
return $this->response(200, '', $data);
}
/**
......
......@@ -119,4 +119,42 @@ public function saveList(){
return $r;
}
/**
* 总监列表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getListDistrict($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
$data = $this->field($field)
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
$district_where['status'] = 0;
$store_where['status'] = 0;
foreach ($data as $k=>$v){
$result[$k] = $v;
if (isset($v->district_id)) {
$district_where['id'] = $v->district_id;
$result[$k]['district_name'] = Db::table('a_district')->where($district_where)->value('district_name');
if ($result[$k]['district_name']) {
$store_where['district_id'] = $v->district_id;
$result[$k]['store_name'] = Db::table('a_store')->where($store_where)->column('store_name');
} else {
$result[$k]['store_name'] = '';
}
}
}
return $result;
}
}
\ 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