Commit dea0ff21 authored by hujun's avatar hujun

冻结推送

parent b5aeddc2
......@@ -262,12 +262,8 @@ class PushMessageService
*/
public function record($type, $house_id, $agent_id, $operation_id, $data = [])
{
$result = false;
$m_push = new MPushMessage();
switch ($type) {
case 0 :
$result = $m_push->addData($data, $operation_id, $type);
break;
case 1 :
$result = $m_push->addHouseIdArray($house_id, $operation_id, $type, $data);
break;
......@@ -277,19 +273,22 @@ class PushMessageService
case 3 :
$data['house_id'] = $house_id;
$result = $m_push->addAgentIdArray($agent_id, $operation_id, $type, $data);
break;
default :
$result = $m_push->addData($data, $operation_id, $type);
}
return $result;
}
/**
*
* 消息推送
*/
public function pushRecord()
{
$title = '';
$title = $type = '';
$m_push = new MPushMessage();
$field = 'id,addressee_id,type,message,house_id';
$where['status'] = 0;
$field = 'id,addressee_id,type,message,house_id,user_id';
$where['status'] = $id = 0;
$push_data = $m_push->getDateLimit($field, $where, 100);
foreach ($push_data['data'] as $k => $v) {
......@@ -300,16 +299,25 @@ class PushMessageService
switch ($v['type']) {
case 1 :
$title = "商铺下架";
$id = $v['house_id'];
$type = 'house_info';
break;
case 2:
$title = "修改客方";
$type = 'user_info';
break;
case 3:
$title = '盘方修改';
$id = $v['house_id'];
$type = 'house_info';
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['send_time'] = date('Y-m-d H:i:s');
......
......@@ -22,17 +22,13 @@
namespace app\index\controller;
use app\api_broker\service\CallPhoneService;
use app\api_broker\service\PushMessageService;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\ABindingDevice;
use app\model\Agents;
use app\model\AStore;
use app\model\BindingPhone;
use app\model\Evaluate;
use app\model\Regions;
use think\Exception;
use think\Session;
use think\Db;
class Agent extends Basic
{
......@@ -83,14 +79,14 @@ class Agent extends Basic
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//条件
// $where['a.status'] = ['IN',['0,1']];
$where['a.id'] = ['<>', 1];
$where['a.id'] = [ '<>', 1 ];
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'])) {
$where['g.title'] = ['LIKE', "%{$params['group_name']}%"];
$where['g.title'] = [ 'LIKE', "%{$params['group_name']}%" ];
}
if (!empty($params['store_id'])) {
......@@ -134,11 +130,11 @@ class Agent extends Basic
$params["agent_id"] = $agent_id;
$field = "id,agent_id,device_id,model,is_forbidden,is_pc,create_time,update_time";
$result = $aBD->getDeviceByAgentId($params,$field);
if(count($result) > 0){
return $this->response("200","success",$result);
}else{
return $this->response("101","此账号未绑定过设备");
$result = $aBD->getDeviceByAgentId($params, $field);
if (count($result) > 0) {
return $this->response("200", "success", $result);
} else {
return $this->response("101", "此账号未绑定过设备");
}
}
......@@ -282,20 +278,25 @@ class Agent extends Basic
//同时修改设备绑定表
$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) {
$where['a.id'] = $ids;
$where['b.status'] = 1;
$agent_phone = $m_agent->getAgentCallPhone('b.phone_a,b.phone_b,c.phone_x', $where);
$agent_phone = $m_agent->getAgentCallPhone('b.phone_a,b.phone_b,c.phone_x', $where);
if (!empty($agent_phone['data']) && $agent_phone['status'] != 'fail') {
$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);
}
}
$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);
} else {
......@@ -336,7 +337,6 @@ class Agent extends Basic
}
/**
* 经纪人列表计算-评价次数和分数
* 朱伟 2018年07月03日
......@@ -347,28 +347,28 @@ class Agent extends Basic
/*$data = array(
"agents_id" => '869,5758,5757,5756,5755,5754,5753,5752,5751,5750,5749,5748,5747,5746,5745'
);*/
$agents_ids = $data['agents_id'];
$agents_ids = $data['agents_id'];
if (!isset($agents_ids)) {
return $this->response("300", "参数不全");
}
$model = new Evaluate();
foreach (explode(',',$agents_ids) as $k => $v){
foreach (explode(',', $agents_ids) as $k => $v) {
$params['agents_id'] = $v;
//dump($v);
$field='sum(evaluate_grade) as agent_evaluate_fraction';
$agent_evaluate_num = $model->getAgentEvaluateNum($params);
$agent_evaluate_fraction_res = $model->getAgentEvaluateFraction($field,$params);
$agent_evaluate_fraction = 0;
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);
$field = 'sum(evaluate_grade) as agent_evaluate_fraction';
$agent_evaluate_num = $model->getAgentEvaluateNum($params);
$agent_evaluate_fraction_res = $model->getAgentEvaluateFraction($field, $params);
$agent_evaluate_fraction = 0;
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);
}
$res['agents_id'] = $v;
$res['agent_evaluate_num'] = $agent_evaluate_num;
$res['agent_evaluate_fraction'] = $agent_evaluate_fraction;
$result[] = $res;
$res['agents_id'] = $v;
$res['agent_evaluate_num'] = $agent_evaluate_num;
$res['agent_evaluate_fraction'] = $agent_evaluate_fraction;
$result[] = $res;
}
if ($result) {
......
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