人人商城

wxapp.ctrl.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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('miniapp');
  8. if (strexists($_SERVER['HTTP_REFERER'], 'https://servicewechat.com/')) {
  9. $referer_url = parse_url($_SERVER['HTTP_REFERER']);
  10. list($appid, $version) = explode('/', ltrim($referer_url['path'], '/'));
  11. }
  12. if (!empty($_W['uniacid'])) {
  13. $version = trim($_GPC['v']);
  14. $version_info = miniapp_version_by_version($version);
  15. if (!empty($version_info['modules'])) {
  16. foreach ($version_info['modules'] as $module) {
  17. if (!empty($module['account']) && intval($module['account']['uniacid']) > 0) {
  18. $_W['uniacid'] = $module['account']['uniacid'];
  19. $_W['account']['link_uniacid'] = $module['account']['uniacid'];
  20. }
  21. }
  22. }
  23. }
  24. $site = WeUtility::createModuleWxapp($entry['module']);
  25. $method = 'doPage' . ucfirst($entry['do']);
  26. if(!is_error($site)) {
  27. $site->appid = $appid;
  28. $site->version = $version;
  29. if (!empty($site->token)) {
  30. if (!$site->checkSign()) {
  31. message(error(1, '签名错误'), '', 'ajax');
  32. }
  33. }
  34. if (!empty($_GPC['state']) && strexists($_GPC['state'], 'we7sid-') && (empty($_W['openid']) || empty($_SESSION['openid']))) {
  35. $site->result(41009, '请登录');
  36. }
  37. exit($site->$method());
  38. }
  39. exit();