| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Lenovo
- * Date: 2018/10/30
- * Time: 17:34
- */
- namespace App\Api\Controller;
- class SystemInfo extends BaseController
- {
- //获取网站基本信息、平台维护状态
- function GetNetworkInfo()
- {
- $data = lm('Setinfo', 'Commons')
- ->select('identity', 'infoname', 'infocontent', 'extinfo', 'remarks', 'status', 'infotype')
- ->whereIn('infotype', array(0, 24))
- ->get();
- if ($data && count($data->toArray()) > 0) Render($data->toArray(), 1);
- Render('', -5201);
- }
- function DefaultInfo()
- {
- $cache = C()->get('cache')->get('DefaultInfo');
- if(!empty($cache))
- Render(json_decode($cache,1));
- //--Bruce--合并接口
- $info = lm('setinfo', 'commons')->whereIn('infotype', [2004, 2001, 1017, 24,100,20060])->orderBy('infotype', 'desc')->get(['identity', 'infoname', 'infocontent', 'extinfo', 'remarks', 'status', 'infotype']);
- if (!$info) {
- Render('', -5201);
- }
- // $infodata = [];
- // foreach ($info as $v) {
- // if (in_array($v['infotype'], [2001, 2004, 1017])) {
- // $infodata[$v['remarks']] = $v['infocontent'];
- // } else {
- // $infodata[] = $v;
- // }
- // }
- $ret =array_column($info->toarray(),'infocontent','remarks');
- C()->get('cache')->set('DefaultInfo',json_encode($ret),600);
- Render($ret, 1);
- }
- }
|