作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

... ... @@ -48,11 +48,11 @@ class ProjectFilePDF extends Command
public function handle()
{
// 开始时间
$startTime = microtime(true);
$html = $this->html([]);
$filename = hash('md5', $this->time . '-' . random_int(100000, 999999));
$this->savePDF($html, $filename);
$gg = $this->main();
// 结束时间
$endTime = microtime(true);
... ... @@ -62,7 +62,9 @@ class ProjectFilePDF extends Command
// 输出执行时间
var_dump("程序执行时间: " . $executionTime . " 秒");
// return $this->main();
return $gg;
}
/**
... ...
... ... @@ -18,6 +18,7 @@ use App\Models\Product\Keyword;
use App\Models\Product\Product;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Models\Template\BTemplateMain;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
... ... @@ -59,7 +60,7 @@ class UpdateMainHtml extends Command
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$this->editMainHtml();
$this->editMainHtml($v['id']);
DB::disconnect('custom_mysql');
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
... ... @@ -72,10 +73,32 @@ class UpdateMainHtml extends Command
* @method :post
* @time :2023/12/27 18:03
*/
public function editMainHtml(){
$mainModel = new BTemplateMain();
// $mainModel->edit(['type'=>3],['type'=>4]);
$mainModel->edit(['type'=>4],['type'=>6]);
public function editMainHtml($project_id){
$templateModel = new BTemplate();
$info = $templateModel->read(['source'=>4,'source_id'=>0]);
if($info !== false){
$mainModel = new BTemplateMain();
$mainInfo = $mainModel->read(['type'=>4,'is_list'=>1]);
if($mainInfo === false){
$data = [
'type'=>4,
'is_list'=>1,
'main_html'=>$info['main_html'],
'main_css'=>$info['main_css'],
'section_list_id'=>$info['section_list_id'],
'project_id'=>$project_id
];
$mainModel->add($data);
}else{
$data = [
'main_html'=>$info['main_html'],
'main_css'=>$info['main_css'],
'section_list_id'=>$info['section_list_id'],
'project_id'=>$project_id,
];
$mainModel->edit($data,['id'=>$mainInfo['id']]);
}
}
return true;
}
}
... ...
... ... @@ -10,6 +10,8 @@ use App\Models\Blog\Blog as BlogModel;
use App\Models\Blog\BlogCategory;
use App\Models\Blog\BlogCategory as BlogCategoryModel;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Models\Template\Setting;
use App\Models\User\User;
class BlogController extends BaseController
... ... @@ -32,12 +34,16 @@ class BlogController extends BaseController
$lists = $lists->toArray();
// //获取当前项目的所有分类
$data = $this->getCategoryList();
//获取当前用户选择的模版
$templateSettingModel = new Setting();
$info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
$user = new User();
foreach ($lists['list'] as $k => $v){
$v['category_name'] = $this->categoryName($v['category_id'],$data);
$v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']);
$v['image_link'] = getImageUrl($v['image']);
$v['operator_name'] = $user->getName($v['operator_id']);
$v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
$lists['list'][$k] = $v;
}
}
... ... @@ -45,6 +51,31 @@ class BlogController extends BaseController
}
/**
* @remark :查看产品是否已装修
* @name :getProductIsRenovation
* @author :lyh
* @method :post
* @time :2023/9/13 14:02
*/
public function getProductIsRenovation($info,$id){
if($info !== false){
$webTemplateModel = new BTemplate();
$param = [
'source'=>BTemplate::SOURCE_BLOG,
'project_id'=>$this->user['project_id'],
'source_id'=>$id,
'template_id'=>$info['template_id'],
'is_list'=>0
];
$templateInfo = $webTemplateModel->read($param);
if($templateInfo !== false){
return 1;
}
}
return 0;
}
/**
* @remark :处理列表返回参数
* @name :handleReturnParam
* @author :lyh
... ...
... ... @@ -65,7 +65,8 @@ class NewsController extends BaseController
'source'=>4,
'project_id'=>$this->user['project_id'],
'source_id'=>$id,
'template_id'=>$info['template_id']
'template_id'=>$info['template_id'],
'is_list'=>0
];
$templateInfo = $webTemplateModel->read($param);
if($templateInfo !== false){
... ...
... ... @@ -132,7 +132,8 @@ class ProductController extends BaseController
'source'=>2,
'project_id'=>$this->user['project_id'],
'source_id'=>$id,
'template_id'=>$info['template_id']
'template_id'=>$info['template_id'],
'is_list'=>0
];
$templateInfo = $webTemplateModel->read($param);
if($templateInfo !== false){
... ...
... ... @@ -248,164 +248,23 @@ class BTemplateLogic extends BaseLogic
* @time :2023/10/21 16:55
*/
public function getCommonHtml($source,$is_list,$template_id){
$is_head = $this->user['configuration']['is_head'] ?? 0;
$type = $this->getType($source,$is_list,$template_id);
$data = [
'template_id' => $template_id,
'project_id' => $this->user['project_id']
'project_id' => $this->user['project_id'],
'type'=>$type
];
if($template_id == 0){
$is_head = BTemplate::IS_HEADER;
}
if($is_head != BTemplate::IS_NO_HEADER) {
//查看页面是否设置自定义头部底部
$pageSettingModel = new PageSetting();
$pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
if($pageInfo !== false){
$commonInfo = [];
if ($source == BTemplate::SOURCE_BLOG) {//产品页
$commonInfo = $this->getProductCommonHtml($data,$is_list,$pageInfo);
}
if ($source == BTemplate::SOURCE_BLOG) {//博客页
$commonInfo = $this->getBlogCommonHtml($data,$is_list,$pageInfo);
}
if ($source == BTemplate::SOURCE_NEWS) {//新闻页
$commonInfo = $this->getNewsCommonHtml($data,$is_list,$pageInfo);
}
if ($source == BTemplate::SOURCE_KEYWORD) {//聚合页
$commonInfo = $this->getKeywordCommonHtml($data,$pageInfo);
}
if(!empty($commonInfo)){
return $this->success($commonInfo);
}
}
}
//获取首页公共的头部和底部
$commonInfo = $this->getHomeCommonHtml($data);
return $commonInfo;
}
/**
* @remark :获取首页头部底部
* @name :getHomeCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/27 16:11
*/
public function getHomeCommonHtml($data){
$data['type'] = BTemplate::SOURCE_HOME;
$commonTemplateModel = new BTemplateCommon();
return $commonTemplateModel->read($data);
}
/**
* @remark :聚合页
* @name :getKeywordCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/27 16:09
*/
public function getKeywordCommonHtml($data,$pageInfo){
$commonInfo = [];
$commonTemplateModel = new BTemplateCommon();
$data['type'] = BTemplate::TYPE_EIGHT;
if ($pageInfo['polymerization'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$data['type'] = BTemplate::SOURCE_HOME;
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
return $this->success($commonInfo);
}
/**
* @remark :产品头部底部
* @name :getProductCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/27 16:01
*/
public function getProductCommonHtml($data,$is_list,$pageInfo){
$commonInfo = [];
$commonTemplateModel = new BTemplateCommon();
if($is_list == BTemplate::IS_LIST){
$data['type'] = BTemplate::TYPE_THREE;
if ($pageInfo['product_list'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
} else {
$data['type'] = BTemplate::TYPE_TWO;
if ($pageInfo['product_details'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
}
return $this->success($commonInfo);
}
/**
* @remark :博客头部
* @name :getBlogCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/27 16:05
*/
public function getBlogCommonHtml($data,$is_list,$pageInfo){
$commonInfo = [];
$commonTemplateModel = new BTemplateCommon();
if ($is_list == BTemplate::IS_LIST) {
$data['type'] = BTemplate::TYPE_SEVEN;
if ($pageInfo['blog_list'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
} else {
$data['type'] = BTemplate::TYPE_SIX;
if ($pageInfo['blog_details'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
}
return $this->success($commonInfo);
}
/**
* @remark :新闻头部
* @name :getNewsCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/27 16:07
*/
public function getNewsCommonHtml($data,$is_list,$pageInfo){
$commonInfo = [];
$commonTemplateModel = new BTemplateCommon();
if ($is_list == BTemplate::IS_LIST) {
$data['type'] = BTemplate::TYPE_SEVEN;
if ($pageInfo['news_list'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
} else {
$data['type'] = BTemplate::TYPE_SIX;
if ($pageInfo['news_details'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
}
return $this->success($commonInfo);
}
/**
* @remark :保存修改后的模版
... ... @@ -436,7 +295,7 @@ class BTemplateLogic extends BaseLogic
$this->model->add($data);
}else{//执行编辑
$condition = [
'source'=>$this->param['source'], 'source_id'=>$this->param['source'],
'source'=>$this->param['source'], 'source_id'=>$this->param['source_id'],
'is_custom'=>$this->param['is_custom'], 'template_id'=>$this->param['template_id'],
'is_list'=>$this->param['is_list']
];
... ...