Commit 505bf9a2 authored by zhuwei's avatar zhuwei

1

parent e10fd5a9
......@@ -12,6 +12,7 @@ use app\index\extend\Basic;
use app\model\GHouses;
use app\model\OBargainModel;
use app\model\OMarchInModel;
use app\model\OPartialCommission;
use app\model\Users;
class ClinchMap extends Basic
......@@ -20,6 +21,8 @@ class ClinchMap extends Basic
private $gHousesModel;
private $userModel;
private $marchInModel;
private $bargainModel;
private $partialCommission;
public function __construct($request = null)
......@@ -28,6 +31,9 @@ class ClinchMap extends Basic
$this->gHousesModel = new GHouses();
$this->userModel = new Users();
$this->marchInModel = new OMarchInModel();
$this->bargainModel = new OBargainModel();
$this->partialCommission = new OPartialCommission();
}
......@@ -37,13 +43,8 @@ class ClinchMap extends Basic
*/
public function clinchMapInfo()
{
$m_bargain = new OBargainModel();
$where_ = [];
$performanceSum = $m_bargain->getAddBargainNumClinchMap($where_);
$shop_bargain_num = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
//成交数
$result['bargain_num'] = $shop_bargain_num;
$result['bargain_num'] = $this->getCityBargainInfo();
//城市 当月成交 总成交
$result['city_bargain_info'] = $this->getCityBargainInfo();
......@@ -56,21 +57,33 @@ class ClinchMap extends Basic
$result["house_num"] = $house_num['house_num'];//商铺总量
$result["have_not_rent_num"] = $house_num['have_not_rent_num'];//待租商铺数量
$result["performance_info"] = $this->getPerformanceInfo();
return $this->response(200, 'success', $result);
}
/**
* 成交数
* @return int
*/
public function getShopBargainNum()
{
$m_bargain = new OBargainModel();
$conditions = [];
$performanceSum = $m_bargain->getAddBargainNumClinchMap($conditions);
$shop_bargain_num = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
return $shop_bargain_num;
}
/**
* 客户总数
* @return int
*/
public function getUserNum()
{
$where = [];
$where['status'] = 0;
$addUserNum = $this->userModel->getAddUserNumForOperation($where);
$conditions = [];
$conditions['status'] = 0;
$addUserNum = $this->userModel->getAddUserNumForOperation($conditions);
$user_num = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
return $user_num;
}
......@@ -81,13 +94,13 @@ class ClinchMap extends Basic
*/
public function houseNum()
{
$where['status'] = array( 'neq', 3 );//排除删除的商铺
$conditions['status'] = array( 'neq', 3 );//排除删除的商铺
// 商铺总量
$house_res = $this->gHousesModel->getHouseListTotal($where);
$house_res = $this->gHousesModel->getHouseListTotal($conditions);
$result["house_num"] = $house_res;
// 待租商铺数量
$where['status'] = 1;
$house_res = $this->gHousesModel->getHouseListTotal($where);
$conditions['status'] = 1;
$house_res = $this->gHousesModel->getHouseListTotal($conditions);
$result["have_not_rent_num"] = $house_res;
return $result;
}
......@@ -122,6 +135,39 @@ class ClinchMap extends Basic
return $city_arr;
}
/**
* 业绩
* @return array
*/
public function getPerformanceInfo()
{
$time_arr = [date('Y-m', strtotime('-1 month'))=>['type'=>'1'],
date('Y-m', strtotime('-2 month'))=>['type'=>'2'],
date('Y-m', strtotime('-3 month'))=>['type'=>'3'],
date('Y-m', strtotime('-4 month'))=>['type'=>'4'],
date('Y-m', strtotime('-5 month'))=>['type'=>'5'],
date('Y-m', strtotime('-6 month'))=>['type'=>'6'],
date('Y-m', strtotime('-7 month'))=>['type'=>'7'],
date('Y-m', strtotime('-8 month'))=>['type'=>'8'],
date('Y-m', strtotime('-9 month'))=>['type'=>'9'],
date('Y-m', strtotime('-10 month'))=>['type'=>'10']];
foreach ($time_arr as $key => $v) {
$start_time = date('Y-m-d', strtotime(date('Y-m-01') . "-{$v['type']} month"));// 计算出本月第一天再减一个月
$last_num = $v['type'] - 1;
$last_time = date('Y-m-d', strtotime(date('Y-m-01') . "-{$last_num} month"));//计算出本月
$end_time = date('Y-m-d', strtotime($last_time . ' -1 day'));//本月第一天再减一天
// $conditions['agent_id'] = array( "in", $agent_res['agent_ids'] );
$conditions['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
// 业绩
$performanceSum = $this->bargainModel->getAddBargainNumV3($conditions, 1);//1表示业绩 2表示实收
$time_arr[$key]["performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// 实收
$real_performanceSum = $this->partialCommission->getReceived($conditions);
$time_arr[$key]["real_performance"] = isset($real_performanceSum[0]["num"]) ? $real_performanceSum[0]["num"] : 0;
}
return $time_arr;
}
}
\ No newline at end of file
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