自动点赞提交
This commit is contained in:
@@ -349,7 +349,11 @@ class WebSocketController extends BaseController
|
||||
$snsId = !empty($data['snsId']) ? $data['snsId'] : '';
|
||||
$wechatAccountId = !empty($data['wechatAccountId']) ? $data['wechatAccountId'] : '';
|
||||
$wechatFriendId = !empty($data['wechatFriendId']) ? $data['wechatFriendId'] : 0;
|
||||
|
||||
$momentInteractType = isset($data['momentInteractType']) ? intval($data['momentInteractType']) : 1;
|
||||
if (!in_array($momentInteractType, [1, 2], true)) {
|
||||
$momentInteractType = 1;
|
||||
}
|
||||
$sendWord = isset($data['sendWord']) ? (string)$data['sendWord'] : '';
|
||||
|
||||
//过滤消息
|
||||
if (empty($snsId)) {
|
||||
@@ -358,19 +362,26 @@ class WebSocketController extends BaseController
|
||||
if (empty($wechatAccountId)) {
|
||||
return json_encode(['code' => 400, 'msg' => '微信id不能为空']);
|
||||
}
|
||||
if ($momentInteractType === 2 && $sendWord === '') {
|
||||
return json_encode(['code' => 400, 'msg' => '评论内容不能为空']);
|
||||
}
|
||||
|
||||
try {
|
||||
$result = [
|
||||
"cmdType" => "CmdMomentInteract",
|
||||
"momentInteractType" => 1,
|
||||
"momentInteractType" => $momentInteractType,
|
||||
"seq" => time(),
|
||||
"snsId" => $snsId,
|
||||
"wechatAccountId" => $wechatAccountId,
|
||||
"wechatFriendId" => $wechatFriendId,
|
||||
];
|
||||
if ($momentInteractType === 2) {
|
||||
$result['sendWord'] = $sendWord;
|
||||
}
|
||||
|
||||
$message = $this->sendMessage($result);
|
||||
return json_encode(['code' => 200, 'msg' => '点赞成功', 'data' => $message]);
|
||||
$okMsg = $momentInteractType === 2 ? '评论成功' : '点赞成功';
|
||||
return json_encode(['code' => 200, 'msg' => $okMsg, 'data' => $message]);
|
||||
} catch (\Exception $e) {
|
||||
return json_encode(['code' => 500, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user