Commit 3140e35e authored by clone's avatar clone

bug

parent 908f91d5
...@@ -83,24 +83,25 @@ class AppChat extends Basic ...@@ -83,24 +83,25 @@ class AppChat extends Basic
/* $params = array( /* $params = array(
"user_id" => 80, "user_id" => 80,
"mobile" => "15821506182", "mobile" => "15821506182",
"is_self" => 0是 1否
"source" => 1, //1经纪人 2用户 "source" => 1, //1经纪人 2用户
"device_id" => "ssss1231231123123", "device_id" => "ssss1231231123123",
"push_id" => "ssss1231231123123" "push_id" => "ssss1231231123123"
);*/ );*/
if (!isset($params['user_id']) || !isset($params['mobile']) || !isset($params['source']) || !isset($params['push_id'])) {
return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误");
}
$user_id = $params['user_id']; $user_id = $params['user_id'];
$mobile = $params['mobile']; $mobile = $params['mobile'];
$is_self = $params['is_self'];
$source = $params['source']; $source = $params['source'];
$device_id = $params['device_id']; $device_id = $params['device_id'];
$push_id = $params['push_id']; $push_id = $params['push_id'];
if (!$user_id || !$mobile || !$source || !$push_id) { if (!$is_self || !$source || !$user_id || !$mobile) {
return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误"); return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误");
} }
if ($is_self == 0 && (!$device_id || !$push_id)) {
return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误");
}
$only_arr = $this->_chat->register($user_id, $mobile, $source, $device_id, $push_id); $only_arr = $this->_chat->register($user_id, $mobile, $source, $device_id, $push_id);
...@@ -337,7 +338,7 @@ class AppChat extends Basic ...@@ -337,7 +338,7 @@ class AppChat extends Basic
if (!empty($params["relation_list"])) { if (!empty($params["relation_list"])) {
try { try {
$relation_ = json_decode($params["relation_list"], true); $relation_ = json_decode($params["relation_list"], true);
foreach ($relation_ as $item){ foreach ($relation_ as $item) {
$relation_list[$item["r_id"]][] = $item; $relation_list[$item["r_id"]][] = $item;
} }
} catch (Exception $exception) { } catch (Exception $exception) {
......
...@@ -88,7 +88,7 @@ class ChatService ...@@ -88,7 +88,7 @@ class ChatService
} }
//todo 保存或更新push_id //todo 保存或更新push_id
//todo 1.判断设备id +id 的数据是否存在,存在并且push_id和提交的不同则修改,否者新增 //todo 1.判断设备id +id 的数据是否存在,存在并且push_id和提交的不同则修改,否者新增
if ($id > 0) { if ($id > 0 && $device_id && $push_id) {
$this->savePushId($id, $device_id, $push_id); $this->savePushId($id, $device_id, $push_id);
} }
return [ "code" => 200, "only_id" => $only_id ]; return [ "code" => 200, "only_id" => $only_id ];
......
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