Commit 138c5b5b authored by zw's avatar zw

店铺动态

parent 2ba8e661
...@@ -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\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\GHousesImgs; use app\model\GHousesImgs;
use app\model\Regions; use app\model\Regions;
...@@ -416,4 +417,33 @@ class Shop extends Basic ...@@ -416,4 +417,33 @@ class Shop extends Basic
$data = $regions->getRegions($this->params['code'], $this->params['parent_code']); $data = $regions->getRegions($this->params['code'], $this->params['parent_code']);
return $this->response(200, '', $data); return $this->response(200, '', $data);
} }
/**
* 新增店铺跟进
* @return \think\Response
*/
public function addShopFollowUp(){
$params = $this->params;
/* $params = array(
"house_id" => 1,
"follow_up_info"=>"123123131",
"agent_id"=>1,
"agent_name"=>"2324",
"agent_phone"=>"13766166616",
);*/
if(!isset($params["house_id"]) || !isset($params["follow_up_info"])|| !isset($params["agent_id"])
|| !isset($params["agent_name"])|| !isset($params["agent_phone"])){
return $this->response("101", "请求参数错误");
}
$follow_up_model = new GHousesFollowUp();
$id = $follow_up_model->addHousesFollowUp($params);
if($id > 0 ){
return $this->response("200","request success",["id"=>$id]);
}else{
return $this->response("200","request error");
}
}
} }
...@@ -5,6 +5,7 @@ namespace app\api_broker\service; ...@@ -5,6 +5,7 @@ namespace app\api_broker\service;
use app\api\untils\GeTuiUntils; use app\api\untils\GeTuiUntils;
use app\model\AAgents; use app\model\AAgents;
use app\model\FollowUpLogModel; use app\model\FollowUpLogModel;
use app\model\GHousesFollowUp;
use app\model\GHousesToAgents; use app\model\GHousesToAgents;
use app\model\OBargainModel; use app\model\OBargainModel;
use app\model\OMarchInModel; use app\model\OMarchInModel;
...@@ -451,12 +452,14 @@ class OrderLogService ...@@ -451,12 +452,14 @@ class OrderLogService
$sort = 0; $sort = 0;
//todo 1.验证订单是否存在 //todo 1.验证订单是否存在
$oReportModel = new OReportModel(); $oReportModel = new OReportModel();
$oMarchInModel = new OMarchInModel(); $oMarchInModel = new OMarchInModel();
$followUpLogModel = new FollowUpLogModel(); $followUpLogModel = new FollowUpLogModel();
$oPayLogModel = new OPayLogModel(); $oPayLogModel = new OPayLogModel();
$oRefundModel = new ORefundModel(); $oRefundModel = new ORefundModel();
$oBargainModel = new OBargainModel(); $oBargainModel = new OBargainModel();
$gHousesFollowModel = new GHousesFollowUp();
$field_report = "a.id,a.create_time,a.user_name,a.user_phone,b.id as order_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name"; $field_report = "a.id,a.create_time,a.user_name,a.user_phone,b.id as order_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name";
...@@ -465,7 +468,7 @@ class OrderLogService ...@@ -465,7 +468,7 @@ class OrderLogService
return []; return [];
} }
$order_ids = $report_ids = ""; $order_ids = $report_ids = "";
$user_info_arr = []; $user_info_arr = [];
//报备 //报备
foreach ($reportData as $k => $v) { foreach ($reportData as $k => $v) {
...@@ -474,17 +477,15 @@ class OrderLogService ...@@ -474,17 +477,15 @@ class OrderLogService
$v["step_name"] = "report"; $v["step_name"] = "report";
$v["step"] = "报备【" . $v['user_name'] . "-" . $v["user_phone"] . "】"; $v["step"] = "报备【" . $v['user_name'] . "-" . $v["user_phone"] . "】";
$result[$sort++] = $v; $result[$sort++] = $v;
$order_ids .= $v["order_id"] . ","; $order_ids .= $v["order_id"] . ",";
$report_ids .= $v["id"] . ","; $report_ids .= $v["id"] . ",";
//todo 组装成order_id为key的数组 //todo 组装成order_id为key的数组
$user_info_arr[$v["order_id"]] = $v; $user_info_arr[$v["order_id"]] = $v;
} }
$order_ids = rtrim($order_ids, ","); $order_ids = rtrim($order_ids, ",");
$report_ids = rtrim($report_ids, ","); $report_ids = rtrim($report_ids, ",");
$orderParams["order_id"] = array( "in", $order_ids ); $orderParams["order_id"] = array( "in", $order_ids );
...@@ -496,7 +497,7 @@ class OrderLogService ...@@ -496,7 +497,7 @@ class OrderLogService
if (count($marchInData) > 0) { if (count($marchInData) > 0) {
foreach ($marchInData as $k => $v) { foreach ($marchInData as $k => $v) {
$v["step_name"] = "march_in"; $v["step_name"] = "march_in";
$v["step"] = "进场【" . $user_info_arr[$v['order_id']]['user_name'] . "-" . $user_info_arr[$v['order_id']]["user_phone"] . "】"; $v["step"] = "进场【" . $user_info_arr[$v['order_id']]['user_name'] . "-" . $user_info_arr[$v['order_id']]["user_phone"] . "】";
$result[$sort++] = $v; $result[$sort++] = $v;
} }
} }
...@@ -508,13 +509,13 @@ class OrderLogService ...@@ -508,13 +509,13 @@ class OrderLogService
if (count($followUpLogData) > 0) { if (count($followUpLogData) > 0) {
foreach ($followUpLogData as $k => $v) { foreach ($followUpLogData as $k => $v) {
$v["step_name"] = "follow_up_log"; $v["step_name"] = "follow_up_log";
$v["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $v["user_phone"]); $v["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $v["user_phone"]);
$v["step"] = "跟进【" . $v['user_name'] . "-" . $v['user_phone'] . "】"; $v["step"] = "报备跟进【" . $v['user_name'] . "-" . $v['user_phone'] . "】";
$v = $this->convertFollowUp($v); $v = $this->convertFollowUp($v);
$v["img_path"] = CHAT_IMG_URL; $v["img_path"] = CHAT_IMG_URL;
$result[$sort++] = $v; $result[$sort++] = $v;
} }
} }
...@@ -524,7 +525,7 @@ class OrderLogService ...@@ -524,7 +525,7 @@ class OrderLogService
if (count($payLogData) > 0) { if (count($payLogData) > 0) {
foreach ($payLogData as $k => $v) { foreach ($payLogData as $k => $v) {
$v["step_name"] = "pay_log"; $v["step_name"] = "pay_log";
$v["step"] = "收款【" . $user_info_arr[$v['order_id']]['user_name'] . "-" . $user_info_arr[$v['order_id']]["user_phone"] . "】"; $v["step"] = "收款【" . $user_info_arr[$v['order_id']]['user_name'] . "-" . $user_info_arr[$v['order_id']]["user_phone"] . "】";
$result[$sort++] = $v; $result[$sort++] = $v;
} }
} }
...@@ -537,7 +538,7 @@ class OrderLogService ...@@ -537,7 +538,7 @@ class OrderLogService
if (count($refundData) > 0) { if (count($refundData) > 0) {
foreach ($refundData as $k => $v) { foreach ($refundData as $k => $v) {
$v["step_name"] = "refund"; $v["step_name"] = "refund";
$v["step"] = "退款【" . $user_info_arr[$v['order_id']]['user_name'] . "-" . $user_info_arr[$v['order_id']]["user_phone"] ."】"; $v["step"] = "退款【" . $user_info_arr[$v['order_id']]['user_name'] . "-" . $user_info_arr[$v['order_id']]["user_phone"] . "】";
$result[$sort++] = $v; $result[$sort++] = $v;
} }
} }
...@@ -548,7 +549,18 @@ class OrderLogService ...@@ -548,7 +549,18 @@ class OrderLogService
if (count($bargainData) > 0) { if (count($bargainData) > 0) {
foreach ($bargainData as $k => $v) { foreach ($bargainData as $k => $v) {
$v["step_name"] = "bargain"; $v["step_name"] = "bargain";
$v["step"] = "成交报告【" . $user_info_arr[$v['order_id']]['user_name'] . "-" . $user_info_arr[$v['order_id']]["user_phone"] . "】"; $v["step"] = "成交报告【" . $user_info_arr[$v['order_id']]['user_name'] . "-" . $user_info_arr[$v['order_id']]["user_phone"] . "】";
$result[$sort++] = $v;
}
}
//楼盘跟进
$field_shop_follow_up = "a.id,a.follow_up_info,a.agent_id,a.create_time,b.name as agent_name,b.img,c.store_name";
$houseFollowUpData = $gHousesFollowModel->getShopFollowUpList($field_shop_follow_up, [ "house_id" => $house_id ]);
if (count($houseFollowUpData) > 0) {
foreach ($houseFollowUpData as $k => $v) {
$v["step_name"] = "shop_follow_up";
$v["step"] = "跟进:" . $v["follow_up_info"];
$result[$sort++] = $v; $result[$sort++] = $v;
} }
} }
......
<?php
namespace app\model;
use think\Db;
use think\Model;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/4/23
* Time : 下午4:31
* Intro:
*/
class GHousesFollowUp extends Model
{
protected $table = "g_houses_follow_up";
protected $db_;
function __construct()
{
$this->db_ = Db::table($this->table);
}
/**
* @param $params
* @return int|string
*/
public function addHousesFollowUp($params)
{
$where_ = [];
if (isset($params["house_id"])) {
$where_["house_id"] = $params["house_id"];
}
if (isset($params["follow_up_info"])) {
$where_["follow_up_info"] = $params["follow_up_info"];
}
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
if (isset($params["agent_name"])) {
$where_["agent_name"] = $params["agent_name"];
}
if (isset($params["agent_phone"])) {
$where_["agent_phone"] = $params["agent_phone"];
}
$where_["create_time"] = date("Y-m-d H:i:s", time());
$where_["update_time"] = date("Y-m-d H:i:s", time());
Db::startTrans();
try {
$id = $this->db_->insertGetId($where_);
Db::commit();
return $id;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getShopFollowUpList($field, $params)
{
$where_ = [];
$where_["a.house_id"] = $params["house_id"];
return $this->db_
->field($field)
->alias("a")
->join("a_agents b", "a.agent_id = b.id", "left")
->join("a_store c", "b.store_id = c.id", "left")
->where($where_)
->select();
}
}
\ No newline at end of file
...@@ -356,6 +356,7 @@ Route::group('broker', [ ...@@ -356,6 +356,7 @@ Route::group('broker', [
//商铺 //商铺
'getShopList' => ['api_broker/Shop/getShopList', [ 'method' => 'get|post' ] ], 'getShopList' => ['api_broker/Shop/getShopList', [ 'method' => 'get|post' ] ],
'getShopDetail' => ['api_broker/Shop/getShopDetail', [ 'method' => 'get' ] ], 'getShopDetail' => ['api_broker/Shop/getShopDetail', [ 'method' => 'get' ] ],
'addShopFollowUp' => ['api_broker/Shop/addShopFollowUp', [ 'method' => 'post' ] ], //新增商铺跟进记录
'reportList' => ['api_broker/Report/reportList', [ 'method' => 'get' ] ], 'reportList' => ['api_broker/Report/reportList', [ 'method' => 'get' ] ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment