消息条数修改

master
Your Name 5 years ago
parent 4b965d72a1
commit 77ec44c495

@ -11,7 +11,7 @@ class BaseController extends RestController{
'Apple.apple_platform_pay','Spend.notice','Apple.apple_union_pay','WapPay.wap_shortcut_pay', 'Apple.apple_platform_pay','Spend.notice','Apple.apple_union_pay','WapPay.wap_shortcut_pay',
'WapPay.shortcut_pay','WapPay.android_shortcut_pay','WapPay.wap_shortcut_pay','WapPay.wap_shortcut_pay', 'WapPay.shortcut_pay','WapPay.android_shortcut_pay','WapPay.wap_shortcut_pay','WapPay.wap_shortcut_pay',
'Apple.apple_weixin_pay','Ipa365','User.user_login','platform_coin_deduction','test','get_user_money', 'Apple.apple_weixin_pay','Ipa365','User.user_login','platform_coin_deduction','test','get_user_money',
'file_pay','pay','GameGiftPage','UserH','Game.get_suspend' 'file_pay','pay','GameGiftPage','UserH','Game.get_suspend',
]; ];
// 不需要验证TOKEN的接口 // 不需要验证TOKEN的接口
protected $noNeedToken = [ protected $noNeedToken = [

@ -121,7 +121,6 @@ class NoticeController extends BaseController{
//yyh 2018.10.18 //yyh 2018.10.18
public function notice_detail(){ public function notice_detail(){
$request = json_decode(base64_decode(file_get_contents("php://input")),true); $request = json_decode(base64_decode(file_get_contents("php://input")),true);
$map['id'] = $request['notice_id']; $map['id'] = $request['notice_id'];
switch ($request['type']) { switch ($request['type']) {
case '1': case '1':
@ -155,6 +154,11 @@ class NoticeController extends BaseController{
$data['content'] = $detail['content']; $data['content'] = $detail['content'];
$data['create_time'] = $detail['create_time']; $data['create_time'] = $detail['create_time'];
$data['type'] = $request['type']; $data['type'] = $request['type'];
$arr['notice_id'] = $request['notice_id'];
$arr['user_id'] = $request['user_id'];
$arr['is_read'] = 1;
$arr['create_time'] = time();
M('notice_read','tab_')->data($arr)->add();
break; break;
case '2': case '2':
$game_name = get_game_name($detail['game_id']); $game_name = get_game_name($detail['game_id']);

@ -1436,7 +1436,6 @@ class UserController extends BaseController
*/ */
public function user_info() public function user_info()
{ {
C(api('Config/lists')); C(api('Config/lists'));
$user = json_decode(base64_decode(file_get_contents("php://input")), true); $user = json_decode(base64_decode(file_get_contents("php://input")), true);
$model = M("user", "tab_"); $model = M("user", "tab_");
@ -1462,8 +1461,23 @@ class UserController extends BaseController
} }
$unread_count = 0; $unread_count = 0;
$unread_count += M('share_record', 'tab_') -> where(['invite_id' => $data['id'], 'award_coin' => ['gt', 0], 'read' => 0]) -> count();
$unread_count += M('point_record', 'tab_') -> where(['type_id' => 6, 'user_id' => $data['id'], 'point' => ['gt', 0], 'read' => 0]) -> count(); //获取公告未读条数
$time = time();
$notice = M('notice', 'tab_')->where('start_time < ' .$time. ' AND (end_time = 0 OR end_time >' . $time . ')')->getField('id',true);
if(!empty($notice))
{
$unread_count += count($notice);
$where['notice_id'] = ['in', implode(',', $notice)];
$where['user_id'] = $user['user_id'];
$where['is_read'] = 1;
$notice_read_count = M('notice_read', 'tab_')->where($where)->count();
$unread_count -= $notice_read_count;
}
// //邀请奖励消息未读条数
// $unread_count += M('share_record', 'tab_') -> where(['invite_id' => $data['id'], 'award_coin' => ['gt', 0], 'read' => 0]) -> count();
// //积分奖励消息条数
// $unread_count += M('point_record', 'tab_') -> where(['type_id' => 6, 'user_id' => $data['id'], 'point' => ['gt', 0], 'read' => 0]) -> count();
$data['notice_count'] = $unread_count; $data['notice_count'] = $unread_count;
$buddies_request = get_buddies_unagree_count($data['id']); $buddies_request = get_buddies_unagree_count($data['id']);
$data['request_count'] = $buddies_request; $data['request_count'] = $buddies_request;

Loading…
Cancel
Save