人人商城

diagnose.ctrl.php 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * [淘淘源码铺微擎系统 System] Copyright (c) 2018 www.330code.com
  4. */
  5. defined('IN_IA') or exit('Access Denied');
  6. load()->model('cloud');
  7. load()->model('setting');
  8. $dos = array('display', 'testapi');
  9. $do = in_array($do, $dos) ? $do : 'display';
  10. uni_user_permission_check('system_cloud_diagnose');
  11. $_W['page']['title'] = '云服务诊断 - 云服务';
  12. if ($do == 'testapi') {
  13. $starttime = microtime(true);
  14. $response = cloud_request(HTTP_X_FOR .'we7.jcxbhm.com/app/api.php', array(), array('ip' => $_GPC['ip']));
  15. $endtime = microtime(true);
  16. iajax(0,'请求接口成功,耗时 '.(round($endtime - $starttime, 5)).' 秒');
  17. } else {
  18. if(checksubmit()) {
  19. setting_save('', 'site');
  20. itoast('成功清除站点记录.', 'refresh', 'success');
  21. }
  22. if (checksubmit('updateserverip')) {
  23. if (!empty($_GPC['ip'])) {
  24. setting_save(array('ip' => $_GPC['ip'], 'expire' => TIMESTAMP + 201600), 'cloudip');
  25. } else {
  26. setting_save(array(), 'cloudip');
  27. }
  28. itoast('修改云服务ip成功.', 'refresh', 'success');
  29. }
  30. if(empty($_W['setting']['site'])) {
  31. $_W['setting']['site'] = array();
  32. }
  33. $checkips = array();
  34. if (!empty($_W['setting']['cloudip']['ip'])) {
  35. $checkips[] = $_W['setting']['cloudip']['ip'];
  36. }
  37. if (strexists(strtoupper(PHP_OS), 'WINNT')) {
  38. $cloudip = gethostbyname('we7.jcxbhm.com');
  39. if (!in_array($cloudip, $checkips)) {
  40. $checkips[] = $cloudip;
  41. }
  42. } else {
  43. for ($i = 0; $i <= 10; $i++) {
  44. $cloudip = gethostbyname('we7.jcxbhm.com');
  45. if (!in_array($cloudip, $checkips)) {
  46. $checkips[] = $cloudip;
  47. }
  48. }
  49. }
  50. template('cloud/diagnose');
  51. }