Commit 768f5878 authored by hujun's avatar hujun

个人推送所有设备

parent 4328ceb2
...@@ -11,6 +11,7 @@ namespace app\api_broker\service; ...@@ -11,6 +11,7 @@ namespace app\api_broker\service;
use app\api\untils\GeTuiUntils; use app\api\untils\GeTuiUntils;
use app\model\AAgents; use app\model\AAgents;
use app\model\ABindingDevice;
use app\model\AStore; use app\model\AStore;
use app\model\GHouses; use app\model\GHouses;
use app\model\GHousesToAgents; use app\model\GHousesToAgents;
...@@ -42,7 +43,7 @@ class PushMessageService ...@@ -42,7 +43,7 @@ class PushMessageService
$agent = new AAgents(); $agent = new AAgents();
$house = new GHouses(); $house = new GHouses();
$data = $house_agent->getHousesAgents($house_id, 'b.id,device_id', ['type'=> $type]); $data = $house_agent->getHousesAgents($house_id, 'b.id', ['type'=> $type]);
$agent_name = $agent->getAgentsStoreById(['a.id'=>$agent_id], 'name,store_name'); $agent_name = $agent->getAgentsStoreById(['a.id'=>$agent_id], 'name,store_name');
$house_data = $house->getHouseDetail('internal_title',['id'=>$house_id]); $house_data = $house->getHouseDetail('internal_title',['id'=>$house_id]);
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
...@@ -69,7 +70,7 @@ class PushMessageService ...@@ -69,7 +70,7 @@ class PushMessageService
$report_data = $report->getReportOrder($field, [ 'a.id' => $report_id ]); $report_data = $report->getReportOrder($field, [ 'a.id' => $report_id ]);
$agent = new AAgents(); $agent = new AAgents();
$agent_data = $agent->getAgentInfo('id,device_id', $report_data['report_agent_id']); $agent_data = $agent->getAgentInfo('id', $report_data['report_agent_id']);
if ($type == 1) { if ($type == 1) {
$content = "客户{$report_data['user_name']}进场【{$report_data['house_title']}】商铺"; $content = "客户{$report_data['user_name']}进场【{$report_data['house_title']}】商铺";
...@@ -171,8 +172,8 @@ class PushMessageService ...@@ -171,8 +172,8 @@ class PushMessageService
return false; return false;
} }
$result = []; $result = [];
$agent = new AAgents(); // $agent = new AAgents();
$device_id = $agent->getAgentsById($id, 'device_id'); // $device_id = $agent->getAgentsById($id, 'device_id');
if (!empty($device_id)) { if (!empty($device_id)) {
// $result = $this->push->public_push_message_for_one($id, $device_id, $title, $content, $type, $user_id); // $result = $this->push->public_push_message_for_one($id, $device_id, $title, $content, $type, $user_id);
...@@ -196,7 +197,7 @@ class PushMessageService ...@@ -196,7 +197,7 @@ class PushMessageService
$agent = new AAgents(); $agent = new AAgents();
$order = new OrderModel(); $order = new OrderModel();
$house = $order->getHouseInfoByOrderIdOne('internal_title', ['a.id'=>$order_id]); $house = $order->getHouseInfoByOrderIdOne('internal_title', ['a.id'=>$order_id]);
$agent_data = $agent->getAgentInfo('id,device_id,name', $agent_id); $agent_data = $agent->getAgentInfo('id,name', $agent_id);
$content = "{$submit_agent_name}新增成交报告,分佣方:{$agent_data['name']}[{$house['internal_title']}]商铺"; $content = "{$submit_agent_name}新增成交报告,分佣方:{$agent_data['name']}[{$house['internal_title']}]商铺";
// return $this->push->public_push_message_for_one($agent_data['id'], $agent_data['device_id'], '新增分佣', $content); // return $this->push->public_push_message_for_one($agent_data['id'], $agent_data['device_id'], '新增分佣', $content);
...@@ -214,11 +215,11 @@ class PushMessageService ...@@ -214,11 +215,11 @@ class PushMessageService
*/ */
public function pushAgentAllDeviceId($id, $title, $content, $type = null, $user_id = null) { public function pushAgentAllDeviceId($id, $title, $content, $type = null, $user_id = null) {
$m_agent_device = new ABindingDevice(); $m_agent_device = new ABindingDevice();
$device_id_array = $m_agent_device->getDeviceByAgentId(['agent_id'=>$id], 'id,device_id'); $device_id_array = $m_agent_device->getDeviceByAgentId(['agent_id'=>$id], 'id,push_id');
foreach ($device_id_array as $k => $v) { foreach ($device_id_array as $k => $v) {
if (!empty($v['device_id'])) { if (!empty($v['push_id'])) {
$this->push->public_push_message_for_one($id, $v['device_id'], $title, $content, $type, $user_id); $this->push->public_push_message_for_one($id, $v['push_id'], $title, $content, $type, $user_id);
} }
} }
......
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