Commit 4fa1773a authored by hujun's avatar hujun

监督执行列表

parent be279e2e
......@@ -71,4 +71,40 @@ class Supervise 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 getSupervise() {
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$supervision = new SSupervision();
$fields = 'content,img_url,b.name';
if (isset($this->params['agent_id'])) {
$where['agent_id'] = $this->params['agent_id'];
}
if (isset($this->params['district_id'])) {
$where['district_id'] = $this->params['district_id'];
}
if (isset($this->params['store_id'])) {
$where['store_id'] = $this->params['store_id'];
}
if (empty($where)) {
return $this->response(101, 'Params is error');
}
$data['list'] = $supervision->getSupervisionList($pageNo, $pageSize, 'a.id desc', $fields, $where);
$data['total'] = $supervision->getSupervisionListTotal($where);
return $this->response(200, '', $data);
}
}
\ No newline at end of file
......@@ -13,4 +13,39 @@ class SSupervision extends BaseModel
{
protected $table = 's_supervision';
/**
* 监督执行列表
*
* @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 getSupervisionList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
return $this->field($field)->alias('a')
->join('a_agents b', 'a.agent_id=b.id','left')
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
/**
* 监督执行列表总记录数
*
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getSupervisionListTotal($params = '') {
return $this->alias('a')
->join('a_agents b', 'a.agent_id=b.id','left')
->where($params)
->count();
}
}
\ No newline at end of file
......@@ -370,6 +370,7 @@ Route::group('broker', [
'uploadSuperviseFile' => ['api_broker/Supervise/uploadSuperviseFile', ['method' => 'post']], //监督执行上传图片
'add_supervise' => ['api_broker/Supervise/add', ['method' => 'post']], //监督执行
'addBargain' => ['api_broker/OrderLog/addBargain', [ 'method' => 'post' ] ], //新增成交报告佣金(分佣提成)
'getSupervise' => ['api_broker/Supervise/getSupervise', [ '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