代码同步提交
This commit is contained in:
@@ -249,4 +249,43 @@ class WechatController extends BaseController
|
||||
WechatAccountModel::create($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function chatroomCreate($data = [])
|
||||
{
|
||||
|
||||
$authorization = $this->authorization;
|
||||
|
||||
if (empty($authorization)) {
|
||||
return json_encode(['code' => 500, 'msg' => '缺少授权信息']);
|
||||
}
|
||||
|
||||
try {
|
||||
// 设置请求头
|
||||
$headerData = ['Client:system'];
|
||||
$header = setHeader($headerData, $authorization,'json');
|
||||
$params = [
|
||||
"chatroomOperateType" => 7,
|
||||
"extra" => "{chatroomName:{$data['chatroomName']}}",
|
||||
"wechatAccountId" => $data['wechatAccountId'],
|
||||
"wechatChatroomId" => 0,
|
||||
"wechatFriendIds" => $data['wechatFriendIds']
|
||||
];
|
||||
|
||||
// 发送请求获取状态信息
|
||||
$result = requestCurl($this->baseUrl . 'api/WechatChatroom/chatroomOperate', $params, 'POST', $header,'json');
|
||||
$response = handleApiResponse($result);
|
||||
if (!empty($response)) {
|
||||
return json_encode(['code' => 500, 'msg' =>$response]);
|
||||
}else{
|
||||
return json_encode(['code' => 200, 'msg' =>'成功']);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
if (empty($authorization)) { // 只有作为独立API调用时才返回
|
||||
return json_encode(['code' => 500, 'msg' => '获取失败:' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user