profile.ctrl.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. load()->model('cloud');
  8. load()->func('communication');
  9. $dos = array('site', 'sms', 'common_api');
  10. $do = in_array($do, $dos) ? $do : 'site';
  11. if($do == 'site') {
  12. if (!empty($_W['setting']['site']['key']) && !empty($_W['setting']['site']['token'])) {
  13. $site_info = cache_read('cloud_site_register_info');
  14. if (empty($site_info)) {
  15. $site_info = cloud_site_info();
  16. if (is_error($site_info)) {
  17. message('获取站点信息失败: ' . $site_info['message'], url('cloud/diagnose'), 'error');
  18. }
  19. cache_write('cloud_site_register_info', $site_info);
  20. }
  21. } else {
  22. message('注册信息丢失, 请通过"重置站点ID和通信密钥"重新获取 !', url('cloud/diagnose'), 'error');
  23. }
  24. template('cloud/site');
  25. }
  26. if ($do == 'sms') {
  27. if (empty($_GPC['type']) || $_GPC['type'] == 'info') {
  28. $sms_info = cloud_sms_info();
  29. if (!empty($sms_info['sms_sign'])) {
  30. foreach ($sms_info['sms_sign'] as $item) {
  31. $cloud_sms_signs[$item] = $item;
  32. }
  33. }
  34. $setting_sms_sign = setting_load('site_sms_sign');
  35. $setting_sms_sign = !empty($setting_sms_sign['site_sms_sign']) ? $setting_sms_sign['site_sms_sign'] : array();
  36. $setting_sms_sign['register'] = !empty($setting_sms_sign['register']) ? $setting_sms_sign['register'] : '';
  37. $setting_sms_sign['find_password'] = !empty($setting_sms_sign['find_password']) ? $setting_sms_sign['find_password'] : '';
  38. $setting_sms_sign['user_expire'] = !empty($setting_sms_sign['user_expire']) ? $setting_sms_sign['user_expire'] : '';
  39. }
  40. template('cloud/sms');
  41. }
  42. if ($do == 'common_api') {
  43. $method = safe_gpc_string($_GPC['method']);
  44. $params = safe_gpc_array($_GPC['params']);
  45. if (!in_array($method, array('smsInfo', 'smsSign', 'smsTrade', 'smsLog'))) {
  46. iajax(-1, '参数有误');
  47. }
  48. if (!empty($params['time'][1])) {
  49. $params['time'][1] += 86400;
  50. } else {
  51. $params['time'] = array();
  52. }
  53. if ($method == 'smsInfo') {
  54. $data = cloud_sms_info();
  55. } elseif ($method == 'smsLog') {
  56. $params['mobile'] = !is_numeric($params['mobile']) || empty($params['mobile']) ? 0 : $params['mobile'];
  57. $params['page'] = empty($params['page']) ? 1 : intval($params['page']);
  58. $params['page_size'] = empty($params['page_size']) ? 10 : intval($params['page_size']);
  59. $data = cloud_sms_log($params['mobile'], $params['time'], $params['page'], $params['page_size']);
  60. } elseif ($method == 'smsTrade') {
  61. $data = cloud_sms_trade($params['page'], $params['time']);
  62. } else {
  63. $data = cloud_api_redirect($method, $params);
  64. }
  65. if (is_error($data)) {
  66. iajax(-1, $data['message']);
  67. } else {
  68. if (isset($data['data'][0]['createtime']) && is_numeric($data['data'][0]['createtime'])) {
  69. foreach ($data['data'] as &$item) {
  70. $item['createtime'] = date('Y-m-d H:i:s', $item['createtime']);
  71. }
  72. }
  73. iajax(0, $data);
  74. }
  75. }