wxapp.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * 模块小程序接口定义
  4. * @author 人资
  5. * @url
  6. */
  7. defined('IN_IA') or exit('Access Denied');
  8. define('APP_NAME', 'xm_mallv3');
  9. define('DB_PREFIX', APP_NAME.'_');
  10. define('ADDON_PATH', IA_ROOT . "/addons/" . APP_NAME);
  11. define('TP_IDNEX', '/public/index.php');
  12. define('TP_APIURL', "/addons/" . APP_NAME . '/public');
  13. class Xm_mallv3ModuleWxapp extends WeModuleWxapp
  14. {
  15. //重构父类的call方法
  16. public function __call($name, $arguments)
  17. {
  18. $do = ucfirst(substr($name, 6));
  19. $doDir = 'index';
  20. if (empty($_GET["do"])) {
  21. $_GET["do"] = $do;
  22. }
  23. $stmp = explode('.', $_GET["do"]);
  24. if (empty($stmp[1])) {
  25. $_GET["do"] = $_GET["do"] . "/index";
  26. } else {
  27. $_GET["do"] = $stmp[0] . "/" . $stmp[1];
  28. }
  29. if (!empty($stmp[2])) {
  30. $_GET["do"] = $_GET["do"] . "/" . $stmp[2];
  31. }
  32. if (strtolower($stmp[0]) == strtolower($doDir)) {
  33. $_GET["do"] = $_GET["do"];
  34. } else {
  35. $_GET["do"] = $doDir . '/' . $_GET["do"];
  36. }
  37. $_GET["s"] = strtolower($_GET["do"]);
  38. require ADDON_PATH . TP_IDNEX;
  39. exit;
  40. return null;
  41. }
  42. }