作者 刘锟

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

... ... @@ -73,7 +73,7 @@ class Count extends Command
$arr['ip_num'] = $this->ip_num($yesterday,$v['test_domain']);
DB::disconnect('custom_mysql');
//服务达标天数
$arr['compliance_day'] = $this->compliance_day($v['id']);
$arr['compliance_day'] = $v['finish_remain_day'];
//剩余服务时常
$arr['service_day'] = $v['remain_day'];
//项目id
... ... @@ -164,24 +164,6 @@ class Count extends Command
}
/**
* @param $yesterday
* @name :(服务达标天数)compliance_day
* @author :lyh
* @method :post
* @time :2023/6/14 15:48
*/
public function compliance_day($project_id){
//服务达标天数
$rank_info = DB::table('gl_rank_data')->where(['project_id'=>$project_id,'lang'=>''])->select(['compliance_day'])->first();
if(empty($rank_info)){
$compliance_day = 0;
}else{
$compliance_day = $rank_info->compliance_day;
}
return $compliance_day;
}
/**
* @name :(查询参数设置)selectParam
* @author :lyh
* @method :post
... ... @@ -193,6 +175,7 @@ class Count extends Command
'gl_project.type AS type',
'gl_project.extend_type AS extend_type',
'gl_project.remain_day AS remain_day',
'gl_project.finish_remain_day AS finish_remain_day',
'gl_project_deploy_build.test_domain AS test_domain',
'gl_project_deploy_optimize.domain AS domain',
'gl_project_deploy_build.project_id AS project_id',
... ...
... ... @@ -49,13 +49,19 @@ class DomainInfo extends Command
}
$ssl = $this->updateDomainSsl($v['domain']);
$time = $this->updateDomain($v['domain']);
$data = [
'certificate_start_time'=>$ssl['from'],
'certificate_end_time'=>$ssl['to'],
'domain_start_time'=>$time['start'],
'domain_end_time'=>$time['end']
];
if(!empty($time['start']) && !!empty($time['end'])){
$data = [
'certificate_start_time'=>$ssl['from'],
'certificate_end_time'=>$ssl['to'],
'domain_start_time'=>$time['start'],
'domain_end_time'=>$time['end']
];
}else{
$data = [
'domain_start_time'=>$time['start'],
'domain_end_time'=>$time['end']
];
}
$domainModel->edit($data,['id'=>$v['id']]);
}
return 1;
... ... @@ -169,8 +175,8 @@ class DomainInfo extends Command
$valid_to = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validTo_time_t']);
fclose($stream);
}catch (\Exception $e){
$valid_from = date('Y-m-d H:i:s');
$valid_to = date('Y-m-d H:i:s');
$valid_from = '';
$valid_to = '';
}
return ['from'=>$valid_from,'to'=>$valid_to];
}
... ...
... ... @@ -67,7 +67,6 @@ class InitProject extends Command
if(!empty($project['serve_id'])){
$project_logic->updateServe($project['serve_id']);
}
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
echo 'success:' . $item['id'] . PHP_EOL;
... ...
... ... @@ -124,27 +124,4 @@ class BaseController extends Controller
$response = response($result,$result_code,$this->header);
throw new HttpResponseException($response);
}
/**
* @remark :返回json
* @name :success
* @author :lyh
* @method :post
* @time :2023/8/28 10:18
*/
function success(array $data = [], string $code = Code::SUCCESS, bool $objectData = false): JsonResponse
{
if ($objectData) {
$data = (object)$data;
}
$code = Code::fromValue($code);
$response = [
'code' => $code->value,
'data' => $data,
'message' => $code->description,
];
$this->header['token'] = $this->token;
return response()->json($response,200,$this->header);
}
}
... ...
... ... @@ -2,6 +2,7 @@
namespace App\Http\Controllers\Aside\Collect;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\CollectLogic;
... ... @@ -22,6 +23,6 @@ class CollectController extends BaseController
public function index(CollectLogic $collectLogic)
{
$data = $collectLogic->collect_data();
return $this->success($data);
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -7,6 +7,8 @@ use App\Exceptions\BsideGlobalException;
use App\Helper\Common;
use App\Http\Controllers\Controller;
use App\Http\Requests\Scene;
use App\Models\Template\BTemplate;
use App\Models\Template\Setting;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Exceptions\HttpResponseException;
... ... @@ -127,7 +129,7 @@ class BaseController extends Controller
* @param bool $objectData
* @return JsonResponse
*/
function success($data) :array
function success($data)
{
return $data;
}
... ... @@ -170,4 +172,85 @@ class BaseController extends Controller
return \Illuminate\Support\Facades\Request::isMethod('post');
}
/**
* @remark :获取当前用户选择的模版
* @name :getTemplateId
* @author :lyh
* @method :post
* @time :2024/1/3 10:52
*/
public function getTemplateId($source,$is_list){
$template_id = 0;
if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION) {//定制项目
$type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
//查看当前页面是否定制,是否开启可视化
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
if (in_array($type, $page_array)) {//是定制界面
return $this->success($template_id);
}
}
$bSettingModel = new Setting();
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
if($info === false){
return $this->success($template_id);
}
$template_id = $info['template_id'];
return $this->success($template_id);
}
/**
* @remark :定制页面头部类型---根据source获取type类型
* @name :getType
* @author :lyh
* @method :post
* @time :2023/11/16 11:20
*/
public function getCustomizedType($source,$is_list){
$type = BTemplate::TYPE_HOME;
if($source == BTemplate::SOURCE_PRODUCT){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_PRODUCT_LIST;
}else{
$type = BTemplate::TYPE_PRODUCT_DETAIL;
}
}
if($source == BTemplate::SOURCE_BLOG){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_BLOG_LIST;
}else{
$type = BTemplate::TYPE_BLOG_DETAIL;
}
}
if($source == BTemplate::SOURCE_NEWS){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_NEWS_LIST;
}else{
$type = BTemplate::TYPE_NEWS_DETAIL;
}
}
return $type;
}
/**
* @remark :查看是否已装修
* @name :getIsRenovation
* @author :lyh
* @method :post
* @time :2023/9/13 14:02
*/
public function getIsRenovation($source,$is_list,$template_id,$id){
$webTemplateModel = new BTemplate();
$param = [
'source'=>$source,
'project_id'=>$this->user['project_id'],
'source_id'=>$id,
'template_id'=>$template_id,
'is_list'=>$is_list
];
$templateInfo = $webTemplateModel->read($param);
if($templateInfo !== false){
return 1;
}
return 0;
}
}
... ...
... ... @@ -9,6 +9,7 @@ use App\Http\Requests\Bside\Blog\BlogCategoryRequest;
use App\Models\Blog\Blog as BlogModel;
use App\Models\Blog\BlogCategory as BlogCategoryModel;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
class BlogCategoryController extends BaseController
{
... ... @@ -25,9 +26,11 @@ class BlogCategoryController extends BaseController
$data = [];
if(!empty($lists)){
$blogModel = new BlogModel();
$template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST);
foreach ($lists as $k => $v){
$v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
$v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST,$template_id,$v['id']);
$lists[$k] = $v;
}
if(!isset($this->map['name'])){
... ...
... ... @@ -32,18 +32,15 @@ class BlogController extends BaseController
$lists = $query->select($filed)->paginate($this->row, ['*'], 'page', $this->page);
if(!empty($lists)){
$lists = $lists->toArray();
// //获取当前项目的所有分类
$data = $this->getCategoryList();
//获取当前用户选择的模版
$templateSettingModel = new Setting();
$info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
$template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL);
$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']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL,$template_id,$v['id']);
$lists['list'][$k] = $v;
}
}
... ... @@ -51,31 +48,6 @@ 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
... ...
... ... @@ -9,6 +9,7 @@ use App\Http\Requests\Bside\News\NewsCategoryRequest;
use App\Models\News\News as NewsModel;
use App\Models\News\NewsCategory as NewsCategoryModel;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
class NewsCategoryController extends BaseController
{
... ... @@ -25,9 +26,11 @@ class NewsCategoryController extends BaseController
$data = [];
if(!empty($lists)){
$newsModel = new NewsModel();
$template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST);
foreach ($lists as $k => $v){
$v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
$v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_LIST,$template_id,$v['id']);
$lists[$k] = $v;
}
if(!isset($this->map['name'])){
... ...
... ... @@ -36,15 +36,14 @@ class NewsController extends BaseController
// //获取当前项目的所有分类
$data = $this->getCategoryList();
//获取当前用户选择的模版
$templateSettingModel = new Setting();
$info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
$template_id = $this->getTemplateId(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL);//获取模版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_NEWS,$v['id']);
$v['image_link'] = getImageUrl($v['image']);
$v['operator_name'] = $user->getName($v['operator_id']);
$v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL,$template_id,$v['id']);
$lists['list'][$k] = $v;
}
}
... ... @@ -52,31 +51,6 @@ class NewsController 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'=>4,
'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
... ...
... ... @@ -10,6 +10,7 @@ use App\Models\Product\Category;
use App\Models\Product\CategoryRelated;
use App\Models\Product\Product;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Rules\Ids;
use Illuminate\Http\Request;
... ... @@ -36,10 +37,12 @@ class CategoryController extends BaseController
$list = $category->list($this->map,['sort','id'],$filed);
$data = [];
if(!empty($list)){
$template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id
foreach ($list as $k =>$v){
$v['url'] = $this->user['domain'] . $v['route'].'/';
$v['product_num'] = Category::getProductNum($v['id']);
$v['image_link'] = getImageUrl($v['image']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
$list[$k] = $v;
}
if(!isset($this->map['title'])){
... ...
... ... @@ -7,6 +7,7 @@ use App\Exceptions\BsideGlobalException;
use App\Helper\Arr;
use App\Helper\Common;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\BTemplate\BTemplateLogic;
use App\Http\Logic\Bside\Product\ProductLogic;
use App\Http\Requests\Bside\Product\ProductRequest;
use App\Models\Product\Category;
... ... @@ -52,15 +53,13 @@ class ProductController extends BaseController
$lists = $lists->toArray();
$cate_data = $this->getCategoryList();//分类
$key_data = $this->getKeywordsList();//关键字
//获取当前用户选择的模版
$templateSettingModel = new Setting();
$info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
$template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
$userModel = new User();
foreach ($lists['list'] as $k=>$v){
$v['category_id_text'] = $this->categoryName($v['category_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->getProductIsRenovation($info,$v['id']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
$v['url'] = $this->user['domain'].$v['route'].'/';
$lists['list'][$k] = $v;
}
... ... @@ -119,31 +118,6 @@ class ProductController 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'=>2,
'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 :getCategoryList
* @author :lyh
... ... @@ -266,9 +240,8 @@ class ProductController extends BaseController
}
$v['status_text'] = Product::statusMap()[$v['status']] ?? '';
//获取当前用户选择的模版
$templateSettingModel = new Setting();
$templateInfo = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
$v['is_renovation'] = $this->getProductIsRenovation($templateInfo,$v['id']);
$template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
$v['url'] = $this->user['domain'].$v['route'];
//获取当前数据扩展字段及值
$v['extend'] = $this->getExtendInfo($v['id']);
... ...
... ... @@ -48,7 +48,7 @@ class ProjectAssociationController extends BaseController
$image = request()->post('image', '');
$data = compact('project_id', 'user_id', 'friend_id', 'nickname', 'user_name', 'image');
$this->ProjectAssociationLogic->saveWeChatData($data);
$this->response('success');
$this->response('绑定成功');
}
/**
... ... @@ -67,18 +67,25 @@ class ProjectAssociationController extends BaseController
$isRes = $this->ProjectAssociationLogic->normal($project_id);
// 当数据不存在时并开启状态,自动添加一条数据
if (is_null($isRes) && (!is_null($status) && $status)) {
$bool = $this->ProjectAssociationLogic->saveProject($project_id, $status);
if (empty($bool)) {
$isRes = $this->ProjectAssociationLogic->saveProject($project_id, $status);
if (is_null($isRes)) {
// 保存数据失败
$this->response('error', Code::SERVER_ERROR);
$this->response('绑定AICC数据失败!', Code::SERVER_ERROR);
}
} // 关闭状态
elseif (!is_null($isRes) && (!is_null($status) && empty($status))) {
$res = $this->ProjectAssociationLogic->closedState($isRes, $status);
$this->response($res['message'], $res['code']);
} elseif (is_null($isRes)) {
$bool = $this->ProjectAssociationLogic->closedState($isRes, $status);
if ($bool) {
// 关闭aicc绑定成功
$this->response('关闭aicc绑定 - 成功!');
}else{
// 关闭aicc绑定失败
$this->response('关闭aicc绑定 - 失败!');
}
}
if (is_null($isRes)) {
// 请开启AICC绑定
$this->response('error', Code::SERVER_ERROR);
$this->response('success', Code::SERVER_ERROR);
}
$cache = isset($cache);
$result = $this->ProjectAssociationLogic->getAiccWechatLists($isRes, $cache);
... ...
... ... @@ -7,9 +7,7 @@ use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\BTemplate\BTemplateLogic;
use App\Http\Requests\Bside\Template\TemplateRequest;
use App\Models\Template\BTemplate;
use App\Models\Template\BTemplateMain;
use App\Models\Template\Setting;
use App\Models\Template\Template;
class BTemplateController extends BaseController
{
... ... @@ -160,4 +158,16 @@ class BTemplateController extends BaseController
$this->response('模板保存成功');
}
/**
* @remark :获取source类型
* @name :getSource
* @author :lyh
* @method :post
* @time :2024/1/3 9:06
*/
public function getSource(){
$bTemplateModel = new BTemplate();
$info = $bTemplateModel->sourceMap();
$this->response('success',Code::SUCCESS,$info);
}
}
... ...
... ... @@ -150,6 +150,7 @@ class DomainInfoLogic extends BaseLogic
*/
public function setDomainSsl($initDomain,$domain,$rewrite,$other_domain)
{
$this->fail('当前功能,占时无法使用,如有紧急需要上线项目,请联系管理人员');
if($this->param['type'] == 2){
if(empty($this->param['key'])){
$this->fail('证书KEY值不能为空');
... ...
... ... @@ -418,8 +418,8 @@ class ProjectLogic extends BaseLogic
'role_menu'=>implode(',',$ids),
'project_id'=>$project_id,
'type'=>1,
'operator_id'=>$this->manager['id'],
'create_id'=>$this->manager['id'],
'operator_id'=>0,
'create_id'=>0,
];
$roleModel->add($data);
}
... ...
... ... @@ -52,7 +52,7 @@ class ProjectAssociationLogic extends Logic
* 初始化数据/修改数据
* @param int $project_id
* @param int $status
* @return bool
* @return Builder|Model|object|ProjectAssociation|null
*/
public function saveProject($project_id, $status)
{
... ... @@ -66,12 +66,12 @@ class ProjectAssociationLogic extends Logic
$isRes->user_id = (int)env('AICC_WECHAT_USER_ID');
$isRes->status = $status;
try {
$bool = $isRes->save();
$isRes->save();
DB::commit();
} catch (\Exception $exception) {
DB::rollBack();
}
return $bool;
return $isRes;
}
/**
... ... @@ -104,27 +104,19 @@ class ProjectAssociationLogic extends Logic
* 关闭状态
* @param ProjectAssociation $res
* @param int $status 1 - 正常, 0 - 禁用
* @return array
* @return bool
*/
public function closedState($res, $status)
{
DB::beginTransaction();
$bool = false;
try {
$res->status = $status;
$res->save();
$bool = $res->save();
DB::commit();
$code = Code::SUCCESS;
$message = '关闭AICC绑定成功!';
} catch (\Exception $exception) {
DB::rollBack();
// 数据错误,请重试
$code = Code::SERVER_ERROR;
$message = 'error';
}
return [
'code' => $code,
'data' => [],
'message' => $message,
];
return $bool;
}
}
... ...
... ... @@ -41,6 +41,11 @@ class CountLogic extends BaseLogic
$info = $this->model->read(['project_id' => $this->user['project_id']],
['pv_num','ip_num','inquiry_num','date','compliance_day','service_day','country']);
}
//获取项目的剩余时长
$projectModel = new Project();
$projectInfo = $projectModel->read(['id'=>$this->user['project_id']],['remain_day','finish_remain_day']);
$info['service_day'] = $projectInfo['remain_day'];
$info['compliance_day'] = $projectInfo['finish_remain_day'];
return $this->success($info);
}
... ... @@ -83,7 +88,7 @@ class CountLogic extends BaseLogic
* @time :2023/5/24 14:03
*/
public function keyword_data_count(){
$yesterday = Carbon::yesterday()->toDateString();
$yesterday = date('Y-m-d');
$rankDataModel = new RankDataModel();
$param = [
'updated_date' => $yesterday,
... ...
... ... @@ -27,19 +27,5 @@ class EnableCrossRequestMiddleware
exit;
}
return $response;
// 指定允许其他域名访问
// $http_origin = "*";
// if(isset($_SERVER['HTTP_ORIGIN'])){
// $http_origin = $_SERVER['HTTP_ORIGIN'];
// }
// header("Access-Control-Allow-Origin:".$http_origin);
// header('Access-Control-Allow-Methods:POST,GET'); //支持的http 动作
// header('Access-Control-Allow-Credentials: true');
// header('Access-Control-Max-Age: 1000');
// header('Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Authorization, token'); //响应头 请按照自己需求添加。
// if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {
// exit;
// }
// return $next($request);
}
}
... ...
... ... @@ -45,6 +45,7 @@ class BTemplate extends Base
* 其他相关定义
*/
const IS_LIST = 1;//列表页
const IS_DETAIL = 0;//详情页
const IS_HEADER = 1;//独立头部底部
const IS_NO_HEADER = 0;//非独立头部底部
const IS_CUSTOM = 1;//为扩展模块
... ... @@ -131,7 +132,7 @@ class BTemplate extends Base
* @method :post
* @time :2023/12/29 10:57
*/
public function typeMap()
public function sourceMap()
{
return [
'SOURCE_HOME'=>self::SOURCE_HOME,
... ...
... ... @@ -119,16 +119,17 @@ class ProjectServer extends BaseService
* @method :post
* @time :2023/12/29 9:34
*/
public function initModule($project_id){
$moduleModel = new CustomModule();
$info = $moduleModel->read(['route'=>'video']);
if($info === false){
public static function initModule($project_id){
$info = DB::connection('custom_mysql')->table('gl_custom_module')->first();
if(empty($info)){
$data = [
'name'=>'视频模块',
'project_id'=>$project_id,
'route'=>'video',
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
];
$moduleModel->add($data);
DB::connection('custom_mysql')->table('gl_custom_module')->insert($data);
}
return true;
}
... ...
... ... @@ -317,6 +317,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate');
Route::any('/getDetailInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getDetailInfo'])->name('template_getDetailInfo');
Route::any('/saveDetail', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'saveDetail'])->name('template_saveDetail');
Route::any('/getSource', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getSource'])->name('template_getSource');
// 模板
Route::prefix('module')->group(function () {
//获取所有左侧模版
... ...