Commit cc26aca7 authored by clone's avatar clone

Merge branch '0910-v2.9.1' into test

parents f71a784d 6cb0ea73
......@@ -8,6 +8,7 @@ use app\model\AppointWatchShop;
use app\model\Evaluate;
use app\model\GHouses;
use app\model\GHousesImgs;
use app\model\GImageDepot;
use app\model\HouseInfos;
use app\model\OReportModel;
use think\helper\Time;
......@@ -30,6 +31,7 @@ class AppointmentTime extends Basic
protected $appliesModel;
protected $evaluateMode;
protected $reportModel;
protected $imageDepotModel;
function __construct($request = null)
{
......@@ -41,6 +43,7 @@ class AppointmentTime extends Basic
$this->appliesModel = new Applies();
$this->evaluateMode = new Evaluate();
$this->reportModel = new OReportModel();
$this->imageDepotModel = new GImageDepot();
}
/**
......@@ -212,17 +215,27 @@ class AppointmentTime extends Basic
public function getYetListV2($pageNo, $pageSize, $params)
{
$field = "a.id,a.report_agent_phone as phone,a.report_agent_id as agents_id,a.predict_see_time as expect_time,b.house_id,
d.external_title as house_title,d.residue_num as room_num_left, d.is_show,d.status";
d.external_title as house_title,d.residue_num as room_num_left, d.is_show,d.status,d.external_image_id";
$where_["a.user_id"] = $params["user_id"];
// $result = $this->appointmentTimeModel->getHaveToSeeList($pageNo, $pageSize, "id desc", $field, $where_);
$result = $this->reportModel->getHaveToSeeList($pageNo, $pageSize, "id desc", $field, $where_);
//获取图片信息
foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["house_id"];
$result[$key]["api_path"] = SHOP_IMAGE_DEPOT_URL;
/*$param["house_id"] = $val["house_id"];
$param["img_type"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);*/
$result[$key]["images"] = [];
if ($val["external_image_id"]) {
$param["id"] = array( "in", $val["external_image_id"] );
$param["img_status"] = 0;
$field = 'id,0 as house_id,img_type,label,img_name,img_status';
$res = $this->imageDepotModel->getImageDepotById($field, $param,1);
$result[$key]["images"] = count($res) > 0 ? $res : [];
}
//todo 是否评价
$evaluateResult = $this->evaluateMode->getIsEvaluate(10, $val["id"], $params["user_id"]);
$result[$key]["is_evaluate"] = count($evaluateResult) > 0 ? 1 : 0;
......@@ -238,8 +251,8 @@ class AppointmentTime extends Basic
*/
public function getWaitListV2($pageNo, $pageSize, $params)
{
$field = "a.id,a.report_agent_phone as phone,a.report_agent_id as agents_id,a.predict_see_time as expect_time,b.house_id,
d.external_title as house_title,d.residue_num as room_num_left";
$field = "a.id,a.report_agent_phone as phone,a.report_agent_id as agents_id,b.house_id,a.predict_see_time as expect_time,
d.external_title as house_title,d.residue_num as room_num_left,d.external_image_id";
$where_["user_id"] = $params["user_id"];
......@@ -247,10 +260,20 @@ class AppointmentTime extends Basic
//获取图片信息
foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["house_id"];
$result[$key]["api_path"] = SHOP_IMAGE_DEPOT_URL;
/* $param["house_id"] = $val["house_id"];
$param["img_type"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);*/
$result[$key]["images"] = [];
if ($val["external_image_id"]) {
$param["id"] = array( "in", $val["external_image_id"] );
$param["img_status"] = 0;
$field = 'id,0 as house_id,img_type,label,img_name,img_status';
$res = $this->imageDepotModel->getImageDepotById($field, $param,1);
$result[$key]["images"] = count($res) > 0 ? $res : [];
}
//todo 是否评价
$evaluateResult = $this->evaluateMode->getIsEvaluate(10, $val["id"], $params["user_id"]);
$result[$key]["is_evaluate"] = count($evaluateResult) > 0 ? 1 : 0;
......
......@@ -5,6 +5,7 @@ namespace app\api\controller;
use app\api\extend\Basic;
use app\model\AttentionModel;
use app\model\GHousesImgs;
use app\model\GImageDepot;
use think\Request;
use app\model\HouseImgs;
......@@ -21,6 +22,7 @@ class AttentionShop extends Basic
protected $attentionModel;
protected $dbImg;
protected $imgModel;
protected $imageDepotModel;
public function __construct($request = null)
{
......@@ -28,6 +30,7 @@ class AttentionShop extends Basic
$this->attentionModel = new AttentionModel();
$this->dbImg = new HouseImgs();
$this->imgModel = new GHousesImgs();
$this->imageDepotModel = new GImageDepot();
}
/**
......@@ -77,7 +80,7 @@ class AttentionShop extends Basic
$order_ = 'a.create_time desc';
//b.room_num_left 前端显示已下架,不可点击到详情
$field = "a.id,a.house_id,b.external_title as title,b.shop_area_start as room_area,b.shop_area_end as room_area2,b.rent_price as price,
b.shop_sign as shangpu_tags,b.shop_type as shangpu_type,b.residue_num as room_num_left,b.rent_type";
b.shop_sign as shangpu_tags,b.shop_type as shangpu_type,b.residue_num as room_num_left,b.rent_type,b.external_image_id";
if (!isset($params["user_id"])) {
return $this->response("101", "用户id不能为空");
......@@ -90,11 +93,20 @@ class AttentionShop extends Basic
}
foreach ($result as $key => $val) {
$result[$key]["price"] = $val["price"] * 0.01;
$result[$key]["api_path"] = IMG_PATH;
$imgParam["house_id"] = $val["house_id"];
$result[$key]["api_path"] = SHOP_IMAGE_DEPOT_URL;
/* $imgParam["house_id"] = $val["house_id"];
$imgParam["img_type"] = 1; //默认主图
$imgArr = $this->imgModel->getHouseImages($imgParam, 1);
$result[$key]["images"] = $imgArr;
$result[$key]["images"] = $imgArr;*/
if ($val["external_image_id"]) {
$param["id"] = array( "in", $val["external_image_id"] );
$param["img_status"] = 0;
$field = 'id,0 as house_id,img_type,label,img_name,img_status';
$res = $this->imageDepotModel->getImageDepotById($field, $param,1);
$result[$key]["images"] = count($res) > 0 ? $res : [];
}
}
......
......@@ -172,8 +172,11 @@ class Member extends Basic
* @throws \think\exception\DbException
*/
public function register() {
return $this->response(101, '版本升级,请去官网或应用商店下载更新APP!');
$type = $this->request->param('type');
$type = $this->request->param('type');
if ($type == 'add') {
return $this->response(101, '版本升级,请去官网或应用商店下载更新APP!');
}
$phone = $this->request->param('phone');
$pwd = $this->request->param('pwd');
$user_nick = $this->request->param('user_nick');
......@@ -227,102 +230,6 @@ class Member extends Basic
$pwd = md5(md5($pwd) . '+123');
switch ($type) {
case 'add' :
$this->user->startTrans();
if ($pwd == '') {
return $this->response(101, '密码为空');
}
if ($phone == '') {
return $this->response(101, '手机号码为空');
}
if (!empty($user_data->id) && ($user_data->status != -1)) {
return $this->response(101, '该手机号已注册');
}
if ($this->params['code'] == $code && $code == '') {
return $this->response(101, '验证码错误');
}
$referrer_id = $this->request->param('referrer_id');
$referrer_source = $this->request->param('referrer_source');
$user_nick = isset($this->params['user_nick']) ? $this->params['user_nick'] : $user_data['user_nick'];
if (!empty($referrer_id)) {
if ($referrer_source == 20 && ($user_data['status'] != -1)){
$insert_data['agent_id'] = $referrer_id; //客方也是经纪人
} elseif ($referrer_source == 10) {
//统计经纪人id,目前保留两级,经纪人(id)→用户1(agent_id)→用户2(agent_id)
//邀请人是一级,被邀请人是二级
//查找邀请人的信息
$referrer_user = $this->user->field('id,agent_id,referrer_id,referrer_source,source')
->where('id', $referrer_id)
->find();
if (!empty($referrer_user['id'])) {
//经纪人邀请的客户,客户再去邀请客户客方为二级
if ($referrer_user['referrer_source'] == 20) {
$insert_data['agent_id'] = $referrer_user['agent_id']; //2 级
} else {
//客户邀请客户客方保留2级
$referrer_user_agent_id = $this->user
->field('id,agent_id,referrer_id')
->where('referrer_id', $referrer_id)
->where('agent_id', $referrer_user['agent_id'])
->find();
if (empty($referrer_user_agent_id)) {
$insert_data['agent_id'] = $referrer_user_agent_id['agent_id']; //2 级
}
}
}
}
}
$insert_data['referrer_id'] = $referrer_id; //经纪人邀请
$insert_data['referrer_source'] = $referrer_source;
$insert_data['status'] = 0;
$insert_data['create_time'] = $date;
$insert_data['user_phone'] = $phone;
$insert_data['user_pswd'] = $pwd;
$insert_data['user_nick'] = $user_nick;
$insert_data['user_pic'] = $user_pic;
$insert_data['registration_time'] = $date;
if (isset($user_data['id'])) {
$result = $this->user->save($insert_data, ['id'=>$user_data['id']]); //注册(激活)用户
$id = empty($result) ? 0 : $user_data['id'];
} else {
$this->user->save($insert_data); //注册用户
$id = $this->user->id;
}
if (empty($id)) {
$this->user->rollback();
$data['status'] = 101;
$data['msg'] = '注册失败';
} else {
$this->user->commit();
$jwt_data['id'] = $id;
$jwt_data['userNick'] = $insert_data['user_nick'];
$jwt_data['phone'] = $insert_data['user_phone'];
$jwt = new JwtUntils();
$insert_data['AuthToken'] = $jwt->createToken($jwt_data);
$insert_data['id'] = $id;
$data['data'] = $insert_data;
$data['msg'] = '注册成功';
$data['status'] = 200;
if (!empty($insert_data['agent_id'])) {
$push = new PushMessageService();
$content = '你有新客户【'.$phone.'】成功注册App';
$push->pushMessageById($insert_data['agent_id'],'邀请注册', $content);
}
}
break;
case 'forget' :
if ($pwd == '') {
return $this->response(101, '密码为空');
......@@ -386,7 +293,6 @@ class Member extends Basic
$data['status'] = 101;
$data['msg'] = '编辑失败';
}
break;
}
return $this->response($data['status'], $data['msg'], $data['data']);
}
......
......@@ -806,7 +806,7 @@ class OrderLog extends Basic
if (!empty($where)) {
//获取被修改人信息
$m_agent = new AAgents();
$agent_data = $m_agent->agentBragainDetail('a.id,a.store_id,a.district_id,b.create_time', ['b.id'=>$bargain_id]);
$agent_data = $m_agent->agentBargainDetail('a.id,a.store_id,a.district_id,b.create_time', ['b.id'=>$bargain_id]);
//更新业绩统计
$sum = new ResultsSummaryNewTask();
......
......@@ -4,9 +4,9 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\LookShopService;
use app\api_broker\service\PushMessageService;
use app\api_broker\service\VerifyService;
use app\api_broker\service\VipService;
use app\index\service\HouseService;
use app\index\validate\HouseValidate;
use app\model\AAgents;
use app\model\ACollectHouse;
......@@ -114,19 +114,6 @@ class Shop extends Basic
$conditions['internal_address'] = array( "like", "%" . trim($params['address']) . "%" );
}
$houseIds = "";
if (isset($params['landlord_phone'])) {
$houseIds = $this->returnHouseId($params['landlord_phone']);
if (empty($houseIds)) {
return $this->response("200", "此条件没有找到数据");
}
}
if (isset($params['house_id'])) {
$houseIds = $params['house_id'];
}
if (!empty($houseIds)) {
$conditions['id'] = array( "in", $houseIds );
}
if (isset($params['start_time']) && isset($params['end_time'])) {
$start_time = date('Y-m-d H:i:s', $params['start_time']);
......@@ -211,6 +198,23 @@ class Shop extends Basic
$conditions['status'] = !empty($params['status']) ? $params['status'] : array( 'in', "1,2" ); //b端搜索显示上架下架的
}
}
$houseIds = "";
if (isset($params['house_id'])) {
$houseIds = $params['house_id'];
} else {
if (isset($params['landlord_phone'])) {
$houseIds = $this->returnHouseId($params['landlord_phone']);
if (empty($houseIds)) {
return $this->response("200", "此条件没有找到数据");
}
}
}
if (!empty($houseIds)) {
$conditions['id'] = array( "in", $houseIds );
}
//如果有传经纪人id则代表我的商铺不区分状态
if (isset($params['agent_id'])) {
unset($conditions["city"]);
......@@ -430,7 +434,33 @@ class Shop extends Basic
*/
public function edit()
{
return $this->response(101, '请升级最新版本');
$result['code'] = 200;
$result['msg'] = '';
$result_data = [];
if ($this->request->isPost()) {
$house = new HouseService();
$data = $house->addHouse($this->params, $this->agentId, 1);
if ($data['status'] == 'successful') {
$result_data['house_id'] = $data['data']['house_id'];
$result_data['internal_title'] = $data['data']['internal_title'];
$result['msg'] = '新增或编辑成功';
} else {
$result['code'] = 101;
$result['msg'] = 'Add houses failure';
}
} else {
if (empty($this->params['id'])) {
$result['code'] = 101;
$result['msg'] = 'Id is null';
} else {
//获取商铺详情
$result_data = $this->gHousesModel->getHouseById($this->params['id'], 1);
}
}
return $this->response($result['code'], $result['msg'], $result_data);
}
/**
......
......@@ -34,6 +34,7 @@ class Statement extends Basic
*/
public function dayStatement()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/*$params = array(
......
......@@ -74,15 +74,15 @@ class User extends Basic
"money_end" => 10000,//租金
"start_time" => "2016-05-25",
"end_time" => "2018-05-30",
"id" => 1,
"id" => 1,
"user_name" => "12312",
"user_phone" => "138171212",
"pageNo" => 1,
"agent_id" => 5741,//传经纪人id代表我得客户
"pageSize" => 15,
"status" => 0,
"pageNo" => 1,
"agent_id" => 5741,//传经纪人id代表我得客户
"pageSize" => 15,
"status" => 0,
);*/
$field = "id as user_id,sex,user_name,city,user_phone,user_status,agent_id,create_time,industry_type,price_demand,area_demand,vip";
$field = "id as user_id,sex,user_name,city,user_phone,user_status,agent_id,create_time,industry_type,price_demand,area_demand,vip,user_label,source_intro";
$conditions = [];
......@@ -94,17 +94,21 @@ class User extends Basic
if (isset($params['user_status'])) {
$conditions['user_status'] = $params['user_status'];
}
$is_search = false;
if (isset($params['id'])) {
$conditions['id'] = $params['id'];
$is_search = true;
}
if (isset($params['user_name'])) {
$conditions['user_name'] = array( "like", "%" . trim($params['user_name']) . "%" );
$is_search = true;
}
if (isset($params['user_phone'])) {
$conditions['user_phone'] = array( "like", "%" . trim($params['user_phone']) . "%" );
$is_search = true;
}
if (isset($params['yetai'])) {
......@@ -144,6 +148,11 @@ class User extends Basic
//传了经纪人id则表示我的客户
if (isset($params["agent_id"])) {
$conditions['agent_id'] = $params['agent_id'];
$is_search = false;
}
if (!$is_search) {
$conditions['user_label'] = array( "neq", 2 );
}
$userList = $this->userModel->selectUserList($field, $conditions, $pageNo, $pageSize, "id desc");
......@@ -154,6 +163,15 @@ class User extends Basic
$clientService = new ClientService();
foreach ($userList as $k => $v) {
/*判断是否纯房东 0:否 1:是 start*/
$is_single_homeowner = 0;
if ($v['user_label'] == 2) {
//source 41纯房东
$is_single_homeowner = 1;
}
$userList[$k]['is_single_homeowner'] = $is_single_homeowner;
/*判断是否纯房东 end*/
$is_show = $clientService->dialTotal($v["user_id"]);
$userList[$k]['sign_call'] = $is_show ? 0 : 1;
......@@ -449,9 +467,9 @@ class User extends Basic
// $model = new AAgents();
/* $result = $model->searchAgentsByKeyword("id,name,phone", [ "id" => $params["agent_id"]]);
$call = new CallPhoneService();
$gresult = $call->getBindNum($user_res['user_phone'],$result[0]['phone']);*/
/* $result = $model->searchAgentsByKeyword("id,name,phone", [ "id" => $params["agent_id"]]);
$call = new CallPhoneService();
$gresult = $call->getBindNum($user_res['user_phone'],$result[0]['phone']);*/
// 判断当天被拨打是否超过5次
$clientService = new ClientService();
if (!$clientService->dialTotal($user_res[0]['id'])) {
......@@ -614,13 +632,13 @@ class User extends Basic
}
// 判断当天被拨打是否超过5次
$model_agent = new AAgents();
$result = $model_agent->searchAgentsByKeyword("id,name,phone", [ "id" => $params["agent_id"]]);
$call = new CallPhoneService();
$gresult = $call->getBindNum($model_res['user_phone'],$result[0]['phone']);
$model_agent = new AAgents();
$result = $model_agent->searchAgentsByKeyword("id,name,phone", [ "id" => $params["agent_id"] ]);
$call = new CallPhoneService();
$gresult = $call->getBindNum($model_res['user_phone'], $result[0]['phone']);
$clientService = new ClientService();
if (!$clientService->dialTotal($model_res[0]['user_id']) && $gresult==0) {
return $this->response("201", "当天被拨打超过5次", ['id'=>$model_res[0]['id']]);
if (!$clientService->dialTotal($model_res[0]['user_id']) && $gresult == 0) {
return $this->response("201", "当天被拨打超过5次", [ 'id' => $model_res[0]['id'] ]);
}
//如果非客方
......
......@@ -216,16 +216,17 @@ class PushMessageService
* @param $content
* @param null $type
* @param null $user_id
* @param int $is_forbidden
* @return array|bool
*/
public function pushAgentAllDeviceId($id, $title, $content, $type = null, $user_id = null)
public function pushAgentAllDeviceId($id, $title, $content, $type = null, $user_id = null, $is_forbidden = 0)
{
if (empty($id)) {
return false;
}
$m_agent_device = new ABindingDevice();
$device_id_array = $m_agent_device->getDeviceByAgentId([ 'agent_id' => $id, 'is_forbidden' => 0 ], 'id,push_id');
$device_id_array = $m_agent_device->getDeviceByAgentId([ 'agent_id' => $id, 'is_forbidden' => $is_forbidden, 'is_pc'=>0 ], 'id,push_id');
$result = [];
if (!empty($device_id_array)) {
foreach ($device_id_array as $k => $v) {
......@@ -262,32 +263,33 @@ class PushMessageService
*/
public function record($type, $house_id, $agent_id, $operation_id, $data = [])
{
$result = false;
$m_push = new MPushMessage();
switch ($type) {
case 0 :
$result = $m_push->addData($data, $operation_id, $type);
break;
case 1 :
$result = $m_push->addHouseIdArray($house_id, $operation_id, $type, $data);
break;
case 2 :
$result = $m_push->addAgentIdArray($agent_id, $operation_id, $type, $data);
break;
case 3 :
$data['house_id'] = $house_id;
$result = $m_push->addAgentIdArray($agent_id, $operation_id, $type, $data);
break;
default :
$result = $m_push->addData($data, $operation_id, $type);
}
return $result;
}
/**
*
* 消息推送
*/
public function pushRecord()
{
$title = '';
$title = $type = '';
$m_push = new MPushMessage();
$field = 'id,addressee_id,type,message,house_id';
$where['status'] = 0;
$field = 'id,addressee_id,type,message,house_id,user_id';
$where['status'] = $id = $is_forbidden = 0;
$push_data = $m_push->getDateLimit($field, $where, 100);
foreach ($push_data['data'] as $k => $v) {
......@@ -298,16 +300,27 @@ class PushMessageService
switch ($v['type']) {
case 1 :
$title = "商铺下架";
$id = $v['house_id'];
$type = 'house_info';
break;
case 2:
$title = "修改客方";
$type = 'user_info';
$id = $v['user_id'];
break;
case 3:
$title = '盘方修改';
$id = $v['house_id'];
$type = 'house_info';
break;
case 4:
$title = '账号冻结';
$id = $v['addressee_id'];
$type = 'down_line';
$is_forbidden = 1;
}
$result = $this->pushAgentAllDeviceId($v['addressee_id'], $title, $v['message'], 'house_info', $v['house_id']);
$result = $this->pushAgentAllDeviceId($v['addressee_id'], $title, $v['message'], $type, $id, $is_forbidden);
$update_data['status'] = 1;
$update_data['send_time'] = date('Y-m-d H:i:s');
......
......@@ -131,6 +131,13 @@ class StatementService
}
}
/*获取店长个人 房源数 客源数 带看数 成交数*/
$result["store_manager_list"] = [];
if ($user_type == 1) {
$store_manager_list_res = $this->getStoreManagerList($store_id, $conditions['create_time']);
$result["store_manager_list"] = $store_manager_list_res;
}
$result["agent_total"] = $agent_total;
$result["house_num"] = $this->houseModel->getAddHouseNumByAgentId($conditions);
......@@ -373,6 +380,41 @@ class StatementService
$store_list["add_user_num"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
return $store_list;
}
/**
* 获取店长个人 房源数 客源数 带看数 成交数
* @param $store_id
* @param $create_time
* @return mixed
*/
private function getStoreManagerList($store_id,$create_time)
{
/*1.查询店长ID*/
$params_['store_id'] = $store_id;
$params_['level'] = 20;
$agents_id = $this->agentModel->getAgentsManagerID($params_);
/*2.根据店长ID组装查询条件*/
$conditions_["agent_id"] = $agents_id[0]['id'];
$conditions_["create_time"] = $create_time;
/*3.根据条件查询 店长个人 房源数 客源数 带看数 成交数 */
// 房源
$addHouseNum = $this->houseModel->getAddHouseNumGroupTimeNew($conditions_);
$result["house_num"] = $addHouseNum[0]["num"];
// 客源
$addUserNum = $this->userModel->getAddUserNum($conditions_);
$result["add_user_num"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
// 带看
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions_);
$result["look_at_num_day_store"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
// 成交
$obargain = new OBargainModel();
$performanceSum = $obargain->getAddBargainNum($conditions_, 3);//1表示业绩 2表示实收
$result["bargain_sum_store"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
return $result;
}
/**
......
......@@ -165,7 +165,7 @@
<!--line 5-->
<div class="b4_font">
<p class="b4_font_p">
签约规则
商务条款
</p>
<p class="b5_font_p1 yw">
</p>
......
......@@ -30,7 +30,7 @@
top: 0;
bottom: 0;
right: .66rem;
display: block;
display: none;
width: .88rem;
height: .88rem;
}
......@@ -126,6 +126,8 @@
<p>创建时间:<span id="add_time"></span></p>
<p>注册时间:<span id="register_time"></span></p>
<p>下载登录时间:<span id="login_time"></span></p>
<p>客户来源:<span id="source_intro"></span></p>
</div>
<div class="record-main">
<p>客方修改日志</p>
......@@ -215,7 +217,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?new59"></script>
<script src="/app/js/customerinfo_details_new.js?new61"></script>
</body>
......
......@@ -46,7 +46,7 @@
</tr>
<tr>
<td colspan="2">交通:{{d.traffic}}</td>
<td colspan="2">签约规则:{{signRule()}}</td>
<td colspan="2">商务条款:{{signRule()}}</td>
</tr>
<tr>
<td colspan="2">对内项目优势:{{d.internal_item_advantage}}</td>
......@@ -61,7 +61,7 @@
<tr>
<td>面宽:{{d.area_width}}米</td>
<td>进深:{{d.depth}}米</td>
<td>电量:{{d.electric_quantity}}W</td>
<td>电量:{{d.electric_quantity}}KW</td>
<td>电压:{{d.voltage}}V</td>
</tr>
<tr>
......
......@@ -63,7 +63,7 @@
<button class="weekly_btn" @click.prevent.stop="goToNewPage">确认</button>
</div>
<script src="/app/js/libs/require.min.js" data-js="/app/js/weekly.js" data-main="/app/js/main" defer async="true"></script>
<script src="/app/js/libs/require.min.js" data-js="/app/js/weekly.js?new1" data-main="/app/js/main" defer async="true"></script>
</body>
</html>
\ No newline at end of file
......@@ -115,19 +115,83 @@
<tr class="table-tr-textarea tr-padding60">
<td>业绩方面的总结和措施方法</td>
<td colspan="6">
<div class="div-textarea" contenteditable="true">点击填写</div>
<div class="div-textarea" contenteditable="true" id="mendianzhou_text_data1">点击填写</div>
</td>
</tr>
<tr class="table-tr-textarea tr-padding60">
<td>人员方面的总结和措施方法</td>
<td colspan="6">
<div class="div-textarea" contenteditable="true">点击填写</div>
<div class="div-textarea" contenteditable="true" id="mendianzhou_text_data2">点击填写</div>
</td>
</tr>
<tr class="table-tr-textarea tr-padding60">
<td>日数据管理方案</td>
<td colspan="6">
<div class="div-textarea" contenteditable="true" id="mendianzhou_text_data3">点击填写</div>
</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="0" cellpadding="0" class="table-type11">
<tbody>
<tr class="table-tr-single"><td colspan="7">店长个人本周数据</td></tr>
<tr class="table-tr-header">
<td>房源</td>
<td>客源</td>
<td>带看</td>
<td>跟进</td>
<td>成交</td>
<td>网络</td>
<td>处罚金额</td>
</tr>
<tr class="table-tr-gerenshuju">
<td></td>
<td></td>
<td></td>
<td><input type="number" placeholder="填写" /></td>
<td></td>
<td><input type="number" placeholder="填写" /></td>
<td><input type="number" placeholder="填写" /></td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="0" cellpadding="0" class="table-type1">
<tbody>
<tr class="table-tr-single"><td colspan="6">店长下周目标个人数据</td></tr>
<tr class="table-tr-header">
<td>房源</td>
<td>客源</td>
<td>带看</td>
<td>跟进</td>
<td>成交</td>
<td>网络</td>
</tr>
<tr>
<td><input type="number" placeholder="填写" /></td>
<td><input type="number" placeholder="填写" /></td>
<td><input type="number" placeholder="填写" /></td>
<td><input type="number" placeholder="填写" /></td>
<td><input type="number" placeholder="填写" /></td>
<td><input type="number" placeholder="填写" /></td>
</tr>
<tr class="table-tr-textarea tr-padding60">
<td>店长个人自律事项</td>
<td colspan="6">
<div class="div-textarea" contenteditable="true" id="dianzhanggeren_text_data1">点击填写</div>
</td>
</tr>
<tr class="table-tr-textarea tr-padding60">
<td>创新建议</td>
<td colspan="6">
<div class="div-textarea" contenteditable="true" id="dianzhanggeren_text_data2">点击填写</div>
</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="0" cellpadding="0" class="table-type2">
<!--<table border="0" cellspacing="0" cellpadding="0" class="table-type2">
<tbody>
<tr class="table-tr-single">
<td colspan="2">业态分析</td>
......@@ -145,7 +209,7 @@
</td>
</tr>
</tbody>
</table>
</table>-->
<table border="0" cellspacing="0" cellpadding="0" class="table-type6">
<tbody id="yejiInfoArea">
......@@ -176,13 +240,13 @@
<tr class="table-tr-textarea tr-padding60">
<td>点评优秀员工</td>
<td colspan="4">
<div class="div-textarea" contenteditable="true">点击填写</div>
<div class="div-textarea" contenteditable="true" id="yuangong_text_data1">点击填写</div>
</td>
</tr>
<tr class="table-tr-textarea tr-padding60">
<td>点评须进步员工</td>
<td colspan="4">
<div class="div-textarea" contenteditable="true">点击填写</div>
<div class="div-textarea" contenteditable="true" id="yuangong_text_data2">点击填写</div>
</td>
</tr>
</tbody>
......
......@@ -22,6 +22,7 @@ use app\model\GHousesImgs;
use app\model\HouseImgs;
use app\model\HouseinfoExts;
use app\model\HouseInfos;
use app\model\MPushMessage;
use app\model\Users;
use think\Cache;
use think\Exception;
......@@ -361,7 +362,6 @@ class AppChat extends Basic
}
/**
* 获取聊天关系
* @return \think\Response
......@@ -409,9 +409,9 @@ class AppChat extends Basic
public function getUserInfoByFrom()
{
$params = $this->params;
/*$params = array(
'id' => 1,
);*/
/*$params = array(
'id' => 1,
);*/
if (!isset($params['id'])) {
return $this->response("300", "参数不全");
}
......@@ -422,16 +422,16 @@ class AppChat extends Basic
//3.ID
//4.手机号隐藏中间4位
$user = new Users();
$field = 'a.id,a.user_name,a.user_nick,a.user_phone,a.user_pic,a.other_pic';
$user = new Users();
$field = 'a.id,a.user_name,a.user_nick,a.user_phone,a.user_pic,a.other_pic';
$params_["a.id"] = $params['id'];
$result = $user->getAgentByUserId($field, $params_);
$result = $user->getAgentByUserId($field, $params_);
if (count($result) > 0) {
$result_["id"] = $result[0]["id"];
$result_["agent_id"] = 'agent_'.$result[0]["id"];
$result_["user_name"] = $result[0]["user_name"];
$result_["user_nick"] = $result[0]["user_nick"];
$result_["user_pic"] = !empty($result[0]["user_pic"]) ? HEADERIMGURL . $result[0]["user_pic"] : $result[0]["other_pic"];
$result_["id"] = $result[0]["id"];
$result_["agent_id"] = 'agent_' . $result[0]["id"];
$result_["user_name"] = $result[0]["user_name"];
$result_["user_nick"] = $result[0]["user_nick"];
$result_["user_pic"] = !empty($result[0]["user_pic"]) ? HEADERIMGURL . $result[0]["user_pic"] : $result[0]["other_pic"];
$result_["user_phone"] = $result[0]["user_phone"];
return $this->response("200", "success!", $result_);
......@@ -441,5 +441,69 @@ class AppChat extends Basic
}
/**系统消息商铺修改消息
* @return \think\Response
*/
public function getSystemMessageByShop()
{
$params = $this->params;
/* $params = array(
"agent_id" => 5740,
'page_no' => '1', //第几页
'page_size' => '15' //每页多少条
);*/
if (!isset($params['agent_id'])) {
return $this->response("101", "请求参数错误");
}
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$field = "id,addressee_id,type,message,house_id,create_time";
//获取此经纪人的所有盘方楼盘id
$param["addressee_id"] = $params["agent_id"];
$param["type"] = array( "in", "1,3" );
$msgModel = new MPushMessage();
$history_result = $msgModel->getListByWhere($field, $param, $page_no, $page_size);
return $this->response("200", "request success", $history_result);
}
/**
* 系统消息客户修改消息
* @return \think\Response
*/
public function getSystemMessageByUser()
{
$params = $this->params;
/* $params = array(
"agent_id" => 5741,
'page_no' => '1', //第几页
'page_size' => '15' //每页多少条
);*/
if (!isset($params['agent_id'])) {
return $this->response("101", "请求参数错误");
}
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$field = "id,addressee_id,type,message,user_id,create_time";
//获取此经纪人的所有盘方楼盘id
$param["addressee_id"] = $params["agent_id"];
$param["type"] = 2;
$msgModel = new MPushMessage();
$history_result = $msgModel->getListByWhere($field, $param, $page_no, $page_size);
return $this->response("200", "request success", $history_result);
}
}
......@@ -22,17 +22,13 @@
namespace app\index\controller;
use app\api_broker\service\CallPhoneService;
use app\api_broker\service\PushMessageService;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\ABindingDevice;
use app\model\Agents;
use app\model\AStore;
use app\model\BindingPhone;
use app\model\Evaluate;
use app\model\Regions;
use think\Exception;
use think\Session;
use think\Db;
class Agent extends Basic
{
......@@ -83,14 +79,14 @@ class Agent extends Basic
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//条件
// $where['a.status'] = ['IN',['0,1']];
$where['a.id'] = ['<>', 1];
$where['a.id'] = [ '<>', 1 ];
if (!empty($params['search'])) {
$where[] = ['EXP', "a.name like '%{$params['search']}%' OR a.phone like '%{$params['search']}%'"];
$where[] = [ 'EXP', "a.name like '%{$params['search']}%' OR a.phone like '%{$params['search']}%'" ];
}
if (!empty($params['group_name'])) {
$where['g.title'] = ['LIKE', "%{$params['group_name']}%"];
$where['g.title'] = [ 'LIKE', "%{$params['group_name']}%" ];
}
if (!empty($params['store_id'])) {
......@@ -134,11 +130,11 @@ class Agent extends Basic
$params["agent_id"] = $agent_id;
$field = "id,agent_id,device_id,model,is_forbidden,is_pc,create_time,update_time";
$result = $aBD->getDeviceByAgentId($params,$field);
if(count($result) > 0){
return $this->response("200","success",$result);
}else{
return $this->response("101","此账号未绑定过设备");
$result = $aBD->getDeviceByAgentId($params, $field);
if (count($result) > 0) {
return $this->response("200", "success", $result);
} else {
return $this->response("101", "此账号未绑定过设备");
}
}
......@@ -282,20 +278,25 @@ class Agent extends Basic
//同时修改设备绑定表
$m_agent_device = new ABindingDevice();
$m_agent_device->updateDate(['is_forbidden'=>$is_forbidden], ['agent_id'=>$ids]);
$m_agent_device->updateDate([ 'is_forbidden' => $is_forbidden ], [ 'agent_id' => $ids ]);
if ($data['status'] == 1) {
$where['a.id'] = $ids;
$where['b.status'] = 1;
$agent_phone = $m_agent->getAgentCallPhone('b.phone_a,b.phone_b,c.phone_x', $where);
$agent_phone = $m_agent->getAgentCallPhone('b.phone_a,b.phone_b,c.phone_x', $where);
if (!empty($agent_phone['data']) && $agent_phone['status'] != 'fail') {
$call = new CallPhoneService();
foreach ($agent_phone['data'] as $k=>$v) {
foreach ($agent_phone['data'] as $k => $v) {
$call->agentsUnBind($v['phone_a'], $v['phone_b'], $v['phone_x'], 0);
}
}
$push = new PushMessageService();
$message_data['message'] = '你的账号被冻结。';
$message_data['agent_id'] = $ids;
$push->record(4, 0, 0, $this->userId, $message_data);
}
return $this->response(200, '成功', $data);
} else {
......@@ -336,7 +337,6 @@ class Agent extends Basic
}
/**
* 经纪人列表计算-评价次数和分数
* 朱伟 2018年07月03日
......@@ -347,28 +347,28 @@ class Agent extends Basic
/*$data = array(
"agents_id" => '869,5758,5757,5756,5755,5754,5753,5752,5751,5750,5749,5748,5747,5746,5745'
);*/
$agents_ids = $data['agents_id'];
$agents_ids = $data['agents_id'];
if (!isset($agents_ids)) {
return $this->response("300", "参数不全");
}
$model = new Evaluate();
foreach (explode(',',$agents_ids) as $k => $v){
foreach (explode(',', $agents_ids) as $k => $v) {
$params['agents_id'] = $v;
//dump($v);
$field='sum(evaluate_grade) as agent_evaluate_fraction';
$agent_evaluate_num = $model->getAgentEvaluateNum($params);
$agent_evaluate_fraction_res = $model->getAgentEvaluateFraction($field,$params);
$agent_evaluate_fraction = 0;
if($agent_evaluate_fraction_res[0]['agent_evaluate_fraction']){
$agent_evaluate_fraction = round($agent_evaluate_fraction_res[0]['agent_evaluate_fraction']/2 /$agent_evaluate_num,1);
$field = 'sum(evaluate_grade) as agent_evaluate_fraction';
$agent_evaluate_num = $model->getAgentEvaluateNum($params);
$agent_evaluate_fraction_res = $model->getAgentEvaluateFraction($field, $params);
$agent_evaluate_fraction = 0;
if ($agent_evaluate_fraction_res[0]['agent_evaluate_fraction']) {
$agent_evaluate_fraction = round($agent_evaluate_fraction_res[0]['agent_evaluate_fraction'] / 2 / $agent_evaluate_num, 1);
}
$res['agents_id'] = $v;
$res['agent_evaluate_num'] = $agent_evaluate_num;
$res['agent_evaluate_fraction'] = $agent_evaluate_fraction;
$result[] = $res;
$res['agents_id'] = $v;
$res['agent_evaluate_num'] = $agent_evaluate_num;
$res['agent_evaluate_fraction'] = $agent_evaluate_fraction;
$result[] = $res;
}
if ($result) {
......
This diff is collapsed.
......@@ -704,4 +704,26 @@ class Houses extends Basic
return $this->response(101, '锁盘失败!');
}
}
/**
* 商铺修改日志
*
* @return \think\Response
*/
public function getEditLog() {
if (empty($this->params['house_id'])) {
return $this->response(101, '参数错误');
}
$msg = '';
$house = new HouseService();
$data = $house->getEditLog($this->params['house_id']);
if ($data['status'] == 'successful') {
$code = 200;
} else {
$code = 101;
$msg = '获取数据失败'.$data['msg'];
}
return $this->response($code, $msg, $data['data']);
}
}
\ No newline at end of file
<?php
namespace app\index\controller;
/**
* Created by PhpStorm.
* User: liu yin ping
* Date: 2018/9/10
* Time: 13:10
*/
use app\index\extend\Basic;
class InviteStatistics extends Basic
{
public function inviteStatisticsList()
{
if (!$this->request->isAjax()) {
return view('inviteStatistics/inviteStatisticsList');
}
}
}
\ No newline at end of file
<?php
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\AStore;
use app\model\Users;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/9/11
* Time : 16:37
* Intro:
*/
class InviteTotal extends Basic
{
public function getFirstLoginTotal()
{
$params = $this->params;
/* $params = array(
"district_id" => 5,
//"store_id" => 1,
"start_time" => "2018-03-01",
"end_time" => "2018-10-01",
"page_no" => 1,
"page_size" => 30
);*/
if (empty($params["district_id"])) {
return $this->response("101", "请选择部门或门店");
} else {
$param["b.district_id"] = $params["district_id"];
}
if (!empty($params["store_id"])) {
$param["b.store_id"] = $params["store_id"];
}
if (empty($params["start_time"]) || empty($params["end_time"])) {
return $this->response("101", "请选择时间");
} else {
$param["a.first_login_time"] = array( "between", array( $params["start_time"], $params["end_time"] . " 23:59:59" ) );
}
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 30 : $params['page_size'];
$field = 'count(a.id) num ,b.id,b.name,b.store_id,b.district_id';
$param["a.referrer_source"] = 20;
$param["a.status"] = 0;
$userModel = new Users();
$data_list = $userModel->getInviteTotal($field, $param, $page_no, $page_size);
$getInviteCount = $userModel->getInviteCount($param);
$storeModel = new AStore();
foreach ($data_list as $key => $item) {
$info = $storeModel->getStoreAndDistrict($item["store_id"]);
$data_list[$key]["district_name"] = $info["district_name"];
$data_list[$key]["store_name"] = $info["store_name"];
}
$result["list"] = $data_list;
$result["total"] = $getInviteCount;
return $this->response("200", "success", $result);
}
}
\ No newline at end of file
<?php
namespace app\index\controller;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2018/9/10
* Time: 15:40:20
*/
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\ADistrict;
use app\model\ChatRelation;
use app\model\GHouses;
use app\model\OBargainModel;
use app\model\OMarchInModel;
use app\model\Users;
class OperationData extends Basic
{
private $gHousesModel;
private $userModel;
private $marchInModel;
public function __construct($request = null)
{
parent::__construct($request);
$this->gHousesModel = new GHouses();
$this->userModel = new Users();
$this->marchInModel = new OMarchInModel();
}
/**
* 发起微聊用户数
* @return \think\Response
*/
public function chatUserNum()
{
$params = $this->params;
$where['create_time'] = [ 'between', [ $params['create_time_start'] . ' 00:00:00', $params['create_time_end'] . ' 23:59:59' ] ];
// 发起微聊用户数
$chatRelationModel = new ChatRelation();
$where['from_id'] = [ 'LIKE', '%user_%' ];
$group = '';
$res = $chatRelationModel->getChatUserNumOperation($where, $group);
$result["chat_user_all_num"] = $res;
$group = 'from_id';
$res = $chatRelationModel->getChatUserNumOperation($where, $group);
$result["chat_user_num"] = $res;
return $this->response(200, 'success', $result);
}
/**
* 客户来电数
* @return \think\Response
*/
public function userPhoneNum()
{
$params = $this->params;
$where['create_time'] = [ 'between', [ $params['create_time_start'] . ' 00:00:00', $params['create_time_end'] . ' 23:59:59' ] ];
// 先查新所有部门
$district_list = $this->getDistrict();
foreach ($district_list as $key => $v) {
$result_["id"] = $v['id'];
$result_["district_name"] = $v['district_name'];
// 客户来电数
$params = [];
$params["district_id"] = $v['id'];
$params["status"] = 0; //只查询正常状态的经纪人
$field = "sum(call_number) as call_number_total";
$agentModel = new AAgents();
$res = $agentModel->getUserPhoneNum($field, $params);
$result_["user_phone_num"] = isset($res[0]["call_number_total"]) ? $res[0]["call_number_total"] : 0;;
$result[] = $result_;
}
return $this->response(200, 'success', $result);
}
/**
* 新增-注册-登录用户数
* @return \think\Response
*/
public function loginNum()
{
$params = $this->params;
$between = [ 'between', [ $params['create_time_start'] . ' 00:00:00', $params['create_time_end'] . ' 23:59:59' ] ];
$where['create_time'] = $between;
// 新增客户数
$addUserNum = $this->userModel->getAddUserNumForOperation($where);
$result["add_user_num"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
// 注册客户数
$where = [];
$where['registration_time'] = $between;
$where['status'] = 0;
// $where['registration_time'] = array( 'exp', 'is not null' );
$addUserNum = $this->userModel->getAddUserNumForOperation($where);
$result["create_user_num"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
// 登录客户数
$where = [];
$where['first_login_time'] = $between;
$where['status'] = 0;
//$where['last_login_time'] = array( 'exp', 'is not null' );
$addUserNum = $this->userModel->getAddUserNumForOperation($where);
$result["login_user_num"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
return $this->response(200, 'success', $result);
}
/**
* 商铺总量-待租数
* @return \think\Response
*/
public function houseNum()
{
$params = $this->params;
if (!empty($params['create_time_start']) && !empty($params['create_time_end'])) {
$where['create_time'] = [ 'between', [ $params['create_time_start'] . ' 00:00:00', $params['create_time_end'] . ' 23:59:59' ] ];
}
$where['status'] = array( 'neq', 3 );//排除删除的商铺
// 商铺总量
$house_res = $this->gHousesModel->getHouseNum($where);
$result["house_num"] = $house_res;
// 待租商铺数量
/*$where['residue_num'] = array( 'neq', 0 );
$where['total'] = array( 'neq', 0 );*/
$where['status'] = 1;
$house_res = $this->gHousesModel->getHouseNum($where);
$result["have_not_rent_num"] = $house_res;
return $this->response(200, 'success', $result);
}
/**
* 各部门商场街铺进场数-商场街铺成交数
* @return \think\Response
*/
public function houseBargainNum()
{
$params = $this->params;
$where['a.create_time'] = [ 'between', [ $params['create_time_start'] . ' 00:00:00', $params['create_time_end'] . ' 23:59:59' ] ];
// 先查新所有部门
$district_list = $this->getDistrict();
foreach ($district_list as $key => $v) {
$result_["id"] = $v['id'];
$result_["district_name"] = $v['district_name'];
// 商场进场数
$agentIds = $this->getAgentIDsByDistrictId($v['id']);
$where["a.reception_id"] = array( "in", $agentIds );
$res = $this->getFollowUpNum($where, 0);
$result_["indoor_shop_look_at_num"] = $res;
// 街铺进场数
$res = $this->getFollowUpNum($where, 1);
$result_["outdoor_shop_look_at_num"] = $res;
// 商场成交数
$obargain = new OBargainModel();
$where_['a.create_time'] = $where['a.create_time'];
$where_['a.agent_id'] = array( "in", $agentIds );
$performanceSum = $obargain->getAddBargainNumOperation($where_, 0);
$result_["indoor_shop_bargain_num"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// 街铺成交数
$performanceSum = $obargain->getAddBargainNumOperation($where_, 1);
$result_["outdoor_shop_bargain_num"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
$result[] = $result_;
}
return $this->response(200, 'success', $result);
}
/**
* 获取部门列表
* @return \think\Response
*/
public function getDistrict()
{
$params = [];
$params['status'] = 0;
$field = 'id,district_name';
$district_model = new ADistrict();
$result = $district_model->getDistrict($params, $field);
return $result;
}
/**
* 获取进场数
* @return \think\Response
*/
public function getFollowUpNum($params, $type)
{
//shop_type '商铺类型(0商场,1街铺)'
$params['c.shop_type'] = $type == 0 ? 0 : 1;
$addMarchInNum = $this->marchInModel->getMarchInNumOperation($params);
return $addMarchInNum;
}
/**
* 查询区域的所有经纪人id
* @param $district_id
* @return string
*/
public function getAgentIDsByDistrictId($district_id)
{
//查询总监下面门店的所有经纪人
$params = [];
$params["district_id"] = $district_id;
$params["status"] = 0; //只查询正常状态的经纪人
$agentModel = new AAgents();
$agentsArr = $agentModel->getAgentsByStoreId($params);
$agent_total = count($agentsArr);
if ($agent_total > 0) {
$agentIds = "";
foreach ($agentsArr as $key1 => $value1) {
$agentIds .= $value1["id"] . ",";
}
$agentIds = rtrim($agentIds, ",");//经纪人ID集合
}//查询总监下面门店的所有经纪人 end
return $agentIds;
}
}
\ No newline at end of file
<?php
namespace app\index\controller;
/**
* Created by PhpStorm.
* User: liu yin ping
* Date: 2018/9/10
* Time: 13:10
*/
use app\index\extend\Basic;
class OperationalData extends Basic
{
public function operationalDataList()
{
if (!$this->request->isAjax()) {
return view('operationalData/operationalDataList');
}
}
}
\ No newline at end of file
......@@ -24,13 +24,14 @@ class HouseService
{
protected $house;
protected $agent;
protected $agetn_house;
protected $agent_house;
protected $push;
public function __construct()
{
$this->house = new GHouses();
$this->agent = new AAgents();
$this->agetn_house = new GHousesToAgents();
$this->agent_house = new GHousesToAgents();
$this->push = new PushMessageService();
}
......@@ -39,16 +40,16 @@ class HouseService
*
* @param array $data
* @param int $agent_id
* @param int $is_app
* @return array
* @throws \think\exception\PDOException
*/
public function addHouse(array $data, int $agent_id): array
public function addHouse(array $data, int $agent_id, $is_app = 0): array
{
$result = [];
$validate = new HouseValidate();
$check = $validate->check($data);
if (true !== $check) {
if (!$validate->check($data)) {
$result['status'] = 'fail';
$result['msg'] = $validate->getError();
return $result;
......@@ -62,6 +63,15 @@ class HouseService
$house_id = $this->house->addHouse($data, $agent_id);
if (!empty($data['id'])) {
$m_operating = new GOperatingRecords();
$remark = '修改为:剩余铺数'.$data['residue_num'];
if ($data['is_exclusive_type'] == 1) {
$remark .= ',独家有效期 '.$data['agent_start_time'].'—'.$data['agent_end_time'];
}
$m_operating->record($agent_id, 6, $remark, $house_id);
}
if (empty($house_id)) {
$result['status'] = 'fail';
$result['msg'] = '新增或编辑商铺失败';
......@@ -72,9 +82,15 @@ class HouseService
$house_img = new GHousesImgs();
//商铺扩展字段
$houses_ext->addHouseExt($data, $house_id);
$houses_ext->addHouseExt($data, $house_id, $is_app);
//商铺图片
if ($is_app == 1) {
$data['cover'] = json_decode($data['cover'], true);
$data['slide_show'] = json_decode($data['slide_show'], true);
$data['exclusive_img'] = json_decode($data['exclusive_img'], true);
}
if ($data['id'] == '') {
$house_img->add($data, $house_id); //只记录新增图片
} else {
......@@ -94,6 +110,7 @@ class HouseService
if ($result_agent_data['status'] == 'fail') {
$result['status'] = 'fail';
$result['msg'] = '新增或编辑案场权限人失败,' . $result_agent_data['msg'];
return $result;
}
}
......@@ -103,6 +120,7 @@ class HouseService
if ($result_agent_dish['status'] == 'fail') {
$result['status'] = 'fail';
$result['msg'] = '新增或编辑盘方失败,' . $result_agent_dish['msg'];
return $result;
}
}
......@@ -112,6 +130,7 @@ class HouseService
if ($result_exclusive_ids['status'] == 'fail') {
$result['status'] = 'fail';
$result['msg'] = '新增或编辑独家方失败,' . $result_exclusive_ids['msg'];
return $result;
}
}
......@@ -122,7 +141,8 @@ class HouseService
}
}
$result['data']['house_id'] = $house_id;
$result['data']['house_id'] = $house_id;
$result['data']['internal_title'] = $data['internal_title'];
$result['status'] = 'successful';
$result['msg'] = '新增或编辑成功!';
return $result;
......@@ -182,7 +202,7 @@ class HouseService
$agent_house_where['houses_id'] = $house_id;
$agent_house_where['type'] = $type;
$agent_data_old = $this->agetn_house->getAgentHouseAll('id,agents_id,houses_id', $agent_house_where);
$agent_data_old = $this->agent_house->getAgentHouseAll('id,agents_id,houses_id', $agent_house_where);
foreach ($agent_data_old['data'] as $k => $v) {
$agent_id_old[] = $v['agents_id'];
......@@ -209,15 +229,15 @@ class HouseService
}
}
$this->agetn_house->startTrans();
$this->agent_house->startTrans();
try {
//伪删除关系
if (!empty($update_data)) {
$this->agetn_house->updateUserAll($update_data);
$this->agent_house->updateUserAll($update_data);
}
if (!empty($insert_data)) {
$this->agetn_house->insertAll($insert_data);
$this->agent_house->insertAll($insert_data);
}
//处理盘方
......@@ -235,7 +255,7 @@ class HouseService
$agent_name[] = $agent_data['name'];
}
$remark = '新增盘方:' . implode(',', $agent_name);
$records->record('', 2, $remark, $house_id);
$records->record($operation_id, 2, $remark, $house_id);
}
if (!empty($del_agent_id)) {
......@@ -248,21 +268,41 @@ class HouseService
$del_agent_arr[] = $v['name'];
}
$remark = '删除盘方:' . implode(',', $del_agent_arr);
$records->record('', 2, $remark, $house_id);
$records->record($operation_id, 2, $remark, $house_id);
$operation_name = $this->agent->getAgentsById($operation_id, 'name');
$data['message'] = '你的【'.$house_title.'】商铺,盘方被【'.$operation_name.'】修改为:'. implode(',', $agent_name);
$this->push->record(2, $house_id, $del_agent_id, $operation_id, $data);
$this->push->record(3, $house_id, $del_agent_id, $operation_id, $data);
}
}
}
$this->agetn_house->commit();
$this->agent_house->commit();
$result['status'] = 'successful';
} catch (\Exception $e) {
$this->agetn_house->rollback();
$this->agent_house->rollback();
$result['status'] = 'fail';
$result['msg'] = $e->getMessage();
}
return $result;
}
/**
* 商铺修改日志
*s
* @param $house_id
* @return mixed
*/
public function getEditLog($house_id) {
try {
$m_operating = new GOperatingRecords();
$result['data'] = $m_operating->getList(1, 1000, 'id DESC','agents_id,name,remark,create_time',['type'=>6, 'houses_id'=>$house_id]);
$result['status'] = 'successful';
} catch (\Exception $e) {
$result['status'] = 'fail';
$result['msg'] = $e->getMessage();
$result['data'] = [];
}
return $result;
......
......@@ -10,6 +10,7 @@ namespace app\index\service;
use app\api_broker\service\PushMessageService;
use app\index\validate\MemberValidate;
use app\model\AAgents;
use app\model\GOperatingRecords;
use app\model\Users;
......@@ -37,9 +38,17 @@ class UserService
*/
public function editUser($id, $data, $operation_id)
{
$validate = new MemberValidate();
if (!$validate->scene('add')->check($data)) {
$result['status'] = 'fail';
$result['msg'] = $validate->getError();
return $result;
}
$this->operation_id = $operation_id;
$result = [];
$agent_id_old = $referrer_id_old = $referrer_source_old = 0;
$type = $user_name = '';
try {
if (empty($id)) {
//新增用户
......@@ -86,9 +95,14 @@ class UserService
}
//记录修改客方
$this->recordGuest((int)$data['agents_id'], (int)$agent_id_old, $id, $user_name,$type);
if (!empty($data['agents_id'])) {
$this->recordGuest((int)$data['agents_id'], (int)$agent_id_old, $id, $user_name, $type);
}
//记录邀请人修改记录
$this->recordReferrer($data['referrer_id'], $data['referrer_source'], $id, $referrer_id_old, $referrer_source_old, $type);
if (!empty($data['referrer_id'])) {
$this->recordReferrer($data['referrer_id'], $data['referrer_source'], $id, $referrer_id_old, $referrer_source_old, $type);
}
//更新业绩统计
$agent = new AAgents();
......@@ -151,7 +165,7 @@ class UserService
} else {
if ($agent_id != $agent_id_old) {
$remark = '修改为' . $agent_data['name'] . '-' . $agent_data['phone'];
$this->pushMessage($agent_id, $this->operation_id, $user_name, $user_id);
$this->pushMessage($agent_id, $agent_id_old, $this->operation_id, $user_name, $user_id);
}
}
......@@ -289,11 +303,14 @@ class UserService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function pushMessage($agent_id, $operation_id, $user_name, $user_id) {
public function pushMessage($agent_id, $old_agent_id, $operation_id, $user_name, $user_id) {
$push = new PushMessageService();
$agent = new AAgents();
$ccr_agent_data = $agent->getAgentInfo('name,phone', $operation_id);
$content = "【{$ccr_agent_data['name']}-{$ccr_agent_data['phone']}修改了{$user_name}(id:{$user_id})客方】";
$push->pushMessageById($agent_id, '客方修改', $content, 'user_info', $user_id);
$ccr_agent_data = $agent->getAgentInfo('name', $operation_id);
$agent_name = $agent->getAgentInfo('name', $agent_id);
$content = "你的【客户ID:{$user_id}】客户,客方被【{$ccr_agent_data['name']}】修改为【{$agent_name['name']}】";
$data['message'] = $content;
$data['user_id'] = $user_id;
$push->record(2, 0, [0=>$old_agent_id], $operation_id, $data);
}
}
\ No newline at end of file
......@@ -21,7 +21,7 @@ class HouseValidate extends Validate
'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_type' => 'require',
'rent_price' => 'require',
'industry_type' => 'require',
'shop_type' => 'require|in:0,1',
......@@ -54,7 +54,6 @@ class HouseValidate extends Validate
'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' => '商铺类型为必填',
......
......@@ -6,24 +6,47 @@ use think\Validate;
/**
* Created by PhpStorm.
* User: zhuwei
* User: zhu wei
* Date: 2018/8/29
* Time: 上午11:02
*/
class MemberValidate extends Validate
{
protected $regex = [ 'phone' => '/^1[23456789]{1}\d{9}$/' ];
protected $rule = [
'agent_id_for_bind' => 'require|number|gt:0'
'agent_id_for_bind' => 'require|number|gt:0',
'user_nick' => 'length:0,80',
'user_name' => 'length:0,80',
'user_phone' => 'require|regex:phone',
'user_pswd' => 'length:0,255',
'sex' => 'in:0,1,2',
'referrer_source' => 'in:10,20',
'source' => 'in:10,20,30',
'source_intro'=>'in:0,1,2,3,4,5,6,7',
'user_status'=>'in:0,1,-1',
'user_label' => 'in:0,1,2',
];
protected $message = [
'agent_id_for_bind.require' => 'agent_id_for_bind为必填字段',
'agent_id_for_bind.number' => 'agent_id_for_bind只能为数字',
'agent_id_for_bind.gt' => 'agent_id_for_bind必须大于0',
'agent_id_for_bind.require' => 'agent_id_for_bind为必填字段',
'agent_id_for_bind.number' => 'agent_id_for_bind只能为数字',
'agent_id_for_bind.gt' => 'agent_id_for_bind必须大于0',
'user_nick.length' => '名字字数超过限制',
'user_name.length' => '名字字数超过限制',
'user_phone.require' => '手机号必填',
'user_phone.regex' => '手机号格式错误',
'user_pswd.length' => '密码长度超过限制',
'sex.in' => '性别参数错误',
'referrer_source.in' => '邀请来源参数错误',
'source.in'=>'注册来源参数错误',
'source_intro.in' => '来源简述参数错误',
'user_status.in' => '客户状态参数错误',
'user_label.in' => '用户标签'
];
protected $scene = [
'getUserList' => [ 'agent_id_for_bind' ],
'getUserList' => [ 'agent_id_for_bind' ],
'add' => 'user_phonp,user_name,user_nick,user_pswd,sex,referrer_source,source,source_intro,user_status,user_label'
];
}
\ No newline at end of file
......@@ -407,4 +407,33 @@
</div>
<div id="img_mask_area" title="点击任意位置可关闭">
<img />
</div>
<!-- /#删除模态框 -->
<div class="modal fade" id="modal-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<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">
删除
</h4>
</div>
<div class="modal-body">
<div class="modal-body">
<input type="hidden" value="" id="delete_id" /> 确认删除吗?
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消
</button>
<button type="button" class="btn btn-primary" id="confirm_delete" data-dismiss="modal">
删除
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div>
\ No newline at end of file
......@@ -191,11 +191,11 @@
<input type="text" class="form-control half" id="jinshen" placeholder="请输入">&nbsp;&nbsp;
</div>
<div class="col-xs-3 p-t-10">
<label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;量: </label>
<input type="text" class="form-control half" id="dianliang" placeholder="请输入">&nbsp;&nbsp;
<label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;量: </label>
<input type="text" class="form-control half" id="dianliang" placeholder="请输入">&nbsp;&nbsp;
</div>
<div class="col-xs-3 p-t-10">
<label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;压 :</label>
<label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;压 :</label>
<input type="text" class="form-control half" id="dianya" placeholder="请输入">&nbsp;&nbsp;
</div>
<div class="col-xs-3 p-t-10">
......@@ -203,7 +203,7 @@
<select class=" form-control half" id="hasGas">
<option value="-1" selected="selected">请选择</option>
<option value="0"></option>
<option value="1">没有</option>
<option value="1"></option>
</select>
</div>
<div class="col-xs-3 p-t-10" >
......@@ -215,7 +215,7 @@
</select>
</div>
<div class="col-xs-3 p-t-10" >
<label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;水: </label>
<label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;水: </label>
<select class=" form-control half" id="shangshui">
<option value="-1" selected="selected">请选择</option>
<option value="1"></option>
......@@ -223,7 +223,7 @@
</select>
</div>
<div class="col-xs-3 p-t-10">
<label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;水 : </label>
<label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;水 : </label>
<select class=" form-control half" id="xiashui">
<option value="-1" selected="selected">请选择</option>
<option value="1"></option>
......@@ -325,10 +325,11 @@
<option value="1" selected="selected">月租金</option>
<option value="2">营业额扣点</option>
<option value="3">每平方米租金</option>
<option value="4">年租金</option>
</select>
</div>
<div class="form-group">
<label class="" for="price">月租均价</label>
<label class="" for="price">租金均价</label>
<div class="input-group">
<div class="input-group-addon" style="display: none;">营业额扣点</div>
<input type="number" class="form-control input-100-width" name="moonPrice" id="moonPrice" placeholder="请输入" data-alert="请填写月租均价!">
......@@ -470,7 +471,7 @@
</div>
<div class="form-group full-width-100 show-c-part">
<label for=""> 经纪人对本铺的评价</label>
<textarea class="form-control textarea-500-width" rows="3" id="foreignYoushi" data-alert="请输入该商铺周边配套、所处地段和该商铺的优势!" placeholder="请输入"></textarea>
<textarea class="form-control textarea-500-width" rows="3" id="foreignYoushi" data-alert="请输入该商铺周边配套、所处地段和该商铺的优势!" placeholder="1、商铺周边配套(附近有什么)&#10;2、商铺所处地段怎么样&#10;3、商铺附近的人流怎么样"></textarea>
</div>
</li>
<!--<li class="list-group-item">-->
......
......@@ -183,8 +183,8 @@
</select>
<select class="form-control btn2" id="leased">
<option value="-1">商铺状态</option>
<option value="1" selected="selected">待租</option>
<option value="0">已租</option>
<option value="1">待租</option>
</select>
<select class="form-control btn2" id="rent_price">
<option value="-1">月租金</option>
......@@ -229,8 +229,8 @@
<option value="330100">杭州市</option>
</select>-->
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="dish_name" placeholder="盘方姓名" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="dish_phone" placeholder="盘方手机号" type="tel" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="dish_name" placeholder="盘方(员工)姓名" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="dish_phone" placeholder="盘方(员工)手机号" type="tel" value="">
<span class="fore-span ld-Marheight">创建时间:</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="start_date" name="start_date" type="date">
......@@ -459,7 +459,9 @@
<h4 class="modal-title detail-modal-header-tab" >
<a href="javascript:;" class="btn btn-info">查看商铺</a>
<a href="javascript:;" class="btn btn-default">商铺跟进</a>
<a href="javascript:;" class="btn btn-info">操作记录</a>
<a href="javascript:;" class="btn btn-default">操作记录</a>
<a href="javascript:;" class="btn btn-default">查看日志</a>
<a href="javascript:;" class="btn btn-default">编辑日志</a>
</h4>
</div>
<div class="modal-body modal-body-one">
......@@ -506,6 +508,32 @@
</table>
</div>
<!--查看日志-->
<div class="detail-modal-body-sec iframe-shop-detail-scroll">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<th class="text-center">查看时间</th>
<th class="text-center">商铺ID</th>
<th class="text-center">查看人</th>
</tr>
</thead>
<tbody class="text-center" id="caozuo_table_log">
</table>
</div>
<!--编辑日志-->
<div class="detail-modal-body-sec iframe-shop-detail-scroll">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<th class="text-center">编辑时间</th>
<th class="text-center">编辑人</th>
<th class="text-center">编辑内容</th>
</tr>
</thead>
<tbody class="text-center" id="caozuo_table_edit">
</table>
</div>
</div>
</div>
......
{layout name="global/frame_tpl" /}
<input type="hidden" class="page-load" id="inviteStatisticsList" />
<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;
}
</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">
<span class="fore-span ld-Marheight">客户初次登录时间:</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time_start" name="start_date1" type="date">
<span class="fore-span ld-Marheight">-</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time_end" name="end_date1" type="date">
<select class="form-control btn4 ld-Marheight input" name="" id="district_id" >
<option value="">选择部门</option>
</select>
<select class="form-control btn4 ld-Marheight input" name="" id="guest_stores" value="">
</select>
<span class="btn btn-info btn3 ld-Marheight" id="search">搜索</span>
<span class="btn btn-info btn3 ld-Marheight" id="reset">重置</span>
</form>
</td>
</tr>
<tr>
<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" id="modal-time" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title">
时间轴
</h4>
</div>
<div class="modal-body" class="iframe-div-parent">
<iframe class="iframe-time-line"></iframe>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
......@@ -491,9 +491,16 @@
<span class="user-details-introduce-id fore-span">
</span>
</td>
</tr>
<tr>
<td>
<span class="fore-span">客户来源:</span>
<span class="user-source-details fore-span">网络</span>
</td>
<td></td>
<td></td>
</tr>
<!--<tr class="ld-Marheight">
<td class="text-left"><label>客方修改记录:</label></td>
</tr>-->
......@@ -949,14 +956,21 @@
<span class="fore-span ld-Marheight">注册时间:</span>
<span class="fore-span ld-Marheight registration_time"></span>
</td>
<!--<td>
<span class="fore-span ld-Marheight">邀请人:</span>
<span class="fore-span ld-Marheight referrer_user"></span>
</td>-->
<td>
<span class="fore-span ld-Marheight">客户来源:</span>
<select class="form-control btn6 fore-span ld-Marheight" id="user_source_edit">
<option value=''>请选择</option>
<option value="1">网络</option>
<option value="2">客户介绍</option>
<option value="3">朋友介绍</option>
<option value="4">上门挂牌</option>
<option value="5">打跟进</option>
<option value="6">驻守</option>
<option value="7">其他</option>
</select>
</td>
<td>
<span class="fore-span ld-Marheight">昵称:</span>
<!--<input type="hidden" value='[%= it[item]["agent_img"] %]'>-->
<!--<img src='' class="diagram-image J_preview" data-bimg=''>-->
<img src="" alt="" class="fore-span ld-Marheight diagram-image J_preview user_pic" data-bimg=''/>
<span class="fore-span ld-Marheight cus_nick"></span>
</td>
......
......@@ -280,7 +280,7 @@
<!--附件-->
<div class="form-group">
<label class="col-sm-2 control-label">附件(格式为pdf/doc,选填,上限为1个):</label>
<label class="col-sm-2 control-label">附件(格式为pdf/doc,选填,上限为5个):</label>
<div class="col-sm-9">
<div class="file-upload-area">
<div class="btn-area">
......
{layout name="global/frame_tpl" /}
<input type="hidden" class="page-load" id="operationalDataList" />
<style type="text/css">
.left{
float: left;
}
#maintable_list{
font-size: 16px;
}
</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="#">运营数据统计</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="11" class="maintable-top-sub-tr">
<a class="btn btn-info liudan_pic_btn performance-district-click" id='liudan_pic_btn_district'>微聊用户统计</a>
<a class="btn btn-default liudan_pic_btn performance-store-click" id='liudan_pic_btn_store'>客户来电统计</a>
<a class="btn btn-default liudan_pic_btn performance-person-click" id='liudan_pic_btn_person'>客户统计</a>
<a class="btn btn-default liudan_pic_btn performance-person-click" id='liudan_pic_btn_person'>商铺统计</a>
<a class="btn btn-default liudan_pic_btn performance-person-click" id='liudan_pic_btn_person'>进场和成交统计</a>
</td>
</tr>
<!--部门业绩 门店业绩 个人业绩的搜索功能-->
<tr>
<td colspan="11">
<form id="maintable_form_search">
<span class="fore-span margin-left-10">时间:</span>
<input class="form-control btn4" value="" data-rule-phoneus="false" data-rule-required="false" id="maintable_create_time" name="start_date" type="date">
<span class="fore-span margin-left-10">-</span>
<input class="form-control btn4" value="" data-rule-phoneus="false" data-rule-required="false" id="maintable_end_time" name="end_date" type="date">
<span class="btn btn-primary btn3 search" id="maintable_search">搜索</span>
<span class="btn btn-primary btn3" id="maintable_reset">重置</span>
</form>
</td>
</tr>
</thead>
<tbody class="text-center" id="maintable_list">
</tbody>
</table>
</div>
<div class="text-right" id="pagediv">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -11,6 +11,30 @@
font-size: 16px;
font-weight: 700;
}
/*客户详情 样式*/
.modal-body1 {
height: 716px;
overflow-y: auto;
padding-bottom: 60px;
}
.modal-body-details {
width: 850px;
}
/*客户动态*/
.followup-modal-list-area {
height: 258px;
overflow-y: scroll;
}
.form-control[disabled]{
background-color: #fff;
}
.user_pic {
width: 30px;
height: 30px;
border-radius: 15px;
}
/*客户详情 样式*/
</style>
<div id="page-content-wrapper">
<div class="container">
......@@ -130,7 +154,9 @@
<span id="bargaininfo_shop_type"></span>
<br />
<span>商铺地址:</span><span id="bargaininfo_internal_address"></span><br>
<span>商铺地址:</span><span id="bargaininfo_internal_address"></span>
<a class="btn1 bargain-detail-shop btn-info" href="#modal_shop_detail" data-toggle="modal">商铺</a>
<br>
<span>业态:</span>&nbsp;<input class="form-control" id="bargaininfo_yetai" type="text"><br>
<span>客户姓名:</span><span id="bargaininfo_user_name"></span><br>
<span>成交类型:</span>
......@@ -153,7 +179,9 @@
<span>商铺号:</span><span id="bargaininfo_shop_num"></span><br>
<!--<span>预计收款时间:</span><span id="bargaininfo_expect_payback_time"></span><br>-->
<span>预计收款时间:</span><input type="date" id="bargaininfo_expect_payback_time" placeholder="请输入"><br>
<span>客户电话:</span><span id="bargaininfo_user_phone"></span><br>
<span>客户电话:</span><span id="bargaininfo_user_phone"></span>
<a class="btn1 caozuo genj_ure btn-info" href="#modal_user_detail" data-toggle="modal">客户</a>
<br>
<span>成交日期:</span><span id="bargaininfo_create_time"></span><br>
<span>成交价:</span>&nbsp;<input class="form-control" id="bargaininfo_chengjiao_price" type="number">
</div>
......@@ -453,4 +481,199 @@
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div>
<!--商铺详情 弹出框-->
<div class="modal fade" id="modal_shop_detail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title">
商铺详情
</h4>
</div>
<div class="modal-body">
<iframe class="iframe-shop-detail"></iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
<!--客户详情 弹出框-->
<div class="modal fade" id="modal_user_detail" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-body-details">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title text-info detail-modal-header-tab">
客户详情
</h4>
</div>
<div class="modal-body modal-body1">
<div class="detail-modal-body-sec">
<div class="call-user-five"></div>
<div class="detail-modal-body-sec-2">
<table class="" id="caozuo_hide" border='0'>
<thead>
<tr>
<td>
<span class="fore-span">姓名:</span>
<input class="form-control btn6 cus_name input-border-0" value="" data-rule-phoneus="false" data-rule-required="false" name="name" type="text" disabled="disabled">
</td>
<td width="35%">
<span class="fore-span">产生类型:</span>
<span class="fore-span source_type"></span>
</td>
<td>
<span class="fore-span">面积:</span>
<input class="form-control btn6 input-border-0" value="" data-rule-phoneus="false" data-rule-required="false" id="" name="area_demand" type="number" disabled="disabled"><span class="fore-span">
</span>
</td>
</tr>
<tr>
<td>
<span class="fore-span">客户编号:</span>
<span class="fore-span cus_id"></span>
</td>
<td>
<span class="fore-span">性别:</span>
<select class="form-control btn6 sex input-border-0" disabled="disabled">
<option value="0" class="successModel">性别</option>
<option value="1"></option>
<option value="2"></option>
</select>
</td>
<td>
<span class="fore-span">业态:</span>
<select class="form-control btn6 input-border-0" name="industry_type_two" disabled="disabled">
<option>轻餐饮</option>
<option>重餐饮</option>
<option>百货零售</option>
<option>服装</option>
<option>亲子教育</option>
<option>休闲娱乐</option>
</select>
</td>
</tr>
<tr>
<td>
<span class="fore-span">电话:</span>
<span class="fore-span cus_phone"></span>
</td>
<td>
<span class="fore-span">价格:</span>
<input class="form-control btn6 input-border-0" value="" data-rule-phoneus="false" data-rule-required="false" id="" name="price_demand" type="number" disabled="disabled"><span class="fore-span">元/月</span>
</td>
<td>
<span class="fore-span">VIP客户:</span>
<select class="form-control btn6 user_vip2 input-border-0" disabled="disabled">
<option value='' class="successModel">请选择</option>
<option value="1"></option>
<option value="0"></option>
</select>
</td>
</tr>
<tr>
<td>
<span class="fore-span">注册时间:</span>
<span class="fore-span registration_time"></span>
</td>
<td>
<span class="fore-span">客户所属城市:</span>
<span class="user_details_city fore-span">
</span>
</td>
<td>
<span class="fore-span">昵称:</span>
<img src="" alt="" class="fore-span diagram-image J_preview user_pic" data-bimg='' />
<span class="fore-span cus_nick"></span>
</td>
</tr>
<tr>
<td>
<span class="fore-span">创建时间:</span>
<span class="fore-span cus_date"></span>
</td>
<!--<td>
</td>-->
<td>
<span class="fore-span">下载登录时间:</span>
<span class="fore-span firstlogin_time"></span>
</td>
<td>
<span class="fore-span">客户标签:</span>
<span class="user_details_label fore-span">
</span>
</td>
</tr>
<tr>
<td>
<div class="form-group">
<span class="fore-span">客方:</span>
<div class="col-sm-9">
<input type="text" class="form-control btn6-1 cus_fang_edit input-border-0" name="pwd" autocomplete="off" disabled="disabled">
<!--<ul class="user-ul2"></ul>-->
</div>
</div>
</td>
<td>
<span class="fore-span">是否转介绍:</span>
<span class="user-details-introduce fore-span"></span>
</td>
<td>
<span class="fore-span">邀请人(介绍人):</span>
<span class="user-details-introduce-id fore-span"></span>
</td>
</tr>
<tr>
<td>
<span class="fore-span">客户来源:</span>
<span class="user-source-details fore-span">网络</span>
</td>
<td></td>
<td></td>
</tr>
</thead>
</table>
<h4 class="modal-title-genjing clear text-info">
客户跟进
</h4>
<div id="gen_jing_user">
<div class="followup-modal-list-area">
<table class="table table-striped table-bordered table-hover table-condensed">
<tbody class="text-center" id="caozuo_table2">
</tbody>
</table>
</div>
<div class="clear margin-top-ld">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-guanbi" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div>
\ No newline at end of file
......@@ -517,6 +517,14 @@
</td>
</tr>
<tr>
<td>
<span class="fore-span">客户来源:</span>
<span class="user-source-details fore-span">网络</span>
</td>
<td></td>
<td></td>
</tr>
</thead>
</table>
......@@ -787,15 +795,24 @@
<span class="fore-span ld-Marheight">注册时间:</span>
<span class="fore-span ld-Marheight registration_time"></span>
</td>
<td>
<span class="fore-span ld-Marheight">客户来源:</span>
<select class="form-control btn6 fore-span ld-Marheight" id="user_source_edit">
<option value=''>请选择</option>
<option value="1">网络</option>
<option value="2">客户介绍</option>
<option value="3">朋友介绍</option>
<option value="4">上门挂牌</option>
<option value="5">打跟进</option>
<option value="6">驻守</option>
<option value="7">其他</option>
</select>
</td>
<td>
<span class="fore-span ld-Marheight">昵称:</span>
<img src="" alt="" class="fore-span ld-Marheight diagram-image J_preview user_pic" data-bimg=''/>
<span class="fore-span ld-Marheight cus_nick"></span>
</td>
<td>
<!--<span class="fore-span ld-Marheight">邀请人:</span>
<span class="fore-span ld-Marheight referrer_user"></span>-->
</td>
</tr>
<tr>
<td>
......
......@@ -1114,7 +1114,7 @@ class AAgents extends BaseModel
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
*/
public function agentBragainDetail($field, $where) {
public function agentBargainDetail($field, $where) {
try {
$data = $this->alias('a')
->field($field)
......@@ -1127,6 +1127,24 @@ class AAgents extends BaseModel
return $data;
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Collection
*/
public function agentBargainAll($field, $where) {
try {
$data = $this->alias('a')
->field($field)
->join('o_bargain b', 'a.id = b.agent_id', 'left')
->where($where)
->select();
} catch (\Exception $e) {
$data = [];
}
return $data;
}
/**
* 获取绑定号码
*
......@@ -1151,4 +1169,41 @@ class AAgents extends BaseModel
return $result;
}
/**
* 根据门店id查店长ID
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getAgentsManagerID($params)
{
$result = Db::table($this->table)
->field("id")
->where($params)
->limit(1)
->select();
//echo Db::table($this->table)->getLastSql();
//dump($this->getLastSql());
return $result;
}
/**
* 客户来电数
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getUserPhoneNum($field ,$params)
{
$result = Db::table($this->table)
->field($field)
->where($params)
->group('district_id')
->select();
//echo $this->getLastSql();
return $result;
}
}
\ No newline at end of file
......@@ -218,4 +218,21 @@ class ADistrict extends BaseModel
return $this->where($where)
->value($field);
}
/**
* 获取部门
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getDistrict($params,$field)
{
$result = $this
->field($field)
->where($params)
->select();
//echo Db::table($this->table)->getLastSql();
//dump($this->getLastSql());
return $result;
}
}
\ No newline at end of file
......@@ -184,6 +184,22 @@ class AStore extends BaseModel
return $name;
}
/**
* @param $id
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getStoreAndDistrict($id)
{
$name = $this->field('b.district_name,a.store_name')->alias('a')
->join('a_district b', 'a.district_id = b.id', 'left')
->where('a.id',$id)
->find();
return $name;
}
/**
* 查询门店单个字段信息
*
......
......@@ -41,7 +41,7 @@ class AliYunPhone extends BaseModel
$m_bind = new BindingPhone();
$id_arr = $m_bind->getBindingPhoneList('b.id', $where_bind);
foreach ($id_arr as $k=>$v) {
foreach ($id_arr['data'] as $k=>$v) {
$id[$k] = $v['id'];//去除phone_a已经绑定的号码
}
......@@ -59,6 +59,79 @@ class AliYunPhone extends BaseModel
return $result;
}
/**
* 获取未绑定的手机号码
*
* @param $phone_a
* @param $phone_b
* @param int $type
* @param array $phone_x
* @param $city
* @return mixed
*/
public function getAliYunPhoneAll($phone_a, $phone_b, $type = 1, $phone_x = [], $city)
{
$result['data'] = [];
$m_bind = new BindingPhone();
// if ($city == '上海') {
// $where_bind_a['area'] = '021';
// $where_bind_b['area'] = '021';
// $where_phone['area'] = '021';
// }
//
// if ($city == '杭州') {
// $where_bind_a['area'] = '0571';
// $where_bind_b['area'] = '0571';
// $where_phone['area'] = '0571';
// }
//尝试多次绑定,去除已经绑定失败的号码
if (!empty($phone_x)) {
$where_bind_a['b.phone_x'] = [ 'NOT IN', $phone_x];
$where_bind_b['b.phone_x'] = [ 'NOT IN', $phone_x];
}
//找到与phone_a绑定的隐私号码
$where_bind_a['a.phone_a'] = $phone_a;
$where_bind_a['a.status'] = 1;
$where_bind_a['b.type'] = $type;
$id_arr_a = $m_bind->getBindingPhoneList('b.id', $where_bind_a);
//找到phone_b绑定的隐私号码
$where_bind_b['a.phone_b'] = $phone_b;
$where_bind_b['a.status'] = 1;
$where_bind_b['b.type'] = $type;
$id_arr_b = $m_bind->getBindingPhoneList('b.id', $where_bind_b);
$id_merge = array_merge($id_arr_a['data'], $id_arr_b['data']);
foreach ($id_merge as $k => $v) {
$id[$k] = $v['id'];//去除phone_a已经绑定的号码
}
$id = empty($id) ? 0 : $id;
$where_phone['status'] = 0;
$where_phone['type'] = $type;
$where_phone['bind_num'] = ['<', 201];
try {
if (empty($id)) {
$result['data'] = $this->field('id,phone_x,area')->where($where_phone)->find();
} else {
$where_phone['id'] = [ 'NOT IN', $id ]; //排除已经绑定的号码
$result['data'] = $this->field('id,phone_x,area')->where($where_phone)->find();
}
$result['status'] = 'successful';
} catch (\Exception $e) {
$result['status'] = 'fail';
$result['msg'] = $e->getMessage();
}
return $result;
}
/**
* 绑定手机号列表
*
......
......@@ -108,19 +108,26 @@ class BindingPhone extends BaseModel
}
/**
* 获取绑定信息
*
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @return mixed
*/
public function getBindingPhoneList($field, $where)
{
return $this->field($field)->alias('a')
->join('aliYun_phone b', 'a.aliYun_phone_id = b.id', 'left')
->where($where)
->select();
$data['data'] = [];
try {
$data['data'] = $this->field($field)->alias('a')
->join('aliYun_phone b', 'a.aliYun_phone_id = b.id', 'left')
->where($where)
->select();
$data['status'] = 'successful';
} catch (\Exception $e) {
$data['status'] = 'fail';
$data['msg'] = $e->getMessage();
}
return $data;
}
/**
......
......@@ -119,4 +119,28 @@ class ChatRelation extends Model
}
}
/**
* 发起微聊用户数
* @param $params
* @param $group
* @return int|string
*/
public function getChatUserNumOperation($params,$group)
{
//dump($params);
if($group){
$return = Db::table($this->table)
->where($params)
->group($group)
->count();
}else{
$return = Db::table($this->table)
->where($params)
->count();
}
//dump($this->getLastSql($return));
return $return;
}
}
\ No newline at end of file
......@@ -605,13 +605,13 @@ class GHouses extends BaseModel
//状态 0待审批 1上架 2下架 3回收
if (isset($data['status'])) {
$save_data['status'] = $data['status'];
}
//剩余商铺为0下架
if (empty($data['residue_num']) || empty($data['total'])) {
$save_data['status'] = 2;
} else {
//剩余商铺为0下架
if (empty($data['residue_num']) || empty($data['total'])) {
$save_data['status'] = 2;
} else {
$save_data['status'] = 1;
}
$save_data['status'] = 1;
}
//首页排序
......@@ -1564,4 +1564,16 @@ class GHouses extends BaseModel
}
public function getHouseNum($params)
{
$result = Db::table($this->table)
->field($field)
->where($params)
->count();
return $result;
}
}
......@@ -41,9 +41,10 @@ class GHousesExt extends BaseModel
/**
* @param $data
* @param $house_id
* @param int $is_app
* @return bool
*/
public function addHouseExt($data, $house_id) {
public function addHouseExt($data, $house_id, $is_app = 0) {
$save_data = [];
//100字以内产品沟通过
......@@ -122,20 +123,33 @@ class GHousesExt extends BaseModel
if (!empty($data['landlord_phone'])) {
$landlord_phone = [];
if (is_array($data['landlord_phone'])) {
foreach ($data['landlord_phone'] as $k => $v) {
if (!empty($v['phone'])) {
$landlord_phone[$k]['name'] = empty($v['name']) ? '房东' : $v['name'];
$landlord_phone[$k]['phone'] = $v['phone'];
if ($is_app == 1) {
$landlord_phone_arr = json_decode($data['landlord_phone'], true);
if (is_array($landlord_phone_arr)) {
foreach ($landlord_phone_arr as $k => $v) {
if (!empty($v['phone'])) {
$landlord_phone[$k]['name'] = empty($v['name']) ? '房东' : $v['name'];
$landlord_phone[$k]['phone'] = $v['phone'];
}
}
}
} else {
//兼容之前逗号隔开的手机号
$params['landlord_phone'] = explode(',', $data['landlord_phone']);
if (is_array($data['landlord_phone'])) {
foreach ($data['landlord_phone'] as $k => $v) {
if (!empty($v['phone'])) {
$landlord_phone[$k]['name'] = empty($v['name']) ? '房东' : $v['name'];
$landlord_phone[$k]['phone'] = $v['phone'];
}
}
} else {
//兼容之前逗号隔开的手机号
$params['landlord_phone'] = explode(',', $data['landlord_phone']);
foreach ($params['landlord_phone'] as $key => $val) {
$landlord_phone[$key]['name'] = '房东';
$landlord_phone[$key]['phone'] = trim($val);
foreach ($params['landlord_phone'] as $key => $val) {
$landlord_phone[$key]['name'] = '房东';
$landlord_phone[$key]['phone'] = trim($val);
}
}
}
......
......@@ -123,7 +123,7 @@ class GHousesToAgents extends BaseModel
foreach ($agent_id as $k=>$v) {
//获取被修改人信息
$m_agent = new AAgents();
$agent_data = $m_agent->agentBragainDetail('a.id,a.store_id,a.district_id,b.create_time,a.name', ['a.id'=>$v]);
$agent_data = $m_agent->agentBargainDetail('a.id,a.store_id,a.district_id,b.create_time,a.name', ['a.id'=>$v]);
//更新业绩统计
$sum = new ResultsSummaryNewTask();
......
......@@ -211,4 +211,15 @@ class MPushMessage
}
return $result;
}
public function getListByWhere(string $field, array $params,int $page_no = 1,int $page_size = 15)
{
return $this->db_
->field($field)
->where($params)
->order(" id desc")
->page($page_no)
->limit($page_size)
->select();
}
}
\ No newline at end of file
......@@ -361,8 +361,6 @@ class OBargainModel extends Model
->join('o_report b', 'a.report_id = b.id', 'left')
->join('o_order c', 'a.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->join('a_agents f', 'b.report_agent_id=f.id', 'left')
->join('a_agents g', 'a.agent_id=g.id', 'left')
->where($params)
->group('a.id')
->order($order_)
......@@ -383,8 +381,6 @@ class OBargainModel extends Model
->join('o_report b', 'a.report_id = b.id', 'left')
->join('o_order c', 'a.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->join('a_agents f', 'b.report_agent_id=f.id', 'left')
->join('a_agents g', 'a.agent_id=g.id', 'left')
->where($params)
->group('a.id')
->count();
......@@ -1467,4 +1463,24 @@ class OBargainModel extends Model
// echo $this->getLastSql();
return $result;
}
public function getAddBargainNumOperation($params, $type)
{
$field = "count(1) as num";
//$where_["trade_type"] = 10;//产品要求统计数量必须是出租类型的180620
$params["a.role"] = 3;//必须是反签方
$params['c.shop_type'] = $type == 0 ? 0 : 1;
// dump($params);
$return = Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b", "a.order_id = b.id", "left")
->join("g_houses c", "b.house_id = c.id", "left")
->where($params)
->select();
/*echo $this->getLastSql();
echo '--------------';*/
return $return;
}
}
\ No newline at end of file
......@@ -374,4 +374,23 @@ class OMarchInModel extends Model
return $result;
}
/**
* 获取进场数-运营
* @param $params
* @return int|string
*/
public function getMarchInNumOperation($params)
{
//dump($params);
$return = Db::table($this->table)
->alias("a")
->join("o_order b", "a.order_id = b.id", "left")
->join('g_houses c', 'b.house_id = c.id', 'LEFT')
->where($params)
->count();
//dump($this->getLastSql($return));
return $return;
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -822,12 +822,13 @@ class OReportModel extends Model
a.user_id,
a.report_agent_id AS agents_id,
a.predict_see_time AS expect_time,
a.create_time,
`b`.`house_id`,
a.create_time,
d.external_title AS house_title,
d.residue_num AS room_num_left,
d.is_show,
d.status
d.status,
d.external_image_id
FROM
`o_report` `a`
LEFT JOIN `o_order` `b` ON `b`.`f_id` = `a`.`id`
......@@ -844,12 +845,13 @@ class OReportModel extends Model
a.user_id,
a.agents_id,
a.expect_time,
a.house_id,
a.create_time,
a.house_id,
a.create_time,
b.external_title AS house_title,
b.residue_num AS room_num_left,
b.is_show,
b.status
b.status,
b.external_image_id
FROM
u_appoint_watch_shop a
LEFT JOIN g_houses b ON a.house_id = b.id
......
......@@ -293,21 +293,32 @@ class Users extends Model
if (!empty($data['user_label'])) {
$insert_data['user_label'] = $data['user_label'];
}
if (!empty($data['industry_type'])) {
$insert_data['industry_type'] = $data['industry_type'];
}
if (!empty($data['price_demand'])) {
$insert_data['price_demand'] = $data['price_demand'];
}
if (!empty($data['area_demand'])) {
$insert_data['area_demand'] = $data['area_demand'];
}
if (isset($data['vip'])) {
$insert_data['vip'] = $data['vip'];
}
if (!empty($data['source'])) {
$insert_data['source'] = $data['source'];
}
if (isset($data['source_intro'])) {
$insert_data['source_intro'] = $data['source_intro'];
}
//邀请人
if (!empty($data['referrer_id']) && !empty($data['referrer_source']) && ($data['referrer_id'] != -1)) {
$insert_data['referrer_id'] = $data['referrer_id'];
$insert_data['referrer_id'] = $data['referrer_id'];
$insert_data['referrer_source'] = $data['referrer_source'];
}
if ($id && $id > 0) {
......@@ -315,7 +326,7 @@ class Users extends Model
$insert_data['update_time'] = date('Y-m-d H:i:s');
if ($data['referrer_id'] == -1) {
$insert_data['referrer_id'] = 0;
$insert_data['referrer_id'] = 0;
$insert_data['referrer_source'] = 0;
}
......@@ -329,7 +340,9 @@ class Users extends Model
$m_phone = new AliYunPhone();
$num = $m_phone->where('phone_x', $data['user_phone'])->count(); //查询隐私号码
if ($num == 0) {
$insert_data['source'] = 20;
if (empty($data['source'])) {
$insert_data['source'] = 20;
}
$insert_data['status'] = -1;
$insert_data['create_time'] = date('Y-m-d H:i:s');
$this->save($insert_data);
......@@ -361,8 +374,9 @@ class Users extends Model
public function getClient($id)
{
if ($id) {
$field = "a.id as user_id,a.user_nick,a.user_pic,a.other_pic,a.user_name,a.user_phone,a.sex,a.agent_id,a.industry_type,a.user_label,
a.price_demand,a.area_demand,a.create_time,b.name,b.phone,a.first_login_time,a.referrer_id,a.referrer_source,a.province,a.city,a.disc,a.source";
$field = "a.id as user_id,a.user_nick,a.user_pic,a.other_pic,a.user_name,a.user_phone,a.sex,a.agent_id,
a.industry_type,a.user_label,a.price_demand,a.area_demand,a.create_time,b.name,b.phone,a.first_login_time,
a.referrer_id,a.referrer_source,a.province,a.city,a.disc,a.source,a.source_intro";
$data = $this->field($field)
->alias('a')
......@@ -384,7 +398,7 @@ class Users extends Model
$data['referrer_user'] = $referrer_user['name'] . '-' . $referrer_user['phone'];
} elseif ($data['referrer_source'] == 10) {
$referrer_user = $this->field('user_name,user_phone')->find($data['referrer_id']);
$user_phone = substr_replace($referrer_user['user_phone'], '****', 3, 4);
$user_phone = substr_replace($referrer_user['user_phone'], '****', 3, 4);
$data['referrer_user'] = $referrer_user['user_name'] . '-' . $user_phone;
}
......@@ -430,7 +444,7 @@ class Users extends Model
public function useraction_search_user_res($user_id, int $referrer = 0)
{
$field = 'id as user_id,agent_id,sex,user_nick,user_name,user_pic,user_status,user_phone,create_time,city,disc,user_label,
referrer_source,referrer_id,registration_time,industry_type,price_demand,area_demand,source,vip,first_login_time';
referrer_source,referrer_id,registration_time,industry_type,price_demand,area_demand,source,vip,first_login_time,source_intro';
$data = db('u_users')
->where('id', $user_id)
->field($field)
......@@ -438,12 +452,12 @@ class Users extends Model
if ($referrer != 0) {
if ($data['referrer_source'] == 10) {
$referrer_user = $data['referrer_user'] = db('u_users')
$referrer_user = $data['referrer_user'] = db('u_users')
->where('id', $data['referrer_id'])
->field('user_phone,user_name')
->find();
$user_phone = empty($referrer_user['user_phone']) ? '' : substr_replace($referrer_user['user_phone'], '****', 3, 4);
$user_phone = empty($referrer_user['user_phone']) ? '' : substr_replace($referrer_user['user_phone'], '****', 3, 4);
$referrer_user_string = $referrer_user['user_name'] . '-' . $user_phone;
} else {
$referrer_user = $data['referrer_user'] = db('a_agents')
......@@ -820,7 +834,7 @@ class Users extends Model
}
public function getLastOrNextUserID($where, $field, $limit, $order,$type)
public function getLastOrNextUserID($where, $field, $limit, $order, $type)
{
if ($type == 1) {
......@@ -874,8 +888,8 @@ class Users extends Model
public function getUserCityInfo($id)
{
$field='province,city,disc,create_time';
$params= [ 'id' => $id ];
$field = 'province,city,disc,create_time';
$params = [ 'id' => $id ];
$result = Db::table($this->table)
->field($field)
->where($params)
......@@ -884,5 +898,40 @@ class Users extends Model
return $result;
}
public function getAddUserNumForOperation($params)
{
$field = "count(1) as num";
$result = Db::table($this->table)
->field($field)
->where($params)
->select();
// dump($this->getLastSql());
return $result;
}
public function getInviteTotal($field,$params,$page_no,$page_size){
return Db::table($this->table)
->field($field)
->alias("a")
->join("a_agents b","a.referrer_id=b.id","left")
->where($params)
->group("b.id")
->page($page_no)
->limit($page_size)
->select();
}
public function getInviteCount($params){
return Db::table($this->table)
->alias("a")
->join("a_agents b","a.referrer_id=b.id","left")
->where($params)
->group("b.id")
->count();
}
}
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