<?php namespace app\api\controller; use app\common\controller\Api; use think\Db; /** * 消息 */ class Message extends Api { protected $noNeedLogin = []; protected $noNeedRight = ['*']; //我的个人消息列表 public function mylist(){ $list = Db::name('message')->where('user_id',$this->auth->id)->autopage()->order('id desc')->select(); //读取即为已读 $map = [ 'user_id' => $this->auth->id, 'status' => 0, ]; Db::name('message')->where($map)->update(['status'=>1]); $this->success('success',$list); } /* * 获取系统消息列表 */ public function getMessageSys() { $list = Db::name('message_sys')->autopage()->order('id desc')->select(); $this->success("获取成功!",$list); } }