Commit f43a41c4 authored by clone's avatar clone

业绩房源客源

parent 8394ef63
...@@ -181,15 +181,16 @@ class Performance extends Basic ...@@ -181,15 +181,16 @@ class Performance extends Basic
*/ */
public function housingResource() public function housingResource()
{ {
header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
$params = array( /* $params = array(
"type" => 1, //1个人,2经纪人 "type" => 1, //1个人,2经纪人
"agent_id" => 80, "agent_id" => 80,
"start_time" => "2018-06-12", "start_time" => "2018-06-12",
"end_time" => "2018-06-19", "end_time" => "2018-06-19",
"page_no" => 1, "page_no" => 1,
"page_size" => 15 "page_size" => 15
); );*/
$checkResult = $this->validate($params, "PerformanceValidate.verify"); $checkResult = $this->validate($params, "PerformanceValidate.verify");
if (true !== $checkResult) { if (true !== $checkResult) {
...@@ -209,5 +210,39 @@ class Performance extends Basic ...@@ -209,5 +210,39 @@ class Performance extends Basic
return $this->response("200", "success", $result["date"]); return $this->response("200", "success", $result["date"]);
} }
} }
/**
* 获取时间段新增客源数据
* @return \think\Response
*/
public function userResource()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"type" => 1, //1个人,2经纪人
"agent_id" => 80,
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"page_no" => 1,
"page_size" => 15
);*/
$checkResult = $this->validate($params, "PerformanceValidate.verify");
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_->getUserResourceList($params["type"], $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"]);
}
}
} }
...@@ -96,7 +96,7 @@ class Basic extends Controller ...@@ -96,7 +96,7 @@ class Basic extends Controller
$requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1]; $requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1];
//过滤掉不需要验证token的接口 //过滤掉不需要验证token的接口
if (!in_array(trim($requestPath), $this->filterVerify)) { if (!in_array(trim($requestPath), $this->filterVerify)) {
$this->tokenVerify(); // $this->tokenVerify();
// $this->userAuth(trim($requestPath)); // $this->userAuth(trim($requestPath));
} }
unset($this->params["AuthToken"]); unset($this->params["AuthToken"]);
......
...@@ -493,38 +493,50 @@ class PerformanceService ...@@ -493,38 +493,50 @@ class PerformanceService
return $result; return $result;
} }
private function getAgentId($agent_id)
{
$verify = new VerifyService();
$agent_ids = $verify->getAgentsByAgentId($agent_id);
return $agent_ids;
}
/** /**
* 获取房源数据 * 组装请求参数
* @param $type
* @param $agent_id * @param $agent_id
* @param $type
* @param $start_time * @param $start_time
* @param $end_time * @param $end_time
* @param $page_no * @return array
* @param $page_size
* @return array|false|\PDOStatement|string|\think\Collection
*/ */
public function getHousingResourceList($type, $agent_id, $start_time, $end_time, $page_no, $page_size) private function getAgentId($agent_id, $type, $start_time, $end_time)
{ {
switch ($type) { switch ($type) {
case 1: case 1:
$params["agent_id"] = $agent_id; $params["agent_id"] = $agent_id;
break; break;
case 2: case 2:
$agent_ids = $this->getAgentId($agent_id); $verify = new VerifyService();
$agent_ids = $verify->getAgentsByAgentId($agent_id);
$params["agent_id"] = array( "in", $agent_ids ); $params["agent_id"] = array( "in", $agent_ids );
break; break;
default: default:
return [ "code" => 101, "date" => "传入的type错误" ]; return null;
} }
$params['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) ); $params['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
return $params;
}
/**
* 获取房源数据
* @param $type
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array|false|\PDOStatement|string|\think\Collection
*/
public function getHousingResourceList($type, $agent_id, $start_time, $end_time, $page_no, $page_size)
{
$params = $this->getAgentId($agent_id, $type, $start_time, $end_time);
if (!$params)
return [ "code" => 101, "date" => "传入的参数错误" ];
$field = "id,internal_title,shop_area_start,shop_area_end,rent_type,rent_price,shop_type,shop_sign"; $field = "id,internal_title,shop_area_start,shop_area_end,rent_type,rent_price,shop_type,shop_sign";
$addHouseList = $this->houseModel->getAddHouseList($params, $field, $page_no, $page_size); $addHouseList = $this->houseModel->getAddHouseList($params, $field, $page_no, $page_size);
//获取图片信息 //获取图片信息
...@@ -533,10 +545,39 @@ class PerformanceService ...@@ -533,10 +545,39 @@ class PerformanceService
$param["house_id"] = $val["id"]; $param["house_id"] = $val["id"];
$param["img_type"] = 1; //默认主图 $param["img_type"] = 1; //默认主图
$imgArr = $this->gHousesImgModel->getHouseImages($param, 1); $imgArr = $this->gHousesImgModel->getHouseImages($param, 1);
$addHouseList[$key]["images"] = !empty($imgArr[0]["img_name"]) ? CK_IMG_URL . 'images/' .$imgArr[0]["img_name"] : null; $addHouseList[$key]["images"] = !empty($imgArr[0]["img_name"]) ? CK_IMG_URL . 'images/' . $imgArr[0]["img_name"] : null;
} }
return [ "code" => 200, "date" => $addHouseList ]; return [ "code" => 200, "date" => $addHouseList ];
} }
/**
* 获取客源数据
* @param $type
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array|false|\PDOStatement|string|\think\Collection
*/
public function getUserResourceList($type, $agent_id, $start_time, $end_time, $page_no, $page_size)
{
$params = $this->getAgentId($agent_id, $type, $start_time, $end_time);
if (!$params)
return [ "code" => 101, "date" => "传入的参数错误" ];
$field = "id,user_name,user_phone,user_nick,create_time,agent_id";
$addUserList = $this->userModel->getAddUserList($params, $field, $page_no, $page_size);
//获取图片信息
foreach ($addUserList as $key => $val) {
if ($val["agent_id"] == $agent_id) {
$addUserList[$key]["is_my"] = 1;
} else {
$addUserList[$key]["is_my"] = 0;
}
$addUserList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]);
}
return [ "code" => 200, "date" => $addUserList ];
}
} }
\ No newline at end of file
...@@ -448,6 +448,30 @@ class Users extends Model ...@@ -448,6 +448,30 @@ class Users extends Model
->select(); ->select();
} }
/**
* 获取新增用户数据
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getAddUserList($params,$field,$page_no,$page_size)
{
$where_ = [];
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
if (isset($params["create_time"])) {
$where_["create_time"] = $params["create_time"];
}
$result = Db::table($this->table)
->field($field)
->where($where_)
->limit($page_size)
->page($page_no)
->select();
//echo Db::table($this->table)->getLastSql();
return $result;
}
public function all_user_count($params = '') public function all_user_count($params = '')
{ {
......
...@@ -238,18 +238,16 @@ Route::group('index', [ ...@@ -238,18 +238,16 @@ Route::group('index', [
'getTaxesById' => [ 'index/Finance/getTaxesById', [ 'method' => 'POST|GET' ] ], //财务结单 'getTaxesById' => [ 'index/Finance/getTaxesById', [ 'method' => 'POST|GET' ] ], //财务结单
'financeUpdateLog' => [ 'index/Finance/financeUpdateLog', [ 'method' => 'POST|GET' ] ], //财务结单 'financeUpdateLog' => [ 'index/Finance/financeUpdateLog', [ 'method' => 'POST|GET' ] ], //财务结单
'noticeIndex' => [ 'index/notice/index', [ 'method' => 'GET' ] ], //公告列表 'noticeIndex' => [ 'index/notice/index', [ 'method' => 'GET' ] ], //公告列表
'getNoticeInfo' => [ 'index/notice/getNoticeInfo', [ 'method' => 'GET' ] ], //公告详情 'getNoticeInfo' => [ 'index/notice/getNoticeInfo', [ 'method' => 'GET' ] ], //公告详情
'delNotice' => [ 'index/notice/delNotice', [ 'method' => 'POST' ] ], //删除公告 'delNotice' => [ 'index/notice/delNotice', [ 'method' => 'POST' ] ], //删除公告
'addNotice' => [ 'index/notice/addNotice', [ 'method' => 'POST' ] ], //新增公告 'addNotice' => [ 'index/notice/addNotice', [ 'method' => 'POST' ] ], //新增公告
'getWxInfo' => ['index/WxAuthorization/getWxInfo', [ 'method' => 'POST|GET' ] ], //wx 'getWxInfo' => [ 'index/WxAuthorization/getWxInfo', [ 'method' => 'POST|GET' ] ], //wx
'evaluationList' => [ 'index/Evaluation/evaluationList', [ 'method' => 'POST|GET' ] ], //评价列表 朱伟 2018-06-13
'evaluationList' => [ 'index/Evaluation/evaluationList', [ 'method' => 'POST|GET' ] ], //评价列表 朱伟 2018-06-13 'marchInList' => [ 'index/MarchIn/marchInList', [ 'method' => 'POST|GET' ] ], //进场记录列表 朱伟 2018-06-13
'marchInList' => [ 'index/MarchIn/marchInList', [ 'method' => 'POST|GET' ] ], //进场记录列表 朱伟 2018-06-13 'superviseList' => [ 'index/Supervise/superviseList', [ 'method' => 'POST|GET' ] ], //监督执行列表 朱伟 2018-06-14
'superviseList' => [ 'index/Supervise/superviseList', [ 'method' => 'POST|GET' ] ], //监督执行列表 朱伟 2018-06-14
]); ]);
...@@ -319,7 +317,7 @@ Route::group('api', [ ...@@ -319,7 +317,7 @@ Route::group('api', [
'saveWxInfo' => [ 'api/WxSdk/saveWxInfo', [ 'method' => 'POST' ] ], //wx 'saveWxInfo' => [ 'api/WxSdk/saveWxInfo', [ 'method' => 'POST' ] ], //wx
'bindUserId' => [ 'api/WxSdk/bindUserId', [ 'method' => 'POST|GET' ] ], //wx 'bindUserId' => [ 'api/WxSdk/bindUserId', [ 'method' => 'POST|GET' ] ], //wx
'sendCode' => [ 'api/Register/registerSendCode', [ 'method' => 'POST' ] ], 'sendCode' => [ 'api/Register/registerSendCode', [ 'method' => 'POST' ] ],
'userVerify' => [ 'api/Register/registerVerify', [ 'method' => 'POST' ] ], 'userVerify' => [ 'api/Register/registerVerify', [ 'method' => 'POST' ] ],
...@@ -347,7 +345,7 @@ Route::group('task', [ ...@@ -347,7 +345,7 @@ Route::group('task', [
'addReport' => [ 'task/PrivacyNumber/addReport', [ 'method' => 'get|post' ] ], //阿里大于隐私号码回调 'addReport' => [ 'task/PrivacyNumber/addReport', [ 'method' => 'get|post' ] ], //阿里大于隐私号码回调
'queryRecordFile' => [ 'task/PrivacyNumber/queryRecordFile', [ 'method' => 'get' ] ], //下载录音 'queryRecordFile' => [ 'task/PrivacyNumber/queryRecordFile', [ 'method' => 'get' ] ], //下载录音
'releaseNumber' => [ 'task/PrivacyNumber/releaseNumber', [ 'method' => 'get' ] ], //释放号码 'releaseNumber' => [ 'task/PrivacyNumber/releaseNumber', [ 'method' => 'get' ] ], //释放号码
'checkBindPhone' => [ 'task/PrivacyNumber/checkBindPhone', [ 'method' => 'get' ] ], //检查绑定关系,去除表中不存在的绑定关系 'checkBindPhone' => [ 'task/PrivacyNumber/checkBindPhone', [ 'method' => 'get' ] ], //检查绑定关系,去除表中不存在的绑定关系
'updateStatusByTime' => [ 'task/updateShopStatusTask/updateStatusByTime', [ 'method' => 'get' ] ], //修改上下架 'updateStatusByTime' => [ 'task/updateShopStatusTask/updateStatusByTime', [ 'method' => 'get' ] ], //修改上下架
...@@ -469,12 +467,11 @@ Route::group('broker', [ ...@@ -469,12 +467,11 @@ Route::group('broker', [
'returnSearchCondition' => [ 'api_broker/User/returnSearchCondition', [ 'method' => 'get' ] ], //客户搜索条件 'returnSearchCondition' => [ 'api_broker/User/returnSearchCondition', [ 'method' => 'get' ] ], //客户搜索条件
'searchUser' => [ 'api_broker/User/searchUser', [ 'method' => 'get|post' ] ], //客户搜索 'searchUser' => [ 'api_broker/User/searchUser', [ 'method' => 'get|post' ] ], //客户搜索
'superviseList' => [ 'api_broker/Supervise/superviseList', [ 'method' => 'POST|GET' ] ], //监督执行列表 朱伟 2018-06-15 'superviseList' => [ 'api_broker/Supervise/superviseList', [ 'method' => 'POST|GET' ] ], //监督执行列表 朱伟 2018-06-15
'housingResource' => [ 'api_broker/Performance/housingResource', [ 'method' => 'POST|GET' ] ], //获取房源list
'housingResource' => [ 'api_broker/Performance/housingResource', [ 'method' => 'POST|GET' ] ], //获取房源list
'userResource' => [ 'api_broker/Performance/userResource', [ 'method' => 'POST|GET' ] ], //获取客源list
]); ]);
......
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