作者 刘锟

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

@@ -73,7 +73,7 @@ class Count extends Command @@ -73,7 +73,7 @@ class Count extends Command
73 $arr['ip_num'] = $this->ip_num($yesterday,$v['test_domain']); 73 $arr['ip_num'] = $this->ip_num($yesterday,$v['test_domain']);
74 DB::disconnect('custom_mysql'); 74 DB::disconnect('custom_mysql');
75 //服务达标天数 75 //服务达标天数
76 - $arr['compliance_day'] = $this->compliance_day($v['id']); 76 + $arr['compliance_day'] = $v['finish_remain_day'];
77 //剩余服务时常 77 //剩余服务时常
78 $arr['service_day'] = $v['remain_day']; 78 $arr['service_day'] = $v['remain_day'];
79 //项目id 79 //项目id
@@ -164,24 +164,6 @@ class Count extends Command @@ -164,24 +164,6 @@ class Count extends Command
164 } 164 }
165 165
166 /** 166 /**
167 - * @param $yesterday  
168 - * @name :(服务达标天数)compliance_day  
169 - * @author :lyh  
170 - * @method :post  
171 - * @time :2023/6/14 15:48  
172 - */  
173 - public function compliance_day($project_id){  
174 - //服务达标天数  
175 - $rank_info = DB::table('gl_rank_data')->where(['project_id'=>$project_id,'lang'=>''])->select(['compliance_day'])->first();  
176 - if(empty($rank_info)){  
177 - $compliance_day = 0;  
178 - }else{  
179 - $compliance_day = $rank_info->compliance_day;  
180 - }  
181 - return $compliance_day;  
182 - }  
183 -  
184 - /**  
185 * @name :(查询参数设置)selectParam 167 * @name :(查询参数设置)selectParam
186 * @author :lyh 168 * @author :lyh
187 * @method :post 169 * @method :post
@@ -193,6 +175,7 @@ class Count extends Command @@ -193,6 +175,7 @@ class Count extends Command
193 'gl_project.type AS type', 175 'gl_project.type AS type',
194 'gl_project.extend_type AS extend_type', 176 'gl_project.extend_type AS extend_type',
195 'gl_project.remain_day AS remain_day', 177 'gl_project.remain_day AS remain_day',
  178 + 'gl_project.finish_remain_day AS finish_remain_day',
196 'gl_project_deploy_build.test_domain AS test_domain', 179 'gl_project_deploy_build.test_domain AS test_domain',
197 'gl_project_deploy_optimize.domain AS domain', 180 'gl_project_deploy_optimize.domain AS domain',
198 'gl_project_deploy_build.project_id AS project_id', 181 'gl_project_deploy_build.project_id AS project_id',
@@ -49,13 +49,19 @@ class DomainInfo extends Command @@ -49,13 +49,19 @@ class DomainInfo extends Command
49 } 49 }
50 $ssl = $this->updateDomainSsl($v['domain']); 50 $ssl = $this->updateDomainSsl($v['domain']);
51 $time = $this->updateDomain($v['domain']); 51 $time = $this->updateDomain($v['domain']);
52 - $data = [  
53 - 'certificate_start_time'=>$ssl['from'],  
54 - 'certificate_end_time'=>$ssl['to'],  
55 - 'domain_start_time'=>$time['start'],  
56 - 'domain_end_time'=>$time['end']  
57 - ];  
58 - 52 + if(!empty($time['start']) && !!empty($time['end'])){
  53 + $data = [
  54 + 'certificate_start_time'=>$ssl['from'],
  55 + 'certificate_end_time'=>$ssl['to'],
  56 + 'domain_start_time'=>$time['start'],
  57 + 'domain_end_time'=>$time['end']
  58 + ];
  59 + }else{
  60 + $data = [
  61 + 'domain_start_time'=>$time['start'],
  62 + 'domain_end_time'=>$time['end']
  63 + ];
  64 + }
59 $domainModel->edit($data,['id'=>$v['id']]); 65 $domainModel->edit($data,['id'=>$v['id']]);
60 } 66 }
61 return 1; 67 return 1;
@@ -169,8 +175,8 @@ class DomainInfo extends Command @@ -169,8 +175,8 @@ class DomainInfo extends Command
169 $valid_to = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validTo_time_t']); 175 $valid_to = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validTo_time_t']);
170 fclose($stream); 176 fclose($stream);
171 }catch (\Exception $e){ 177 }catch (\Exception $e){
172 - $valid_from = date('Y-m-d H:i:s');  
173 - $valid_to = date('Y-m-d H:i:s'); 178 + $valid_from = '';
  179 + $valid_to = '';
174 } 180 }
175 return ['from'=>$valid_from,'to'=>$valid_to]; 181 return ['from'=>$valid_from,'to'=>$valid_to];
176 } 182 }
@@ -67,7 +67,6 @@ class InitProject extends Command @@ -67,7 +67,6 @@ class InitProject extends Command
67 if(!empty($project['serve_id'])){ 67 if(!empty($project['serve_id'])){
68 $project_logic->updateServe($project['serve_id']); 68 $project_logic->updateServe($project['serve_id']);
69 } 69 }
70 -  
71 $item->status = NoticeLog::STATUS_SUCCESS; 70 $item->status = NoticeLog::STATUS_SUCCESS;
72 $item->save(); 71 $item->save();
73 echo 'success:' . $item['id'] . PHP_EOL; 72 echo 'success:' . $item['id'] . PHP_EOL;
@@ -124,27 +124,4 @@ class BaseController extends Controller @@ -124,27 +124,4 @@ class BaseController extends Controller
124 $response = response($result,$result_code,$this->header); 124 $response = response($result,$result_code,$this->header);
125 throw new HttpResponseException($response); 125 throw new HttpResponseException($response);
126 } 126 }
127 -  
128 - /**  
129 - * @remark :返回json  
130 - * @name :success  
131 - * @author :lyh  
132 - * @method :post  
133 - * @time :2023/8/28 10:18  
134 - */  
135 - function success(array $data = [], string $code = Code::SUCCESS, bool $objectData = false): JsonResponse  
136 - {  
137 - if ($objectData) {  
138 - $data = (object)$data;  
139 - }  
140 - $code = Code::fromValue($code);  
141 - $response = [  
142 - 'code' => $code->value,  
143 - 'data' => $data,  
144 - 'message' => $code->description,  
145 - ];  
146 - $this->header['token'] = $this->token;  
147 - return response()->json($response,200,$this->header);  
148 - }  
149 -  
150 } 127 }
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Http\Controllers\Aside\Collect; 3 namespace App\Http\Controllers\Aside\Collect;
4 4
  5 +use App\Enums\Common\Code;
