<?php

/**
 * 模块小程序接口定义
 * @author 人资
 * @url
 */
defined('IN_IA') or exit('Access Denied');
define('APP_NAME', 'xm_mallv3');
define('DB_PREFIX', APP_NAME.'_');
define('ADDON_PATH', IA_ROOT . "/addons/" . APP_NAME);
define('TP_IDNEX',   '/public/index.php');
define('TP_APIURL',   "/addons/" . APP_NAME . '/public');

class Xm_mallv3ModuleWxapp extends WeModuleWxapp
{
    //重构父类的call方法
    public function __call($name, $arguments)
    {
        $do = ucfirst(substr($name, 6));

        $doDir = 'index';

        if (empty($_GET["do"])) {
            $_GET["do"] = $do;
        }

        $stmp = explode('.', $_GET["do"]);

        if (empty($stmp[1])) {
            $_GET["do"] = $_GET["do"] . "/index";
        } else {
            $_GET["do"] = $stmp[0] . "/" . $stmp[1];
        }
        if (!empty($stmp[2])) {
            $_GET["do"] = $_GET["do"] . "/" . $stmp[2];
        }
        if (strtolower($stmp[0]) == strtolower($doDir)) {
            $_GET["do"] = $_GET["do"];
        } else {
            $_GET["do"] = $doDir . '/' . $_GET["do"];
        }

        $_GET["s"] = strtolower($_GET["do"]);
        require ADDON_PATH . TP_IDNEX;

        exit;
        return null;
    }
}
