Commit 27ef8902 authored by hujun's avatar hujun

新增客方推送

parent 1c61ae7c
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
namespace app\api\controller; namespace app\api\controller;
use app\api\untils\GeTuiUntils; use app\api_broker\service\PushMessageService;
use app\model\AAgents;
use think\Request; use think\Request;
use app\api\extend\Basic; use app\api\extend\Basic;
use app\api\untils\MessageUntils; use app\api\untils\MessageUntils;
...@@ -279,11 +278,11 @@ class Member extends Basic ...@@ -279,11 +278,11 @@ class Member extends Basic
} }
} }
$ge_tui = new GeTuiUntils(); if (!empty($insert_data['agent_id'])) {
$agent_ = new AAgents(); $push = new PushMessageService();
$agent_data = $agent_->getAgentInfo('device_id',$referrer_id); $content = '你有新客户【'.$user_nick.'-'.$phone.'】成功注册App';
$content = '你有新客户【'.$user_nick.'-'.$phone.'】成功注册App'; $push->pushMessageById($insert_data['agent_id'],'邀请注册', $content);
$ge_tui->public_push_message_for_one($referrer_id,$agent_data['device_id'],'邀请注册',$content); }
} }
} }
$insert_data['referrer_id'] = $referrer_id; //经纪人邀请 $insert_data['referrer_id'] = $referrer_id; //经纪人邀请
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
namespace app\api_broker\controller; namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\service\PushMessageService;
use app\model\AAgents; use app\model\AAgents;
use app\model\Agents;
use app\model\ULabels; use app\model\ULabels;
use app\model\Users; use app\model\Users;
use app\model\UPhoneFollowPp; use app\model\UPhoneFollowPp;
...@@ -53,31 +53,29 @@ class Client extends Basic ...@@ -53,31 +53,29 @@ class Client extends Basic
if ($this->params['agents_id'] != $this->params['ccr_id']) { if ($this->params['agents_id'] != $this->params['ccr_id']) {
$agent = new AAgents(); $agent = new AAgents();
$agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']); $agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']);
$remark = '修改客方为'.$agent_data['name'].'-'.$agent_data['phone']; $remark = '修改为'.$agent_data['name'].'-'.$agent_data['phone'];
} else {
$remark = '用户编辑'; $push = new PushMessageService();
$push->pushMessageById($this->params['ccr_id']);
$this->operating_records($this->params['ccr_id'], $type=3, $remark,0,$this->params['id']);
} }
//编辑 //编辑
$data['start'] = $this->user->edit($this->params, $this->params['id']); $data['start'] = $this->user->edit($this->params, $this->params['id']);
$this->operating_records($this->params['ccr_id'], $type=3, $remark,0,$this->params['id']);
} else { } else {
$table = new AAgents(); $table = new AAgents();
//添加 //添加
$data['start'] = $this->user->edit($this->params); $data['start'] = $this->user->edit($this->params);
if ($data['start'] != 1) { if ($data['start'] == 1) {
$this->code = 101;
$this->msg = '该用户已存在';
} elseif ($data['start'] == 1){
$data['id']= $this->user->id; $data['id']= $this->user->id;
$this->operating_records($this->params['ccr_id'], $type=3, $remark='用户添加',0,$data['id']); $agent_data = $table->getAgentInfo('name,phone',$this->params['agents_id']);
} else { $remark = '新增为'. $agent_data['name'].'-'.$agent_data['phone'];
$data['id']= $this->user->id;
//获取客方数据
$name = $table->where('id',$this->params['agents_id'])->value('name');
$remark = '客方添加为 '.$name;
$this->operating_records($this->params['ccr_id'], $type=3, $remark,0,$data['id']); $this->operating_records($this->params['ccr_id'], $type=3, $remark,0,$data['id']);
} else {
$this->code = 101;
$this->msg = '该用户已存在';
} }
} }
} else { } else {
......
...@@ -139,4 +139,25 @@ class PushMessageService ...@@ -139,4 +139,25 @@ class PushMessageService
return ; return ;
} }
/**
* 普通消息推送
*
* @param $id
* @param $title
* @param $content
* @return array|void
*/
public function pushMessageById($id, $title,$content) {
if (empty($id)) {
return false;
}
$ge_tui = new GeTuiUntils();
$agent = new AAgents();
$device_id = $agent->getAgentsById($id, 'device_id');
$result = $ge_tui->public_push_message_for_one($id, $device_id, $title, $content);
return $result;
}
} }
\ No newline at end of file
...@@ -222,12 +222,12 @@ class Users extends Model ...@@ -222,12 +222,12 @@ class Users extends Model
*/ */
public function getClient($id) { public function getClient($id) {
if ($id) { if ($id) {
$data = $this->field('a.id as user_id,a.user_nick,a.user_phone,a.sex,a.agent_id,a.create_time,b.realname,b.phone') $data = $this->field('a.id as user_id,a.user_nick,a.user_phone,a.sex,a.agent_id,a.create_time,b.name,b.phone')
->alias('a') ->alias('a')
->join('agents b','a.agent_id=b.id', 'left') ->join('a_agents b','a.agent_id=b.id', 'left')
->where('a.id',$id)->find(); ->where('a.id',$id)->find();
$data['agents'] = $data['realname'].'-'.$data['phone']; $data['agents'] = $data['name'].'-'.$data['phone'];
unset($data['realname']); unset($data['name']);
unset($data['phone']); unset($data['phone']);
} else { } else {
$data = false; $data = false;
......
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