5 use App\Http\Controllers\Aside\BaseController; 6 use App\Http\Controllers\Aside\BaseController;
6 use App\Http\Logic\Aside\CollectLogic; 7 use App\Http\Logic\Aside\CollectLogic;
7 8
@@ -22,6 +23,6 @@ class CollectController extends BaseController @@ -22,6 +23,6 @@ class CollectController extends BaseController
22 public function index(CollectLogic $collectLogic) 23 public function index(CollectLogic $collectLogic)
23 { 24 {
24 $data = $collectLogic->collect_data(); 25 $data = $collectLogic->collect_data();
25 - return $this->success($data); 26 + $this->response('success',Code::SUCCESS,$data);
26 } 27 }
27 } 28 }
@@ -7,6 +7,8 @@ use App\Exceptions\BsideGlobalException; @@ -7,6 +7,8 @@ use App\Exceptions\BsideGlobalException;
7 use App\Helper\Common; 7 use App\Helper\Common;
8 use App\Http\Controllers\Controller; 8 use App\Http\Controllers\Controller;
9 use App\Http\Requests\Scene; 9 use App\Http\Requests\Scene;
  10 +use App\Models\Template\BTemplate;
  11 +use App\Models\Template\Setting;
10 use Illuminate\Http\JsonResponse; 12 use Illuminate\Http\JsonResponse;
11 use Illuminate\Http\Request; 13 use Illuminate\Http\Request;
12 use Illuminate\Http\Exceptions\HttpResponseException; 14 use Illuminate\Http\Exceptions\HttpResponseException;
@@ -127,7 +129,7 @@ class BaseController extends Controller @@ -127,7 +129,7 @@ class BaseController extends Controller
127 * @param bool $objectData 129 * @param bool $objectData
128 * @return JsonResponse 130 * @return JsonResponse
129 */ 131 */
130 - function success($data) :array 132 + function success($data)
131 { 133 {
132 return $data; 134 return $data;
133 } 135 }
@@ -170,4 +172,85 @@ class BaseController extends Controller @@ -170,4 +172,85 @@ class BaseController extends Controller
170 return \Illuminate\Support\Facades\Request::isMethod('post'); 172 return \Illuminate\Support\Facades\Request::isMethod('post');
171 } 173 }
172 174
  175 +
  176 + /**
  177 + * @remark :获取当前用户选择的模版
  178 + * @name :getTemplateId
  179 + * @author :lyh
  180 + * @method :post
  181 + * @time :2024/1/3 10:52
  182 + */
  183 + public function getTemplateId($source,$is_list){
  184 + $template_id = 0;
  185 + if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION) {//定制项目
  186 + $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
  187 + //查看当前页面是否定制,是否开启可视化
  188 + $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
  189 + if (in_array($type, $page_array)) {//是定制界面
  190 + return $this->success($template_id);
  191 + }
  192 + }
  193 + $bSettingModel = new Setting();
  194 + $info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
  195 + if($info === false){
  196 + return $this->success($template_id);
  197 + }
  198 + $template_id = $info['template_id'];
  199 + return $this->success($template_id);
  200 + }
  201 +
  202 + /**
  203 + * @remark :定制页面头部类型---根据source获取type类型
  204 + * @name :getType
  205 + * @author :lyh
  206 + * @method :post
  207 + * @time :2023/11/16 11:20
  208 + */
  209 + public function getCustomizedType($source,$is_list){
  210 + $type = BTemplate::TYPE_HOME;
  211 + if($source == BTemplate::SOURCE_PRODUCT){
  212 + if($is_list == BTemplate::IS_LIST){
  213 + $type = BTemplate::TYPE_PRODUCT_LIST;
  214 + }else{
  215 + $type = BTemplate::TYPE_PRODUCT_DETAIL;
  216 + }
  217 + }
  218 + if($source == BTemplate::SOURCE_BLOG){
  219 + if($is_list == BTemplate::IS_LIST){
  220 + $type = BTemplate::TYPE_BLOG_LIST;
  221 + }else{
  222 + $type = BTemplate::TYPE_BLOG_DETAIL;
  223 + }
  224 + }
  225 + if($source == BTemplate::SOURCE_NEWS){
  226 + if($is_list == BTemplate::IS_LIST){
  227 + $type = BTemplate::TYPE_NEWS_LIST;
  228 + }else{
  229 + $type = BTemplate::TYPE_NEWS_DETAIL;
  230 + }
  231 + }
  232 + return $type;
  233 + }
  234 + /**
  235 + * @remark :查看是否已装修
  236 + * @name :getIsRenovation
  237 + * @author :lyh
  238 + * @method :post
  239 + * @time :2023/9/13 14:02
  240 + */
  241 + public function getIsRenovation($source,$is_list,$template_id,$id){
  242 + $webTemplateModel = new BTemplate();
  243 + $param = [
  244 + 'source'=>$source,
  245 + 'project_id'=>$this->user['project_id'],
  246 + 'source_id'=>$id,
  247 + 'template_id'=>$template_id,
  248 + 'is_list'=>$is_list
  249 + ];
  250 + $templateInfo = $webTemplateModel->read($param);
  251 + if($templateInfo !== false){
  252 + return 1;
  253 + }
  254 + return 0;
  255 + }
