|
|
@@ -136,6 +136,12 @@ class ChatMessageService extends BaseService
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 消息列表
|
|
|
+ * @param $params
|
|
|
+ * @param int $pageSize
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
public function getNewList($params, $pageSize = 15)
|
|
|
{
|
|
|
$where = ['a.mark' => 1,'status'=>1];
|
|
|
@@ -195,6 +201,28 @@ class ChatMessageService extends BaseService
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 消息数量
|
|
|
+ * @param $userId
|
|
|
+ * @return int[]
|
|
|
+ */
|
|
|
+ public function getNewCount($userId)
|
|
|
+ {
|
|
|
+ $counts = ['notice'=>0,'message'=>0];
|
|
|
+
|
|
|
+ $counts['notice'] = (int) $this->model->where(['status'=>1,'mark'=>1,'type'=>3])
|
|
|
+ ->where(function($query) use($userId){
|
|
|
+ $query->where(['from_uid'=> $userId])->orWhere(['to_uid'=> $userId]);
|
|
|
+ })->count('id');
|
|
|
+
|
|
|
+ $counts['message'] = (int) $this->model->where(['status'=>1,'mark'=>1,'type'=>1])
|
|
|
+ ->where(function($query) use($userId){
|
|
|
+ $query->where(['from_uid'=> $userId])->orWhere(['to_uid'=> $userId]);
|
|
|
+ })->count('id');
|
|
|
+
|
|
|
+ return $counts;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取最新的聊天消息
|
|
|
* @param $chatKey 聊天窗口标识
|
|
|
* @return array|mixed
|
|
|
@@ -253,6 +281,7 @@ class ChatMessageService extends BaseService
|
|
|
*/
|
|
|
public function pushMessage($data)
|
|
|
{
|
|
|
+
|
|
|
return $this->model->edit($data);
|
|
|
}
|
|
|
}
|