SystemInfo.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Lenovo
  5. * Date: 2018/10/30
  6. * Time: 17:34
  7. */
  8. namespace App\Api\Controller;
  9. class SystemInfo extends BaseController
  10. {
  11. //获取网站基本信息、平台维护状态
  12. function GetNetworkInfo()
  13. {
  14. $data = lm('Setinfo', 'Commons')
  15. ->select('identity', 'infoname', 'infocontent', 'extinfo', 'remarks', 'status', 'infotype')
  16. ->whereIn('infotype', array(0, 24))
  17. ->get();
  18. if ($data && count($data->toArray()) > 0) Render($data->toArray(), 1);
  19. Render('', -5201);
  20. }
  21. function DefaultInfo()
  22. {
  23. $cache = C()->get('cache')->get('DefaultInfo');
  24. if(!empty($cache))
  25. Render(json_decode($cache,1));
  26. //--Bruce--合并接口
  27. $info = lm('setinfo', 'commons')->whereIn('infotype', [2004, 2001, 1017, 24,100,20060])->orderBy('infotype', 'desc')->get(['identity', 'infoname', 'infocontent', 'extinfo', 'remarks', 'status', 'infotype']);
  28. if (!$info) {
  29. Render('', -5201);
  30. }
  31. // $infodata = [];
  32. // foreach ($info as $v) {
  33. // if (in_array($v['infotype'], [2001, 2004, 1017])) {
  34. // $infodata[$v['remarks']] = $v['infocontent'];
  35. // } else {
  36. // $infodata[] = $v;
  37. // }
  38. // }
  39. $ret =array_column($info->toarray(),'infocontent','remarks');
  40. C()->get('cache')->set('DefaultInfo',json_encode($ret),600);
  41. Render($ret, 1);
  42. }
  43. }