196 lines
5.9 KiB
PHP
196 lines
5.9 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\model\express\Config as ExpressConfig;
|
|
use app\model\system\Promotion as PromotionModel;
|
|
use app\model\system\Servicer;
|
|
use app\model\system\Site as SiteModel;
|
|
use app\model\web\Config as ConfigModel;
|
|
use app\model\web\DiyView as DiyViewModel;
|
|
use app\model\shop\Shop as ShopModel;
|
|
|
|
use app\model\member\Config as ConfigMemberModel;
|
|
class Config extends BaseApi
|
|
{
|
|
|
|
public function agreement(){
|
|
$config_model = new ConfigMemberModel();
|
|
|
|
$type = $this->params['type'] ?? '';
|
|
$uniacid = $this->params['uniacid'] ?? 0;
|
|
$site_id = $this->site_id;
|
|
if($uniacid > 0){
|
|
$site_id = $uniacid;
|
|
}
|
|
|
|
//注册协议
|
|
$document_info = $config_model->getRegisterDocument($site_id, 'shop');
|
|
//隐私协议
|
|
$rivacy_info = $config_model->getRrivacyDocument($site_id, 'shop');
|
|
|
|
if($type == 1){//注册
|
|
$config = $document_info;
|
|
}else{//隐私
|
|
$config = $rivacy_info;
|
|
}
|
|
|
|
return $this->response($config);
|
|
}
|
|
|
|
/*
|
|
*VR页面获取
|
|
*/
|
|
public function defaultvr(){
|
|
|
|
$config_model = new ConfigModel();
|
|
$config = $config_model->getDiyVr($this->site_id, $this->app_module)[ 'data' ][ 'value' ];
|
|
return $this->response($this->success($config));
|
|
}
|
|
/**
|
|
* 详情信息
|
|
*/
|
|
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[ 'data' ][ 'value' ]));
|
|
}
|
|
|
|
/**
|
|
* 客服配置
|
|
*/
|
|
public function servicer()
|
|
{
|
|
$servicer_model = new Servicer();
|
|
$result = $servicer_model->getServicerConfig()[ 'data' ] ?? [];
|
|
return $this->response($this->success($result[ 'value' ] ?? []));
|
|
}
|
|
|
|
/**
|
|
* 系统初始化配置信息
|
|
* @return false|string
|
|
*/
|
|
public function init()
|
|
{
|
|
|
|
$diy_view = new DiyViewModel();
|
|
$diy_style = $diy_view->getStyleConfig($this->site_id)[ 'data' ][ 'value' ];
|
|
|
|
// 底部导航
|
|
$diy_bottom_nav = $diy_view->getBottomNavConfig($this->site_id)[ 'data' ][ 'value' ];
|
|
|
|
// 插件存在性
|
|
$addon = new \app\model\system\Addon();
|
|
$addon_is_exist = $addon->addonIsExist();
|
|
|
|
// 默认图
|
|
$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' ];
|
|
$map_config = $config_model->getMapConfig($this->site_id, 'shop')[ 'data' ][ 'value' ];
|
|
|
|
$website_model = new SiteModel();
|
|
$site_info = $website_model->getSiteInfo([ [ 'site_id', '=', $this->site_id ] ], 'site_id,site_domain,site_name,logo,seo_title,seo_keywords,seo_description,site_tel,logo_square')[ 'data' ];
|
|
|
|
$servicer_model = new Servicer();
|
|
$servicer_info = $servicer_model->getServicerConfig()[ 'data' ][ 'value' ] ?? [];
|
|
|
|
$this->initStoreData();
|
|
//联系我们
|
|
$shop_model = new ShopModel();
|
|
$shop_info_result = $shop_model->getShopInfo([ [ 'site_id', '=', $this->site_id ] ]);
|
|
$shop_info = $shop_info_result['data'];
|
|
|
|
$res = [
|
|
'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,
|
|
'servicer' => $servicer_info,
|
|
'shop_info'=>$shop_info,
|
|
'store_config' => $this->store_data[ 'config' ],
|
|
'map_config' => $map_config
|
|
];
|
|
if (!empty($this->store_data[ 'store_info' ])) {
|
|
$res[ 'store_info' ] = $this->store_data[ 'store_info' ];
|
|
}
|
|
|
|
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 = $this->params['name'] ?? ''; // 活动名称标识
|
|
if (empty($name)) {
|
|
return $this->response($this->error([], '缺少必填参数name'));
|
|
}
|
|
$promotion_model = new PromotionModel();
|
|
$res = $promotion_model->getPromotionZoneConfig($name, $this->site_id)[ 'data' ][ 'value' ];
|
|
return $this->response($this->success($res));
|
|
}
|
|
|
|
} |