Commit efe933f9 authored by clone's avatar clone

chat

parent cfc5c200
...@@ -111,21 +111,21 @@ class AppChat extends Basic ...@@ -111,21 +111,21 @@ class AppChat extends Basic
public function pushMsg() public function pushMsg()
{ {
/* $params = $this->params; $params = $this->params;
if (!isset($params['target_type']) || !isset($params['target']) || !isset($params['type']) || !isset($params['msg_content']) if (!isset($params['target_type']) || !isset($params['target']) || !isset($params['type']) || !isset($params['msg_content'])
|| !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' => '看看', 'msg_content' => '111',
'target_type' => 'users', 'target_type' => 'users',
'source' => '1', 'source' => '1',
'from' => 'app_64', 'from' => 'app_64',
'type' => '1', 'type' => '1',
'is_user' => '0', 'is_user' => '0',
'target' => 'app_63', 'target' => '18112347151',
); );*/
$target_type = $params['target_type']; // 消息类型 users 给用户发消息。chatgroups: 给群发消息,chatrooms: 给聊天室发消息 $target_type = $params['target_type']; // 消息类型 users 给用户发消息。chatgroups: 给群发消息,chatrooms: 给聊天室发消息
$target = $params['target']; //接受人 if target_type 群 者表示群id $target = $params['target']; //接受人 if target_type 群 者表示群id
$source = $params['source']; //消息来源 1c端app 2b端app 3其他 $source = $params['source']; //消息来源 1c端app 2b端app 3其他
......
...@@ -44,7 +44,7 @@ class RPush ...@@ -44,7 +44,7 @@ class RPush
* @param $access_token * @param $access_token
* @return \app\chat\utils\CurlResponse|bool * @return \app\chat\utils\CurlResponse|bool
*/ */
public function sendRequestByCurl($target_type, $target, $type, $msg_content, $from, $access_token) public function sendRequestByCurl($target_type, $target, $type, $msg_content, $from ,$access_token)
{ {
$arr = array( $arr = array(
'target_type' => $target_type, 'target_type' => $target_type,
...@@ -53,13 +53,14 @@ class RPush ...@@ -53,13 +53,14 @@ 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",
"Content-Type" => "application/json;charset=utf-8", "Content-Type" => "application/json;charset=utf-8",
'Authorization' => "Bearer " .$access_token, 'Authorization' => "Bearer " . $access_token,
]; ];
$curl->options = [ $curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0, "CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2, "CURLOPT_SSL_VERIFYHOST" => 2,
...@@ -76,6 +77,6 @@ class RPush ...@@ -76,6 +77,6 @@ class RPush
*/ */
private function buildSendUrl() private function buildSendUrl()
{ {
return ConfigConst::API_PATH . ConfigConst::ORG_NAME . "/" . ConfigConst::APP_NAME; return ConfigConst::API_PATH . ConfigConst::ORG_NAME . "/" . ConfigConst::APP_NAME . "/messages";
} }
} }
\ No newline at end of file
...@@ -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 1516356939 rememberMe deleteMe a1.easemob.com FALSE / FALSE 1516416547 rememberMe deleteMe
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