Commit 3b48e985 authored by clone's avatar clone

Merge branch 'test_0507' into test

# Conflicts: # application/api_broker/extend/Basic.php # application/app_broker/view/index/customerinfo_customer_add.html # application/app_broker/view/index/customerinfo_details_new.html # application/index/controller/Agent.php # application/index/controller/District.php # application/index/view/agent/agent.html # application/route.php # public/app/js/customerinfo_customer_add.js # public/app/js/customerinfo_details_new.js
parents 481109f6 0ca3d9f2
...@@ -73,12 +73,24 @@ class GeTuiUntils { ...@@ -73,12 +73,24 @@ class GeTuiUntils {
* zhuwei * zhuwei
* 2017-11-06 * 2017-11-06
*/ */
function push_message_for_all($data) function push_message_for_all($title,$content,$link)
{ {
$igt = new \IGeTui(TL_GETUI_HOST, TL_GETUI_APPKEY, TL_GETUI_MASTERSECRET); $igt = new \IGeTui(TL_GETUI_HOST, TL_GETUI_APPKEY, TL_GETUI_MASTERSECRET);
$homeurl = $this->http_host();
$data['black_title'] = $title;
$data['content'] = $content;
$data['touchuan'] = json_encode(array(
'title' => $title,
'content' => $content,
'type' => 'url',
'url' => $link,
'name' => $title,
'id' => '69',
'imageUrl' => $homeurl .'/notice_android_logo.png'));
$template = $this->onli_all_template($data['touchuan'], $data['black_title'], $data['content']); $template = $this->onli_all_template($data['touchuan'], $data['black_title'], $data['content']);
//个推信息体 //个推信息体
//基于应用消息体 //基于应用消息体
$message = new \IGtAppMessage(); $message = new \IGtAppMessage();
$message->set_isOffline(true); $message->set_isOffline(true);
......
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/5/7
* Time: 16:47
*/
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\model\PushFeed;
class Feed extends Basic
{
/**
* 成交喜报列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function feedList() {
$push = new PushFeed();
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$field = 'id,house_id,title,content,link,house_title,create_time';
$where = [];
$where['status'] = 0;
if (!empty($this->agentId)) {
$where[0] = ['EXP','find_in_set('.$this->agentId.',agent_id) or agent_id = -1'];
}
$data = $push->getList($pageNo, $pageSize, 'id DESC', $field, $where);
foreach ($data as $k => $v) {
$data[$k]['icon'] = CURRENT_URL . "resource/image/notice_xibaotl.png";
$data[$k]['content'] = "恭喜{$v['content']}成交{$v['house_title']}商铺一套";
}
return $this->response(200, "", $data);
}
/**
* 点击数
*
* @return \think\Response
* @throws \think\Exception
*/
public function editFeedClick() {
header('Access-Control-Allow-Origin:*');
$push = new PushFeed();
if (empty($this->params['id'])) {
return $this->$this->response(101, 'Id is null');
}
if (empty($this->params['read_num'])) {
$push->editNum($this->params['id'], 'click_num');
} else {
$push->editNum($this->params['id'], 'read_num');
}
return $this->response(200, "");
}
/**
* 取消点赞数
*
* @return \think\Response
* @throws \think\Exception
*/
public function editDecFeedClick() {
header('Access-Control-Allow-Origin:*');
$push = new PushFeed();
if (empty($this->params['id'])) {
return $this->$this->response(101, 'Id is null');
}
$push->editNum($this->params['id'], 'click_num', 2);
return $this->response(200, "");
}
/**
* feed 详情
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getFeedInfo() {
header('Access-Control-Allow-Origin:*');
$push = new PushFeed();
$field = 'id,create_time,house_title,click_num,content,type';
if (empty($this->params['id'])) {
return $this->response(101, "Id is null!");
}
$where['id'] = $this->params['id'];
$where['status'] = 0;
$data = $push->getFeedInfo($field, $where);
if ($data['type'] == 0) {
$data['type_string'] = '成功下定';
}
return $this->response(200, "", $data);
}
}
\ No newline at end of file
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\LookShopService;
use app\model\AAgents;
use app\model\SystemConfig;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/5/8
* Time : 上午11:29
* Intro:
*/
class LookShop extends Basic
{
protected $lookShopService_;
protected $agentsModel;
function __construct(Request $request = null)
{
parent::__construct($request);
$this->lookShopService_ = new LookShopService();
$this->agentsModel = new AAgents();
}
/**
* 升级经纪人的看铺数量
* @return \think\Response
*/
public function setAgentLookNum()
{
$params = $this->params;
/* $params = array(
"agent_id" => 1,
"submit_agent_id" => 1,
);*/
if (!isset($params["agent_id"]) || !isset($params["submit_agent_id"])) {
return $this->response("101", "请求参数错误");
}
//todo 验证申请提交人和此经纪人是否是所属关系
$is_ok = $this->lookShopService_->setAgentLookNum($params["agent_id"]);
if ($is_ok) {
return $this->response("200", "request success", []);
} else {
return $this->response("101", "升级看铺数量失败");
}
}
/**
* 经纪人列表
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentsResidueNumList()
{
$params = $this->params;
/* $params = array(
"store_id" => 1,
);*/
if (!isset($params["store_id"]) && $params["store_id"] <= 0) {
return $this->response("101", "请求参数错误");
}
$field = "id,store_id,level,name,phone,img";
$where_["store_id"] = $params["store_id"];
$where_["status"] = 0;
$where_["level"] = 10;
$agentList = $this->agentsModel->getAgentById($field, $where_);
if (count($agentList) <= 0) {
return $this->response("101", "request null");
}
$systemConfigModel = new SystemConfig();
$lookNum = 0;
$data = $systemConfigModel->getSetting([ "config_type" => 40 ], "rule");
if ($data && $data["agent_shop_num"] > 0) {
$lookNum = $data["agent_shop_num"];
}
foreach ($agentList as $key => $item) {
$residue_num = $this->lookShopService_->isLookShop($item["id"]);
if ($residue_num <= 0) {
$agentList[$key]["is_show_button"] = true;
} else {
$agentList[$key]["is_show_button"] = false;
}
}
$result["look_num"] = $lookNum;
$result["list"] = $agentList;
return $this->response("200", "request success", $result);
}
}
\ No newline at end of file
...@@ -156,9 +156,9 @@ class OrderLog extends Basic ...@@ -156,9 +156,9 @@ class OrderLog extends Basic
} }
$is_ok = $this->service_->updateBillInfo($params["p_id"],$params["trade_no"],$params["pay_time"],$params["real_money"]); $is_ok = $this->service_->updateBillInfo($params["p_id"],$params["trade_no"],$params["pay_time"],$params["real_money"]);
if($is_ok > 0){ if($is_ok > 0){
return $this->response("200","request update success"); return $this->response("200","支付成功!");
}else{ }else{
return $this->response("101","update faild"); return $this->response("101","支付失败!");
} }
} }
...@@ -546,14 +546,10 @@ class OrderLog extends Basic ...@@ -546,14 +546,10 @@ class OrderLog extends Basic
$insert_data['scale'] = empty($this->params['scale']) ? 0 : $this->params['scale']; $insert_data['scale'] = empty($this->params['scale']) ? 0 : $this->params['scale'];
$data['data']['id'] = $bargain->insertBargain($insert_data); $data['data']['id'] = $bargain->insertBargain($insert_data);
if ($data['data']['id'] == 0) { if ($data['data'] == 0) {
$data['code'] = 101; $data['code'] = 101;
$data['msg'] = 'Add the failure.'; $data['msg'] = 'Add the failure.';
} }
//新增分佣推送
$push = new PushMessageService();
$push->pushBargainCommissionMessage($bargain_data['submit_agent_name'], $this->params['agent_id'], $bargain_data['order_id']);
} }
return $this->response($data['code'], $data['msg'], $data['data']); return $this->response($data['code'], $data['msg'], $data['data']);
......
...@@ -6,6 +6,7 @@ use app\api_broker\extend\Basic; ...@@ -6,6 +6,7 @@ use app\api_broker\extend\Basic;
use app\api_broker\service\ReportService; use app\api_broker\service\ReportService;
use app\model\AAgents; use app\model\AAgents;
use app\model\FollowUpLogModel; use app\model\FollowUpLogModel;
use app\model\GHousesToAgents;
use app\model\OReportModel; use app\model\OReportModel;
use think\Exception; use think\Exception;
...@@ -86,14 +87,13 @@ class Report extends Basic ...@@ -86,14 +87,13 @@ class Report extends Basic
*/ */
public function reportList() public function reportList()
{ {
/* $params = array(
"agent_id" =>10013,
"type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告
"page_no"=>1,
"page_size"=>15
);*/
$params = $this->params; $params = $this->params;
/*$params = array(
"agent_id" => 4022,
"type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告
"page_no" => 1,
"page_size" => 15
);*/
if (!isset($params["agent_id"]) || !isset($params["type"])) { if (!isset($params["agent_id"]) || !isset($params["type"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
...@@ -125,8 +125,33 @@ class Report extends Basic ...@@ -125,8 +125,33 @@ class Report extends Basic
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"agent_id" => 51, "agent_id" => 51,
"house_id" => 1
);*/ );*/
if (!isset($params["agent_id"]) || !isset($params["house_id"])) {
return $this->response("101", "请求参数错误");
}
$agent_id = $params["agent_id"];
$house_id = $params["house_id"];
//todo 判断是不是案场权限人
$agentToHouseModel = new GHousesToAgents();
$where_["houses_id"] = $house_id;
$where_["agents_id"] = $agent_id;
$where_["type"] = 1;
$where_["is_del"] = 0;
$isCase = $agentToHouseModel->getHouseToAgents("id", $where_);
$result["marchIn"] = $result["collectingBill"] = $result["refund"] = $result["bargain"] = false;
if (count($isCase) > 0) {
$result["marchIn"] = true;
$result["collectingBill"] = true;
$result["refund"] = true;
$result["bargain"] = true;
return $this->response("200", "request success", $result);
}
$auth_arr = [ $auth_arr = [
/*'broker/report', /*'broker/report',
'broker/addFollowUp',*/ 'broker/addFollowUp',*/
...@@ -140,9 +165,7 @@ class Report extends Basic ...@@ -140,9 +165,7 @@ class Report extends Basic
$agents = new AAgents(); $agents = new AAgents();
$is_auth = $agents->agentsAuthIds($params["agent_id"], $param); $is_auth = $agents->agentsAuthIds($params["agent_id"], $param);
/* $result["report"] = $result["addFollowUp"] = $result["statusBargain"] =*/
$result["marchIn"] = $result["collectingBill"] = $result["refund"]
= $result["bargain"] = false;
if (count($is_auth) > 0) { if (count($is_auth) > 0) {
foreach ($is_auth as $item) { foreach ($is_auth as $item) {
if ($item['name'] == "broker/marchIn") { if ($item['name'] == "broker/marchIn") {
......
...@@ -3,12 +3,14 @@ ...@@ -3,12 +3,14 @@
namespace app\api_broker\controller; namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\service\LookShopService;
use app\api_broker\service\VerifyService; use app\api_broker\service\VerifyService;
use app\model\AttentionModel; use app\model\AttentionModel;
use app\model\GHouses; use app\model\GHouses;
use app\model\GHousesFollowUp; use app\model\GHousesFollowUp;
use app\model\GHousesImgs; use app\model\GHousesImgs;
use app\model\Regions; use app\model\Regions;
use think\Log;
/** /**
* Created by PhpStorm. * Created by PhpStorm.
...@@ -22,13 +24,15 @@ class Shop extends Basic ...@@ -22,13 +24,15 @@ class Shop extends Basic
private $gHousesModel; private $gHousesModel;
private $gHousesImgModel; private $gHousesImgModel;
private $attentionModel; private $attentionModel;
private $lookShopService_;
function __construct($request = null) function __construct($request = null)
{ {
parent::__construct($request); parent::__construct($request);
$this->gHousesModel = new GHouses(); $this->gHousesModel = new GHouses();
$this->gHousesImgModel = new GHousesImgs(); $this->gHousesImgModel = new GHousesImgs();
$this->attentionModel = new AttentionModel(); $this->attentionModel = new AttentionModel();
$this->lookShopService_ = new LookShopService();
} }
/** /**
...@@ -171,6 +175,10 @@ class Shop extends Basic ...@@ -171,6 +175,10 @@ class Shop extends Basic
$param["house_id"] = $val["id"]; $param["house_id"] = $val["id"];
$param["img_type"] = 1; //默认主图 $param["img_type"] = 1; //默认主图
$result[$key]["images"] = $this->gHousesImgModel->getHouseImages($param, 1); $result[$key]["images"] = $this->gHousesImgModel->getHouseImages($param, 1);
if ($params["site_area"] == 3 || $params["site_area"] == 4) {
$isLook = $this->lookShopService_->isLooked($this->agentId, $val["id"]);
$result[$key]["is_look"] = $isLook;
}
} }
...@@ -192,11 +200,11 @@ class Shop extends Basic ...@@ -192,11 +200,11 @@ class Shop extends Basic
public function getShopDetail() public function getShopDetail()
{ {
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
/*$params = array( $params = array(
"id" => 445, "id" => 4,
"site_area" => 3, //1.c端 3.b端 "site_area" => 3, //1.c端 3.b端
"user_id" => 2 //if c端 用户登录后传入user_id //"user_id" => 2 //if c端 用户登录后传入user_id
);*/ );
$params = $this->params; $params = $this->params;
$conditions = []; $conditions = [];
...@@ -207,6 +215,7 @@ class Shop extends Basic ...@@ -207,6 +215,7 @@ class Shop extends Basic
return $this->response("101", "请求来源错误"); return $this->response("101", "请求来源错误");
} }
if ($params['site_area'] == 1) { if ($params['site_area'] == 1) {
$field = "a.id,a.external_title as title,a.external_address as address,a.city,a.disc,a.business_district_id,a.status, $field = "a.id,a.external_title as title,a.external_address as address,a.city,a.disc,a.business_district_id,a.status,
a.industry_type,a.shop_area_start,a.shop_area_end,a.shop_type,a.residue_num,a.shop_sign,a.is_carefully_chosen,a.rent_type, a.industry_type,a.shop_area_start,a.shop_area_end,a.shop_type,a.residue_num,a.shop_sign,a.is_carefully_chosen,a.rent_type,
...@@ -221,13 +230,15 @@ class Shop extends Basic ...@@ -221,13 +230,15 @@ class Shop extends Basic
a.rent_price,a.management_fee,a.slotting_fee,a.total,a.market_area,a.is_has_gas,a.file_path,a.longitude,a.latitude, a.rent_price,a.management_fee,a.slotting_fee,a.total,a.market_area,a.is_has_gas,a.file_path,a.longitude,a.latitude,
b.enter_num,b.internal_item_advantage as item_advantage,b.sign_rule,b.do_business_date, b.opening_date,b.traffic, b.enter_num,b.internal_item_advantage as item_advantage,b.sign_rule,b.do_business_date, b.opening_date,b.traffic,
b.auditorium,b.tiny_brochure_url,b.start_business_date,a.upload_id,b.fee_rule"; b.auditorium,b.tiny_brochure_url,b.start_business_date,a.upload_id,b.fee_rule";
} }
$conditions['a.id'] = array( "eq", $params["id"] ); $conditions['a.id'] = array( "eq", $params["id"] );
$result = $this->gHousesModel->getHouseDetailById($field, $conditions); $result = $this->gHousesModel->getHouseDetailById($field, $conditions);
if (count($result) <= 0) {
return $this->response("101", '此楼盘不存在');
}
if ($result["start_business_date"] == "0000-00-00 00:00:00" || empty($result["start_business_date"])) { if ($result["start_business_date"] == "0000-00-00 00:00:00" || empty($result["start_business_date"])) {
$result["start_business_date"] = ""; $result["start_business_date"] = "";
...@@ -266,6 +277,21 @@ class Shop extends Basic ...@@ -266,6 +277,21 @@ class Shop extends Basic
$agentId = $verify->getPanpartyAgentsByHouseId($params["id"]); $agentId = $verify->getPanpartyAgentsByHouseId($params["id"]);
$result["panParty"] = $agentId; $result["panParty"] = $agentId;
// 计数开始
if ($params["site_area"] == 3 && $result) {
$lookShopArr = $this->lookShopService_->countLookShopNum((int)$this->agentId, (int)$params["id"]);
//判断看铺数量是否上限
if ($lookShopArr) {
if ($lookShopArr["residue_num"] == 0 && !$lookShopArr["isExist"] && !$lookShopArr["isPanParty"]) {
Log::record('info ----countLookShopNum------121113-', "info");
return $this->response("102", "您今天的看铺数量已达上限!");
}
$result["lookShopArr"] = $lookShopArr;
}
}
return $this->response("200", 'request success', $result); return $this->response("200", 'request success', $result);
} }
...@@ -304,7 +330,7 @@ class Shop extends Basic ...@@ -304,7 +330,7 @@ class Shop extends Basic
} }
} }
return $this->response($result['code'], $result['msg'], $result['data']);; return $this->response($result['code'], $result['msg'], $result['data']);
} }
/** /**
...@@ -365,8 +391,8 @@ class Shop extends Basic ...@@ -365,8 +391,8 @@ class Shop extends Basic
$img = new GHousesImgs(); $img = new GHousesImgs();
$id = $img->getHouseImagesInfo('id', [ $id = $img->getHouseImagesInfo('id', [
'house_id' => $this->params['house_id'], 'house_id' => $this->params['house_id'],
'img_name' => $this->params['save_path'], 'img_name' => $this->params['save_path'],
'img_status' => 0 'img_status' => 0
]); ]);
...@@ -418,26 +444,27 @@ class Shop extends Basic ...@@ -418,26 +444,27 @@ class Shop extends Basic
* 新增店铺跟进 * 新增店铺跟进
* @return \think\Response * @return \think\Response
*/ */
public function addShopFollowUp(){ public function addShopFollowUp()
{
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"house_id" => 1, "house_id" => 1,
"follow_up_info"=>"123123131", "follow_up_info"=>"123123131",
"agent_id"=>1, "agent_id"=>1,
"agent_name"=>"2324", "agent_name"=>"2324",
"agent_phone"=>"13766166616", "agent_phone"=>"13766166616",
);*/ );*/
if(!isset($params["house_id"]) || !isset($params["follow_up_info"])|| !isset($params["agent_id"]) if (!isset($params["house_id"]) || !isset($params["follow_up_info"]) || !isset($params["agent_id"])
|| !isset($params["agent_name"])|| !isset($params["agent_phone"])){ || !isset($params["agent_name"]) || !isset($params["agent_phone"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$follow_up_model = new GHousesFollowUp(); $follow_up_model = new GHousesFollowUp();
$id = $follow_up_model->addHousesFollowUp($params); $id = $follow_up_model->addHousesFollowUp($params);
if($id > 0 ){ if ($id > 0) {
return $this->response("200","request success",["id"=>$id]); return $this->response("200", "request success", [ "id" => $id ]);
}else{ } else {
return $this->response("200","request error"); return $this->response("200", "request error");
} }
......
...@@ -47,6 +47,10 @@ class Basic extends Controller ...@@ -47,6 +47,10 @@ class Basic extends Controller
'broker/getBroker', 'broker/getBroker',
'broker/searchAgentShop', 'broker/searchAgentShop',
'broker/forgetPwd', 'broker/forgetPwd',
'broker/getFeedInfo',
'broker/feedList',
'broker/editFeedClick',
'broker/editDecFeedClick',
'broker/sendSms' 'broker/sendSms'
); );
......
<?php
namespace app\api_broker\service;
use app\extra\RedisExt;
use app\model\AAgents;
use app\model\GHousesToAgents;
use app\model\SystemConfig;
use RedisException;
use think\Exception;
use think\Log;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/5/7
* Time : 上午10:28
* Intro:
*/
class LookShopService
{
private $redis;
private $nowTime;
private $gHousesToAgentsModel;
private $agentsModel;
private $systemConfigModel;
const LOOK_SHOP = "look_shop_";//存入已看的楼盘id
const LOOK_TOTAL = "look_total_";//记录每个经纪人的看铺总数
const LOOK_UP_NUM = "look_up_num_";//记录每个经纪人的看铺升级次数
public function __construct()
{
try {
$this->redis = RedisExt::getRedis();
} catch (RedisException $exception) {
$this->redis = false;
}
$this->nowTime = date("Y-m-d", time());
$this->gHousesToAgentsModel = new GHousesToAgents();
$this->agentsModel = new AAgents();
$this->systemConfigModel = new SystemConfig();
}
/**
* 验证数量
* @param int $agent_id
* @param int $house_id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function countLookShopNum(int $agent_id, int $house_id): array
{
//todo 1.取读控制里面的看铺数量,2.取出此经济人已看数量和商铺 3.判断时间,每天刷新看铺数量
// todo 4.判断是否到达上限,if 上限 return false else return true
//redis服务挂掉,都可以看
if(!$this->redis){
return [];
}
//todo 过滤掉店长以上的经纪人
$agentInfo = $this->agentsModel->getAgentById("id,level", [ "agent_id" => $agent_id ]);
Log::record('info ----countLookShopNum-------' . json_encode($agentInfo), "info");
if ($agentInfo && $agentInfo[0]["level"] > 10) {
Log::record('info ----countLookShopNum------123-', "info");
return [];
}
//过滤掉盘方为自己的
$params["houses_id"] = $house_id;
$params["agents_id"] = $agent_id;
$params["type"] = 2;
$params["is_del"] = 0;
$housesToAgents = $this->gHousesToAgentsModel->getHouseToAgents("id", $params);
$isPanParty = count($housesToAgents) > 0 ? true : false;
//判断楼盘是否看过,看过了则不判断数量
$isExist = $this->isLooked($agent_id, $house_id);
$lookShopNum = $this->isLookShop($agent_id);
if ($lookShopNum > 0 && !$isExist && !$isPanParty) {
$this->redis->sAdd(self::LOOK_SHOP . $this->nowTime . $agent_id, $house_id);//存入楼盘信息
$this->incrementLookNum($agent_id);
}
$totalNum = $this->redis->hGet(self::LOOK_UP_NUM . $this->nowTime, $agent_id) * $this->redis->get("lookNum");
return [ "total_num" => $totalNum, "residue_num" => $lookShopNum, "isExist" => $isExist, "isPanParty" => $isPanParty ];
}
/**
* 判断是否已经看过,看过返回true 否则 false
* @param int $agent_id
* @param int $house_id
* @return bool
*/
public function isLooked(int $agent_id, int $house_id): bool
{
//redis服务挂掉,都可以看
if(!$this->redis){
return false;
}
$isExist = $this->redis->sIsMember(self::LOOK_SHOP . $this->nowTime . $agent_id, $house_id);
if ($isExist) {
return true;
} else {
return false;
}
}
/**
* look shop num +1
* @param int $agent_id
* @return bool
*/
private function incrementLookNum(int $agent_id): bool
{
$residueNum = (int)$this->redis->hGet($this->nowTime, $agent_id);
$residueNum += 1;
Log::record('info ----look residueNum-------' . $residueNum, "info");
$this->redis->hSet($this->nowTime, $agent_id, $residueNum);
return true;
}
/**
* 判断是否可以继续看铺,返回剩余数量
* @param int $agent_id
* @return int
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function isLookShop(int $agent_id): int
{
//redis服务挂掉,不显示升级按钮 数量不能为0
if(!$this->redis){
return 1;
}
$lookNum = 50;//默认50看铺数量
if (!$this->redis->get("lookNum")) {
//数据库查询
$data = $this->systemConfigModel->getSetting([ "config_type" => 40 ], "rule");
if ($data && $data["agent_shop_num"] > 0) {
$lookNum = $data["agent_shop_num"];
}
$this->redis->set("lookNum", $lookNum);
} else {
$lookNum = $this->redis->get("lookNum");
}
if (!$this->redis->hExists($this->nowTime, $agent_id)) { //初始化经纪人看铺次数和升级次数
$this->redis->hSet($this->nowTime, $agent_id, 0); //开始计数
$this->redis->hSet(self::LOOK_UP_NUM . $this->nowTime, $agent_id, 1);//初始次数
}
$agentLookNum = (int)$this->redis->hGet($this->nowTime, $agent_id);
$totalNum = $lookNum * (int)$this->redis->hGet(self::LOOK_UP_NUM . $this->nowTime, $agent_id);
Log::record('info ----look agentLookNum-------' . $agentLookNum, "info");
Log::record('info ----look totalNum-------' . $totalNum, "info");
if ($agentLookNum >= $totalNum) { //如果数量为大于等于总数 证明看铺达到上限
return 0;
}
return $totalNum - $agentLookNum;//返回剩余看铺数
}
/**
* 后台修改看铺数量配置,则更改redis数量
* @param int $num
* @return bool
*/
public function setLookNum(int $num): bool
{
if(!$this->redis){
return false;
}
$this->redis->set("lookNum", $num);
return true;
}
/**
* 升级经纪人看铺次数
* @param int $agent_id
* @return bool
*/
public function setAgentLookNum(int $agent_id): bool
{
if(!$this->redis){
return false;
}
$agentUpNum = $this->redis->hGet(self::LOOK_UP_NUM . $this->nowTime, $agent_id);
$upLookNum = (int)$agentUpNum + 1;
$this->redis->hSet(self::LOOK_UP_NUM . $this->nowTime, $agent_id, $upLookNum);
return true;
}
}
\ No newline at end of file
...@@ -16,7 +16,8 @@ use app\model\GHouses; ...@@ -16,7 +16,8 @@ use app\model\GHouses;
use app\model\GHousesToAgents; use app\model\GHousesToAgents;
use app\model\OrderModel; use app\model\OrderModel;
use app\model\OReportModel; use app\model\OReportModel;
use app\model\Users; use app\model\PushFeed;
class PushMessageService class PushMessageService
{ {
...@@ -87,7 +88,7 @@ class PushMessageService ...@@ -87,7 +88,7 @@ class PushMessageService
} }
/** /**
* 成交报告推送 * 成交报告推送(feed流喜报)
* *
* @param int $report_id * @param int $report_id
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
...@@ -95,53 +96,34 @@ class PushMessageService ...@@ -95,53 +96,34 @@ class PushMessageService
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function pushBargainMessage($report_id = 0){ public function pushBargainMessage($report_id = 0){
$agent = new AAgents(); $report = new OReportModel();
$agent_house = new GHousesToAgents(); $feed = new PushFeed();
$user = new Users(); $field = 'house_id,house_title,report_agent_name,report_store_id,user_id,report_agent_id';
$field = 'house_id,house_title,report_agent_name,report_store_id,user_id';
$report = new OReportModel();
$report_data = $report->getReportOrder($field, [ 'a.id' => $report_id ]);
$user_agent_id = $user->getUserById('agent_id',$report_data['user_id']); $report_data = $report->getReportOrder($field, [ 'a.id' => $report_id ]);
$key = 0;
//客方
if (!empty($user_agent_id['agent_id'])) {
$agent_data[$key]['id'] = $user_agent_id['agent_id'];
$agent_data[$key]['device_id'] = $agent->getAgentsById($user_agent_id['agent_id'],'device_id');
$key++;
}
$device_id = $agent->getAgentInfo('id,device_id','', [
'store_id'=>$report_data['report_store_id'],'level'=>['in','20,40']
]);
//店长
if ($device_id['device_id']) {
$agent_data[$key]['id'] = $device_id['id'];
$agent_data[$key]['device_id'] = $device_id['device_id'];
$key++;
}
//独家方和盘方
$agent_houser_data = $agent_house->getHousesAgents($report_data['house_id'], 'b.id,b.device_id',['type'=>['in','2,3']]);
foreach ($agent_houser_data as $v) {
if (!empty($v['device_id'])) {
$agent_data[$key]['id'] = $v['id'];
$agent_data[$key]['device_id'] = $v['device_id'];
$key++;
}
}
$store = new AStore(); $store = new AStore();
$store_name = $store->getStoreKeyById('store_name',$report_data['report_store_id']); $store_name = $store->getStoreDistrictName($report_data['report_store_id']);
$title = '成交就是这么简单';
$feed->editData([
'title' => $title,
'agent_id' => -1,
'report_id' => $report_id,
'house_id' => $report_data['house_id'],
'content' => $store_name . $report_data['report_agent_name'],
'steel_phone' => 0,
'type' => 0,
'status' => 0,
'user_id' => $report_data['report_agent_id'],
'house_title' => $report_data['house_title'],
'read_num' => 10, //不要问什么,就是产品要加的。PV
'click_num' => 10 //不要问什么,就是产品要加的。
]);
$content = "恭喜【{$store_name}】店【{$report_data['report_agent_name']}】成交【{$report_data['house_title']}】商铺一套"; $content = "恭喜【{$store_name}】店【{$report_data['report_agent_name']}】成交【{$report_data['house_title']}】商铺一套";
$url = $this->push->http_host(). '/app/dist/index.html#/feeds?id='.$feed->id;
foreach ($agent_data as $k => $v) { $feed->editData(['link'=>$url], $feed->id);
$this->push->public_push_message_for_one($v['id'], $v['device_id'], '成交就是这么简单', $content); $this->push->push_message_for_all($title, $content, $url);
}
return ; return ;
} }
......
...@@ -73,10 +73,10 @@ class ReportService ...@@ -73,10 +73,10 @@ class ReportService
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function verifyReport($agent_id,$agent_phone, $agent_name, $store_id, $user_id, $user_phone, $user_name, $house_ids, $vehicle, $intro, $predict_see_time) public function verifyReport($agent_id, $agent_phone, $agent_name, $store_id, $user_id, $user_phone, $user_name, $house_ids, $vehicle, $intro, $predict_see_time)
{ {
$id = $this->reportBin($agent_id,$agent_phone, $agent_name, $store_id, $user_id, $user_phone, $user_name, $vehicle, $intro, $id = $this->reportBin($agent_id, $agent_phone, $agent_name, $store_id, $user_id, $user_phone, $user_name, $vehicle, $intro,
$predict_see_time); $predict_see_time);
if ($id > 0) { if ($id > 0) {
...@@ -91,7 +91,7 @@ class ReportService ...@@ -91,7 +91,7 @@ class ReportService
$push->pushReportMessage($v, $agent_id); //推送报备信息 $push->pushReportMessage($v, $agent_id); //推送报备信息
} }
//todo 保存order表 订单返回成功返回报备id //todo 保存order表 订单返回成功返回报备id
return ($this->orderModel->insertOrderByAll($order_arr) > 0) ? $id:0; return ($this->orderModel->insertOrderByAll($order_arr) > 0) ? $id : 0;
} }
} }
...@@ -112,15 +112,18 @@ class ReportService ...@@ -112,15 +112,18 @@ class ReportService
$vModel = new VerifyService(); $vModel = new VerifyService();
$agentArr = $vModel->getAgentsByAgentId($params["report_agent_id"]); $agentArr = $vModel->getAgentsByAgentId($params["report_agent_id"]);
if ($agentArr) { if ($agentArr) {
$params["agent_id_s"] = array("in",$agentArr); $params["agent_id_s"] = array( "in", $agentArr );
$params["report_agent_id"] = $agentArr; $params["report_agent_id"] = $agentArr;
} }
$caseHouseId = $vModel->getCaseHouseIdByAgentId($params["agent_id_s"]); $caseHouseId = $vModel->getCaseHouseIdByAgentId($params["agent_id_s"]);
$ids = ""; $ids = "";
foreach ($caseHouseId as $item) { if (count($caseHouseId) > 0) {
$ids .= $item["houses_id"] . ","; foreach ($caseHouseId as $item) {
$ids .= $item["houses_id"] . ",";
}
} }
$ids = rtrim($ids, ","); $ids = rtrim($ids, ",");
$ids = $ids ? $ids : 0; $ids = $ids ? $ids : 0;
$params["house_ids"] = $ids; $params["house_ids"] = $ids;
...@@ -139,6 +142,7 @@ class ReportService ...@@ -139,6 +142,7 @@ class ReportService
$sign_arr = $this->orderSign($ids_str); $sign_arr = $this->orderSign($ids_str);
foreach ($result as $k => $v) { foreach ($result as $k => $v) {
$result[$k]["sign"] = "";
foreach ($sign_arr as $value) { foreach ($sign_arr as $value) {
if ($v["order_id"] == $value["order_id"]) { if ($v["order_id"] == $value["order_id"]) {
$result[$k]["sign"] .= $this->signTitle($value["type"]) . ","; $result[$k]["sign"] .= $this->signTitle($value["type"]) . ",";
...@@ -198,22 +202,22 @@ class ReportService ...@@ -198,22 +202,22 @@ class ReportService
* @param $predict_see_time int 时间戳 * @param $predict_see_time int 时间戳
* @return int|string * @return int|string
*/ */
public function reportBin($report_agent_id,$agent_phone , $report_agent_name, $report_store_id, $user_id, $user_phone, $user_name, public function reportBin($report_agent_id, $agent_phone, $report_agent_name, $report_store_id, $user_id, $user_phone, $user_name,
$vehicle, $intro, $predict_see_time) $vehicle, $intro, $predict_see_time)
{ {
$param["report_agent_id"] = $report_agent_id; $param["report_agent_id"] = $report_agent_id;
$param["report_agent_phone"] = $agent_phone; $param["report_agent_phone"] = $agent_phone;
$param["report_agent_name"] = $report_agent_name; $param["report_agent_name"] = $report_agent_name;
$param["report_store_id"] = $report_store_id; $param["report_store_id"] = $report_store_id;
$param["user_id"] = $user_id; $param["user_id"] = $user_id;
$param["user_phone"] = $user_phone; $param["user_phone"] = $user_phone;
$param["user_name"] = $user_name; $param["user_name"] = $user_name;
$param["vehicle"] = $vehicle; $param["vehicle"] = $vehicle;
$param["status"] = 0; $param["status"] = 0;
$param["intro"] = $intro; $param["intro"] = $intro;
$param["predict_see_time"] = date("Y-m-d H:i:s", $predict_see_time); $param["predict_see_time"] = date("Y-m-d H:i:s", $predict_see_time);
$param["create_time"] = date("Y-m-d H:i:s", time()); $param["create_time"] = date("Y-m-d H:i:s", time());
$param["update_time"] = date("Y-m-d H:i:s", time()); $param["update_time"] = date("Y-m-d H:i:s", time());
return $this->reportModel->addReport($param); return $this->reportModel->addReport($param);
} }
......
...@@ -5,7 +5,6 @@ namespace app\app\controller; ...@@ -5,7 +5,6 @@ namespace app\app\controller;
use app\model\AppVersion; use app\model\AppVersion;
use app\model\HouseImgs; use app\model\HouseImgs;
use app\model\HouseInfos; use app\model\HouseInfos;
use think\Controller;
use think\Response; use think\Response;
class Index class Index
...@@ -66,8 +65,6 @@ class Index ...@@ -66,8 +65,6 @@ class Index
{ {
return view('index/more_chengjiao'); return view('index/more_chengjiao');
} }
/** /**
* 楼盘详情 * 楼盘详情
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
<script type="text/javascript" src="/app/js/jquery-1122-min.js"></script> <script type="text/javascript" src="/app/js/jquery-1122-min.js"></script>
<script src="/app/js/common.js?new40" charset="utf-8"></script> <script src="/app/js/common.js?new40" charset="utf-8"></script>
<script src="/app/js/customerinfo_customer_add.js?new34"></script> <script src="/app/js/customerinfo_customer_add.js?new35"></script>
</body> </body>
......
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
<script type="text/javascript" src="/app/js/jquery-1122-min.js"></script> <script type="text/javascript" src="/app/js/jquery-1122-min.js"></script>
<script src="/app/js/common.js?new39" charset="utf-8"></script> <script src="/app/js/common.js?new39" charset="utf-8"></script>
<script src="/app/js/customerinfo_details_new.js?new44"></script> <script src="/app/js/customerinfo_details_new.js?new45"></script>
</body> </body>
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace app\extra; namespace app\extra;
use RedisException;
/** /**
* Created by PhpStorm. * Created by PhpStorm.
* User : zw * User : zw
...@@ -9,7 +11,6 @@ namespace app\extra; ...@@ -9,7 +11,6 @@ namespace app\extra;
* Time : 13:49 * Time : 13:49
* Intro: * Intro:
*/ */
use think\cache\driver\Redis;
class RedisExt class RedisExt
{ {
...@@ -27,7 +28,18 @@ class RedisExt ...@@ -27,7 +28,18 @@ class RedisExt
'persistent' => false, 'persistent' => false,
'prefix' => '', 'prefix' => '',
]; ];
self::$_instance = new Redis($config);
self::$_instance = new \Redis();
try{
self::$_instance->connect(
$config["host"],
$config["port"],
$config["timeout"]
);
}catch (RedisException $exception){
throw new RedisException($exception);
}
} }
public static function getRedis() public static function getRedis()
......
...@@ -116,42 +116,59 @@ class Agent extends Basic ...@@ -116,42 +116,59 @@ class Agent extends Basic
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function saveAgent(){ public function saveAgent(){
$group_id = $this->request->param('id');
$table = new AAgents(); $m_agent = new AAgents();
$id = $this->params['id'];
if ($this->request->isPost()) { if ($this->request->isPost()) {
$data = input('post.');
if (empty($this->params['store_id'])) {
return $this->response(101, '门店id为空!');
}
$password = $m_agent->verifyUser('password', '', ['phone'=> $this->params['phone']]);
//新增或者编辑数据 //新增或者编辑数据
if(empty($data['id'])) { if(empty($this->params['id'])) {
//判断name是否重复
if(!empty($password)) {
return $this->response(101, '手机号重复');
}
$data['create_time'] = date( 'Y-m-d H:i:s',time()); $data['create_time'] = date( 'Y-m-d H:i:s',time());
$data['update_time'] = date( 'Y-m-d H:i:s',time()); $data['update_time'] = date( 'Y-m-d H:i:s',time());
$id = ''; $id = 0;
$data['password'] = md5(substr($this->params['password'], -6)); //默认号码后6位
} else { } else {
$data['update_time'] = date( 'Y-m-d H:i:s',time()); $data['update_time'] = date( 'Y-m-d H:i:s',time());
$id = $data['id'];
} if (!empty($this->params['password'])) {
$md5_password = md5($this->params['password']);
//判断name是否重复 if (($md5_password != $password['password']) && ($password['password'] != $this->params['password'])) {
if($table->repetition('phone',$data['phone']) && empty($id)) { $data['password'] = $md5_password;
return $this->response(100, '存在重复值'); }
} }
if (empty($this->params['store_id'])) {
return $this->response(100, '门店id为空!');
} }
$store = new AStore(); $store = new AStore();
$data['district_id'] = $store->getStoreKeyById('district_id', ['id'=>$this->params['store_id']]); $data['district_id'] = $store->getStoreKeyById('district_id', ['id'=>$this->params['store_id']]);
$data['password'] = md5(substr($data['phone'], -6));
if ($table->editData($data,$id)) { $data['name'] = trim($this->params['name']);
$data['store_id'] = $this->params['store_id'];
$data['phone'] = trim($this->params['phone']);
$data['admin_off'] = $this->params['admin_off'];
$data['sex'] = $this->params['sex'];
$data['remarks'] = $this->params['remarks'];
$data['auth_group_id'] = $this->params['auth_group_id'];
if ($m_agent->editData($data, $id)) {
return $this->response(200, '成功'); return $this->response(200, '成功');
} else { } else {
return $this->response(100, '无修改'); return $this->response(101, '无修改');
} }
} else { } else {
//查看 //查看
$info = $table->where('id',$group_id)->find(); $info = $m_agent->verifyUser('id,name,phone,password,store_id,sex,admin_off,remarks', '', ['id'=>$id]);
return $this->response(200, '查看', $info); return $this->response(200, '查看', $info);
} }
} }
...@@ -198,23 +215,17 @@ class Agent extends Basic ...@@ -198,23 +215,17 @@ class Agent extends Basic
if($table->saveStatus('auth_group_id', $data['group_id'], $ids)){ if($table->saveStatus('auth_group_id', $data['group_id'], $ids)){
$msg = '成功'; $msg = '成功';
} else { } else {
$code = '100'; $code = 101;
$msg = '失败'; $msg = '失败';
} }
} else { } else {
$msg = '数据为空'; $msg = '数据为空';
$code = 100; $code = 101;
} }
return $this->response($code,$msg, $data); return $this->response($code,$msg, $data);
} }
//
public function shop_district(){
}
/** /**
* 添加门店 * 添加门店
* @throws \Exception * @throws \Exception
......
...@@ -25,10 +25,10 @@ class District extends Basic ...@@ -25,10 +25,10 @@ class District extends Basic
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getDistrictList () { public function getDistrictList () {
if (!$this->request->isAjax()) { if (!$this->request->isAjax()) {
return view('index'); return view('index');
} }
$data['status'] = 200; $data['status'] = 200;
$data['data'] = ''; $data['data'] = '';
$data['msg'] = ''; $data['msg'] = '';
...@@ -61,13 +61,6 @@ class District extends Basic ...@@ -61,13 +61,6 @@ class District extends Basic
return $this->response($data['status'], $data['msg'], $data); return $this->response($data['status'], $data['msg'], $data);
} }
/**
* 部门总监列表页面
*/
public function districtList() {
return view('index');
}
/** /**
* 添加部门,绑定总监关系 * 添加部门,绑定总监关系
* *
......
...@@ -61,7 +61,7 @@ class Member extends Basic{ ...@@ -61,7 +61,7 @@ class Member extends Basic{
//客户手机号 //客户手机号
if (!empty($params['phone'])) { if (!empty($params['phone'])) {
$where['concat(a.user_phone,a.user_nick)'] = ['like','%'.$this->params['phone'].'%']; $where[0] = ['EXP','a.user_phone LIKE "%'.$this->params['phone'].'%" or a.user_nick LIKE "%'.$this->params['phone'].'%"'];
} }
//是否公客 //是否公客
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
namespace app\index\controller; namespace app\index\controller;
use app\api_broker\service\LookShopService;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\model\SystemConfig; use app\model\SystemConfig;
use think\Cache; use think\Cache;
...@@ -53,7 +54,24 @@ class Setting extends Basic ...@@ -53,7 +54,24 @@ class Setting extends Basic
'day_num'=>$data['day_num'] 'day_num'=>$data['day_num']
]); ]);
$config_data[1]['agent_id'] = $this->userId; $config_data[1]['agent_id'] = $this->userId;
$config_data[2]['id'] = 3;
$config_data[2]['config_name'] = '新客户保护期有效小时数';
$config_data[2]['config_type'] = 30;
$new_client_hours = $this->params['new_client_hours'];
$config_data[2]['rule'] = json_encode(['new_client_hours'=>$new_client_hours]);
$config_data[2]['agent_id'] = $this->userId;
$config_data[3]['id'] = 4;
$config_data[3]['config_name'] = '业务员最多可查看的商铺数量';
$config_data[3]['config_type'] = 40;
$agent_shop_num = empty($this->params['agent_shop_num']) ? 5 : $this->params['agent_shop_num'];
$config_data[3]['rule'] = json_encode(['agent_shop_num'=>$agent_shop_num]);
$config_data[3]['agent_id'] = $this->userId;
$config->insertSetting($config_data, true); $config->insertSetting($config_data, true);
$look = new LookShopService();
$look->setLookNum($agent_shop_num);
Cache::set('Setting',$data); Cache::set('Setting',$data);
} }
......
...@@ -43,7 +43,7 @@ class Store extends Basic ...@@ -43,7 +43,7 @@ class Store extends Basic
} }
if (!empty($this->params['district'])) { if (!empty($this->params['district'])) {
$where['province'] = $this->params['district']; $where['district'] = $this->params['district'];
} }
//店长姓名 //店长姓名
......
This diff is collapsed.
...@@ -98,28 +98,6 @@ class AAgents extends BaseModel ...@@ -98,28 +98,6 @@ class AAgents extends BaseModel
return $data; return $data;
} }
/**检查重复
* @param $name
* @param $key
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function repetition($name, $key)
{
$r = $this->field($name)
->where($name, '=', $key)
->select();
//$this->getLastSql();
if ($r) {
return true;
} else {
return false;
}
}
//更新数据 //更新数据
public function saveStatus($name, $key, $ids) public function saveStatus($name, $key, $ids)
{ {
...@@ -285,6 +263,16 @@ class AAgents extends BaseModel ...@@ -285,6 +263,16 @@ class AAgents extends BaseModel
if (isset($params["agent_id"])) { if (isset($params["agent_id"])) {
$where_["id"] = $params["agent_id"]; $where_["id"] = $params["agent_id"];
} }
if (isset($params["store_id"])) {
$where_["store_id"] = $params["store_id"];
}
if (isset($params["status"])) {
$where_["status"] = $params["status"];
}
if (isset($params["level"])) {
$where_["level"] = $params["level"];
}
$result = $this->field($field) $result = $this->field($field)
->where($where_) ->where($where_)
......
...@@ -563,12 +563,14 @@ class GHouses extends BaseModel ...@@ -563,12 +563,14 @@ class GHouses extends BaseModel
*/ */
public function getHouseDetailById($field, $params) public function getHouseDetailById($field, $params)
{ {
return Db::table($this->table) $result = Db::table($this->table)
->field($field) ->field($field)
->alias("a") ->alias("a")
->join('g_houses_ext b', 'a.id=b.house_id', 'left') ->join('g_houses_ext b', 'a.id=b.house_id', 'left')
->where($params) ->where($params)
->find($params["id"]); ->find($params["a.id"]);
//echo Db::table($this->table)->getLastSql();
return $result;
} }
/** /**
......
...@@ -262,4 +262,13 @@ class GHousesToAgents extends BaseModel ...@@ -262,4 +262,13 @@ class GHousesToAgents extends BaseModel
public function updateUserAll($data) { public function updateUserAll($data) {
return $this->saveAll($data); return $this->saveAll($data);
} }
public function getHouseToAgents($field,$params){
return Db::table($this->table)
->field($field)
->where($params)
->limit(1)
->select();
}
} }
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/5/7
* Time: 17:54
*/
namespace app\model;
class PushFeed extends BaseModel
{
/**
* 修改单个字段步长
*
* @param $id
* @param $field
* @param int $way
* @param int $step
* @return int|true
* @throws \think\Exception
*/
public function editNum($id, $field, $way = 1, $step = 1) {
$this->where('id',$id);
if ($way == 1) {
$result = $this->setInc($field, $step);
} else {
$result = $this->setDec($field, $step);
}
return $result;
}
/**
* feed流详情
*
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getFeedInfo($field = '', $params = '') {
return $this->field($field)
->where($params)
->find();
}
}
\ No newline at end of file
<?php
namespace app\model;
use think\Model;
class PushHistories extends Model
{
//
}
...@@ -36,7 +36,7 @@ class SystemConfig extends BaseModel ...@@ -36,7 +36,7 @@ class SystemConfig extends BaseModel
$data = $this->field($field) $data = $this->field($field)
->where($where) ->where($where)
->select(); ->select();
$result = [];
if ($data != NULL) { if ($data != NULL) {
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
$result_arr = json_decode($v['rule'], true); $result_arr = json_decode($v['rule'], true);
...@@ -44,8 +44,6 @@ class SystemConfig extends BaseModel ...@@ -44,8 +44,6 @@ class SystemConfig extends BaseModel
$result[$kk] = $vv; $result[$kk] = $vv;
} }
} }
} else {
$result = [];
} }
return $result; return $result;
......
...@@ -24,6 +24,7 @@ Route::group('app', [ ...@@ -24,6 +24,7 @@ Route::group('app', [
'download' => [ 'app/index/download', [ 'method' => 'get' ] ], 'download' => [ 'app/index/download', [ 'method' => 'get' ] ],
'getShopDetails' => [ 'app/index/getShopDetail', [ 'method' => 'get | post' ] ], 'getShopDetails' => [ 'app/index/getShopDetail', [ 'method' => 'get | post' ] ],
'getVersionNo' => [ 'app/index/getVersionNo', [ 'method' => 'get | post' ] ], 'getVersionNo' => [ 'app/index/getVersionNo', [ 'method' => 'get | post' ] ],
'feed' => [ 'app/index/feed', [ 'method' => 'get' ] ]
]); ]);
Route::group('app_broker',[ Route::group('app_broker',[
...@@ -423,6 +424,13 @@ Route::group('broker', [ ...@@ -423,6 +424,13 @@ Route::group('broker', [
'getSupervise' => ['api_broker/Supervise/getSupervise', [ 'method' => 'get' ] ], //监督执行列表 'getSupervise' => ['api_broker/Supervise/getSupervise', [ 'method' => 'get' ] ], //监督执行列表
'sendSms' => ['api_broker/broker/sendSms', [ 'method' => 'get' ] ], //发送短信 'sendSms' => ['api_broker/broker/sendSms', [ 'method' => 'get' ] ], //发送短信
'qrCode' => ['api_broker/broker/qrCode', [ 'method' => 'get|post' ] ], //生成二维码 'qrCode' => ['api_broker/broker/qrCode', [ 'method' => 'get|post' ] ], //生成二维码
'feedList' => ['api_broker/Feed/feedList', [ 'method' => 'get' ] ], //首页feed喜报
'editFeedClick' => ['api_broker/Feed/editFeedClick', [ 'method' => 'post' ] ], //feed流喜报点赞和页面浏览数量
'getFeedInfo' => ['api_broker/Feed/getFeedInfo', [ 'method' => 'get' ] ], //feed流喜报详情
'editDecFeedClick' => ['api_broker/Feed/editDecFeedClick', [ 'method' => 'post' ] ], //feed流喜报详情
'getAgentsResidueNumList' => ['api_broker/LookShop/getAgentsResidueNumList', [ 'method' => 'get' ] ], //剩余铺数列表
'setAgentLookNum' => ['api_broker/LookShop/setAgentLookNum', [ 'method' => 'post' ] ], //设置经纪人的看铺数量
......
<?php
namespace app\task\controller;
use app\extra\RedisExt;
use RedisException;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/5/9
* Time : 下午4:45
* Intro:
*/
class SaveLookShopHistoryTask
{
private $redis;
private $date_;
const LOOK_SHOP = "look_shop_";//存入已看的楼盘id
const LOOK_TOTAL = "look_total_";//记录每个经纪人的看铺总数
function __construct()
{
try {
$this->redis = RedisExt::getRedis();
} catch (RedisException $exception) {
$this->redis = false;
}
$this->date_ = date("Y-m-d", strtotime("-1 day"));
}
public function saveLookShop(){
//todo 1.拿到每个经纪人的看铺记录 2.根据看铺记录统计出已看铺数量,3.根据经纪人id 拿到可看铺总数
//$this->redis->sAdd(self::LOOK_SHOP . $this->nowTime . $agent_id, $house_id);//存入楼盘信息
}
}
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
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