Commit 99a74b39 authored by hujun's avatar hujun

总监列表

parent cb2b3154
......@@ -11,7 +11,6 @@ namespace app\index\controller;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\ADistrict;
use app\model\Agents;
use app\model\GHousesToAgents;
......@@ -175,56 +174,7 @@ class Broker extends Basic
return $this->response($data['status'], $data['msg'], $data['data']);
}
/**
* 部门总监列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getDistrictList () {
$data['status'] = 200;
$data['data'] = '';
$data['msg'] = '';
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$search = $this->params['search'];
$agents = new AAgents();
$field = 'id,name,create_time,phone,district_id';
$where = '';
$where .= 'level=40 AND status=0';
if ($search != NULL) {
$where .= " AND (phone like '{$search}%' or name like '{$search}%')";
}
$data['list'] = $agents->getListDistrict($pageNo, $pageSize, 'id DESC', $field, $where);
$data['total'] = $agents->getListDistrictTotal($where);
return $this->response($data['status'], $data['msg'], $data);
}
/**
* 部门总监列表页面
*/
public function districtList() {
return view('agent/district');
}
/**
* 添加部门,绑定总监关系
*
* @return \think\Response
* @throws \think\exception\PDOException
*/
public function addDistrict () {
if ($this->params['department_name'] || $this->params['agents_id']) {
$district = new ADistrict();
$this->data = $district->addDepartmentAgents($this->params, $this->params['agents_id']);
} else {
$this->code = 101;
$this->msg = 'department or district is null';
}
return $this->response($this->code, $this->msg, $this->data);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/2/5
* Time: 15:19
*/
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\ADistrict;
class District extends Basic
{
/**
* 部门总监列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getDistrictList () {
$data['status'] = 200;
$data['data'] = '';
$data['msg'] = '';
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$search = $this->params['search'];
$agents = new AAgents();
$field = 'id,name,create_time,phone,district_id';
$where = '';
$where .= 'level=40 AND status=0';
if ($search != NULL) {
$where .= " AND (phone like '{$search}%' or name like '{$search}%')";
}
$data['list'] = $agents->getListDistrict($pageNo, $pageSize, 'id DESC', $field, $where);
$data['total'] = $agents->getListDistrictTotal($where);
return $this->response($data['status'], $data['msg'], $data);
}
/**
* 部门总监列表页面
*/
public function districtList() {
return view('index');
}
/**
* 添加部门,绑定总监关系
*
* @return \think\Response
* @throws \think\exception\PDOException
*/
public function addDistrict () {
if ($this->params['department_name'] || $this->params['agents_id']) {
$district = new ADistrict();
$this->data = $district->addDepartmentAgents($this->params, $this->params['agents_id']);
} else {
$this->code = 101;
$this->msg = 'department or district is null';
}
return $this->response($this->code, $this->msg, $this->data);
}
/**
* 根据部门名获取部门列表
*
* @return \think\Response
*/
public function getDistrictListByName() {
$data['status'] = 200;
$data['data'] = '';
$data['msg'] = '';
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$where['status'] = 0;
if ($this->params['district_name']) {
$where['district_name'] = ['LIKE', $this->params['district_name']. '%'];
}
if ($where) {
$agent = new ADistrict();
$field = 'id,district_name';
$data['data'] = $agent->getList($pageNo, $pageSize, 'id DESC', $field, $where);
} else {
$data['msg'] = '没有部门信息';
}
return $this->response($data['status'], $data['msg'], $data['data']);
}
}
\ No newline at end of file
......@@ -123,8 +123,12 @@ Route::group('index', [
'editExclusive' => ['index/houses/editExclusive', ['method' => 'post']], //添加和编辑楼盘独家
'getExclusive' => ['index/houses/getExclusive', ['method' => 'get']], //获取楼盘独家
'getRecords' => ['index/houses/getRecords',['method'=>'get']], //操作记录
'getDistrictList' => ['index/broker/getDistrictList',['method'=>'get']], //总监列表
'districtList' => ['index/broker/districtList',['method'=>'get']], //总监列表
'getDistrictList' => ['index/district/getDistrictList',['method'=>'get']], //总监列表
'districtList' => ['index/district/districtList',['method'=>'get']], //总监列表
'adddistrict' => ['index/district/addDistrict',['method'=>'post']], //添加部门,绑定总监关系
'storeList' => ['index/Store/index',['method'=>'get']], //门店列表
'addStore' => ['index/Store/addStore',['method'=>'get']], //添加门店
'getDistrictListByName' => ['index/broker/getDistrictListByName',['method'=>'get']], //添加门店
]);
......
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