Commit 49b83aeb authored by hujun's avatar hujun

业绩明细引入缓存

parent 396f1448
......@@ -9,6 +9,7 @@
namespace app\index\controller;
use app\api_broker\service\RedisCacheService;
use app\api_broker\service\VipService;
use app\index\extend\Basic;
use app\index\untils\ExportExcelUntil;
......@@ -20,13 +21,14 @@ class PerformanceInfo extends Basic
{
protected $oBargainModel;
protected $status;
protected $redis_service;
public function __construct($request = null)
{
parent::__construct($request);
$this->oBargainModel = new OBargainModel();
$this->status = array('in','10,11,13');
$this->redis_service = new RedisCacheService();
}
/**
......@@ -64,11 +66,11 @@ class PerformanceInfo extends Basic
// 部门
if ($this->params['district_id'] != NULL) {
$where['District.id'] = $this->params['district_id'] ;
$where['Agent.district_id'] = $this->params['district_id'] ;
}
// 门店
if ($this->params['store_id'] != NULL) {
$where['Store.id'] = $this->params['store_id'] ;
$where['Agent.store_id'] = $this->params['store_id'] ;
}
// 经纪人ID
......@@ -103,8 +105,8 @@ class PerformanceInfo extends Basic
$field .= 'Obargain.price,';//pricec成交价格
$field .= 'Agent.name,';
$field .= 'Agent.phone,';
$field .= 'Store.store_name,';
$field .= 'District.district_name,';
// $field .= 'Store.store_name,';
// $field .= 'District.district_name,';
$field .= 'Houses.internal_address,';
$field .= 'PartialCommission.practical_fee,';
$field .= 'Oorder.house_id';
......@@ -118,6 +120,10 @@ class PerformanceInfo extends Basic
$return[$key]['practical_fee'] = $val["practical_fee"] ? $val["practical_fee"] : 0 ;
//商铺地址只显示前3位,后面*替代
$return[$key]['landmark'] = $val["internal_address"] ? mb_substr($val["internal_address"],0,3,'utf-8').'****' : '';
$agent_data = $this->redis_service->getRedisCache(2, $val['agent_id']);
$return[$key]['store_name'] = $agent_data['store_name'];
$return[$key]['district_name'] = $agent_data['district_name'];
}
$return_total = $this->oBargainModel->performancelInfoTotal($where,$field);
......@@ -189,11 +195,11 @@ class PerformanceInfo extends Basic
// 部门
if ($this->params['district_id'] != NULL) {
$where['District.id'] = $this->params['district_id'] ;
$where['Agent.district_id'] = $this->params['district_id'] ;
}
// 门店
if ($this->params['store_id'] != NULL) {
$where['Store.id'] = $this->params['store_id'] ;
$where['Agent.store_id'] = $this->params['store_id'] ;
}
// 姓名
if ($this->params['name'] != NULL) {
......@@ -214,13 +220,14 @@ class PerformanceInfo extends Basic
$field .= 'Obargain.id,';
$field .= 'Obargain.father_id,';
$field .= 'Obargain.trade_type,';
$field .= 'Obargain.agent_id,';//分佣方ID
$field .= 'Houses.internal_address,';
$field .= 'Oorder.house_id,';
$field .= 'Obargain.price,';//pricec成交价格
$field .= 'Agent.name,';
$field .= 'Agent.phone,';
$field .= 'Store.store_name,';
$field .= 'District.district_name,';
// $field .= 'Store.store_name,';
// $field .= 'District.district_name,';
$field .= 'Obargain.scale,';
$field .= 'Obargain.scale_fee,';
$field .= 'PartialCommission.practical_fee,';
......@@ -261,20 +268,19 @@ class PerformanceInfo extends Basic
$e_data_old['landmark'] = $landmark;//商铺地址
$e_data_old['house_id'] = $v['house_id'];//商铺编号
//$e_data_old['name_phone'] = $v['name'].'-'.$v['phone'];//分佣提成方
$e_data_old['role_name'] = $role_arr[$v['role']];//分佣提成方
$e_data_old['name_phone'] = $v['name'];//分佣提成方
//$e_data_old['district_name'] = $v['district_name'].'-'.$v['store_name'];//所属部门
$e_data_old['district_name'] = $v['store_name'];//所属部门
$e_data_old['name_phone'] = $v['name'].'-'.$v['phone'];//分佣提成方
$agent_data = $this->redis_service->getRedisCache(2, $v['agent_id']);
$e_data_old['store_name'] = $agent_data['store_name'];//所属门店
$e_data_old['scale'] = $v['scale'];//分佣比例
$e_data_old['scale_fee'] = $v['scale_fee'];//应收佣金
$e_data_old['practical_fee'] = $v['practical_fee'];//实收佣金
$e_data_old['scale_fee'] = $v['scale_fee'] ? $v['scale_fee'] : 0;//应收佣金
$e_data_old['practical_fee'] = $v['practical_fee'] ? $v['practical_fee'] : 0;//实收佣金
$e_data_old['price'] = $v['price'];//成交价
$e_data_new[]=$e_data_old;
}
$title = [ '成交报告ID', '分佣ID','提交时间', '成交类型', '商铺地址', '商铺编号','角色', '分佣提成方', '所属部门门店', '分佣比例', '应分佣金', '实收佣金' ,'成交价'];
$export->exportTable('业绩明细', $e_data_new, count($e_data_new[0]), '业绩明细表', $title);
$export->exportTable('业绩明细', $e_data_new, count($e_data_new[0]) - 1, '业绩明细表', $title);
return '';
}
......
......@@ -1455,8 +1455,8 @@ class OBargainModel extends Model
->join("o_order Oorder", "Obargain.order_id = Oorder.id", "left")
->join("g_houses Houses", "Oorder.house_id = Houses.id", "left")
->join("a_agents Agent", "Obargain.agent_id = Agent.id", "left")
->join('a_store Store', 'Agent.store_id = Store.id', 'left')
->join('a_district District', 'Agent.district_id = District.id', 'left')
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
->join('o_partial_commission PartialCommission', 'PartialCommission.bargain_id = Obargain.id', 'left')
->where($where)
->order("Obargain.create_time desc")
......@@ -1476,8 +1476,8 @@ class OBargainModel extends Model
->join("o_order Oorder", "Obargain.order_id = Oorder.id", "left")
->join("g_houses Houses", "Oorder.house_id = Houses.id", "left")
->join("a_agents Agent", "Obargain.agent_id = Agent.id", "left")
->join('a_store Store', 'Agent.store_id = Store.id', 'left')
->join('a_district District', 'Agent.district_id = District.id', 'left')
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
->join('o_partial_commission PartialCommission', 'PartialCommission.bargain_id = Obargain.id', 'left')
->where($where)
->order("Obargain.create_time desc")
......@@ -1495,10 +1495,9 @@ class OBargainModel extends Model
->join("o_order Oorder", "Obargain.order_id = Oorder.id", "left")
->join("g_houses Houses", "Oorder.house_id = Houses.id", "left")
->join("a_agents Agent", "Obargain.agent_id = Agent.id", "left")
->join('a_store Store', 'Agent.store_id = Store.id', 'left')
->join('a_district District', 'Agent.district_id = District.id', 'left')
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
->join('o_partial_commission PartialCommission', 'PartialCommission.bargain_id = Obargain.id', 'left')
->where($where)
->order("Obargain.create_time desc")
->select();
......@@ -1520,8 +1519,8 @@ class OBargainModel extends Model
->join("o_order Oorder", "Obargain.order_id = Oorder.id", "left")
->join("g_houses Houses", "Oorder.house_id = Houses.id", "left")
->join("a_agents Agent", "Obargain.agent_id = Agent.id", "left")
->join('a_store Store', 'Agent.store_id = Store.id', 'left')
->join('a_district District', 'Agent.district_id = District.id', 'left')
// ->join('a_store Store', 'Agent.store_id = Store.id', 'left')
// ->join('a_district District', 'Agent.district_id = District.id', 'left')
->join('o_partial_commission PartialCommission', 'PartialCommission.bargain_id = Obargain.id', 'left')
->where($where)
......
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