作者 刘锟

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

... ... @@ -446,6 +446,8 @@ class SyncProject extends Command
ProjectServer::createDatabase($project);
//创建表
ProjectServer::initTable();
//初始数据
ProjectServer::saveInitParam($project_id);
}
/**
... ...
<?php
/**
* @remark :
* @name :PopularTemplateLabel.php
* @author :lyh
* @method :post
* @time :2024/6/3 17:00
*/
namespace App\Console\Commands\TemplateLabel;
use App\Models\Template\Template;
use App\Models\Template\TemplateLabel as TemplateLabelModel;
use App\Models\Template\TemplateModule;
use Illuminate\Console\Command;
class PopularTemplateLabel extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'popular_template_label';
/**
* The console command description.
*
* @var string
*/
protected $description = '设置热门label';
/**
* @remark :执行脚本
* @name :handle
* @author :lyh
* @method :post
* @time :2024/6/3 17:01
*/
public function handle(){
$this->setTemplate();
$this->setTemplateModule();
return true;
}
/**
* @remark :公共模块热门模块
* @name :setTemplate
* @author :lyh
* @method :post
* @time :2024/6/3 15:56
*/
public function setTemplate(){
$templateModel = new Template();
$info = $templateModel->list(['test_model'=>0,'number'=>['<>',0]],'number',['id'],'desc',50);
if(empty($info)){
return true;
}else{
//清除当前所有最新标签
$labelModel = new TemplateLabelModel();
$labelModel->del(['name'=>'热门','type'=>1]);
$data = [];
foreach ($info as $v){
$data[] = [
'name'=>'热门',
'type'=>1,
'template_id'=>$v['id'],
'manager_id'=>0,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
}
//设置为最新
$labelModel->insert($data);
}
return true;
}
/**
* @remark :左侧模块
* @name :templateModule
* @author :lyh
* @method :post
* @time :2024/6/3 15:54
*/
public function setTemplateModule(){
$templateModuleModel = new TemplateModule();
$moduleInfo = $templateModuleModel->list(['test_model'=>0,'number'=>['<>',0]],'id',['id']);
if(empty($moduleInfo)){
return true;
}else{
//清除当前所有最新标签
$labelModel = new TemplateLabelModel();
$labelModel->del(['name'=>'热门','type'=>2]);
$moduleData = [];
foreach ($moduleInfo as $k => $v){
$moduleData[] = [
'name'=>'热门',
'type'=>2,
'template_id'=>$v['id'],
'manager_id'=>0,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
}
//设置为最新
$labelModel->insert($moduleData);
}
return true;
}
}
... ...
<?php
/**
* @remark :
* @name :TemplateLabel.php
* @author :lyh
* @method :post
* @time :2024/6/3 11:33
*/
namespace App\Console\Commands\TemplateLabel;
use App\Models\Template\Template;
use App\Models\Template\TemplateModule;
use Illuminate\Console\Command;
use App\Models\Template\TemplateLabel as TemplateLabelModel;
class TemplateLabel extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'template_label';
/**
* The console command description.
*
* @var string
*/
protected $description = '设置label';
/**
* @remark :执行脚本
* @name :handle
* @author :lyh
* @method :post
* @time :2024/6/3 11:35
*/
public function handle(){
//获取最近7天模版的记录
$start_time = now()->subDays(90)->startOfDay()->toDateString();
$end_time = now()->startOfDay()->toDateString();
$this->setTemplateModule($start_time,$end_time);
$this->setTemplate($start_time,$end_time);
return true;
}
/**
* @remark :公共模块
* @name :setTemplate
* @author :lyh
* @method :post
* @time :2024/6/3 15:56
*/
public function setTemplate($start_time,$end_time){
$templateModel = new Template();
$info = $templateModel->list(['created_at'=>['between',[$start_time,$end_time]],'test_model'=>0],'id',['id']);
if(empty($info)){
return true;
}else{
//清除当前所有最新标签
$labelModel = new TemplateLabelModel();
$labelModel->del(['name'=>'最新','type'=>1]);
$data = [];
foreach ($info as $k => $v){
$data[] = [
'name'=>'最新',
'type'=>1,
'template_id'=>$v['id'],
'manager_id'=>0,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
}
//设置为最新
$labelModel->insert($data);
}
return true;
}
/**
* @remark :左侧模块
* @name :templateModule
* @author :lyh
* @method :post
* @time :2024/6/3 15:54
*/
public function setTemplateModule($start_time,$end_time){
$templateModuleModel = new TemplateModule();
$moduleInfo = $templateModuleModel->list(['created_at'=>['between',[$start_time,$end_time]],'test_model'=>0],'id',['id']);
if(empty($moduleInfo)){
return true;
}else{
//清除当前所有最新标签
$labelModel = new TemplateLabelModel();
$labelModel->del(['name'=>'最新','type'=>2]);
$moduleData = [];
foreach ($moduleInfo as $k => $v){
$moduleData[] = [
'name'=>'最新',
'type'=>2,
'template_id'=>$v['id'],
'manager_id'=>0,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
}
//设置为最新
$labelModel->insert($moduleData);
}
return true;
}
}
... ...
... ... @@ -72,70 +72,70 @@ class Demo extends Command
// return true;
// }
// public function handle(){
// $keywordVideoModel = new KeywordVideoTask();
// $project_id_arr = $keywordVideoModel::where('id','>',0)->pluck('project_id')->toArray();
// $projectModel = new Project();
// $list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0,'id'=>['in',$project_id_arr]]);
// $data = [];
// foreach ($list as $v){
// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
// ProjectServer::useProject($v['id']);
// $this->saveKeyword();
// DB::disconnect('custom_mysql');
// }
// echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
// }
//
// /**
// * @remark :关键字有视频的改为1
// * @name :getProductKeywordInfo
// * @author :lyh
// * @method :post
// * @time :2024/5/31 9:54
// */
// public function saveKeyword(){
// $keywordModel = new Keyword();
// $rs = $keywordModel->edit(['is_video_keyword'=>1],['video'=>['!=',null]]);
// echo date('Y-m-d H:i:s') . 'end'.$rs . PHP_EOL;
// return true;
// }
public function handle(){
//切换数据库配置
ProjectServer::useProject(1862);
return $this->initTable(1380,1862);
$keywordVideoModel = new KeywordVideoTask();
$project_id_arr = $keywordVideoModel::where('id','>',0)->pluck('project_id')->toArray();
$projectModel = new Project();
$list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0,'id'=>['in',$project_id_arr]]);
$data = [];
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$this->saveKeyword();
DB::disconnect('custom_mysql');
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
public function initTable($project_id, $news_project_id)
{
config(['database.connections.custom_tmp_mysql_copy.database' => 'gl_data_' . $project_id]);
$database_name = DB::connection('custom_tmp_mysql_copy')->getDatabaseName();
$tables = Schema::connection('custom_tmp_mysql_copy')->getAllTables();
$tables = array_column($tables, 'Tables_in_' . $database_name);
foreach ($tables as $table) {
$has_table = Schema::connection('custom_mysql')->hasTable($table);
if (!$has_table) {
$sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$table}");
DB::connection('custom_mysql')->statement(array_values((array)$sql[0])[0]); // 修正此处的sql语句获取方式
}
if ($table == 'gl_customer_visit' || $table == 'gl_customer_visit_item' || $table == 'gl_inquiry_other' || $table == 'gl_inquiry_form_data' || $table == 'gl_inquiry_form') {
continue;
}
DB::connection('custom_mysql')->table($table)->truncate(); // 清空目标表数据
DB::connection('custom_mysql')->table($table)->insertUsing(
[], // 列名数组,留空表示插入所有列
function ($query) use ($table, $project_id) {
$name = 'gl_data_' . $project_id . '.' . $table;
$query->select('*')->from("{$name}");
}
);
if (Schema::connection('custom_mysql')->hasColumn($table, 'project_id')) {
DB::connection('custom_mysql')->table($table)->update(['project_id' => $news_project_id]);
}
}
/**
* @remark :关键字有视频的改为1
* @name :getProductKeywordInfo
* @author :lyh
* @method :post
* @time :2024/5/31 9:54
*/
public function saveKeyword(){
$keywordModel = new Keyword();
$rs = $keywordModel->edit(['is_video_keyword'=>0],['video'=>'']);
echo date('Y-m-d H:i:s') . 'end'.$rs . PHP_EOL;
return true;
}
// public function handle(){
// //切换数据库配置
// ProjectServer::useProject(1862);
// return $this->initTable(1380,1862);
// }
//
// public function initTable($project_id, $news_project_id)
// {
// config(['database.connections.custom_tmp_mysql_copy.database' => 'gl_data_' . $project_id]);
// $database_name = DB::connection('custom_tmp_mysql_copy')->getDatabaseName();
// $tables = Schema::connection('custom_tmp_mysql_copy')->getAllTables();
// $tables = array_column($tables, 'Tables_in_' . $database_name);
// foreach ($tables as $table) {
// $has_table = Schema::connection('custom_mysql')->hasTable($table);
// if (!$has_table) {
// $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$table}");
// DB::connection('custom_mysql')->statement(array_values((array)$sql[0])[0]); // 修正此处的sql语句获取方式
// }
//
// if ($table == 'gl_customer_visit' || $table == 'gl_customer_visit_item' || $table == 'gl_inquiry_other' || $table == 'gl_inquiry_form_data' || $table == 'gl_inquiry_form') {
// continue;
// }
// DB::connection('custom_mysql')->table($table)->truncate(); // 清空目标表数据
// DB::connection('custom_mysql')->table($table)->insertUsing(
// [], // 列名数组,留空表示插入所有列
// function ($query) use ($table, $project_id) {
// $name = 'gl_data_' . $project_id . '.' . $table;
// $query->select('*')->from("{$name}");
// }
// );
//
// if (Schema::connection('custom_mysql')->hasColumn($table, 'project_id')) {
// DB::connection('custom_mysql')->table($table)->update(['project_id' => $news_project_id]);
// }
// }
// return true;
// }
}
... ...
... ... @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command
public function handle(){
//获取所有项目
$projectModel = new Project();
$list = $projectModel->list(['id'=>['in',[621]]],'id',['id']);
$list = $projectModel->list(['id'=>['in',[1077]]],'id',['id']);
echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL;
try {
foreach ($list as $v) {
... ...
... ... @@ -15,6 +15,9 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// 每日更新最新模块
// $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块
// $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块
// $schedule->command('inspire')->hourly();
$schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长
$schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
... ...
... ... @@ -37,10 +37,12 @@ class V6UpdateLogController extends BaseController
*/
public function save(V6UpdateLogLogic $logic){
$this->request->validate([
'title' => 'required',
'version_id' => 'required',
'remark' => 'required',
'updated_date' => 'required',
], [
'title.required' => 'title不能为空',
'version_id.required' => '版本号version_id不能为空',
'remark.required' => '更新内容不能为空',
'updated_date.required' => '更新时间不能为空',
... ...
... ... @@ -331,6 +331,9 @@ class OptimizeController extends BaseController
'project_id.required' => 'project_id不能为空',
]);
$projectModel = new Project();
if($this->param['robots'] != $projectModel::STATUS_ONE){
$this->response('robots只能开启不能关闭',Code::SYSTEM_ERROR);
}
$rs = $projectModel->edit(['robots'=>$this->param['robots']],['id'=>$this->param['project_id']]);
if($rs === false){
$this->response('执行错误,请联系开发人员',Code::SYSTEM_ERROR);
... ...
... ... @@ -25,17 +25,14 @@ class ATemplateController extends BaseController
* @method :post
* @time :2023/6/28 16:34
*/
public function lists(ATemplateLogic $aTemplateLogic,TemplateLabel $templateLabel){
if(isset($this->map['label_name']) && !empty($this->map['label_name'])){
$id_arr = $templateLabel->formatQuery(['name'=>['like','%'.$this->map['label_name'].'%']])->pluck('template_id')->toArray();
$this->map['id'] = ['in',$id_arr];
unset($this->map['label_name']);
}
public function lists(ATemplateLogic $aTemplateLogic){
$templateLabel = new TemplateLabel();
$this->searchLabelName($templateLabel);
$filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id'];
$lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed);
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v['label'] = $templateLabel->list(['template_id'=>$v['id']],'id',['id','name'],'desc',5);
$v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>1],'id',['id','name'],'desc',5);
$v['image_link'] = getImageUrl($v['image']);
$lists['list'][$k] = $v;
}
... ... @@ -44,6 +41,22 @@ class ATemplateController extends BaseController
}
/**
* @remark :搜索label
* @name :searchLabelName
* @author :lyh
* @method :post
* @time :2024/6/3 11:11
*/
public function searchLabelName($templateLabel){
if(isset($this->map['label_name']) && !empty($this->map['label_name'])){
$id_arr = $templateLabel->formatQuery(['name'=>['like','%'.$this->map['label_name'].'%'],'type'=>1])->pluck('template_id')->toArray();
$this->map['id'] = ['in',$id_arr];
unset($this->map['label_name']);
}
return true;
}
/**
* @remark :获取选择的模版
* @name :getTemplateInfo
* @author :lyh
... ...
... ... @@ -8,6 +8,8 @@ use App\Http\Logic\Aside\Template\ATemplateLogic;
use App\Http\Logic\Aside\Template\ATemplateModuleLogic;
use App\Http\Requests\Aside\Template\ATemplateModuleRequest;
use App\Models\Project\Project;
use App\Models\Template\TemplateLabel;
use App\Models\Template\TemplateModule;
/**
* @remark :左侧模块管理
... ... @@ -24,12 +26,38 @@ class ATemplateModuleController extends BaseController
* @method :post
* @time :2023/6/28 16:54
*/
public function lists(ATemplateModuleLogic $ATemplateModuleLogic){
$lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order);
public function lists(TemplateModule $templateModule){
$templateLabel = new TemplateLabel();
$this->map['deleted_status'] = 0;
$this->searchLabelName($templateLabel);
$lists = $templateModule->lists($this->map,$this->page,$this->row,$this->order);
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc',5);
$lists['list'][$k] = $v;
}
}
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :搜索label
* @name :searchLabelName
* @author :lyh
* @method :post
* @time :2024/6/3 11:11
*/
public function searchLabelName($templateLabel){
if(isset($this->map['label_name']) && !empty($this->map['label_name'])){
$id_arr = $templateLabel->formatQuery(['name'=>['like','%'.$this->map['label_name'].'%'],'type'=>2])->pluck('template_id')->toArray();
$this->map['id'] = ['in',$id_arr];
unset($this->map['label_name']);
}
return true;
}
/**
* @remark :左侧模块保存
* @name :save
* @author :lyh
... ...
... ... @@ -34,8 +34,10 @@ class TemplateLabelController extends BaseController
public function getUserLists(TemplateLabel $templateLabel){
$this->request->validate([
'template_id'=>'required',
'type'=>'required',
],[
'template_id.required' => '模版id不能为空',
'type.required' => '模版类型不能为空不能为空',
]);
$data = $templateLabel->list($this->map);
$this->response('success',Code::SUCCESS,$data);
... ...
... ... @@ -55,12 +55,12 @@ class ProductController extends BaseController
if(!empty($lists)){
$lists = $lists->toArray();
$cate_data = $this->getCategoryList();//分类
$key_data = $this->getKeywordsList();//关键字
$key_data = $this->keywordNameLists($lists['list']);//关键字
$template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
$userModel = new User();
foreach ($lists['list'] as $k=>$v){
$v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);;
$v['category_id_text'] = $this->categoryName($v['category_id'],$cate_data);
$v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
$v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
$v['created_uid_text'] = $userModel->getName($v['created_uid']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
... ... @@ -72,6 +72,30 @@ class ProductController extends BaseController
}
/**
* @remark :获取当前页的所有关键字名称
* @name :keywordNameLists
* @author :lyh
* @method :post
* @time :2024/6/3 14:24
*/
public function keywordNameLists($lists){
$keywordId = [];
foreach ($lists as $v){
$keywordId = array_merge($keywordId,$v['keyword_id']);
}
$keywordId = array_values(array_unique($keywordId));
$keywordModel = new Keyword();
$data = [];
$cateList = $keywordModel->list(['id' => ['in',$keywordId]], ['id', 'title']);
if (!empty($cateList)) {
foreach ($cateList as $value) {
$data[$value['id']] = $value['title'];
}
}
return $data;
}
/**
* @remark :不分页产品列表
* @name :productNoPage
* @author :lyh
... ... @@ -220,7 +244,9 @@ class ProductController extends BaseController
* @method :post
* @time :2023/9/14 13:58
*/
public function categoryName($category_id,$data){
public function categoryName($product_id,$data){
$cateRelatedModel = new CategoryRelated();
$category_id = $cateRelatedModel->where('product_id',$product_id)->pluck('cate_id')->toArray();
$category_name = '';
if(!empty($category_id) && !empty($data)){
foreach ($category_id as $v){
... ...
<?php
/**
* @remark :
* @name :TemplateLabelController.php
* @author :lyh
* @method :post
* @time :2024/5/16 9:51
*/
namespace App\Http\Controllers\Bside\Template;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\BTemplate\BTemplateLabelLogic;
use App\Models\Template\TemplateLabel;
/**
* @remark :
* @name :TemplateLabelController
* @author :lyh
* @method :post
* @time :2024/5/16 9:51
*/
class BTemplateLabelController extends BaseController
{
/**
* @remark :获取模版的标签
* @name :lists
* @author :lyh
* @method :post
* @time :2024/5/16 10:15
*/
public function getUserLists(TemplateLabel $templateLabel){
$this->request->validate([
'template_id'=>'required',
'type'=>'required',
],[
'template_id.required' => '模版id不能为空',
'type.required' => '模版类型不能为空不能为空',
]);
$data = $templateLabel->list($this->map);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存标签
* @name :save
* @author :lyh
* @method :post
* @time :2024/5/16 9:53
*/
public function save(BTemplateLabelLogic $labelLogic){
$this->request->validate([
'name'=>'required | max:200',
'type'=>'required',
'template_id'=>'required',
],[
'name.required' => '标签名称不能为空',
'type.required' => '模版类型不能为空不能为空',
'template_id.required' => '模版ID不能为空不能为空',
]);
$data = $labelLogic->saveLabel();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :删除数据
* @name :del
* @author :lyh
* @method :post
* @time :2024/5/16 10:08
*/
public function del(BTemplateLabelLogic $labelLogic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => '主键不能为空',
]);
$data = $labelLogic->delLabel();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -7,6 +7,7 @@ use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\BTemplate\BTemplateModuleLogic;
use App\Http\Logic\Bside\BTemplate\BTemplateModuleProjectLogic;
use App\Models\Template\BModuleProject;
use App\Models\Template\TemplateLabel;
/**
* @remark :左侧模块管理
... ... @@ -62,4 +63,21 @@ class BTemplateModuleController extends BaseController
$list = $BTemplateModuleLogic->ModuleType($this->map);
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :设置数量
* @name :setModuleNumber
* @author :lyh
* @method :post
* @time :2024/6/3 16:50
*/
public function setModuleNumber(){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'id不能为空',
]);
$this->model->where('id', $this->param['id'])->increment('number');
$this->response('success');
}
}
... ...
... ... @@ -22,19 +22,6 @@ class ATemplateModuleLogic extends BaseLogic
}
/**
* @remark :左侧模块列表
* @name :aTemplateModuleLists
* @author :lyh
* @method :post
* @time :2023/6/28 18:01
*/
public function aTemplateModuleLists($map,$page,$row,$order = 'created_at',$filed = ['*']){
$map['deleted_status'] = 0;
$lists = $this->model->lists($map,$page,$row,$order,$filed);
return $this->success($lists);
}
/**
* @remark :保存左侧模块
* @name :aTemplateModuleSave
* @author :lyh
... ...
<?php
/**
* @remark :
* @name :TemplateLabelLogic.php
* @author :lyh
* @method :post
* @time :2024/5/16 9:54
*/
namespace App\Http\Logic\Bside\BTemplate;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Template\TemplateLabel;
/**
* @remark :模版标签
* @name :TemplateLabelLogic
* @author :lyh
* @method :post
* @time :2024/5/16 9:54
*/
class BTemplateLabelLogic extends BaseLogic
{
/**
* 初始化数据
*/
public function __construct()
{
parent::__construct();
$this->model = new TemplateLabel();
$this->param = $this->requestAll;
}
/**
* @remark :保存标签
* @name :saveLabel
* @author :lyh
* @method :post
* @time :2024/5/16 9:55
*/
public function saveLabel(){
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$info = $this->model->read(['name'=>$this->param['name'],'template_id'=>$this->param['template_id'],'id'=>['!=',$id]],['id']);
if($info === false){
$this->model->edit($this->param,['id'=>$id]);
}
}else{
$info = $this->model->read(['name'=>$this->param['name'],'template_id'=>$this->param['template_id']],['id']);
if($info === false){
$this->param['manager_id'] = $this->manager['id'];
$id = $this->model->addReturnId($this->param);
}else{
$id = $info['id'];
}
}
return $this->success(['id'=>$id]);
}
/**
* @remark :删除标签
* @name :delLabel
* @author :lyh
* @method :post
* @time :2024/5/16 10:03
*/
public function delLabel(){
$rs = $this->model->del($this->param);
if($rs === false){
$this->fail('删除失败,请联系管理员');
}
return $this->success();
}
}
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Http\Logic\Bside\BTemplate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Template\TemplateLabel;
use App\Models\Template\TemplateModule;
use App\Models\Template\TemplateType;
... ... @@ -25,8 +26,13 @@ class BTemplateModuleLogic extends BaseLogic
public function ModuleList($map,$order = 'created_at',$filed = ['id','name','type','sort','status','image','test_model']){
$map['deleted_status'] = 0;
$map['status'] = 0;
$lists = $this->model->list($map,$order,$filed);
return $this->success($lists);
$list = $this->model->list($map,$order,$filed);
$templateLabel = new TemplateLabel();
foreach ($list as $k => $v){
$v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc',5);
$list[$k] = $v;
}
return $this->success($list);
}
/**
... ...
... ... @@ -244,12 +244,6 @@ class CategoryLogic extends BaseLogic
$str = ','.implode(',',$category).',';
}
return $str;
// if(isset($category) && !empty($category)){
// foreach ($category as $v){
// $str .= $v.',';
// }
// }
// return !empty(trim($str,',')) ? ','.$str.',' : '';
}
/**
... ...
... ... @@ -21,7 +21,7 @@ class Visit extends Base
//连接数据库
protected $connection = 'custom_mysql';
protected $appends = ['device_text'];
protected $fillable = ['id','ip','device_port','country','city','url','referrer_url','depth','domain','is_inquiry','original_id','updated_date', 'created_at'];
protected $fillable = ['id','ip','device_port','country','city','url','referrer_url','depth','domain','is_inquiry','original_id','updated_date', 'created_at', 'user_agent'];
const DEVICE_PC = 1;
const DEVICE_MOBILE = 2;
... ...
... ... @@ -17,6 +17,6 @@ class VisitItem extends Base
//连接数据库
protected $connection = 'custom_mysql';
protected $fillable = ['ip','customer_visit_id','device_port','country','city','url','referrer_url','domain','updated_date','created_at'];
protected $fillable = ['ip','customer_visit_id','device_port','country','city','url','referrer_url','domain','updated_date','created_at', 'user_agent'];
}
... ...
... ... @@ -132,6 +132,7 @@ class SyncSubmitTaskService
$visit_data['country'] = $data['country'];
$visit_data['updated_date'] = $data['submit_at']->toDateString();
$visit_data['created_at'] = $data['submit_at'];
$visit_data['user_agent'] = $data['user_agent'];
Visit::saveData($visit_data, $date);
return true;
... ...
... ... @@ -369,6 +369,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'lists'])->name('template_module_lists');
Route::any('/read', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'read'])->name('template_module_read');
Route::any('/type', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'getType'])->name('template_module_getType');
Route::any('/setModuleNumber', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'setModuleNumber'])->name('template_module_setModuleNumber');
});
// 保存私有模块
... ... @@ -537,6 +538,12 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('tutorial')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\BCom\TutorialController::class, 'lists'])->name('tutorial_lists');
});
//oa教程
Route::prefix('template_label')->group(function () {
Route::any('/getUserLists', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'getUserLists'])->name('template_label_getUserLists');
Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'save'])->name('template_label_save');
Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'del'])->name('template_label_del');
});
});
//无需登录验证的路由组
Route::group([], function () {
... ...