Commit 9987a87b authored by hujun's avatar hujun

是否评价检测

parent 4d401290
......@@ -11,6 +11,7 @@ use app\model\GHouses;
use app\model\GHousesImgs;
use app\model\GHousesToAgents;
use app\model\GImageDepot;
use app\model\OPushMessageModel;
use app\model\OReportModel;
use app\model\Users;
......@@ -294,5 +295,34 @@ class AppointmentTime extends Basic
}
/**
* 检查是有未评价
*
* @return \think\Response
*/
public function checkAppointment()
{
$data['name'] = $msg = "";
try {
$m_push = new OPushMessageModel();
$where['user_id'] = $this->userId;
// $where['user_id'] = 122;
$where['status'] = 0;
$id = $m_push->getListByWhere('id,operation_id,message', $where, 1, 1);
if (empty($id[0]['id'])) {
$data['is_alert'] = 0;
} else {
$data['name'] = $id[0]['message'];
$data['is_alert'] = 1;
}
} catch (\Exception $e) {
$data = [];
$msg = "内部错误:".$e->getMessage();
}
return $this->response(200, $msg, $data);
}
}
\ No newline at end of file
......@@ -44,8 +44,7 @@ class PushClientService
if (empty($message)) {
$m_agent = new AAgents();
$name = $m_agent->getAgentsById($operation_id, 'name');
$message = '同联商业邀请您评价经纪人'.$name.'对商铺的带看服务';
$message = $m_agent->getAgentsById($operation_id, 'name');
}
$data['message'] = $message;
$data['order_id'] = $order_id;
......@@ -60,7 +59,7 @@ class PushClientService
public function pushRecord()
{
$title = $type = '';
$field = 'id,addressee_id,type,message,house_id,user_id,order_id';
$field = 'id,operation_id,type,message,house_id,user_id,order_id';
$where['status'] = $id = $is_forbidden = 0;
$push_data = $this->m_push->getDateLimit($field, $where, 100);
......@@ -68,12 +67,10 @@ class PushClientService
switch ($v['type']) {
case 0 :
$title = "评价经纪人";
$id = $v['house_id'];
$type = 'evaluate';
break;
}
$this->pushAgentAllDeviceId($v['addressee_id'], $title, $v['message'], $type, $id, $is_forbidden,$v['house_id'], $v['order_id']);
$this->pushAgentAllDeviceId($v['operation_id'], $title, $v['message'], $type, $v['user_id'], $is_forbidden, $v['house_id'], $v['order_id']);
$update_data['status'] = 1;
$update_data['send_time'] = date('Y-m-d H:i:s');
......@@ -96,16 +93,22 @@ class PushClientService
*/
public function pushAgentAllDeviceId($id, $title, $content, $type = 0, $user_id = 0, $is_forbidden = 0, $house_id = 0, $order_id = 0)
{
if (empty($id)) {
if (empty($user_id)) {
return false;
}
$push = new GeTuiUtils('client');
$chat = new ChatUser();
$chat_ext = new ChatUserExt();
$ext_id = $chat->getFieldValue('id', ['uesr_id'=>$user_id, 'type'=>2]);
$push_id = $chat_ext->getInfo('push_id', ['ext_id'=>$ext_id, 'is_forbidden'=>$is_forbidden]);
$result = $push->public_push_message_for_one($user_id, $push_id['push_id'], $title, $content, $type, $user_id, $house_id, $order_id);
$ext_id = $chat->getFieldValue('id', ['user_id'=>$user_id, 'type'=>2]);
if (empty($ext_id)) {
$result = false;
} else {
$push_id = $chat_ext->getInfo('push_id', ['ext_id'=>$ext_id, 'is_forbidden'=>$is_forbidden]);
$result = $push->public_push_message_for_one($id, $push_id['push_id'], $title, $content, $type, $user_id, $house_id, $order_id);
}
return $result;
}
}
\ No newline at end of file
......@@ -11,13 +11,14 @@ namespace app\model;
use think\Db;
class OPushMessageModel
class OPushMessageModel extends BaseModel
{
protected $table = "u_push_message";
private $db_;
public function __construct()
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
......
......@@ -423,6 +423,7 @@ Route::group('api', [
//post AppointmentTime
'getAppointmentSeeShopList' => ['api/appointmentTime/getAppointmentSeeShopList', ['method' => 'post|get']],
'addAppointmentSeeShop' => ['api/appointmentTime/addAppointmentSeeShop', ['method' => 'post|get']],
'checkAppointment' => ['api/appointmentTime/checkAppointment', ['method' => 'get']],
//tradeLog
......
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