1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php namespace App\Http\Controllers\Admin;
- use Illuminate\Support\Facades\Cache;
- use App\Facades\Servers\WechatMini\Mini;
- /**
- * 后台控制器
- *
- * @author 刘相欣
- *
- * */
- class Index extends Auth{
-
-
- public function index()
- {
-
- // 获取菜单
- $this->getMenu('admin');
- // 请求结果
- return $this->fetch();
- }
- /**
- * 欢迎页
- *
- * */
- public function welcome()
- {
- // 结果数据
- $link = cache('admin:wechat:mini:index:mpurl');
- // 不存在数据
- if ( is_null($link) ) {
- // 从数据库获取数据
- $link = Mini::getUrlLink('pages/index/index');
- // 存起来
- cache(['admin:wechat:mini:index:mpurl'=>$link],$link ? now()->addDays(28) : now()->addMinutes(3));
- }
- // 分配参数
- $this->assign('link',$link);
- // 加载模板
- return $this->fetch();
- }
- /**
- * 清理缓存
- *
- * */
- public function refresh()
- {
-
- // 清除缓存
- Cache::flush();
- // 加载模板
- return json_send(['code'=>'success','msg'=>'刷新成功']);
- }
- }
|