workorder.ctrl.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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()->classs('cloudapi');
  8. load()->model('message');
  9. if($do == 'display') { $message_id = intval($_GPC['message_id']);
  10. message_notice_read($message_id);
  11. $siteurl = $_W['siteroot'];
  12. $cloud = new CloudApi();
  13. $uuid = $_GPC['uuid'];
  14. $data = $cloud->get('system','workorder', array('do'=>'siteworkorder'), 'json');
  15. if(is_error($data)) {
  16. itoast('无权限进入工单系统');
  17. }
  18. $iframe_url = $data['data']['url'].'&from='.urlencode($siteurl).'&uuid='.$uuid;
  19. template('system/workorder');
  20. }
  21. if($do == 'module') {
  22. $name = trim($_GPC['name']);
  23. if(empty($name)){
  24. itoast('模块参数错误');
  25. }
  26. $module = module_fetch($name);
  27. if(!$module) {
  28. itoast('未找到模块');
  29. }
  30. $module_name = $name;
  31. $module_version = $module['version'];
  32. $issystem = $module['issystem'];
  33. $module_type = 'module';
  34. $from = urlencode($_W['siteroot']);
  35. $param = http_build_query(compact('module_name', 'module_version', 'module_type', 'from'));
  36. $cloud = new CloudApi();
  37. $data = $cloud->get('system','workorder', array('do'=>'siteworkorder'), 'json');
  38. if(is_error($data)) {
  39. echo json_encode(array('errno'=>0, 'message'=>'无权限进入工单系统'));
  40. exit;
  41. }
  42. $iframe_url = $data['data']['url'] . '&' . $param;
  43. echo json_encode(array('errno'=>0, 'message'=>'', 'data'=>array('url'=>$iframe_url)));
  44. exit;
  45. }