Commit 14b9f474 authored by zw's avatar zw

Merge branch 'test' into 1030-v2.9.6

parents c2592d90 75617085
......@@ -288,7 +288,7 @@ class Broker extends Basic
if (empty($this->params['phone'])) {
$agents_data = $m_agents->getAgentInfo('id,update_time,call_number', $this->params['agent_id']);
} else {
$agents_data = $m_agents->getAgentInfo('id,update_time,call_number', '', ['agent_id'=>$this->params['agent_id']]);
$agents_data = $m_agents->getAgentInfo('id,update_time,call_number', '', ['phone'=>$this->params['phone']]);
}
$insert_data['update_time'] = $agents_data['update_time'];
......@@ -318,30 +318,28 @@ class Broker extends Basic
$data['data'] = [];
$data['msg'] = '';
if ($this->params['agent_id'] > 0) {
$redis = new VerifyRepetitionService();
$is = $redis->verifyStart(2, $this->params['phone'], 0);
if ($is) {
if (isset($this->params['phone'])) {
$is = 0;
$m_agents = new AAgents();
$agents_data = $m_agents->getAgentInfo('id,update_time,call_number', '', ['agent_id'=> $this->params['agent_id']]);
if (empty($this->params['phone'])) {
$agents_data = $m_agents->getAgentInfo('id,update_time,call_number', $this->params['agent_id']);
} else {
$agents_data = $m_agents->getAgentInfo('id,update_time,call_number', '', ['agent_id'=>$this->params['agent_id']]);
$agents_data = $m_agents->getAgentInfo('id,update_time,call_number', '', ['phone'=>$this->params['phone'],'status'=>0]);
}
if (!empty($agents_data)) {
$redis = new VerifyRepetitionService();
$is = $redis->verifyStart(2, $agents_data['id'], 0);
}
if ($is) {
$insert_data['update_time'] = $agents_data['update_time'];
$insert_data['call_number'] = $agents_data['call_number'] + 1;
$data['data'] = $m_agents->editData($insert_data, $agents_data['id']);
}
} else {
$data['status'] = 101;
$data['msg'] = 'agent_id is null';
$data['msg'] = 'phone is null';
}
return $this->response($data['status'], $data['msg'], $data['data']);
......
......@@ -9,6 +9,7 @@ namespace app\api\controller;
use app\api\extend\Basic;
use app\model\AAgents;
use app\model\AUserCallAgent;
use think\Request;
......@@ -59,7 +60,32 @@ class CallAgent extends Basic
* @return \think\Response
*/
public function addUserCallAgentV2(){
$params = $this->params;
/*$params = array(
"user_id" => 1,
"agent_id" => 4,
);*/
if (!isset($params["phone"]) ) {
return $this->response("101", "请求参数错误");
}
$model = new AAgents();
$params_['phone'] = $params["phone"];
$agents_id = $model->getAgentsManagerID($params_);
//先判断是否已经存在数据
$insert["user_id"] = 0;
$insert["agent_id"] = $agents_id[0]['id'] ? $agents_id[0]['id'] : 0;
$insert["status"] = 0;
$res = $this->aUserCallAgent->saveUserCallAgent($insert);//int(1)
if ($res) {
return $this->response("200", "成功");
} else {
return $this->response("101", "失败");
}
}
}
\ No newline at end of file
......@@ -68,7 +68,8 @@ class Basic extends Controller
"api/getMarchInList",
"api/addSublet",
"api/getSiteListApp",
"api/recordCallNumShare"
"api/recordCallNumShare",
"api/addUserCallAgentV2"
);
/**
......
......@@ -48,8 +48,8 @@ class CallPhoneService
$this->landlord_phone_day = $this->redis->get('s_landlord_phone_day');
$this->is_privacy = empty($this->is_privacy) ? 0 : $this->is_privacy;
$this->day_num = empty($this->day_num) ? 1 : $this->day_num;
$this->landlord_phone_day = empty($this->landlord_phone_day) ? 1 : $this->landlord_phone_day;
$this->day_num = empty($this->day_num) ? 1 : $this->day_num + 1;
$this->landlord_phone_day = empty($this->landlord_phone_day) ? 1 : $this->landlord_phone_day + 1;
}
/**
......
......@@ -81,25 +81,31 @@ class Broker extends Basic
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$where = 'status = 0';
if (empty($this->params['all'])) {
$where['status'] = 0;
} else {
$where = [];
}
if ($this->params['phone']) {
$where .= ' AND concat(phone,name) like "%'.$this->params['phone'].'%"';
$where['concat(phone,name)'] = ['LIKE', '%'.$this->params['phone'].'%'];
}
if ($this->params['level']) {
$where .= ' AND level in ('.$this->params['level'].')';
$where['level'] = ['IN', $this->params['level'] ];
}
if ($this->params['store_id']) {
$where .= ' AND store_id='.$this->params['store_id'];
$where['store_id'] = $this->params['store_id'];
}
if ($this->params['district_id']) {
$where .= ' AND district_id='.$this->params['district_id'];
$where['district_id'] = $this->params['district_id'];
}
if ($this->params['site_id'] && ($this->userId != 1)) {
$where .= ' AND site_id='. $this->params['site_id'];
$where['site_id'] = $this->params['site_id'];
}
if ($where) {
......
......@@ -96,36 +96,6 @@ class OperationData extends Basic
return $this->response(200, 'success', $result);
}
/**
* 客户来电数
* @return \think\Response
*/
// public function userPhoneNum()
// {
// $params = $this->params;
// if (!$params['create_time_start'] && !$params['create_time_end']) {
// $params['create_time_start'] = date("Y-m-1", time());
// $params['create_time_end'] = date("Y-m-d", time());
// }
// $params_['a.create_time'] = [ 'between', [ $params['create_time_start'] . ' 00:00:00', $params['create_time_end'] . ' 23:59:59' ] ];
// // 先查新所有部门
// $district_list = $this->getDistrict();
//
// foreach ($district_list as $key => $v) {
// $result_["id"] = $v['id'];
// $result_["district_name"] = $v['district_name'];
//
// // 客户来电数
// $params_["b.district_id"] = $v['id'];
// $model = new AUserCallAgent();
// $res = $model->getUserCallAgentCount($params_);
// dump($res);
// $result_["call_number_total"] = isset($res) ? $res : 0;
// $result[] = $result_;
// }
// return $this->response(200, 'success', $result);
// }
/**
* 客户来电数
* @return \think\Response
......@@ -133,6 +103,10 @@ class OperationData extends Basic
public function userPhoneNum()
{
$params = $this->params;
if (!$params['create_time_start'] && !$params['create_time_end']) {
$params['create_time_start'] = date("Y-m-1", time());
$params['create_time_end'] = date("Y-m-d", time());
}
$params_['a.create_time'] = [ 'between', [ $params['create_time_start'] . ' 00:00:00', $params['create_time_end'] . ' 23:59:59' ] ];
// 先查新所有部门
$district_list = $this->getDistrict();
......@@ -142,19 +116,44 @@ class OperationData extends Basic
$result_["district_name"] = $v['district_name'];
// 客户来电数
$params = [];
$params["district_id"] = $v['id'];
//$params["status"] = 0; //只查询正常状态的经纪人
$field = "sum(call_number) as call_number_total";
$agentModel = new AAgents();
$res = $agentModel->getUserPhoneNum($field, $params);
$result_["call_number_total"] = isset($res[0]['call_number_total']) ? $res[0]['call_number_total'] : 0;
$params_["b.district_id"] = $v['id'];
$model = new AUserCallAgent();
$res = $model->getUserCallAgentCount($params_);
$result_["call_number_total"] = isset($res) ? $res : 0;
$result[] = $result_;
}
return $this->response(200, 'success', $result);
}
/**
* 客户来电数
* @return \think\Response
*/
// public function userPhoneNum()
// {
// $params = $this->params;
// $params_['a.create_time'] = [ 'between', [ $params['create_time_start'] . ' 00:00:00', $params['create_time_end'] . ' 23:59:59' ] ];
// // 先查新所有部门
// $district_list = $this->getDistrict();
//
// foreach ($district_list as $key => $v) {
// $result_["id"] = $v['id'];
// $result_["district_name"] = $v['district_name'];
//
// // 客户来电数
// $params = [];
// $params["district_id"] = $v['id'];
// //$params["status"] = 0; //只查询正常状态的经纪人
// $field = "sum(call_number) as call_number_total";
// $agentModel = new AAgents();
// $res = $agentModel->getUserPhoneNum($field, $params);
//
// $result_["call_number_total"] = isset($res[0]['call_number_total']) ? $res[0]['call_number_total'] : 0;
// $result[] = $result_;
// }
// return $this->response(200, 'success', $result);
// }
/**
* 新增-注册-登录用户数
* @return \think\Response
......
......@@ -96,7 +96,7 @@ class PerformanceInfo extends Basic
$field .= 'Obargain.scale_fee,';
$field .= 'Obargain.order_id,';
$field .= 'Obargain.role,';
$field .= 'Obargain.price,';
$field .= 'Obargain.price,';//pricec成交价格
$field .= 'Agent.name,';
$field .= 'Agent.phone,';
$field .= 'Store.store_name,';
......@@ -176,9 +176,11 @@ class PerformanceInfo extends Basic
$field = 'Obargain.create_time,';
$field .= 'Obargain.id,';
$field .= 'Obargain.father_id,';
$field .= 'Obargain.trade_type,';
$field .= 'Houses.internal_address,';
$field .= 'Oorder.house_id,';
$field .= 'Obargain.price,';//pricec成交价格
$field .= 'Agent.name,';
$field .= 'Agent.phone,';
$field .= 'Store.store_name,';
......@@ -195,6 +197,10 @@ class PerformanceInfo extends Basic
$export = new ExportExcelUntil();
$e_data_new = [];
foreach ($return as $key => $v) {
$e_data_old['bargain_id'] = $v["father_id"] == 0 ? $v["id"] : $v["father_id"];
$e_data_old['commission_id'] = $v["id"] ;
$e_data_old['create_time'] = $v['create_time'];//提交时间
if($v['trade_type'] == 10){
......@@ -209,9 +215,8 @@ class PerformanceInfo extends Basic
//商铺地址截取字符串前3位,后面做隐藏 --暂时不用,后期可直接解除注释
//$landmark = $v["landmark"] ? mb_substr($v["landmark"],0,3,'utf-8').'****' : '';
$e_data_old['landmark'] = $v["internal_address"];//商铺地址
// $landmark = $v["internal_address"] ? mb_substr($v["internal_address"],0,3,'utf-8').'****' : '';
$e_data_old['landmark'] = $v["internal_address"] ? mb_substr($v["internal_address"],0,3,'utf-8').'****' : '';//商铺地址
$e_data_old['house_id'] = $v['house_id'];//商铺编号
//$e_data_old['name_phone'] = $v['name'].'-'.$v['phone'];//分佣提成方
$e_data_old['name_phone'] = $v['name'];//分佣提成方
......@@ -220,10 +225,11 @@ class PerformanceInfo extends Basic
$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['price'] = $v['price'];//成交价
$e_data_new[]=$e_data_old;
}
$title = [ '提交时间', '成交类型', '商铺地址', '商铺编号', '分佣提成方', '所属部门门店', '分佣比例', '应收佣金', '实收佣金' ];
$title = [ '成交报告ID', '分佣ID','提交时间', '成交类型', '商铺地址', '商铺编号', '分佣提成方', '所属部门门店', '分佣比例', '应分佣金', '实收佣金' ,'成交价'];
$export->exportTable('业绩明细', $e_data_new, count($e_data_new[0]), '业绩明细表', $title);
return '';
}
......
......@@ -16,12 +16,13 @@ use Think\Log;
*/
class WxAuthorization extends Basic
{
private $url = CURRENT_URL . "/index/getWxInfo";
private $url;
private $_wxApi;
public function __construct()
{
$this->_wxApi = new WxCallbackUntils();
$this->url = CURRENT_URL . "/index/getWxInfo";
}
public function getWxInfo()
......
......@@ -363,7 +363,6 @@ class OBargainModel extends Model
->join('g_houses d', 'c.house_id = d.id', 'left')
->join('o_partial_commission e', 'e.bargain_id = a.id', 'left')
->where($params)
->group('a.id')
->order($order_)
->limit($pageSize)
->page($pageNo)
......@@ -381,8 +380,8 @@ class OBargainModel extends Model
->join('o_report b', 'a.report_id = b.id', 'left')
->join('o_order c', 'a.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->join('o_partial_commission e', 'e.bargain_id = a.id', 'left')
->where($params)
->group('a.id')
->sum($field);
}
......
......@@ -80,7 +80,6 @@ class ORealIncome extends BaseModel
->join('o_order c', 'a.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->where($params)
->group('a.id')
->sum($field);
}
}
\ No newline at end of file
......@@ -428,6 +428,8 @@ Route::group('api', [
'getSiteListApp' => [ 'api/Site/getSiteList', [ 'method' => 'POST|GET' ] ], //获取站点列表 朱伟 2018-10-18
'addUserCallAgent' => [ 'api/CallAgent/addUserCallAgent', [ 'method' => 'POST|GET' ] ],//客户来电记录
'addUserCallAgentV2' => [ 'api/CallAgent/addUserCallAgentV2', [ 'method' => 'POST|GET' ] ],//客户来电记录h5
]);
......
......@@ -162,10 +162,10 @@ class PrivacyNumber
$bind->unBind($v['phone_x'], $v['phone_a'], $v['phone_b'], $result->RequestId);
$binding_phone_id[$k] = $v['id'];
$phone_id[$k] = $v['aliYun_phone_id'];
}
$call_key = 'call_'.$v['phone_a'].'_'.$v['phone_b'].'_1';
$redis->del($call_key);
}
} elseif ($v['type'] == 2 && !empty($v['mappingId'])) {
//释放容联云隐私号码
$tong_xun = new RongDemo();
......@@ -174,15 +174,15 @@ class PrivacyNumber
$bind->unBind($v['phone_x'], $v['phone_a'], $v['phone_b']);
$binding_phone_id[$k] = $v['id'];
$phone_id[$k] = $v['aliYun_phone_id'];
$call_key = 'call_'.$v['phone_a'].'_'.$v['phone_b'].'_2';
$redis->del($call_key);
} else {
$yun_result = $tong_xun->getBindInfo($v['phone_a'], $v['phone_b'], $v['phone_x'], $v['mappingId']);
if (empty($yun_result['data']['mappingId'])) {
$bind->unBind($v['phone_x'], $v['phone_a'], $v['phone_b']);
}
}
$call_key = 'call_'.$v['phone_a'].'_'.$v['phone_b'].'_2';
$redis->del($call_key);
}
}
......
......@@ -272,13 +272,13 @@
}
//点击拨打 记录拨打次数
//点击拨打 记录拨打次数 朱威
$("#fix_tel").click(function() {
var time = localStorage.getItem(_shangpuId+"_"+_tel);
var nowTime = (new Date()).getTime();
if(!time || nowTime-time > 24*3600*1000){
$.ajax({
url: '/api/recordCallNumShare',
url: '/api/addUserCallAgentV2',
type: 'POST',
async: true,
data: {
......@@ -291,7 +291,24 @@
});
}
});
$("#fix_tel").click(function() {
var _time = localStorage.getItem(_tel+"_"+_shangpuId);
var _nowTime = (new Date()).getTime();
if(!_time || _nowTime-_time > 24*3600*1000){
$.ajax({
url: '/api/recordCallNumShare',
type: 'POST',
async: true,
data: {
'phone': _tel
},
dataType: 'json',
success: function(data) {
localStorage.setItem(_tel+"_"+_shangpuId,(new Date()).getTime());
}
});
}
});
$("#fix_area_bottom_btn").click(function() {
_fix_bottom.hide();
});
......
......@@ -2,7 +2,7 @@ body {
/*width: 1335px !important;*/
/*min-width: 1335px !important;*/
width: 1160px !important;
width: 1230px !important;
/*min-width:1160px !important;*/
margin: 0;
margin: 0 auto;
......
......@@ -470,7 +470,8 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
type: 'GET',
url: '/index/getBroker_new',
data: {
'phone': $.trim(_this.val())
'phone': $.trim(_this.val()),
'all':1
},
timeout: 30000,
dataType: 'json',
......@@ -632,7 +633,8 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
type: 'GET',
async: true,
data: {
"phone": $("#partical_name").val()
"phone": $("#partical_name").val(),
'all' : 1
},
dataType: 'json',
success: function(data) {
......
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