Commit fb8a933e authored by hujun's avatar hujun

修改报备推送

parent daae17f7
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/4/12
* Time: 15:19
*/
namespace app\api_broker\service;
use app\api\untils\GeTuiUntils;
use app\model\GHousesToAgents;
class PushMessageService
{
private $push;
public function __construct()
{
$this->push = new GeTuiUntils();
}
/**
* @param $house_id
* @param int $type
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function pushReportMessage($house_id, $type = 1) {
$house = new GHousesToAgents();
$ge_tui = new GeTuiUntils();
$data = $house->getAgentList($house_id, $type);
foreach ($data as $k => $v) {
$content = "【{$v['store_name']}】店【{$v['name']}】约带看【{$v['internal_title']}】商铺";
$ge_tui->public_push_message_for_one($v['id'], $v['device_id'], '报备', $content);
}
return ;
}
}
\ No newline at end of file
......@@ -78,24 +78,17 @@ class ReportService
if ($id > 0) {
$house_arr = explode(",", $house_ids);
$order_arr = [];
$agent = new GHousesToAgents();
$ge_tui = new GeTuiUntils();
$push = new PushMessageService();
foreach ($house_arr as $k => $v) {
//todo 批量插入到数据库
$order_no = $this->createOrderNumber();
array_push($order_arr, $this->orderBin($order_no, $id, $v));
$device_id = $agent->getAgentList($v);
foreach ($device_id as $k => $v) {
$content = "【{$v['store_name']}】店【{$agent_name}】约带看【{$order_arr['house_title']}】商铺";
$ge_tui->public_push_message_for_one($v['id'], $v['device_id'], '报备', $content);
}
$push->pushReportMessage($v); //推送报备信息
}
//todo 保存order表
return $this->orderModel->insertOrderByAll($order_arr);
}
}
/**
......
......@@ -382,7 +382,10 @@
<li class="list-group-item">
<label for="">商铺标签(可多选)</label>
<label class="checkbox-inline">
<input type="checkbox" class="roomTag" id="" value="临近地铁" name="shangpu_tags[]">临近地铁
<input type="checkbox" class="roomTag" id="" value="购物广场" name="shangpu_tags[]">购物广场
</label>
<label class="checkbox-inline">
<input type="checkbox" class="roomTag" id="" value="临近地铁" name="shangpu_tags[]">临近地铁
</label>
<label class="checkbox-inline">
<input type="checkbox" class="roomTag" id="" value="临街旺铺" name="shangpu_tags[]">临街旺铺
......
......@@ -196,10 +196,11 @@ class GHousesToAgents extends BaseModel
* @throws \think\exception\DbException
*/
public function getAgentList($house_id, $type = 1) {
return $this->field('b.id,device_id,store_name')
return $this->field('b.id,device_id,store_name,d.internal_title,b.name')
->alias('a')
->join('a_agents b', 'a.agents_id = b.id','left')
->join('a_store c', 'b.store_id = c.id','left')
->join('g_houses d', 'd.id = a.houses_id', 'left')
->where('houses_id', $house_id)
->where('type', $type)
->select();
......
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