173 } 256 }
@@ -9,6 +9,7 @@ use App\Http\Requests\Bside\Blog\BlogCategoryRequest; @@ -9,6 +9,7 @@ use App\Http\Requests\Bside\Blog\BlogCategoryRequest;
9 use App\Models\Blog\Blog as BlogModel; 9 use App\Models\Blog\Blog as BlogModel;
10 use App\Models\Blog\BlogCategory as BlogCategoryModel; 10 use App\Models\Blog\BlogCategory as BlogCategoryModel;
11 use App\Models\RouteMap\RouteMap; 11 use App\Models\RouteMap\RouteMap;
  12 +use App\Models\Template\BTemplate;
12 13
13 class BlogCategoryController extends BaseController 14 class BlogCategoryController extends BaseController
14 { 15 {
@@ -25,9 +26,11 @@ class BlogCategoryController extends BaseController @@ -25,9 +26,11 @@ class BlogCategoryController extends BaseController
25 $data = []; 26 $data = [];
26 if(!empty($lists)){ 27 if(!empty($lists)){
27 $blogModel = new BlogModel(); 28 $blogModel = new BlogModel();
  29 + $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST);
28 foreach ($lists as $k => $v){ 30 foreach ($lists as $k => $v){
29 $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); 31 $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
30 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id']); 32 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id']);
  33 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST,$template_id,$v['id']);
31 $lists[$k] = $v; 34 $lists[$k] = $v;
32 } 35 }
33 if(!isset($this->map['name'])){ 36 if(!isset($this->map['name'])){
@@ -32,18 +32,15 @@ class BlogController extends BaseController @@ -32,18 +32,15 @@ class BlogController extends BaseController
32 $lists = $query->select($filed)->paginate($this->row, ['*'], 'page', $this->page); 32 $lists = $query->select($filed)->paginate($this->row, ['*'], 'page', $this->page);
33 if(!empty($lists)){ 33 if(!empty($lists)){
34 $lists = $lists->toArray(); 34 $lists = $lists->toArray();
35 -// //获取当前项目的所有分类  
36 $data = $this->getCategoryList(); 35 $data = $this->getCategoryList();
37 - //获取当前用户选择的模版  
38 - $templateSettingModel = new Setting();  
39 - $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]); 36 + $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL);
40 $user = new User(); 37 $user = new User();
41 foreach ($lists['list'] as $k => $v){ 38 foreach ($lists['list'] as $k => $v){
42 $v['category_name'] = $this->categoryName($v['category_id'],$data); 39 $v['category_name'] = $this->categoryName($v['category_id'],$data);
43 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']); 40 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']);
44 $v['image_link'] = getImageUrl($v['image']); 41 $v['image_link'] = getImageUrl($v['image']);
45 $v['operator_name'] = $user->getName($v['operator_id']); 42 $v['operator_name'] = $user->getName($v['operator_id']);
46 - $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']); 43 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL,$template_id,$v['id']);
47 $lists['list'][$k] = $v; 44 $lists['list'][$k] = $v;
48 } 45 }
49 } 46 }
@@ -51,31 +48,6 @@ class BlogController extends BaseController @@ -51,31 +48,6 @@ class BlogController extends BaseController
51 } 48 }
52 49
53 /** 50 /**
54 - * @remark :查看产品是否已装修  
55 - * @name :getProductIsRenovation  
56 - * @author :lyh  
57 - * @method :post  
58 - * @time :2023/9/13 14:02  
59 - */  
60 - public function getProductIsRenovation($info,$id){  
61 - if($info !== false){  
62 - $webTemplateModel = new BTemplate();  
63 - $param = [  
64 - 'source'=>BTemplate::SOURCE_BLOG,  
65 - 'project_id'=>$this->user['project_id'],  
66 - 'source_id'=>$id,  
67 - 'template_id'=>$info['template_id'],  
68 - 'is_list'=>0  
69 - ];  
70 - $templateInfo = $webTemplateModel->read($param);  
71 - if($templateInfo !== false){  
72 - return 1;  
73 - }  
74 - }  
75 - return 0;  
76 - }  
77 -  
78 - /**  
79 * @remark :处理列表返回参数 51 * @remark :处理列表返回参数
80 * @name :handleReturnParam 52 * @name :handleReturnParam
81 * @author :lyh 53 * @author :lyh
@@ -9,6 +9,7 @@ use App\Http\Requests\Bside\News\NewsCategoryRequest; @@ -9,6 +9,7 @@ use App\Http\Requests\Bside\News\NewsCategoryRequest;
9 use App\Models\News\News as NewsModel; 9 use App\Models\News\News as NewsModel;
10 use App\Models\News\NewsCategory as NewsCategoryModel; 10 use App\Models\News\NewsCategory as NewsCategoryModel;
11 use App\Models\RouteMap\RouteMap; 11 use App\Models\RouteMap\RouteMap;
  12 +use App\Models\Template\BTemplate;
12 13
13 class NewsCategoryController extends BaseController 14 class NewsCategoryController extends BaseController
14 { 15 {
@@ -25,9 +26,11 @@ class NewsCategoryController extends BaseController @@ -25,9 +26,11 @@ class NewsCategoryController extends BaseController
25 $data = []; 26 $data = [];
26 if(!empty($lists)){ 27 if(!empty($lists)){
27 $newsModel = new NewsModel(); 28 $newsModel = new NewsModel();
  29 + $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST);
28 foreach ($lists as $k => $v){ 30 foreach ($lists as $k => $v){
29 $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); 31 $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
30 $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id']); 32 $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id']);
  33 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_LIST,$template_id,$v['id']);
31 $lists[$k] = $v; 34 $lists[$k] = $v;
32 } 35 }
33 if(!isset($this->map['name'])){ 36 if(!isset($this->map['name'])){
@@ -36,15 +36,14 @@ class NewsController extends BaseController @@ -36,15 +36,14 @@ class NewsController extends BaseController
36 // //获取当前项目的所有分类 36 // //获取当前项目的所有分类
37 $data = $this->getCategoryList(); 37 $data = $this->getCategoryList();
38 //获取当前用户选择的模版 38 //获取当前用户选择的模版
39 - $templateSettingModel = new Setting();  
40 - $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]); 39 + $template_id = $this->getTemplateId(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL);//获取模版id
41 $user = new User(); 40 $user = new User();
42 foreach ($lists['list'] as $k => $v){ 41 foreach ($lists['list'] as $k => $v){
43 $v['category_name'] = $this->categoryName($v['category_id'],$data); 42 $v['category_name'] = $this->categoryName($v['category_id'],$data);
44 $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']); 43 $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']);
45 $v['image_link'] = getImageUrl($v['image']); 44 $v['image_link'] = getImageUrl($v['image']);
46 $v['operator_name'] = $user->getName($v['operator_id']); 45 $v['operator_name'] = $user->getName($v['operator_id']);
47 - $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']); 46 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL,$template_id,$v['id']);
48 $lists['list'][$k] = $v; 47 $lists['list'][$k] = $v;
49 } 48 }
50 } 49 }
@@ -52,31 +51,6 @@ class NewsController extends BaseController @@ -52,31 +51,6 @@ class NewsController extends BaseController
52 } 51 }
53 52
54 /** 53 /**
55 - * @remark :查看产品是否已装修  
56 - * @name :getProductIsRenovation  
57 - * @author :lyh  
58 - * @method :post  
59 - * @time :2023/9/13 14:02  
60 - */  
61 - public function getProductIsRenovation($info,$id){  
62 - if($info !== false){  
63 - $webTemplateModel = new BTemplate();  
64 - $param = [  
65 - 'source'=>4,  
66 - 'project_id'=>$this->user['project_id'],  
67 - 'source_id'=>$id,  
68 - 'template_id'=>$info['template_id'],  
69 - 'is_list'=>0  
70 - ];  
71 - $templateInfo = $webTemplateModel->read($param);  
72 - if($templateInfo !== false){  
73 - return 1;  
74 - }  
75 - }  
76 - return 0;  
77 - }  
78 -  
79 - /**  
80 * @remark :处理列表返回参数 54 * @remark :处理列表返回参数
81 * @name :handleReturnParam 55 * @name :handleReturnParam
82 * @author :lyh 56 * @author :lyh
@@ -10,6 +10,7 @@ use App\Models\Product\Category; @@ -10,6 +10,7 @@ use App\Models\Product\Category;
10 use App\Models\Product\CategoryRelated; 10 use App\Models\Product\CategoryRelated;
11 use App\Models\Product\Product; 11 use App\Models\Product\Product;
12 use App\Models\RouteMap\RouteMap; 12 use App\Models\RouteMap\RouteMap;
  13 +use App\Models\Template\BTemplate;
13 use App\Rules\Ids; 14 use App\Rules\Ids;
14 use Illuminate\Http\Request; 15 use Illuminate\Http\Request;
15 16
@@ -36,10 +37,12 @@ class CategoryController extends BaseController @@ -36,10 +37,12 @@ class CategoryController extends BaseController
36 $list = $category->list($this->map,['sort','id'],$filed); 37 $list = $category->list($this->map,['sort','id'],$filed);
37 $data = []; 38 $data = [];
38 if(!empty($list)){ 39 if(!empty($list)){
  40 + $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id
39 foreach ($list as $k =>$v){ 41 foreach ($list as $k =>$v){
40 $v['url'] = $this->user['domain'] . $v['route'].'/'; 42 $v['url'] = $this->user['domain'] . $v['route'].'/';
41 $v['product_num'] = Category::getProductNum($v['id']); 43 $v['product_num'] = Category::getProductNum($v['id']);
42 $v['image_link'] = getImageUrl($v['image']); 44 $v['image_link'] = getImageUrl($v['image']);
  45 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
43 $list[$k] = $v; 46 $list[$k] = $v;
44 } 47 }
45 if(!isset($this->map['title'])){ 48 if(!isset($this->map['title'])){
@@ -7,6 +7,7 @@ use App\Exceptions\BsideGlobalException; @@ -7,6 +7,7 @@ use App\Exceptions\BsideGlobalException;
7 use App\Helper\Arr; 7 use App\Helper\Arr;
8 use App\Helper\Common; 8 use App\Helper\Common;
9 use App\Http\Controllers\Bside\BaseController; 9 use App\Http\Controllers\Bside\BaseController;
  10 +use App\Http\Logic\Bside\BTemplate\BTemplateLogic;
10 use App\Http\Logic\Bside\Product\ProductLogic; 11 use App\Http\Logic\Bside\Product\ProductLogic;
11 use App\Http\Requests\Bside\Product\ProductRequest; 12 use App\Http\Requests\Bside\Product\ProductRequest;
12 use App\Models\Product\Category; 13 use App\Models\Product\Category;
@@ -52,15 +53,13 @@ class ProductController extends BaseController @@ -52,15 +53,13 @@ class ProductController extends BaseController
52 $lists = $lists->toArray(); 53 $lists = $lists->toArray();
53 $cate_data = $this->getCategoryList();//分类 54 $cate_data = $this->getCategoryList();//分类
54 $key_data = $this->getKeywordsList();//关键字 55 $key_data = $this->getKeywordsList();//关键字
55 - //获取当前用户选择的模版  
56 - $templateSettingModel = new Setting();  
57 - $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]); 56 + $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
58 $userModel = new User(); 57 $userModel = new User();
59 foreach ($lists['list'] as $k=>$v){ 58 foreach ($lists['list'] as $k=>$v){
60 $v['category_id_text'] = $this->categoryName($v['category_id'],$cate_data); 59 $v['category_id_text'] = $this->categoryName($v['category_id'],$cate_data);
61 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); 60 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
62 $v['created_uid_text'] = $userModel->getName($v['created_uid']); 61 $v['created_uid_text'] = $userModel->getName($v['created_uid']);
63 - $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']); 62 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
64 $v['url'] = $this->user['domain'].$v['route'].'/'; 63 $v['url'] = $this->user['domain'].$v['route'].'/';
65 $lists['list'][$k] = $v; 64 $lists['list'][$k] = $v;
66 } 65 }
@@ -119,31 +118,6 @@ class ProductController extends BaseController @@ -119,31 +118,6 @@ class ProductController extends BaseController
119 } 118 }
120 119
121 /** 120 /**
122 - * @remark :查看产品是否已装修  
123 - * @name :getProductIsRenovation  
124 - * @author :lyh  
125 - * @method :post  
126 - * @time :2023/9/13 14:02  
127 - */  
128 - public function getProductIsRenovation($info,$id){  
129 - if($info !== false){  
130 - $webTemplateModel = new BTemplate();  
131 - $param = [  
132 - 'source'=>2,  
133 - 'project_id'=>$this->user['project_id'],  
134 - 'source_id'=>$id,  
135 - 'template_id'=>$info['template_id'],  
136 - 'is_list'=>0  
137 - ];  
138 - $templateInfo = $webTemplateModel->read($param);  
139 - if($templateInfo !== false){  
140 - return 1;  
141 - }  
142 - }  
143 - return 0;  
144 - }  
145 -  
146 - /**  
147 * @remark :获取所有分类 121 * @remark :获取所有分类
148 * @name :getCategoryList 122 * @name :getCategoryList
149 * @author :lyh 123 * @author :lyh
@@ -266,9 +240,8 @@ class ProductController extends BaseController @@ -266,9 +240,8 @@ class ProductController extends BaseController
266 } 240 }
267 $v['status_text'] = Product::statusMap()[$v['status']] ?? ''; 241 $v['status_text'] = Product::statusMap()[$v['status']] ?? '';
268 //获取当前用户选择的模版 242 //获取当前用户选择的模版
269 - $templateSettingModel = new Setting();  
270 - $templateInfo = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);  
271 - $v['is_renovation'] = $this->getProductIsRenovation($templateInfo,$v['id']); 243 + $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);
  244 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
272 $v['url'] = $this->user['domain'].$v['route']; 245 $v['url'] = $this->user['domain'].$v['route'];
273 //获取当前数据扩展字段及值 246 //获取当前数据扩展字段及值
274 $v['extend'] = $this->getExtendInfo($v['id']); 247 $v['extend'] = $this->getExtendInfo($v['id']);
@@ -48,7 +48,7 @@ class ProjectAssociationController extends BaseController @@ -48,7 +48,7 @@ class ProjectAssociationController extends BaseController
48 $image = request()->post('image', ''); 48 $image = request()->post('image', '');
49 $data = compact('project_id', 'user_id', 'friend_id', 'nickname', 'user_name', 'image'); 49 $data = compact('project_id', 'user_id', 'friend_id', 'nickname', 'user_name', 'image');
50 $this->ProjectAssociationLogic->saveWeChatData($data); 50 $this->ProjectAssociationLogic->saveWeChatData($data);
51 - $this->response('success'); 51 + $this->response('绑定成功');
52 } 52 }
53 53
54 /** 54 /**
@@ -67,18 +67,25 @@ class ProjectAssociationController extends BaseController @@ -67,18 +67,25 @@ class ProjectAssociationController extends BaseController
67 $isRes = $this->ProjectAssociationLogic->normal($project_id); 67 $isRes = $this->ProjectAssociationLogic->normal($project_id);
68 // 当数据不存在时并开启状态,自动添加一条数据 68 // 当数据不存在时并开启状态,自动添加一条数据
69 if (is_null($isRes) && (!is_null($status) && $status)) { 69 if (is_null($isRes) && (!is_null($status) && $status)) {
70 - $bool = $this->ProjectAssociationLogic->saveProject($project_id, $status);  
71 - if (empty($bool)) { 70 + $isRes = $this->ProjectAssociationLogic->saveProject($project_id, $status);
  71 + if (is_null($isRes)) {
72 // 保存数据失败 72 // 保存数据失败
73 - $this->response('error', Code::SERVER_ERROR); 73 + $this->response('绑定AICC数据失败!', Code::SERVER_ERROR);
74 } 74 }
75 } // 关闭状态 75 } // 关闭状态
76 elseif (!is_null($isRes) && (!is_null($status) && empty($status))) { 76 elseif (!is_null($isRes) && (!is_null($status) && empty($status))) {
77 - $res = $this->ProjectAssociationLogic->closedState($isRes, $status);  
78 - $this->response($res['message'], $res['code']);  
79 - } elseif (is_null($isRes)) { 77 + $bool = $this->ProjectAssociationLogic->closedState($isRes, $status);
  78 + if ($bool) {
  79 + // 关闭aicc绑定成功
  80 + $this->response('关闭aicc绑定 - 成功!');
  81 + }else{
  82 + // 关闭aicc绑定失败
  83 + $this->response('关闭aicc绑定 - 失败!');
  84 + }
  85 + }
  86 + if (is_null($isRes)) {
80 // 请开启AICC绑定 87 // 请开启AICC绑定
81 - $this->response('error', Code::SERVER_ERROR); 88 + $this->response('success', Code::SERVER_ERROR);
82 } 89 }
83 $cache = isset($cache); 90 $cache = isset($cache);
84 $result = $this->ProjectAssociationLogic->getAiccWechatLists($isRes, $cache); 91 $result = $this->ProjectAssociationLogic->getAiccWechatLists($isRes, $cache);
@@ -7,9 +7,7 @@ use App\Http\Controllers\Bside\BaseController; @@ -7,9 +7,7 @@ use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\BTemplate\BTemplateLogic; 7 use App\Http\Logic\Bside\BTemplate\BTemplateLogic;
8 use App\Http\Requests\Bside\Template\TemplateRequest; 8 use App\Http\Requests\Bside\Template\TemplateRequest;
9 use App\Models\Template\BTemplate; 9 use App\Models\Template\BTemplate;
10 -use App\Models\Template\BTemplateMain;  
11 use App\Models\Template\Setting; 10 use App\Models\Template\Setting;
12 -use App\Models\Template\Template;  
13 11
14 class BTemplateController extends BaseController 12 class BTemplateController extends BaseController
15 { 13 {
@@ -160,4 +158,16 @@ class BTemplateController extends BaseController @@ -160,4 +158,16 @@ class BTemplateController extends BaseController
160 $this->response('模板保存成功'); 158 $this->response('模板保存成功');
161 } 159 }
162 160
  161 + /**
  162 + * @remark :获取source类型
  163 + * @name :getSource
  164 + * @author :lyh
  165 + * @method :post
  166 + * @time :2024/1/3 9:06
  167 + */
  168 + public function getSource(){
  169 + $bTemplateModel = new BTemplate();
  170 + $info = $bTemplateModel->sourceMap();
  171 + $this->response('success',Code::SUCCESS,$info);
  172 + }
