Commit dea0ff21 authored by hujun's avatar hujun

冻结推送

parent b5aeddc2
...@@ -262,12 +262,8 @@ class PushMessageService ...@@ -262,12 +262,8 @@ class PushMessageService
*/ */
public function record($type, $house_id, $agent_id, $operation_id, $data = []) public function record($type, $house_id, $agent_id, $operation_id, $data = [])
{ {
$result = false;
$m_push = new MPushMessage(); $m_push = new MPushMessage();
switch ($type) { switch ($type) {
case 0 :
$result = $m_push->addData($data, $operation_id, $type);
break;
case 1 : case 1 :
$result = $m_push->addHouseIdArray($house_id, $operation_id, $type, $data); $result = $m_push->addHouseIdArray($house_id, $operation_id, $type, $data);
break; break;
...@@ -277,19 +273,22 @@ class PushMessageService ...@@ -277,19 +273,22 @@ class PushMessageService
case 3 : case 3 :
$data['house_id'] = $house_id; $data['house_id'] = $house_id;
$result = $m_push->addAgentIdArray($agent_id, $operation_id, $type, $data); $result = $m_push->addAgentIdArray($agent_id, $operation_id, $type, $data);
break;
default :
$result = $m_push->addData($data, $operation_id, $type);
} }
return $result; return $result;
} }
/** /**
* * 消息推送
*/ */
public function pushRecord() public function pushRecord()
{ {
$title = ''; $title = $type = '';
$m_push = new MPushMessage(); $m_push = new MPushMessage();
$field = 'id,addressee_id,type,message,house_id'; $field = 'id,addressee_id,type,message,house_id,user_id';
$where['status'] = 0; $where['status'] = $id = 0;
$push_data = $m_push->getDateLimit($field, $where, 100); $push_data = $m_push->getDateLimit($field, $where, 100);
foreach ($push_data['data'] as $k => $v) { foreach ($push_data['data'] as $k => $v) {
...@@ -300,16 +299,25 @@ class PushMessageService ...@@ -300,16 +299,25 @@ class PushMessageService
switch ($v['type']) { switch ($v['type']) {
case 1 : case 1 :
$title = "商铺下架"; $title = "商铺下架";
$id = $v['house_id'];
$type = 'house_info';
break; break;
case 2: case 2:
$title = "修改客方"; $title = "修改客方";
$type = 'user_info';
break; break;
case 3: case 3:
$title = '盘方修改'; $title = '盘方修改';
$id = $v['house_id'];
$type = 'house_info';
break; break;
case 4:
$title = '账号冻结';
$id = $v['addressee_id'];
$type = 'down_line';
} }
$result = $this->pushAgentAllDeviceId($v['addressee_id'], $title, $v['message'], 'house_info', $v['house_id']); $result = $this->pushAgentAllDeviceId($v['addressee_id'], $title, $v['message'], $type, $id);
$update_data['status'] = 1; $update_data['status'] = 1;
$update_data['send_time'] = date('Y-m-d H:i:s'); $update_data['send_time'] = date('Y-m-d H:i:s');
......
...@@ -22,17 +22,13 @@ ...@@ -22,17 +22,13 @@
namespace app\index\controller; namespace app\index\controller;
use app\api_broker\service\CallPhoneService; use app\api_broker\service\CallPhoneService;
use app\api_broker\service\PushMessageService;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\model\AAgents; use app\model\AAgents;
use app\model\ABindingDevice; use app\model\ABindingDevice;
use app\model\Agents;
use app\model\AStore;
use app\model\BindingPhone;
use app\model\Evaluate; use app\model\Evaluate;
use app\model\Regions;
use think\Exception; use think\Exception;
use think\Session; use think\Session;
use think\Db;
class Agent extends Basic class Agent extends Basic
{ {
...@@ -83,14 +79,14 @@ class Agent extends Basic ...@@ -83,14 +79,14 @@ class Agent extends Basic
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//条件 //条件
// $where['a.status'] = ['IN',['0,1']]; // $where['a.status'] = ['IN',['0,1']];
$where['a.id'] = ['<>', 1]; $where['a.id'] = [ '<>', 1 ];
if (!empty($params['search'])) { if (!empty($params['search'])) {
$where[] = ['EXP', "a.name like '%{$params['search']}%' OR a.phone like '%{$params['search']}%'"]; $where[] = [ 'EXP', "a.name like '%{$params['search']}%' OR a.phone like '%{$params['search']}%'" ];
} }
if (!empty($params['group_name'])) { if (!empty($params['group_name'])) {
$where['g.title'] = ['LIKE', "%{$params['group_name']}%"]; $where['g.title'] = [ 'LIKE', "%{$params['group_name']}%" ];
} }
if (!empty($params['store_id'])) { if (!empty($params['store_id'])) {
...@@ -134,11 +130,11 @@ class Agent extends Basic ...@@ -134,11 +130,11 @@ class Agent extends Basic
$params["agent_id"] = $agent_id; $params["agent_id"] = $agent_id;
$field = "id,agent_id,device_id,model,is_forbidden,is_pc,create_time,update_time"; $field = "id,agent_id,device_id,model,is_forbidden,is_pc,create_time,update_time";
$result = $aBD->getDeviceByAgentId($params,$field); $result = $aBD->getDeviceByAgentId($params, $field);
if(count($result) > 0){ if (count($result) > 0) {
return $this->response("200","success",$result); return $this->response("200", "success", $result);
}else{ } else {
return $this->response("101","此账号未绑定过设备"); return $this->response("101", "此账号未绑定过设备");
} }
} }
...@@ -282,7 +278,7 @@ class Agent extends Basic ...@@ -282,7 +278,7 @@ class Agent extends Basic
//同时修改设备绑定表 //同时修改设备绑定表
$m_agent_device = new ABindingDevice(); $m_agent_device = new ABindingDevice();
$m_agent_device->updateDate(['is_forbidden'=>$is_forbidden], ['agent_id'=>$ids]); $m_agent_device->updateDate([ 'is_forbidden' => $is_forbidden ], [ 'agent_id' => $ids ]);
if ($data['status'] == 1) { if ($data['status'] == 1) {
...@@ -292,10 +288,15 @@ class Agent extends Basic ...@@ -292,10 +288,15 @@ class Agent extends Basic
if (!empty($agent_phone['data']) && $agent_phone['status'] != 'fail') { if (!empty($agent_phone['data']) && $agent_phone['status'] != 'fail') {
$call = new CallPhoneService(); $call = new CallPhoneService();
foreach ($agent_phone['data'] as $k=>$v) { foreach ($agent_phone['data'] as $k => $v) {
$call->agentsUnBind($v['phone_a'], $v['phone_b'], $v['phone_x'], 0); $call->agentsUnBind($v['phone_a'], $v['phone_b'], $v['phone_x'], 0);
} }
} }
$push = new PushMessageService();
$message_data['message'] = '你的账号被冻结。';
$message_data['agent_id'] = $ids;
$push->record(0, 0, 0, $this->userId, $message_data);
} }
return $this->response(200, '成功', $data); return $this->response(200, '成功', $data);
} else { } else {
...@@ -336,7 +337,6 @@ class Agent extends Basic ...@@ -336,7 +337,6 @@ class Agent extends Basic
} }
/** /**
* 经纪人列表计算-评价次数和分数 * 经纪人列表计算-评价次数和分数
* 朱伟 2018年07月03日 * 朱伟 2018年07月03日
...@@ -354,15 +354,15 @@ class Agent extends Basic ...@@ -354,15 +354,15 @@ class Agent extends Basic
} }
$model = new Evaluate(); $model = new Evaluate();
foreach (explode(',',$agents_ids) as $k => $v){ foreach (explode(',', $agents_ids) as $k => $v) {
$params['agents_id'] = $v; $params['agents_id'] = $v;
//dump($v); //dump($v);
$field='sum(evaluate_grade) as agent_evaluate_fraction'; $field = 'sum(evaluate_grade) as agent_evaluate_fraction';
$agent_evaluate_num = $model->getAgentEvaluateNum($params); $agent_evaluate_num = $model->getAgentEvaluateNum($params);
$agent_evaluate_fraction_res = $model->getAgentEvaluateFraction($field,$params); $agent_evaluate_fraction_res = $model->getAgentEvaluateFraction($field, $params);
$agent_evaluate_fraction = 0; $agent_evaluate_fraction = 0;
if($agent_evaluate_fraction_res[0]['agent_evaluate_fraction']){ if ($agent_evaluate_fraction_res[0]['agent_evaluate_fraction']) {
$agent_evaluate_fraction = round($agent_evaluate_fraction_res[0]['agent_evaluate_fraction']/2 /$agent_evaluate_num,1); $agent_evaluate_fraction = round($agent_evaluate_fraction_res[0]['agent_evaluate_fraction'] / 2 / $agent_evaluate_num, 1);
} }
$res['agents_id'] = $v; $res['agents_id'] = $v;
......
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