3 Star 0 Fork 0

邓云溪 / 尊道

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1.php 16.85 KB
一键复制 编辑 原始数据 按行查看 历史
邓云溪 提交于 2017-09-11 18:49 . no commit message
<?php
namespace Mobile\Controller;
class ShopController extends MobileController
{
public function index()
{
if (($this->is_wx == 1) && (!PID || (PID != UID))) {
$this->redirect('index');
}
$PageDesign = d('PageDesign');
$Shop = m('Shop');
$Item = d('Item');
$User = m('User');
$shop_title = '';
$where_id = (PID ? PID : UID);
$is_store_log = config('is_store_log');
$is_store_log = (is_null($is_store_log) ? 1 : $is_store_log);
if ($where_id && $is_store_log) {
$store = $User->where('user_id = ' . $where_id . ' AND shop_id = ' . SHOP_ID . ' AND is_user_del = 0')->field('store_title, store_logo, superior_user_id,is_agent')->find();
if (!$store['is_agent']) {
$store['store_title'] = null;
$store['store_logo'] = null;
}
if (!$store['store_title'] && $store['superior_user_id']) {
$store['store_title'] = $User->where('user_id = ' . $store['superior_user_id'] . ' AND shop_id = ' . SHOP_ID . ' AND is_user_del = 0')->getField('store_title');
}
if (!$store['store_logo'] && $store['superior_user_id']) {
$store['store_logo'] = $User->where('user_id = ' . $store['superior_user_id'] . ' AND shop_id = ' . SHOP_ID . ' AND is_user_del = 0')->getField('store_logo');
}
$page_title = $shop_title = $store['store_title'];
$is_store_name = config('is_store_name');
if ($is_store_name == 1) {
if (!$store['store_title']) {
$shop = m('Shop')->where('shop_id = ' . SHOP_ID)->field('title')->find();
if (isset($shop['title']) && $shop['title']) {
$store['store_title'] = $shop['title'];
}
}
$page_title = $shop_title = config('store_prefix') . $store['store_title'];
}
}
if (!$shop_title) {
$shop_title = $Shop->where('shop_id = ' . SHOP_ID)->getField('title');
}
$this->assign('shop_title', $shop_title);
$res = d('PageDesign')->get_content(3);
if (isset($res['PModules'][0]['content']['showInhome']) && ($res['PModules'][0]['content']['showInhome'] == false)) {
$this->assign('hide_nav', true);
}
if (!($homepage_tpl_id = i('tid'))) {
$homepage_tpl_id = config('homepage_tpl_id');
$homepage_tpl_id = (!is_null($homepage_tpl_id) ? $homepage_tpl_id : c('HOMEPAGE_TPL_ID'));
}
$content = $PageDesign->get_content(1, $homepage_tpl_id);
if (!isset($page_title)) {
if (isset($content['page']['title'])) {
$page_title = $content['page']['title'];
}
else {
$page_title = '商城首页';
}
}
$this->assign('page_title', $page_title);
$opacity = '';
if (isset($content['PModules'][0]['content']['opacity'])) {
$opacity = $content['PModules'][0]['content']['opacity'];
}
$this->assign('opacity', $opacity);
switch ($homepage_tpl_id) {
case 1:
$header_bg = '';
if (isset($content['PModules'][0]['content']['bg'])) {
$header_bg = $content['PModules'][0]['content']['bg'];
}
$this->assign('header_bg', $header_bg);
$header_photo = '';
if (isset($store['store_logo']) && !empty($store['store_logo'])) {
$header_photo = $store['store_logo'];
}
else if (isset($content['PModules'][0]['content']['photo'])) {
$header_photo = $content['PModules'][0]['content']['photo'];
}
$this->assign('header_photo', $header_photo);
$itemNum = $Item->itemNum();
$this->assign('itemNum', $itemNum);
$newItemNum = $Item->newItemNum();
$this->assign('newItemNum', $newItemNum);
break;
case 2:
$this->assign('PModules', $content['PModules'][0]['content']);
$this->assign('bg_img', $content['PModules'][0]['content']['bg']);
$this->assign('hide_bottom', true);
$this->assign('hide_footer', true);
break;
case 3:
$this->assign('PModules', $content['PModules'][0]['content']);
$this->assign('bg_img', $content['PModules'][0]['content']['bg']);
$this->assign('hide_bottom', true);
$this->assign('hide_footer', true);
break;
case 4:
$this->assign('PModules', $content['PModules'][0]['content']['dataset']);
$this->assign('bg_img', $content['PModules'][0]['content']['bg']);
$this->assign('hide_bottom', true);
$this->assign('hide_footer', true);
break;
case 5:
$this->assign('PModules', $content['PModules'][0]['content']);
$this->assign('bg_img', $content['PModules'][0]['content']['bg']);
$this->assign('hide_bottom', true);
$this->assign('hide_footer', true);
break;
case 6:
$this->assign('PModules', $content['PModules'][0]['content']);
$this->assign('bg_img', $content['PModules'][0]['content']['bg']);
$this->assign('hide_bottom', true);
$this->assign('hide_footer', true);
break;
case 7:
$header_bg = '';
if (isset($content['PModules'][0]['content']['bg'])) {
$header_bg = $content['PModules'][0]['content']['bg'];
}
$this->assign('header_bg', $header_bg);
$header_photo = '';
if (isset($store['store_logo']) && !empty($store['store_logo'])) {
$header_photo = $store['store_logo'];
}
else if (isset($content['PModules'][0]['content']['photo'])) {
$header_photo = $content['PModules'][0]['content']['photo'];
}
$this->assign('header_photo', $header_photo);
$itemNum = $Item->itemNum();
$this->assign('itemNum', $itemNum);
$newItemNum = $Item->newItemNum();
$this->assign('newItemNum', $newItemNum);
$this->assign('PModules', $content['PModules'][0]['content']['dataset']);
break;
case 8:
$this->assign('PModules', $content['PModules'][0]['content']['dataset']);
$this->assign('bg_img', $content['PModules'][0]['content']['bg']);
$this->assign('hide_bottom', true);
$this->assign('hide_footer', true);
break;
case 9:
$itemNum = $Item->itemNum();
$this->assign('itemNum', $itemNum);
$newItemNum = $Item->newItemNum();
$this->assign('newItemNum', $newItemNum);
$header_bg = '';
if (isset($content['PModules'][0]['content']['bg'])) {
$header_bg = $content['PModules'][0]['content']['bg'];
}
$this->assign('header_bg', $header_bg);
$header_photo = '';
if (isset($store['store_logo']) && !empty($store['store_logo'])) {
$header_photo = $store['store_logo'];
}
else if (isset($content['PModules'][0]['content']['photo'])) {
$header_photo = $content['PModules'][0]['content']['photo'];
}
$this->assign('header_photo', $header_photo);
break;
case 12:
$header_bg = '';
if (isset($content['PModules'][0]['content']['bg'])) {
$header_bg = $content['PModules'][0]['content']['bg'];
}
$this->assign('header_bg', $header_bg);
$header_photo = '';
if (isset($store['store_logo']) && !empty($store['store_logo'])) {
$header_photo = $store['store_logo'];
}
else if (isset($content['PModules'][0]['content']['photo'])) {
$header_photo = $content['PModules'][0]['content']['photo'];
}
$this->assign('header_photo', $header_photo);
$itemNum = $Item->itemNum();
$this->assign('itemNum', $itemNum);
$newItemNum = $Item->newItemNum();
$this->assign('newItemNum', $newItemNum);
$this->assign('PModules', $content['PModules'][0]['content']['dataset']);
break;
case 13:
$header_bg = '';
if (isset($content['PModules'][0]['content']['bg'])) {
$header_bg = $content['PModules'][0]['content']['bg'];
}
$this->assign('header_bg', $header_bg);
$header_photo = '';
if (isset($store['store_logo']) && !empty($store['store_logo'])) {
$header_photo = $store['store_logo'];
}
else if (isset($content['PModules'][0]['content']['photo'])) {
$header_photo = $content['PModules'][0]['content']['photo'];
}
$this->assign('header_photo', $header_photo);
$itemNum = $Item->itemNum();
$this->assign('itemNum', $itemNum);
$newItemNum = $Item->newItemNum();
$this->assign('newItemNum', $newItemNum);
$this->assign('PModules', $content['PModules'][0]['content']['dataset']);
break;
case 14:
$this->assign('PModules', $content['PModules'][0]['content']['dataset']);
$this->assign('bg_img', $content['PModules'][0]['content']['bg']);
$this->assign('hide_bottom', true);
$this->assign('hide_footer', true);
break;
case 15:
$header_bg = '';
if (isset($content['PModules'][0]['content']['bg'])) {
$header_bg = $content['PModules'][0]['content']['bg'];
}
$this->assign('header_bg', $header_bg);
$header_photo = '';
if (isset($store['store_logo']) && !empty($store['store_logo'])) {
$header_photo = $store['store_logo'];
}
else if (isset($content['PModules'][0]['content']['photo'])) {
$header_photo = $content['PModules'][0]['content']['photo'];
}
$this->assign('header_photo', $header_photo);
$itemNum = $Item->itemNum();
$this->assign('itemNum', $itemNum);
$newItemNum = $Item->newItemNum();
$this->assign('newItemNum', $newItemNum);
$this->assign('PModules', $content['PModules'][0]['content']['dataset']);
break;
case 16:
$header_bg = '';
if (isset($content['PModules'][0]['content']['bg'])) {
$header_bg = $content['PModules'][0]['content']['bg'];
}
$this->assign('header_bg', $header_bg);
$header_photo = '';
if (isset($store['store_logo']) && !empty($store['store_logo'])) {
$header_photo = $store['store_logo'];
}
else if (isset($content['PModules'][0]['content']['photo'])) {
$header_photo = $content['PModules'][0]['content']['photo'];
}
$this->assign('header_photo', $header_photo);
$itemNum = $Item->itemNum();
$this->assign('itemNum', $itemNum);
$newItemNum = $Item->newItemNum();
$this->assign('newItemNum', $newItemNum);
$this->assign('PModules', $content['PModules'][0]['content']['dataset']);
break;
case 20:
$this->assign('PModules', $content['PModules'][0]['content']);
$this->assign('bg_img', $content['PModules'][0]['content']['bg']);
$this->assign('hide_bottom', true);
$this->assign('hide_footer', true);
break;
case 21:
$header_photo = '';
if (isset($store['store_logo']) && !empty($store['store_logo'])) {
$header_photo = $store['store_logo'];
}
else if (isset($content['PModules'][0]['content']['photo'])) {
$header_photo = $content['PModules'][0]['content']['photo'];
}
$this->assign('header_photo', $header_photo);
$this->assign('PModules', $content['PModules'][0]['content']);
$this->assign('bg_img', $content['PModules'][0]['content']['bg']);
$this->assign('hide_bottom', true);
$this->assign('hide_footer', true);
break;
default:
$this->assign('PModules', $content['PModules'][0]['content']['dataset']);
$this->assign('showType', $content['PModules'][0]['content']['showType']);
$this->assign('bg_img', $content['PModules'][0]['content']['bg']);
$this->assign("tplid",$homepage_tpl_id);
break;
}
$diyHtml = '';
if (isset($content['LModules'])) {
foreach ($content['LModules'] as $k => $v) {
$diyHtml .= R('Diy/getHtml', $content['LModules']);
unset($content['LModules'][$k]);
}
}
$this->assign('diyHtml', $diyHtml);
$nickname = d('Home/User')->getNick(UID);
$author = d('Home/User')->getHeadImg(UID);
$this->assign('nickname', $nickname);
$this->assign('avatars', $author);
$avatar = m('Shop')->where('shop_id = ' . SHOP_ID . ' AND status = 1')->getField('avatar');
$this->assign('avatar', $avatar);
$alias = m('Shop')->where('shop_id = ' . SHOP_ID)->getField('alias');
$is_agent = m('User')->where('user_id = ' . UID . ' AND is_user_del = 0')->getField('is_agent');
$show_shop_app = (is_null(config('show_shop_app')) ? c('SHOW_SHOP_APP') : config('show_shop_app'));
if ($alias && (CONTROLLER_NAME == 'Shop') && (ACTION_NAME == 'index') && !isapp() && ($_SERVER['HTTP_HOST'] != 'm.amiablechina.com') && $show_shop_app && $is_agent) {
$this->assign('is_shop', true);
$this->assign('alias', $alias);
$this->show_app_time = (is_null(config('show_app_time')) ? 5 : config('show_app_time')) * 1000;
}
$this->display('index' . $homepage_tpl_id);
}
public function module()
{
$id = intval(i('id'));
if (!$id) {
$this->error('抱歉,链接错误!');
}
if (($this->is_wx == 1) && (!PID || (PID != UID))) {
$this->redirect('module?id=' . $id);
}
$CustomModule = m('CustomModule');
$map = array('shop_id' => SHOP_ID, 'custom_module_id' => $id);
$content = $CustomModule->where($map)->getField('content');
$content = (!$content ? array() : json_decode(htmlspecialchars_decode($content), true));
$page_title = '';
if (isset($content['page']['title'])) {
$page_title = $content['page']['title'];
}
$this->assign('page_title', $page_title);
$diyHtml = '';
if ($content['LModules']) {
foreach ($content['LModules'] as $k => $v) {
$diyHtml .= r('Diy/getHtml', $content['LModules']);
unset($content['LModules'][$k]);
}
}
$this->assign('diyHtml', $diyHtml);
$this->display();
}
public function app_down()
{
$alias = m('Shop')->where('shop_id = ' . SHOP_ID)->getField('alias');
$this->assign('alias', $alias);
$iphone_link = config('ios_app_url');
$android_link = config('android_app_url');
if ($iphone_link && $android_link) {
$is_customized = 1;
}
else {
$is_customized = 0;
}
$this->assign('is_customized', $is_customized);
if (!$iphone_link) {
$iphone_link = 'itms-services://?action=download-manifest&url=https://chuanbobao.cn/App/customer/eshoe360/manifest.plist';
}
if (!$android_link) {
$android_link = c('FRONT_URL') . '/Public/app/eshoe360.apk';
}
$this->assign(array('iphone_link' => $iphone_link, 'android_link' => $android_link));
$this->display();
}
}
?>
PHP
1
https://gitee.com/yunxi59/zundao.git
git@gitee.com:yunxi59/zundao.git
yunxi59
zundao
尊道
master

搜索帮助