Commit 6e2c5fcd authored by zhuwei's avatar zhuwei

1

parent 891d3674
......@@ -509,6 +509,7 @@ class Broker extends Basic
*/
public function brokerDetail()
{
header('Access-Control-Allow-Origin:*');
$data['status'] = 200;
$data['data'] = [];
......
<?php
namespace app\index\controller;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2019/9/17
* Time: 15:40:20
*/
use app\index\extend\Basic;
use app\model\GHouses;
use app\model\OBargainModel;
use app\model\OMarchInModel;
use app\model\Users;
class ClinchMap extends Basic
{
private $gHousesModel;
private $userModel;
private $marchInModel;
public function __construct($request = null)
{
parent::__construct($request);
$this->gHousesModel = new GHouses();
$this->userModel = new Users();
$this->marchInModel = new OMarchInModel();
}
/**
* 成交地图信息
* @return \think\Response
*/
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['city_bargain_info'] = $this->getCityBargainInfo();
//客户总数
$result["create_user_num"] = $this->getUserNum();
//商铺总量 待租商铺数量
$house_num = $this->houseNum();
$result["house_num"] = $house_num['house_num'];//商铺总量
$result["have_not_rent_num"] = $house_num['have_not_rent_num'];//待租商铺数量
return $this->response(200, 'success', $result);
}
/**
* 客户总数
* @return int
*/
public function getUserNum()
{
$where = [];
$where['status'] = 0;
$addUserNum = $this->userModel->getAddUserNumForOperation($where);
$user_num = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
return $user_num;
}
/**
* 商铺总量 待租商铺数量
* @return mixed
*/
public function houseNum()
{
$where['status'] = array( 'neq', 3 );//排除删除的商铺
// 商铺总量
$house_res = $this->gHousesModel->getHouseListTotal($where);
$result["house_num"] = $house_res;
// 待租商铺数量
$where['status'] = 1;
$house_res = $this->gHousesModel->getHouseListTotal($where);
$result["have_not_rent_num"] = $house_res;
return $result;
}
/**
* 城市 当月成交 总成交
* @return array
*/
public function getCityBargainInfo()
{
$m_bargain = new OBargainModel();
$start_time = date("Y-m-01", time());
$end_time = date("Y-m-d", time());
$city_arr = ['上海市'=>['site_id'=>'10001'],
'杭州市'=>['site_id'=>'10002'],
'深圳市'=>['site_id'=>'10003'],
'广州市'=>['site_id'=>'10004'],
'北京市'=>['site_id'=>'10005']];
foreach ($city_arr as $key => $v) {
$conditions['a.create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$conditions['c.city'] = $key;
$performanceSum = $m_bargain->getAddBargainNumClinchMap($conditions);
$month_bargain_num = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
$city_arr[$key]['month_bargain_num'] = $month_bargain_num;
$conditions = [];
$conditions['c.city'] = $key;
$performanceSum = $m_bargain->getAddBargainNumClinchMap($conditions);
$all_bargain_num = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
$city_arr[$key]['all_bargain_num'] = $all_bargain_num;
}
return $city_arr;
}
}
\ No newline at end of file
......@@ -1246,6 +1246,8 @@ class AAgents extends BaseModel
$result['evaluate_grade_attitude'] = $evaluate_grade_attitude;//评分等级 态度分
$result['evaluate_grade_clothing'] = $evaluate_grade_clothing;//评分等级 着装分
$result['average_evaluate'] = round(($grade + $evaluate_grade_attitude + $evaluate_grade_clothing) / 3,1);//平均分
$result['evaluate_num'] = $evaluate_grade['evaluate_num']; //评论数量
$result['watch_shop'] = Db::table('u_appoint_watch_shop')
->where('agents_id', $id)->count(); //看铺
......
......@@ -1630,7 +1630,6 @@ class OBargainModel extends Model
//$where_["trade_type"] = 10;//产品要求统计数量必须是出租类型的180620
$params["a.role"] = 3;//必须是反签方
$params['c.shop_type'] = $type == 0 ? 0 : 1;
// dump($params);
$return = Db::table($this->table)
->field($field)
->alias("a")
......@@ -1638,11 +1637,24 @@ class OBargainModel extends Model
->join("g_houses c", "b.house_id = c.id", "left")
->where($params)
->select();
/*echo $this->getLastSql();
echo '--------------';*/
// echo $this->getLastSql();
return $return;
}
public function getAddBargainNumClinchMap($params)
{
$field = "count(1) as num";
$params["a.role"] = 3;//必须是反签方
$return = Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b", "a.order_id = b.id", "left")
->join("g_houses c", "b.house_id = c.id", "left")
->where($params)
->select();
// echo $this->getLastSql();
return $return;
}
/**
* @param $field
* @param $where
......
......@@ -599,6 +599,8 @@ Route::group('index', [
'getShopLookList' => ['index/LookShop/getShopLookList', ['method' => 'POST|GET']],//客户看了哪些铺记录
'clinchMapInfo' => [ 'index/ClinchMap/clinchMapInfo', [ 'method' => 'get | post' ] ],
]);
......
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