消息列表
This commit is contained in:
@@ -97,11 +97,53 @@ class MessageController extends BaseController
|
||||
}
|
||||
|
||||
Db::table('s2_wechat_message')->where($where)->update(['isRead' => 1]);
|
||||
|
||||
|
||||
return ResponseHelper::success([]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function details(){
|
||||
$wechatFriendId = $this->request->param('wechatFriendId', '');
|
||||
$wechatChatroomId = $this->request->param('wechatChatroomId', '');
|
||||
$wechatAccountId = $this->request->param('wechatAccountId', '');
|
||||
$page = $this->request->param('page', 1);
|
||||
$limit = $this->request->param('limit', 10);
|
||||
$from = $this->request->param('From', '');
|
||||
$to = $this->request->param('To', '');
|
||||
$olderData = $this->request->param('olderData', false);
|
||||
$accountId = $this->getUserInfo('s2_accountId');
|
||||
if (empty($accountId)){
|
||||
return ResponseHelper::error('请先登录');
|
||||
}
|
||||
if (empty($wechatChatroomId) && empty($wechatFriendId)){
|
||||
return ResponseHelper::error('参数缺失');
|
||||
}
|
||||
|
||||
$where = [];
|
||||
if (!empty($wechatChatroomId)){
|
||||
$where[] = ['wechatChatroomId','=',$wechatChatroomId];
|
||||
}
|
||||
|
||||
if (!empty($wechatFriendId)){
|
||||
$where[] = ['wechatFriendId','=',$wechatFriendId];
|
||||
}
|
||||
|
||||
if (!empty($From) && !empty($To)){
|
||||
$where[] = ['wechatTime','between',[$from,$to]];
|
||||
}
|
||||
|
||||
|
||||
$list = Db::table('s2_wechat_message')->where($where)->page($page,$limit)->order('id DESC')->select();
|
||||
$total = Db::table('s2_wechat_message')->where($where)->count();
|
||||
|
||||
|
||||
foreach ($list as $k=>&$v){
|
||||
$v['wechatTime'] = !empty($v['wechatTime']) ? date('Y-m-d H:i:s',$v['wechatTime']) : '';
|
||||
}
|
||||
|
||||
|
||||
return ResponseHelper::success(['total'=>$total,'list'=>$list]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user