Authored by hf

do modify cuxiao coupon huodong js add checkout is logged

... ... @@ -64,46 +64,8 @@ class Bootstrap extends Bootstrap_Abstract
*/
public function _initRoute(Dispatcher $dispatcher)
{
$hostParts = explode('.', $dispatcher->getRequest()->getServer('HTTP_HOST', ''));
$level = count($hostParts) - 1;
/* 根据域名的级别,设置默认的模块、控制器、方法 */
$module = 'Index';
$controller = 'Index';
$action = 'Index';
// 三级域名
if (3 === $level) {
$subDomain = strval($hostParts[0]);
switch (strtolower($subDomain)) {
case 'm': // 老版(到频道选择)
case 'buy': // 测试环境的域名, 以后可去掉
break;
case 'new': // 原新版(到男生首页)
$controller = 'Boys';
break;
case 'search': // 搜索
$controller = 'Search';
$action = 'List';
break;
case 'guang': // 逛
$module = 'Guang';
break;
case 'list': // 商品列表
$module = 'Product';
break;
default: // 其它(识别为品牌)
$module = 'Product';
$action = 'Brand';
$dispatcher->getRequest()->setParam('named', $subDomain);
break;
}
}
$dispatcher->getRequest()->module = $module;
$dispatcher->getRequest()->controller = $controller;
$dispatcher->getRequest()->action = $action;
/* 根据对应模块的配置,添加相应的路由规则 */
$iniFile = APPLICATION_PATH . '/configs/routes.' . strtolower($module) . '.ini';
$iniFile = APPLICATION_PATH . '/configs/routes.index.ini';
if (file_exists($iniFile)) {
$config = new Config\Ini($iniFile);
if (isset($config->routes)) {
... ...
... ... @@ -501,32 +501,18 @@ class CouponController extends HuodongAction
{
do {
/* 判断是否有参数 */
$param = $this->get();
if (empty($param)) {
$uid = $this->get('uid');
if (empty($uid) || !is_numeric($uid) ) {
break;
}
/* 判断参数是否有效 */
if (!isset($param['client_secret']) || empty($param['uid'])) {
$secret = $this->get('client_secret');
if (!isset($secret) ) {
break;
}
/* 取消无用的参数 */
$uri = key($param);
if (false !== stripos($uri, 'cuxiao/')) {
unset($param[$uri]);
}
/* 验证公钥是否有效 */
$clientSecret = $param['client_secret'];
$publicParam = Yohobuy::param();
$param['private_key'] = $publicParam['private_key'];
unset($param['client_secret']);
if ($clientSecret !== Sign::makeSign($param)) {
break;
}
$this->setSession(self::SESSION_UID, $param['uid']);
$this->setSession(self::SESSION_UID, $uid);
return true;
... ...