Commit 7e7e4166 authored by clone's avatar clone

Merge branch 'chat_0818' of https://gitee.com/zwyjjc/tl_estate into chat_0818

parents 5e019481 00cd4cd0
<?php
//配置文件
return [
];
\ No newline at end of file
<?php
namespace app\chat\consts;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/9
* Time : 13:27
* Intro:
*/
class ConfigConst
{
const CLIENT_ID = "YXA6hqlTwLr0EeeNFrlhHiI-Xg";
const CLIENT_SECRET = "YXA6BkraoPZqZYJoLce4sCyRebXMC48";
const API_PATH = "https://a1.easemob.com/";
const ORG_NAME = "1157170531115254";
const APP_NAME = "tonglianjituan";
}
\ No newline at end of file
<?php
namespace app\chat\consts;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/9
* Time : 16:54
* Intro:
*/
class ErrorCodeConst
{
//聊天
const ERROR_CODE_PARAM_NOT_EXIST = 110001;
const ERROR_CODE_TARGET_TYPE_ERROR = 110002;
}
\ No newline at end of file
<?php
namespace app\chat\controller;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/8
* Time : 16:54
* Intro:
*/
use app\chat\consts\ErrorCodeConst;
use app\chat\extend\Basic;
use app\chat\service\ChatService;
use app\chat\utils\RPush;
use app\extra\RedisPackage;
use app\model\ChatMsg;
use think\Cache;
use Think\Log;
class AppChat extends Basic
{
/**
* @var RPush
*/
private $_push;//环信接口消息推送
/**
* @var ChatService
*/
private $_chat;
public function __construct($request = null)
{
parent::__construct($request);
$this->_push = new RPush();
$this->_chat = new ChatService();
}
public function index()
{
/*
log 常规日志,用于记录日志
error 错误,一般会导致程序的终止
notice 警告,程序可以运行但是还不够完美的错误
info 信息,程序输出信息
debug 调试,用于调试信息
sql SQL语句,用于SQL记录,只在数据库的调试模式开启时有效
*/
Cache::set('name', '121212');
echo Cache::get('name');
$redis = new RedisPackage();
$redis::set('test', 'hello redis');
echo $redis::get('test');
Log::record('日志', 'notice');
return null;
}
/**
* 验证用户角色,生成唯一id
*
* @return \think\Response
*/
public function userChat()
{
/* $params = array(
"user_id" => 1,
"mobile" => "15720682761",
"source" => 2 //1经纪人 2用户
);*/
$params = $this->params;
if (!isset($params['user_id']) || !isset($params['mobile']) || !isset($params['source'])) {
return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误");
}
$user_id = $params['user_id'];
$mobile = $params['mobile'];
$source = $params['source'];
$only_arr = $this->_chat->register($user_id, $mobile, $source);
if ($only_arr["code"] == 200) {
return $this->response("200", "success", [ "only_id" => $only_arr["only_id"] ]);
} else {
return $this->response("101", $only_arr["msg"]);
}
}
/**
* c端根据经纪人的手机号获取唯一id
* @return \think\Response
*/
public function getAgentOnlyId()
{
//todo
return $this->response("200", "success", "");
}
public function getUserOrAgentInfo()
{
$params = $this->params;
if (!isset($params['id']) || !isset($params['type'])) {
return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误");
}
$params = array(
"id" => 1,
"type" => 1,//1用户 or 2经纪人
);
$this->_chat->getUserInfo();
}
/**
* 发送消息接口
* @return \think\Response
*/
public function pushMsg()
{
$params = $this->params;
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'])) {
return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误");
}
/* $params = array(
'msg_content' => '111',
'target_type' => 'users',
'source' => '1',
'from' => 'app_64',
'type' => '1',
'is_user' => '0',
'target' => '18112347151',
);*/
$target_type = $params['target_type']; // 消息类型 users 给用户发消息。chatgroups: 给群发消息,chatrooms: 给聊天室发消息
$target = $params['target']; //接受人 if target_type 群 者表示群id
$source = $params['source']; //消息来源 1c端app 2b端app 3其他
$is_user = $params['is_user']; //发送人是否是会员 0是1经济人
$type = $params['type']; //消息类型 1文字 2图片 3楼盘
$msg_content = $params['msg_content'];
$from = $params['from']; //消息发送人
if ($target_type != "users" && $target_type != "chatgroups" && $target_type != "chatrooms") {
return $this->response(ErrorCodeConst::ERROR_CODE_TARGET_TYPE_ERROR, "错误的消息类型");
}
$result = $this->_chat->sendMsg($target_type, $target, $source, $is_user, $type, $msg_content, $from, $this->accessToken);
if (count($result) > 0) {
return $this->response("200", "", [ "msg" => "消息发送成功" ]);
}
}
/**
* 查询历史和搜索历史
* @return \think\Response
*/
public function getChatHistory()
{
$params = $this->params;
if (!isset($params['target_type']) || !isset($params['from']) || !isset($params['target'])) {
return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误");
}
/* $params = array(
'target_type' => 'users', // 消息类型 users 用户消息。chatgroups: 群消息,chatrooms: 聊天室消息
'from' => 'app_64', //发送人
'target' => '18112347151', //接受人
'page_no' => '1', //第几页
'page_size' => '15' //每页多少条
);*/
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$field = "a.id,a.to_id,a.from_id,a.created_at,b.type,b.body";
$msgModel = new ChatMsg();
$history_result = $msgModel->getChatHistory($params, $field, $page_no, $page_size);
if ($history_result) {
return $this->response("200", "request success", array_reverse($history_result));
}
}
}
<?php
namespace app\chat\controller;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/23
* Time : 13:47
* Intro:
*/
use app\chat\extend\Basic;
class Group extends Basic
{
public function createGroupByOnlyId()
{
//todo 组群创建 1.存表,2调用环信接口
}
public function updateGroup()
{
//todo 修改组群信息 1.群信息完善到后台表 无需调用环信接口
}
public function delGroup()
{
//todo 删除群组 1.改变我们group表的状态2.调用环信删群接口
}
/**
* 群组管理
*/
public function getGroupUser()
{
//todo 获取群组成员/管理员 我们的数据库获取
}
public function addGroupUserByIds()
{
//todo 添加群组成员 1.单个/多个到表中,2.调用环信接口更新进去
}
public function delGroupUserByIds()
{
//todo 移除群组成员 1.单个或多个跟新到库, 2.调用环信接口更新
}
public function addGroupManage()
{
//todo 添加群组管理员 1.单个更新到库, 2.调用环信接口更新
}
public function delGroupManage()
{
//todo 移除群组管理员 1.单个更新到库, 2.调用环信接口更新
}
}
\ No newline at end of file
<?php
namespace app\chat\extend;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/8
* Time : 16:54
* Intro:
*/
use app\chat\consts\ConfigConst;
use app\chat\utils\CurlUtil;
use http\Exception;
use think\Cache;
use think\Controller;
use Think\Log;
use think\Request;
use think\Response;
class Basic extends Controller
{
/**
* 访问请求对象
* @var Request
*/
public $request;
/**
* 请求参数
* @var mixed|null
*/
public $params;
/**
* app通讯接口授权token
* @var
*/
public $accessToken;
/**
* 基础接口SDK
* @param Request|null $request
*/
public function __construct(Request $request = null)
{
// CORS 跨域 Options 检测响应
$this->corsOptionsHandler();
// 输入对象
$this->request = is_null($request) ? Request::instance() : $request;
if (strtoupper($this->request->method()) === "GET") {
$this->params = $this->request->param();
} elseif (strtoupper($this->request->method()) === "POST") {
$this->params = $this->request->param() != null ? $this->request->param() : null;
}
$this->accessToken = Cache::get('access_token');
$expires_in = Cache::get('expires_in');
$application = Cache::get('application');
$accredit_time = Cache::get('accredit_time');
if (!$this->accessToken || !$expires_in || !$application || !$accredit_time || (time() - $accredit_time) > $expires_in) {
//todo 这里加个验证 多少时间内不能重复请求
$this->getToken();
if (Cache::get('access_token')) {
$this->accessToken = Cache::get('access_token');
} else {
echo json_encode(array( "code" => "300", "msg" => "accessToken拉取失败,请稍后再试!", "data" => [], "type" => "json" ));
exit;
}
}
}
/**
* 输出返回数据
* @param string $msg 提示消息内容
* @param string $code 业务状态码
* @param mixed $data 要返回的数据
* @param string $type 返回类型 JSON XML
* @return Response
*/
public function response($code = 'SUCCESS', $msg, $data = [], $type = 'json')
{
$result = [ 'code' => $code, 'msg' => $msg, 'data' => $data, 'type' => strtolower($type) ];
return Response::create($result, $type);
}
public function getApiPath()
{
return ConfigConst::API_PATH . ConfigConst::ORG_NAME . "/" . ConfigConst::APP_NAME;
}
/**
* Cors Options 授权处理
*/
public static function corsOptionsHandler()
{
if (request()->isOptions()) {
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Headers:Accept,Referer,Host,Keep-Alive,User-Agent,X-Requested-With,Cache-Control,Content-Type,Cookie,token');
header('Access-Control-Allow-Credentials:true');
header('Access-Control-Allow-Methods:GET,POST,OPTIONS');
header('Access-Control-Max-Age:1728000');
header('Content-Type:text/plain charset=UTF-8');
header('Content-Length: 0', true);
header('status: 204');
header('HTTP/1.0 204 No Content');
exit;
}
}
/**
* 获取调取接口的access_token
*/
public function getToken()
{
$url = "/token";
$data = [
"grant_type" => "client_credentials",
"client_id" => ConfigConst::CLIENT_ID,
"client_secret" => ConfigConst::CLIENT_SECRET
];
$curl = new CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$apiUrl = $this->getApiPath() . $url;
try {
$response = $curl->post($apiUrl, json_encode($data));
$response = json_decode($response,true);
if ($response) {
Cache::set('access_token', $response["access_token"]);
Cache::set('expires_in', $response["expires_in"]);
Cache::set('application', $response["application"]);
Cache::set('accredit_time', time());
}
} catch (Exception $e) {
Log::record('class:Basic,function:getToken get token ,Exception :' . $e, "error");
}
Log::record('class:Basic,function:getToken get token' , "info");
}
}
<?php
namespace app\chat\service;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/8
* Time : 16:54
* Intro:
*/
use app\chat\utils\RegisterUtil;
use app\chat\utils\RPush;
use app\model\Agents;
use app\model\ChatMsg;
use app\model\ChatMsgExt;
use app\model\ChatUser;
use app\model\Users;
class ChatService
{
public $connection;
public $logs;
const MSG_CONTENT_TYPE_TEXT = 1; //文字
const MSG_CONTENT_TYPE_VOICE = 2; //语音
const MSG_CONTENT_TYPE_VIDEO = 3; //视频
const MSG_TYPE_USERS = "users"; //给用户发消息
const MSG_TYPE_CHAT_GROUPS = "chatgroups"; //给群发消息
const MSG_TYPE_CHAT_CHAT_ROOMS = "chatrooms"; //给聊天室发消息
const SOURCE_TYPE_APP = 'user_'; // 用户 c端
const SOURCE_TYPE_AGENT = 'agent_';//经纪人 b端
protected $userModel;
protected $agentsModel;
protected $chatUserModel;
public function __construct()
{
$this->userModel = new Users();
$this->agentsModel = new Agents();
$this->chatUserModel = new ChatUser();
}
/**
* @param $user_id
* @param $mobile
* @param $source
* @return array
*/
public function register($user_id, $mobile, $source)
{
//todo
$params["type"] = $source;
$params["user_id"] = $user_id;
$params["phone"] = $mobile;
$fields = "id,type,phone,only_id,password";
$chatUser = $this->chatUserModel->getChatUser($params, $fields);
if (count($chatUser) > 0) {
return [ "code" => "200", "only_id" => $chatUser[0]["only_id"] ];
} else {
$reg = new RegisterUtil();
$only_id = $this->createOnlyId($user_id, $source);
if (!$only_id) {
return [ "code" => "101", "msg" => "user msg not found" ];
}
$response = $reg->registerByCurl($only_id, $mobile);
if ($response) {
//todo insert
$this->insertChatUser($source, $user_id, $mobile, $only_id);
}
return [ "code" => 200, "only_id" => $only_id ];
}
}
/**
* 生成唯一id
* @param $userId integer 用户id
* @param $source integer 来源 '1经纪人 2用户'
* @return string
*/
public function createOnlyId($userId, $source)
{
$onlyId = "";
switch ($source) {
case 1:
$agentsResult = $this->agentsModel->getAgentsById("id", $userId);
if (count($agentsResult) > 1)
$onlyId = self::SOURCE_TYPE_AGENT . $userId;
break;
case 2:
$userResult = $this->userModel->selectUser($userId);
if ($userResult->id)
$onlyId = self::SOURCE_TYPE_APP . $userResult->id;
break;
}
if (!$onlyId) {
//return array( "code" => 101, "msg" => "没找到用户信息" );
return null;
}
return $onlyId;
}
/**
* 删除注册用户
* @param $only_id
* @param $access_token
* @return bool
*/
public function deleteUser($only_id, $access_token)
{
$reg = new RegisterUtil();
$reg->deleteByCurl($only_id, $access_token);
return true;
}
/**
* 发送消息
* @param $target_type
* @param $target
* @param $source
* @param $is_user
* @param $type
* @param $msg_content
* @param $from
* @param $accessToken
* @return bool
*/
public function sendMsg($target_type, $target, $source, $is_user, $type, $msg_content, $from, $accessToken)
{
//todo
$this->insertMsg($target_type, $target, $source, $is_user, $type, $msg_content, $from);
$rPush = new RPush();
//todo 消息接收人必须是数据
$rPush->send($target_type, [ $target ], $msg_content, $from, $type, $accessToken, [ $this, 'saveSendStatus' ]);
//返回消息发送成功
return true;
}
/**
* 保存推送到环信的消息状态 往msg_status中插入数据
* @param $response
* @param $target
* @param $from
* @param $msg_content
*/
public function saveSendStatus($response, $target, $from, $msg_content)
{
$response = json_decode($response, true);
$status = $response["data"][$target[0]];
if ($status === "success") {
//todo 保存成功
}
// $status = $response['statusCode'] == RPush::PUSH_STATUS_SUCCESS ? MsgStatus::STATUS_SUCCESS : MsgStatus::STATUS_FAILURE;
//$this->insertPushLog($sender, $target, $msg_content, $status, $response['statusMsg']);
}
public function getUserInfo($id, $type)
{
switch ($type) {
case 1:
$field = "id,";
$agentsResult = $this->agentsModel->getAgentsById($field, $id);
break;
case 2:
$userResult = $this->userModel->selectUser($id);
break;
}
}
/**
* 保存用户发送的消息
* @param $target_type
* @param $target
* @param $source
* @param $is_user
* @param $type
* @param $msg_content
* @param $from
*/
private function insertMsg($target_type, $target, $source, $is_user, $type, $msg_content, $from)
{
//todo
$params["msg_type"] = 1; //目前只用到了环信的文本消息
$params["to_id"] = $target;
$params["from_id"] = $from;
$params["is_group"] = $target_type == "users" ? 0 : 1;
$params["account_type"] = 1;
$params["source"] = $source;
$params["is_user"] = $is_user;
$params["created_at"] = date("Y-m-d H:i:s", time());
$params["updated_at"] = date("Y-m-d H:i:s", time());
$msgModel = new ChatMsg();
$id = $msgModel->addChatMsg($params);
if ($id > 0) {
//todo 插入msg_ext
$group_id = 0;
if ($target_type != "users") {
$group_id = $from;
}
$this->insetMsgExt($id, $type, $msg_content, $params["is_group"], $group_id);
}
}
/**
* 记录消息body
* @param $id
* @param $type
* @param $msg_content
* @param $is_group
* @param $group_id
*/
private function insetMsgExt($id, $type, $msg_content, $is_group, $group_id)
{
$param["msg_id"] = $id;
$param["type"] = $type;
$param["body"] = $msg_content;
$param["send_type"] = $is_group;
$param["group_id"] = $group_id;
$param["create_at"] = date("Y-m-d H:i:s", time());
$param["updated_at"] = date("Y-m-d H:i:s", time());
$msgExtModel = new ChatMsgExt();
$msgExtModel->addChatMsgExt($param);
}
/** 获取聊天记录
* @param $sender
* @param $start
* @param $limit
* @param $site_id
* @return array
*/
public function getHistoryChatList($sender, $start, $limit, $site_id)
{
//todo
}
/**
* 往chat_msg_status中插入数据,记录推送的状态
* @param $sender
* @param $target
* @param $content
* @param $status
* @param $error_reason
* @return bool
*/
public function insertPushLog($sender, $target, $content, $status, $error_reason)
{
//todo
return true;
}
/**
* @param $type
* @param $user_id
* @param $phone
* @param $only_id
* @return bool
*/
public function insertChatUser($type, $user_id, $phone, $only_id)
{
$params["type"] = $type;
$params["user_id"] = $user_id;
$params["phone"] = $phone;
$params["only_id"] = $only_id;
$params["password"] = $phone;
$params["last_login_time"] = date("Y-m-d H:i:s", time());
$params["created_at"] = date("Y-m-d H:i:s", time());
$params["updated_at"] = date("Y-m-d H:i:s", time());
$this->chatUserModel->addChatUser($params);
return true;
}
}
\ No newline at end of file
<?php
namespace app\chat\service;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/23
* Time : 14:15
* Intro:
*/
class GroupService
{
//todo
}
\ No newline at end of file
<?php
namespace app\chat\utils;
/**
* Parses the response from a Curl request into an object containing
* the response body and an associative array of headers
*
* @author qianfunian <qianfunian@51jk.com>
**/
class CurlResponse {
/**
* The body of the response without the headers block
*
* @var string
**/
public $body = '';
/**
* An associative array containing the response's headers
*
* @var array
**/
public $headers = array();
/**
* Accepts the result of a curl request as a string
*
* <code>
* $response = new CurlResponse(curl_exec($curl_handle));
* echo $response->body;
* echo $response->headers['Status'];
* </code>
*
* @param string $response
**/
function __construct($response) {
# Headers regex
$pattern = '#HTTP/\d\.\d.*?$.*?\r\n\r\n#ims';
# Extract headers from response
preg_match_all($pattern, $response, $matches);
$headers_string = array_pop($matches[0]);
$headers = explode("\r\n", str_replace("\r\n\r\n", '', $headers_string));
# Remove headers from the response body
$this->body = str_replace($headers_string, '', $response);
# Extract the version and status from the first header
$version_and_status = array_shift($headers);
preg_match('#HTTP/(\d\.\d)\s(\d\d\d)\s(.*)#', $version_and_status, $matches);
$this->headers['Http-Version'] = $matches[1];
$this->headers['Status-Code'] = $matches[2];
$this->headers['Status'] = $matches[2].' '.$matches[3];
# Convert headers into an associative array
foreach ($headers as $header) {
preg_match('#(.*?)\:\s(.*)#', $header, $matches);
$this->headers[$matches[1]] = $matches[2];
}
}
/**
* Returns the response body
*
* <code>
* $curl = new Curl;
* $response = $curl->get('google.com');
* echo $response; # => echo $response->body;
* </code>
*
* @return string
**/
function __toString() {
return $this->body;
}
}
\ No newline at end of file
<?php
namespace app\chat\utils;
/**
* A basic CURL wrapper
*
* @author qianfunian <qianfunian@51jk.com>
**/
class CurlUtil {
/**
* The file to read and write cookies to for requests
*
* @var string
**/
public $cookie_file;
/**
* Determines whether or not requests should follow redirects
*
* @var boolean
**/
public $follow_redirects = true;
/**
* An associative array of headers to send along with requests
*
* @var array
**/
public $headers = array();
/**
* An associative array of CURLOPT options to send along with requests
*
* @var array
**/
public $options = array();
/**
* The referer header to send along with requests
*
* @var string
**/
public $referer;
/**
* The user agent to send along with requests
*
* @var string
**/
public $user_agent;
/**
* Stores an error string for the last request if one occurred
*
* @var string
* @access protected
**/
protected $error = '';
/**
* Stores resource handle for the current CURL request
*
* @var resource
* @access protected
**/
protected $request;
/**
* Initializes a Curl object
*
* Sets the $cookie_file to "curl_cookie.txt" in the current directory
* Also sets the $user_agent to $_SERVER['HTTP_USER_AGENT'] if it exists, 'Curl/PHP '.PHP_VERSION.' (http://github.com/shuber/curl)' otherwise
**/
function __construct() {
$this->cookie_file = dirname(__FILE__).DIRECTORY_SEPARATOR.'curl_cookie.txt';
$this->user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'Curl/PHP ' . PHP_VERSION;
}
/**
* Makes an HTTP DELETE request to the specified $url with an optional array or string of $vars
*
* Returns a CurlResponse object if the request was successful, false otherwise
*
* @param string $url
* @param array|string $vars
* @return CurlResponse object
**/
function delete($url, $vars = array()) {
return $this->request('DELETE', $url, $vars);
}
/**
* Returns the error string of the current request if one occurred
*
* @return string
**/
function error() {
return $this->error;
}
/**
* Makes an HTTP GET request to the specified $url with an optional array or string of $vars
*
* Returns a CurlResponse object if the request was successful, false otherwise
*
* @param string $url
* @param array|string $vars
* @return CurlResponse
**/
function get($url, $vars = array()) {
$vars['platform_type'] = 130;
if (!empty($vars)) {
$url .= (stripos($url, '?') !== false) ? '&' : '?';
$url .= (is_string($vars)) ? $vars : http_build_query($vars, '', '&');
}
$file = new LogsService(LOGS_PATH.'/curl_get/' . date('Y-m-d'));
$file->info($url);
return $this->request('GET', $url);
}
/**
* Makes an HTTP HEAD request to the specified $url with an optional array or string of $vars
*
* Returns a CurlResponse object if the request was successful, false otherwise
*
* @param string $url
* @param array|string $vars
* @return CurlResponse
**/
function head($url, $vars = array()) {
return $this->request('HEAD', $url, $vars);
}
/**
* Makes an HTTP POST request to the specified $url with an optional array or string of $vars
*
* @param string $url
* @param array|string $vars
* @return CurlResponse|boolean
**/
function post($url, $vars = array()) {
if (!is_string($vars)) {
$vars['platform_type'] = 130;
}
return $this->request('POST', $url, $vars);
}
/**
* Makes an HTTP PUT request to the specified $url with an optional array or string of $vars
*
* Returns a CurlResponse object if the request was successful, false otherwise
*
* @param string $url
* @param array|string $vars
* @return CurlResponse|boolean
**/
function put($url, $vars = array()) {
return $this->request('PUT', $url, $vars);
}
/**
* Makes an HTTP request of the specified $method to a $url with an optional array or string of $vars
*
* Returns a CurlResponse object if the request was successful, false otherwise
*
* @param string $method
* @param string $url
* @param array|string $vars
* @return CurlResponse|boolean
**/
function request($method, $url, $vars = array()) {
$this->error = '';
$this->request = curl_init();
if (is_array($vars)) $vars = http_build_query($vars, '', '&');
$this->set_request_method($method);
$this->set_request_options($url, $vars);
$this->set_request_headers();
$response = curl_exec($this->request);
if ($response) {
$response = new CurlResponse($response);
} else {
$this->error = curl_errno($this->request).' - '.curl_error($this->request);
}
curl_close($this->request);
return $response;
}
/**
* Formats and adds custom headers to the current request
*
* @return void
* @access protected
**/
protected function set_request_headers() {
$headers = array();
foreach ($this->headers as $key => $value) {
$headers[] = $key.': '.$value;
}
curl_setopt($this->request, CURLOPT_HTTPHEADER, $headers);
}
/**
* Set the associated CURL options for a request method
*
* @param string $method
* @return void
* @access protected
**/
protected function set_request_method($method) {
switch (strtoupper($method)) {
case 'HEAD':
curl_setopt($this->request, CURLOPT_NOBODY, true);
break;
case 'GET':
curl_setopt($this->request, CURLOPT_HTTPGET, true);
break;
case 'POST':
curl_setopt($this->request, CURLOPT_POST, true);
break;
default:
curl_setopt($this->request, CURLOPT_CUSTOMREQUEST, $method);
}
}
/**
* Sets the CURLOPT options for the current request
*
* @param string $url
* @param string $vars
* @return void
* @access protected
**/
protected function set_request_options($url, $vars) {
/* echo $url;
dump($vars);
dump($this->options);
echo $this->request;
exit;*/
curl_setopt($this->request, CURLOPT_URL, $url);
if (!empty($vars)) curl_setopt($this->request, CURLOPT_POSTFIELDS, $vars);
# Set some default CURL options
curl_setopt($this->request, CURLOPT_HEADER, true);
curl_setopt($this->request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->request, CURLOPT_USERAGENT, $this->user_agent);
if ($this->cookie_file) {
curl_setopt($this->request, CURLOPT_COOKIEFILE, $this->cookie_file);
curl_setopt($this->request, CURLOPT_COOKIEJAR, $this->cookie_file);
}
if ($this->follow_redirects) curl_setopt($this->request, CURLOPT_FOLLOWLOCATION, true);
if ($this->referer) curl_setopt($this->request, CURLOPT_REFERER, $this->referer);
# Set any custom CURL options
foreach ($this->options as $option => $value) {
curl_setopt($this->request, constant('CURLOPT_'.str_replace('CURLOPT_', '', strtoupper($option))), $value);
}
}
}
\ No newline at end of file
<?php
namespace app\chat\utils;
use app\chat\consts\ConfigConst;
use Think\Log;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/8
* Time : 17:17
* Intro: 发送消息类
*/
class RPush
{
/**
* 发送消息
* @param $target_type
* @param $target
* @param $msg_content
* @param $from
* @param $type
* @param $access_token
* @param $callback
*/
public function send($target_type, $target, $msg_content, $from, $type, $access_token, $callback)
{
//todo 这里做算法优化,环信接口有限制,每个时间段最多能推送多少请求
$response = $this->sendRequestByCurl($target_type, $target, $msg_content, $from, $type, $access_token);
call_user_func_array([ $callback[0], $callback[1] ], [ $response, $target, $from, $msg_content ]);
}
/** curl参数拼凑
* @param $target_type users 给用户发消息。chatgroups: 给群发消息,chatrooms: 给聊天室发消息
* @param $target 注意这里需要用数组,数组长度建议不大于20,即使只有一个用户,也要用数组 ['u1'],给用户发送时数组元素是用户名,
* 给群组发送时数组元素是groupid
* @param $type //目前只有文本的消息
* @param $msg_content
* @param $from
* @param $type
* @param $access_token
* @return \app\chat\utils\CurlResponse|bool
*/
public function sendRequestByCurl($target_type, $target, $msg_content, $from, $type, $access_token)
{
$arr = array(
'target_type' => $target_type,
'target' => $target,
'msg' => [ "type" => "txt", "msg" => $msg_content ],
'from' => $from,
'ext' => [ "msg_type" => $type ]
);
$data = json_encode($arr);
$curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
'Authorization' => "Bearer " . $access_token,
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl();
$response = $curl->post($url, $data);
Log::record('info -------------' . json_encode($response), "info");
return $response;
}
/**
* 请求api
* @return string
*/
private function buildSendUrl()
{
return ConfigConst::API_PATH . ConfigConst::ORG_NAME . "/" . ConfigConst::APP_NAME . "/messages";
}
}
\ No newline at end of file
<?php
namespace app\chat\utils;
use app\chat\consts\ConfigConst;
use app\chat\utils;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/18
* Time : 14:47
* Intro: 注册环信用户
*/
class RegisterUtil
{
const IM_REGISTER_USER = "/users";
const IM_DELETE_USER = "/users";
/**
* @param $username
* @param $password
* @return CurlResponse|bool
*/
public function registerByCurl($username, $password)
{
$arr = array(
'username' => $username,
'password' => $password,
);
$data = json_encode($arr);
$curl = new CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl() . self::IM_REGISTER_USER;
$response = $curl->post($url, $data);
return $response;
}
/**
* @param $username
* @param $access_token
* @return CurlResponse|bool
*/
public function deleteByCurl($username, $access_token)
{
$arr = array(
'username' => $username,
);
$data = json_encode($arr);
$curl = new CurlUtil();
$curl->delete();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
'Authorization' => $access_token,
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl() . self::IM_DELETE_USER;
$response = $curl->post($url, $data);
return $response;
}
/**
* 请求api
* @return string
*/
private function buildSendUrl()
{
return ConfigConst::API_PATH . ConfigConst::ORG_NAME . "/" . ConfigConst::APP_NAME;
}
}
\ No newline at end of file
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
a1.easemob.com FALSE / FALSE 1516762819 rememberMe deleteMe
<?php
namespace app\extra;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/9
* Time : 15:20
* Intro: redis connect class
*/
class RedisPackage
{
protected static $handler = null;
protected $options = [
'host' => '101.132.186.250',
'port' => 6379,
'password' => '',
'select' => 0,
'timeout' => 0,
'expire' => 0,
'persistent' => false,
'prefix' => '',
];
public function __construct($options = [])
{
if (!extension_loaded('redis')) { //判断是否有扩展(如果你的apache没reids扩展就会抛出这个异常)
throw new \BadFunctionCallException('not support: redis');
}
if (!empty($options)) {
$this->options = array_merge($this->options, $options);
}
$func = $this->options['persistent'] ? 'pconnect' : 'connect'; //判断是否长连接
self::$handler = new \Redis;
self::$handler->$func($this->options['host'], $this->options['port'], $this->options['timeout']);
if ('' != $this->options['password']) {
self::$handler->auth($this->options['password']);
}
if (0 != $this->options['select']) {
self::$handler->select($this->options['select']);
}
}
/**
* 写入缓存
* @param string $key 键名
* @param string $value 键值
* @param int $exprie 过期时间 0:永不过期
* @return bool
*/
public static function set($key, $value, $exprie = 0)
{
if ($exprie == 0) {
$set = self::$handler->set($key, $value);
} else {
$set = self::$handler->setex($key, $exprie, $value);
}
return $set;
}
/**
* 读取缓存
* @param string $key 键值
* @return mixed
*/
public static function get($key)
{
$fun = is_array($key) ? 'Mget' : 'get';
return self::$handler->{$fun}($key);
}
/**
* 获取值长度
* @param string $key
* @return int
*/
public static function lLen($key)
{
return self::$handler->lLen($key);
}
/**
* 将一个或多个值插入到列表头部
* @param $key
* @param $value
* @return int
*/
public static function LPush($key, $value, $value2 = null, $valueN = null)
{
return self::$handler->lPush($key, $value, $value2, $valueN);
}
/**
* 移出并获取列表的第一个元素
* @param string $key
* @return string
*/
public static function lPop($key)
{
return self::$handler->lPop($key);
}
}
\ No newline at end of file
......@@ -9,7 +9,7 @@ class Agents extends Model
{
/**
* 查询经纪人
*
*
* @param type $pageNo
* @param type $pageSize
* @param type $order_
......@@ -18,85 +18,101 @@ class Agents extends Model
* @param type $house_id 查询该街铺和商铺的经纪人评论信息
* @return type
*/
public function getUser($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $house_id = '') {
public function getUser($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $house_id = '')
{
if ($house_id == '') {
$data = $this->field($field)->alias('a')
->join('u_evaluate b', 'a.id = b.agents_id', 'left')
->where($params)
->where('level=2 or level=5')
->group('a.id')
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
->join('u_evaluate b', 'a.id = b.agents_id', 'left')
->where($params)
->where('level=2 or level=5')
->group('a.id')
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
} else {
$data = $this->field($field)->alias('a')
->join('u_evaluate b','a.id = b.agents_id','left')
->where('find_in_set('.$house_id.', house_ids) or find_in_set('.$house_id.', house_ids2)')
->where($params)
->where('level=2 or level=5')
->group('a.id')
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
->join('u_evaluate b', 'a.id = b.agents_id', 'left')
->where('find_in_set(' . $house_id . ', house_ids) or find_in_set(' . $house_id . ', house_ids2)')
->where($params)
->where('level=2 or level=5')
->group('a.id')
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
return $data;
}
/**
* 经纪人详情
*
*
* @param type $id
* @return boolean
*/
public function agentsDetail($id) {
public function agentsDetail($id)
{
if ($id) {
$result = $this->field('id,realname,created,sub_shopname,head_portrait')
->where('level=2 or level=5')
->where('id',$id)->find();
$result['head_portrait'] = 'user_header/'.$result['head_portrait']; //头像
->where('level=2 or level=5')
->where('id', $id)->find();
$result['head_portrait'] = 'user_header/' . $result['head_portrait']; //头像
$evaluate_grade = Db::table('u_evaluate')
->field('sum(evaluate_grade) as evaluate_grade, count(*) as evaluate_num')
->where('agents_id',$id)->where('is_show',0)->find();
->field('sum(evaluate_grade) as evaluate_grade, count(*) as evaluate_num')
->where('agents_id', $id)->where('is_show', 0)->find();
if ($evaluate_grade['evaluate_grade']) {
$grade = floor(($evaluate_grade['evaluate_grade']/2)/$evaluate_grade['evaluate_num']);
$grade = floor(($evaluate_grade['evaluate_grade'] / 2) / $evaluate_grade['evaluate_num']);
} else {
$grade = 0;
}
$result['evaluate_grade'] = $grade; //评分等级
$result['evaluate_num'] = $evaluate_grade['evaluate_num']; //评论数量
$result['watch_shop'] = Db::table('u_appoint_watch_shop')
->where('agents_id',$id)->count(); //看铺
$result['evaluate_num'] = $evaluate_grade['evaluate_num']; //评论数量
$result['watch_shop'] = Db::table('u_appoint_watch_shop')
->where('agents_id', $id)->count(); //看铺
$result['head_portrait'] = ADMIN_URL_TL.$result['head_portrait'];
$result['head_portrait'] = ADMIN_URL_TL . $result['head_portrait'];
$journal = new JournalAccounts();
$fields = 'count(j.id) as num';
$fields = 'count(j.id) as num';
$result['JournalAccounts'] = $journal->getJournalHouseInfoId($fields, $id)['num']; //成交记录
$current_time = time();
$user_time = strtotime($result['created']);
$year = date('Y', $current_time) - date('Y', $user_time);
$user_time = strtotime($result['created']);
$year = date('Y', $current_time) - date('Y', $user_time);
//入职年限
if ($year == 0) {
$result['created'] = $year .'个月以上';
$result['created'] = $year . '个月以上';
} else {
$result['created'] = $year . '年以上';
$result['created'] = $year . '年以上';
}
$result['label'] = array(0=>'待定标签数据',1=>'待定标签数据');
$result['label'] = array( 0 => '待定标签数据', 1 => '待定标签数据' );
$data = $result;
} else {
$data = false;
}
return $data;
}
/**
* 获取经纪人 by zw
* @param $field
* @param $id
* @return array|false|\PDOStatement|string|Model
*/
public function getAgentsById($field , $id)
{
return $this
->field($field)
->where('inuse = 1 and id = ' . $id)
->find();
}
/**
* 查询经纪人列表
*
......@@ -111,7 +127,8 @@ class Agents extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgents($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $house_id = '') {
public function getAgents($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $house_id = '')
{
if ($house_id == '') {
$data = $this->field($field)
->where($params)
......@@ -122,7 +139,7 @@ class Agents extends Model
->select();
} else {
$data = $this->field($field)
->where('find_in_set('.$house_id.', house_ids) or find_in_set('.$house_id.', house_ids2)')
->where('find_in_set(' . $house_id . ', house_ids) or find_in_set(' . $house_id . ', house_ids2)')
->where($params)
->where('level=2 or level=5')
->order($order_)
......
<?php
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/18
* Time : 15:33
* Intro:
*/
namespace app\model;
use think\Model;
use think\Db;
class ChatMsg extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'chat_msg';
protected $db;
public function __construct()
{
$this->db = Db($this->table);
}
public function addChatMsg($params)
{
Db::startTrans();
try {
$this->save($params);
$id = $this->id;
Db::commit();
return $id;
} catch (\Exception $e) {
Db::rollback();
}
return 0;
}
/**
* @param $params
* @param $field
* @param $page_no
* @param $page_size
* @return false|\PDOStatement|string|\think\Collection
*/
public function getChatHistory($params, $field, $page_no, $page_size)
{
if (isset($params["from"])) {
$where_["a.from_id"] = $params["from"];
$where_or["a.to_id"] = $params["from"];
}
if (isset($params["target"])) {
$where_["a.to_id"] = $params["target"];
$where_or["a.from_id"] = $params["target"];
}
if (isset($params["is_group"])) {
$where_["a.is_group"] = $params["is_group"];
}
if (isset($params["body"])) {
$where_["b.body"] = array( 'like', "%" . trim($params["body"]) . "%" );
}
$where_["a.is_del"] = 0;
$data = $this->field($field)
->alias("a")
->join('chat_msg_ext b', 'a.id = b.msg_id', 'LEFT')
->where($where_)
->whereOr(function ($query) use ($where_or) {
$query->where($where_or);
})
->order("a.created_at desc")
->limit($page_size)
->page($page_no)
->select();
return $data;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/18
* Time : 15:33
* Intro:
*/
namespace app\model;
use think\Model;
use think\Db;
class ChatMsgExt extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'chat_msg_ext';
protected $db;
public function __construct()
{
$this->db = Db::name($this->table);
}
public function addChatMsgExt($params)
{
Db::startTrans();
try {
$this->db->insert($params);
Db::commit();
} catch (\Exception $e) {
dump($e);
Db::rollback();
}
return 0;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/18
* Time : 15:33
* Intro:
*/
namespace app\model;
use think\Model;
use think\Db;
class ChatUser extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'chat_user';
protected $db;
public function __construct()
{
$this->db = Db($this->table);
}
public function getChatUser($params, $field = "only_id,phone")
{
$data = $this->db->field($field)
->where($params)
->select();
return $data;
}
public function addChatUser($params)
{
Db::startTrans();
try {
$this->save($params);
Db::commit();
} catch (\Exception $e) {
Db::rollback();
}
}
}
\ No newline at end of file
......@@ -138,8 +138,13 @@ Route::group('api', [
]);
Route::group('task',[
'exclusiveExpirationTime' => [ 'task/exclusive/exclusiveExpirationTime', [ 'method' => 'get' ]] //独家过期时间
Route::group('chat', [
'index' => [ 'chat/AppChat/index', [ 'method' => 'get' ] ],
'userChat' => [ 'chat/AppChat/userChat', [ 'method' => 'post|get' ] ],
'pushMsg' => [ 'chat/AppChat/pushMsg', [ 'method' => 'post|get' ] ],
'getChatHistory' => [ 'chat/AppChat/getChatHistory', [ 'method' => 'post|get' ] ],
]);
//Route::miss('api/index/miss');//处理错误的url
\ No newline at end of file
Route::group('task',[
'exclusiveExpirationTime' => [ 'task/exclusive/exclusiveExpirationTime', [ 'method' => 'get' ]] //独家过期时间
]);//Route::miss('api/index/miss');//处理错误的url
\ No newline at end of file
......@@ -22,11 +22,10 @@ return [
'view' => ['index/index'],
],*/
// 其他更多的模块定义
'app' => [
'chat' => [
'__file__' => ['common.php'],
'__dir__' => ['behavior', 'controller', 'model', 'view'],
'controller' => ['Index', 'Test', 'UserType'],
'model' => ['User', 'UserType'],
'view' => ['index/index'],
'__dir__' => ['behavior', 'controller', 'service', 'utils'],
'controller' => ['Index'],
'service' => ['IndexService'],
],
];
......@@ -128,3 +128,211 @@ response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>15505625080</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>4796</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=F413CF2011A6A1505C3B9F4FDD6A2258
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>15505625090</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>8999</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=F41DBC75A64B489C3754C87B65A2E09E
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>18205625070</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>7889</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=905D65B26C5DEF1EC630B0F5AA17A509
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>15505625060</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>3182</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=76D08F08B4D1BAD08457BC638BBDB484
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>18805625020</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>2071</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=7058E44B5B45924D7B11C38F5D534306
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>18756252570</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>9183</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=1A0FD455A35089B0EB5E6723190A15FB
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>18756258888</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>7572</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=1566AAB75F25B6DD28A4902FA26AEC0F
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>18756259999</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>3479</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=DE9865EE495BD9B0D85EDAF249CDA24F
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>18756257777</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>7094</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=7977CEC21F534DD1E5D675D792595DC9
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>15038133185</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>1323</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=A83C2D00731E2A9F65F7CAC298B44B09
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</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>
request body = <TemplateSMS>
<to>15032323232</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>4355</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=157B3CA0CF0C1D232FE6D6758A6F9E77
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>18756254444</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>8064</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=EA2BC31B5B5662AD292223DC686FA26D
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>18756253333</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>7687</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=00F01FFDBFD51AA503BB5585E4D2DC21
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
request body = <TemplateSMS>
<to>13112341234</to>
<appId>8a216da85f5c89b1015f7718e2b90a63</appId>
<templateId>214759</templateId>
<datas><data>8858</data><data>5分钟</data></datas>
</TemplateSMS>
request url = https://app.cloopen.com:8883/2013-12-26/Accounts/8a48b55153eae51101540e763d3b3888/SMS/TemplateSMS?sig=873B52C43862749A39926C652B5834DC
response body = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
<statusCode>160053</statusCode>
<statusMsg>IP鉴权失败</statusMsg>
</Response>
<?php
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/8
* Time : 15:56
* Intro:
*/
// [ 应用入口文件 ]
// 定义应用目录
define('APP_PATH', __DIR__ . '/../application/');
// 加载框架引导文件
require __DIR__ . '/../thinkphp/start.php';
// 读取自动生成定义文件
/*$build = include './../build.php';
// 运行自动生成
\think\Build::run($build);*/
\ No newline at end of file
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