Browse Source

追加个人中心消息删除/修改状态

彭俊 6 years ago
parent
commit
c7dbb94f48
2 changed files with 48 additions and 2 deletions
  1. 20 2
      Application/Api/Controller/Information.php
  2. 28 0
      Application/Api/Model/AccountNews.php

+ 20 - 2
Application/Api/Controller/Information.php

@@ -14,7 +14,7 @@ class Information extends BaseController
         $this->commonFunction =  C()->get('commonFunction');
 
          //获取用户token
-         $token = $_POST['token'];
+         $token = $_REQUEST['token'];
          $UserInfo = $this->getAgent($token);
          //获取用户信息
          $this->UserInfo = $UserInfo;
@@ -33,7 +33,7 @@ class Information extends BaseController
         $BetNews = $this->getUserNews();
     }
     /**
-     * 获取通知消息
+     * 获取通知消息1
      */
     public function getUserNews(){
         //获取当前用户投注信息
@@ -50,6 +50,24 @@ class Information extends BaseController
 
         Render($Article, '1', lang('Tips','Sports')->get('success'));
     }
+    /**
+     * 删除消息
+     */
+    public function delUserNews(){
+        $delUserNews = AccountNewsModel::delUserNews();
+       
+        Render($delUserNews, '1', lang('Tips','Sports')->get('success'));
+
+    }
+
+    /**
+     * 修改读取状态
+     */
+     public function upStatus(){
+        $upStatus = AccountNewsModel::upStatus();
+       
+        Render($upStatus, '1', lang('Tips','Sports')->get('success'));
+     }
 
     /**
      * token获取用户详情

+ 28 - 0
Application/Api/Model/AccountNews.php

@@ -98,4 +98,32 @@ class AccountNews extends Model {
 
         return $result;
     }
+
+    //删除消息
+    public static function delUserNews(){
+        //获取消息id
+        $identity = $_REQUEST['identity'];
+        if (empty($identity)) {
+            Render([], '40255', lang('Errors','Api') -> get('error-40255'));
+        }
+
+        $del =  lm('account_news', "commons")::where('identity',$identity)->delete();
+        return $del;
+    }
+
+    //修改读取状态
+    public static function upStatus(){
+        //获取消息id
+        $identity = $_REQUEST['identity'];
+        if (empty($identity)) {
+            Render([], '40255', lang('Errors','Api') -> get('error-40255'));
+        }
+        $up = [
+            'read_status'=>1,
+        ];
+
+        $upStatus =  lm('account_news', "commons")::where('identity',$identity)->update($up);
+
+        return $upStatus;
+    }
 }