163 } 173 }
@@ -150,6 +150,7 @@ class DomainInfoLogic extends BaseLogic @@ -150,6 +150,7 @@ class DomainInfoLogic extends BaseLogic
150 */ 150 */
151 public function setDomainSsl($initDomain,$domain,$rewrite,$other_domain) 151 public function setDomainSsl($initDomain,$domain,$rewrite,$other_domain)
152 { 152 {
  153 + $this->fail('当前功能,占时无法使用,如有紧急需要上线项目,请联系管理人员');
153 if($this->param['type'] == 2){ 154 if($this->param['type'] == 2){
154 if(empty($this->param['key'])){ 155 if(empty($this->param['key'])){
155 $this->fail('证书KEY值不能为空'); 156 $this->fail('证书KEY值不能为空');
@@ -418,8 +418,8 @@ class ProjectLogic extends BaseLogic @@ -418,8 +418,8 @@ class ProjectLogic extends BaseLogic
418 'role_menu'=>implode(',',$ids), 418 'role_menu'=>implode(',',$ids),
419 'project_id'=>$project_id, 419 'project_id'=>$project_id,
420 'type'=>1, 420 'type'=>1,
421 - 'operator_id'=>$this->manager['id'],  
422 - 'create_id'=>$this->manager['id'], 421 + 'operator_id'=>0,
  422 + 'create_id'=>0,
423 ]; 423 ];
424 $roleModel->add($data); 424 $roleModel->add($data);
425 } 425 }
@@ -52,7 +52,7 @@ class ProjectAssociationLogic extends Logic @@ -52,7 +52,7 @@ class ProjectAssociationLogic extends Logic
52 * 初始化数据/修改数据 52 * 初始化数据/修改数据
53 * @param int $project_id 53 * @param int $project_id
54 * @param int $status 54 * @param int $status
55 - * @return bool 55 + * @return Builder|Model|object|ProjectAssociation|null
56 */ 56 */
57 public function saveProject($project_id, $status) 57 public function saveProject($project_id, $status)
58 { 58 {
@@ -66,12 +66,12 @@ class ProjectAssociationLogic extends Logic @@ -66,12 +66,12 @@ class ProjectAssociationLogic extends Logic
66 $isRes->user_id = (int)env('AICC_WECHAT_USER_ID'); 66 $isRes->user_id = (int)env('AICC_WECHAT_USER_ID');
67 $isRes->status = $status; 67 $isRes->status = $status;
68 try { 68 try {
69 - $bool = $isRes->save(); 69 + $isRes->save();
70 DB::commit(); 70 DB::commit();
71 } catch (\Exception $exception) { 71 } catch (\Exception $exception) {
72 DB::rollBack(); 72 DB::rollBack();
73 } 73 }
74 - return $bool; 74 + return $isRes;
75 } 75 }
76 76
77 /** 77 /**
@@ -104,27 +104,19 @@ class ProjectAssociationLogic extends Logic @@ -104,27 +104,19 @@ class ProjectAssociationLogic extends Logic
104 * 关闭状态 104 * 关闭状态
105 * @param ProjectAssociation $res 105 * @param ProjectAssociation $res
106 * @param int $status 1 - 正常, 0 - 禁用 106 * @param int $status 1 - 正常, 0 - 禁用
107 - * @return array 107 + * @return bool
108 */ 108 */
109 public function closedState($res, $status) 109 public function closedState($res, $status)
110 { 110 {
111 DB::beginTransaction(); 111 DB::beginTransaction();
  112 + $bool = false;
112 try { 113 try {
113 $res->status = $status; 114 $res->status = $status;
114 - $res->save(); 115 + $bool = $res->save();
115 DB::commit(); 116 DB::commit();
116 - $code = Code::SUCCESS;  
117 - $message = '关闭AICC绑定成功!';  
118 } catch (\Exception $exception) { 117 } catch (\Exception $exception) {
119 DB::rollBack(); 118 DB::rollBack();
120 - // 数据错误,请重试  
121 - $code = Code::SERVER_ERROR;  
122 - $message = 'error';  
123 } 119 }
124 - return [  
125 - 'code' => $code,  
126 - 'data' => [],  
127 - 'message' => $message,  
128 - ]; 120 + return $bool;
129 } 121 }
130 } 122 }
@@ -41,6 +41,11 @@ class CountLogic extends BaseLogic @@ -41,6 +41,11 @@ class CountLogic extends BaseLogic
41 $info = $this->model->read(['project_id' => $this->user['project_id']], 41 $info = $this->model->read(['project_id' => $this->user['project_id']],
42 ['pv_num','ip_num','inquiry_num','date','compliance_day','service_day','country']); 42 ['pv_num','ip_num','inquiry_num','date','compliance_day','service_day','country']);
43 } 43 }
  44 + //获取项目的剩余时长
  45 + $projectModel = new Project();
  46 + $projectInfo = $projectModel->read(['id'=>$this->user['project_id']],['remain_day','finish_remain_day']);
  47 + $info['service_day'] = $projectInfo['remain_day'];
  48 + $info['compliance_day'] = $projectInfo['finish_remain_day'];
