Commit ff5b8018 authored by clone's avatar clone

bug

parent 7043b84a
...@@ -117,7 +117,7 @@ class AppChat extends Basic ...@@ -117,7 +117,7 @@ class AppChat extends Basic
|| !isset($params['source']) || !isset($params['is_user']) || !isset($params['from'])) { || !isset($params['source']) || !isset($params['is_user']) || !isset($params['from'])) {
return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误"); return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误");
} }
/*$params = array( /* $params = array(
'msg_content' => '111', 'msg_content' => '111',
'target_type' => 'users', 'target_type' => 'users',
'source' => '1', 'source' => '1',
......
...@@ -99,7 +99,7 @@ class ChatService ...@@ -99,7 +99,7 @@ class ChatService
$userResult = $this->userModel->selectUser($userId); $userResult = $this->userModel->selectUser($userId);
if ($userResult->id) if ($userResult->id)
$onlyId = self::SOURCE_TYPE_APP . $userId; $onlyId = self::SOURCE_TYPE_APP . $userResult->id;
break; break;
} }
if (!$onlyId) { if (!$onlyId) {
...@@ -143,7 +143,7 @@ class ChatService ...@@ -143,7 +143,7 @@ class ChatService
$rPush = new RPush(); $rPush = new RPush();
//todo 消息接收人必须是数据 //todo 消息接收人必须是数据
$rPush->send($target_type, [$target], $type, $msg_content, $from, $accessToken, [ $this, 'saveSendStatus' ]); // $rPush->send($target_type, [$target], $type, $msg_content, $from, $accessToken, [ $this, 'saveSendStatus' ]);
//返回消息发送成功 //返回消息发送成功
return true; return true;
} }
...@@ -188,6 +188,7 @@ class ChatService ...@@ -188,6 +188,7 @@ class ChatService
$msgModel = new ChatMsg(); $msgModel = new ChatMsg();
$id = $msgModel->addChatMsg($params); $id = $msgModel->addChatMsg($params);
if ($id > 0) { if ($id > 0) {
//todo 插入msg_ext //todo 插入msg_ext
$group_id = 0; $group_id = 0;
...@@ -208,16 +209,16 @@ class ChatService ...@@ -208,16 +209,16 @@ class ChatService
*/ */
private function insetMsgExt($id, $type, $msg_content, $is_group, $group_id) private function insetMsgExt($id, $type, $msg_content, $is_group, $group_id)
{ {
$params["msg_id"] = $id; $param["msg_id"] = $id;
$params["type"] = $type; $param["type"] = $type;
$params["body"] = $msg_content; $param["body"] = $msg_content;
$params["send_type"] = $is_group; $param["send_type"] = $is_group;
$params["group_id"] = $group_id; $param["group_id"] = $group_id;
$params["create_at"] = date("Y-m-d H:i:s", time()); $param["create_at"] = date("Y-m-d H:i:s", time());
$params["updated_at"] = date("Y-m-d H:i:s", time()); $param["updated_at"] = date("Y-m-d H:i:s", time());
$msgExtModel = new ChatMsgExt(); $msgExtModel = new ChatMsgExt();
$msgExtModel->addChatMsgExt($params); $msgExtModel->addChatMsgExt($param);
} }
/** 获取聊天记录 /** 获取聊天记录
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace app\chat\utils; namespace app\chat\utils;
use app\chat\consts\ConfigConst; use app\chat\consts\ConfigConst;
use Think\Log;
/** /**
...@@ -53,6 +54,7 @@ class RPush ...@@ -53,6 +54,7 @@ class RPush
'from' => $from, 'from' => $from,
); );
$data = json_encode($arr); $data = json_encode($arr);
echo $data;echo "-------------";
$curl = new \app\chat\utils\CurlUtil(); $curl = new \app\chat\utils\CurlUtil();
$curl->headers = [ $curl->headers = [
"Accept" => "application/json", "Accept" => "application/json",
...@@ -65,7 +67,7 @@ class RPush ...@@ -65,7 +67,7 @@ class RPush
]; ];
$url = $this->buildSendUrl(); $url = $this->buildSendUrl();
$response = $curl->post($url, $data); $response = $curl->post($url, $data);
dump($response); Log::record('info -------------', json_encode($response));
return $response; return $response;
} }
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
# http://curl.haxx.se/docs/http-cookies.html # http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk. # This file was generated by libcurl! Edit at your own risk.
a1.easemob.com FALSE / FALSE 1516416547 rememberMe deleteMe a1.easemob.com FALSE / FALSE 1516419232 rememberMe deleteMe
...@@ -29,8 +29,8 @@ class ChatMsg extends Model ...@@ -29,8 +29,8 @@ class ChatMsg extends Model
try { try {
$this->save($params); $this->save($params);
$id = $this->id; $id = $this->id;
return $id;
Db::commit(); Db::commit();
return $id;
} catch (\Exception $e) { } catch (\Exception $e) {
Db::rollback(); Db::rollback();
......
...@@ -20,18 +20,17 @@ class ChatMsgExt extends Model ...@@ -20,18 +20,17 @@ class ChatMsgExt extends Model
public function __construct() public function __construct()
{ {
$this->db = Db($this->table); $this->db = Db::name($this->table);
} }
public function addChatMsgExt($params) public function addChatMsgExt($params)
{ {
Db::startTrans(); Db::startTrans();
try { try {
$this->save($params); $this->db->insert($params);
$id = $this->id;
return $id;
Db::commit(); Db::commit();
} catch (\Exception $e) { } catch (\Exception $e) {
dump($e);
Db::rollback(); Db::rollback();
} }
......
...@@ -258,3 +258,29 @@ response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?> ...@@ -258,3 +258,29 @@ response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<statusMsg>IP鉴权失败</statusMsg> <statusMsg>IP鉴权失败</statusMsg>
</Response> </Response>
request body = <TemplateSMS>
<to>18756256666</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>3450</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=40EE1C43A1B08B698B610DC95026AF74
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>18756255555</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>5919</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=8DABD7C3A3D79365F4AA65E92613F6A1
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
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