Commit 70043eef authored by hujun's avatar hujun

feed喜报

parent c693d2a0
......@@ -10,10 +10,57 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\model\PushFeed;
class Feed extends Basic
{
public function pushFeed() {
/**
* 成交喜报列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function feedList() {
$push = new PushFeed();
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$field = 'id,report_id,house_id,title,content,link,read_num,click_num,house_title,create_time';
$where = [];
$where['type'] = 0;
if (!empty($this->agentId)) {
$where[0] = ['EXP','find_in_set('.$this->agentId.',agent_id)'];
}
$data['data'] = $push->getList($pageNo, $pageSize, 'id DESC', $field, $where);
$data['total'] = $push->getTotal($where);
return $this->response(200, "", $data);
}
/**
* 点击数
*
* @return \think\Response
* @throws \think\Exception
*/
public function editFeedClick() {
$push = new PushFeed();
if (empty($this->params['id'])) {
return $this->$this->response(101, 'Id is null');
}
if (empty($this->params['read_num'])) {
$push->editNum($this->params['id'], 'click_num');
} else {
$push->editNum($this->params['id'], 'read_num');
}
return $this->response(200, "");
}
}
\ No newline at end of file
......@@ -17,8 +17,7 @@ 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
{
......@@ -99,8 +98,7 @@ class PushMessageService
public function pushBargainMessage($report_id = 0){
$report = new OReportModel();
$feed = new PushFeed();
$history = new PushHistory();
$field = 'house_id,house_title,report_agent_name,report_store_id,user_id';
$field = 'house_id,house_title,report_agent_name,report_store_id,user_id,report_agent_id';
$report_data = $report->getReportOrder($field, [ 'a.id' => $report_id ]);
......@@ -111,19 +109,19 @@ class PushMessageService
$url = $this->push->http_host(). '/app/feed';
$feed->editData([
'agent_id' => 0,
'title' => $title,
'agent_id' => -1,
'report_id' => $report_id,
'house_id' => $report_data['house_id'],
'feed_content' => $content,
]);
$history->editData([
'title' => $title,
'content' => $content,
'steel_phone' => 0,
'type' => 0,
'link' => $url,
'status' => 0,
'user_id' => $report_data['report_agent_id'],
'house_title' => $report_data['house_title'],
'read_num' => 10, //不要问什么,就是产品要加的。PV
'click_num' => 10, //不要问什么,就是产品要加的。
'feed_id' => $feed->id,
'click_num' => 10 //不要问什么,就是产品要加的。
]);
$this->push->push_message_for_all($title, $content, $url);
......
......@@ -66,13 +66,6 @@ class Index
return view('index/more_chengjiao');
}
public function feed()
{
return view('index/feed');
}
/**
* 楼盘详情
* @return \think\Response
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
喜报feed
</body>
</html>
\ No newline at end of file
......@@ -11,6 +11,23 @@ namespace app\model;
class PushFeed extends BaseModel
{
/**
* 修改单个字段步长
*
* @param $id
* @param $field
* @param int $way
* @param int $step
* @return int|true
* @throws \think\Exception
*/
public function editNum($id, $field, $way = 1, $step = 1) {
$this->where('id',$id);
if ($way) {
$result = $this->setInc($field, $step);
} else {
$result = $this->setDec($field, $step);
}
return $result;
}
}
\ No newline at end of file
<?php
namespace app\model;
use think\Model;
class PushHistories extends Model
{
//
}
<?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
......@@ -421,6 +421,8 @@ Route::group('broker', [
'getSupervise' => ['api_broker/Supervise/getSupervise', [ 'method' => 'get' ] ], //监督执行列表
'sendSms' => ['api_broker/broker/sendSms', [ 'method' => 'post' ] ], //发送短信
'qrCode' => ['api_broker/broker/qrCode', [ 'method' => 'get' ] ], //生成二维码
'feedList' => ['api_broker/Feed/feedList', [ 'method' => 'get' ] ], //首页feed喜报
'editFeedClick' => ['api_broker/Feed/editFeedClick', [ 'method' => 'post' ] ], //feed流喜报点赞和页面浏览数量
......
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