925 行
50 KiB
PHP
可执行文件
925 行
50 KiB
PHP
可执行文件
<?php
|
||
|
||
namespace SmallProgramApi\Controller;
|
||
|
||
use Common\Model\AdvanceSkuGoodsModel;
|
||
use Common\Model\ImageGalleryModel;
|
||
use Common\Model\RetailBannerModel;
|
||
use Common\Model\RetailBillAdvanceModel;
|
||
use Common\Model\RetailCardPropagandaModel;
|
||
use Common\Model\RetailGiftCardCoverModel;
|
||
use Common\Model\RetailGiftCardModel;
|
||
use Common\Model\RetailGoodsClassModel;
|
||
use Common\Model\RetailGroupViewModel;
|
||
use Common\Model\RetailMagicCubeModel;
|
||
use Common\Model\RetailMerchantModel;
|
||
use Common\Model\RetailPlugMerchantModel;
|
||
use Common\Model\RetailPlugModel;
|
||
use Common\Model\RetailSpikeViewModel;
|
||
use Common\Model\RetailStoreModel;
|
||
use Common\Model\RetailStoreXcxConfigModel;
|
||
use Common\Model\RetailXcxNavigationModel;
|
||
|
||
header("Access-Control-Allow-Origin: *");
|
||
header("Access-Control-Allow-Methods: POST");
|
||
header('Access-Control-Allow-Headers:x-requested-with,content-type');
|
||
|
||
//[1.8.20]
|
||
|
||
class BaseSetController extends BaseController
|
||
{
|
||
/*
|
||
* 获取首页拼团,秒杀,礼品卡,付款码,客服,小图标数据
|
||
* */
|
||
public function getHomeData()
|
||
{
|
||
if (IS_POST) {
|
||
$merchant_id = self::$merchant_id;
|
||
$store_id = self::$store_id;
|
||
if (!empty($store_id) && !empty($merchant_id)) {
|
||
//-----------------------------------------------------------拼团获取封面图-----------------------------------------------------------
|
||
$PlugModel = new RetailPlugModel();
|
||
$StoreXcxConfigModel = new RetailStoreXcxConfigModel();
|
||
// 判断是否有拼团插件 门店是否开启了拼团插件
|
||
|
||
$where = array('p.plug_name' => '拼团', 'p.status' => 1, 's.storeid' => $store_id);
|
||
$field = array(
|
||
'p.*',
|
||
's.s_status'
|
||
);
|
||
$plug_group = $PlugModel->getPlugStatus($where, $field);
|
||
|
||
if (!empty($plug_group) && $plug_group['s_status'] == 1) {
|
||
$field = array(
|
||
$StoreXcxConfigModel::HOME_GROUP_STATUS,
|
||
$StoreXcxConfigModel::GROUP_STATUS,
|
||
$StoreXcxConfigModel::XCX_GROUP_COVER_ID,
|
||
);
|
||
$xcx_group_status = $StoreXcxConfigModel->getFind(array($StoreXcxConfigModel::STORE_ID => $store_id), $field);
|
||
if (!empty($xcx_group_status) && $xcx_group_status[$StoreXcxConfigModel::GROUP_STATUS] == 1 && $xcx_group_status[$StoreXcxConfigModel::HOME_GROUP_STATUS] == 1) {
|
||
if (empty($xcx_group_status[$StoreXcxConfigModel::XCX_GROUP_COVER_ID])) {
|
||
$res['group_status'] = 1;
|
||
$res['group_msg'] = '无拼团封面图';
|
||
} else {
|
||
$img = $this->getGoodsImage($xcx_group_status[$StoreXcxConfigModel::XCX_GROUP_COVER_ID]);
|
||
$res['group_status'] = 1;
|
||
$res['group_msg'] = '拼团封面图查询成功';
|
||
$res['xcx_group_cover'] = $img;
|
||
}
|
||
} else {
|
||
$res['group_status'] = 0;
|
||
$res['group_msg'] = '拼团未展示';
|
||
}
|
||
} else {
|
||
$res['group_status'] = 0;
|
||
$res['group_msg'] = '门店没有拼团权限';
|
||
}
|
||
unset($where);
|
||
unset($field);
|
||
//-----------------------------------------------------------秒杀获取封面图-----------------------------------------------------------
|
||
// 判断是否有秒杀插件 门店是否开启了秒杀插件
|
||
$where = array('p.plug_name' => '秒杀', 'p.status' => 1, 's.storeid' => $store_id);
|
||
$field = array(
|
||
'p.*',
|
||
's.status'
|
||
);
|
||
$plug_seckill = $PlugModel->getPlugStatus($where, $field);
|
||
if (!empty($plug_seckill) && $plug_seckill['s_status'] == 1) {
|
||
$field = array(
|
||
$StoreXcxConfigModel::HOME_SECKILL_STATUS,
|
||
$StoreXcxConfigModel::SECKILL_STATUS,
|
||
$StoreXcxConfigModel::XCX_SECKILL_COVER_ID,
|
||
);
|
||
$secKill_status = $StoreXcxConfigModel->getFind(array($StoreXcxConfigModel::STORE_ID => $store_id), $field);
|
||
if (!empty($secKill_status) && $secKill_status[$StoreXcxConfigModel::SECKILL_STATUS] == 1 && $secKill_status[$StoreXcxConfigModel::HOME_SECKILL_STATUS] == 1) {
|
||
if (empty($secKill_status[$StoreXcxConfigModel::XCX_SECKILL_COVER_ID])) {
|
||
$res['sec_kill_status'] = 1;
|
||
$res['sec_kill_msg'] = '无秒杀封面图';
|
||
} else {
|
||
$img = $this->getGoodsImage($secKill_status[$StoreXcxConfigModel::XCX_SECKILL_COVER_ID]);
|
||
$res['sec_kill_status'] = 1;
|
||
$res['sec_kill_msg'] = '秒杀封面图查询成功';
|
||
$res['sec_kill_cover'] = $img;
|
||
}
|
||
} else {
|
||
$res['sec_kill_status'] = 0;
|
||
$res['sec_kill_msg'] = '秒杀未展示';
|
||
}
|
||
} else {
|
||
$res['sec_kill_status'] = 0;
|
||
$res['sec_kill_msg'] = '门店暂无秒杀权限';
|
||
}
|
||
unset($where);
|
||
unset($field);
|
||
//-----------------------------------------------------------礼品卡获取封面图-----------------------------------------------------------
|
||
$CardPropagandaModel = new RetailCardPropagandaModel();
|
||
$where[$CardPropagandaModel::MERCHANT_ID] = $merchant_id;
|
||
$where[$CardPropagandaModel::STATUS] = 1;
|
||
$list = $CardPropagandaModel->getFind($where);
|
||
if (!empty($list) && !empty($list[$CardPropagandaModel::IMG_URL_ID])) {
|
||
$img = $this->getGoodsImage($list[$CardPropagandaModel::IMG_URL_ID]);
|
||
if ($img) {
|
||
if (empty($list[$CardPropagandaModel::TITLE])) {
|
||
$list[$CardPropagandaModel::TITLE] = '狂欢大促';
|
||
}
|
||
$gift_data['img_url'] = $img;
|
||
$gift_data['title'] = $list[$CardPropagandaModel::TITLE];
|
||
$res['gift_data'] = $gift_data;
|
||
$res['gift_status'] = 1;
|
||
$res['gift_msg'] = '礼品卡封面图查询成功';
|
||
} else {
|
||
$res['gift_status'] = 0;
|
||
$res['gift_msg'] = '礼品卡封面图查询失败';
|
||
}
|
||
} else {
|
||
$res['gift_status'] = 0;
|
||
$res['gift_msg'] = '商家未设置展示图';
|
||
}
|
||
unset($where);
|
||
unset($field);
|
||
//-----------------------------------------------------------付款码是否显示-----------------------------------------------------------
|
||
$num = $StoreXcxConfigModel->getFind(array($StoreXcxConfigModel::STORE_ID => $store_id), $StoreXcxConfigModel::PROGRAM_CODE_STATUS);
|
||
if (empty($num) || $num[$StoreXcxConfigModel::PROGRAM_CODE_STATUS] == 1) {
|
||
$res['code_status'] = 1;
|
||
$res['code_msg'] = '显示付款码';
|
||
} else {
|
||
$res['code_status'] = 0;
|
||
$res['code_msg'] = '不显示付款码';
|
||
}
|
||
//----------------------------------------------门店展示客服和返回的自定义图标,获取客服类型-------------------------------------------
|
||
$StoreModel = new RetailStoreModel();
|
||
// 微信客服类型
|
||
$find_store = $StoreModel->getFind(array($StoreModel::ID => $store_id), array($StoreModel::PHONE, $StoreModel::CUSTOMER_SERVICE));
|
||
$find_store[$StoreModel::CUSTOMER_SERVICE] = !$find_store[$StoreModel::CUSTOMER_SERVICE] || !$find_store[$StoreModel::PHONE] ? 2 : $find_store[$StoreModel::CUSTOMER_SERVICE];
|
||
$field = $find_store[$StoreModel::CUSTOMER_SERVICE] == 2 ? $StoreXcxConfigModel::HOME_SUPPORT_ICON_ID . ',' . $StoreXcxConfigModel::HOME_BACK_ICON_ID : $StoreXcxConfigModel::HOME_TEL_ICON_ID . ',' . $StoreXcxConfigModel::HOME_BACK_ICON_ID;
|
||
$config = $StoreXcxConfigModel->getFind(array($StoreXcxConfigModel::STORE_ID => $store_id), $field);
|
||
if ($config) {
|
||
if (!empty($config[$StoreXcxConfigModel::HOME_BACK_ICON_ID])) {
|
||
$list['home_back_icon'] = $this->getGoodsImage($config[$StoreXcxConfigModel::HOME_BACK_ICON_ID]);
|
||
} else {
|
||
$list['home_back_icon'] = '';
|
||
}
|
||
if ($find_store[$StoreModel::CUSTOMER_SERVICE] == 2) {
|
||
if (!empty($config[$StoreXcxConfigModel::HOME_SUPPORT_ICON_ID])) {
|
||
$list['home_support_icon'] = $this->getGoodsImage($config[$StoreXcxConfigModel::HOME_SUPPORT_ICON_ID]);
|
||
} else {
|
||
$list['home_support_icon'] = '';
|
||
}
|
||
} else {
|
||
if (!empty($config[$StoreXcxConfigModel::HOME_TEL_ICON_ID])) {
|
||
$list['home_tel_icon'] = $this->getGoodsImage($config[$StoreXcxConfigModel::HOME_TEL_ICON_ID]);
|
||
} else {
|
||
$list['home_tel_icon'] = '';
|
||
}
|
||
}
|
||
} else {
|
||
$res['config'] = 0; // 门店未设置图标
|
||
}
|
||
$count = $StoreModel->getCount(array($StoreModel::STATE => 0, $StoreModel::STORE_STATUS => 0, $StoreModel::STATUS => 1, $StoreModel::MERCHANT_ID => $merchant_id));
|
||
if ($count) {
|
||
$store_id = $StoreModel->getFindField(array($StoreModel::ID => $store_id, $StoreModel::STATE => 0, $StoreModel::STORE_STATUS => 0, $StoreModel::STATUS => 1, $StoreModel::MERCHANT_ID => $merchant_id), $StoreModel::ID);
|
||
if (!$store_id) {
|
||
$count = -1;
|
||
}
|
||
}
|
||
$res['user_type'] = self::$user['user_type'];
|
||
$res['customer_service'] = $find_store[$StoreModel::CUSTOMER_SERVICE]; // 客服类型
|
||
$res['phone'] = $find_store[$StoreModel::CUSTOMER_SERVICE] == 2 ? '' : $find_store[$StoreModel::PHONE];
|
||
$res['icon'] = $list;
|
||
$res['xcxStoreCount'] = $count;
|
||
unset($where);
|
||
unset($field);
|
||
//----------------------------------------------首页轮播图下的小图标-------------------------------------------
|
||
$MerchantModel = new RetailMerchantModel();
|
||
$merchant = $MerchantModel->getFind(array($MerchantModel::ID => $merchant_id));
|
||
if (!empty($merchant)) {
|
||
$XcxNavigationModel = new RetailXcxNavigationModel();
|
||
$map[$XcxNavigationModel::STORE_ID] = $store_id;
|
||
$map[$XcxNavigationModel::MERCHANT_ID] = $merchant_id;
|
||
$map[$XcxNavigationModel::STATUS] = 1;
|
||
$navigation = $XcxNavigationModel->getSelect($map, '*', $XcxNavigationModel::RANK . ' asc');
|
||
if (!empty($navigation)) {
|
||
$GoodsClassModel = new RetailGoodsClassModel();
|
||
$MagicCubeModel = new RetailMagicCubeModel();
|
||
foreach ($navigation as $key => &$val) {
|
||
$val[$XcxNavigationModel::ICON] = $this->getGoodsImage($val[$XcxNavigationModel::ICON_ID]);
|
||
if ($val[$XcxNavigationModel::NAVIGATION_TYPE] == 1) {
|
||
if (!empty($val[$XcxNavigationModel::OTHER_URL])) {
|
||
$val['url'] = '../web/web?url=' . $val[$XcxNavigationModel::OTHER_URL];
|
||
} else {
|
||
unset($navigation[$key]);
|
||
}
|
||
} else if ($val[$XcxNavigationModel::NAVIGATION_TYPE] == 2) { // 分类
|
||
|
||
$class_goods_data = $GoodsClassModel->getFind(array($GoodsClassModel::ID => $val[$XcxNavigationModel::GOODS_CLASS_ID], $GoodsClassModel::MERCHANT_ID => $merchant_id, $GoodsClassModel::STATUS => 0, $GoodsClassModel::TYPE => 1));
|
||
if (!empty($class_goods_data)) {
|
||
$val['url'] = '../productList/productList?id=' . $class_goods_data[$GoodsClassModel::ID] . '&class_name=' . $class_goods_data[$GoodsClassModel::CLASS_NAME];
|
||
} else {
|
||
unset($navigation[$key]);
|
||
}
|
||
} else if ($val[$XcxNavigationModel::NAVIGATION_TYPE] == 3) { // 功能入口
|
||
|
||
$magic = $MagicCubeModel->getFind(array($MagicCubeModel::ID => $val[$XcxNavigationModel::MAGIC_CUBE_ID], $MagicCubeModel::STATUS => 1, $MagicCubeModel::STATE => 1));
|
||
if (!empty($magic)) {
|
||
if ($magic[$MagicCubeModel::TYPE] == 1 && $magic[$MagicCubeModel::URL] == '/pages/details/details' && !empty($val[$XcxNavigationModel::GOODS_ID])) {
|
||
$val['url'] = $magic[$MagicCubeModel::URL] . '?id=' . $val[$XcxNavigationModel::GOODS_ID];
|
||
} else if ($magic[$MagicCubeModel::TYPE] == 2 && $magic['/pages/myOrder/myOrder']) {
|
||
$val['url'] = $magic[$MagicCubeModel::URL];
|
||
} else {
|
||
$val['url'] = $magic[$MagicCubeModel::URL];
|
||
}
|
||
$plug_state = $this->plug_state($store_id, $merchant_id); // 判断插件是否开启
|
||
if ($magic[$MagicCubeModel::URL] == '/pages/Group-purchase/Group-purchase') {
|
||
if ($plug_state['group_status'] == false) {
|
||
unset($navigation[$key]);
|
||
}
|
||
}
|
||
if ($magic[$MagicCubeModel::URL] == '/pages/Seckill-purchase/Seckill-purchase') {
|
||
if ($plug_state['seckill_status'] == false) {
|
||
unset($navigation[$key]);
|
||
}
|
||
}
|
||
if ($magic[$MagicCubeModel::URL] == '/pages/gift_home/gift_home') {
|
||
if ($plug_state['gift_card_status'] == false) {
|
||
unset($navigation[$key]);
|
||
}
|
||
}
|
||
// 判断次卡
|
||
if ($magic[$MagicCubeModel::URL] == '/pages/subCard/subCard') {
|
||
if ($plug_state['sub_card_status'] == false) {
|
||
unset($navigation[$key]);
|
||
}
|
||
}
|
||
// 判断plus
|
||
if ($magic[$MagicCubeModel::URL] == '/pages/plusHome/plusHome') {
|
||
if ($plug_state['plus_status'] == false) {
|
||
unset($navigation[$key]);
|
||
}
|
||
}
|
||
} else {
|
||
unset($navigation[$key]);
|
||
}
|
||
}
|
||
}
|
||
$res['nav_status'] = 1;
|
||
$res['nav_data'] = $navigation;
|
||
$res['nav_msg'] = '查询成功';
|
||
} else {
|
||
$res['nav_status'] = 0;
|
||
$res['nav_msg'] = '门店暂未设置导航列表';
|
||
}
|
||
} else {
|
||
$res['nav_status'] = 0;
|
||
$res['nav_msg'] = '商户不存在';
|
||
}
|
||
} else {
|
||
$res['status'] = 0;
|
||
$res['msg'] = '缺少参数';
|
||
$this->ajaxReturn($res);
|
||
}
|
||
}
|
||
$this->ajaxReturn($res);
|
||
}
|
||
|
||
/*
|
||
* 判断拼团 秒杀插件状态
|
||
* */
|
||
private function plug_state($store_id, $merchant_id)
|
||
{
|
||
// 判断是否有拼团插件 门店是否开启了拼团插件
|
||
$PlugModel = new RetailPlugModel();
|
||
$StoreXcxConfigModel = new RetailStoreXcxConfigModel();
|
||
$PlugMerchantModel = new RetailPlugMerchantModel();
|
||
$plug_group_status = $PlugModel->getPlugStatus(array('p.plug_name' => '拼团', 'p.status' => 1, 's.storeid' => $store_id), 's.s_status');
|
||
|
||
if ($plug_group_status['s_status'] == 1) {
|
||
$xcx_group_status = $StoreXcxConfigModel->getFind(array($StoreXcxConfigModel::STORE_ID => $store_id), $StoreXcxConfigModel::GROUP_STATUS);
|
||
$res['group_status'] = $xcx_group_status[$StoreXcxConfigModel::GROUP_STATUS] == 1 ? true : false;
|
||
} else {
|
||
$res['group_status'] = false;
|
||
}
|
||
$plug_seckill_status = $PlugModel->getPlugStatus(array('p.plug_name' => '秒杀', 'p.status' => 1, 's.storeid' => $store_id), 's.s_status');
|
||
if ($plug_seckill_status['s_status'] == 1) {
|
||
$xcx_seckill_status = $StoreXcxConfigModel->getFind(array($StoreXcxConfigModel::STORE_ID => $store_id), $StoreXcxConfigModel::SECKILL_STATUS);
|
||
$res['seckill_status'] = $xcx_seckill_status[$StoreXcxConfigModel::SECKILL_STATUS] == 1 ? true : false;
|
||
} else {
|
||
$res['seckill_status'] = false;
|
||
}
|
||
//预售插件
|
||
$plug_advance_status = $PlugModel->getPlugStatus(array('p.id' => 45, 'p.status' => 1, 's.storeid' => $store_id), 's.s_status');
|
||
if ($plug_advance_status['s_status'] == 1) {
|
||
$xcx_advance_status = $StoreXcxConfigModel->getFind(array("storeid" => $store_id), "advance_sale_status");
|
||
$res['advance_status'] = $xcx_advance_status["advance_sale_status"] == 1 ? true : false;
|
||
} else {
|
||
$res['advance_status'] = false;
|
||
}
|
||
// 礼品卡插件
|
||
$where = array(
|
||
'p.plug_name' => '礼品卡',
|
||
'p.status' => 1,
|
||
'm.merchant_id' => $merchant_id
|
||
);
|
||
$plug_gift_card_status = $PlugModel->getGiftStatus($where, 'm.' . $PlugMerchantModel::M_STATUS);
|
||
$res['gift_card_status'] = $plug_gift_card_status[$PlugMerchantModel::M_STATUS] == 1 ? true : false;
|
||
// 次卡插件
|
||
$sub_card_status = M('plug as p')
|
||
->join('ls_plug_merchant as m on p.id=m.plug_id')
|
||
->where(array('p.plug_name' => '次卡', 'p.status' => 1, 'm.merchant_id' => $merchant_id))
|
||
->getField('m.m_status');
|
||
$res['sub_card_status'] = $sub_card_status == 1 ? true : false;
|
||
// plus会员
|
||
$plus_status = M('retail_plus_set')->where(array('merchantid' => $merchant_id))->getField('switch_type');
|
||
$res['plus_status'] = $plus_status == 2 ? true : false;
|
||
return $res;
|
||
}
|
||
|
||
/*
|
||
* 门店轮播
|
||
* */
|
||
public function storeBanner()
|
||
{
|
||
if (IS_POST) {
|
||
$new = I('post.subPackages');//是否分包
|
||
$BannerModel = new RetailBannerModel();
|
||
$where[$BannerModel::MERCHANT_ID] = self::$merchant_id;
|
||
$where[$BannerModel::STORE_ID] = self::$store_id;
|
||
$where[$BannerModel::STATUS] = 1;//启用
|
||
$field = array(
|
||
$BannerModel::IMG_URL,
|
||
$BannerModel::IMG_URL_ID,
|
||
$BannerModel::URL,
|
||
);
|
||
$banner = $BannerModel->getSelect($where, $field, $BannerModel::BANNER_ORDER . ' desc');
|
||
|
||
if ($banner) {
|
||
$data = array();
|
||
foreach ($banner as $key => &$val) {
|
||
$temp = array();
|
||
$img = $this->getGoodsImage($val[$BannerModel::IMG_URL_ID]);
|
||
if ($img) {
|
||
$temp['img_url'] = $img;
|
||
// 判断url
|
||
switch ($val[$BannerModel::URL]) {
|
||
case '/pages/Group-purchase/Group-purchase':
|
||
$group_status = M('plug as p')
|
||
->join('ls_plug_store as s on p.id=s.plug_id')
|
||
->where(array('p.plug_name' => '拼团', 'p.status' => 1, 's.storeid' => self::$store_id))
|
||
->getField('s.s_status');
|
||
if ($group_status == 1) {
|
||
$xcx_group_status = M('store_xcx_config')->where(array('storeid' => self::$store_id))->getField('group_status');
|
||
$temp['url'] = $xcx_group_status == 1 ? $val[$BannerModel::URL] : '';
|
||
} else {
|
||
$temp['url'] = '';
|
||
}
|
||
break;
|
||
case '/pages/Seckill-purchase/Seckill-purchase':
|
||
$seckill_status = M('plug as p')
|
||
->join('ls_plug_store as s on p.id=s.plug_id')
|
||
->where(array('p.plug_name' => '秒杀', 'p.status' => 1, 's.storeid' => self::$store_id))
|
||
->getField('s.s_status');
|
||
if ($seckill_status == 1) {
|
||
$xcx_seckill_status = M('store_xcx_config')->where(array('storeid' => self::$store_id))->getField('seckill_status');
|
||
$temp['url'] = $xcx_seckill_status == 1 ? $val[$BannerModel::URL] : '';
|
||
} else {
|
||
$temp['url'] = '';
|
||
}
|
||
break;
|
||
case '/pages/gift_home/gift_home':
|
||
$gift_card_status = M('plug as p')
|
||
->join('ls_plug_merchant as m on p.id=m.plug_id')
|
||
->where(array('p.plug_name' => '礼品卡', 'p.status' => 1, 'm.merchant_id' => self::$merchant_id))
|
||
->getField('m.m_status');
|
||
$temp['url'] = $gift_card_status == 1 ? $val[$BannerModel::URL] : '';
|
||
break;
|
||
case '/pages/plusHome/plusHome':
|
||
$plus_status = M('retail_plus_set')->where(array('merchantid' => self::$merchant_id))->getField('switch_type');
|
||
$temp['url'] = $plus_status == 2 ? $val[$BannerModel::URL] : '';
|
||
break;
|
||
case '/pages/subCard/subCard':
|
||
$sub_card_status = M('plug as p')
|
||
->join('ls_plug_merchant as m on p.id=m.plug_id')
|
||
->where(array('p.plug_name' => '次卡', 'p.status' => 1, 'm.merchant_id' => self::$merchant_id))
|
||
->getField('m.m_status');
|
||
$temp['url'] = $sub_card_status == 1 ? $val[$BannerModel::URL] : '';
|
||
break;
|
||
default:
|
||
$temp['url'] = $val[$BannerModel::URL];
|
||
}
|
||
if ($new && $temp['url']) {
|
||
$temp['url'] = str_replace('pages/productList', 'pages/product/productList', $temp['url']);
|
||
$temp['url'] = str_replace('pages/recharge', 'pages/mine/recharge', $temp['url']);
|
||
$temp['url'] = str_replace('pages/details', 'pages/product/details', $temp['url']);
|
||
$temp['url'] = str_replace('pages/plusHome', 'pages/mine/plusHome', $temp['url']);
|
||
$temp['url'] = str_replace('pages/subCard', 'pages/mine/subCard', $temp['url']);
|
||
$temp['url'] = str_replace('pages/gift_home', 'pages/mine/gift_home', $temp['url']);
|
||
$temp['url'] = str_replace('pages/Seckill-purchase', 'pages/index/Seckill-purchase', $temp['url']);
|
||
$temp['url'] = str_replace('pages/Group-purchase', 'pages/index/Group-purchase', $temp['url']);
|
||
$temp['url'] = str_replace('pages/advanceSale', 'pages/index/advanceSale', $temp['url']);
|
||
}
|
||
$data[] = $temp;
|
||
}
|
||
}
|
||
$res['status'] = 1;
|
||
$res['banner'] = $data;
|
||
|
||
} else {
|
||
$res['status'] = 0;
|
||
$res['msg'] = '暂无设置轮播';
|
||
}
|
||
} else {
|
||
$res['status'] = 0;
|
||
$res['msg'] = '网络错误';
|
||
}
|
||
$this->ajaxReturn($res);
|
||
}
|
||
|
||
/**
|
||
* 新版获取首页拼团,秒杀,礼品卡,付款码,客服,小图标数据 2019-12-14(如有修改请将v2也改掉)
|
||
*/
|
||
public function getHomeData_v1()
|
||
{
|
||
$merchant_id = self::$merchant_id;
|
||
$store_id = self::$store_id;
|
||
$PlugModel = new RetailPlugModel();
|
||
$StoreXcxConfigModel = new RetailStoreXcxConfigModel();
|
||
$store_plug_state = $PlugModel->getStorePlugState($store_id);//获取门店插件权限
|
||
$field = array(
|
||
$StoreXcxConfigModel::SECKILL_STATUS,
|
||
$StoreXcxConfigModel::HOME_SECKILL_STATUS,
|
||
$StoreXcxConfigModel::GROUP_STATUS,
|
||
$StoreXcxConfigModel::HOME_GROUP_STATUS,
|
||
$StoreXcxConfigModel::HOME_SUPPORT_ICON_ID,
|
||
$StoreXcxConfigModel::HOME_TEL_ICON_ID,
|
||
);
|
||
$map = array(
|
||
$StoreXcxConfigModel::STORE_ID => $store_id
|
||
);
|
||
$store_config = $StoreXcxConfigModel->getFind($map, $field);//获取门店小程序设置
|
||
$res = array(
|
||
'group_list' => array(),
|
||
'seckill_list' => array(),
|
||
'gift_card_list' => array(),
|
||
);
|
||
$time = time();
|
||
//---------------------------------------------------------拼团获取封面图---------------------------------------------------------
|
||
// 判断是否有拼团插件 门店是否开启了拼团插件和首页列表展示
|
||
if ($store_plug_state['group_state'] == 1 && $store_config[$StoreXcxConfigModel::GROUP_STATUS] == 1 && $store_config[$StoreXcxConfigModel::HOME_GROUP_STATUS] == 1) {
|
||
//有拼团插件
|
||
// 实例化模型
|
||
$RetailGroupViewModel = new RetailGroupViewModel();
|
||
// 查询活动
|
||
$map = array(
|
||
'RetailGroup.storeid' => self::$store_id,
|
||
'RetailGroup.merchantid' => self::$merchant_id,
|
||
'RetailGroup.acttype' => 1,
|
||
'RetailGroup.endtime' => array('gt', time()),
|
||
'RetailGoods.status' => 0,
|
||
'RetailGoods.online_state' => 1
|
||
);
|
||
$fields = array(
|
||
'id',
|
||
'act_price',
|
||
'goods_img_id',
|
||
'start_time',
|
||
);
|
||
// 查询拼团活动
|
||
$group_list = $RetailGroupViewModel->getSelect($map, $fields, 1, 3, 'start_time asc,act_price asc');
|
||
if (!empty($group_list)) {
|
||
// 处理数据
|
||
foreach ($group_list as &$b_val) {
|
||
$b_val['act_price'] = $b_val['act_price'] ? floatval($b_val['act_price']) : 0;
|
||
$b_val['image'] = $this->getGoodsImage($b_val['goods_img_id']);// 商品图片
|
||
}
|
||
$res['group_list'] = $group_list;
|
||
}
|
||
}
|
||
//--------------------------------------------------------秒杀获取封面图----------------------------------------------------------
|
||
// 判断是否有秒杀插件 门店是否开启了秒杀插件和首页列表展示
|
||
if ($store_plug_state['seckill_state'] == 1 && $store_config[$StoreXcxConfigModel::SECKILL_STATUS] == 1 && $store_config[$StoreXcxConfigModel::HOME_SECKILL_STATUS] == 1) {
|
||
$RetailSpikeViewModel = new RetailSpikeViewModel();
|
||
$map = array(
|
||
'RetailSpike.storeid' => self::$store_id,
|
||
'RetailSpike.active_status' => 1,
|
||
'RetailSpike.active_endtime' => array('gt', time()),
|
||
'RetailGoods.status' => 0,
|
||
'RetailGoods.online_state' => 1
|
||
);
|
||
$field = array(
|
||
'id',
|
||
'spike_price',
|
||
'goods_img_id',
|
||
'start_time',
|
||
'end_time',
|
||
);
|
||
// 查询秒杀活动
|
||
$seckill_list = $RetailSpikeViewModel->getSelect($map, $field, 1, 3, 'start_time asc,spike_price asc');
|
||
if (!empty($seckill_list)) {
|
||
// 处理数据
|
||
$time = time();
|
||
foreach ($seckill_list as &$s_val) {
|
||
$s_val['spike_price'] = $s_val['spike_price'] ? floatval($s_val['spike_price']) : 0;
|
||
$s_val['image'] = $this->getGoodsImage($s_val['goods_img_id']);// 商品图片
|
||
if ($time > $s_val['start_time']) {
|
||
$s_val['time'] = $s_val['end_time'] - $time;
|
||
} else {
|
||
$s_val['time'] = $s_val['start_time'] - $time;
|
||
}
|
||
}
|
||
$res['seckill_list'] = $seckill_list;
|
||
}
|
||
}
|
||
//-----------------------------------------------------------礼品卡获取封面图-----------------------------------------------------------
|
||
$merchant_plug_state = $PlugModel->getMerchantPlugState($merchant_id, array('礼品卡'));//获取商户插件权限
|
||
$ImageGalleryModel = new ImageGalleryModel();
|
||
if ($merchant_plug_state['gift_card_state'] == 1) {
|
||
$GiftCardModel = new RetailGiftCardModel();
|
||
$map = array(
|
||
$GiftCardModel::MERCHANT_ID => $merchant_id,
|
||
$GiftCardModel::STATUS => 1,
|
||
$GiftCardModel::STATE => 1,
|
||
$GiftCardModel::START_TIME => array('elt', $time),
|
||
$GiftCardModel::END_TIME => array('gt', $time),
|
||
);
|
||
$gift_list = $GiftCardModel->getSelect($map, $GiftCardModel::ID, $GiftCardModel::ID . ' desc', '1,2');
|
||
if (!empty($gift_list)) {
|
||
$GCCModel = new RetailGiftCardCoverModel();
|
||
foreach ($gift_list as &$v) {
|
||
$map = array(
|
||
$GCCModel::GIFT_CARD_ID => $v[$GiftCardModel::ID],
|
||
$GCCModel::STATUS => 1,
|
||
$GCCModel::STATE => 1,
|
||
);
|
||
$img_id = $GCCModel->getOrderFindField($map, $GCCModel::IMG_URL_ID, $GCCModel::ID . ' desc');
|
||
$v['img_url'] = $ImageGalleryModel->getFieldPath(array('id' => $img_id));
|
||
}
|
||
$res['gift_card_list'] = $gift_list;
|
||
}
|
||
}
|
||
//----------------------------------------------门店展示客服和返回的自定义图标,获取客服类型-------------------------------------------
|
||
$StoreModel = new RetailStoreModel();
|
||
// 微信客服类型
|
||
$store = self::$store;
|
||
$customer_service = !$store[$StoreModel::CUSTOMER_SERVICE] ? 1 : $store[$StoreModel::CUSTOMER_SERVICE];
|
||
$icon = array();
|
||
if ($customer_service == 2) {
|
||
if (!empty($store_config[$StoreXcxConfigModel::HOME_SUPPORT_ICON_ID])) {
|
||
$icon['home_support_icon'] = $ImageGalleryModel->getFieldPath(array('id' => $store_config[$StoreXcxConfigModel::HOME_SUPPORT_ICON_ID]));
|
||
} else {
|
||
$icon['home_support_icon'] = '';
|
||
}
|
||
} else if ($customer_service == 1) {
|
||
if (!empty($store_config[$StoreXcxConfigModel::HOME_TEL_ICON_ID])) {
|
||
$icon['home_tel_icon'] = $ImageGalleryModel->getFieldPath(array('id' => $store_config[$StoreXcxConfigModel::HOME_TEL_ICON_ID]));
|
||
} else {
|
||
$icon['home_tel_icon'] = '';
|
||
}
|
||
}
|
||
$res['user_type'] = self::$user['user_type'];
|
||
$res['customer_service'] = $customer_service; // 客服类型
|
||
$res['phone'] = $store[$StoreModel::CUSTOMER_SERVICE] == 2 ? '' : $store[$StoreModel::PHONE];//门店联系电话
|
||
$res['icon'] = $icon;
|
||
$res['status'] = 1;
|
||
$res['msg'] = '数据获取成功';
|
||
$this->ajaxReturn($res);
|
||
}
|
||
|
||
/**
|
||
* 新版获取首页拼团,秒杀,预售,礼品卡,付款码,客服,小图标数据 2020-3-27
|
||
*/
|
||
public function getHomeData_v2()
|
||
{
|
||
$merchant_id = self::$merchant_id;
|
||
$store_id = self::$store_id;
|
||
$PlugModel = new RetailPlugModel();
|
||
$StoreXcxConfigModel = new RetailStoreXcxConfigModel();
|
||
$store_plug_state = $PlugModel->plug_store_verify(array("store_id" => $store_id, "identification" => ['group','seckill','presale']));//获取门店插件权限
|
||
$field = array(
|
||
$StoreXcxConfigModel::SECKILL_STATUS,
|
||
$StoreXcxConfigModel::HOME_SECKILL_STATUS,
|
||
$StoreXcxConfigModel::GROUP_STATUS,
|
||
$StoreXcxConfigModel::HOME_GROUP_STATUS,
|
||
$StoreXcxConfigModel::HOME_SUPPORT_ICON_ID,
|
||
$StoreXcxConfigModel::HOME_TEL_ICON_ID,
|
||
$StoreXcxConfigModel::ADVANCE_SALE_STATUS,
|
||
$StoreXcxConfigModel::ADVANCE_SALE_INDEX_STATUS
|
||
);
|
||
$map = array(
|
||
$StoreXcxConfigModel::STORE_ID => $store_id
|
||
);
|
||
$store_config = $StoreXcxConfigModel->getFind($map, $field);//获取门店小程序设置
|
||
$res = array(
|
||
'group_list' => array(),
|
||
'seckill_list' => array(),
|
||
'gift_card_list' => array(),
|
||
'advance_list' => array(),
|
||
);
|
||
$time = time();
|
||
//---------------------------------------------------------拼团获取封面图---------------------------------------------------------
|
||
// 判断是否有拼团插件 门店是否开启了拼团插件和首页列表展示
|
||
if ($store_plug_state['group'] == 'group' && $store_config[$StoreXcxConfigModel::GROUP_STATUS] == 1 && $store_config[$StoreXcxConfigModel::HOME_GROUP_STATUS] == 1) {
|
||
//有拼团插件
|
||
// 实例化模型
|
||
$RetailGroupViewModel = new RetailGroupViewModel();
|
||
// 查询活动
|
||
$map = array(
|
||
'RetailGroup.storeid' => self::$store_id,
|
||
'RetailGroup.merchantid' => self::$merchant_id,
|
||
'RetailGroup.acttype' => 1,
|
||
'RetailGroup.endtime' => array('gt', time()),
|
||
'RetailGoods.status' => 0,
|
||
'RetailGoods.online_state' => 1
|
||
);
|
||
$fields = array(
|
||
'id',
|
||
'act_price',
|
||
'goods_img_id',
|
||
'start_time',
|
||
);
|
||
// 查询拼团活动
|
||
$group_list = $RetailGroupViewModel->getSelect($map, $fields, 1, 3, 'start_time asc,act_price asc');
|
||
if (!empty($group_list)) {
|
||
// 处理数据
|
||
foreach ($group_list as &$b_val) {
|
||
$b_val['act_price'] = $b_val['act_price'] ? floatval($b_val['act_price']) : 0;
|
||
$b_val['image'] = $this->getGoodsImage($b_val['goods_img_id']);// 商品图片
|
||
}
|
||
$res['group_list'] = $group_list;
|
||
}
|
||
}
|
||
//--------------------------------------------------------秒杀获取封面图----------------------------------------------------------
|
||
// 判断是否有秒杀插件 门店是否开启了秒杀插件和首页列表展示
|
||
if ($store_plug_state['seckill'] == 'seckill' && $store_config[$StoreXcxConfigModel::SECKILL_STATUS] == 1 && $store_config[$StoreXcxConfigModel::HOME_SECKILL_STATUS] == 1) {
|
||
$RetailSpikeViewModel = new RetailSpikeViewModel();
|
||
$map = array(
|
||
'RetailSpike.storeid' => self::$store_id,
|
||
'RetailSpike.active_status' => 1,
|
||
'RetailSpike.active_endtime' => array('gt', time()),
|
||
'RetailGoods.status' => 0,
|
||
'RetailGoods.online_state' => 1
|
||
);
|
||
$field = array(
|
||
'id',
|
||
'spike_price',
|
||
'goods_img_id',
|
||
'start_time',
|
||
'end_time',
|
||
);
|
||
// 查询秒杀活动
|
||
$seckill_list = $RetailSpikeViewModel->getSelect($map, $field, 1, 3, 'start_time asc,spike_price asc');
|
||
if (!empty($seckill_list)) {
|
||
// 处理数据
|
||
$time = time();
|
||
foreach ($seckill_list as &$s_val) {
|
||
$s_val['spike_price'] = $s_val['spike_price'] ? floatval($s_val['spike_price']) : 0;
|
||
$s_val['image'] = $this->getGoodsImage($s_val['goods_img_id']);// 商品图片
|
||
if ($time > $s_val['start_time']) {
|
||
$s_val['time'] = $s_val['end_time'] - $time;
|
||
} else {
|
||
$s_val['time'] = $s_val['start_time'] - $time;
|
||
}
|
||
}
|
||
$res['seckill_list'] = $seckill_list;
|
||
}
|
||
}
|
||
//-----------------------------------------------------------礼品卡获取封面图-----------------------------------------------------------
|
||
$merchant_plug_state = $PlugModel->getMerchantPlugState($merchant_id, array('礼品卡'));//获取商户插件权限
|
||
$ImageGalleryModel = new ImageGalleryModel();
|
||
if ($merchant_plug_state['gift_card_state'] == 1) {
|
||
$GiftCardModel = new RetailGiftCardModel();
|
||
$map = array(
|
||
$GiftCardModel::MERCHANT_ID => $merchant_id,
|
||
$GiftCardModel::STATUS => 1,
|
||
$GiftCardModel::STATE => 1,
|
||
$GiftCardModel::START_TIME => array('elt', $time),
|
||
$GiftCardModel::END_TIME => array('gt', $time),
|
||
);
|
||
$gift_list = $GiftCardModel->getSelect($map, $GiftCardModel::ID, $GiftCardModel::ID . ' desc', '1,2');
|
||
if (!empty($gift_list)) {
|
||
$GCCModel = new RetailGiftCardCoverModel();
|
||
foreach ($gift_list as &$v) {
|
||
$map = array(
|
||
$GCCModel::GIFT_CARD_ID => $v[$GiftCardModel::ID],
|
||
$GCCModel::STATUS => 1,
|
||
$GCCModel::STATE => 1,
|
||
);
|
||
$img_id = $GCCModel->getOrderFindField($map, $GCCModel::IMG_URL_ID, $GCCModel::ID . ' desc');
|
||
$v['img_url'] = $ImageGalleryModel->getFieldPath(array('id' => $img_id));
|
||
}
|
||
$res['gift_card_list'] = $gift_list;
|
||
}
|
||
}
|
||
//------------------------------------------------------------获取预售三个商品---------------------------------------------------------------------
|
||
if ($store_plug_state['presale'] == 'presale' && $store_config['advance_sale_status'] == 1 && $store_config['advance_sale_index_status'] == 1) {
|
||
//预售开启并在首页展示
|
||
$AdvanceSkuGoodsModel = new AdvanceSkuGoodsModel();
|
||
$map = array(
|
||
'a.store_id' => self::$store_id,
|
||
'a.merchant_id' => self::$merchant_id,
|
||
'a.advance_state' => 1,
|
||
'a.surplus_num' => array('gt', 0),
|
||
'a.advance_end_time' => array('gt', time()),
|
||
'g.status' => 0
|
||
);
|
||
$advanceList = M("retail_advance_goods as a")
|
||
->join("ls_retail_goods as g on a.goods_id=g.id")
|
||
->where($map)
|
||
->field("a.id,a.goods_id,a.advance_price,g.goods_img_id,g.attribute_state")
|
||
->order('a.id desc')
|
||
->page(1, 3)
|
||
->select();
|
||
$RetailBillAdvanceModel = new RetailBillAdvanceModel();
|
||
if ($advanceList) {
|
||
foreach ($advanceList as $k => $va) {
|
||
$advanceList[$k]['image'] = $this->getGoodsImage($va['goods_img_id']);// 商品图片
|
||
if ($va['attribute_state'] == 2) {
|
||
$advance_price = $AdvanceSkuGoodsModel->where(array('advance_id' => $va['id'], 'goods_id' => $va['goods_id'], 'advance_state' => 1))->order('advance_price asc')->getField("advance_price");
|
||
$advanceList[$k]['advance_price'] = round($advance_price, 2);
|
||
} else {
|
||
$advanceList[$k]['advance_price'] = round($va['advance_price'], 2);
|
||
}
|
||
$advanceList[$k]['reserve_num'] = $RetailBillAdvanceModel->getUserNum(array("id" => $va['id']))['data']['count']; //已经预定人数
|
||
}
|
||
}
|
||
$res['advance_list'] = $advanceList;
|
||
}
|
||
//----------------------------------------------门店展示客服和返回的自定义图标,获取客服类型-------------------------------------------
|
||
$StoreModel = new RetailStoreModel();
|
||
// 微信客服类型
|
||
$store = self::$store;
|
||
$customer_service = !$store[$StoreModel::CUSTOMER_SERVICE] ? 1 : $store[$StoreModel::CUSTOMER_SERVICE];
|
||
$icon = array();
|
||
if ($customer_service == 2) {
|
||
if (!empty($store_config[$StoreXcxConfigModel::HOME_SUPPORT_ICON_ID])) {
|
||
$icon['home_support_icon'] = $ImageGalleryModel->getFieldPath(array('id' => $store_config[$StoreXcxConfigModel::HOME_SUPPORT_ICON_ID]));
|
||
} else {
|
||
$icon['home_support_icon'] = '';
|
||
}
|
||
} else if ($customer_service == 1) {
|
||
if (!empty($store_config[$StoreXcxConfigModel::HOME_TEL_ICON_ID])) {
|
||
$icon['home_tel_icon'] = $ImageGalleryModel->getFieldPath(array('id' => $store_config[$StoreXcxConfigModel::HOME_TEL_ICON_ID]));
|
||
} else {
|
||
$icon['home_tel_icon'] = '';
|
||
}
|
||
}
|
||
$res['user_type'] = self::$user['user_type'];
|
||
$res['customer_service'] = $customer_service; // 客服类型
|
||
$res['phone'] = $store[$StoreModel::CUSTOMER_SERVICE] == 2 ? '' : $store[$StoreModel::PHONE];//门店联系电话
|
||
$res['icon'] = $icon;
|
||
$res['status'] = 1;
|
||
$res['msg'] = '数据获取成功';
|
||
$this->ajaxReturn($res);
|
||
}
|
||
|
||
/**
|
||
* 2019-12-14 获取导航栏
|
||
*/
|
||
public function getNavigation()
|
||
{
|
||
$new = I('post.subPackages');//是否分包
|
||
$merchant_id = self::$merchant_id;
|
||
$store_id = self::$store_id;
|
||
$XcxNavigationModel = new RetailXcxNavigationModel();
|
||
$map = array(
|
||
$XcxNavigationModel::STORE_ID => $store_id,
|
||
$XcxNavigationModel::MERCHANT_ID => $merchant_id,
|
||
$XcxNavigationModel::STATUS => 1,
|
||
);
|
||
$navigation = $XcxNavigationModel->getSelect($map, '*', $XcxNavigationModel::RANK . ' asc');
|
||
$ImageGalleryModel = new ImageGalleryModel();
|
||
$GoodsClassModel = new RetailGoodsClassModel();
|
||
$MagicCubeModel = new RetailMagicCubeModel();
|
||
$plug_state = $this->plug_state($store_id, $merchant_id); // 判断插件是否开启
|
||
$navigationList = array();
|
||
foreach ($navigation as &$val) {
|
||
$val[$XcxNavigationModel::ICON] = $ImageGalleryModel->getFieldPath(array('id' => $val[$XcxNavigationModel::ICON_ID]));
|
||
switch ($val[$XcxNavigationModel::NAVIGATION_TYPE]) {
|
||
case '1':
|
||
//其他链接
|
||
if (!empty($val[$XcxNavigationModel::OTHER_URL])) {
|
||
$val['url'] = '/pages/web/web?url=' . $val[$XcxNavigationModel::OTHER_URL];
|
||
$navigationList[] = $val;
|
||
}
|
||
break;
|
||
case '2':
|
||
//分类
|
||
$map = array(
|
||
$GoodsClassModel::ID => $val[$XcxNavigationModel::GOODS_CLASS_ID],
|
||
$GoodsClassModel::MERCHANT_ID => $merchant_id,
|
||
$GoodsClassModel::STATUS => 0,
|
||
$GoodsClassModel::TYPE => 1,
|
||
);
|
||
$fields = array(
|
||
$GoodsClassModel::ID,
|
||
$GoodsClassModel::CLASS_NAME,
|
||
);
|
||
$class_data = $GoodsClassModel->getFind($map, $fields);
|
||
if (!empty($class_data)) {
|
||
$val['url'] = '/pages/productList/productList?id=' . $class_data[$GoodsClassModel::ID] . '&class_name=' . $class_data[$GoodsClassModel::CLASS_NAME];
|
||
$navigationList[] = $val;
|
||
}
|
||
break;
|
||
case '3':
|
||
//功能入口
|
||
$map = array(
|
||
$MagicCubeModel::ID => $val[$XcxNavigationModel::MAGIC_CUBE_ID],
|
||
$MagicCubeModel::STATUS => 1,
|
||
$MagicCubeModel::STATE => 1,
|
||
);
|
||
$magic = $MagicCubeModel->getFind($map);
|
||
if (!empty($magic)) {
|
||
if ($magic[$MagicCubeModel::TYPE] == 1 && $magic[$MagicCubeModel::URL] == '/pages/details/details' && !empty($val[$XcxNavigationModel::GOODS_ID])) {
|
||
$val['url'] = $magic[$MagicCubeModel::URL] . '?id=' . $val[$XcxNavigationModel::GOODS_ID];
|
||
$navigationList[] = $val;
|
||
} else if ($magic[$MagicCubeModel::TYPE] == 2 && $magic['/pages/myOrder/myOrder']) {
|
||
$val['url'] = $magic[$MagicCubeModel::URL];
|
||
$navigationList[] = $val;
|
||
} else {
|
||
$val['url'] = $magic[$MagicCubeModel::URL];
|
||
if ($this->handleNav($plug_state, $magic[$MagicCubeModel::URL])) {
|
||
$navigationList[] = $val;
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
if (!empty($navigationList)) {
|
||
foreach ($navigationList as &$value){
|
||
if ($new && $value['url']) {
|
||
$value['url'] = str_replace('pages/productList', 'pages/product/productList', $value['url']);
|
||
$value['url'] = str_replace('pages/recharge', 'pages/mine/recharge', $value['url']);
|
||
$value['url'] = str_replace('pages/details', 'pages/product/details', $value['url']);
|
||
$value['url'] = str_replace('pages/plusHome', 'pages/mine/plusHome', $value['url']);
|
||
$value['url'] = str_replace('pages/subCard', 'pages/mine/subCard', $value['url']);
|
||
$value['url'] = str_replace('pages/gift_home', 'pages/mine/gift_home', $value['url']);
|
||
$value['url'] = str_replace('pages/Seckill-purchase', 'pages/index/Seckill-purchase', $value['url']);
|
||
$value['url'] = str_replace('pages/Group-purchase', 'pages/index/Group-purchase', $value['url']);
|
||
$value['url'] = str_replace('pages/advanceSale', 'pages/index/advanceSale', $value['url']);
|
||
$value['url'] = str_replace('/pages/web/web', '/pages/index/web/web', $value['url']);
|
||
}
|
||
}
|
||
$res['status'] = 1;
|
||
$res['data'] = $navigationList;
|
||
$res['msg'] = '查询成功';
|
||
} else {
|
||
$res['status'] = 0;
|
||
$res['msg'] = '门店暂未设置导航列表';
|
||
}
|
||
$res['new'] = $new;
|
||
$this->ajaxReturn($res);
|
||
}
|
||
|
||
/**
|
||
* 处理导航栏数据
|
||
* @param $plug_state
|
||
* @param $url
|
||
* @return bool
|
||
*/
|
||
private function handleNav($plug_state, $url)
|
||
{
|
||
$flag = false;
|
||
switch ($url) {
|
||
case '/pages/Group-purchase/Group-purchase':
|
||
//拼团
|
||
if ($plug_state['group_status'] == 1) {
|
||
$flag = true;
|
||
}
|
||
break;
|
||
case '/pages/Seckill-purchase/Seckill-purchase':
|
||
//秒杀
|
||
if ($plug_state['seckill_status'] == 1) {
|
||
$flag = true;
|
||
}
|
||
break;
|
||
case '/pages/advanceSale/advanceSale':
|
||
//预售
|
||
if ($plug_state['advance_status'] == 1) {
|
||
$flag = true;
|
||
}
|
||
break;
|
||
case '/pages/gift_home/gift_home':
|
||
//礼品卡
|
||
if ($plug_state['gift_card_status'] == 1) {
|
||
$flag = true;
|
||
}
|
||
break;
|
||
case '/pages/subCard/subCard':
|
||
// 判断次卡
|
||
if ($plug_state['sub_card_status'] == 1) {
|
||
$flag = true;
|
||
}
|
||
break;
|
||
case '/pages/plusHome/plusHome':
|
||
// 判断plus
|
||
if ($plug_state['plus_status'] == 1) {
|
||
$flag = true;
|
||
}
|
||
break;
|
||
default:
|
||
$flag = true;
|
||
}
|
||
return $flag;
|
||
}
|
||
}
|
||
|