| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App\Http\Controllers\Api;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- use Illuminate\Support\Facades\Redis;
- use App\Models;
- class NoticeController extends Controller
- {
- /*
- * 公告
- */
- public function notice(Request $req){
- $Notice = new Models\Notice;
- $data = $Notice->notice_info();
- if(!$data){
- return toJson(-1);
- }
- return toJson(1,'',$data);
- }
- /*
- * 添加系统公告
- */
- public function redisNotice(array $msg){
- foreach($msg as $k => $v){
- Redis::rpush('msg',$v);
- }
- }
- /*
- * 获取后删除系统公告
- */
- public function redisPop(){
- $msg = Redis::lrange('msg',0,-1);
- Redis::ltrim('msg',1,0);
- return toJson(1,'',$msg);
- }
- }
|