Commit c84e7cdf authored by clone's avatar clone

Merge branch 'test'

# Conflicts: # application/api_broker/service/BrokerService.php
parents af0cdff9 acae14ae
No preview for this file type
......@@ -213,9 +213,11 @@ class Shop extends Basic
*/
public function filtrateCondition()
{
$params = $this->params;
$city_code = isset($params["city_code"]) ? $params["city_code"] : "330000"; //上海310000 浙江 330000
$regions = new Regions();
$cityList = $regions->getRegionsCitySH();
$cityList = $regions->getRegionsCitySH($city_code);
$i = 0;
$result["area"][$i]["city"] = "全部";
$result["area"][$i]["disc"][] = "全部";
......@@ -230,7 +232,7 @@ class Shop extends Basic
$result["area"][$i]["disc"][] = $item;
}
}
break; //目前只有上海和杭州其余的先不显示
}
$result['yetai'] = array( '全部', '餐饮美食', '百货零售', '服装', '亲子教育', '休闲娱乐', '办公', '其他' );
......
......@@ -144,7 +144,7 @@ class Broker extends Basic
if ($params["phone"] != "13918937742") {
$is_login = $this->brokerService->judgeBand($params["device_id"], $agents_data['id'], $params["model"], 0, $params["push_id"], 0);
if (!$is_login) {
return $this->response("102", "该账号没有绑定该手机,请致电财务徐伟洋进行绑定。");
return $this->response("102", "该账号没有绑定该手机,请先向店长申请,由店长致电财务徐伟洋。");
}
}
......
......@@ -60,27 +60,29 @@ class Client extends Basic
$user_agent_id = $this->user->getUserById('id,user_name,agent_id', $this->params['id']); //查询原始客方
//编辑
$data['start'] = $this->user->edit($this->params, $this->params['id']);
//是否修改客方
if ($this->params['agents_id'] != $user_agent_id['agent_id']) {
$agent = new AAgents();
$agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']);
$remark = '修改为'.$agent_data['name'].'-'.$agent_data['phone'];
$push = new PushMessageService();
$ccr_agent_data = $agent->getAgentInfo('name,phone', $this->params['ccr_id']);
$content = "【{$ccr_agent_data['name']}-{$ccr_agent_data['phone']}修改了{$user_agent_id['user_name']}(id:{$user_agent_id['id']})客方】";
$push->pushMessageById($user_agent_id['agent_id'], '客方修改', $content, 'user_info', $user_agent_id['id']);
$this->operating_records($this->params['ccr_id'], $type=3, $remark,0,$this->params['id']);
$data['start'] = $this->user->edit($this->params, $this->params['id'], $this->agentId);
if (!empty($this->params['agents_id'])) {
//是否修改客方
if ($this->params['agents_id'] != $user_agent_id['agent_id']) {
$agent = new AAgents();
$agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']);
$remark = '修改为'.$agent_data['name'].'-'.$agent_data['phone'];
$push = new PushMessageService();
$ccr_agent_data = $agent->getAgentInfo('name,phone', $this->params['ccr_id']);
$content = "【{$ccr_agent_data['name']}-{$ccr_agent_data['phone']}修改了{$user_agent_id['user_name']}(id:{$user_agent_id['id']})客方】";
$push->pushMessageById($user_agent_id['agent_id'], '客方修改', $content, 'user_info', $user_agent_id['id']);
$this->operating_records($this->params['ccr_id'], $type=3, $remark,0,$this->params['id']);
}
}
} else {
$table = new AAgents();
//添加
$data['start'] = $this->user->edit($this->params);
$data['start'] = $this->user->edit($this->params, 0, $this->agentId);
if ($data['start'] > 0) {
if ($data['start'] > 0 && !empty($this->params['agents_id'])) {
$data['id']= $this->user->id;
$agent_data = $table->getAgentInfo('name,phone',$this->params['agents_id']);
$remark = '新增为'. $agent_data['name'].'-'.$agent_data['phone'];
......
......@@ -67,6 +67,8 @@ class HomePageLog extends Basic
$where_["a.name|a.phone"] = array( "like", "%" . trim($params["name_or_phone"]) . "%" );
}
$where_["u.city"] = trim($this->city);
$join = [
[ 'a_agents a', 'a.id=f.agent_id', 'left' ],
[ 'u_users u', 'u.id=f.user_id', 'left' ],
......@@ -130,7 +132,16 @@ class HomePageLog extends Basic
$where_["a.phone|a.name"] = array( "like", "%" . trim($params["name_or_phone"]) . "%" );
}
$where_["c.city"] = "上海市";
if (empty($params['city'])) {
$where_["c.city"] = trim($this->city);
} else {
$where_["c.city"] = $params['city'];
}
if (!empty($params['disc'])) {
$where_["c.disc"] = $params['disc'];
}
$join = [
[ 'a_agents a', 'a.id=f.agent_id', 'left' ],
[ 'a_store b', 'b.id=a.store_id', 'left' ],
......
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\extra\RedisExt;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/8/7
* Time : 11:31
* Intro:
*/
class Location extends Basic
{
private $redis_;
const CITY_AGENTS = "agent_city_";
public function __construct($request = null)
{
parent::__construct($request);
$this->redis_ = RedisExt::getRedis();
}
public function saveSiteCity()
{
$params = $this->params;
/* $params = array(
"agent_id" => 1,
"city" => "上海市"
);*/
$checkResult = $this->validate($params, "LocationValidate.saveSiteCityVerify");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$city = "上海市";
$agent_id = $params["agent_id"];
if ($params["city"] == "杭州市" || $params["city"] == "杭州") {
$city = "杭州市";
}
if ($this->redis_) {
$this->redis_->set(self::CITY_AGENTS . $agent_id, $city);
} else {
return $this->response("101", "redis service not found");
}
return $this->response("200", "success", []);
}
}
\ No newline at end of file
......@@ -37,24 +37,21 @@ class Performance extends Basic
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/*$params = array(
"agent_id" => 80,
"type" => 3, //1表示个人业绩排行 2门店 3区域
"end_day" => "",
"start_day" =>""
);*/
/* $params = array(
"agent_id" => 80,
"type" => 3, //1表示个人业绩排行 2门店 3区域
"end_day" => "",
"start_day" =>""
);*/
if (!isset($params["agent_id"]) || !isset($params["type"])) {
return $this->response("101", "请求参数错误");
}
//默认排序一周 2018-07-18改为本月
$end_day = !empty($params["end_day"]) ? $params["end_day"] : date("Y-m-d", strtotime("-1 day"));
//$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-d", strtotime("-7 day"));
$end_day = !empty($params["end_day"]) ? $params["end_day"] : date("Y-m-d", time());
$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-01", time());
$list = $this->service_->totalAgent($params["agent_id"], $params["type"], $end_day, $start_day);
//dump($list);
$list = $this->service_->totalAgent($params["agent_id"], $params["type"], $start_day, $end_day);
if (count($list) > 0) {
$result["list"] = $list;
$result["start_time"] = $start_day;
......@@ -73,13 +70,13 @@ class Performance extends Basic
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"agent_id" => 9,
"start_time" => "2018-06-20",
"end_time" => "2018-06-20",
"is_case" => 1,//1经纪人 2案场
"house_id" => 0
);*/
/* $params = array(
"agent_id" => 9,
"start_time" => "2018-06-20",
"end_time" => "2018-06-20",
"is_case" => 1,//1经纪人 2案场
"house_id" => 0
);*/
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"]) || !isset($params["is_case"])) {
return $this->response("101", "请求参数错误");
}
......@@ -105,11 +102,11 @@ class Performance extends Basic
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"agent_id" => 5739,
"start_time" => "2018-06-25",
"end_time" => "2018-06-25",
);*/
/* $params = array(
"agent_id" => 5739,
"start_time" => "2018-06-25",
"end_time" => "2018-06-25",
);*/
try {
$result = $this->service_->storePerformance($params["agent_id"], $params["start_time"], $params["end_time"]);
return $this->response("200", "request success", $result);
......@@ -126,13 +123,13 @@ class Performance extends Basic
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"agent_id" => 6,
"start_time" => "2018-04-09",
"end_time" => "2018-04-12",
"is_case" => 1,//1经纪人 2案场
"house_id" => 0,
"type" => 1 // 1带看 2进场 3收款 4成交报告
/* $params = array(
"agent_id" => 5740,
"start_time" => "2018-08-08",
"end_time" => "2018-08-08",
"is_case" => 2,//1经纪人 2案场
"house_id" => 7311,
"type" => 4 // 1带看 2进场 3收款 4成交报告
);*/
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"]) || !isset($params["type"])) {
return $this->response("101", "请求参数错误");
......
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\PerformanceUtilService;
use think\Exception;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/8/8
* Time : 14:02
* Intro:
*/
class PerformanceStatistics extends Basic{
private $service_;
function __construct(Request $request = null)
{
parent::__construct($request);
$this->service_ = new PerformanceUtilService();
}
/**
* 个人业绩
* @return \think\Response
*/
public function agentPerformanceBySearch()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"agent_id" => 9,
"start_time" => "2018-06-20",
"end_time" => "2018-06-20",
"is_case" => 1,//1经纪人 2案场
"house_id" => 0
);*/
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"]) || !isset($params["is_case"])) {
return $this->response("101", "请求参数错误");
}
$house_id = 0;
if (isset($params["house_id"])) {
$house_id = $params["house_id"];
}
try {
$result = $this->service_->personagePerformance($params["agent_id"], $params["start_time"], $params["end_time"],
$params["is_case"], $house_id);
return $this->response("200", "request success", $result);
} catch (Exception $exception) {
return $this->response("101", "request error,msg:" . $exception);
}
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\LookShopService;
use app\api_broker\service\VerifyService;
use app\index\validate\HouseValidate;
use app\model\AAgents;
use app\model\ACollectHouse;
use app\model\AttentionModel;
......@@ -85,7 +86,8 @@ class Shop extends Basic
} else {
$field = "id,internal_title as title,internal_address as address,city,disc,business_district_id,status,industry_type
,shop_area_start,shop_area_end,shop_type,residue_num,shop_sign,is_carefully_chosen,rent_type,rent_price";
$conditions["city"] = "上海市";
$conditions["city"] = trim($this->city);
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
......@@ -307,7 +309,7 @@ class Shop extends Basic
$result["plan_images"] = $this->gHousesImgModel->getHouseImages($param, 1);
if ($params['site_area'] == 3 || $params["site_area"] == 4) {
$result['landlord_phone'] = json_decode($result['landlord_phone'], true);
$result['create_time'] = date('Y-m-d', strtotime($result['create_time']));
// $result['create_time'] = date('Y-m-d', strtotime($result['create_time']));
}
if ($params['site_area'] == 4) {
......@@ -360,12 +362,13 @@ class Shop extends Basic
//独家方
if ($result['is_exclusive_type'] == 1) {
$m_house_agent = new GHousesToAgents();
$where_house['is_del'] = 0;
$where_house['type'] = 3;
$where_house['houses_id'] = $result['id'];
$house_agent_data = $m_house_agent->getAgentsByHouseId('name,phone', $where_house);
$result['exclusive_user'] = $house_agent_data[0]['name'] . '-' . $house_agent_data[0]['phone'];
$m_house_agent = new GHousesToAgents();
$where_house['is_del'] = 0;
$where_house['type'] = 3;
$where_house['houses_id'] = $result['id'];
$house_agent_data = $m_house_agent->getAgentsByHouseId('name,phone', $where_house);
$result['exclusive_user'] = $house_agent_data[0]['name'];
$result['exclusive_phone'] = $house_agent_data[0]['phone'];
}
}
......@@ -402,6 +405,13 @@ class Shop extends Basic
$result['data'] = [];
if ($this->request->isPost()) {
$validate = new HouseValidate();
$check = $validate->check($this->params);
if(true !== $check){
return $this->response(101, $validate->getError());
}
$house_id = $this->gHousesModel->app_add($this->params, $this->agentId); //添加或编辑商铺
if ($house_id) {
$result['data']['house_id'] = $house_id['house_id'];
......@@ -438,6 +448,12 @@ class Shop extends Basic
$result['data'] = [];
if ($this->request->isPost()) {
$validate = new HouseValidate();
$check = $validate->check($this->params);
if(true !== $check){
return $this->response(101, $validate->getError());
}
$house_id = $this->gHousesModel->app_addV2($this->params, $this->agentId); //添加或编辑商铺
if ($house_id) {
$result['data']['house_id'] = $house_id['house_id'];
......
......@@ -61,19 +61,23 @@ class User extends Basic
public function searchUser()
{
$params = $this->params;
/*$params = array(
"user_status" => 0,//客户状态(0:求租;1:已租;-1:无效)
"yetai" => "休闲娱乐",
"area_start" => 1,//面积起始范围 room_area2
"area_end" => 65,//面积结束范围
"money_start" => 1,//租金 price2
"money_end" => 10000,//租金
"start_time" => "2016-05-25",
"end_time" => "2018-05-30",
"pageNo" => 1,
"pageSize" => 15,
"status" => -1,
);*/
/* $params = array(
"user_status" => 0,//客户状态(0:求租;1:已租;-1:无效)
"yetai" => "休闲娱乐",
"area_start" => 1,//面积起始范围 room_area2
"area_end" => 65,//面积结束范围
"money_start" => 1,//租金 price2
"money_end" => 10000,//租金
"start_time" => "2016-05-25",
"end_time" => "2018-05-30",
"id" => 1,
"user_name" => "12312",
"user_phone" => "138171212",
"pageNo" => 1,
//"agent_id" => 5741,//传经纪人id代表我得客户
"pageSize" => 15,
"status" => -1,
);*/
$field = "id as user_id,sex,user_name,user_phone,user_status,agent_id,create_time,industry_type,price_demand,area_demand,vip";
$conditions = [];
......@@ -81,10 +85,22 @@ class User extends Basic
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$conditions["city"] = trim($this->city);
if (isset($params['user_status'])) {
$conditions['user_status'] = $params['user_status'];
} else {
return $this->response("101", "请求参数错误");
}
if (isset($params['id'])) {
$conditions['id'] = $params['id'];
}
if (isset($params['user_name'])) {
$conditions['user_name'] = array( "like", "%" . trim($params['user_name']) . "%" );
}
if (isset($params['user_phone'])) {
$conditions['user_phone'] = array( "like", "%" . trim($params['user_phone']) . "%" );
}
if (isset($params['yetai'])) {
......@@ -93,6 +109,7 @@ class User extends Basic
$area_start = isset($params['area_start']) ? $params['area_start'] : -1;
$area_end = isset($params['area_end']) ? $params['area_end'] : -1;
if ($area_start >= 0 && $area_end >= 0) { //面积
$conditions['area_demand'] = array( 'between', array( $area_start, $area_end ) );
$conditions['area_demand'] = array( 'between', array( $area_start, $area_end ) );
......@@ -100,8 +117,10 @@ class User extends Basic
$conditions['area_demand'] = array( 'egt', $area_start );
$conditions['area_demand'] = array( 'egt', $area_start );
}
$price_start = isset($params['money_start']) ? $params['money_start'] : -1;
$price_end = isset($params['money_end']) ? $params['money_end'] : -1;
if ($price_start >= 0 && $price_end >= 0) { //金额
$conditions['price_demand'] = array( 'between', array( $price_start, $price_end ) );
} else if ($price_start >= 0 && $price_end < 0) {
......@@ -112,7 +131,7 @@ class User extends Basic
$start_time = date('Y-m-d H:i:s', $params['start_time']);
$end_time = date('Y-m-d H:i:s', $params['end_time']);
$conditions['create_time'] = array( 'between', array( $start_time, $end_time ) );
} else {
} else if(empty($params["agent_id"]) && empty($params["id"]) && empty($params["user_phone"])) {
$time_ = date('Y-m-d H:i:s', strtotime("-1 day"));
$conditions['create_time'] = array( 'lt', $time_ );
}
......@@ -120,22 +139,100 @@ class User extends Basic
if (isset($params['status'])) {
$conditions['status'] = $params['status'];
}
//传了经纪人id则表示我的客户
if (isset($params["agent_id"])) {
$conditions['agent_id'] = $params['agent_id'];
}
$userList = $this->userModel->selectUserList($field, $conditions, $pageNo, $pageSize, "id desc");
if (empty($userList)) {
return $this->response("200", "此条件没有找到数据");
}
$clientService = new ClientService();
$list = [];
foreach ($userList as $k => $v) {
$is_show = $clientService->dialTotal($v["user_id"]);
if ($is_show) {
array_push($list, $v);
$list = [];
if (isset($params["agent_id"])) {
$list = $userList;
} else {
$clientService = new ClientService();
foreach ($userList as $k => $v) {
$is_show = $clientService->dialTotal($v["user_id"]);
if ($is_show) {
array_push($list, $v);
}
}
}
$vip_services = new VipService();
$data['examine_vip'] = $vip_services->vip($this->agentId);
$data['user_date'] = $userList;
$data['user_date'] = $list;
return $this->response("200", 'request success', $data);
}
/**
* 客户详情上一页下一页接口
* @return \think\Response
* 朱伟 2018-08-07
*/
public function getLastOrNextUserID()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/*$params = array(
"user_id" => 3,
"agent_id" => 9,
"type" =>"last",
);*/
$checkResult = $this->validate($params, "UserGetLastOrNextUserIdValidate.verifyStatus");
if (true !== $checkResult) {
return $this->response("300", $checkResult);
}
//todo 判断是 杭州还是上海
$where['city'] = trim($this->city);
if ($params['type'] == 'last') {
$where['id'] = [ 'gt', $params['user_id'] ];
$order = 'id asc';
} else {
$where['id'] = [ 'lt', $params['user_id'] ];
$order = 'id desc';
}
//dump($where);
$field = 'id,user_nick,agent_id,vip';
$user = new Users();
$user_res = $user->getLastOrNextUserID($where, $field, $limit = 1, $order);
if (!$user_res) {
return $this->response("200", "不符合条件0", []);
}
//todo 判断是否vip客户,如果是 只有是当前经纪人自己的客户才能查看
//vip客户 0:否 1:是
if (($user_res['vip'] == 1) && ($user_res['agent_id'] != $params['agent_id'])) {
return $this->response("200", "不符合条件1", []);
}
//todo 判断
$clientService = new ClientService();
if (!$clientService->dialTotal($params['user_id'])) {
return $this->response("200", "不符合条件2", []);
}
$where = [];
$where['city'] = trim($this->city);
$field = 'max(id) as max_id';
$order = 'id asc';
$max_id = $user->getLastOrNextUserID($where, $field, $limit = '', $order);
$field = 'MIN(id) as min_id';
$min_id = $user->getLastOrNextUserID($where, $field, $limit = '', $order);
return $this->response("200", "success!", [
'user_id' => $user_res[0]['id'],
'max_user_id' => $max_id[0]['max_id'],
'min_user_id' => $min_id[0]['min_id'] ]
);
}
}
\ No newline at end of file
......@@ -9,8 +9,10 @@ namespace app\api_broker\extend;
* Time: 9:35
* 基类
*/
use app\extra\RedisExt;
use app\model\AAgents;
use app\model\GOperatingRecords;
use think\Exception;
use UnexpectedValueException;
use InvalidArgumentException;
use think\Controller;
......@@ -25,9 +27,8 @@ class Basic extends Controller
* @var Request
*/
public $request;
public $params;
public $city;
protected $authToken;
/**
......@@ -65,6 +66,7 @@ class Basic extends Controller
*/
public function __construct(Request $request = null)
{
// CORS 跨域 Options 检测响应
$this->corsOptionsHandler();
// 输入对象
......@@ -76,16 +78,15 @@ class Basic extends Controller
$this->params = $this->request->param() != null ? $this->request->param() : null;
}
if (isset($this->params['AuthToken']) && $this->params['AuthToken'] != 'null' && !empty($this->params['AuthToken'])) {
$jwt = new \Firebase\JWT\JWT();
$jwt = new \Firebase\JWT\JWT();
try {
$result = $jwt->decode($this->params['AuthToken'], config('jwt_key'), array( 'HS256' )); //解码token
} catch( UnexpectedValueException $e) {
$result = $jwt->decode($this->params['AuthToken'], config('jwt_key'), array( 'HS256' )); //解码token
} catch (UnexpectedValueException $e) {
echo json_encode(array( "code" => "300", "msg" => "AuthToken参数错误!", "data" => [], "type" => "json" ));
exit;
} catch( InvalidArgumentException $e) {
} catch (InvalidArgumentException $e) {
echo json_encode(array( "code" => "300", "msg" => "AuthToken参数错误!", "data" => [], "type" => "json" ));
exit;
}
......@@ -96,15 +97,39 @@ class Basic extends Controller
$this->agentName = isset($result->data->name) ? $result->data->name : "";
$this->timeStamp_ = $result->timeStamp_;
}
//获取默认城市
$this->getCity($this->agentId);
$requestPath = $this->request->routeInfo()["rule"][0] . "/" . $this->request->routeInfo()["rule"][1];
//过滤掉不需要验证token的接口
if (!in_array(trim($requestPath), $this->filterVerify)) {
$this->tokenVerify();
$this->tokenVerify();
// $this->userAuth(trim($requestPath));
}
unset($this->params["AuthToken"]);
}
/**
* 默认城市选择
* @param $agentId
*/
public function getCity($agentId)
{
try {
$redis_ = RedisExt::getRedis();
if ($redis_) {
$city = $redis_->get("agent_city_" . $agentId);
$this->city = empty($city) ? "上海市" : $city;
} else {
$this->city = "上海市";
}
} catch (Exception $exception) {
$this->city = "上海市";
}
}
/**
* token 验证
*/
......@@ -136,11 +161,11 @@ class Basic extends Controller
*/
public function verifyAgentInfo()
{
$agentModel = new AAgents();
$agentModel = new AAgents();
$params["status"] = 0;
$params["id"] = $this->agentId;
$agentArr = $agentModel->getAgentById("id,store_id,name,phone",$params);
if (count($agentArr) > 0 && ($agentArr["id"] != $this->agentId )) {
$params["id"] = $this->agentId;
$agentArr = $agentModel->getAgentById("id,store_id,name,phone", $params);
if (count($agentArr) > 0 && ($agentArr["id"] != $this->agentId)) {
echo json_encode(array( "code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json" ));
exit;
}
......@@ -258,11 +283,11 @@ class Basic extends Controller
public static function corsRequestHander()
{
return [
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Credentials' => true,
'Access-Control-Allow-Methods' => 'GET,POST,OPTIONS',
'Access-Defined-X-Support' => 'service@cuci.cc',
'Access-Defined-X-Servers' => 'Guangzhou Cuci Technology Co. Ltd',
'Access-Control-Allow-Methods' => 'GET,POST,OPTIONS',
'Access-Defined-X-Support' => 'service@cuci.cc',
'Access-Defined-X-Servers' => 'Guangzhou Cuci Technology Co. Ltd',
];
}
......@@ -290,7 +315,8 @@ class Basic extends Controller
* @param $requestPath
* @return bool
*/
public function userAuth($requestPath){
public function userAuth($requestPath)
{
$agents = new AAgents();
$is_auth = $agents->agentsAuthId($this->agentId, $requestPath);
......@@ -306,7 +332,8 @@ class Basic extends Controller
];
if (in_array($requestPath, $auth_arr) && empty($is_auth) && $this->agentId != 1) {
echo json_encode(array( "code" => "300", "msg" => "没有权限!", "data" => [], "type" => "json" ));exit;
echo json_encode(array( "code" => "300", "msg" => "没有权限!", "data" => [], "type" => "json" ));
exit;
}
return true;
......
......@@ -65,7 +65,6 @@ class BrokerService
} elseif ($item["is_forbidden"] == 1) { //已存在申请关系
$is_exits = true;
}
}
}
if (!$is_exits && $type == 0)
......
......@@ -38,6 +38,7 @@ class ClientService
$params["user_id"] = $user_id;
$total = $this->uPhoneFollowUpModel->getCount( $params);
if ($total >= $num) {
return false;
} else {
......
<?php
namespace app\api_broker\service;
use app\model\AAgents;
use app\model\GHouses;
use app\model\OBargainModel;
use app\model\TAgentTotalModel;
use app\model\Users;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/8/8
* Time : 10:22
* Intro:
*/
class PerformanceUtilService
{
private $totalModel;
private $agentModel;
private $agentsModel;
private $tAgentTotalModel;
private $houseModel;
private $userModel;
private $bargainModel;
private $reportModel;
private $marchInModel;
private $payLogModel;
private $gHousesImgModel;
private $superviseModel;
public function __construct()
{
$this->totalModel = new TAgentTotalModel();
$this->agentModel = new AAgents();
$this->agentsModel = new AAgents();
$this->tAgentTotalModel = new TAgentTotalModel();
$this->houseModel = new GHouses();
$this->userModel = new Users();
$this->bargainModel = new OBargainModel();
$this->reportModel = new OReportModel();
$this->marchInModel = new OMarchInModel();
$this->payLogModel = new OPayLogModel();
$this->gHousesImgModel = new GHousesImgs();
$this->superviseModel = new ASuperviseModel();
}
public function HouseNum()
{
}
private function sumDistrictPerformance($params)
{
$result = [];
//房源
$addHouseNum = $this->houseModel->getAddHouseNum($params);
$result["add_house_num"] = isset($addHouseNum[0]["num"]) ? $addHouseNum[0]["num"] : 0;
//dump($addHouseNum);
//客源
$addUserNum = $this->userModel->getAddUserNum($params);
$result["add_user_num"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
//dump($addUserNum);
//业绩
$performanceSum = $this->bargainModel->getAddBargainNum($params, 1);//1表示业绩 2表示实收
$result["performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
//实收
$receivedSum = $this->bargainModel->getReceived($params);
$result["official_receipts"] = isset($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0;
//dump($receivedSum);
//约带看
$reportNum = $this->reportModel->getAddReportNum($params);
$result["look_at_num"] = isset($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;
//dump($reportNum);
//进场
$addMarchInNum = $this->marchInModel->getAddMarchInNum($params);
$result["march_in_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
//dump($addMarchInNum);
//收款
$payLogNum = $this->payLogModel->getAddPayLogNum($params);
$result["paylog"] = isset($payLogNum[0]["num"]) ? $payLogNum[0]["num"] : 0;
//dump($payLogNum);
// 监督
$result["supervision_num"] = $this->superviseModel->getSuperviseListCount($params);
return $result;
}
}
\ No newline at end of file
<?php
namespace app\api_broker\validate;
use think\Validate;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/8/7
* Time : 13:17
* Intro:
*/
class LocationValidate extends Validate
{
protected $rule = [
'city' => 'require',
'agent_id' => 'require|number',
];
protected $message = [
'city.require' => 'city为必填字段',
'agent_id.require' => '经纪人id为必填字段',
'agent_id.number' => '经纪人id只能为数字',
];
protected $scene = [
'saveSiteCityVerify' => [ 'city', 'agent_id' ],
];
}
\ No newline at end of file
<?php
namespace app\api_broker\validate;
use think\Validate;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2018/8/7
* Time: 13:54:12
*/
class UserGetLastOrNextUserIdValidate extends Validate{
protected $rule = [
'type' => 'require',
'agent_id' => 'require|number|gt:0',
'user_id' => 'require|number|gt:0'
];
protected $message = [
'type.require' => '网络异常!错误代码:uv1',//type为必填字段
'agent_id.require' => 'agent_id为必填字段',//agent_id为必填字段
'agent_id.number' => '网络异常!错误代码:uv4',//agent_id只能为数字
'agent_id.gt' => '网络异常!错误代码:uv5',//agent_id必须大于0
'user_id.require' => 'user_id为必填字段',//user_id为必填字段
'user_id.number' => '网络异常!错误代码:uv7',//user_id只能为数字
'user_id.gt' => '网络异常!错误代码:uv8',//user_id必须大于0
];
protected $scene = [
'add_phone_follow_up_verify' => [ 'user_id', 'agent_id', 'type'],
];
}
......@@ -32,8 +32,9 @@
<div class="flex-center"><img src="/app/images/ic_default_headpic.png" onerror="javascript:this.src='/app/images/ic_default_headpic.png'" id="customer_pic" /></div>
<div>
<p><span id="name"></span><span class="edit-btn"><img src="/app/images/boy_ic@2x.png" class="sex-icon" /></span></p>
<p><a href="javascript:;" id="call_list_open_btn" class="flex-center"><span id="customer_phone"></span><img src="/app/images/ic_tel.png" /></a></p>
<p><a href="javascript:;" id="call_list_open_btn" class="flex-center"><span id="customer_id">客户ID:0,</span><span id="customer_phone"></span><img class="call-btn" src="/app/images/ic_tel.png" /></a></p>
<p><span class="flex-center" id="industry_type"></span><span class="flex-center" id="price_demand"></span><span class="flex-center" id="area_demand"></span></p>
<p id="add_city_type_area"></p>
</div>
</div>
......@@ -78,8 +79,8 @@
<p>客源编号:<span id="customer_code"></span></p>
<!--<p>客户姓名:<span class="edit-btn"><span id="customer_name"></span><img class="edit-icon" src="/app/images/ic_bianji.png" /></span></p>
<p>性别:<span class="edit-btn"><span id="customer_sex"></span><img src="/app/images/boy_ic@2x.png" class="sex-icon" /><img class="edit-icon" src="/app/images/ic_bianji.png" /></span></p>-->
<p>客方:<span><span id="kefang"></span></span></p>
<p>邀请人:<span id="yaoqingren"></span></p>
<p>客方:<span id="kefang"></span><img class="call-btn call-btn-other" src="/app/images/ic_tel.png" /></p>
<p>邀请人:<span id="yaoqingren"></span><img class="call-btn call-btn-other" src="/app/images/ic_tel.png" /></p>
<p>VIP客户(客方和有权限的人才能看到):<span id="isvip"></span></p>
<p>产生类型:<span id="create_type"></span></p>
<p>创建时间:<span id="add_time"></span></p>
......@@ -158,7 +159,7 @@
<script type="text/javascript" src="/app/js/jquery-1122-min.js"></script>
<script src="/app/js/common.js?new42" charset="utf-8"></script>
<script src="/app/js/customerinfo_details_new.js?new49"></script>
<script src="/app/js/customerinfo_details_new.js?new50"></script>
</body>
......
......@@ -34,7 +34,7 @@
<span class="time_p1">
开始
</span>
<input type="date" v-model.trim="dateStart" name="date" class="name_date" id="datePicker" @change="changeDate('0')">
<input type="date" v-model.trim="dateStart" name="date" class="name_date" id="datePicker">
</p>
</li>
......@@ -43,7 +43,7 @@
<span class="time_p1">
结束
</span>
<input type="date" v-model.trim="dateEnd" name="date" class="name_date" id="datePicker2" @change="changeDate('1')">
<input type="date" v-model.trim="dateEnd" name="date" class="name_date" id="datePicker2">
</p>
</li>
</ul>
......
......@@ -269,12 +269,26 @@ class Agent extends Basic
}
}
$table = new AAgents();
if ($table->saveStatus('status', $data['status'], $ids)) {
return $this->response(200, '成功', $data);
} else {
return $this->response(100, '失败', $data);
try {
$m_agent = new AAgents();
if ($m_agent->saveStatus('status', $data['status'], $ids)) {
if ($data['status'] != 0) {
$is_forbidden = 1;
} else {
$is_forbidden = 0;
}
//同时修改设备绑定表
$m_agent_device = new ABindingDevice();
$m_agent_device->updateDate(['is_forbidden'=>$is_forbidden], ['agent_id'=>$ids]);
return $this->response(200, '成功', $data);
} else {
return $this->response(100, '失败', $data);
}
} catch (\Exception $e) {
return $this->response(100, '修改失败' . $e->getMessage(), $data);
}
}
/**
......
......@@ -39,7 +39,7 @@ class CellPhone extends Basic
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$report = new SecretReport();
$field = 'agents_id,users_id,call_type,call_time,time,voice_file,c.user_status,a.id,a.create_time,a.type,secret_no';
$field = 'agents_id,users_id,call_type,call_time,time,voice_file,c.user_status,a.id,a.create_time,a.type,secret_no,c.id as user_id,c.agent_id as c_agent_id';
$where = [];
if (!empty($this->params['start_date'])) {
......
......@@ -68,20 +68,34 @@ class Collection extends Basic
$where['a.house_number'] = $this->params['id'];
}
if (!empty($this->params['store_name'])) {
$where['f.store_name'] = ['like','%'.$this->params['store_name'].'%'];
if (!empty($this->params['store_id'])) {
$where['e.store_id'] = $this->params['store_id'];
}
if (!empty($this->params['district_id'])) {
$where['e.district_id'] = $this->params['district_id'];
}
if (!empty($this->params['report_phone'])) {
$where['e.phone'] = ['like','%'.$this->params['report_phone'].'%'];
}
if (!empty($this->params['pay_type'])) {
$where['a.pay_type'] = $this->params['pay_type'];
}
if (!empty($this->params['type'])) {
$where['a.type'] = $this->params['type'];
}
if (!empty($this->params['report_name'])) {
$where['e.name'] = ['like','%'.$this->params['report_name'].'%'];
}
if (empty($this->params['excel'])) {
$field = 'a.id,a.father_id,a.order_id,a.create_time,c.user_name,c.user_phone,a.money,a.real_money,a.pay_type,a.house_number,a.type,d.internal_title,d.internal_address,a.source,a.transaction_fee';
$field = 'a.id,a.father_id,a.order_id,a.create_time,c.user_name,c.user_phone,a.money,a.real_money,a.pay_type,
a.house_number,a.type,d.internal_title,d.internal_address,a.source,a.transaction_fee,c.report_agent_phone,
c.report_agent_name,f.store_name,g.district_name';
$data['data']['list'] = $order->getAddPayLogOrderListLmit($pageNo, $pageSize, $order_ = 'a.id desc', $field, $where);
$data['data']['total'] = $order->getAddPayLogOrderListLmitTotal($where);
$data['data']['money_total'] = $order->getMoneyTotal(); //总额
......@@ -96,7 +110,7 @@ class Collection extends Basic
} else {
$pageNo = 1;
$pageSize = 50000; //最多5万条数据
$field = 'a.create_time,c.user_name,c.user_phone,e.name,e.phone,f.store_name,g.district_name,a.money,a.real_money,a.transaction_fee,a.type,a.pay_type,d.internal_address,a.house_number,a.source';
$field = 'a.create_time,c.user_name,c.user_phone,c.report_agent_name,c.report_agent_phone,f.store_name,g.district_name,a.money,a.real_money,a.transaction_fee,a.type,a.pay_type,d.internal_address,a.house_number,a.source';
$data = $order->getAddPayLogOrderListLmit($pageNo, $pageSize, $order_ = 'a.id desc', $field, $where);
foreach ($data as $k=>$v) {
......@@ -116,6 +130,11 @@ class Collection extends Basic
}
}
/**
* 收款记录-实付金额
*
* @return \think\Response
*/
public function addRealMoney(){
$params = $this->params;
/*$params = array(
......@@ -126,7 +145,7 @@ class Collection extends Basic
if(!isset($params["collection_id"]) || $params["collection_id"] <= 0){
return $this->response("101","请求参数错误");
}
if((!isset($params["real_money"]) || $params["real_money"] <= 0) and (!isset($params["transaction_fee"]) || $params["transaction_fee"] <= 0)){
if((!isset($params["real_money"]) || $params["real_money"] <= 0) and (!isset($params["transaction_fee"]) || $params["transaction_fee"] < 0)){
return $this->response("101","请求参数错误");
}
$where_["id"] = $params["collection_id"];
......@@ -144,7 +163,7 @@ class Collection extends Basic
if($id > 0 ){
return $this->response("200","编辑成功");
}else{
return $this->response("101","编辑失败");
return $this->response("101","无记录修改或修改失败");
}
}
......
......@@ -65,7 +65,7 @@ class Finance extends Basic
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$check_status = $this->params['check_status'];
$fields = 'a.id,a.create_time,a.trade_type,b.user_phone,b.user_name,d.internal_title,d.internal_address,
a.commission,a.practical_fee,a.scale_fee,a.order_no,a.order_id,content,house_number,a.is_open';
a.commission,a.practical_fee,a.scale_fee,a.order_no,a.order_id,content,house_number,a.is_open,a.agent_id';
$where['a.father_id'] = 0;
// $where['c.is_del'] = 0;
$where['a.status'] = 11;
......@@ -116,6 +116,11 @@ class Finance extends Basic
$where['f.name'] = ['LIKE', '%'.$this->params['agent_name'].'%'];
}
//分佣方姓名
if (!empty($this->params['partial_name'])) {
$where['e.name'] = ['LIKE', '%'.$this->params['partial_name'].'%'];
}
switch ($check_status) {
case 2 :
//成交报告列表-第二级审核
......
......@@ -11,7 +11,9 @@ namespace app\index\controller;
use app\api_broker\service\LookShopService;
use app\index\extend\Basic;
use app\index\validate\HouseValidate;
use app\model\AAgents;
use app\model\ACollectHouse;
use app\model\GHouses;
use app\model\GHousesImgs;
use app\model\GHousesToAgents;
......@@ -49,6 +51,13 @@ class Houses extends Basic
$result['msg'] = '';
if ($this->request->isPost()) {
$validate = new HouseValidate();
$check = $validate->check($this->params);
if(true !== $check){
return $this->response(101,$validate->getError());
}
$house_id = $this->house->add($this->params, $this->userId); //添加或编辑商铺
if (!empty($this->params['sublet_id']) && $this->params['source'] == 'transfer_list') {
......@@ -218,7 +227,7 @@ class Houses extends Basic
}
$fields = 'a.id,a.shop_type,a.internal_title,a.rent_price,a.is_show,a.create_time,a.residue_num,a.rent_type,
a.shop_area_start,a.shop_area_end,a.industry_type,d.landlord_phone';
a.shop_area_start,a.shop_area_end,a.industry_type,d.landlord_phone,disc';
/*楼盘编号*/
if ($this->params['id'] != NULL) {
......@@ -242,6 +251,14 @@ class Houses extends Basic
$where['d.landlord_phone'] = [ 'LIKE', '%' . $this->params['landlord_phone'] . '%' ];
}
if ($this->params['city'] != NULL) {
$where['a.city'] = $this->params['city'];
}
if ($this->params['disc'] != NULL) {
$where['a.disc'] = $this->params['disc'];
}
if (!empty($this->params['area'])) {
switch ($this->params['area']) {
case 1:
......@@ -260,7 +277,6 @@ class Houses extends Basic
$where['a.shop_area_start'] = ['>', 0];
}
}
$where['a.city'] = '上海市';
$data['data']['list'] = $this->house->getHouseListDish($pageNo, $pageSize, 'a.id DESC', $fields, $where, $this->userId);
$data['data']['total'] = $this->house->getHouseListDishTotal($where);
......@@ -268,7 +284,21 @@ class Houses extends Basic
$look_shop = new LookShopService();
foreach ($data['data']['list'] as $k=>$v) {
$data['data']['list'][$k]["is_look"] = $look_shop->isLooked($this->userId, $v["id"]);;
$data['data']['list'][$k]["is_look"] = $look_shop->isLooked($this->userId, $v["id"]);
//是否被收藏
$data['data']['list'][$k]["is_collect"] = 2;
if ($this->params['agent_id'] ) {
//先判断是否已经存在数据
$field = 'id,status';
$get_params['agents_id'] = $this->params["agent_id"];
$get_params['house_id'] = $v["id"];
$collect_house = new ACollectHouse();
$res = $collect_house->getCollectHouse($field, $get_params);
if ($res && ($res[0]['status'] == 1)) {//如果存在
$data['data']['list'][$k]["is_collect"] = 1;
}
}
}
return $this->response($data['status'], $data['msg'], $data['data']);
......@@ -290,6 +320,11 @@ class Houses extends Basic
if ($this->params['id']) {
$this->house->isUpdate(true)->save([ 'status' => 3 ], [ 'id' => $this->params['id'] ]);
//删除商铺对应的收藏商铺也要删除(改状态值)delCollectHouse
$collect_house =new ACollectHouse();
$collect_house->delCollectHouse($this->params['id']);
$data['msg'] = 'successfully deleted';
} else {
$data['status'] = 101;
......@@ -425,7 +460,7 @@ class Houses extends Basic
foreach ($agent_house as $k=>$v) {
$agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']);
$remark = '批量修改方为'.$agent_data['name'].'-'.$agent_data['phone'];
$remark = '批量修改盘方方为'.$agent_data['name'].'-'.$agent_data['phone'];
$records->record($this->userId, 2, $remark, $v['houses_id'], $v['id']);
}
$agent->commit();
......
......@@ -76,7 +76,7 @@ class Login extends Basic
}
if ($user_data['status'] != 0 || $user_data['admin_off'] != '0' || empty($auth_group_id)) {
return $this->response('101', '请致电财务徐伟洋');
return $this->response('101', '没有后台登录权限,请先向店长申请,由店长致电财务徐伟洋。');
}
$last_login_ip = ip2long($this->request->ip());
......@@ -85,9 +85,10 @@ class Login extends Basic
//判断设备id是否存在
$is_login = $this->brokerService->judgeBand($last_login_ip, $user_data['id'], $model, 0,$only_id , 1);
if (!$is_login) {
return $this->response("102", "该账号没有绑定该设备的浏览器,请致电财务徐伟洋进行绑定。");
return $this->response("102", "该账号没有绑定该设备的浏览器,请先向店长申请,由店长致电财务徐伟洋。");
}
}
$where_rule['status'] = 0;
if ($user_data['id'] == 1) {
......
......@@ -4,6 +4,7 @@ namespace app\index\controller;
use app\api_broker\service\ClientService;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\ACollectUser;
use app\model\GOperatingRecords;
use app\model\Users;
use app\model\UPhoneFollowPp;
......@@ -99,8 +100,10 @@ class Member extends Basic{
}elseif (!empty($params['start_date']) && !empty($params['end_date'])) {
$where['a.create_time'] = ['between time', [$params['start_date']. ' 00:00:00', $params['end_date'] . ' 23:59:59']];
}else{
$time_ = date('Y-m-d H:i:s', strtotime("-1 day"));
$where['a.create_time'] = array( 'lt', $time_ );
if (empty($params['id']) && empty($params['phone'])) {
$time_ = date('Y-m-d H:i:s', strtotime("-1 day"));
$where['a.create_time'] = array( 'lt', $time_ );
}
}
//跟进结束时间
......@@ -259,7 +262,19 @@ class Member extends Basic{
}
}
$fields = 'a.id,a.user_nick,a.user_name,a.user_phone,a.user_pic,a.create_time,a.user_pswd,a.referrer_id,
if (!empty($params['province'])) {
$where['a.province'] = $params['province'];
}
if (!empty($params['city'])) {
$where['a.city'] = $params['city'];
}
if (!empty($params['disc'])) {
$where['a.disc'] = $params['disc'];
}
$fields = 'a.id,a.user_nick,a.user_name,a.user_phone,a.user_pic,a.create_time,a.user_pswd,a.referrer_id,a.user_label,
a.user_name,a.status,a.first_login_time,a.last_login_time,a.agent_id,a.vip,a.price_demand,a.industry_type,a.area_demand,a.user_status,a.source';
try {
......@@ -269,6 +284,21 @@ class Member extends Basic{
foreach ($data_list as $k=>$v) {
$data_list[$k]['user_phone'] = hide_customer_phone($data_list[$k]['user_phone']);
$data_list[$k]['current_agent_id'] = $this->userId;
//是否被收藏
$data_list[$k]["is_collect"] = 2;
if($params["agent_id"] && $v["id"]){
//先判断是否已经存在数据
$field = 'id,status';
$get_params['agents_id'] = $params["agent_id"];
$get_params['user_id'] = $v["id"];
$collect_house = new ACollectUser();
$res = $collect_house->getCollectUser($field, $get_params);
if ($res && ($res[0]['status'] == 1)) {//如果存在
$data_list[$k]["is_collect"] = 1;
}
}
$is_show = true;
if( $if_search_user == false){
$is_show = $clientService->dialTotal($v["id"]);
......@@ -278,6 +308,8 @@ class Member extends Basic{
array_push($list, $data_list[$k]);
}
}
$data['list'] =$list;
$data['total'] = $this->user->getUserAgentTotal($where, $type);
......@@ -333,6 +365,7 @@ class Member extends Basic{
if ($this->request->isPost()) {
//编辑用户
$result = '';
if (empty($this->params['id'])) {
//新增用户
$where['user_phone'] = $this->params['user_phone'];
......@@ -343,12 +376,15 @@ class Member extends Basic{
$agent = new AAgents();
$agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']);
$remark = '新增为' . $agent_data['name'] . '-' . $agent_data['phone'];
$result = $this->user->edit($this->params, $this->params['id']); //新增或编辑
$result = $this->user->edit($this->params, $this->params['id'], $this->userId); //新增或编辑
$this->operating_records($this->userId, $type=3, $remark, $this->params['id']); //记录日志
} else {
$user_data = $this->user->getUserById('id,agent_id', $this->params['id']);
if (empty($user_data)) {
return $this->response(101, '没有用户信息');
} else {
}
if (!empty($this->params['agents_id'])) {
//是否修改客方
if ($this->params['agents_id'] != $user_data['agent_id']) {
$agent = new AAgents();
......@@ -357,8 +393,10 @@ class Member extends Basic{
} else {
$remark = '用户编辑';
}
$result = $this->user->edit($this->params, $this->params['id']); //新增或编辑
$this->operating_records($this->userId, $type=3, $remark, $this->params['id']); //记录日志
}
$result = $this->user->edit($this->params, $this->params['id'], $this->userId); //新增或编辑
}
switch ($result) {
......@@ -370,10 +408,8 @@ class Member extends Basic{
$this->msg = '此号码为虚拟号码';break;
case -3 :
$this->code = 101;
$this->msg = '没有新增VIP权限';break;
$this->msg = '没有新增和编辑VIP权限';break;
}
$this->operating_records($this->userId, $type=3, $remark, $this->params['id']);
} else {
//编辑获取用户信息
......
<?php
namespace app\index\controller;
/**
* Created by PhpStorm.
* User: liu yin ping
* Date: 2018/8/7
* Time: 15:48
*/
use app\index\extend\Basic;
class MyCollectionShop extends Basic
{
public function myCollectionShopList()
{
if (!$this->request->isAjax()) {
return view('myCollectionShop/myCollectionShopList');
}
}
}
<?php
namespace app\index\controller;
/**
* Created by PhpStorm.
* User: liu yin ping
* Date: 2018/8/7
* Time: 15:48
*/
use app\index\extend\Basic;
class MyCollectionUser extends Basic
{
public function myCollectionUserList()
{
if (!$this->request->isAjax()) {
return view('myCollectionUser/myCollectionUserList');
}
}
}
......@@ -21,6 +21,37 @@ class Performance extends Basic
$this->service_ = new PerformanceService();
}
public function getSearchTimeType($start_day,$end_day)
{
//todo 1.今天之前,不包括今天
$search_time_type = 1;
if(
(date('Y-m-d',strtotime($start_day)) != date("Y-m-d", time()))
&&
(date('Y-m-d',strtotime($end_day)) != date("Y-m-d", time()))
){
$search_time_type = 1;
}
//todo 2.今天之前,包括今天
if(
(date('Y-m-d',strtotime($start_day)) != date("Y-m-d", time()))
&&
(date('Y-m-d',strtotime($end_day)) == date("Y-m-d", time()))
){
$search_time_type = 2;
}
//todo 3.就只查询今天
if(
(date('Y-m-d',strtotime($start_day)) == date("Y-m-d", time()))
&&
(date('Y-m-d',strtotime($end_day)) == date("Y-m-d", time()))
){
$search_time_type = 3;
}
return $search_time_type;
}
//TODO 区域业绩排行 District
/**
......@@ -40,14 +71,16 @@ class Performance extends Basic
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
//默认排序一周 2018-07-18改为本月
$end_day = !empty($params["end_day"]) ? $params["end_day"] : date("Y-m-d", time());
$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-01", time());
$end_day = !empty($params["end_day"]) ? $params["end_day"] : date("Y-m-d", time());
$father_id = !empty($params["father_id"]) ? $params["father_id"] : '' ;
$is_today = !empty($params["is_today"]) ? $params["is_today"] : 0 ;
//todo 业绩查询目前分三种情况
$search_time_type = $this->getSearchTimeType($start_day,$end_day);
$list = $this->service_->totalAgent($params["type"], $end_day, $start_day,$pageNo,$pageSize,$father_id,$is_today);
$list = $this->service_->totalAgent($params["type"], $end_day, $start_day,$pageNo,$pageSize,$father_id,$search_time_type);
//dump($list);
if (count($list) > 0) {
$result["list"] = $list['list'];
......@@ -84,10 +117,11 @@ class Performance extends Basic
$end_day = !empty($params["end_day"]) ? $params["end_day"] : date("Y-m-d", time());
$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-01", time());
$father_id = !empty($params["father_id"]) ? $params["father_id"] : '' ;
$is_today = !empty($params["is_today"]) ? $params["is_today"] : 0 ;
//todo 业绩查询目前分三种情况
$search_time_type = $this->getSearchTimeType($start_day,$end_day);
$list = $this->service_->totalAgent($params["type"], $end_day, $start_day,$pageNo,$pageSize,$father_id,$is_today);
$list = $this->service_->totalAgent($params["type"], $end_day, $start_day,$pageNo,$pageSize,$father_id,$search_time_type);
//dump($list);
if (count($list) > 0) {
$result["list"] = $list['list'];
......@@ -126,10 +160,11 @@ class Performance extends Basic
$end_day = !empty($params["end_day"]) ? $params["end_day"] : date("Y-m-d", time());
$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-01", time());
$father_id = !empty($params["father_id"]) ? $params["father_id"] : '' ;
$is_today = !empty($params["is_today"]) ? $params["is_today"] : 0 ;
//todo 业绩查询目前分三种情况
$search_time_type = $this->getSearchTimeType($start_day,$end_day);
$list = $this->service_->totalAgent($params["type"], $end_day, $start_day,$pageNo,$pageSize,$father_id,$is_today);
$list = $this->service_->totalAgent($params["type"], $end_day, $start_day,$pageNo,$pageSize,$father_id,$search_time_type);
//dump($list);
if (count($list) > 0) {
$result["list"] = $list['list'];
......
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/4/24
* Time: 16:55
*/
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\OBargainModel;
class PerformanceInfo extends Basic
{
protected $oBargainModel;
public function __construct($request = null)
{
parent::__construct($request);
$this->oBargainModel = new OBargainModel();
}
/**
* 业绩明细
*/
public function performanceInfo() {
if ($this->request->isAjax()) {
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$where=[];
/*开始结束时间*/
if (($this->params['create_time_start'] != NULL) && ($this->params['create_time_end'] != NULL)) {
$where['Obargain.create_time'] = ['between time', [$this->params['create_time_start'] . ' 00:00:00'], $this->params['create_time_end'] . ' 23:59:59'];
}
if ($this->params['shop_type'] != NULL) {
$where['Houses.shop_type'] = $this->params['shop_type'];
}
//todo 成交类型
if ($this->params['trade_type'] != NULL) {
$where['Obargain.trade_type'] = $this->params['trade_type'];
}
//todo 商铺地址
if ($this->params['landmark'] != NULL) {
$where['Houses.landmark'] = ['like', '%'.$this->params['landmark'].'%'];
}
//todo 商铺编号
if ($this->params['houses_id'] != NULL) {
$where['Houses.houses_id'] = $this->params['houses_id'];
}
//todo 部门
if ($this->params['district_id'] != NULL) {
$where['District.id'] = $this->params['district_id'] ;
}
//todo 门店
if ($this->params['store_id'] != NULL) {
$where['Store.id'] = $this->params['store_id'] ;
}
//todo 姓名
if ($this->params['name'] != NULL) {
$where['Agent.name'] = ['like', '%'.$this->params['name'].'%'];
}
//todo 手机号
if ($this->params['phone'] != NULL) {
$where['Agent.phone'] = ['like', '%'.$this->params['phone'].'%'];
}
$field = 'Obargain.create_time,';
$field .= 'Obargain.id,';
$field .= 'Obargain.trade_type,';
$field .= 'Obargain.scale,';
$field .= 'Obargain.scale_fee,';
$field .= 'Obargain.practical_fee,';
$field .= 'Obargain.order_id,';
$field .= 'Agent.name,';
$field .= 'Agent.phone,';
$field .= 'Store.store_name,';
$field .= 'District.district_name,';
$field .= 'Houses.landmark,';
$field .= 'Oorder.house_id';
$return = $this->oBargainModel->performancelInfo($where,$field,$pageSize,$pageNo);
$return_total = $this->oBargainModel->performancelInfoTotal($where,$field);
$field = 'sum(Obargain.scale_fee) as scale_fee_sum';
$return_sum = $this->oBargainModel->performancelInfo($where,$field,$pageSize,$pageNo);
return $this->response(200, '', ['scale_fee_sum'=>$return_sum[0]['scale_fee_sum'],'data'=>$return,'total'=>$return_total]);
} else {
return view('performanceInfo');
}
}
}
\ No newline at end of file
<?php
namespace app\index\controller;
/**
* Created by PhpStorm.
* User: liu yin ping
* Date: 2018/8/7
* Time: 15:48
*/
use app\index\extend\Basic;
class PerformanceSubsidiary extends Basic
{
public function performancesubsidiaryList()
{
if (!$this->request->isAjax()) {
return view('performancesubsidiary/performancesubsidiaryList');
}
}
}
......@@ -85,6 +85,18 @@ class Remark extends Basic
$where['b.district_id'] = $this->params['remark_district_id'];
}
if (!empty($this->params['province'])) {
$where['c.province'] = $this->params['province'];
}
if (!empty($this->params['city'])) {
$where['c.city'] = $this->params['city'];
}
if (!empty($this->params['disc'])) {
$where['c.disc'] = $this->params['disc'];
}
$field = 'c.id,a.create_time,a.content,b.name as admin,d.name as label_name,c.user_name,c.user_phone,a.user_status';
$data['data']['list'] = $u_phone_follow->getFollowList($pageNo, $pageSize, $order_ = 'a.id desc', $field, $where);
......@@ -235,4 +247,6 @@ class Remark extends Basic
//dump($total);
return $this->response("200", "success!", ['user_date'=>$UPhoneFollowPp_res,'pagenum'=>$pagenum,'total'=>$total]);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/8/8
* Time: 10:45
*/
namespace app\index\validate;
use think\Validate;
class HouseValidate extends Validate
{
protected $rule = [
'internal_title' => 'require|length:1,125',
'internal_address' => 'require|length:1,125',
// 'province' => 'require|length:1,60',
// 'city' => 'require|length:1,60|in:上海市,杭州市',
'disc' => 'require|length:1,60',
'market_area' => 'require|between:0,9999999',
'shop_area_start' => 'require|between:0,9999999',
'rent_type' => 'require|in:1,2,3',
'rent_price' => 'require',
'industry_type' => 'require',
'shop_type' => 'require|in:0,1',
'shop_sign' => 'require',
'management_fee' => 'require|between:0,9999999999',
'slotting_fee' => 'require|between:0,9999999999',
'residue_num' => 'require|between:0,9999999999',
'total' => 'require|between:0,9999999999',
'longitude' => 'require|min:1',
'latitude' => 'require|min:1',
'is_show' => 'require|in:0,1',
'fee_rule' => 'require',
'internal_item_advantage' => 'require',
];
protected $message = [
'internal_title.require' => '对内商铺名为必填',
'internal_title.length' => '名称字数在1至125个字',
'internal_address.require'=> '对内商铺地址为必填',
'internal_address.length' => '对内地址要在1至255个字',
// 'province.require' => '省份为必填',
// 'province.length' => '省份要在1至60个字',
// 'city.require' => '市为必填',
// 'city.length' => '对内地址要在1至60个字',
// 'city.in' => '只能添加上海和杭州的商铺',
'disc.require' => '区为必填',
'disc.length' => '对内地址要在1至60个字',
'market_area.require' => '商场面积为必填',
'market_area.between' => '商场面积值在0至9999999',
'shop_area_start.require' => '店铺面积为必填',
'shop_area_start.between' => '店铺面积值在0至9999999',
'rent_type.require' => '租金模式为必填',
'rent_type.in' => '租金模式参数错误',
'rent_price.require' => '租金均价为必填',
'industry_type.require' => '业态为必填',
'shop_type.require' => '商铺类型为必填',
'shop_type.in' => '商铺类型值错误',
'shop_sign.require' => '商铺标签为必填',
'management_fee.require' => '物业费为必填',
'management_fee.between' => '物业费钱为0至9999999999',
'slotting_fee.require' => '进场费为必填',
'slotting_fee.between' => '进场费值为0至9999999999',
'residue_num.require' => '剩余铺数为必填',
'residue_num.between' => '剩余铺数值为0至9999999999',
'total.require' => '总铺数量为必填',
'total.between' => '总铺数量为0至9999999999',
'is_show.require' => '是否显示在c端必填',
'is_show.in' => '是否显示在c端参数不对',
'fee_rule.require' => '佣金规则必填',
'fee_rule.between' => '佣金规则字数为0至500',
'internal_item_advantage.require' => '对内项目优势必填',
'internal_item_advantage.between' => '对内项目优势字数为1至500',
];
protected $scene = [
];
}
\ No newline at end of file
......@@ -166,8 +166,8 @@
display: none !important;
}
.result>img,.result2>img{
width: 200px;
height: 200px;
width: 150px;
height: 150px;
}
#container_body{
position: relative;
......@@ -191,6 +191,18 @@
color: red;
}
/*控制放大镜的 收款图片显示*/
#preview{
z-index: 9999!important;
}
#preview img{
width: 600px;
}
.clear{
clear: both;
}
/*css样式*/
</style>
<div id="page-content-wrapper">
......@@ -218,13 +230,46 @@
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="shop_num" placeholder="商铺号" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="customer_phone" placeholder="客户手机号" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="customer_name" placeholder="客户姓名" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="store_name" placeholder="门店" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="applicant_phone" placeholder="报备手机号" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="applicant_name" placeholder="报备人姓名" type="text" value="">
<!--<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="store_name" placeholder="门店" type="text" value="">-->
<select class="form-control btn2 ld-Marheight" name="maintable_shop_type_1" id="maintable_deal_type">
<option value="">入账类型</option>
<option value="10">意向金</option>
<option value="20">定金</option>
<option value="30">保管金</option>
<option value="40">押金</option>
<option value="50">租金</option>
<option value="60">进场费</option>
<option value="70">转让费</option>
<option value="80">其他</option>
<option value="90">佣金</option>
</select>
<select class="form-control btn2 ld-Marheight" name="maintable_shop_type_2" id="maintable_money_type">
<option value="">入账方式</option>
<option value="10">支付宝</option>
<option value="20">微信</option>
<option value="30">POS机器</option>
<option value="40">转账</option>
<option value="50">现金</option>
<option value="60">其他</option>
</select>
<select name="district_id" class="form-control btn4 ld-Marheight">
<option value="">约带看人所在部门</option>
</select>
<select name="store_id" class="form-control btn4 ld-Marheight">
<option value="">约带看人所在门店</option>
</select>
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="applicant_phone" placeholder="约带看人手机号" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="applicant_name" placeholder="约带看人姓名" type="text" value="">
<div class="clear">
</div>
<!--<span class=" btn btn-info btn3 ld-Marheight" style="visibility: hidden;">搜索</span>-->
<span class="btn btn-info btn3 ld-Marheight" id="search">搜索</span>
<span class="btn btn-info btn3 ld-Marheight" id="reset">重置</span>
<span class="money_total_two fore-span ld-Marheight ">总额:</span><span id="money_total" class="money_total_two fore-span ld-Marheight"></span>
<span class="money_total_two fore-span ld-Marheight ">收款总额:</span><span id="money_total" class="money_total_two fore-span ld-Marheight"></span>
<!--<span class="money_total_two fore-span ld-Marheight ">实付总额:</span><span id="money_total" class="money_total_two_shifu fore-span ld-Marheight">1268</span>元-->
<span class="btn btn-info btn3 ld-Marheight" id="export">导出报表</span>
</form>
</form>
......@@ -232,11 +277,12 @@
</tr>
<tr>
<th class="text-center">收款时间</th>
<th class="text-center">客户姓名</th>
<th class="text-center">客户手机号</th>
<th class="text-center">约带看人</th>
<th class="text-center">所属部门</th>
<th class="text-center">所属门店</th>
<th class="text-center">收款金额(元)</th>
<th class="text-center">实付金额(元)</th>
<th class="text-center">手续费(元)</th>
<!--<th class="text-center">手续费(元)</th>-->
<th class="text-center">入账类型</th>
<th class="text-center">入账方式</th>
<th class="text-center">商铺地址</th>
......
{layout name="global/frame_tpl" /}
<input type="hidden" class="page-load" id="reportList" />
<style type="text/css">
.clear{
clear: both;
}
</style>
<div id="page-content-wrapper">
<div class="container">
<div class="row">
......@@ -49,6 +53,10 @@
</select>
<input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="agent_name" placeholder="约带看人姓名" type="text" value="">
<input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="agent_phone" placeholder="约带看人手机号" type="text" value="">
<input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="partical_name" placeholder="分佣方姓名" type="text" value="">
<div class="clear">
</div>
<span class="btn btn-info btn3 search" id="maintable_search">搜索</span>
<span class="btn btn-info btn3" id="maintable_reset">重置</span>
<!--<span class="btn btn-info btn3" id="maintable_export">导出excel</span>-->
......
<script src='/resource/lib/js/require.min.js' data-main='/resource/js/main?version=1212311' charset='utf-8'></script>
\ No newline at end of file
<script src='/resource/lib/js/require.min.js' data-main='/resource/js/main?version=12121' charset='utf-8'></script>
\ No newline at end of file
......@@ -81,6 +81,15 @@
<input class="form-control btn4 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="user_phone" placeholder="跟进人姓名或电话" type="text" value="">
<div class="clear"></div>
<select class="form-control btn2 ld-Marheight" id="shop_city_id">
<option value="" selected="selected">城市筛选</option>
<option value="310100">上海市</option>
<option value="330100">杭州市</option>
</select>
<select class="form-control btn2 ld-Marheight" id="shop_area_id">
<option value="" selected="selected">区域筛选</option>
</select>
<span class="btn btn-info btn3 ld-Marheight" id="search">搜索</span>
<span class="btn btn-info btn3 ld-Marheight" id="reset">重置</span>
</form>
......
......@@ -79,7 +79,7 @@
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<td colspan="9">
<td colspan="10">
<form id="form_search">
<select class="form-control btn11" id="is_carefully_chosen">
<option value="-1"">是否显示在首页</option>
......@@ -118,9 +118,15 @@
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="internal_title" placeholder="对内商铺名称" type="text" value="">
<!--新加筛选-->
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="internal_title_open" placeholder="对外商铺名称" type="text" value="">
<select class="form-control btn2 ld-Marheight" id="district_id">
<select class="form-control btn2 ld-Marheight" id="shop_city_id">
<option value="" selected="selected">城市筛选</option>
<option value="310100">上海市</option>
<option value="330100">杭州市</option>
</select>
<select class="form-control btn2 ld-Marheight" id="shop_area_id">
<option value="" selected="selected">区域筛选</option>
</select>
<select class="form-control btn2 ld-Marheight" id="area_id">
<option value="" selected="selected">面积筛选</option>
</select>
......@@ -147,6 +153,7 @@
<tr class="main_table_th_tr">
<th class="text-center">编号</th>
<th class="text-center">类型</th>
<th class="text-center">区域</th>
<th class="text-center">对内名称</th>
<th class="text-center">租金均价</th>
<th class="text-center">面积</th>
......
{layout name="global/frame_tpl" /}
<input type="hidden" class="page-load" id="myCollectionShopList" />
<style>
.modal-body {
/*height: 600px;*/
overflow-y: auto;
padding-bottom: 60px;
}
.user-ul2 {
width: 100%;
height: auto;
padding-bottom: 15px;
float: left;
}
.user-ul2 li {
list-style: none;
line-height: 30px;
}
.money_total_two {
font-weight: bold;
font-size: 15px;
}
#search {
float: left;
}
#reset {
float: left;
}
#district_id {
width: 16%!important;
}
#follow_up_con{
width: 32%!important;
}
.clear{
clear: both;
}
.btn-top-house{
margin-top: 20px;
text-align: center;
}
</style>
<div id="page-content-wrapper">
<div class="container">
<div class="row">
<div class="">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li>
<a href="javascript:;">商铺收藏</a>
</li>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<td colspan="10">
<form id="form_search">
</form>
</td>
</tr>
<tr>
<th class="text-center">编号</th>
<th class="text-center">类型</th>
<!--<th class="text-center">区域</th>-->
<th class="text-center">对内名称</th>
<th class="text-center">租金均价</th>
<th class="text-center">面积</th>
<th class="text-center">业态</th>
<!--<th class="text-center">最后跟进时间</th>-->
<!--<th class="text-center">状态</th>-->
<th class="text-center">操作</th>
</tr>
</thead>
<tbody class="text-center" id="follow_list">
</table>
</div>
<!-- /#page-content-wrapper -->
<div class="text-right" id="pagediv">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- #查看-->
<div class="modal fade modal_followup" id="modal_shop_detail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-one">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
&times;
</button>
<h4 class="modal-title detail-modal-header-tab" >
<a href="javascript:;" class="btn btn-default">商铺跟进</a>
<a href="javascript:;" class="btn btn-info">查看商铺</a>
</h4>
</div>
<div class="modal-body modal-body-one">
<div class="detail-modal-body-sec">
<div class="followup-modal-list-area">
<table class="table table-striped table-bordered table-hover table-condensed">
<tbody class="" id="modal_followup_table_list">
<tr>
<td>电话跟进:测试测试测试测试测试测试测试测试测试测试测试测试</td>
<td>刘丹丹</td>
<td>2017-09-05 15:22:33</td>
</tr>
<tr>
<td colspan="3">2017-09-05 15:22:33</td>
</tr>
</tbody>
</table>
</div>
<div class="followup-modal-comment-area">
<textarea></textarea>
</div>
<div class="btn-top-house">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" id="modal_followup_submit_btn">提交</button>
</div>
</div>
<div class="detail-modal-body-sec">
<iframe class="iframe-shop-detail"></iframe>
</div>
</div>
</div>
</div>
</div>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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