1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?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;
- }
- }
- }
|