From 77ec44c49573c74bad897300c2414c095731f15b Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 30 Oct 2019 11:28:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=9D=A1=E6=95=B0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/BaseController.class.php | 2 +- .../Sdk/Controller/NoticeController.class.php | 6 +++++- .../Sdk/Controller/UserController.class.php | 20 ++++++++++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Application/Sdk/Controller/BaseController.class.php b/Application/Sdk/Controller/BaseController.class.php index 2fce78a2..fe954fef 100644 --- a/Application/Sdk/Controller/BaseController.class.php +++ b/Application/Sdk/Controller/BaseController.class.php @@ -11,7 +11,7 @@ class BaseController extends RestController{ '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', '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的接口 protected $noNeedToken = [ diff --git a/Application/Sdk/Controller/NoticeController.class.php b/Application/Sdk/Controller/NoticeController.class.php index f4cdce39..b2d39217 100644 --- a/Application/Sdk/Controller/NoticeController.class.php +++ b/Application/Sdk/Controller/NoticeController.class.php @@ -121,7 +121,6 @@ class NoticeController extends BaseController{ //yyh 2018.10.18 public function notice_detail(){ $request = json_decode(base64_decode(file_get_contents("php://input")),true); - $map['id'] = $request['notice_id']; switch ($request['type']) { case '1': @@ -155,6 +154,11 @@ class NoticeController extends BaseController{ $data['content'] = $detail['content']; $data['create_time'] = $detail['create_time']; $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; case '2': $game_name = get_game_name($detail['game_id']); diff --git a/Application/Sdk/Controller/UserController.class.php b/Application/Sdk/Controller/UserController.class.php index 32884ca5..21b5f866 100644 --- a/Application/Sdk/Controller/UserController.class.php +++ b/Application/Sdk/Controller/UserController.class.php @@ -1436,7 +1436,6 @@ class UserController extends BaseController */ public function user_info() { - C(api('Config/lists')); $user = json_decode(base64_decode(file_get_contents("php://input")), true); $model = M("user", "tab_"); @@ -1462,8 +1461,23 @@ class UserController extends BaseController } $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; $buddies_request = get_buddies_unagree_count($data['id']); $data['request_count'] = $buddies_request;