Commit 8d8eab12 authored by clone's avatar clone

c端商铺详情带看数据

parent 70570468
...@@ -15,6 +15,7 @@ use app\model\GLabels; ...@@ -15,6 +15,7 @@ use app\model\GLabels;
use app\model\HouseImgs; use app\model\HouseImgs;
use app\model\HouseInfos; use app\model\HouseInfos;
use app\model\Labels; use app\model\Labels;
use app\model\OMarchInModel;
use app\model\Regions; use app\model\Regions;
class Shop extends Basic class Shop extends Basic
...@@ -254,4 +255,55 @@ class Shop extends Basic ...@@ -254,4 +255,55 @@ class Shop extends Basic
} }
return $this->response("200", "request success", $result); return $this->response("200", "request success", $result);
} }
/**
* 商铺列表进场统计
* @return \think\Response
*/
public function getMarchInList()
{
$params = $this->params;
/* $params = array(
"house_id" => 7277,
"is_return_list" => 2,//1只返回统计2,返回列表
"page_no" => 1,
"page_size" => 15
);*/
$checkResult = $this->validate($params, "ShopValidate.getMarchInList");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$marchInModel = new OMarchInModel();
$attentionModel = new AttentionModel();
$week_time = date("Y-m-d", strtotime("-7 day"));
$month_time = date("Y-m-d", strtotime("-30 day"));
$week_params['house_id'] = $params['house_id'];
$week_params['create_time'] = array( 'gt', $week_time );
$month_params['house_id'] = $params['house_id'];
$month_params['create_time'] = array( 'gt', $month_time );
$result_week = $marchInModel->getMarchInNum($week_params);
$result_month = $marchInModel->getMarchInNum($month_params);
$attention = $attentionModel->getAttentionNumByHouseId($week_params);
$result["week"] = $result_week[0]["num"];
$result["month"] = $result_month[0]["num"];
$result["last_march_in"] = empty($result_month[0]["create_time"]) ? "" : $result_month[0]["create_time"];
$result["attention"] = $attention + 50;//todo 产品定义
if ($params["is_return_list"] == 2) {
$field = "a.create_time,c.name,c.img";
$marchInList = $marchInModel->getMarchInList($field, $month_params, $page_no, $page_size);
$result["list"] = $marchInList;
$result["img_path"] = AGENTHEADERIMGURL;
}
return $this->response("200", "success", $result);
}
} }
\ No newline at end of file
...@@ -58,6 +58,7 @@ class Basic extends Controller ...@@ -58,6 +58,7 @@ class Basic extends Controller
"api/convertMarchIn", "api/convertMarchIn",
"api/convertCollectingBill", "api/convertCollectingBill",
"api/getVersionNo", "api/getVersionNo",
"api/getMarchInList",
); );
/** /**
......
<?php
namespace app\api\validate;
use think\Validate;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/7/27
* Time : 10:01
* Intro:
*/
class ShopValidate extends Validate
{
protected $rule = [
'house_id' => 'require|number|gt:0',
'is_return_list' => 'require|in:1,2'
];
protected $message = [
'house_id.require' => '楼盘id为必填字段',
'house_id.number' => '楼盘id只能为数字',
'house_id.gt' => '楼盘id必须大于0',
'is_return_list.require' => "必填参数缺失",
'is_return_list.in' => "请求参数值错误"
];
protected $scene = [
'getMarchInList' => [ 'house_id', 'is_return_list' ],
];
}
\ No newline at end of file
...@@ -783,21 +783,5 @@ class OrderLog extends Basic ...@@ -783,21 +783,5 @@ class OrderLog extends Basic
} }
/**
* @return \think\Response
*/
public function getMarchInList(){
$params = $this->params;
$params = array(
"house_id" => 260
);
$checkResult = $this->validate($params, "OrderLogValidate.getMarchInList");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
}
} }
\ No newline at end of file
<?php
namespace app\api_broker\validate;
use think\Validate;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/7/27
* Time : 10:01
* Intro:
*/
class OrderLogValidate extends Validate
{
protected $rule = [
'house_id' => 'require|number|gt:0',
];
protected $message = [
'house_id.require' => '楼盘id为必填字段',
'house_id.number' => '楼盘id只能为数字',
'house_id.gt' => '楼盘id必须大于0',
];
protected $scene = [
'getMarchInList' => [ 'house_id' ],
];
}
\ No newline at end of file
...@@ -9,11 +9,11 @@ class AttentionModel extends Model ...@@ -9,11 +9,11 @@ class AttentionModel extends Model
{ {
// 设置当前模型对应的完整数据表名称 // 设置当前模型对应的完整数据表名称
protected $table = 'u_attention'; protected $table = 'u_attention';
protected $db; protected $db_;
public function __construct() public function __construct()
{ {
$this->db = Db($this->table); $this->db_ = Db($this->table);
} }
/** /**
...@@ -116,4 +116,21 @@ class AttentionModel extends Model ...@@ -116,4 +116,21 @@ class AttentionModel extends Model
->select(); ->select();
} }
/**根据楼盘id获取关注此楼盘人得数量
* @param $params
* @return mixed
*/
public function getAttentionNumByHouseId($params)
{
$where_ = [];
if (isset($params["house_id"])) {
$where_["house_id"] = $params["house_id"];
$where_["is_del"] = 0;
}
return $this->db_
->field("id")
->where($where_)
->count();
}
} }
...@@ -59,6 +59,7 @@ class OMarchInModel extends Model ...@@ -59,6 +59,7 @@ class OMarchInModel extends Model
return 0; return 0;
} }
} }
/** /**
* @param $filed * @param $filed
* @param $params * @param $params
...@@ -97,13 +98,14 @@ class OMarchInModel extends Model ...@@ -97,13 +98,14 @@ class OMarchInModel extends Model
* @param $params * @param $params
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
*/ */
public function getAddMarchInNumGroupTime($params){ public function getAddMarchInNumGroupTime($params)
$field = "count(DISTINCT report_id) as num,DATE(create_time) as day"; {
$field = "count(DISTINCT report_id) as num,DATE(create_time) as day";
$where_ = []; $where_ = [];
if(isset($params["agent_id"])){ if (isset($params["agent_id"])) {
$where_["reception_id"] = $params["agent_id"]; $where_["reception_id"] = $params["agent_id"];
} }
if(isset($params["create_time"])){ if (isset($params["create_time"])) {
$where_["create_time"] = $params["create_time"]; $where_["create_time"] = $params["create_time"];
} }
return Db::table($this->table) return Db::table($this->table)
...@@ -113,26 +115,85 @@ class OMarchInModel extends Model ...@@ -113,26 +115,85 @@ class OMarchInModel extends Model
->select(); ->select();
} }
public function getAddMarchInNum($params){ /**
$field = "count(DISTINCT report_id) as num"; * 统计房源进场数据 过滤重负
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getAddMarchInNum($params)
{
$field = "count(DISTINCT report_id) as num";
$where_ = []; $where_ = [];
if(isset($params["agent_id"])){ if (isset($params["agent_id"])) {
$where_["a.reception_id"] = $params["agent_id"]; $where_["a.reception_id"] = $params["agent_id"];
} }
if(isset($params["create_time"])){ if (isset($params["create_time"])) {
$where_["a.create_time"] = $params["create_time"]; $where_["a.create_time"] = $params["create_time"];
} }
if(isset($params["house_ids"])){ if (isset($params["house_ids"])) {
$where_["b.house_id"] = array("in",$params["house_ids"]); $where_["b.house_id"] = array( "in", $params["house_ids"] );
} }
return Db::table($this->table) return Db::table($this->table)
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("o_order b","a.order_id = b.id","left") ->join("o_order b", "a.order_id = b.id", "left")
->where($where_) ->where($where_)
->select(); ->select();
} }
/**
* 统计房源进场数据 不过滤
* @param $params
* @return int|string
*/
public function getMarchInNum($params)
{
$where_ = [];
if (isset($params["create_time"])) {
$where_["a.create_time"] = $params["create_time"];
}
if (isset($params["house_id"])) {
$where_["b.house_id"] = $params["house_id"];
$where_["b.is_del"] = 0;//选择正常状态的参数
}
return Db::table($this->table)
->field("count(1) as num,a.create_time")
->alias("a")
->join("o_order b", "a.order_id = b.id", "left")
->where($where_)
->limit(1)
->select();
}
/**统计房源进场数据列表
* @param $field
* @param $params
* @param $page_no
* @param $page_size
* @return false|\PDOStatement|string|\think\Collection
*/
public function getMarchInList($field, $params, $page_no, $page_size)
{
$where_ = [];
if (isset($params["create_time"])) {
$where_["a.create_time"] = $params["create_time"];
}
if (isset($params["house_id"])) {
$where_["b.house_id"] = $params["house_id"];
$where_["b.is_del"] = 0;//选择正常状态的参数
}
return Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b", "a.order_id = b.id", "left")
->join("a_agents c", "a.reception_id = c.id", "left")
->where($where_)
->order("a.create_time desc")
->limit($page_size)
->page($page_no)
->select();
}
/** /**
* @param $params * @param $params
* @param $field * @param $field
...@@ -143,66 +204,69 @@ class OMarchInModel extends Model ...@@ -143,66 +204,69 @@ class OMarchInModel extends Model
public function getAddMarchInList($params, $field, $page_no, $page_size) public function getAddMarchInList($params, $field, $page_no, $page_size)
{ {
$where_ = []; $where_ = [];
if(isset($params["agent_id"])){ if (isset($params["agent_id"])) {
$where_["a.reception_id"] = $params["agent_id"]; $where_["a.reception_id"] = $params["agent_id"];
} }
if(isset($params["create_time"])){ if (isset($params["create_time"])) {
$where_["a.create_time"] = $params["create_time"]; $where_["a.create_time"] = $params["create_time"];
} }
if(isset($params["house_ids"])){ if (isset($params["house_ids"])) {
$where_["b.house_id"] = array("in",$params["house_ids"]); $where_["b.house_id"] = array( "in", $params["house_ids"] );
} }
return Db::table($this->table) return Db::table($this->table)
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("o_order b","a.order_id = b.id","left") ->join("o_order b", "a.order_id = b.id", "left")
->join("o_report c","b.f_id = c.id","left") ->join("o_report c", "b.f_id = c.id", "left")
->where($where_) ->where($where_)
->limit($page_size) ->limit($page_size)
->page($page_no) ->page($page_no)
->select(); ->select();
} }
public function getAddMarchInOrderList($field,$params){ public function getAddMarchInOrderList($field, $params)
{
$where_ = []; $where_ = [];
if(isset($params["agent_id"])){ if (isset($params["agent_id"])) {
$where_["a.reception_id"] = $params["agent_id"]; $where_["a.reception_id"] = $params["agent_id"];
} }
if(isset($params["create_time"])){ if (isset($params["create_time"])) {
$where_["a.create_time"] = $params["create_time"]; $where_["a.create_time"] = $params["create_time"];
} }
if(isset($params["house_ids"])){ if (isset($params["house_ids"])) {
$where_["b.house_id"] = array("in",$params["house_ids"]); $where_["b.house_id"] = array( "in", $params["house_ids"] );
} }
return Db::table($this->table) return Db::table($this->table)
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("o_order b","a.order_id = b.id","left") ->join("o_order b", "a.order_id = b.id", "left")
->join("o_report c","b.f_id = c.id","left") ->join("o_report c", "b.f_id = c.id", "left")
->join('g_houses d','b.house_id = d.id','left') ->join('g_houses d', 'b.house_id = d.id', 'left')
->where($where_) ->where($where_)
->select(); ->select();
} }
public function getMarchInListByOrderId($field,$params){ public function getMarchInListByOrderId($field, $params)
{
$where_ = []; $where_ = [];
if(isset($params["order_id"])){ if (isset($params["order_id"])) {
$where_["a.order_id"] = $params["order_id"]; $where_["a.order_id"] = $params["order_id"];
} }
if(isset($params["house_title"])){ if (isset($params["house_title"])) {
$where_["b.house_title"] = $params["house_title"]; $where_["b.house_title"] = $params["house_title"];
} }
return Db::table($this->table) return Db::table($this->table)
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("o_order b","a.order_id = b.id","left") ->join("o_order b", "a.order_id = b.id", "left")
->join("a_agents c","a.reception_id = c.id","left") ->join("a_agents c", "a.reception_id = c.id", "left")
->join("a_store d","c.store_id = d.id","left") ->join("a_store d", "c.store_id = d.id", "left")
->where($where_) ->where($where_)
->select(); ->select();
} }
public function findmarchInList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params = '') { public function findmarchInList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params = '')
{
$result = $this $result = $this
->field($field) ->field($field)
...@@ -217,10 +281,12 @@ class OMarchInModel extends Model ...@@ -217,10 +281,12 @@ class OMarchInModel extends Model
->limit($pageSize) ->limit($pageSize)
->page($pageNo) ->page($pageNo)
->select(); ->select();
//dump($this->getLastSql()); //dump($this->getLastSql());
return $result; return $result;
} }
public function findmarchInListCount($field, $params = '') {
public function findmarchInListCount($field, $params = '')
{
$result = $this $result = $this
->field($field) ->field($field)
......
...@@ -90,8 +90,8 @@ Route::group('index', [ ...@@ -90,8 +90,8 @@ Route::group('index', [
'loginVerify' => [ 'index/login/loginVerify', [ 'method' => 'post|get' ] ], 'loginVerify' => [ 'index/login/loginVerify', [ 'method' => 'post|get' ] ],
'logout' => [ 'index/login/logout', [ 'method' => 'get' ] ], //退出 'logout' => [ 'index/login/logout', [ 'method' => 'get' ] ], //退出
//watchshop 预约看铺 //watchshop 预约看铺
'watch_shop/:type' => [ 'index/WatchShop/getList', [ 'method' => 'get' ], ['type' => 1] ], 'watch_shop/:type' => [ 'index/WatchShop/getList', [ 'method' => 'get' ], [ 'type' => 1 ] ],
'our_watch_shop/:type' => [ 'index/WatchShop/getList', [ 'method' => 'get' ], ['type' => 2] ], 'our_watch_shop/:type' => [ 'index/WatchShop/getList', [ 'method' => 'get' ], [ 'type' => 2 ] ],
'add_applies' => [ 'index/WatchShop/addApplies', [ 'method' => 'post' ] ], 'add_applies' => [ 'index/WatchShop/addApplies', [ 'method' => 'post' ] ],
//查询经纪人 //查询经纪人
...@@ -265,8 +265,6 @@ Route::group('index', [ ...@@ -265,8 +265,6 @@ Route::group('index', [
'inspectionRecordList' => [ 'index/InspectionRecord/inspectionRecordList', [ 'method' => 'GET' ] ],//约带看记录liu 'inspectionRecordList' => [ 'index/InspectionRecord/inspectionRecordList', [ 'method' => 'GET' ] ],//约带看记录liu
'realtimePerformance' => [ 'index/RealTimePerformance/realtimePerformanceList', [ 'method' => 'GET' ] ],//实时业绩liu 'realtimePerformance' => [ 'index/RealTimePerformance/realtimePerformanceList', [ 'method' => 'GET' ] ],//实时业绩liu
'shopinspectionLog' => [ 'index/ShopInspectionLog/shopinspectionLogList', [ 'method' => 'GET' ] ],//商铺查看日志liu 'shopinspectionLog' => [ 'index/ShopInspectionLog/shopinspectionLogList', [ 'method' => 'GET' ] ],//商铺查看日志liu
]); ]);
...@@ -306,6 +304,7 @@ Route::group('api', [ ...@@ -306,6 +304,7 @@ Route::group('api', [
'shopList' => [ 'api/shop/getShopList', [ 'method' => 'post' ] ], 'shopList' => [ 'api/shop/getShopList', [ 'method' => 'post' ] ],
'filtrateCondition' => [ 'api/shop/filtrateCondition', [ 'method' => 'get | post' ] ], 'filtrateCondition' => [ 'api/shop/filtrateCondition', [ 'method' => 'get | post' ] ],
'shopDetail' => [ 'api/shop/getShopDetail', [ 'method' => 'get' ] ], 'shopDetail' => [ 'api/shop/getShopDetail', [ 'method' => 'get' ] ],
'getMarchInList' => [ 'api/shop/getMarchInList', [ 'method' => 'get' ] ],
//get banner //get banner
'bannerList' => [ 'api/banner/getBannerList', [ 'method' => 'get' ] ], 'bannerList' => [ 'api/banner/getBannerList', [ '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