44 return $this->success($info); 49 return $this->success($info);
45 } 50 }
46 51
@@ -83,7 +88,7 @@ class CountLogic extends BaseLogic @@ -83,7 +88,7 @@ class CountLogic extends BaseLogic
83 * @time :2023/5/24 14:03 88 * @time :2023/5/24 14:03
84 */ 89 */
85 public function keyword_data_count(){ 90 public function keyword_data_count(){
86 - $yesterday = Carbon::yesterday()->toDateString(); 91 + $yesterday = date('Y-m-d');
87 $rankDataModel = new RankDataModel(); 92 $rankDataModel = new RankDataModel();
88 $param = [ 93 $param = [
89 'updated_date' => $yesterday, 94 'updated_date' => $yesterday,
@@ -27,19 +27,5 @@ class EnableCrossRequestMiddleware @@ -27,19 +27,5 @@ class EnableCrossRequestMiddleware
27 exit; 27 exit;
28 } 28 }
29 return $response; 29 return $response;
30 - // 指定允许其他域名访问  
31 -// $http_origin = "*";  
32 -// if(isset($_SERVER['HTTP_ORIGIN'])){  
33 -// $http_origin = $_SERVER['HTTP_ORIGIN'];  
34 -// }  
35 -// header("Access-Control-Allow-Origin:".$http_origin);  
36 -// header('Access-Control-Allow-Methods:POST,GET'); //支持的http 动作  
37 -// header('Access-Control-Allow-Credentials: true');  
38 -// header('Access-Control-Max-Age: 1000');  
39 -// header('Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Authorization, token'); //响应头 请按照自己需求添加。  
40 -// if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {  
41 -// exit;  
42 -// }  
43 -// return $next($request);  
44 } 30 }
45 } 31 }
@@ -45,6 +45,7 @@ class BTemplate extends Base @@ -45,6 +45,7 @@ class BTemplate extends Base
45 * 其他相关定义 45 * 其他相关定义
46 */ 46 */
47 const IS_LIST = 1;//列表页 47 const IS_LIST = 1;//列表页
  48 + const IS_DETAIL = 0;//详情页
