133 lines
4.6 KiB
PHP
133 lines
4.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* 公共用户可以访问的类(不需要登录)
|
|
*/
|
|
|
|
namespace app\home\controller;
|
|
use think\facade\Lang;
|
|
/**
|
|
* ============================================================================
|
|
* 联课教育商城系统
|
|
* ============================================================================
|
|
* 版权所有 2022 刻羽互动科技有限公司,并保留所有权利。
|
|
* 网站地址: http://www.o1h.cn
|
|
* ----------------------------------------------------------------------------
|
|
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
|
|
* 不允许对程序代码以任何形式任何目的的再发布。
|
|
* ============================================================================
|
|
* 控制器
|
|
*/
|
|
class BaseMall extends BaseHome {
|
|
|
|
public function initialize() {
|
|
parent::initialize();
|
|
Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/basemall.lang.php');
|
|
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').'/goodsdetail?'.$param);
|
|
exit;
|
|
}elseif ($controller == 'Showgroupbuy' && $action == 'index'){//抢购列表
|
|
header('Location:'.config('ds_config.h5_site_url').'/groupbuy_list');
|
|
exit;
|
|
}elseif ($controller == 'Search' && $action == 'index'){//搜索
|
|
header('Location:'.config('ds_config.h5_site_url').'/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').'/goodsdetail?goods_id='.$goods_id);
|
|
exit;
|
|
}elseif ($controller == 'Store' && $action == 'goods_all'){//店铺商品列表
|
|
header('Location:'.config('ds_config.h5_site_url').'/store_goodslist?'.$param);
|
|
exit;
|
|
}elseif ($controller == 'Category' && $action == 'goods'){//分类
|
|
header('Location:'.config('ds_config.h5_site_url').'/goodsclass');
|
|
exit;
|
|
}else {
|
|
header('Location:'.config('ds_config.h5_site_url'));exit;//其它页面跳转到首页
|
|
}
|
|
}
|
|
|
|
|
|
public function getSimpleName($name)
|
|
{
|
|
$simple = '';
|
|
if ($name == 'Central State University') {
|
|
$simple = 'CSU';
|
|
}
|
|
if ($name == 'Northern Arizona University') {
|
|
$simple = 'NAU';
|
|
}
|
|
if ($name == 'University of California, Berkeley') {
|
|
$simple = 'UC Berkeley';
|
|
}
|
|
if ($name == 'Olympic College') {
|
|
$simple = 'OC';
|
|
}
|
|
if ($name == 'California State Polytechnic University, Pomona') {
|
|
$simple = 'CPP';
|
|
}
|
|
if ($name == 'McGill University') {
|
|
$simple = 'McGill';
|
|
}
|
|
if ($name == 'University of Florida') {
|
|
$simple = 'UFL';
|
|
}
|
|
if ($name == 'University of New Brunswick') {
|
|
$simple = 'UNB';
|
|
}
|
|
if ($name == 'Arizona State University') {
|
|
$simple = 'ASU';
|
|
}
|
|
|
|
if ($name == "Thompson Rivers University") {
|
|
$simple = 'TRU';
|
|
}
|
|
if ($name == 'Colorado State University Pueblo') {
|
|
$simple = 'CSU Pueblo';
|
|
}
|
|
if ($name == 'San Francisco State University') {
|
|
$simple = 'SFSU';
|
|
}
|
|
if ($name == 'San Diego State University') {
|
|
$simple = 'SDSU';
|
|
}
|
|
if ($name == 'University of Wisconsin-Green Bay') {
|
|
$simple = 'UWGB';
|
|
}
|
|
if ($name == 'Trine University') {
|
|
$simple = 'Trine';
|
|
}
|
|
if ($name == 'Fulton-Montgomery Community College') {
|
|
$simple = 'FMCC';
|
|
}
|
|
if ($name == 'Ryerson University') {
|
|
$simple = 'Ryerson';
|
|
}
|
|
if ($name == 'Sichuan University') {
|
|
$simple = 'SCU';
|
|
}
|
|
|
|
|
|
return $simple;
|
|
}
|
|
}
|
|
|
|
?>
|