Commit bf222dae authored by hujun's avatar hujun

推送

parent a8da17ee
......@@ -83,7 +83,8 @@ class Report extends Basic
/*记录推送*/
$push = new PushMessageService();
$house_ids_arr = explode(',', $house_ids);
if (is_array($house_ids)) {
if (is_array($house_ids_arr)) {
foreach ($house_ids_arr as $k=>$v) {
$push->pushReportMessage($v, $agent_id, 1, $this->agentId); //推送报备信息
}
......
......@@ -51,18 +51,20 @@ class PushMessageService
$data = $house_agent->getHousesAgents($house_id, 'b.id', [ 'type' => $type ]);
$agent_name = $agent->getAgentsStoreById([ 'a.id' => $agent_id ], 'name,store_name');
$house_data = $house->getHouseDetail('internal_title', [ 'id' => $house_id ]);
$order_id = $m_report->getReportOrder('b.order_id',['a.report_agent_id'=>$agent_id]);
$order_id = $m_report->getReportOrder('b.id',['a.report_agent_id'=>$agent_id]);
foreach ($data as $k => $v) {
$content = "【{$agent_name['store_name']}】店【{$agent_name['name']}】约带看【{$house_data['internal_title']}】商铺";
// $this->pushAgentAllDeviceId($v['id'], '报备', $content);
$data['content'] = $content;
$data['order_id'] = $order_id;
$data['house_id'] = $house_id;
$this->record(6, 0, $agent_id, $operation_id, $data);
$save['message'] = $content;
$save['order_id'] = $order_id['id'];
$save['house_id'] = $house_id;
$this->record(6, 0, [$agent_id], $operation_id, $save);
}
$result = true;
} catch (\Exception $e) {
$result = false;
var_dump($e->getMessage());die;
}
return $result;
......@@ -361,13 +363,13 @@ class PushMessageService
$title = '收款';
$type = 'timer_shaft';
break;
case 6:
case 7:
$title = '报备';
$type = 'timer_shaft';
break;
}
$this->pushAgentAllDeviceId($v['addressee_id'], $title, $v['message'], $type, $id, $is_forbidden);
$this->pushAgentAllDeviceId($v['addressee_id'], $title, $v['message'], $type, $id, $is_forbidden,$v['house_id'], $v['order_id']);
$update_data['status'] = 1;
$update_data['send_time'] = date('Y-m-d H:i:s');
......
......@@ -724,17 +724,19 @@ class OReportModel extends Model
*
* @param $field
* @param $where
* @param string $order
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getReportOrder($field, $where)
public function getReportOrder($field, $where, $order = 'id desc')
{
return $this->field($field)
return $this->db->field($field)
->alias('a')
->join('o_order b', 'b.f_id=a.id', 'left')
->where($where)
->order($order)
->find();
}
......
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