群信息
This commit is contained in:
@@ -58,7 +58,7 @@ class MessageController extends ApiController
|
|||||||
$total = $query->count();
|
$total = $query->count();
|
||||||
$messages = $query->alias('msg')->order('send_time', 'desc')
|
$messages = $query->alias('msg')->order('send_time', 'desc')
|
||||||
->leftJoin('chat_user user', 'msg.from_id = user.user_id')
|
->leftJoin('chat_user user', 'msg.from_id = user.user_id')
|
||||||
->field('msg.id,from_id,to_id,chat_type,msg_type,content,image_url,order_id,is_read,send_time,session_id,nick_name,user_id,avatar,type,coupon')
|
->field('msg.id,from_id,to_id,chat_type,msg_type,content,image_url,order_id,is_read,send_time,session_id,nick_name,user_id,avatar,type,coupon,coupon_claim,chat_coupon_id')
|
||||||
->page($page, $size)
|
->page($page, $size)
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
|
|
||||||
|
|||||||
@@ -210,6 +210,8 @@ namespace extend\chat\model;
|
|||||||
'from_id' => self::$user_info['uid'],
|
'from_id' => self::$user_info['uid'],
|
||||||
'to_id' => $message['to_id'],
|
'to_id' => $message['to_id'],
|
||||||
'group_id' => $group_id,
|
'group_id' => $group_id,
|
||||||
|
'shop_id' => !empty($message['shop_id'])?$message['shop_id']:null,
|
||||||
|
'chat_coupon_id' => !empty($message['chat_coupon_id'])?$message['chat_coupon_id']:null,
|
||||||
'chat_type' => $message['chat_type'],
|
'chat_type' => $message['chat_type'],
|
||||||
'msg_type' => $message['msg_type'],
|
'msg_type' => $message['msg_type'],
|
||||||
'content' => !empty($message['content'])?$message['content']:null,
|
'content' => !empty($message['content'])?$message['content']:null,
|
||||||
@@ -267,6 +269,22 @@ namespace extend\chat\model;
|
|||||||
if($grep['user_id'] != self::$user_info['uid']) {
|
if($grep['user_id'] != self::$user_info['uid']) {
|
||||||
$user_type = $grep['role']==1?2:1;
|
$user_type = $grep['role']==1?2:1;
|
||||||
$str_uid = self::getUid($grep['user_id'], $user_type);
|
$str_uid = self::getUid($grep['user_id'], $user_type);
|
||||||
|
|
||||||
|
// 如果发送的是优惠券,检查这个人有没有领取过
|
||||||
|
if($message['msg_type'] == 4 && !empty($message['coupon']) && !empty($message['chat_coupon_id'])) {
|
||||||
|
// 查询有没有领取过优惠券
|
||||||
|
$mk_shop_coupon_record = Db::name('mk_shop_coupon_record')->where([
|
||||||
|
'source' => '群聊发放',
|
||||||
|
'source_id ' => $message['chat_coupon_id'],
|
||||||
|
'user_id' => $grep['user_id'],
|
||||||
|
'shop_id' => $message['shop_id'],
|
||||||
|
])->find();
|
||||||
|
if($mk_shop_coupon_record) {
|
||||||
|
$notice_data['coupon_claim'] = 1;
|
||||||
|
}else {
|
||||||
|
$notice_data['coupon_claim'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
// 群成员是否在线,在线发 不在线存起来等上线了发 免打扰也不发消息
|
// 群成员是否在线,在线发 不在线存起来等上线了发 免打扰也不发消息
|
||||||
if($grep['is_dist'] == 0) {
|
if($grep['is_dist'] == 0) {
|
||||||
if(Gateway::isUidOnline($str_uid)) {
|
if(Gateway::isUidOnline($str_uid)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user