diff --git a/Server/application/chukebao/controller/DataProcessing.php b/Server/application/chukebao/controller/DataProcessing.php index af0d0d1b..887fb2ef 100644 --- a/Server/application/chukebao/controller/DataProcessing.php +++ b/Server/application/chukebao/controller/DataProcessing.php @@ -2,6 +2,7 @@ namespace app\chukebao\controller; +use app\api\model\WechatChatroomModel; use library\ResponseHelper; use app\api\model\WechatFriendModel; use app\api\model\WechatMessageModel; @@ -77,15 +78,31 @@ class DataProcessing extends BaseController if(empty($toAccountId)){ return ResponseHelper::error('参数缺失'); } - - $friend = WechatFriendModel::where(['id' => $wechatFriendId,'wechatAccountId' => $wechatAccountId])->find(); - if(empty($friend)){ - return ResponseHelper::error('好友不存在'); + if(empty($wechatFriendId) && empty($wechatChatroomId)){ + return ResponseHelper::error('参数缺失'); } - $friend->accountId = $toAccountId; - $friend->updateTime = time(); - $friend->save(); - $msg = '好友转移成功'; + + + if (!empty($wechatFriendId)){ + $dsta = WechatFriendModel::where(['id' => $wechatFriendId,'wechatAccountId' => $wechatAccountId])->find(); + $msg = '好友转移成功'; + if(empty($ddta)){ + return ResponseHelper::error('好友不存在'); + } + } + + + if (!empty($wechatChatroomId)){ + $dsta = WechatChatroomModel::where(['id' => $wechatChatroomId,'wechatAccountId' => $wechatAccountId])->find(); + $msg = '群聊转移成功'; + if(empty($ddta)){ + return ResponseHelper::error('群聊不存在'); + } + } + + $dsta->accountId = $toAccountId; + $dsta->updateTime = time(); + $dsta->save(); break; case 'CmdNewMessage': if(empty($friendMessage) && empty($chatroomMessage)){ @@ -107,7 +124,7 @@ class DataProcessing extends BaseController $msg = '消息记录成功'; }else{ $msg = '消息记录失败'; - $codee = 400; + $codee = 200; } break; case 'CmdSendMessageResult':