Commit 15be56a5 authored by hujun's avatar hujun

推送feed流

parent 72dace17
......@@ -73,12 +73,24 @@ class GeTuiUntils {
* zhuwei
* 2017-11-06
*/
function push_message_for_all($data)
function push_message_for_all($title,$content,$link)
{
$igt = new \IGeTui(TL_GETUI_HOST, TL_GETUI_APPKEY, TL_GETUI_MASTERSECRET);
$homeurl = $this->http_host();
$data['black_title'] = $title;
$data['content'] = $content;
$data['touchuan'] = json_encode(array(
'title' => $title,
'content' => $content,
'type' => 'url',
'url' => $link,
'name' => $title,
'id' => '69',
'imageUrl' => $homeurl .'/notice_android_logo.png'));
$template = $this->onli_all_template($data['touchuan'], $data['black_title'], $data['content']);
//个推信息体
//基于应用消息体
$message = new \IGtAppMessage();
$message->set_isOffline(true);
......
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/5/7
* Time: 16:47
*/
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
class Feed extends Basic
{
public function pushFeed() {
}
}
\ No newline at end of file
......@@ -16,6 +16,8 @@ use app\model\GHouses;
use app\model\GHousesToAgents;
use app\model\OrderModel;
use app\model\OReportModel;
use app\model\PushFeed;
use app\model\PushHistory;
use app\model\Users;
class PushMessageService
......@@ -87,7 +89,7 @@ class PushMessageService
}
/**
* 成交报告推送
* 成交报告推送(feed流喜报)
*
* @param int $report_id
* @throws \think\db\exception\DataNotFoundException
......@@ -95,53 +97,36 @@ class PushMessageService
* @throws \think\exception\DbException
*/
public function pushBargainMessage($report_id = 0){
$agent = new AAgents();
$agent_house = new GHousesToAgents();
$user = new Users();
$field = 'house_id,house_title,report_agent_name,report_store_id,user_id';
$report = new OReportModel();
$report_data = $report->getReportOrder($field, [ 'a.id' => $report_id ]);
$user_agent_id = $user->getUserById('agent_id',$report_data['user_id']);
$key = 0;
//客方
if (!empty($user_agent_id['agent_id'])) {
$agent_data[$key]['id'] = $user_agent_id['agent_id'];
$agent_data[$key]['device_id'] = $agent->getAgentsById($user_agent_id['agent_id'],'device_id');
$key++;
}
$device_id = $agent->getAgentInfo('id,device_id','', [
'store_id'=>$report_data['report_store_id'],'level'=>['in','20,40']
]);
//店长
if ($device_id['device_id']) {
$agent_data[$key]['id'] = $device_id['id'];
$agent_data[$key]['device_id'] = $device_id['device_id'];
$key++;
}
$report = new OReportModel();
$feed = new PushFeed();
$history = new PushHistory();
$field = 'house_id,house_title,report_agent_name,report_store_id,user_id';
//独家方和盘方
$agent_houser_data = $agent_house->getHousesAgents($report_data['house_id'], 'b.id,b.device_id',['type'=>['in','2,3']]);
foreach ($agent_houser_data as $v) {
if (!empty($v['device_id'])) {
$agent_data[$key]['id'] = $v['id'];
$agent_data[$key]['device_id'] = $v['device_id'];
$key++;
}
}
$report_data = $report->getReportOrder($field, [ 'a.id' => $report_id ]);
$store = new AStore();
$store_name = $store->getStoreKeyById('store_name',$report_data['report_store_id']);
$title = '成交就是这么简单';
$content = "恭喜【{$store_name}】店【{$report_data['report_agent_name']}】成交【{$report_data['house_title']}】商铺一套";
$url = $this->push->http_host(). '/app/feed';
foreach ($agent_data as $k => $v) {
$this->push->public_push_message_for_one($v['id'], $v['device_id'], '成交就是这么简单', $content);
}
$feed->editData([
'agent_id' => 0,
'report_id' => $report_id,
'house_id' => $report_data['house_id'],
'feed_content' => $content,
]);
$history->editData([
'title' => $title,
'content' => $content,
'link' => $url,
'read_num' => 10, //不要问什么,就是产品要加的。PV
'click_num' => 10, //不要问什么,就是产品要加的。
'feed_id' => $feed->id,
]);
$this->push->push_message_for_all($title, $content, $url);
return ;
}
......
......@@ -5,7 +5,6 @@ namespace app\app\controller;
use app\model\AppVersion;
use app\model\HouseImgs;
use app\model\HouseInfos;
use think\Controller;
use think\Response;
class Index
......@@ -66,6 +65,11 @@ class Index
{
return view('index/more_chengjiao');
}
public function feed()
{
return view('index/feed');
}
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
喜报feed
</body>
</html>
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/5/7
* Time: 17:54
*/
namespace app\model;
class PushFeed extends BaseModel
{
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/5/7
* Time: 17:54
*/
namespace app\model;
class PushHistory extends BaseModel
{
}
\ No newline at end of file
......@@ -24,6 +24,7 @@ Route::group('app', [
'download' => [ 'app/index/download', [ 'method' => 'get' ] ],
'getShopDetails' => [ 'app/index/getShopDetail', [ 'method' => 'get | post' ] ],
'getVersionNo' => [ 'app/index/getVersionNo', [ 'method' => 'get | post' ] ],
'feed' => [ 'app/index/feed', [ 'method' => 'get' ] ]
]);
Route::group('app_broker',[
......
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