246 lines
8.7 KiB
PHP
246 lines
8.7 KiB
PHP
<?php
|
|
/**
|
|
* ThinkShop商城系统 - 团队十年电商经验汇集巨献!
|
|
* =========================================================
|
|
* Copy right 2015-2025 成都云之牛科技有限公司, 保留所有权利。
|
|
* ----------------------------------------------
|
|
* 官方网址: https://www.cdcloudshop.com
|
|
* =========================================================
|
|
* @author : niuteam
|
|
*/
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\model\express\Config as ExpressConfig;
|
|
use app\model\goods\Cart as CartModel;
|
|
use app\model\system\Promotion as PrmotionModel;
|
|
use app\model\system\Servicer;
|
|
use app\model\web\Config as ConfigModel;
|
|
|
|
class Config extends BaseApi
|
|
{
|
|
|
|
/**
|
|
* 详情信息
|
|
*/
|
|
public function defaultimg()
|
|
{
|
|
$upload_config_model = new ConfigModel();
|
|
$res = $upload_config_model->getDefaultImg($this->site_id, 'shop');
|
|
if (!empty($res[ 'data' ][ 'value' ])) {
|
|
return $this->response($this->success($res[ 'data' ][ 'value' ]));
|
|
} else {
|
|
return $this->response($this->error());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 版权信息
|
|
*/
|
|
public function copyright()
|
|
{
|
|
$config_model = new ConfigModel();
|
|
$res = $config_model->getCopyright($this->site_id, 'shop');
|
|
return $this->response($this->success($res[ 'data' ][ 'value' ]));
|
|
}
|
|
|
|
/**
|
|
* 获取当前时间戳
|
|
* @return false|string
|
|
*/
|
|
public function time()
|
|
{
|
|
$time = time();
|
|
return $this->response($this->success($time));
|
|
}
|
|
|
|
/**
|
|
* 获取验证码配置
|
|
*/
|
|
public function getCaptchaConfig()
|
|
{
|
|
|
|
$config_model = new ConfigModel();
|
|
$info = $config_model->getCaptchaConfig();
|
|
return $this->response($this->success($info));
|
|
}
|
|
|
|
/**
|
|
* 客服配置
|
|
*/
|
|
public function servicer()
|
|
{
|
|
$servicer_model = new Servicer();
|
|
$result = $servicer_model->getServicerConfig()[ 'data' ] ?? [];
|
|
return $this->response($this->success($result[ 'value' ] ?? []));
|
|
}
|
|
|
|
public function init()
|
|
{
|
|
$cart_count = 0;
|
|
$token = $this->checkToken();
|
|
if ($token[ 'code' ] >= 0) {
|
|
// 购物车数量
|
|
$cart = new CartModel();
|
|
$condition = [
|
|
[ 'gc.member_id', '=', $token[ 'data' ][ 'member_id' ] ],
|
|
[ 'gc.site_id', '=', $this->site_id ],
|
|
[ 'gs.goods_state', '=', 1 ],
|
|
[ 'gs.is_delete', '=', 0 ]
|
|
];
|
|
$list = $cart->getCartList($condition, 'gc.num');
|
|
$list = $list[ 'data' ];
|
|
$count = 0;
|
|
foreach ($list as $k => $v) {
|
|
$count += $v[ 'num' ];
|
|
}
|
|
}
|
|
// 商城风格
|
|
$diy_view_api = new Diyview();
|
|
$diy_style = json_decode($diy_view_api->style(), true)[ 'data' ][ 'value' ];
|
|
// 底部导航
|
|
if(input('app_module')&&input('app_module')=='AlpayStore'){
|
|
$diy_bottom_nav = [
|
|
"type" => 1,
|
|
"theme" => "default",
|
|
"backgroundColor" => "#FFFFFF",
|
|
"textColor" => "#333333",
|
|
"textHoverColor" => "#1677ff",
|
|
"bulge" => true,
|
|
"list" => [
|
|
[
|
|
"iconPath" => "icondiy icon-system-shouyeweixuanzhongbeifen",
|
|
"selectedIconPath" => "icondiy icon-system-shouyexuanzhongbeifen2",
|
|
"text" => "主页",
|
|
"link" => [
|
|
"name" => "INDEX",
|
|
"title" => "主页",
|
|
"wap_url" => "/pages/index/index",
|
|
"parent" => "MALL_LINK"
|
|
],
|
|
"id" => "h1lx8nhr2lc0",
|
|
"imgWidth" => "40",
|
|
"imgHeight" => "40",
|
|
"iconClass" => "icon-system-home",
|
|
"icon_type" => "icon",
|
|
"selected_icon_type" => "icon",
|
|
"style" => [
|
|
"fontSize" => 100,
|
|
"iconBgColor" => [],
|
|
"iconBgColorDeg" => 0,
|
|
"iconBgImg" => "",
|
|
"bgRadius" => 0,
|
|
"iconColor" => [ "#000000" ],
|
|
"iconColorDeg" => 0
|
|
],
|
|
"selected_style" => [
|
|
"fontSize" => 100,
|
|
"iconBgColor" => [],
|
|
"iconBgColorDeg" => 0,
|
|
"iconBgImg" => "",
|
|
"bgRadius" => 0,
|
|
"iconColor" => [ "#1677ff" ],
|
|
"iconColorDeg" => 0
|
|
]
|
|
],
|
|
[
|
|
"iconPath" => "icondiy icon-system-my",
|
|
"selectedIconPath" => "icondiy icon-system-my-selected",
|
|
"text" => "我的",
|
|
"link" => [
|
|
"name" => "MEMBER_CENTER",
|
|
"title" => "会员中心",
|
|
"wap_url" => "/pages/member/index",
|
|
"parent" => "MALL_LINK"
|
|
],
|
|
"imgWidth" => "40",
|
|
"imgHeight" => "40",
|
|
"id" => "1b2tc256egsg0",
|
|
"iconClass" => "icon-system-my",
|
|
"icon_type" => "icon",
|
|
"selected_icon_type" => "icon",
|
|
"style" => [
|
|
"fontSize" => 100,
|
|
"iconBgColor" => [],
|
|
"iconBgColorDeg" => 0,
|
|
"iconBgImg" => "",
|
|
"bgRadius" => 0,
|
|
"iconColor" => [ "#000000" ],
|
|
"iconColorDeg" => 0
|
|
],
|
|
"selected_style" => [
|
|
"fontSize" => 100,
|
|
"iconBgColor" => [],
|
|
"iconBgColorDeg" => 0,
|
|
"iconBgImg" => "",
|
|
"bgRadius" => 0,
|
|
"iconColor" => [ "#1677ff" ],
|
|
"iconColorDeg" => 0
|
|
]
|
|
]
|
|
],
|
|
"imgType" => 2,
|
|
"iconColor" => "#333333",
|
|
"iconHoverColor" => "#1677ff"
|
|
];
|
|
}else{
|
|
$diy_bottom_nav = json_decode($diy_view_api->bottomNav(), true)[ 'data' ][ 'value' ];
|
|
}
|
|
// 插件存在性
|
|
$addon_api = new Addon();
|
|
$addon_is_exist = json_decode($addon_api->addonIsExit(), true)[ 'data' ];
|
|
// 默认图
|
|
$config_model = new ConfigModel();
|
|
$default_img = $config_model->getDefaultImg($this->site_id, 'shop')[ 'data' ][ 'value' ];
|
|
// 版权信息
|
|
$copyright = $config_model->getCopyright($this->site_id, 'shop')[ 'data' ][ 'value' ];
|
|
$site_api = new Site();
|
|
$site_info = json_decode($site_api->info(), true)[ 'data' ];
|
|
$res = [
|
|
'cart_count' => $cart_count,
|
|
'style_theme' => $diy_style,
|
|
'diy_bottom_nav' => $diy_bottom_nav,
|
|
'addon_is_exist' => $addon_is_exist,
|
|
'default_img' => $default_img,
|
|
'copyright' => $copyright,
|
|
'site_info' => $site_info,
|
|
'service_tel' => '13800138000',
|
|
];
|
|
return $this->response($this->success($res));
|
|
}
|
|
|
|
/**
|
|
* 获取pc首页商品分类配置
|
|
* @return false|string
|
|
*/
|
|
public function categoryconfig()
|
|
{
|
|
$config_model = new ConfigModel();
|
|
$config_info = $config_model->getCategoryConfig($this->site_id);
|
|
return $this->response($this->success($config_info[ 'data' ][ 'value' ]));
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return false|string
|
|
*/
|
|
public function enabledExpressType()
|
|
{
|
|
$express_type = ( new ExpressConfig() )->getEnabledExpressType($this->site_id);
|
|
return $this->response($this->success($express_type));
|
|
}
|
|
|
|
/**
|
|
* 获取活动专区页面配置
|
|
* @return false|string
|
|
*/
|
|
public function promotionZoneConfig()
|
|
{
|
|
$name = isset($this->params[ 'name' ]) ? $this->params[ 'name' ] : ''; // 活动名称标识
|
|
|
|
$promotion_model = new PrmotionModel();
|
|
$res = $promotion_model->getPromotionZoneConfig($name, $this->site_id)[ 'data' ][ 'value' ];
|
|
return $this->response($this->success($res));
|
|
}
|
|
|
|
} |