12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace app\home\controller;
- use think\facade\Lang;
- class BaseMall extends BaseHome {
- public function initialize() {
- parent::initialize();
- if(request()->isMobile() && config('ds_config.h5_force_redirect')){
- $this->isHomeUrl();
- }
- $this->template_dir = 'default/mall/'. strtolower(request()->controller()).'/';
- }
-
- protected function isHomeUrl(){
- $controller = request()->controller();
- $action = request()->action();
- $input = request()->param();
- $param = http_build_query($input);
- if ($controller == 'Goods' && $action == 'index'){
- header('Location:'.config('ds_config.h5_site_url').'/pages/home/goodsdetail/Goodsdetail?'.$param);
- exit;
- }elseif ($controller == 'Showgroupbuy' && $action == 'index'){
- header('Location:'.config('ds_config.h5_site_url').'/pages/home/groupbuy/GroupBuyList');
- exit;
- }elseif ($controller == 'Search' && $action == 'index'){
- header('Location:'.config('ds_config.h5_site_url').'/pages/home/goodslist/Goodslist');
- exit;
- }elseif ($controller == 'Showgroupbuy' && $action == 'groupbuy_detail'){
- $goods_id = model('groupbuy')->getGroupbuyOnlineInfo(array(array('groupbuy_id' ,'=', $input['group_id'])))['goods_id'];
- header('Location:'.config('ds_config.h5_site_url').'/pages/home/goodsdetail/Goodsdetail?goods_id='.$goods_id);
- exit;
- }elseif ($controller == 'Store' && $action == 'goods_all'){
- header('Location:'.config('ds_config.h5_site_url').'/pages/home/storegoodslist/Goodslist?'.$param);
- exit;
- }elseif ($controller == 'Category' && $action == 'goods'){
- header('Location:'.config('ds_config.h5_site_url').'/pages/home/goodsclass/Goodsclass');
- exit;
- }else {
- header('Location:'.config('ds_config.h5_site_url'));exit;
- }
- }
- }
- ?>
|