Commit 453a1def authored by hujun's avatar hujun

商铺跟进

parent 55ea5245
...@@ -13,6 +13,7 @@ use app\model\FollowUpLogModel; ...@@ -13,6 +13,7 @@ use app\model\FollowUpLogModel;
use app\model\GHousesFollowUp; use app\model\GHousesFollowUp;
use app\model\GHousesToAgents; use app\model\GHousesToAgents;
use app\model\OBargainModel; use app\model\OBargainModel;
use app\model\OfficeGHousesFollowUp;
use app\model\OfficeOBargainModel; use app\model\OfficeOBargainModel;
use app\model\OfficeOImg; use app\model\OfficeOImg;
use app\model\OfficeOMarchInModel; use app\model\OfficeOMarchInModel;
...@@ -1075,7 +1076,7 @@ class OfficeOrderLogService ...@@ -1075,7 +1076,7 @@ class OfficeOrderLogService
$result = []; $result = [];
$sort = 0; $sort = 0;
$gHousesFollowModel = new GHousesFollowUp(); $gHousesFollowModel = new OfficeGHousesFollowUp();
//楼盘跟进 //楼盘跟进
$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"; $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";
......
<?php
namespace app\model;
use think\Db;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/4/23
* Time : 下午4:31
* Intro:
*/
class OfficeGHousesFollowUp extends BaseModel
{
protected $table = "office_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"];
}
if (isset($params['landlord_phone'])) {
$where_['landlord_phone'] = $params['landlord_phone'];
}
if (isset($params['landlord_name'])) {
$where_['landlord_name'] = $params['landlord_name'];
}
if (isset($params["province"])) {
$where_["province"] = $params["province"];
}
if (isset($params["city"])) {
$where_["city"] = $params["city"];
}
if (isset($params["disc"])) {
$where_["disc"] = $params["disc"];
}
Db::startTrans();
try {
if (empty($params['id'])) {
$where_["create_time"] = date("Y-m-d H:i:s", time());
$id = $this->db_->table($this->table)->insertGetId($where_);
} else {
$where_["update_time"] = date("Y-m-d H:i:s", time());
$this->db_->table($this->table)->where('id',$params['id'])->update($where_);
$id = $params['id'];
}
Db::commit();
return $id;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
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();
}
/**
* @param int $p
* @param int $pageSize
* @param string $order_
* @param $field
* @param $join
* @param $where
* @param $group
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getSearch($p = 1, $pageSize = 15, $order_ = 'id desc', $field, $where, $group)
{
$data = $this->db_
->field($field)
->alias('f')
->join('a_agents a', 'f.agent_id = a.id', 'left')
->where($where)
->group($group)
->order($order_)
->limit($pageSize)
->page($p)
->select();
//echo $this->getLastSql();
return $data;
}
/**
* 首页商铺跟进搜索
* @param $join
* @param $where
* @return int
*/
public function getSearchCount( $where)
{
$data = $this
->alias('f')
->join('a_agents a', 'f.agent_id = a.id', 'left')
->where($where)
->count("f.id");
return $data;
}
/**
* @param array $params
* @return bool
*/
public function getFollowUpByHouseId(array $params): bool
{
$where_ = [];
if (isset($params["create_time"])) {
$where_["create_time"] = $params["create_time"];
}
if (isset($params["house_id"])) {
$where_["house_id"] = $params["house_id"];
}
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
try {
$follow_list = $this
->field("id")
->where($where_)
->select();
} catch (\Exception $e) {
$follow_list = [];
}
if (count($follow_list) > 0) {
return true;
}
return false;
}
/**
* 插入默认跟进
*
* @param $agent_id
* @param $house_id
* @param $content
* @param $landlord_phone
* @param $agent_phone
* @return int|string
*/
public function insertDefaultFollow($agent_id, $house_id, $content, $landlord_phone, $agent_phone) {
$data['agent_id'] = $agent_id;
$data['house_id'] = $house_id;
$data['follow_up_info'] = $content;
if ($house_id > 0) {
try {
$house_data = $this->db_->table('u_users')->field('province,city,disc')->find($house_id);
$data['province'] = $house_data['province'];
$data['city'] = $house_data['city'];
$data['disc'] = $house_data['disc'];
$house_data = $this->db_->table('a_agents')->field('name')->find($agent_id);
$data['agent_name'] = $house_data['name'];
} catch (\Exception $e) {
$data['province'] = "";
$data['city'] = "";
$data['disc'] = "";
$data['agent_name'] = "";
$data['agent_phone'] = "";
}
}
$data['landlord_phone'] = $landlord_phone;
$data['agent_phone'] = $agent_phone;
return $this->addHousesFollowUp($data);
}
public function getLastFollowTime($house_id)
{
$arr = [];
if (isset($house_id)) {
$arr["house_id"] = $house_id;
}
$field = 'create_time';
$order = 'id desc';
$limit = 1;
$return = Db::name($this->table)
->field($field)
->where($arr)
->limit($limit)
->order($order)
->select();
//echo $this->getLastSql();
return $return;
}
/**
* @param $field
* @param $where
* @return mixed
*/
public function getAgentHouseFollowValue($field, $where) {
return $this->where($where)
->value($field);
}
}
\ No newline at end of file
...@@ -533,7 +533,6 @@ Route::group('api', [ ...@@ -533,7 +533,6 @@ Route::group('api', [
'getShopList' => ['api/shop/getShopList', ['method' => 'get|post']], 'getShopList' => ['api/shop/getShopList', ['method' => 'get|post']],
'filtrateCondition' => ['api/shop/filtrateCondition', ['method' => 'get | post']], 'filtrateCondition' => ['api/shop/filtrateCondition', ['method' => 'get | post']],
'filtrateConditionV2' => ['api/shop/filtrateConditionV2', ['method' => 'get | post']], 'filtrateConditionV2' => ['api/shop/filtrateConditionV2', ['method' => 'get | post']],
'filtrateConditionRoom' => ['api/shop/filtrateConditionRoom', ['method' => 'get | post']],
'getShopDetail' => ['api/shop/getShopDetail', ['method' => 'get|post']], 'getShopDetail' => ['api/shop/getShopDetail', ['method' => 'get|post']],
'getMarchInList' => ['api/shop/getMarchInList', ['method' => 'get|post']], 'getMarchInList' => ['api/shop/getMarchInList', ['method' => 'get|post']],
...@@ -958,7 +957,7 @@ Route::group('office', [ ...@@ -958,7 +957,7 @@ Route::group('office', [
'searchAgents' => ['api_broker/OfficeOrderLog/searchAgents', ['method' => 'get']], 'searchAgents' => ['api_broker/OfficeOrderLog/searchAgents', ['method' => 'get']],
'searchBargainList' => ['api_broker/OfficeOrderLog/searchBargainList', ['method' => 'get|post']], 'searchBargainList' => ['api_broker/OfficeOrderLog/searchBargainList', ['method' => 'get|post']],
'searchBargainListByOrderId' => ['api_broker/OfficeOrderLog/searchBargainListByOrderId', ['method' => 'get']], 'searchBargainListByOrderId' => ['api_broker/OfficeOrderLog/searchBargainListByOrderId', ['method' => 'get']],
'getListByHouseId' => ['api_broker/OfficeOrderLog/getListByHouseId', ['method' => 'get']], 'getListByHouseId' => ['api_broker/OfficeOrderLog/getListByHouseId', ['method' => 'get']], //商铺跟进
'searchBargainAgents' => ['api_broker/OfficeOrderLog/searchBargainAgents', ['method' => 'get']], 'searchBargainAgents' => ['api_broker/OfficeOrderLog/searchBargainAgents', ['method' => 'get']],
'isBargainEnd' => ['api_broker/OfficeOrderLog/isBargainEnd', ['method' => 'get']], 'isBargainEnd' => ['api_broker/OfficeOrderLog/isBargainEnd', ['method' => 'get']],
'getCommission' => ['api_broker/OfficeOrderLog/getCommission', ['method' => 'GET|POST']], 'getCommission' => ['api_broker/OfficeOrderLog/getCommission', ['method' => 'GET|POST']],
...@@ -971,9 +970,9 @@ Route::group('office', [ ...@@ -971,9 +970,9 @@ Route::group('office', [
'getBuildingSearch' => ['api_broker/OfficeRoom/getBuildingSearch', ['method' => 'GET']],//搜索楼盘 'getBuildingSearch' => ['api_broker/OfficeRoom/getBuildingSearch', ['method' => 'GET']],//搜索楼盘
'getBuildingDetail' => ['api_broker/OfficeRoom/getBuildingDetail', ['method' => 'GET']],//楼盘详情 'getBuildingDetail' => ['api_broker/OfficeRoom/getBuildingDetail', ['method' => 'GET']],//楼盘详情
'getOfficeBuildingAddress' => ['api_broker/shop/getOfficeBuildingAddress', ['method' => 'GET']],//确认无重盘楼盘字典 'getOfficeBuildingAddress' => ['api_broker/shop/getOfficeBuildingAddress', ['method' => 'GET']],//确认无重盘楼盘字典
'getOfficeBuildingInfo' => [ 'api_broker/OfficeBuilding/getOfficeBuildingInfo', [ 'method' => 'GET|POST' ] ],//办公楼详情
'getOfficeBuildingInfo' => [ 'api_broker/OfficeBuilding/getOfficeBuildingInfo', [ 'method' => 'GET|POST' ] ],//办公楼详情 'getOfficeRoomInfo' => [ 'api_broker/OfficeRoom/getOfficeRoomInfo', [ 'method' => 'GET|POST' ] ],//获取房源详情
'getOfficeRoomInfo' => [ 'api_broker/OfficeRoom/getOfficeRoomInfo', [ 'method' => 'GET|POST' ] ],//获取房源详情 'filtrateConditionRoom' => ['api/shop/filtrateConditionRoom', ['method' => 'get | post']],
]); ]);
Route::group('office_index', [ Route::group('office_index', [
......
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