Commit 5873a063 authored by clone's avatar clone

业绩监督执行列表

parent 5057c0e6
......@@ -388,4 +388,39 @@ class Performance extends Basic
return $this->response("200", "success", $result["date"]);
}
}
/**
* 获取时间段进场数据
* @return \think\Response
*/
public function superviseList()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
$params = array(
"agent_id" => 78,
"start_time" => "2018-06-12",
"end_time" => "2018-06-20",
"page_no" => 1,
"page_size" => 15
);
$checkResult = $this->validate($params, "PerformanceValidate.verifyOther");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
//默认排序一周
$end_day = !empty($params["end_time"]) ? $params["end_time"] : date("Y-m-d", strtotime("-1 day"));
$start_day = !empty($params["start_time"]) ? $params["start_time"] : date("Y-m-d", strtotime("-7 day"));
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$result = $this->service_->superviseList($params["agent_id"], $start_day, $end_day, $page_no, $page_size);
if ($result["code"] == 101) {
return $this->response("101", $result["date"]);
} else {
return $this->response("200", "success", $result["date"]);
}
}
}
......@@ -31,7 +31,8 @@ class Supervise extends Basic
*
* @return \think\Response
*/
public function add() {
public function add()
{
if (empty($this->params['id'])) {
return $this->response(101, 'Id is null');
......@@ -41,11 +42,11 @@ class Supervise extends Basic
$data['id'] = '';
$data['user_id'] = $this->agentId;
$data['usertable'] = empty($this->params['usertable'])? "" : $this->params['usertable'];
$data['usertable'] = empty($this->params['usertable']) ? "" : $this->params['usertable'];
$data['visitor'] = $this->agentPhone;
$data['visitor_name'] = $this->agentName;
$data['agentshopname'] = empty($this->params['agentshopname']) ? '' : $this->params['agentshopname'];
$data['leader_name'] = empty($this->params['leader_name']) ? '': $this->params['leader_name'];
$data['leader_name'] = empty($this->params['leader_name']) ? '' : $this->params['leader_name'];
$data['leader_phone'] = empty($this->params['leader_phone']) ? '' : $this->params['leader_phone'];
$data['address'] = $this->params['address'];
$data['remarks'] = $this->params['remarks'];
......@@ -56,7 +57,7 @@ class Supervise extends Basic
$data['modified'] = date('Y-m-d H:i:s');
$supervision->editData($data, $this->params['id']);
return $this->response(200, '', ['id'=>$this->params['id']]);
return $this->response(200, '', [ 'id' => $this->params['id'] ]);
}
/**
......@@ -64,29 +65,30 @@ class Supervise extends Basic
*
* @return \think\Response
*/
public function uploadSuperviseFile() {
public function uploadSuperviseFile()
{
$data['status'] = 101;
$data['msg'] = '';
$data['data'] = '';
$file = $this->request->file('file');
if($file){
$path = ROOT_PATH . 'public' . DS . 'resource'. DS . 'lib'. DS .'Attachments'. DS .'images'.DS.'supervise';
$info = $file->validate(['size'=>1024000,'ext'=>'jpg,png'])->move($path);
if($info){
if ($file) {
$path = ROOT_PATH . 'public' . DS . 'resource' . DS . 'lib' . DS . 'Attachments' . DS . 'images' . DS . 'supervise';
$info = $file->validate([ 'size' => 1024000, 'ext' => 'jpg,png' ])->move($path);
if ($info) {
$img_path = $info->getSaveName(); //生成的图片路径
$data['scene_photo'] = $img_path;
$data['created'] = date('Y-m-d H:i:s');
$data['visit_type'] = empty($this->params['visit_type']) ? 0:1; //拜访类型(0代表门店拜访、1代表监督执行)
$data['visit_type'] = empty($this->params['visit_type']) ? 0 : 1; //拜访类型(0代表门店拜访、1代表监督执行)
$supervision = new AgentsVisitors();
$supervision->editData($data);
$data['status'] = 200;
$data['msg'] = '上传成功';
$data['data'] = [
'file_name' => CK_IMG_URL .'images/supervise/' . $img_path,
'file_name' => CK_IMG_URL . 'images/supervise/' . $img_path,
'id' => $supervision->id
];
}else{
} else {
// 上传失败获取错误信息
$data['msg'] = $file->getError();
}
......@@ -105,7 +107,8 @@ class Supervise extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getSupervise() {
public function getSupervise()
{
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
......@@ -113,9 +116,9 @@ class Supervise extends Basic
$agent_data = $verify->getAgentInfo('level,store_id,district_id', $this->agentId);
if ($agent_data['level'] == 10) {
$where = 'a.user_id = '.$this->params['agent_id'];
$where = 'a.user_id = ' . $this->params['agent_id'];
} else {
$where = 'b.store_id = '.$agent_data['store_id'];
$where = 'b.store_id = ' . $agent_data['store_id'];
}
//拜访类型(0代表门店拜访、1代表监督执行)
......@@ -137,11 +140,11 @@ class Supervise extends Basic
if (empty($this->params['visit_type'])) {
foreach ($data['list'] as $k => $v) {
$data['list'][$k]['agent_address'] = $data['list'][$k]['province'].$data['list'][$k]['city'].$data['list'][$k]['district'].$data['list'][$k]['agent_address'];
$data['list'][$k]['agent_address'] = $data['list'][$k]['province'] . $data['list'][$k]['city'] . $data['list'][$k]['district'] . $data['list'][$k]['agent_address'];
}
}
foreach ($data['list'] as $k=>$v) {
$data['list'][$k]['scene_photo'] = CK_IMG_URL .'images/supervise/' . $v['scene_photo'];
foreach ($data['list'] as $k => $v) {
$data['list'][$k]['scene_photo'] = CK_IMG_URL . 'images/supervise/' . $v['scene_photo'];
}
$data['total'] = $supervision->getVisitorsListTotal($where);
return $this->response(200, '', $data);
......@@ -155,7 +158,8 @@ class Supervise extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function searchInfo() {
public function searchInfo()
{
$data['status'] = 200;
$data['data'] = '';
$data['msg'] = '';
......@@ -164,11 +168,11 @@ class Supervise extends Basic
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$where = 'a.status <> 2';
if ($this->params['search']) {
$where .= ' AND (concat(phone,name) like "%'.$this->params['search'].'%" or store_name like "%'.$this->params['search'].'%")';
$where .= ' AND (concat(phone,name) like "%' . $this->params['search'] . '%" or store_name like "%' . $this->params['search'] . '%")';
}
if ($this->params['level']) {
$where .= ' AND level in ('.$this->params['level'].')';
$where .= ' AND level in (' . $this->params['level'] . ')';
} else {
$where .= ' AND level in (20,40)';
}
......@@ -196,7 +200,7 @@ class Supervise extends Basic
$file = request()->file('image');
$data = [];
if ($file) {
$path = './resource' . DS . 'lib' . DS . 'Attachments'. DS . 'images'. DS . 'supervise';
$path = './resource' . DS . 'lib' . DS . 'Attachments' . DS . 'images' . DS . 'supervise';
$info = $file->validate([ 'size' => 10240000, 'ext' => 'jpg,png' ])//限制100m
->move($path);
if ($info) {
......@@ -207,7 +211,7 @@ class Supervise extends Basic
$data = [
'name' => $img_path,
'path' => CK_IMG_URL .'images/supervise/' . $img_path
'path' => CK_IMG_URL . 'images/supervise/' . $img_path
];
} else {
// 上传失败获取错误信息
......@@ -226,7 +230,8 @@ class Supervise extends Basic
* Date: 2018/6/20
* Time: 13:10:33
*/
public function addSupervise(){
public function addSupervise()
{
$params = $this->params;
/*
......@@ -238,13 +243,19 @@ class Supervise extends Basic
*/
if (!isset($params['agent_id']) || !isset($params['agent_name']) || !isset($params['remark']) || !isset($params['img'])) {
return $this->response("300", "参数不全", [ 'remote_groupid' => '' ]);
return $this->response("300", "参数不全");
}
$res = $this->aSuperviseModel->saveSupervise(['agent_id' => $params['agent_id'],'agent_name' => $params['agent_name'],'remark' => $params['remark'],'img' => $params['img'],'address' => $params['address']]);
//dump($UPhoneFollowPp->id);exit;
$insert["agent_id"] = $params['agent_id'];
$insert["agent_name"] = $params['agent_name'];
$insert["remark"] = $params['remark'];
$insert["img"] = $params['img'];
$insert["address"] = $params['address'];
$res = $this->aSuperviseModel->saveSupervise($insert);
if ($res) {
return $this->response("200", "success!",$res);
return $this->response("200", "success!", $res);
} else {
return $this->response("101", "失败!");
}
......@@ -257,7 +268,8 @@ class Supervise extends Basic
* Date: 2018/6/15
* Time: 13:10:33
*/
public function superviseList(){
public function superviseList()
{
$result = '';
......@@ -273,7 +285,7 @@ class Supervise extends Basic
//搜索条件 start
//1.上传时间
if (!empty($params['create_time_start']) && !empty($params['create_time_end'])) {
$where['a.create_time'] = ['between time', [$params['create_time_start']. ' 00:00:00', $params['create_time_end'] . ' 23:59:59']];
$where['a.create_time'] = [ 'between time', [ $params['create_time_start'] . ' 00:00:00', $params['create_time_end'] . ' 23:59:59' ] ];
}
//2.部门
......@@ -288,13 +300,13 @@ class Supervise extends Basic
//4.提交人手机号
if (!empty($params['phone'])) {
$where['b.phone'] = ['LIKE','%'.$params['phone'].'%'];
$where['b.phone'] = [ 'LIKE', '%' . $params['phone'] . '%' ];
}
//5.跟进内容
if (!empty($params['remark'])) {
$where['a.remark'] = ['LIKE','%'.$params['remark'].'%'];
$where['a.remark'] = [ 'LIKE', '%' . $params['remark'] . '%' ];
}
//搜索条件 end
......@@ -303,8 +315,8 @@ class Supervise extends Basic
$data['list'] = $this->aSuperviseModel->findSuperviseList($pageNo, $pageSize, 'a.id desc', $fields_evaluate, $where);
$data['total'] = $this->aSuperviseModel->findSuperviseListCount($fields_evaluate, $where);
foreach ($data['list'] as $k=>$v) {
$data['list'][$k]['supervise_img'] = CK_IMG_URL .'images/supervise/' . $v['supervise_img'];
foreach ($data['list'] as $k => $v) {
$data['list'][$k]['supervise_img'] = CK_IMG_URL . 'images/supervise/' . $v['supervise_img'];
}
//var_dump($result);
//return $result;
......
......@@ -3,6 +3,7 @@
namespace app\api_broker\service;
use app\model\AAgents;
use app\model\ASuperviseModel;
use app\model\GHouses;
use app\model\GHousesImgs;
use app\model\OBargainModel;
......@@ -32,6 +33,7 @@ class PerformanceService
private $marchInModel;
private $payLogModel;
private $gHousesImgModel;
private $superviseModel;
public function __construct()
{
......@@ -46,6 +48,7 @@ class PerformanceService
$this->marchInModel = new OMarchInModel();
$this->payLogModel = new OPayLogModel();
$this->gHousesImgModel = new GHousesImgs();
$this->superviseModel = new ASuperviseModel();
}
......@@ -620,6 +623,7 @@ class PerformanceService
}
return [ "code" => 200, "date" => $reportList ];
}
/**
* 获取进场数据
* @param $agent_id
......@@ -643,6 +647,7 @@ class PerformanceService
}
return [ "code" => 200, "date" => $addMarchInList ];
}
/**
* 获取收款数据
* @param $agent_id
......@@ -666,6 +671,7 @@ class PerformanceService
}
return [ "code" => 200, "date" => $payLogList ];
}
/**
* 获取业绩数据
* @param $type
......@@ -676,7 +682,7 @@ class PerformanceService
* @param $page_size
* @return array|false|\PDOStatement|string|\think\Collection
*/
public function performanceList($type,$agent_id, $start_time, $end_time, $page_no, $page_size)
public function performanceList($type, $agent_id, $start_time, $end_time, $page_no, $page_size)
{
$params = $this->getAgentId($agent_id, $type, $start_time, $end_time);
......@@ -687,4 +693,29 @@ class PerformanceService
return [ "code" => 200, "date" => $performanceList ];
}
/**
* 获取监督执行记录
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array
*/
public function superviseList($agent_id, $start_time, $end_time, $page_no, $page_size)
{
$params = $this->getAgentId($agent_id, 2, $start_time, $end_time);
if (!$params)
return [ "code" => 101, "date" => "传入的参数错误" ];
$field = "a.id,a.agent_id,a.agent_name,a.remark,a.img,a.address,a.create_time";
$where_["a.agent_id"] = $params["agent_id"];
$where_["a.create_time"] = $params["create_time"];
$superviseList = $this->superviseModel->findSuperviseList($page_no, $page_size, 'id desc', $field, $where_);
foreach ($superviseList as $k => $v) {
$superviseList[$k]['img'] = CK_IMG_URL . 'images/supervise/' . $v['img'];
}
return [ "code" => 200, "date" => $superviseList ];
}
}
\ No newline at end of file
......@@ -22,7 +22,7 @@ class UWxInfo extends Model
* 新增微信拉取用户信息
* @param $params
* @return int|string
* @throws Exception
* @throws Exception xx
*/
public function addWxInfo(array $params): int
{
......
......@@ -468,6 +468,7 @@ Route::group('broker', [
'marchInList' => [ 'api_broker/Performance/marchInList', [ 'method' => 'POST|GET' ] ], //进场list
'paylogList' => [ 'api_broker/Performance/paylogList', [ 'method' => 'POST|GET' ] ], //收款list
'performanceList' => [ 'api_broker/Performance/performanceList', [ 'method' => 'POST|GET' ] ], //业绩list
'superviseList' => [ 'api_broker/Performance/superviseList', [ 'method' => 'POST|GET' ] ], //监督执行list
//user
'returnSearchCondition' => [ 'api_broker/User/returnSearchCondition', [ '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