Commit ac6d0a26 authored by zw's avatar zw

统计

parent b73048ac
......@@ -29,8 +29,12 @@ class Shop extends Basic
$this->attentionModel = new AttentionModel();
}
/**查询商品列表 b c端公用
/**
* 查询商品列表 b c端公用
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getShopList()
{
......@@ -46,6 +50,7 @@ class Shop extends Basic
"rent_price_start" => 1000,//租金 rent_price
"rent_price_end" => 10000,//租金
"shop_sign" => "临近地铁,临近地铁2",
"agent_id" => 1, //添加经纪人id
"pageNo" => 1,
"pageSize" => 15
);*/
......@@ -100,6 +105,10 @@ class Shop extends Basic
$conditions['shop_type'] = array( "eq", $params['shop_type'] );
}
if(isset($params['agent_id'])){
$conditions['upload_id'] = array( "eq", $params['agent_id'] );
}
$area_start = isset($params['shop_area_start']) ? $params['shop_area_start'] : -1;
$area_end = isset($params['shop_area_end']) ? $params['shop_area_end'] : -1;
if ($area_start >= 0 && $area_end >= 0) { //面积
......@@ -157,9 +166,13 @@ class Shop extends Basic
return $this->response("200", 'request success', $result);
}
/**
* 楼盘详情
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getShopDetail()
{
......
......@@ -470,5 +470,27 @@ class GHouses extends BaseModel
}
/**
* 获取添加的楼盘的每天数量
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getAddHouseNumGroupTime($params){
$field = "count(1) as num,DATE(create_time) as day";
$where_ = [];
if(isset($params["agent_id"])){
$where_["upload_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
$where_["create_time"] = $params["create_time"];
}
return Db::table($this->table)
->field($field)
->where($where_)
->group("day")
->select();
}
/******zw end ************/
}
......@@ -282,4 +282,19 @@ class OBargainModel extends Model
->where($params)
->find();
}
public function getAddBargainNumGroupTime($params){
$field = "count(1) as num,DATE(create_time) as day";
$where_ = [];
if(isset($params["agent_id"])){
$where_["reception_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
$where_["create_time"] = $params["create_time"];
}
return Db::table($this->table)
->field($field)
->where($where_)
->group("day")
->select();
}
}
\ No newline at end of file
......@@ -75,4 +75,25 @@ class OMarchInModel extends Model
->select();
}
/**
* 查询经纪人进场数据
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getAddMarchInNumGroupTime($params){
$field = "count(1) as num,DATE(create_time) as day";
$where_ = [];
if(isset($params["agent_id"])){
$where_["reception_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
$where_["create_time"] = $params["create_time"];
}
return Db::table($this->table)
->field($field)
->where($where_)
->group("day")
->select();
}
}
\ No newline at end of file
......@@ -73,4 +73,24 @@ class OPayLogModel extends Model
->where($where_)
->select();
}
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getAddPayLogNumGroupTime($params){
$field = "count(1) as num,DATE(create_time) as day";
$where_ = [];
if(isset($params["agent_id"])){
$where_["agent_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
$where_["create_time"] = $params["create_time"];
}
return Db::table($this->table)
->field($field)
->where($where_)
->group("day")
->select();
}
}
\ No newline at end of file
......@@ -303,4 +303,25 @@ class Users extends Model
->count();
}
/**
* 按添加时间段分组统计
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getAddUserNumGroupTime($params){
$field = "count(1) as num,DATE(create_time) as day";
$where_ = [];
if(isset($params["agent_id"])){
$where_["referrer_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
$where_["create_time"] = $params["create_time"];
}
return Db::table($this->table)
->field($field)
->where($where_)
->group("day")
->select();
}
}
......@@ -2,7 +2,11 @@
namespace app\task\controller;
use app\model\AAgents;
use app\model\GHouses;
use app\model\OBargainModel;
use app\model\OMarchInModel;
use app\model\OPayLogModel;
use app\model\TAgentTotalModel;
use app\model\Users;
/**
* Created by PhpStorm.
......@@ -60,12 +64,42 @@ class ResultsSummaryTask{
}
}
public function test(){
$this->selectTotal(1,"2018-02-02","2018-03-15");
}
private function selectTotal($agent_id,$start_total_time,$end_total_time){
//todo 如果查询出这个时间段都为0 则给此经纪人插入条最后一个日期的为空的数据
//房源
$houseSourceModel = new GHouses();
$houseModel = new GHouses();
$params["agent_id"] = $agent_id;
$houseSourceModel->getAddHouseNumByAgentId();
$params['create_time'] = array( 'between', array( $start_total_time, $end_total_time) );
$addHouseNum = $houseModel->getAddHouseNumGroupTime($params);
//dump($addHouseNum);
//客源
$userModel = new Users();
$addUserNum = $userModel->getAddUserNumGroupTime($params);
//dump($addUserNum);
//业绩
//实收
//约带看
//进场
$marchInModel = new OMarchInModel();
$addMarchInNum = $marchInModel->getAddMarchInNumGroupTime($params);
//dump($addMarchInNum);
//收款
$payLogModel = new OPayLogModel();
$payLogNum = $payLogModel->getAddPayLogNumGroupTime($params);
//dump($payLogNum);
//监督
//成交报告
$bargainModel = new OBargainModel();
$bargainModel->getAddBargainNumGroupTime($params);
}
......
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