96 lines
2.5 KiB
PHP
96 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\model\web\DiyView as DiyViewModel;
|
|
use app\model\web\Config as ConfigModel;
|
|
/**
|
|
* 自定义模板
|
|
* @package app\api\controller
|
|
*/
|
|
class Diyview extends BaseApi
|
|
{
|
|
/**
|
|
* 获取启动广告
|
|
*/
|
|
public function getstartadv()
|
|
{
|
|
$config_model = new ConfigModel();
|
|
$config = $config_model->getDiyAdv($this->site_id, $this->app_module)['data'];
|
|
return $this->response($config);
|
|
}
|
|
|
|
|
|
/**
|
|
* 基础信息
|
|
*/
|
|
public function info()
|
|
{
|
|
|
|
$id = $this->params['id'] ?? 0;
|
|
$name = $this->params['name'] ?? 'DIY_VIEW_INDEX';
|
|
$en_type = $this->params['en_type'] ?? 'zh-cn';// ['zh-cn', 'en-us'];
|
|
if (empty($id) && empty($name)) {
|
|
return $this->response($this->error('', 'REQUEST_DIY_ID_NAME'));
|
|
}
|
|
|
|
$this->initStoreData();
|
|
|
|
// 如果是连锁运营模式,则进入门店页面
|
|
if ($name == 'DIY_VIEW_INDEX' && $this->store_data[ 'config' ][ 'store_business' ] == 'store') {
|
|
$name = 'DIY_STORE';
|
|
}
|
|
|
|
$diy_view = new DiyViewModel();
|
|
$condition = [
|
|
[ 'site_id', '=', $this->site_id ]
|
|
];
|
|
|
|
if (!empty($id)) {
|
|
$condition[] = [ 'id', '=', $id ];
|
|
} elseif (!empty($name)) {
|
|
$condition[] = [ 'name', '=', $name ];
|
|
//修复只有首页获取中英文
|
|
if($name == 'DIY_VIEW_INDEX'){
|
|
//英文切换
|
|
if($en_type == 'en-us'){
|
|
$condition[] = [ 'is_en_default', '=', 1 ];
|
|
}else{
|
|
$condition[] = [ 'is_default', '=', 1 ];
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
$info = $diy_view->getDiyViewInfoInApi($condition);
|
|
|
|
//去除访问站点
|
|
/* if (!empty($info[ 'data' ])) {
|
|
$diy_view->modifyClick([ [ 'id', '=', $info[ 'data' ][ 'id' ] ], [ 'site_id', '=', $this->site_id ] ]);
|
|
}*/
|
|
|
|
return $this->response($info);
|
|
}
|
|
|
|
/**
|
|
* 平台端底部导航
|
|
* @return string
|
|
*/
|
|
public function bottomNav()
|
|
{
|
|
$diy_view = new DiyViewModel();
|
|
$info = $diy_view->getBottomNavConfig($this->site_id);
|
|
return $this->response($info);
|
|
}
|
|
|
|
/**
|
|
* 风格
|
|
*/
|
|
public function style()
|
|
{
|
|
$diy_view = new DiyViewModel();
|
|
$res = $diy_view->getStyleConfig($this->site_id);
|
|
return $this->response($res);
|
|
}
|
|
|
|
} |