subscribe.ctrl.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. $dos = array('receive', '');
  8. $do = in_array($do, $dos) ? $do: '';
  9. $_W['uniacid'] = intval($_GPC['i']);
  10. if (empty($_W['uniacid'])) {
  11. iajax(1, '请先指定公众号');
  12. }
  13. $_W['account'] = uni_fetch($_W['uniacid']);
  14. if ($do == 'receive') {
  15. ignore_user_abort(true);
  16. set_time_limit(30);
  17. $modulename = $_GPC['modulename'];
  18. $request = json_decode(html_entity_decode($_GPC['request']), true);
  19. $response = json_decode(html_entity_decode($_GPC['response']), true);
  20. $message = json_decode(html_entity_decode($_GPC['message']), true);
  21. $module = module_fetch($modulename);
  22. if (!empty($module)) {
  23. $module_receiver = WeUtility::createModuleReceiver($modulename);
  24. $module_receiver->message = $message;
  25. $module_receiver->params = $request;
  26. $module_receiver->response = $response;
  27. $module_receiver->keyword = $request['keyword'];
  28. $module_receiver->module = $module;
  29. $module_receiver->uniacid = $_W['uniacid'];
  30. if(method_exists($module_receiver, 'receive')) {
  31. @$module_receiver->receive();
  32. }
  33. }
  34. }