48 const IS_HEADER = 1;//独立头部底部 49 const IS_HEADER = 1;//独立头部底部
49 const IS_NO_HEADER = 0;//非独立头部底部 50 const IS_NO_HEADER = 0;//非独立头部底部
50 const IS_CUSTOM = 1;//为扩展模块 51 const IS_CUSTOM = 1;//为扩展模块
@@ -131,7 +132,7 @@ class BTemplate extends Base @@ -131,7 +132,7 @@ class BTemplate extends Base
131 * @method :post 132 * @method :post
132 * @time :2023/12/29 10:57 133 * @time :2023/12/29 10:57
133 */ 134 */
134 - public function typeMap() 135 + public function sourceMap()
135 { 136 {
136 return [ 137 return [
137 'SOURCE_HOME'=>self::SOURCE_HOME, 138 'SOURCE_HOME'=>self::SOURCE_HOME,
@@ -119,16 +119,17 @@ class ProjectServer extends BaseService @@ -119,16 +119,17 @@ class ProjectServer extends BaseService
119 * @method :post 119 * @method :post
120 * @time :2023/12/29 9:34 120 * @time :2023/12/29 9:34
121 */ 121 */
122 - public function initModule($project_id){  
123 - $moduleModel = new CustomModule();  
124 - $info = $moduleModel->read(['route'=>'video']);  
125 - if($info === false){ 122 + public static function initModule($project_id){
  123 + $info = DB::connection('custom_mysql')->table('gl_custom_module')->first();
  124 + if(empty($info)){
126 $data = [ 125 $data = [
127 'name'=>'视频模块', 126 'name'=>'视频模块',
128 'project_id'=>$project_id, 127 'project_id'=>$project_id,
129 'route'=>'video', 128 'route'=>'video',
  129 + 'created_at' => date('Y-m-d H:i:s'),
  130 + 'updated_at' => date('Y-m-d H:i:s')
130 ]; 131 ];
131 - $moduleModel->add($data); 132 + DB::connection('custom_mysql')->table('gl_custom_module')->insert($data);
132 } 133 }
133 return true; 134 return true;
134 } 135 }
@@ -317,6 +317,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -317,6 +317,7 @@ Route::middleware(['bloginauth'])->group(function () {
317 Route::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate'); 317 Route::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate');
318 Route::any('/getDetailInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getDetailInfo'])->name('template_getDetailInfo'); 318 Route::any('/getDetailInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getDetailInfo'])->name('template_getDetailInfo');
319 Route::any('/saveDetail', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'saveDetail'])->name('template_saveDetail'); 319 Route::any('/saveDetail', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'saveDetail'])->name('template_saveDetail');
  320 + Route::any('/getSource', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getSource'])->name('template_getSource');
320 // 模板 321 // 模板
321 Route::prefix('module')->group(function () { 322 Route::prefix('module')->group(function () {
322 //获取所有左侧模版 323 //获取所有左侧模版