作者 zhl

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

正在显示 79 个修改的文件 包含 1403 行增加563 行删除
@@ -40,7 +40,8 @@ class Count extends Command @@ -40,7 +40,8 @@ class Count extends Command
40 */ 40 */
41 public function handle() 41 public function handle()
42 { 42 {
43 - $list = DB::table('gl_project')->where('gl_project.extend_type','!=',5) 43 + $list = DB::table('gl_project')->where('gl_project.extend_type','=',0)
  44 + ->where('gl_project.type','!=',0)
44 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') 45 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
45 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') 46 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
46 ->select($this->selectParam())->get(); 47 ->select($this->selectParam())->get();
@@ -2,21 +2,9 @@ @@ -2,21 +2,9 @@
2 2
3 namespace App\Console\Commands; 3 namespace App\Console\Commands;
4 4
5 -use App\Helper\Arr;  
6 use App\Helper\FormGlobalsoApi; 5 use App\Helper\FormGlobalsoApi;
7 -use App\Http\Logic\Bside\InquiryLogic;  
8 -use App\Models\Product\Category;  
9 -use App\Models\Product\Product;  
10 -use App\Models\Project\OnlineCheck;  
11 use App\Models\Project\Project; 6 use App\Models\Project\Project;
12 -use App\Models\RankData\RankData as GoogleRankModel;  
13 -use App\Models\RouteMap\RouteMap;  
14 -use GuzzleHttp\Client;  
15 -use GuzzleHttp\Promise\Utils;  
16 use Illuminate\Console\Command; 7 use Illuminate\Console\Command;
17 -use Illuminate\Database\Eloquent\Model;  
18 -use Illuminate\Support\Facades\DB;  
19 -use Illuminate\Support\Str;  
20 8
21 /** 9 /**
22 * 最近一次询盘 10 * 最近一次询盘
@@ -36,7 +36,8 @@ class InquiryMonthlyCount extends Command @@ -36,7 +36,8 @@ class InquiryMonthlyCount extends Command
36 * @time :2023/6/30 9:32 36 * @time :2023/6/30 9:32
37 */ 37 */
38 public function handle(){ 38 public function handle(){
39 - $list = DB::table('gl_project')->where('gl_project.extend_type','!=',5) 39 + $list = DB::table('gl_project')->where('gl_project.extend_type','=',0)
  40 + ->where('gl_project.type','!=',0)
40 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') 41 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
41 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') 42 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
42 ->select($this->selectParam())->get()->toArray(); 43 ->select($this->selectParam())->get()->toArray();
@@ -2,9 +2,8 @@ @@ -2,9 +2,8 @@
2 2
3 namespace App\Console\Commands\RankData; 3 namespace App\Console\Commands\RankData;
4 4
5 -use App\Helper\Arr;  
6 use App\Helper\QuanqiusouApi; 5 use App\Helper\QuanqiusouApi;
7 -use App\Models\Project\DeployBuild; 6 +use App\Http\Logic\Bside\RankData\RankDataLogic;
8 use App\Models\Project\DeployOptimize; 7 use App\Models\Project\DeployOptimize;
9 use App\Models\Project\Project; 8 use App\Models\Project\Project;
10 use App\Models\RankData\RankData as GoogleRankModel; 9 use App\Models\RankData\RankData as GoogleRankModel;
@@ -39,6 +38,9 @@ class RankData extends BaseCommands @@ -39,6 +38,9 @@ class RankData extends BaseCommands
39 */ 38 */
40 public function do() 39 public function do()
41 { 40 {
  41 + //所有项目 今日是否达标 重置
  42 + Project::where('is_remain_today', 1)->update(['is_remain_today' => 0]);
  43 +
42 $error = 0; 44 $error = 0;
43 $api = new QuanqiusouApi(); 45 $api = new QuanqiusouApi();
44 //有排名api编号的项目 46 //有排名api编号的项目
@@ -50,122 +52,14 @@ class RankData extends BaseCommands @@ -50,122 +52,14 @@ class RankData extends BaseCommands
50 return false; 52 return false;
51 } 53 }
52 foreach ($list as $item){ 54 foreach ($list as $item){
53 - $model = GoogleRankModel::where('project_id', $item['project_id'])->where('lang', '')->first();  
54 - if (!$model || $model->updated_date != date('Y-m-d')) {  
55 - $res = $api->getGoogleRank($item['api_no']);  
56 - if(!$res){  
57 - $error++;  
58 - continue;  
59 - }  
60 - //收录数  
61 - $indexed_pages_num = $site_res[$item['api_no']] ?? 0;  
62 - $this->save_rank($item['project_id'], $res, $indexed_pages_num);  
63 - }  
64 - //有小语种的  
65 - $lang_list = $api->getLangList();  
66 - if(!empty($lang_list[$item['api_no']])){  
67 - $model = GoogleRankModel::where('project_id', $item['project_id'])->where('lang', '<>', '')->first();  
68 - if (!$model || $model->updated_date != date('Y-m-d')) {  
69 - $res = $api->getGoogleRank($item['api_no'], 1);  
70 - if(!$res){ 55 + try {
  56 + (new RankDataLogic())->syncRankData($item['api_no'], $site_res);
  57 + }catch (\Exception $e){
  58 + LogUtils::info('rank_data error:' . $e->getMessage());
71 $error++; 59 $error++;
72 continue; 60 continue;
73 } 61 }
74 - $data = [];  
75 - //不同的小语种取出来  
76 - foreach ($res as $keyword => $v){  
77 - $data[Arr::last($v)['lang']][$keyword] = $v;  
78 - }  
79 - foreach ($data as $lang => $rank){  
80 - $this->save_rank($item['project_id'], $rank, 0, $lang);  
81 - }  
82 - }  
83 - }  
84 } 62 }
85 return !$error; 63 return !$error;
86 } 64 }
87 -  
88 - /**  
89 - * @param $project_id  
90 - * @param int $indexed_pages_num  
91 - * @param $data  
92 - * @param string $lang  
93 - * @author zbj  
94 - * @date 2023/5/8  
95 - */  
96 - public function save_rank($project_id, $data, int $indexed_pages_num = 0, string $lang = ''){  
97 - $without_project_ids = []; //不用处理排名的项目  
98 -  
99 - $first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0;  
100 -  
101 - if(!$lang){  
102 - foreach ($data as &$ranks){  
103 - ksort($ranks);  
104 - foreach ($ranks as &$rank){  
105 - //处理排名  
106 - if(!in_array($project_id, $without_project_ids)){  
107 - if($rank['position'] >= 10){  
108 - $rank['position'] -= 5;  
109 - }  
110 - //todo 需要特殊处理排名的项目  
111 - }  
112 - }  
113 - $last = Arr::last($ranks);  
114 - //第一名  
115 - if($last['position'] == 1){  
116 - $first_num ++;  
117 - }  
118 - //排名第一页  
119 - if($last['position'] > 0 && $last['position'] <= 10){  
120 - $first_page_num ++;  
121 - }  
122 - //排名前三页  
123 - if($last['position'] > 0 && $last['position'] <= 30){  
124 - $first_three_pages_num ++;  
125 - }  
126 - //排名前五页  
127 - if($last['position'] > 0 && $last['position'] <= 50){  
128 - $first_five_pages_num ++;  
129 - }  
130 - //排名前十页  
131 - if($last['position'] > 0 && $last['position'] <= 100){  
132 - $first_ten_pages_num ++;  
133 - }  
134 - }  
135 - }  
136 -  
137 - $where = [  
138 - 'project_id' => $project_id,  
139 - 'lang' => $lang  
140 - ];  
141 - $model = GoogleRankModel::where($where)->first();  
142 - if(!$model){  
143 - $model = new GoogleRankModel();  
144 - }  
145 -  
146 - //关键词达标天数  
147 - $model->is_compliance = 0;  
148 - if($model->updated_date != date('Y-m-d')){  
149 - //保证关键词数  
150 - $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');  
151 - $type = Project::where('id', $project_id)->value('type');  
152 - if($keyword_num && $type == 2 && $first_page_num >= $keyword_num){  
153 - $model->compliance_day = $model->compliance_day + 1;  
154 - $model->is_compliance = 1;  
155 - }  
156 - }  
157 -  
158 - $model->project_id = $project_id;  
159 - $model->first_num = $first_num;  
160 - $model->first_page_num = $first_page_num;  
161 - $model->first_three_pages_num = $first_three_pages_num;  
162 - $model->first_five_pages_num = $first_five_pages_num;  
163 - $model->first_ten_pages_num = $first_ten_pages_num;  
164 - $model->indexed_pages_num = $indexed_pages_num;  
165 - $model->lang = $lang;  
166 - $model->data = $data;  
167 - $model->updated_date = date('Y-m-d');  
168 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($model, true) . PHP_EOL, FILE_APPEND);  
169 - $model->save();  
170 - }  
171 } 65 }
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\RankData;
  4 +
  5 +use App\Helper\QuanqiusouApi;
  6 +use App\Http\Logic\Bside\RankData\RankDataLogic;
  7 +use App\Models\Com\NoticeLog;
  8 +use App\Models\Project\DeployOptimize;
  9 +use App\Models\Project\Project;
  10 +use App\Models\RankData\RankData as GoogleRankModel;
  11 +use App\Utils\LogUtils;
  12 +use Illuminate\Console\Command;
  13 +
  14 +/**
  15 + * Class GoogleRank
  16 + * @package App\Console\Commands
  17 + * @author zbj
  18 + * @date 2023/5/6
  19 + */
  20 +class RankDataTask extends Command
  21 +{
  22 + /**
  23 + * The name and signature of the console command.
  24 + *
  25 + * @var string
  26 + */
  27 + protected $signature = 'rank_data_task';
  28 +
  29 + /**
  30 + * The console command description.
  31 + * The console command description.
  32 + *
  33 + * @var string
  34 + */
  35 + protected $description = '谷歌排名数据';
  36 +
  37 +
  38 + /**
  39 + * Create a new command instance.
  40 + *
  41 + * @return void
  42 + */
  43 + public function __construct()
  44 + {
  45 + parent::__construct();
  46 + }
  47 +
  48 +
  49 + /**
  50 + * @author zbj
  51 + * @date 2023/5/6
  52 + */
  53 + public function handle()
  54 + {
  55 + $list = NoticeLog::where('type', NoticeLog::TYPE_RANK_DATA)->where('status', NoticeLog::STATUS_PENDING)->get();
  56 + foreach ($list as $item){
  57 + try {
  58 + (new RankDataLogic())->syncRankData($item['data']['api_no']);
  59 +
  60 + $item->status = NoticeLog::STATUS_SUCCESS;
  61 + $item->save();
  62 + }catch (\Exception $e){
  63 + errorLog('排名数据更新失败', $item, $e);
  64 + $this->retry($item);
  65 + }
  66 + }
  67 + }
  68 +
  69 + /**
  70 + * @param NoticeLog $log
  71 + */
  72 + public function retry($log){
  73 + if($log->retry >= 3){
  74 + $log->status = NoticeLog::STATUS_FAIL;
  75 + }else{
  76 + $log->retry = $log->retry + 1;
  77 + }
  78 + $log->save();
  79 + }
  80 +}
@@ -70,6 +70,9 @@ class RemainDay extends Command @@ -70,6 +70,9 @@ class RemainDay extends Command
70 } 70 }
71 } 71 }
72 $item->remain_day = $remain_day > 0 ? $remain_day : 0; 72 $item->remain_day = $remain_day > 0 ? $remain_day : 0;
  73 + if($item->remain_day == 0){
  74 + $item->extend_type = Project::TYPE_FIVE;
  75 + }
73 $item->save(); 76 $item->save();
74 } 77 }
75 } 78 }
@@ -7,12 +7,15 @@ use App\Helper\Common; @@ -7,12 +7,15 @@ use App\Helper\Common;
7 use App\Helper\OaGlobalsoApi; 7 use App\Helper\OaGlobalsoApi;
8 use App\Models\Channel\Channel; 8 use App\Models\Channel\Channel;
9 use App\Models\Com\NoticeLog; 9 use App\Models\Com\NoticeLog;
  10 +use App\Models\Com\UpdateLog;
10 use App\Models\Project\After; 11 use App\Models\Project\After;
11 use App\Models\Project\DeployBuild; 12 use App\Models\Project\DeployBuild;
12 use App\Models\Project\DeployOptimize; 13 use App\Models\Project\DeployOptimize;
13 use App\Models\Project\Payment; 14 use App\Models\Project\Payment;
14 use App\Models\Project\Project; 15 use App\Models\Project\Project;
15 use App\Models\Project\ProjectRenew; 16 use App\Models\Project\ProjectRenew;
  17 +use App\Models\User\User as UserModel;
  18 +use App\Services\ProjectServer;
16 use App\Utils\LogUtils; 19 use App\Utils\LogUtils;
17 use Hashids\Hashids; 20 use Hashids\Hashids;
18 use Illuminate\Console\Command; 21 use Illuminate\Console\Command;
@@ -62,14 +65,20 @@ class SyncProject extends Command @@ -62,14 +65,20 @@ class SyncProject extends Command
62 $list = NoticeLog::where('type', NoticeLog::TYPE_PROJECT)->where('status', NoticeLog::STATUS_PENDING)->get(); 65 $list = NoticeLog::where('type', NoticeLog::TYPE_PROJECT)->where('status', NoticeLog::STATUS_PENDING)->get();
63 foreach ($list as $item){ 66 foreach ($list as $item){
64 try { 67 try {
  68 + $is_update = $item['data']['is_update']??0;//是否是4.0或5.0更新到6.0
  69 + $order_id = $item['data']['order_id'];
  70 + if($is_update == 1){
  71 + $data = http_get('https://quanqiusou.cn/extend_api/v6/update.php?postid='.$order_id, ['charset' => 'UTF-8']);
  72 + }else{
65 $api = new OaGlobalsoApi(); 73 $api = new OaGlobalsoApi();
66 - $data = $api->order_info($item['data']['order_id']); 74 + $data = $api->order_info($order_id);
  75 + }
67 if(!$data || empty($data['data'])){ 76 if(!$data || empty($data['data'])){
68 LogUtils::error('OaGlobalsoApi order_info error', $data); 77 LogUtils::error('OaGlobalsoApi order_info error', $data);
69 $this->retry($item); 78 $this->retry($item);
70 } 79 }
71 if($data['data']['order_type'] == '首次'){ 80 if($data['data']['order_type'] == '首次'){
72 - $this->sync($data['data']); 81 + $this->sync($data['data'],$is_update);
73 82
74 //同步aicc 83 //同步aicc
75 if($data['data']['exclusive_aicc']){ 84 if($data['data']['exclusive_aicc']){
@@ -164,7 +173,7 @@ class SyncProject extends Command @@ -164,7 +173,7 @@ class SyncProject extends Command
164 * @method :post 173 * @method :post
165 * @time :2023/8/9 15:04 174 * @time :2023/8/9 15:04
166 */ 175 */
167 - public function sync($param){ 176 + public function sync($param,$is_update = 0){
168 $title = date('Ymd') . '-' . $param['company_name']; 177 $title = date('Ymd') . '-' . $param['company_name'];
169 $data = [ 178 $data = [
170 'project'=>[ 179 'project'=>[
@@ -183,6 +192,7 @@ class SyncProject extends Command @@ -183,6 +192,7 @@ class SyncProject extends Command
183 'hagro' => $param['exclusive_hagro'], 192 'hagro' => $param['exclusive_hagro'],
184 "exclusive_hagro_day" => $param['exclusive_hagro_day'], 193 "exclusive_hagro_day" => $param['exclusive_hagro_day'],
185 'notice_order_id' => $param['id'], 194 'notice_order_id' => $param['id'],
  195 + 'type' => $is_update
186 ], 196 ],
187 'deploy_build' => [ 197 'deploy_build' => [
188 'service_duration' => $param['years'], 198 'service_duration' => $param['years'],
@@ -207,6 +217,22 @@ class SyncProject extends Command @@ -207,6 +217,22 @@ class SyncProject extends Command
207 $this->saveDeployBuild($data['deploy_build'],$id); 217 $this->saveDeployBuild($data['deploy_build'],$id);
208 $this->saveDeployOptimize($data['deploy_optimize'],$id); 218 $this->saveDeployOptimize($data['deploy_optimize'],$id);
209 $this->saveAfter($data['project_after'],$id); 219 $this->saveAfter($data['project_after'],$id);
  220 +
  221 + if($is_update == 1){
  222 + //4.0或5.0更新到6.0
  223 +
  224 + //初始化数据库
  225 + $this->initializationMysql($id);
  226 +
  227 + //初始账号
  228 + $this->createUser($data['project']['mobile'],$id,$data['project']['lead_name']);
  229 +
  230 + //新增数据抓取任务
  231 + foreach ($param['api_type'] as $v_type){
  232 + UpdateLog::createLog($id,$v_type,$param['get_data_url']);
  233 + }
  234 + }
  235 +
210 DB::commit(); 236 DB::commit();
211 }catch (\Exception $e){ 237 }catch (\Exception $e){
212 DB::rollBack(); 238 DB::rollBack();
@@ -379,6 +405,7 @@ class SyncProject extends Command @@ -379,6 +405,7 @@ class SyncProject extends Command
379 'phone' => $data['principal_mobile'], 405 'phone' => $data['principal_mobile'],
380 'planday' => $data['exclusive_aicc_day'] ?: 1, 406 'planday' => $data['exclusive_aicc_day'] ?: 1,
381 'from_order_id' => $data['from_order_id'], 407 'from_order_id' => $data['from_order_id'],
  408 + 'agent_phone' => Channel::where('source_id', $data['company_id'])->value('contact_mobile') ?: '',
382 ]; 409 ];
383 $common = new Common(); 410 $common = new Common();
384 $token = $common->encrypt($param); 411 $token = $common->encrypt($param);
@@ -387,4 +414,43 @@ class SyncProject extends Command @@ -387,4 +414,43 @@ class SyncProject extends Command
387 LogUtils::error('ProjectToHagro error', $res); 414 LogUtils::error('ProjectToHagro error', $res);
388 } 415 }
389 } 416 }
  417 +
  418 + /**
  419 + * 初始化数据库
  420 + * @param $project_id
  421 + * @author Akun
  422 + * @date 2023/09/19 15:12
  423 + */
  424 + public function initializationMysql($project_id){
  425 + //切换数据库配置
  426 + $project = ProjectServer::useProject($project_id);
  427 + //创建数据库
  428 + ProjectServer::createDatabase($project);
  429 + //创建表
  430 + ProjectServer::initTable();
  431 + }
  432 +
  433 + /**
  434 + * 创建用户
  435 + * @param $mobile
  436 + * @param $project_id
  437 + * @param $lead_name
  438 + * @author Akun
  439 + * @date 2023/09/19 15:12
  440 + */
  441 + public function createUser($mobile,$project_id,$lead_name){
  442 + $userModel = new UserModel();
  443 + //查看当前用户是否存在
  444 + $info = $userModel->read(['mobile'=>$mobile,'project_id'=>$project_id]);
  445 + if($info === false){
  446 + $data = [
  447 + 'mobile'=>$mobile,
  448 + 'password'=>base64_encode(md5('123456')),
  449 + 'project_id'=>$project_id,
  450 + 'name'=>$lead_name,
  451 + 'type'=>UserModel::TYPE_ONE
  452 + ];
  453 + $userModel->add($data);
  454 + }
  455 + }
390 } 456 }
@@ -17,6 +17,7 @@ class Kernel extends ConsoleKernel @@ -17,6 +17,7 @@ class Kernel extends ConsoleKernel
17 { 17 {
18 // $schedule->command('inspire')->hourly(); 18 // $schedule->command('inspire')->hourly();
19 $schedule->command('remain_day')->dailyAt('03:00')->withoutOverlapping(1); // 项目剩余服务时长 19 $schedule->command('remain_day')->dailyAt('03:00')->withoutOverlapping(1); // 项目剩余服务时长
  20 + $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
20 $schedule->command('rank_data')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次 21 $schedule->command('rank_data')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次
21 $schedule->command('rank_data_speed')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次 22 $schedule->command('rank_data_speed')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次
22 $schedule->command('rank_data_external_links')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次 23 $schedule->command('rank_data_external_links')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
@@ -252,6 +252,7 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K @@ -252,6 +252,7 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K
252 return $this->http_click('post',$url,$param); 252 return $this->http_click('post',$url,$param);
253 } 253 }
254 254
  255 +
255 /** 256 /**
256 * 发送http post,get,put,delete请求 257 * 发送http post,get,put,delete请求
257 * @param type $url 258 * @param type $url
@@ -69,7 +69,7 @@ class Common @@ -69,7 +69,7 @@ class Common
69 } 69 }
70 } else { 70 } else {
71 //带原语种翻译 71 //带原语种翻译
72 - $result = Translate::translateSl($param['keywords'])->json(); 72 + $result = Translate::translateSl($param['keywords']);
73 if (isset($result['texts']['sl']) && isset(Translate::$tls_list[$result['texts']['sl']])) { 73 if (isset($result['texts']['sl']) && isset(Translate::$tls_list[$result['texts']['sl']])) {
74 $lang = Translate::$tls_list[$result['texts']['sl']]['text']; 74 $lang = Translate::$tls_list[$result['texts']['sl']]['text'];
75 } else { 75 } else {
@@ -135,9 +135,9 @@ class Common @@ -135,9 +135,9 @@ class Common
135 } 135 }
136 }else{ 136 }else{
137 $key = 'cache_'.$table.'_'.$id.'_type'; 137 $key = 'cache_'.$table.'_'.$id.'_type';
138 - }  
139 Cache::store('file')->pull($key); 138 Cache::store('file')->pull($key);
140 } 139 }
  140 + }
141 return true; 141 return true;
142 } 142 }
143 143
@@ -17,7 +17,14 @@ class Translate @@ -17,7 +17,14 @@ class Translate
17 { 17 {
18 //接口地址 18 //接口地址
19 // public static $url = 'https://translate.hbb618.cn/translates'; 19 // public static $url = 'https://translate.hbb618.cn/translates';
20 - public static $url = 'https://translate.hbbapi.com/'; 20 + public static $url = 'https://api.cmer.com/';
  21 +
  22 + public static $header = array(
  23 + 'accept: application/json',
  24 + 'Content-Type: application/json',
  25 + 'apikey: UkzZljFv83Z2qBi5YR1o3f2otAVWtug6',
  26 + 'X-CmerApi-Host:ai_translate.p.cmer.com'
  27 + );
21 28
22 public static $tls_list = [ 29 public static $tls_list = [
23 'en' => [ 30 'en' => [
@@ -734,7 +741,7 @@ class Translate @@ -734,7 +741,7 @@ class Translate
734 'sl' => 'auto', 741 'sl' => 'auto',
735 'tls' => $tls, 742 'tls' => $tls,
736 ]; 743 ];
737 - return Http::post(self::$url.$action, $data); 744 + return http_post(self::$url.$action, json_encode($data),self::$header);
738 } 745 }
739 746
740 /** 747 /**
@@ -749,11 +756,8 @@ class Translate @@ -749,11 +756,8 @@ class Translate
749 if (!$texts) { 756 if (!$texts) {
750 return ''; 757 return '';
751 } 758 }
752 -  
753 - $retsult = self::translate($texts, $tls)->json();  
754 -  
755 - return $retsult[0]['texts'] ?? '';  
756 - 759 + $result = self::translate($texts, $tls);
  760 + return $result[0]['texts'] ?? '';
757 } 761 }
758 /** 762 /**
759 * 翻译带源语种 763 * 翻译带源语种
@@ -772,7 +776,7 @@ class Translate @@ -772,7 +776,7 @@ class Translate
772 'sl' => 'auto', 776 'sl' => 'auto',
773 'tl' => $tl, 777 'tl' => $tl,
774 ]; 778 ];
775 - return Http::post(self::$url . $action, $data); 779 + return http_post(self::$url.$action, json_encode($data),self::$header);
776 } 780 }
777 781
778 } 782 }
@@ -419,28 +419,21 @@ if (!function_exists('getImageUrl')) { @@ -419,28 +419,21 @@ if (!function_exists('getImageUrl')) {
419 * @method :post 419 * @method :post
420 * @time :2023/7/20 16:46 420 * @time :2023/7/20 16:46
421 */ 421 */
422 - function getImageUrl($hash){  
423 - if(is_array($hash)){  
424 - foreach ($hash as $v){ 422 + function getImageUrl($path,$location = 1){
  423 + if(empty($path)){
  424 + return '';
  425 + }
  426 + if(is_array($path)){
  427 + foreach ($path as $v){
425 $url[] = getImageUrl($v); 428 $url[] = getImageUrl($v);
426 } 429 }
427 }else{ 430 }else{
428 - $imageModel = new Image();  
429 - if (strpos($hash, '.') !== false) {  
430 - $info = $imageModel->read(['path'=>['like','%'.$hash.'%']]);  
431 - }else{  
432 - $info = $imageModel->read(['hash'=>$hash]);  
433 - }  
434 - if(!empty($info)){  
435 - if($info['is_cos'] == 1){ 431 + if($location == 1){
436 $cos = config('filesystems.disks.cos'); 432 $cos = config('filesystems.disks.cos');
437 $cosCdn = $cos['cdn']; 433 $cosCdn = $cos['cdn'];
438 - $url = $cosCdn.$info['path']; 434 + $url = $cosCdn.$path;
439 }else{ 435 }else{
440 - $url = url($info['path']);  
441 - }  
442 - }else{  
443 - $url = $hash; 436 + $url = url($path);
444 } 437 }
445 } 438 }
446 return $url; 439 return $url;
@@ -454,33 +447,27 @@ if (!function_exists('getFileUrl')) { @@ -454,33 +447,27 @@ if (!function_exists('getFileUrl')) {
454 * @method :post 447 * @method :post
455 * @time :2023/7/20 16:46 448 * @time :2023/7/20 16:46
456 */ 449 */
457 - function getFileUrl($hash){  
458 - if(is_array($hash)){  
459 - foreach ($hash as $v){ 450 + function getFileUrl($path,$location = 1){
  451 + if(empty($path)){
  452 + return '';
  453 + }
  454 + if(is_array($path)){
  455 + foreach ($path as $v){
460 $url[] = getFileUrl($v); 456 $url[] = getFileUrl($v);
461 } 457 }
462 }else{ 458 }else{
463 - $fileModel = new File();  
464 - if (strpos($hash, '.') !== false) {  
465 - $info = $fileModel->read(['path'=>['like','%'.$hash.'%']]);  
466 - }else{  
467 - $info = $fileModel->read(['hash'=>$hash]);  
468 - }  
469 - if(!empty($info)){  
470 - if($info['is_cos'] == 1){ 459 + if($location == 1){
471 $cos = config('filesystems.disks.cos'); 460 $cos = config('filesystems.disks.cos');
472 $cosCdn = $cos['cdn']; 461 $cosCdn = $cos['cdn'];
473 - $url = $cosCdn.'/upload'.$info['path'];  
474 - }else{  
475 - $url = url('upload'.$info['path']);  
476 - } 462 + $url = $cosCdn.$path;
477 }else{ 463 }else{
478 - $url = $hash; 464 + $url = url($path);
479 } 465 }
480 } 466 }
481 return $url; 467 return $url;
482 } 468 }
483 } 469 }
  470 +
484 /** 471 /**
485 * @remark :字符串截取 472 * @remark :字符串截取
486 * @name :characterTruncation 473 * @name :characterTruncation
@@ -533,3 +520,31 @@ if (!function_exists('str_replace_url')) { @@ -533,3 +520,31 @@ if (!function_exists('str_replace_url')) {
533 } 520 }
534 } 521 }
535 } 522 }
  523 +
  524 +if(!function_exists('curlGet')){
  525 + /**
  526 + * @remark :忽略证书curl请求
  527 + * @name :curlGet
  528 + * @author :lyh
  529 + * @method :post
  530 + * @time :2023/9/12 10:10
  531 + */
  532 + function curlGet($url){
  533 + $ch1 = curl_init();
  534 + $timeout = 0;
  535 + curl_setopt($ch1, CURLOPT_URL, $url);
  536 + curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
  537 + curl_setopt($ch1, CURLOPT_ENCODING, '');
  538 + curl_setopt($ch1, CURLOPT_MAXREDIRS, 10);
  539 + curl_setopt($ch1, CURLOPT_HTTPHEADER, array());
  540 + curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
  541 + curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, FALSE);
  542 + curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, FALSE);
  543 + curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);
  544 + curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET');
  545 + curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  546 + $access_txt = curl_exec($ch1);
  547 + curl_close($ch1);
  548 + return json_decode($access_txt, true);
  549 + }
  550 +}
@@ -66,7 +66,6 @@ class DomainInfoController extends BaseController @@ -66,7 +66,6 @@ class DomainInfoController extends BaseController
66 'remark.required' => '备注不能为空', 66 'remark.required' => '备注不能为空',
67 'belong_to.required' => '域名不能为空', 67 'belong_to.required' => '域名不能为空',
68 ]); 68 ]);
69 - return true;  
70 } 69 }
71 70
72 /** 71 /**
@@ -39,12 +39,7 @@ class HrController extends BaseController @@ -39,12 +39,7 @@ class HrController extends BaseController
39 * @time :2023/9/6 10:04 39 * @time :2023/9/6 10:04
40 */ 40 */
41 public function info(HrLogic $logic){ 41 public function info(HrLogic $logic){
42 - $this->request->validate([  
43 - 'id'=>'required'  
44 - ],[  
45 - 'id.required' => 'ID不能为空'  
46 - ]);  
47 - $info = $logic->getHrInfo($this->param['id']); 42 + $info = $logic->getHrInfo();
48 $info['photo_gallery_link'] = $info['photo_gallery']; 43 $info['photo_gallery_link'] = $info['photo_gallery'];
49 $info['id_card_gallery_link'] = $info['id_card_gallery']; 44 $info['id_card_gallery_link'] = $info['id_card_gallery'];
50 $info['certificate_gallery_link'] = $info['certificate_gallery']; 45 $info['certificate_gallery_link'] = $info['certificate_gallery'];
@@ -78,12 +78,12 @@ class ManageController extends BaseController @@ -78,12 +78,12 @@ class ManageController extends BaseController
78 */ 78 */
79 public function delete(ManageLogic $logic){ 79 public function delete(ManageLogic $logic){
80 $this->request->validate([ 80 $this->request->validate([
81 - 'ids'=>['required', new Ids()] 81 + 'ids'=>'required'
82 ],[ 82 ],[
83 'ids.required' => 'ID不能为空' 83 'ids.required' => 'ID不能为空'
84 ]); 84 ]);
85 - $logic->delete($this->param['ids']);  
86 - $this->response('success'); 85 + $logic->managerDelete();
  86 + $this->response('删除成功');
87 } 87 }
88 88
89 /** 89 /**
@@ -17,13 +17,10 @@ class NoticeController extends BaseController @@ -17,13 +17,10 @@ class NoticeController extends BaseController
17 { 17 {
18 /** 18 /**
19 * 项目通知 19 * 项目通知
20 - * @return \Illuminate\Http\JsonResponse  
21 - * @throws \Psr\Container\ContainerExceptionInterface  
22 - * @throws \Psr\Container\NotFoundExceptionInterface  
23 * @author zbj 20 * @author zbj
24 * @date 2023/6/26 21 * @date 2023/6/26
25 */ 22 */
26 - public function project(ProjectLogic $logic) 23 + public function project()
27 { 24 {
28 //首次 续费 25 //首次 续费
29 LogUtils::info('notice project', $this->param); 26 LogUtils::info('notice project', $this->param);
@@ -31,4 +28,18 @@ class NoticeController extends BaseController @@ -31,4 +28,18 @@ class NoticeController extends BaseController
31 $this->response('success'); 28 $this->response('success');
32 } 29 }
33 30
  31 +
  32 + /**
  33 + *
  34 + * 更新排名数据通知
  35 + * @author zbj
  36 + * @date 2023/9/20
  37 + */
  38 + public function rank_data()
  39 + {
  40 + LogUtils::info('notice rank_data', $this->param);
  41 + NoticeLog::createLog(NoticeLog::TYPE_RANK_DATA, $this->param);
  42 + $this->response('success');
  43 + }
  44 +
34 } 45 }
@@ -70,13 +70,6 @@ class ProjectGscController extends BaseController @@ -70,13 +70,6 @@ class ProjectGscController extends BaseController
70 * @time :2023/6/19 16:28 70 * @time :2023/6/19 16:28
71 */ 71 */
72 public function save(GscRequest $gscRequest,GscLogic $gscLogic){ 72 public function save(GscRequest $gscRequest,GscLogic $gscLogic){
73 - if(isset($this->param['id'])){  
74 - $gscRequest->validate([  
75 - 'id'=>'required'  
76 - ],[  
77 - 'id.required' => 'GSC账号ID不能为空'  
78 - ]);  
79 - }  
80 $gscRequest->validated(); 73 $gscRequest->validated();
81 $gscLogic->GscSave(); 74 $gscLogic->GscSave();
82 $this->response('success'); 75 $this->response('success');
@@ -38,13 +38,6 @@ class ProjectsController extends BaseController @@ -38,13 +38,6 @@ class ProjectsController extends BaseController
38 * @time :2023/7/11 9:53 38 * @time :2023/7/11 9:53
39 */ 39 */
40 public function save(ProjectsLogic $projectsLogic){ 40 public function save(ProjectsLogic $projectsLogic){
41 - if(isset($this->param['id']) && !empty($this->param['id'])){  
42 - $this->request->validate([  
43 - 'id'=>'required'  
44 - ],[  
45 - 'id.required' => 'ID不能为空'  
46 - ]);  
47 - }  
48 //参数验证 41 //参数验证
49 $this->verifyParam(); 42 $this->verifyParam();
50 $projectsLogic->projectsSave(); 43 $projectsLogic->projectsSave();
@@ -95,6 +95,7 @@ class ProjectController extends BaseController @@ -95,6 +95,7 @@ class ProjectController extends BaseController
95 */ 95 */
96 public function searchType(&$query){ 96 public function searchType(&$query){
97 $query->where('gl_project.delete_status',Project::TYPE_ZERO); 97 $query->where('gl_project.delete_status',Project::TYPE_ZERO);
  98 + $query->where('gl_project.extend_type',Project::TYPE_ZERO);
98 if(!isset($this->map['type'])){ 99 if(!isset($this->map['type'])){
99 $this->map['type'] = Project::TYPE_ZERO; 100 $this->map['type'] = Project::TYPE_ZERO;
100 } 101 }
@@ -512,7 +513,7 @@ class ProjectController extends BaseController @@ -512,7 +513,7 @@ class ProjectController extends BaseController
512 */ 513 */
513 public function getServiceConfig(){ 514 public function getServiceConfig(){
514 $serviceConfigModel = new ServerConfig(); 515 $serviceConfigModel = new ServerConfig();
515 - $list = $serviceConfigModel->list($this->param,'id',['id','type','title']); 516 + $list = $serviceConfigModel->list($this->param,'id',['id','type','title','init_domain','service_type']);
516 $this->response('success',Code::SUCCESS,$list); 517 $this->response('success',Code::SUCCESS,$list);
517 } 518 }
518 519
@@ -22,6 +22,7 @@ use App\Models\Manage\Manage; @@ -22,6 +22,7 @@ use App\Models\Manage\Manage;
22 use App\Models\Project\DeployBuild; 22 use App\Models\Project\DeployBuild;
23 use App\Models\Project\DeployOptimize; 23 use App\Models\Project\DeployOptimize;
24 use App\Models\Project\Project; 24 use App\Models\Project\Project;
  25 +use App\Models\Project\ProjectRenew;
25 use App\Models\Task\Task; 26 use App\Models\Task\Task;
26 use Carbon\Carbon; 27 use Carbon\Carbon;
27 28
@@ -171,4 +172,57 @@ class RenewProjectController extends BaseController @@ -171,4 +172,57 @@ class RenewProjectController extends BaseController
171 ]; 172 ];
172 return $item; 173 return $item;
173 } 174 }
  175 +
  176 + /**
  177 + * @remark :关联续费单
  178 + * @name :editRenew
  179 + * @author :lyh
  180 + * @method :post
  181 + * @time :2023/9/19 9:59
  182 + */
  183 + public function editRenew(RenewLogic $logic){
  184 + $this->request->validate([
  185 + 'id'=>'required',
  186 + 'renew_id'=>'required',
  187 + ],[
  188 + 'id.required' => 'id不能为空',
  189 + 'renew_id'=>'续费单id不能为空',
  190 + ]);
  191 + $logic->editProjectRenew();
  192 + $this->response('同步成功');
  193 + }
  194 +
  195 + /**
  196 + * @remark :获取所有续费单
  197 + * @name :getRenewList
  198 + * @author :lyh
  199 + * @method :post
  200 + * @time :2023/9/19 11:21
  201 + */
  202 + public function getRenewList(ProjectRenew $projectRenew){
  203 + $this->map['project_id'] = 0;
  204 + $this->map['status'] = 0;
  205 + $list = $projectRenew->list($this->map);
  206 + $this->response('success',Code::SUCCESS,$list);
  207 + }
  208 +
  209 + /**
  210 + * @remark :逻辑删除续费单
  211 + * @name :delRenew
  212 + * @author :lyh
  213 + * @method :post
  214 + * @time :2023/9/19 15:47
  215 + */
  216 + public function editStatusRenew(RenewLogic $logic){
  217 + $this->request->validate([
  218 + 'id'=>'required',
  219 + 'status'=>'required',
  220 + ],[
  221 + 'id.required' => 'id不能为空',
  222 + 'status.required' => 'status不能为空',
  223 + ]);
  224 + $logic->editStatus();
  225 + $this->response('success');
  226 + }
  227 +
174 } 228 }
@@ -94,7 +94,7 @@ class AyrShareController extends BaseController @@ -94,7 +94,7 @@ class AyrShareController extends BaseController
94 $ayrShareHelper = new AyrShareHelper(); 94 $ayrShareHelper = new AyrShareHelper();
95 $res = $ayrShareHelper->post_create_profiles($param); 95 $res = $ayrShareHelper->post_create_profiles($param);
96 if($res['status'] == 'fail'){ 96 if($res['status'] == 'fail'){
97 - $this->response('同步绑定失败'); 97 + $this->response('同步绑定失败,当前账号已存在',Code::USER_ERROR);
98 } 98 }
99 //执行数据库操作 99 //执行数据库操作
100 $ayrShareLogic->ayr_share_save($res); 100 $ayrShareLogic->ayr_share_save($res);
@@ -39,7 +39,7 @@ class CNoticeController extends BaseController @@ -39,7 +39,7 @@ class CNoticeController extends BaseController
39 if((!empty($progressInfo))){ 39 if((!empty($progressInfo))){
40 $progressInfo = $progressInfo->toArray(); 40 $progressInfo = $progressInfo->toArray();
41 if(($progressInfo['total_num'] > $progressInfo['current_num'])){ 41 if(($progressInfo['total_num'] > $progressInfo['current_num'])){
42 - $this->response('当前页面正在生成了,请完成后再点击',Code::USER_ERROR,$progressInfo); 42 + $this->response('当前页面正在生成了,请完成后再点击',Code::SUCCESS,$progressInfo);
43 } 43 }
44 } 44 }
45 //通知更新 45 //通知更新
@@ -50,12 +50,12 @@ class CNoticeController extends BaseController @@ -50,12 +50,12 @@ class CNoticeController extends BaseController
50 } 50 }
51 $urlStr = $this->getString($this->param['type'],$this->param['page']); 51 $urlStr = $this->getString($this->param['type'],$this->param['page']);
52 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($urlStr, true) . PHP_EOL, FILE_APPEND); 52 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($urlStr, true) . PHP_EOL, FILE_APPEND);
53 - $this->curlGet($urlStr);  
54 - $this->response('success'); 53 + curlGet($urlStr);
  54 + $this->response('更新成功');
55 } 55 }
56 56
57 /** 57 /**
58 - * @remark :主通知 58 + * @remark :主通知
59 * @name :updateMaster 59 * @name :updateMaster
60 * @author :lyh 60 * @author :lyh
61 * @method :post 61 * @method :post
@@ -98,11 +98,6 @@ class CNoticeController extends BaseController @@ -98,11 +98,6 @@ class CNoticeController extends BaseController
98 $updateNotifyModel = new UpdateNotify(); 98 $updateNotifyModel = new UpdateNotify();
99 try { 99 try {
100 if($this->param['page'] == UpdateNotify::PAGE_ALL){ 100 if($this->param['page'] == UpdateNotify::PAGE_ALL){
101 - $this->request->validate([  
102 - 'language' => 'required',  
103 - ], [  
104 - 'language.required' => '请选择语种',  
105 - ]);  
106 //如果是更新所有 101 //如果是更新所有
107 $routeMapModel = new RouteMap(); 102 $routeMapModel = new RouteMap();
108 $count = $routeMapModel->formatQuery(['project_id'=>$this->user['project_id']])->count(); 103 $count = $routeMapModel->formatQuery(['project_id'=>$this->user['project_id']])->count();
@@ -110,13 +105,6 @@ class CNoticeController extends BaseController @@ -110,13 +105,6 @@ class CNoticeController extends BaseController
110 $extent = json_encode(['language'=>$this->param['language']]); 105 $extent = json_encode(['language'=>$this->param['language']]);
111 $this->addProgress($count,$this->param['type'],$this->param['page'],$extent); 106 $this->addProgress($count,$this->param['type'],$this->param['page'],$extent);
112 }else{ 107 }else{
113 - $this->request->validate([  
114 - 'url'=>'required',  
115 - 'language' => 'required',  
116 - ], [  
117 - 'url.required' => '请输入更新链接',  
118 - 'language.required' => '请选择语种',  
119 - ]);  
120 //根据传递的参数更新 108 //根据传递的参数更新
121 $count = count($this->param['url']); 109 $count = count($this->param['url']);
122 $extent = json_encode(['url'=>$this->param['url'],'language'=>$this->param['language']]); 110 $extent = json_encode(['url'=>$this->param['url'],'language'=>$this->param['language']]);
@@ -129,32 +117,6 @@ class CNoticeController extends BaseController @@ -129,32 +117,6 @@ class CNoticeController extends BaseController
129 } 117 }
130 118
131 /** 119 /**
132 - * @remark :curl请求  
133 - * @name :curlGet  
134 - * @author :lyh  
135 - * @method :post  
136 - * @time :2023/9/12 10:10  
137 - */  
138 - public function curlGet($url){  
139 - $ch1 = curl_init();  
140 - $timeout = 0;  
141 - curl_setopt($ch1, CURLOPT_URL, $url);  
142 - curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);  
143 - curl_setopt($ch1, CURLOPT_ENCODING, '');  
144 - curl_setopt($ch1, CURLOPT_MAXREDIRS, 10);  
145 - curl_setopt($ch1, CURLOPT_HTTPHEADER, array());  
146 - curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);  
147 - curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, FALSE);  
148 - curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, FALSE);  
149 - curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);  
150 - curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET');  
151 - curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);  
152 - $access_txt = curl_exec($ch1);  
153 - curl_close($ch1);  
154 - return json_decode($access_txt, true);  
155 - }  
156 -  
157 - /**  
158 * @remark :生成一条更新记录 120 * @remark :生成一条更新记录
159 * @name :addProgress 121 * @name :addProgress
160 * @author :lyh 122 * @author :lyh
@@ -215,4 +177,5 @@ class CNoticeController extends BaseController @@ -215,4 +177,5 @@ class CNoticeController extends BaseController
215 } 177 }
216 $this->response('success',Code::SUCCESS,$lists); 178 $this->response('success',Code::SUCCESS,$lists);
217 } 179 }
  180 +
218 } 181 }
@@ -148,7 +148,7 @@ class ComController extends BaseController @@ -148,7 +148,7 @@ class ComController extends BaseController
148 $this->response('系统错误',Code::SYSTEM_ERROR); 148 $this->response('系统错误',Code::SYSTEM_ERROR);
149 } 149 }
150 Cache::pull($info['token']); 150 Cache::pull($info['token']);
151 - $this->response('success',Code::USER_LOGIN_ERROE); 151 + $this->response('success');
152 } 152 }
153 153
154 /** 154 /**
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Bside\Import;
  4 +
  5 +
  6 +use App\Enums\Common\Code;
  7 +use App\Http\Controllers\Bside\BaseController;
  8 +use App\Http\Logic\Bside\Import\ImportLogic;
  9 +use App\Http\Requests\Bside\Import\ImportTaskRequest;
  10 +
  11 +/**
  12 + * 新闻、博客、商品导入
  13 + * Class ImportController
  14 + * @package App\Http\Controllers\Bside\Import
  15 + */
  16 +class ImportController extends BaseController
  17 +{
  18 + /**
  19 + * 新增导入任务
  20 + * @param ImportTaskRequest $request
  21 + * @param ImportLogic $logic
  22 + * @throws \App\Exceptions\AsideGlobalException
  23 + * @throws \App\Exceptions\BsideGlobalException
  24 + * @author Akun
  25 + * @date 2023/09/20 11:36
  26 + */
  27 + public function save(ImportTaskRequest $request,ImportLogic $logic)
  28 + {
  29 + $request->validated();
  30 +
  31 + $logic->addImportTask();
  32 + $this->response('success', Code::SUCCESS);
  33 + }
  34 +}
@@ -4,7 +4,7 @@ namespace App\Http\Controllers\Bside\Inquiry; @@ -4,7 +4,7 @@ namespace App\Http\Controllers\Bside\Inquiry;
4 4
5 5
6 use App\Http\Controllers\Bside\BaseController; 6 use App\Http\Controllers\Bside\BaseController;
7 -use App\Http\Logic\Bside\InquiryLogic; 7 +use App\Http\Logic\Bside\Inquiry\InquiryLogic;
8 use App\Rules\Ids; 8 use App\Rules\Ids;
9 use App\Services\BatchExportService; 9 use App\Services\BatchExportService;
10 use Illuminate\Http\Request; 10 use Illuminate\Http\Request;
@@ -15,21 +15,15 @@ use App\Events\WebSocketMessageSent; @@ -15,21 +15,15 @@ use App\Events\WebSocketMessageSent;
15 use App\Helper\Common; 15 use App\Helper\Common;
16 use App\Helper\Translate; 16 use App\Helper\Translate;
17 use App\Helper\Wechat; 17 use App\Helper\Wechat;
18 -use App\Http\Logic\Bside\User\UserLogic;  
19 use App\Http\Logic\Bside\User\UserLoginLogic; 18 use App\Http\Logic\Bside\User\UserLoginLogic;
20 -use App\Models\File\Image as ImageModel;  
21 use App\Models\Project\Project; 19 use App\Models\Project\Project;
22 use App\Models\Service\Service; 20 use App\Models\Service\Service;
23 use App\Models\Sms\SmsLog; 21 use App\Models\Sms\SmsLog;
24 -use App\Models\Template\Template;  
25 -use App\Models\Template\TemplateModule;  
26 use App\Models\User\DeptUser; 22 use App\Models\User\DeptUser;
27 use App\Models\User\ProjectRole; 23 use App\Models\User\ProjectRole;
28 use App\Models\User\User; 24 use App\Models\User\User;
29 -use App\Models\User\User as UserModel;  
30 use App\Utils\EncryptUtils; 25 use App\Utils\EncryptUtils;
31 -use Illuminate\Database\Eloquent\Model;  
32 -use \Illuminate\Support\Facades\Cache; 26 +use Illuminate\Support\Facades\Cache;
33 use Mrgoon\AliSms\AliSms; 27 use Mrgoon\AliSms\AliSms;
34 28
35 class LoginController extends BaseController 29 class LoginController extends BaseController
@@ -116,7 +110,7 @@ class LoginController extends BaseController @@ -116,7 +110,7 @@ class LoginController extends BaseController
116 'mobile.regex' => '请输入正确的手机号码', 110 'mobile.regex' => '请输入正确的手机号码',
117 ]); 111 ]);
118 $mobile = $this->param['mobile']; 112 $mobile = $this->param['mobile'];
119 - $user = UserModel::where(['mobile' => $mobile])->first(); 113 + $user = User::where(['mobile' => $mobile])->first();
120 if (empty($user)) { 114 if (empty($user)) {
121 $this->response('请输入正确的手机号码!', Code::USER_LOGIN_ERROE); 115 $this->response('请输入正确的手机号码!', Code::USER_LOGIN_ERROE);
122 } 116 }
@@ -110,10 +110,4 @@ class NavController extends BaseController @@ -110,10 +110,4 @@ class NavController extends BaseController
110 $navLogic->navSort(); 110 $navLogic->navSort();
111 $this->response('success'); 111 $this->response('success');
112 } 112 }
113 -  
114 -  
115 -  
116 -  
117 -  
118 -  
119 } 113 }
@@ -31,16 +31,15 @@ class CategoryController extends BaseController @@ -31,16 +31,15 @@ class CategoryController extends BaseController
31 */ 31 */
32 public function index(Category $category) 32 public function index(Category $category)
33 { 33 {
34 - if(!empty($this->map['title'])){  
35 - $this->map['title'] = ['like','%'.$this->map['title'].'%'];  
36 - }  
37 - $this->map['project_id'] = $this->user['project_id']; 34 + $this->map = $this->searchParam();
38 $filed = ['id', 'project_id', 'pid', 'title', 'image', 'route','keywords', 'describe', 'status','created_at']; 35 $filed = ['id', 'project_id', 'pid', 'title', 'image', 'route','keywords', 'describe', 'status','created_at'];
39 $list = $category->list($this->map,'id',$filed); 36 $list = $category->list($this->map,'id',$filed);
40 $data = []; 37 $data = [];
41 if(!empty($list)){ 38 if(!empty($list)){
42 foreach ($list as $k =>$v){ 39 foreach ($list as $k =>$v){
43 - $v = $this->handleParam($v); 40 + $v['url'] = $this->user['domain'] . $v['route'];
  41 + $v['product_num'] = Product::where('category_id','like' ,'%,'.$v['id'].',%')->count();;
  42 + $v['image_link'] = getImageUrl($v['image']);
44 $list[$k] = $v; 43 $list[$k] = $v;
45 } 44 }
46 $data = $this->getListSon($list); 45 $data = $this->getListSon($list);
@@ -49,17 +48,18 @@ class CategoryController extends BaseController @@ -49,17 +48,18 @@ class CategoryController extends BaseController
49 } 48 }
50 49
51 /** 50 /**
52 - * @remark :分类处理参数  
53 - * @name :handleParam 51 + * @remark :搜索参数处理
  52 + * @name :searchParam
54 * @author :lyh 53 * @author :lyh
55 * @method :post 54 * @method :post
56 - * @time :2023/8/17 11:10 55 + * @time :2023/9/14 14:57
57 */ 56 */
58 - public function handleParam($v){  
59 - $v['url'] = $this->user['domain'] . RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_CATE, $v['id'], $v['project_id']);  
60 - $v['product_num'] = Product::where('category_id','like' ,'%,'.$v['id'].',%')->count();;  
61 - $v['image_link'] = getImageUrl($v['image']);  
62 - return $v; 57 + public function searchParam(){
  58 + if(!empty($this->map['title'])){
  59 + $this->map['title'] = ['like','%'.$this->map['title'].'%'];
  60 + }
  61 + $this->map['project_id'] = $this->user['project_id'];
  62 + return $this->map;
63 } 63 }
64 64
65 /** 65 /**
@@ -36,13 +36,13 @@ class KeywordController extends BaseController @@ -36,13 +36,13 @@ class KeywordController extends BaseController
36 $this->map['title'] = ['like','%'.$this->map['title'].'%']; 36 $this->map['title'] = ['like','%'.$this->map['title'].'%'];
37 } 37 }
38 $this->map['project_id'] = $this->user['project_id']; 38 $this->map['project_id'] = $this->user['project_id'];
39 - $filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at']; 39 + $filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at','route'];
40 $data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed); 40 $data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed);
41 if(!empty($data)){ 41 if(!empty($data)){
42 foreach ($data['list'] as &$v){ 42 foreach ($data['list'] as &$v){
43 $v['product_num'] = Product::where('keyword_id','like' ,'%,'.$v['id'].',%')->count(); 43 $v['product_num'] = Product::where('keyword_id','like' ,'%,'.$v['id'].',%')->count();
44 $v['tdk'] = boolval($v['seo_title']) * boolval($v['seo_keywords']) * boolval($v['seo_description']); 44 $v['tdk'] = boolval($v['seo_title']) * boolval($v['seo_keywords']) * boolval($v['seo_description']);
45 - $v['url'] = $this->user['domain'] . RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); 45 + $v['url'] = $this->user['domain'] . $v['route'];
46 } 46 }
47 } 47 }
48 return $this->response('success',Code::SUCCESS,$data); 48 return $this->response('success',Code::SUCCESS,$data);
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside\Product; @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside\Product;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Exceptions\BsideGlobalException; 6 use App\Exceptions\BsideGlobalException;
7 use App\Helper\Arr; 7 use App\Helper\Arr;
  8 +use App\Helper\Common;
8 use App\Http\Controllers\Bside\BaseController; 9 use App\Http\Controllers\Bside\BaseController;
9 use App\Http\Logic\Bside\Product\ProductLogic; 10 use App\Http\Logic\Bside\Product\ProductLogic;
10 use App\Http\Requests\Bside\Product\ProductRequest; 11 use App\Http\Requests\Bside\Product\ProductRequest;
@@ -18,6 +19,7 @@ use App\Models\Template\BTemplate; @@ -18,6 +19,7 @@ use App\Models\Template\BTemplate;
18 use App\Models\User\User; 19 use App\Models\User\User;
19 use App\Rules\Ids; 20 use App\Rules\Ids;
20 use Illuminate\Http\Request; 21 use Illuminate\Http\Request;
  22 +use Illuminate\Support\Facades\Cache;
21 use Illuminate\Support\Facades\DB; 23 use Illuminate\Support\Facades\DB;
22 24
23 /** 25 /**
@@ -38,21 +40,23 @@ class ProductController extends BaseController @@ -38,21 +40,23 @@ class ProductController extends BaseController
38 */ 40 */
39 public function index(Product $product) 41 public function index(Product $product)
40 { 42 {
41 - $this->order = 'sort';  
42 - if(isset($this->map['title']) && !empty($this->map['title'])){  
43 - $this->map['title'] = ['like','%'.$this->map['title'].'%'];  
44 - }  
45 - if(isset($this->map['category_id']) && !empty($this->map['category_id'])){  
46 - $this->map['category_id'] = ['like','%'.$this->map['category_id'].'%'];  
47 - }  
48 - $this->map['project_id'] = $this->user['project_id']; 43 + $this->map = $this->searchParam();
49 $filed = ['id', 'project_id', 'title', 'sort' ,'thumb', 'gallery' ,'product_type' , 'route' , 44 $filed = ['id', 'project_id', 'title', 'sort' ,'thumb', 'gallery' ,'product_type' , 'route' ,
50 'category_id', 'keyword_id', 'status', 'created_uid', 'created_at', 'updated_at']; 45 'category_id', 'keyword_id', 'status', 'created_uid', 'created_at', 'updated_at'];
51 - $lists = $product->lists($this->map,$this->page,$this->row,$this->order,$filed);  
52 - if(!empty($lists['list'])){ 46 + $lists = $product->lists($this->map,$this->page,$this->row,$this->order = ['sort','id'],$filed);
  47 + if(!empty($lists) && !empty($lists['list'])){
  48 + $cate_data = $this->getCategoryList();//分类
  49 + $key_data = $this->getKeywordsList();//关键字
  50 + //获取当前用户选择的模版
  51 + $templateSettingModel = new BSetting();
  52 + $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
  53 + $userModel = new User();
53 foreach ($lists['list'] as $k=>$v){ 54 foreach ($lists['list'] as $k=>$v){
54 - //处理参数  
55 - $v = $this->handleParam($v); 55 + $v['category_id_text'] = $this->categoryName($v['category_id'],$cate_data);
  56 + $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
  57 + $v['created_uid_text'] = $userModel->getName($v['created_uid']);
  58 + $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
  59 + $v['url'] = $this->user['domain'].$v['route'];
56 $lists['list'][$k] = $v; 60 $lists['list'][$k] = $v;
57 } 61 }
58 } 62 }
@@ -60,15 +64,31 @@ class ProductController extends BaseController @@ -60,15 +64,31 @@ class ProductController extends BaseController
60 } 64 }
61 65
62 /** 66 /**
  67 + * @remark :搜索参数处理
  68 + * @name :searchParam
  69 + * @author :lyh
  70 + * @method :post
  71 + * @time :2023/9/14 14:32
  72 + */
  73 + public function searchParam(){
  74 + if(isset($this->map['title']) && !empty($this->map['title'])){
  75 + $this->map['title'] = ['like','%'.$this->map['title'].'%'];
  76 + }
  77 + if(isset($this->map['category_id']) && !empty($this->map['category_id'])){
  78 + $this->map['category_id'] = ['like','%'.$this->map['category_id'].'%'];
  79 + }
  80 + $this->map['project_id'] = $this->user['project_id'];
  81 + return $this->map;
  82 + }
  83 +
  84 + /**
63 * @remark :查看产品是否已装修 85 * @remark :查看产品是否已装修
64 * @name :getProductIsRenovation 86 * @name :getProductIsRenovation
65 * @author :lyh 87 * @author :lyh
66 * @method :post 88 * @method :post
67 * @time :2023/9/13 14:02 89 * @time :2023/9/13 14:02
68 */ 90 */
69 - public function getProductIsRenovation($id){  
70 - $templateSettingModel = new BSetting();  
71 - $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]); 91 + public function getProductIsRenovation($info,$id){
72 if($info !== false){ 92 if($info !== false){
73 $webTemplateModel = new BTemplate(); 93 $webTemplateModel = new BTemplate();
74 $param = [ 94 $param = [
@@ -86,6 +106,110 @@ class ProductController extends BaseController @@ -86,6 +106,110 @@ class ProductController extends BaseController
86 } 106 }
87 107
88 /** 108 /**
  109 + * @remark :获取所有分类
  110 + * @name :getCategoryList
  111 + * @author :lyh
  112 + * @method :post
  113 + * @time :2023/9/14 13:56
  114 + */
  115 + public function getCategoryList(){
  116 + $data = Common::get_user_cache('product_category',$this->user['project_id']);
  117 + if(empty($data)){
  118 + $categoryModel = new Category();
  119 + $data = [];
  120 + $cateList = $categoryModel->list(['project_id'=>$this->user['project_id']],['id','title']);
  121 + if(!empty($cateList)){
  122 + foreach ($cateList as $value){
  123 + $data[$value['id']] = $value['title'];
  124 + }
  125 + }
  126 + Common::set_user_cache($data,'product_category',$this->user['project_id']);
  127 + }
  128 + return $data;
  129 + }
  130 +
  131 + /**
  132 + * @remark :获取所有关键词
  133 + * @name :getCategoryList
  134 + * @author :lyh
  135 + * @method :post
  136 + * @time :2023/9/14 13:56
  137 + */
  138 + public function getKeywordsList(){
  139 + $data = Common::get_user_cache('product_keyword',$this->user['project_id']);
  140 + if(empty($data)) {
  141 + $keywordModel = new Keyword();
  142 + $data = [];
  143 + $cateList = $keywordModel->list(['project_id' => $this->user['project_id']], ['id', 'title']);
  144 + if (!empty($cateList)) {
  145 + foreach ($cateList as $value) {
  146 + $data[$value['id']] = $value['title'];
  147 + }
  148 + }
  149 + Common::set_user_cache($data,'product_keyword',$this->user['project_id']);
  150 + }
  151 + return $data;
  152 + }
  153 +
  154 + /**
  155 + * @remark :获取分类名称
  156 + * @name :categoryName
  157 + * @author :lyh
  158 + * @method :post
  159 + * @time :2023/9/14 13:58
  160 + */
  161 + public function categoryName($category_id,$data){
  162 + $category_name = '';
  163 + if(!empty($category_id) && !empty($data)){
  164 + foreach ($category_id as $v){
  165 + if(isset($data[$v])){
  166 + $category_name .= $data[$v].',';
  167 + }
  168 + }
  169 + $category_name = trim($category_name,',');
  170 + }
  171 + return $category_name;
  172 + }
  173 +
  174 + /**
  175 + * @remark :获取关键词名称
  176 + * @name :categoryName
  177 + * @author :lyh
  178 + * @method :post
  179 + * @time :2023/9/14 13:58
  180 + */
  181 + public function keywordName($keyword_id,$data){
  182 + $keyword_name = '';
  183 + if(!empty($keyword_id) && !empty($data)){
  184 + foreach ($keyword_id as $v){
  185 + if(isset($data[$v])){
  186 + $keyword_name .= $data[$v].',';
  187 + }
  188 + }
  189 + $keyword_name = trim($keyword_name,',');
  190 + }
  191 + return $keyword_name;
  192 + }
  193 +
  194 + /**
  195 + * @remark :详情
  196 + * @name :info
  197 + * @author :lyh
  198 + * @method :post
  199 + * @time :2023/8/21 18:12
  200 + */
  201 + public function info(Product $product){
  202 + $this->request->validate([
  203 + 'id'=>'required'
  204 + ],[
  205 + 'id.required' => 'ID不能为空'
  206 + ]);
  207 + $info = $product->read(['id'=>$this->param['id']]);
  208 + $info = $this->handleParam($info);
  209 + return $this->response('success',Code::SUCCESS,$info);
  210 + }
  211 +
  212 + /**
89 * @remark :处理列表参数 213 * @remark :处理列表参数
90 * @name :handleParam 214 * @name :handleParam
91 * @author :lyh 215 * @author :lyh
@@ -112,29 +236,13 @@ class ProductController extends BaseController @@ -112,29 +236,13 @@ class ProductController extends BaseController
112 $v['keyword_id_text'] = trim($v['keyword_id_text'],','); 236 $v['keyword_id_text'] = trim($v['keyword_id_text'],',');
113 } 237 }
114 $v['status_text'] = Product::statusMap()[$v['status']] ?? ''; 238 $v['status_text'] = Product::statusMap()[$v['status']] ?? '';
115 - $v['created_uid_text'] = (new User())->read(['id'=>$v['created_uid']])['name'] ?? ''; 239 + //获取当前用户选择的模版
  240 + $templateSettingModel = new BSetting();
  241 + $templateInfo = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
  242 + $v['is_renovation'] = $this->getProductIsRenovation($templateInfo,$v['id']);
116 $v['url'] = $this->user['domain'].$v['route']; 243 $v['url'] = $this->user['domain'].$v['route'];
117 - $v['is_renovation'] = $this->getProductIsRenovation($v['id']);  
118 return $v; 244 return $v;
119 } 245 }
120 - /**  
121 - * @remark :详情  
122 - * @name :info  
123 - * @author :lyh  
124 - * @method :post  
125 - * @time :2023/8/21 18:12  
126 - */  
127 - public function info(Product $product){  
128 - $this->request->validate([  
129 - 'id'=>'required'  
130 - ],[  
131 - 'id.required' => 'ID不能为空'  
132 - ]);  
133 - $info = $product->read(['id'=>$this->param['id']]);  
134 - $info = $this->handleParam($info);  
135 - return $this->response('success',Code::SUCCESS,$info);  
136 - }  
137 -  
138 246
139 247
140 /** 248 /**
@@ -8,7 +8,7 @@ use App\Helper\GoogleSpeedApi; @@ -8,7 +8,7 @@ use App\Helper\GoogleSpeedApi;
8 use App\Helper\QuanqiusouApi; 8 use App\Helper\QuanqiusouApi;
9 use App\Http\Controllers\Bside\BaseController; 9 use App\Http\Controllers\Bside\BaseController;
10 use App\Http\Logic\Aside\Project\ProjectLogic; 10 use App\Http\Logic\Aside\Project\ProjectLogic;
11 -use App\Http\Logic\Bside\RankDataLogic; 11 +use App\Http\Logic\Bside\RankData\RankDataLogic;
12 use App\Models\RankData\RankData; 12 use App\Models\RankData\RankData;
13 use App\Models\RankData\Speed as GoogleSpeedModel; 13 use App\Models\RankData\Speed as GoogleSpeedModel;
14 use App\Services\BatchExportService; 14 use App\Services\BatchExportService;
@@ -6,6 +6,8 @@ use App\Enums\Common\Code; @@ -6,6 +6,8 @@ use App\Enums\Common\Code;
6 use App\Http\Controllers\Bside\BaseController; 6 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;
  10 +use App\Models\Template\Template;
9 11
10 class BTemplateController extends BaseController 12 class BTemplateController extends BaseController
11 { 13 {
@@ -71,10 +73,6 @@ class BTemplateController extends BaseController @@ -71,10 +73,6 @@ class BTemplateController extends BaseController
71 * @time :2023/6/29 10:02 73 * @time :2023/6/29 10:02
72 */ 74 */
73 public function save(TemplateRequest $templateRequest,BTemplateLogic $BTemplateLogic){ 75 public function save(TemplateRequest $templateRequest,BTemplateLogic $BTemplateLogic){
74 - //演示项目,不允许其他号码编辑$this->user['mobile'] != '15928018676' ||  
75 - if(($this->user['project_id'] == 1) && ($this->user['mobile'] != '15680871314') && ($this->param['source'] == 1)){  
76 - $this->response('演示项目仅支持演示功能,无法更改首页',Code::USER_ERROR);  
77 - }  
78 $templateRequest->validated(); 76 $templateRequest->validated();
79 $BTemplateLogic->templateSave(); 77 $BTemplateLogic->templateSave();
80 $this->response('success'); 78 $this->response('success');
@@ -123,4 +121,24 @@ class BTemplateController extends BaseController @@ -123,4 +121,24 @@ class BTemplateController extends BaseController
123 $this->response('success',Code::SUCCESS,$info); 121 $this->response('success',Code::SUCCESS,$info);
124 } 122 }
125 123
  124 + /**
  125 + * @remark :根据项目保存公共模板
  126 + * @name :savePublicTemplate
  127 + * @author :lyh
  128 + * @method :post
  129 + * @time :2023/9/18 10:58
  130 + */
  131 + public function savePublicTemplate(BTemplateLogic $BTemplateLogic){
  132 + $this->request->validate([
  133 + 'name'=>'required',
  134 + 'html'=>'required',
  135 + 'image'=>'required',
  136 + ],[
  137 + 'name.required' => '模板名称不能为空',
  138 + 'html.required' => 'html不能为空',
  139 + 'image.required' => '模板图片不能为空'
  140 + ]);
  141 + $BTemplateLogic->savePublicTemplateHtml();
  142 + $this->response('模板保存成功');
  143 + }
126 } 144 }
@@ -48,6 +48,23 @@ class BTemplateLogController extends BaseController @@ -48,6 +48,23 @@ class BTemplateLogController extends BaseController
48 } 48 }
49 49
50 /** 50 /**
  51 + * @remark :获取数据详情
  52 + * @name :info
  53 + * @author :lyh
  54 + * @method :post
  55 + * @time :2023/9/19 14:41
  56 + */
  57 + public function info(BTemplateLogLogic $logic){
  58 + $this->request->validate([
  59 + 'id'=>['required'],
  60 + ],[
  61 + 'id.required' => '模版ID不能为空',
  62 + ]);
  63 + $info = $logic->templateLogInfo();
  64 + $this->response('success',Code::SUCCESS,$info);
  65 + }
  66 +
  67 + /**
51 * @remark :回滚版本 68 * @remark :回滚版本
52 * @name :rollbackVersion 69 * @name :rollbackVersion
53 * @author :lyh 70 * @author :lyh
@@ -69,13 +69,6 @@ class CustomTemplateController extends BaseController @@ -69,13 +69,6 @@ class CustomTemplateController extends BaseController
69 * @time :2023/6/29 9:30 69 * @time :2023/6/29 9:30
70 */ 70 */
71 public function save(CustomTemplateRequest $customTemplateRequest,CustomTemplateLogic $customTemplateLogic){ 71 public function save(CustomTemplateRequest $customTemplateRequest,CustomTemplateLogic $customTemplateLogic){
72 - if(isset($this->param['id']) && !empty($this->param['id'])){  
73 - $this->request->validate([  
74 - 'id'=>['required'],  
75 - ],[  
76 - 'id.required' => 'ID不能为空',  
77 - ]);  
78 - }  
79 $customTemplateRequest->validated(); 72 $customTemplateRequest->validated();
80 $customTemplateLogic->customTemplateSave(); 73 $customTemplateLogic->customTemplateSave();
81 $this->response('success'); 74 $this->response('success');
@@ -111,7 +104,7 @@ class CustomTemplateController extends BaseController @@ -111,7 +104,7 @@ class CustomTemplateController extends BaseController
111 ],[ 104 ],[
112 'id.required' => 'ID不能为空', 105 'id.required' => 'ID不能为空',
113 ]); 106 ]);
114 - $customTemplateLogic->customTemplateSave(); 107 + $customTemplateLogic->saveHtml();
115 $this->response('success'); 108 $this->response('success');
116 } 109 }
117 } 110 }
@@ -5,7 +5,7 @@ namespace App\Http\Controllers\Bside\Visit; @@ -5,7 +5,7 @@ namespace App\Http\Controllers\Bside\Visit;
5 5
6 use App\Enums\Common\Code; 6 use App\Enums\Common\Code;
7 use App\Http\Controllers\Bside\BaseController; 7 use App\Http\Controllers\Bside\BaseController;
8 -use App\Http\Logic\Bside\VisitLogic; 8 +use App\Http\Logic\Bside\Visit\VisitLogic;
9 9
10 10
11 /** 11 /**
@@ -97,7 +97,7 @@ class FileController @@ -97,7 +97,7 @@ class FileController
97 $size = $files->getSize(); 97 $size = $files->getSize();
98 $file_type = $files->getClientOriginalExtension(); 98 $file_type = $files->getClientOriginalExtension();
99 $mime = $files->getMimeType(); 99 $mime = $files->getMimeType();
100 - return $this->single($files,$size,$file_type,$mime); 100 + return $this->single($files);
101 } 101 }
102 } 102 }
103 103
@@ -108,7 +108,7 @@ class FileController @@ -108,7 +108,7 @@ class FileController
108 * @method :post 108 * @method :post
109 * @time :2023/6/17 16:32 109 * @time :2023/6/17 16:32
110 */ 110 */
111 - public function single(&$files,$size,$file_type,$mime = ''){ 111 + public function single(&$files){
112 $hash = hash_file('md5', $files->getPathname()); 112 $hash = hash_file('md5', $files->getPathname());
113 //查看文件是否存在 113 //查看文件是否存在
114 $fileModel = new File(); 114 $fileModel = new File();
@@ -117,7 +117,7 @@ class FileController @@ -117,7 +117,7 @@ class FileController
117 return $this->response('资源',Code::SUCCESS,$this->responseData($file_hash['path'])); 117 return $this->response('资源',Code::SUCCESS,$this->responseData($file_hash['path']));
118 } 118 }
119 $url = $this->config['root'].$this->path; 119 $url = $this->config['root'].$this->path;
120 - $fileName = uniqid().rand(10000,99999).'.'.$file_type; 120 + $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
121 //同步数据到cos 121 //同步数据到cos
122 if($this->upload_location == 1){ 122 if($this->upload_location == 1){
123 $cosService = new CosService(); 123 $cosService = new CosService();
@@ -128,7 +128,7 @@ class FileController @@ -128,7 +128,7 @@ class FileController
128 return $this->response($files->getError(), Code::USER_ERROR); 128 return $this->response($files->getError(), Code::USER_ERROR);
129 } 129 }
130 } 130 }
131 - $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime); 131 + $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType());
132 return $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName)); 132 return $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName));
133 } 133 }
134 134
@@ -287,7 +287,7 @@ class FileController @@ -287,7 +287,7 @@ class FileController
287 $fileModel = new File(); 287 $fileModel = new File();
288 $lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at']); 288 $lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at']);
289 foreach ($lists as $k => $v){ 289 foreach ($lists as $k => $v){
290 - $v['file_link'] = getFileUrl($v['hash']); 290 + $v['file_link'] = getFileUrl($v['path']);
291 $lists[$k] = $v; 291 $lists[$k] = $v;
292 } 292 }
293 $this->response('success',Code::SUCCESS,$lists); 293 $this->response('success',Code::SUCCESS,$lists);
@@ -303,7 +303,7 @@ class FileController @@ -303,7 +303,7 @@ class FileController
303 public function responseData($path){ 303 public function responseData($path){
304 $data = [ 304 $data = [
305 'file'=>$path, 305 'file'=>$path,
306 - 'file_link'=>getFileUrl($path), 306 + 'file_link'=>getFileUrl($path,$this->upload_location),
307 ]; 307 ];
308 return $data; 308 return $data;
309 } 309 }
@@ -354,7 +354,7 @@ class ImageController extends Controller @@ -354,7 +354,7 @@ class ImageController extends Controller
354 $lists = $imageModel->lists($this->map,$this->page,$this->row); 354 $lists = $imageModel->lists($this->map,$this->page,$this->row);
355 if(!empty($lists) && !empty($lists['list'])){ 355 if(!empty($lists) && !empty($lists['list'])){
356 foreach ($lists['list'] as $k => $v){ 356 foreach ($lists['list'] as $k => $v){
357 - $v['image_link'] = getImageUrl($v['hash']); 357 + $v['image_link'] = getImageUrl($v['path']);
358 $lists['list'][$k] = $v; 358 $lists['list'][$k] = $v;
359 } 359 }
360 } 360 }
@@ -39,6 +39,15 @@ class ServerConfigLogic extends BaseLogic @@ -39,6 +39,15 @@ class ServerConfigLogic extends BaseLogic
39 */ 39 */
40 public function serviceConfigList($map,$page,$row,$order = 'id',$filed = ['*']){ 40 public function serviceConfigList($map,$page,$row,$order = 'id',$filed = ['*']){
41 $lists = $this->model->lists($map,$page,$row,$order,$filed); 41 $lists = $this->model->lists($map,$page,$row,$order,$filed);
  42 + if(!empty($lists) && !empty($lists)){
  43 + $projectModel = new Project();
  44 + foreach ($lists['list'] as $k => $v){
  45 + if($v['type'] == $this->model::TYPE_SERVER){
  46 + $v['count'] = $projectModel->where(['serve_id'=>$v['id']])->count();
  47 + }
  48 + $lists['list'][$k] = $v;
  49 + }
  50 + }
42 return $this->success($lists); 51 return $this->success($lists);
43 } 52 }
44 53
@@ -11,6 +11,7 @@ use App\Models\Manage\JobLevel; @@ -11,6 +11,7 @@ use App\Models\Manage\JobLevel;
11 use App\Models\Manage\Manage; 11 use App\Models\Manage\Manage;
12 use App\Models\Manage\ManageHr; 12 use App\Models\Manage\ManageHr;
13 use App\Models\Manage\Menu; 13 use App\Models\Manage\Menu;
  14 +use Illuminate\Support\Facades\DB;
14 use Illuminate\Support\Facades\Hash; 15 use Illuminate\Support\Facades\Hash;
15 16
16 /** 17 /**
@@ -41,14 +42,77 @@ class HrLogic extends BaseLogic @@ -41,14 +42,77 @@ class HrLogic extends BaseLogic
41 $this->param = $this->setJson($v,$this->param); 42 $this->param = $this->setJson($v,$this->param);
42 } 43 }
43 if(isset($this->param['id']) && !empty($this->param['id'])){ 44 if(isset($this->param['id']) && !empty($this->param['id'])){
44 - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 45 + $this->editHrManager();
45 }else{ 46 }else{
46 - //添加管理员账号  
47 - $this->param['manage_id'] = $this->addManager($this->param['mobile'],$this->param['name']);  
48 - $rs = $this->model->add($this->param); 47 + $this->addHrManager();
49 } 48 }
50 - if($rs === false){  
51 - $this->fail('系统错误'); 49 + return $this->success();
  50 + }
  51 +
  52 + /**
  53 + * @remark :添加人事信息时 同步添加管理员账号
  54 + * @name :addManager
  55 + * @author :lyh
  56 + * @method :post
  57 + * @time :2023/9/6 10:18
  58 + */
  59 + public function addHrManager(){
  60 + $managerModel = new Manage();
  61 + $info = $managerModel->read(['mobile'=>$this->param['mobile']]);
  62 + if($info !== false){
  63 + $this->fail('当前号码已存在');
  64 + }
  65 + $data = [
  66 + 'name'=>$this->param['name'],
  67 + 'mobile'=>$this->param['mobile'],
  68 + 'password'=>Hash::make('globalsov6'),
  69 + 'gid'=>4,
  70 + ];
  71 + DB::beginTransaction();
  72 + try {
  73 + $managerModel = new Manage();
  74 + $this->param['manage_id'] = $managerModel->addReturnId($data);
  75 + $this->model->add($this->param);
  76 + DB::commit();
  77 + }catch (\Exception $e){
  78 + DB::rollBack();
  79 + $this->fail('系统错误请联系管理员');
  80 + }
  81 + return $this->success();
  82 + }
  83 +
  84 + /**
  85 + * @remark :编辑人事信息
  86 + * @name :editHrManager
  87 + * @author :lyh
  88 + * @method :post
  89 + * @time :2023/9/20 15:06
  90 + */
  91 + public function editHrManager(){
  92 + $hrInfo = $this->model->read(['id'=>$this->param['id']],['id','mobile','manage_id']);
  93 + if($hrInfo === false){
  94 + $this->fail('当前数据不存在或已被删除');
  95 + }
  96 + $managerModel = new Manage();
  97 + if($hrInfo['mobile'] != $this->param['mobile']){
  98 + $mobileInfo = $this->model->read(['mobile'=>$this->param['mobile']],['id']);
  99 + if($mobileInfo !== false){
  100 + $this->fail('当前人事信息中手机号已存在');
  101 + }
  102 + $managerMobileInfo = $managerModel->read(['mobile'=>$this->param['mobile']],['id']);
  103 + if($managerMobileInfo !== false){
  104 + $this->fail('当前管理员信息中手机号已存在');
  105 + }
  106 + }
  107 + DB::beginTransaction();
  108 + try {
  109 + //同步更新管理员手机号码
  110 + $managerModel->edit(['mobile'=>$this->param['mobile']],['id'=>$hrInfo['manage_id']]);
  111 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  112 + DB::commit();
  113 + }catch (\Exception $e){
  114 + DB::rollBack();
  115 + $this->fail('系统错误,请联系管理员');
52 } 116 }
53 return $this->success(); 117 return $this->success();
54 } 118 }
@@ -60,22 +124,29 @@ class HrLogic extends BaseLogic @@ -60,22 +124,29 @@ class HrLogic extends BaseLogic
60 * @method :post 124 * @method :post
61 * @time :2023/7/25 9:27 125 * @time :2023/7/25 9:27
62 */ 126 */
63 - public function getHrInfo($id){ 127 + public function getHrInfo(){
64 //查看当前用户是否有人事权限 128 //查看当前用户是否有人事权限
65 - if($this->manager['gid'] != ManageHr::GID_ZERO){ 129 + if(($this->manager['gid'] != ManageHr::GID_ZERO) && isset($this->param['id'])){
66 $groupModel = new Group(); 130 $groupModel = new Group();
67 $groupInfo = $groupModel->read(['id'=>$this->manager['gid']]); 131 $groupInfo = $groupModel->read(['id'=>$this->manager['gid']]);
68 - if (!in_array(20,$groupInfo['rights']) && ($id != $this->manager['id'])) { 132 + if (!in_array(20,$groupInfo['rights']) && ($this->param['id'] != $this->manager['id'])) {
69 $this->fail('无权限查看其他用户信息'); 133 $this->fail('无权限查看其他用户信息');
70 } 134 }
71 } 135 }
72 - $data = $this->model->read(['id'=>$id]); 136 + $data = $this->model->read($this->param);
73 foreach ($this->model::specieField() as $v){ 137 foreach ($this->model::specieField() as $v){
74 $data[$v] = json_decode($data[$v],true); 138 $data[$v] = json_decode($data[$v],true);
75 } 139 }
76 return $this->success($data); 140 return $this->success($data);
77 } 141 }
78 142
  143 + /**
  144 + * @remark :转换
  145 + * @name :setJson
  146 + * @author :lyh
  147 + * @method :post
  148 + * @time :2023/9/20 15:23
  149 + */
79 //数组转json存储 150 //数组转json存储
80 public function setJson($str,$param){ 151 public function setJson($str,$param){
81 if(isset($param[$str]) && is_array($param[$str])){ 152 if(isset($param[$str]) && is_array($param[$str])){
@@ -189,27 +260,6 @@ class HrLogic extends BaseLogic @@ -189,27 +260,6 @@ class HrLogic extends BaseLogic
189 return $this->success($data); 260 return $this->success($data);
190 } 261 }
191 262
192 - /**  
193 - * @remark :添加人事信息时 同步添加管理员账号  
194 - * @name :addManager  
195 - * @author :lyh  
196 - * @method :post  
197 - * @time :2023/9/6 10:18  
198 - */  
199 - public function addManager($mobile,$name){  
200 - $managerModel = new Manage();  
201 - $info = $managerModel->read(['mobile'=>$mobile]);  
202 - if($info !== false){  
203 - $this->fail('当前号码已存在');  
204 - }  
205 - $data = [  
206 - 'name'=>$name,  
207 - 'mobile'=>$mobile,  
208 - 'password'=>Hash::make('globalsov6'),  
209 - 'gid'=>4,  
210 - ];  
211 - return $managerModel->addReturnId($data);  
212 - }  
213 263
214 /** 264 /**
215 * @param $page_size 265 * @param $page_size
@@ -3,9 +3,12 @@ @@ -3,9 +3,12 @@
3 namespace App\Http\Logic\Aside\Manage; 3 namespace App\Http\Logic\Aside\Manage;
4 4
5 5
  6 +use App\Helper\Common;
6 use App\Http\Logic\Aside\BaseLogic; 7 use App\Http\Logic\Aside\BaseLogic;
7 use App\Models\Manage\Manage; 8 use App\Models\Manage\Manage;
  9 +use App\Models\Manage\ManageHr;
8 use App\Models\Manage\Menu; 10 use App\Models\Manage\Menu;
  11 +use Illuminate\Support\Facades\Cache;
9 use Illuminate\Support\Facades\Hash; 12 use Illuminate\Support\Facades\Hash;
10 13
11 /** 14 /**
@@ -31,21 +34,67 @@ class ManageLogic extends BaseLogic @@ -31,21 +34,67 @@ class ManageLogic extends BaseLogic
31 * @time :2023/9/11 9:34 34 * @time :2023/9/11 9:34
32 */ 35 */
33 public function managerSave(){ 36 public function managerSave(){
  37 + try {
34 if(isset($this->param['id']) && !empty($this->param['id'])){ 38 if(isset($this->param['id']) && !empty($this->param['id'])){
35 - if(isset($this->param['password']) && !empty($this->param['password'])){  
36 - $this->param['password'] = Hash::make($this->param['password']);  
37 - }  
38 - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 39 + $this->editManager();
  40 + Common::del_user_cache('manager',$this->param['id'],'A');
39 }else{ 41 }else{
40 - $this->param['password'] = Hash::make($this->param['password']);  
41 - $rs = $this->model->add($this->param); 42 + $this->addManager();
42 } 43 }
43 - if($rs === false){  
44 - $this->fail('error'); 44 + }catch (\Exception $e){
  45 + $this->fail('系统错误,请联系管理员');
45 } 46 }
46 return $this->success(); 47 return $this->success();
47 } 48 }
48 49
  50 + /**
  51 + * @remark :添加管理员
  52 + * @name :addManager
  53 + * @author :lyh
  54 + * @method :post
  55 + * @time :2023/9/20 15:49
  56 + */
  57 + public function addManager(){
  58 + $managerInfo = $this->model->read(['mobile'=>$this->param['mobile']]);
  59 + if($managerInfo !== false){
  60 + $this->fail('当前手机号码已存在');
  61 + }
  62 + $this->param['password'] = Hash::make(isset($this->param['password']) ?? 'globalsov6');
  63 + $this->model->add($this->param);
  64 + $this->success();
  65 + }
  66 +
  67 + /**
  68 + * @remark :编辑管理员
  69 + * @name :editManager
  70 + * @author :lyh
  71 + * @method :post
  72 + * @time :2023/9/20 15:51
  73 + */
  74 + public function editManager(){
  75 + $info = $this->model->read(['id'=>$this->param['id']]);
  76 + if($info['mobile'] != $this->param['mobile']){
  77 + $mobileInfo = $this->model->read(['mobile'=>$this->param['mobile']]);
  78 + if($mobileInfo !== false){
  79 + $this->fail('当前手机号码在管理员信息中已存在');
  80 + }
  81 + //查看人事信息中是否关联当前管理员账号
  82 + $hrManagerModel = new ManageHr();
  83 + $hrInfo = $hrManagerModel->read(['manage_id'=>$this->param['id']]);
  84 + if($hrInfo !== false){
  85 + //查看是否号码在存在人事表中
  86 + $hrMobileInfo = $hrManagerModel->read(['mobile'=>$this->param['mobile']]);
  87 + if($hrMobileInfo !== false){
  88 + $this->fail('当前号码已存在人事信息中');
  89 + }
  90 + $hrManagerModel->edit(['mobile'=>$this->param['mobile']],['manage_id'=>$this->param['id']]);
  91 + }
  92 + }
  93 + if(isset($this->param['password']) && !empty($this->param['password'])){
  94 + $this->param['password'] = Hash::make($this->param['password']);
  95 + }
  96 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  97 + }
49 98
50 /** 99 /**
51 * @remark :设置排序 100 * @remark :设置排序
@@ -78,5 +127,19 @@ class ManageLogic extends BaseLogic @@ -78,5 +127,19 @@ class ManageLogic extends BaseLogic
78 return $this->success($info); 127 return $this->success($info);
79 } 128 }
80 129
81 - 130 + /**
  131 + * @remark :删除
  132 + * @name :managerDelete
  133 + * @author :lyh
  134 + * @method :post
  135 + * @time :2023/9/15 10:45
  136 + */
  137 + public function managerDelete(){
  138 + $rs = $this->model->del(['id'=>['in',$this->param['ids']]]);
  139 + if($rs === false){
  140 + $this->fail('系统错误,请联系管理员');
  141 + }
  142 + Common::del_user_cache('manager',$this->param['ids'],'A');
  143 + return $this->success();
  144 + }
82 } 145 }
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Http\Logic\Aside\Project; 3 namespace App\Http\Logic\Aside\Project;
4 4
  5 +use App\Models\Com\NoticeLog;
5 use App\Models\Devops\ServerConfig; 6 use App\Models\Devops\ServerConfig;
6 use App\Models\Project\ProjectRenew; 7 use App\Models\Project\ProjectRenew;
7 use App\Models\User\ProjectMenu; 8 use App\Models\User\ProjectMenu;
@@ -54,14 +55,9 @@ class ProjectLogic extends BaseLogic @@ -54,14 +55,9 @@ class ProjectLogic extends BaseLogic
54 public function getProjectInfo($id){ 55 public function getProjectInfo($id){
55 $info = $this->model->with('payment')->with('deploy_build')->with('deploy_optimize')->with('online_check') 56 $info = $this->model->with('payment')->with('deploy_build')->with('deploy_optimize')->with('online_check')
56 ->with('project_after')->where(['id'=>$id])->first()->toArray(); 57 ->with('project_after')->where(['id'=>$id])->first()->toArray();
57 - if(!empty($info['online_check']['created_manage_id'])){  
58 - $info['online_check']['name'] = (new Manage())->read(['id'=>$info['online_check']['created_manage_id']])['name'] ?? '';  
59 - }  
60 - if(isset($info['deploy_optimize']['minor_keywords']) && !empty($info['deploy_optimize']['minor_keywords'])){  
61 - $info['deploy_optimize']['minor_keywords'] = json_decode($info['deploy_optimize']['minor_keywords']) ?? '';  
62 - }else{  
63 - $info['deploy_optimize']['minor_keywords'] = [];  
64 - } 58 + $info['online_check']['name'] = (new Manage())->getName(!empty($info['online_check']['created_manage_id']) ?? '');
  59 + $info['deploy_optimize']['minor_keywords'] = json_decode(!empty($info['deploy_optimize']['minor_keywords']) ?? []);
  60 + $info['init_domain'] = $this->getInitDomain($info['serve_id'])['domain'];
65 if($info['extend_type'] != 0){ 61 if($info['extend_type'] != 0){
66 $info['type'] = $info['extend_type']; 62 $info['type'] = $info['extend_type'];
67 } 63 }
@@ -69,6 +65,25 @@ class ProjectLogic extends BaseLogic @@ -69,6 +65,25 @@ class ProjectLogic extends BaseLogic
69 } 65 }
70 66
71 /** 67 /**
  68 + * @remark :获取初始域名
  69 + * @name :getInitDomain
  70 + * @author :lyh
  71 + * @method :post
  72 + * @time :2023/9/16 9:40
  73 + */
  74 + public function getInitDomain($serve_id = ''){
  75 + $domain = '';
  76 + if(!empty($serve_id)){
  77 + $serveModel = new ServerConfig();
  78 + $info = $serveModel->read(['id'=>$serve_id]);
  79 + if($info !== false){
  80 + $domain = $info['init_domain'];
  81 + }
  82 + }
  83 + return $this->success(['domain'=>$domain]);
  84 + }
  85 +
  86 + /**
72 * @remark :保存项目数据 87 * @remark :保存项目数据
73 * @name :projectSave 88 * @name :projectSave
74 * @author :lyh 89 * @author :lyh
@@ -76,7 +91,6 @@ class ProjectLogic extends BaseLogic @@ -76,7 +91,6 @@ class ProjectLogic extends BaseLogic
76 * @time :2023/8/30 11:57 91 * @time :2023/8/30 11:57
77 */ 92 */
78 public function projectSave(){ 93 public function projectSave(){
79 -  
80 DB::beginTransaction(); 94 DB::beginTransaction();
81 try { 95 try {
82 if($this->param['type'] == Project::TYPE_SEVEN){ 96 if($this->param['type'] == Project::TYPE_SEVEN){
@@ -199,6 +213,13 @@ class ProjectLogic extends BaseLogic @@ -199,6 +213,13 @@ class ProjectLogic extends BaseLogic
199 if(isset($deploy_optimize['minor_keywords']) && !empty($deploy_optimize['minor_keywords'])){ 213 if(isset($deploy_optimize['minor_keywords']) && !empty($deploy_optimize['minor_keywords'])){
200 $deploy_optimize['minor_keywords'] = Arr::a2s($deploy_optimize['minor_keywords']); 214 $deploy_optimize['minor_keywords'] = Arr::a2s($deploy_optimize['minor_keywords']);
201 } 215 }
  216 +
  217 + //是否更新了api_no
  218 + $api_no = DeployOptimize::where('id', $deploy_optimize['id'])->value('api_no');
  219 + if($api_no != $deploy_optimize['api_no']){
  220 + NoticeLog::createLog(NoticeLog::TYPE_RANK_DATA, ['api_no' => $deploy_optimize['api_no']]);
  221 + }
  222 +
202 $deployOptimizeModel->edit($deploy_optimize,['id'=>$deploy_optimize['id']]); 223 $deployOptimizeModel->edit($deploy_optimize,['id'=>$deploy_optimize['id']]);
203 return $this->success(); 224 return $this->success();
204 } 225 }
@@ -228,7 +249,7 @@ class ProjectLogic extends BaseLogic @@ -228,7 +249,7 @@ class ProjectLogic extends BaseLogic
228 //查看当前项目状态是否为初始项目 249 //查看当前项目状态是否为初始项目
229 $info = $this->model->read(['id'=>$param['id']]); 250 $info = $this->model->read(['id'=>$param['id']]);
230 //项目为初始项目时,只能选择建站中 251 //项目为初始项目时,只能选择建站中
231 - if($info['type'] == Project::TYPE_ZERO){ 252 + if(($info['type'] == Project::TYPE_ZERO) && ($info['type'] != Project::TYPE_FIVE)){
232 $param['type'] = Project::TYPE_ONE; 253 $param['type'] = Project::TYPE_ONE;
233 } 254 }
234 //创建默认数据库 255 //创建默认数据库
@@ -237,8 +258,6 @@ class ProjectLogic extends BaseLogic @@ -237,8 +258,6 @@ class ProjectLogic extends BaseLogic
237 if(isset($param['mysql_id']) && !empty($param['mysql_id'])){ 258 if(isset($param['mysql_id']) && !empty($param['mysql_id'])){
238 $this->initializationMysql($param['id']); 259 $this->initializationMysql($param['id']);
239 } 260 }
240 - //创建初始角色  
241 -// $this->createdRole($param['id']);  
242 //初始账号 261 //初始账号
243 if(isset($param['mobile']) && !empty($param['mobile'])){ 262 if(isset($param['mobile']) && !empty($param['mobile'])){
244 $this->createUser($param['mobile'],$param['id'],$param['lead_name']); 263 $this->createUser($param['mobile'],$param['id'],$param['lead_name']);
@@ -299,9 +318,12 @@ class ProjectLogic extends BaseLogic @@ -299,9 +318,12 @@ class ProjectLogic extends BaseLogic
299 ProjectServer::createDatabase($project); 318 ProjectServer::createDatabase($project);
300 //创建表 319 //创建表
301 ProjectServer::initTable(); 320 ProjectServer::initTable();
  321 + //初始数据
  322 + ProjectServer::saveInitParam($project_id);
302 return $this->success(); 323 return $this->success();
303 } 324 }
304 325
  326 +
305 /** 327 /**
306 * @remark :更新服务器为已使用 328 * @remark :更新服务器为已使用
307 * @name :updateServe 329 * @name :updateServe
@@ -10,8 +10,10 @@ @@ -10,8 +10,10 @@
10 namespace App\Http\Logic\Aside\Project; 10 namespace App\Http\Logic\Aside\Project;
11 11
12 use App\Http\Logic\Aside\BaseLogic; 12 use App\Http\Logic\Aside\BaseLogic;
  13 +use App\Models\Project\DeployBuild;
13 use App\Models\Project\Project; 14 use App\Models\Project\Project;
14 use App\Models\Project\ProjectRenew; 15 use App\Models\Project\ProjectRenew;
  16 +use Illuminate\Support\Facades\DB;
15 17
16 class RenewLogic extends BaseLogic 18 class RenewLogic extends BaseLogic
17 { 19 {
@@ -32,8 +34,10 @@ class RenewLogic extends BaseLogic @@ -32,8 +34,10 @@ class RenewLogic extends BaseLogic
32 public function renewListsLog($map,$page,$row,$order,$field = ['*']){ 34 public function renewListsLog($map,$page,$row,$order,$field = ['*']){
33 $lists = $this->model->lists($map,$page,$row,$order,$field); 35 $lists = $this->model->lists($map,$page,$row,$order,$field);
34 if(!empty($lists['list'])){ 36 if(!empty($lists['list'])){
  37 + $projectModel = new Project();
35 foreach ($lists['list'] as $k => $v){ 38 foreach ($lists['list'] as $k => $v){
36 $v['plan'] = Project::planMap()[$v['plan']]; 39 $v['plan'] = Project::planMap()[$v['plan']];
  40 + $v['project_name'] = $projectModel->getProjectName($v['project_id']);
37 $lists['list'][$k] = $v; 41 $lists['list'][$k] = $v;
38 } 42 }
39 } 43 }
@@ -54,4 +58,52 @@ class RenewLogic extends BaseLogic @@ -54,4 +58,52 @@ class RenewLogic extends BaseLogic
54 } 58 }
55 return $this->success($info); 59 return $this->success($info);
56 } 60 }
  61 +
  62 + /**
  63 + * @remark :关联续费单
  64 + * @name :editProjectRenew
  65 + * @author :lyh
  66 + * @method :post
  67 + * @time :2023/9/19 10:21
  68 + */
  69 + public function editProjectRenew(){
  70 + //获取续费单详情
  71 + $info = $this->model->read(['id'=>$this->param['renew_id']]);
  72 + if($info === false){
  73 + $this->fail('当前续费单不存在');
  74 + }
  75 + if($info['project_id'] != 0){
  76 + $this->fail('当前续费单已关联项目,请重新选择');
  77 + }
  78 + DB::beginTransaction();
  79 + try {
  80 + $this->model->edit(['project_id'=>$this->param['id'],'operator_id'=>$this->manager['id']],['id'=>$this->param['renew_id']]);
  81 + $project = new Project();
  82 + $project->edit(['extend_type'=>0],['id'=>$this->param['id']]);
  83 + $deployBuild = new DeployBuild();
  84 + $deployBuild->edit(
  85 + ['service_duration'=>DB::raw('service_duration + ' . $info['service_duration']),
  86 + 'plan'=>$info['plan']], ['project_id'=>$this->param['id']]);
  87 + DB::commit();
  88 + }catch (\Exception $e){
  89 + DB::rollBack();
  90 + $this->fail('系统错误,请联系管理员');
  91 + }
  92 + return $this->success();
  93 + }
  94 +
  95 + /**
  96 + * @remark :编辑续费单状态
  97 + * @name :editStatus
  98 + * @author :lyh
  99 + * @method :post
  100 + * @time :2023/9/19 15:50
  101 + */
  102 + public function editStatus(){
  103 + $rs = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]);
  104 + if($rs === false){
  105 + $this->fail('系统错误,请联系管理员');
  106 + }
  107 + return $this->success();
  108 + }
57 } 109 }
@@ -145,6 +145,7 @@ class ATemplateLogic extends BaseLogic @@ -145,6 +145,7 @@ class ATemplateLogic extends BaseLogic
145 DB::rollBack(); 145 DB::rollBack();
146 $this->fail('error'); 146 $this->fail('error');
147 } 147 }
  148 + return $this->success();
148 } 149 }
149 150
150 /** 151 /**
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 namespace App\Http\Logic\Bside\BTemplate; 10 namespace App\Http\Logic\Bside\BTemplate;
11 11
12 use App\Http\Logic\Bside\BaseLogic; 12 use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\Service\Service as ServiceSettingModel;
13 use App\Models\Template\BTemplate; 14 use App\Models\Template\BTemplate;
14 use App\Models\Template\BTemplateLog; 15 use App\Models\Template\BTemplateLog;
15 16
@@ -35,6 +36,11 @@ class BTemplateLogLogic extends BaseLogic @@ -35,6 +36,11 @@ class BTemplateLogLogic extends BaseLogic
35 if($info === false){ 36 if($info === false){
36 $this->fail('error'); 37 $this->fail('error');
37 } 38 }
  39 + $bTemplateModel = new BTemplate();
  40 + //演示项目,不允许其他号码编辑
  41 + if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){
  42 + $this->fail('演示项目仅支持演示功能,无法更改首页');
  43 + }
38 $data = $this->setParam($info); 44 $data = $this->setParam($info);
39 $BTemplateModel = new BTemplate(); 45 $BTemplateModel = new BTemplate();
40 $rs = $BTemplateModel->edit($data,['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]); 46 $rs = $BTemplateModel->edit($data,['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]);
@@ -63,4 +69,25 @@ class BTemplateLogLogic extends BaseLogic @@ -63,4 +69,25 @@ class BTemplateLogLogic extends BaseLogic
63 ]; 69 ];
64 return $this->success($data); 70 return $this->success($data);
65 } 71 }
  72 +
  73 + /**
  74 + * @remark :获取数据详情
  75 + * @name :templateLogInfo
  76 + * @author :lyh
  77 + * @method :post
  78 + * @time :2023/9/19 14:42
  79 + */
  80 + public function templateLogInfo(){
  81 + $info = $this->model->read($this->param);
  82 + if($info === false){
  83 + $this->fail('当前数据不存在,或已被删除');
  84 + }
  85 + $serviceSettingModel = new ServiceSettingModel();
  86 + $list = $serviceSettingModel->list(['type'=>2],'created_at');
  87 + $data = [
  88 + 'info' => $info,
  89 + 'header_footer'=>$list,
  90 + ];
  91 + return $this->success($data);
  92 + }
66 } 93 }
@@ -174,6 +174,10 @@ class BTemplateLogic extends BaseLogic @@ -174,6 +174,10 @@ class BTemplateLogic extends BaseLogic
174 * @time :2023/6/29 11:05 174 * @time :2023/6/29 11:05
175 */ 175 */
176 public function templateSave(){ 176 public function templateSave(){
  177 + //演示项目,不允许其他号码编辑
  178 + if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$this->model->mobile)) && ($this->param['source'] == 1)){
  179 + $this->fail('演示项目仅支持演示功能,无法更改首页');
  180 + }
177 //查询当前模版是否已保存 181 //查询当前模版是否已保存
178 DB::beginTransaction(); 182 DB::beginTransaction();
179 try { 183 try {
@@ -187,8 +191,6 @@ class BTemplateLogic extends BaseLogic @@ -187,8 +191,6 @@ class BTemplateLogic extends BaseLogic
187 $this->model->edit($this->param,['id'=>$info['id']]); 191 $this->model->edit($this->param,['id'=>$info['id']]);
188 } 192 }
189 $this->setTemplateLog($this->param); 193 $this->setTemplateLog($this->param);
190 - //路由映射  
191 - RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);  
192 DB::commit(); 194 DB::commit();
193 }catch (\Exception $e){ 195 }catch (\Exception $e){
194 DB::rollBack(); 196 DB::rollBack();
@@ -236,6 +238,8 @@ class BTemplateLogic extends BaseLogic @@ -236,6 +238,8 @@ class BTemplateLogic extends BaseLogic
236 if($source == BTemplate::SOURCE_HOME){ 238 if($source == BTemplate::SOURCE_HOME){
237 $type = 'index'; 239 $type = 'index';
238 $route = ''; 240 $route = '';
  241 + //路由映射
  242 + RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
239 }elseif($source == BTemplate::SOURCE_PRODUCT){ 243 }elseif($source == BTemplate::SOURCE_PRODUCT){
240 $type = RouteMap::SOURCE_PRODUCT; 244 $type = RouteMap::SOURCE_PRODUCT;
241 $productModel = new Product(); 245 $productModel = new Product();
@@ -364,67 +368,10 @@ class BTemplateLogic extends BaseLogic @@ -364,67 +368,10 @@ class BTemplateLogic extends BaseLogic
364 */ 368 */
365 public function getModuleType(): array 369 public function getModuleType(): array
366 { 370 {
367 - //前端会回传:products:1,news:2,blogs:3,productCategory:4  
368 //定义数据结构 371 //定义数据结构
369 - $data = [  
370 - "products"=>[  
371 - "category"=>[  
372 - [  
373 - "id"=>"all",  
374 - "title"=>"全部",  
375 - ],  
376 - [  
377 - "id"=>"hot",  
378 - "title"=>"热销产品",  
379 - ],  
380 - [  
381 - "id"=>"recommend",  
382 - "title"=>"推荐产品",  
383 - ],  
384 - ],  
385 - "imageType"=>[  
386 - [  
387 - "id"=>1,  
388 - "title"=>"产品图片",  
389 - ],[  
390 - "id"=>2,  
391 - "title"=>"产品分类图片",  
392 - ],[  
393 - "id"=>3,  
394 - "title"=>"产品图标",  
395 - ]  
396 - ],  
397 - ],  
398 - "news"=>[  
399 - "category"=>[  
400 - [  
401 - "id"=>"all",  
402 - "name"=>"全部",  
403 - ],  
404 - [  
405 - "id"=>"new",  
406 - "name"=>"最新",  
407 - ],  
408 - ],  
409 - ],  
410 - "blogs"=>[  
411 - "category"=>[  
412 - [  
413 - "id"=>"all",  
414 - "name"=>"全部",  
415 - ],  
416 - [  
417 - "id"=>"new",  
418 - "name"=>"最新",  
419 - ],  
420 - ],  
421 - ]  
422 - ]; 372 + $data = $this->model->product_type;
423 //产品,新闻,博客,一级分类数据 373 //产品,新闻,博客,一级分类数据
424 - $map = [  
425 - 'pid'=>0,  
426 - 'project_id'=>$this->user['project_id']  
427 - ]; 374 + $map = ['pid'=>0, 'project_id'=>$this->user['project_id']];
428 $productCategory = Category::where($map)->get(); 375 $productCategory = Category::where($map)->get();
429 $newCategory = NewsCategory::where($map)->get(); 376 $newCategory = NewsCategory::where($map)->get();
430 $blogCategory = BlogCategory::where($map)->get(); 377 $blogCategory = BlogCategory::where($map)->get();
@@ -447,4 +394,22 @@ class BTemplateLogic extends BaseLogic @@ -447,4 +394,22 @@ class BTemplateLogic extends BaseLogic
447 return $this->success($data); 394 return $this->success($data);
448 } 395 }
449 396
  397 + /**
  398 + * @remark :保存html
  399 + * @name :savePublicTemplateHtml
  400 + * @author :lyh
  401 + * @method :post
  402 + * @time :2023/9/18 11:19
  403 + */
  404 + public function savePublicTemplateHtml(){
  405 + $this->param['project_id'] = $this->user['project_id'];
  406 + $this->param['operator_id'] = $this->user['manager_id'] ?? 0;
  407 + $this->param = $this->stringProcessing($this->param);
  408 + $publicTemplateModel = new Template();
  409 + $rs = $publicTemplateModel->add($this->param);
  410 + if($rs === false){
  411 + $this->fail('系统错误,请联系管理员');
  412 + }
  413 + return $this->success();
  414 + }
450 } 415 }
@@ -57,36 +57,63 @@ class CustomTemplateLogic extends BaseLogic @@ -57,36 +57,63 @@ class CustomTemplateLogic extends BaseLogic
57 * @time :2023/6/29 16:21 57 * @time :2023/6/29 16:21
58 */ 58 */
59 public function customTemplateSave(){ 59 public function customTemplateSave(){
  60 + try {
  61 + $this->param['url'] = str_replace_url($this->param['url']);
60 if(isset($this->param['id']) && !empty($this->param['id'])){ 62 if(isset($this->param['id']) && !empty($this->param['id'])){
61 - if(isset($this->param['html']) && !empty($this->param['html'])){  
62 - $html = $this->param['html'];  
63 - $this->param['html'] = characterTruncation($html,'/<main>(.*?)<\/main>/s');  
64 - $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');  
65 - }  
66 - $id = $this->param['id'];  
67 - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);  
68 - if($rs === false){  
69 - $this->fail('error');  
70 - } 63 + $id = $this->editCustomRoute($this->param['id'],$this->param['url']);
  64 + $this->model->edit($this->param,['id'=>$this->param['id']]);
71 }else{ 65 }else{
72 $this->param['project_id'] = $this->user['project_id']; 66 $this->param['project_id'] = $this->user['project_id'];
73 $id = $this->model->addReturnId($this->param); 67 $id = $this->model->addReturnId($this->param);
74 - if($id === false){ 68 + }
  69 + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
  70 + $this->model->edit(['url'=>$route],['id'=>$id]);
  71 + }catch (\Exception $e){
75 $this->fail('error'); 72 $this->fail('error');
76 } 73 }
  74 + return $this->success();
  75 + }
  76 +
  77 + /**
  78 + * @remark :可视化保存html
  79 + * @name :saveHtml
  80 + * @author :lyh
  81 + * @method :post
  82 + * @time :2023/9/16 17:13
  83 + */
  84 + public function saveHtml(){
  85 + $html = $this->param['html'];
  86 + $this->param['html'] = characterTruncation($html,'/<main>(.*?)<\/main>/s');
  87 + $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
  88 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
  89 + if($rs === false){
  90 + $this->fail('系统错误,请联系管理');
77 } 91 }
78 - //路由映射  
79 - if(isset($this->param['url']) && !empty($this->param['url'])){  
80 - $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);  
81 //TODO::通知网站更新 92 //TODO::通知网站更新
  93 + $info = $this->model->read(['id'=>$this->param['id']],['id','url']);
  94 + $data = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PAGE, 'route'=>$info['url']];
  95 + $this->updateNotify($data);
  96 + return $this->success();
  97 + }
  98 +
  99 + /**
  100 + * @remark :查看路由是否更新
  101 + * @name :editProduct
  102 + * @author :lyh
  103 + * @method :post
  104 + * @time :2023/9/7 10:02
  105 + */
  106 + public function editCustomRoute($id,$route){
  107 + $info = $this->model->read(['id'=>$this->param['id']]);
  108 + if($info['url'] != $route){
  109 + //生成一条删除路由记录
82 $data = [ 110 $data = [
83 - 'project_id'=>$this->user['project_id'],  
84 - 'type'=>RouteMap::SOURCE_PAGE, 111 + 'source'=>RouteMap::SOURCE_PAGE,
85 'route'=>$route, 112 'route'=>$route,
86 ]; 113 ];
87 - $this->updateNotify($data); 114 + $this->setRouteDeleteSave($data);
88 } 115 }
89 - return $this->success(); 116 + return $id;
90 } 117 }
91 118
92 /** 119 /**
@@ -149,7 +149,7 @@ class BaseLogic extends Logic @@ -149,7 +149,7 @@ class BaseLogic extends Logic
149 function updateNotify($data) 149 function updateNotify($data)
150 { 150 {
151 $updateNotifyModel = new UpdateNotify(); 151 $updateNotifyModel = new UpdateNotify();
152 - $info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>0]); 152 + $info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>1]);
153 if($info === false){ 153 if($info === false){
154 $param = [ 154 $param = [
155 'project_id'=>$data['project_id'], 155 'project_id'=>$data['project_id'],
@@ -158,6 +158,9 @@ class BaseLogic extends Logic @@ -158,6 +158,9 @@ class BaseLogic extends Logic
158 ]; 158 ];
159 $updateNotifyModel->add($param); 159 $updateNotifyModel->add($param);
160 } 160 }
  161 + //单页面直接通知更新
  162 + $url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$data['route'];
  163 + curlGet($url);
161 return $this->success(); 164 return $this->success();
162 } 165 }
163 166
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Bside\Import;
  4 +
  5 +use App\Http\Logic\Bside\BaseLogic;
  6 +use App\Models\Import\ImportTask;
  7 +
  8 +
  9 +class ImportLogic extends BaseLogic
  10 +{
  11 + public function __construct()
  12 + {
  13 + parent::__construct();
  14 + $this->param = $this->requestAll;
  15 + $this->model = new ImportTask();
  16 + }
  17 +
  18 + /**
  19 + * 新增导入任务
  20 + * @return array
  21 + * @throws \App\Exceptions\AsideGlobalException
  22 + * @throws \App\Exceptions\BsideGlobalException
  23 + * @author Akun
  24 + * @date 2023/09/20 11:17
  25 + */
  26 + public function addImportTask()
  27 + {
  28 + $this->param['project_id'] = $this->user['project_id'];
  29 + $this->param['user_id'] = $this->user['id'];
  30 + $rs = $this->model->add($this->param);
  31 + if($rs === false){
  32 + $this->fail('error');
  33 + }
  34 + return $this->success();
  35 + }
  36 +}
1 <?php 1 <?php
2 2
3 -namespace App\Http\Logic\Bside; 3 +namespace App\Http\Logic\Bside\Inquiry;
4 4
5 use App\Helper\Arr; 5 use App\Helper\Arr;
6 use App\Helper\FormGlobalsoApi; 6 use App\Helper\FormGlobalsoApi;
7 use App\Helper\Translate; 7 use App\Helper\Translate;
8 use App\Http\Logic\Aside\Project\ProjectLogic; 8 use App\Http\Logic\Aside\Project\ProjectLogic;
  9 +use App\Http\Logic\Bside\BaseLogic;
9 10
10 /** 11 /**
11 * Class InquiryLogic 12 * Class InquiryLogic
@@ -36,6 +36,9 @@ class NavLogic extends BaseLogic @@ -36,6 +36,9 @@ class NavLogic extends BaseLogic
36 { 36 {
37 DB::beginTransaction(); 37 DB::beginTransaction();
38 try { 38 try {
  39 + if(isset($this->param['image']) && !empty($this->param['image'])){
  40 + $this->param['image'] = str_replace_url($this->param['image']);
  41 + }
39 if(isset($this->param['id']) && !empty($this->param['id'])){ 42 if(isset($this->param['id']) && !empty($this->param['id'])){
40 $this->handleEditParam();//验证是否可编辑分类 43 $this->handleEditParam();//验证是否可编辑分类
41 $this->model->edit($this->param,['id'=>$this->param['id']]); 44 $this->model->edit($this->param,['id'=>$this->param['id']]);
@@ -60,8 +60,8 @@ class NewsCategoryLogic extends BaseLogic @@ -60,8 +60,8 @@ class NewsCategoryLogic extends BaseLogic
60 public function newsCategorySave(){ 60 public function newsCategorySave(){
61 //验证名称是否存在 61 //验证名称是否存在
62 $this->verifyParamName($this->param['name']); 62 $this->verifyParamName($this->param['name']);
63 -// DB::beginTransaction();  
64 -// try { 63 + DB::beginTransaction();
  64 + try {
65 if(isset($this->param['id']) && !empty($this->param['id'])){ 65 if(isset($this->param['id']) && !empty($this->param['id'])){
66 //验证是否可编辑 66 //验证是否可编辑
67 $this->verifyEditParam($this->param['id'],$this->param['pid']); 67 $this->verifyEditParam($this->param['id'],$this->param['pid']);
@@ -77,11 +77,11 @@ class NewsCategoryLogic extends BaseLogic @@ -77,11 +77,11 @@ class NewsCategoryLogic extends BaseLogic
77 } 77 }
78 $route = RouteMap::setRoute(isset($this->param['alias']) ? $this->param['alias'] : $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); 78 $route = RouteMap::setRoute(isset($this->param['alias']) ? $this->param['alias'] : $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
79 $this->model->edit(['alias'=>$route],['id'=>$id]); 79 $this->model->edit(['alias'=>$route],['id'=>$id]);
80 -// DB::commit();  
81 -// }catch (\Exception $e){  
82 -// DB::rollBack();  
83 -// $this->fail('error');  
84 -// } 80 + DB::commit();
  81 + }catch (\Exception $e){
  82 + DB::rollBack();
  83 + $this->fail('error');
  84 + }
85 //更新通知记录表 85 //更新通知记录表
86 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$route]); 86 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$route]);
87 return $this->success(); 87 return $this->success();
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Http\Logic\Bside\Product; 3 namespace App\Http\Logic\Bside\Product;
4 4
5 use App\Helper\Arr; 5 use App\Helper\Arr;
  6 +use App\Helper\Common;
6 use App\Http\Logic\Bside\BaseLogic; 7 use App\Http\Logic\Bside\BaseLogic;
7 use App\Models\Product\Category; 8 use App\Models\Product\Category;
8 use App\Models\Product\Product; 9 use App\Models\Product\Product;
@@ -77,17 +78,15 @@ class CategoryLogic extends BaseLogic @@ -77,17 +78,15 @@ class CategoryLogic extends BaseLogic
77 //路由映射 78 //路由映射
78 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); 79 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
79 $this->edit(['route'=>$route],['id'=>$id]); 80 $this->edit(['route'=>$route],['id'=>$id]);
  81 + //清除缓存
  82 + Common::del_user_cache('product_category',$this->user['project_id']);
80 DB::commit(); 83 DB::commit();
81 } catch (\Exception $e){ 84 } catch (\Exception $e){
82 DB::rollBack(); 85 DB::rollBack();
83 - $this->fail('保存失败'); 86 + $this->fail('系统错误,请联系管理员');
84 } 87 }
85 //通知更新 88 //通知更新
86 - $notifyData = [  
87 - 'project_id'=>$this->user['project_id'],  
88 - 'type'=>RouteMap::SOURCE_PRODUCT_CATE,  
89 - 'route'=>$route  
90 - ]; 89 + $notifyData = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_CATE, 'route'=>$route];
91 $this->updateNotify($notifyData); 90 $this->updateNotify($notifyData);
92 return $this->success(); 91 return $this->success();
93 } 92 }
@@ -158,6 +157,8 @@ class CategoryLogic extends BaseLogic @@ -158,6 +157,8 @@ class CategoryLogic extends BaseLogic
158 $this->delRoute($id); 157 $this->delRoute($id);
159 $this->model->del(['id'=>$id]); 158 $this->model->del(['id'=>$id]);
160 } 159 }
  160 + //清除缓存
  161 + Common::del_user_cache('product_category',$this->user['project_id']);
161 DB::commit(); 162 DB::commit();
162 }catch (\Exception $e){ 163 }catch (\Exception $e){
163 DB::rollBack(); 164 DB::rollBack();
@@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\Product; @@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\Product;
4 4
5 use App\Exceptions\BsideGlobalException; 5 use App\Exceptions\BsideGlobalException;
6 use App\Helper\Arr; 6 use App\Helper\Arr;
  7 +use App\Helper\Common;
7 use App\Http\Logic\Bside\BaseLogic; 8 use App\Http\Logic\Bside\BaseLogic;
8 use App\Models\Product\Keyword; 9 use App\Models\Product\Keyword;
9 use App\Models\Product\KeywordRelated; 10 use App\Models\Product\KeywordRelated;
@@ -51,9 +52,9 @@ class KeywordLogic extends BaseLogic @@ -51,9 +52,9 @@ class KeywordLogic extends BaseLogic
51 DB::beginTransaction(); 52 DB::beginTransaction();
52 try { 53 try {
53 if(isset($this->param['id']) && !empty($this->param['id'])){ 54 if(isset($this->param['id']) && !empty($this->param['id'])){
54 - $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $this->param['id'], $this->user['project_id']);  
55 - $id = $this->editCategoryRoute($this->param['id'],$route);  
56 - $this->model->edit($this->param,['id'=>$this->param['id']]); 55 + $info = $this->model->read(['id'=>$this->param['id']],['id','route']);
  56 + $route = $info['route'];
  57 + $this->model->edit($this->param,['id'=>$info['id']]);
57 }else{ 58 }else{
58 $this->param['project_id'] = $this->user['project_id']; 59 $this->param['project_id'] = $this->user['project_id'];
59 $this->param['created_at'] = date('Y-m-d H:i:s'); 60 $this->param['created_at'] = date('Y-m-d H:i:s');
@@ -61,8 +62,10 @@ class KeywordLogic extends BaseLogic @@ -61,8 +62,10 @@ class KeywordLogic extends BaseLogic
61 $id = $this->model->insertGetId($this->param); 62 $id = $this->model->insertGetId($this->param);
62 //路由映射 63 //路由映射
63 $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); 64 $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
64 - }  
65 $this->model->edit(['route'=>$route],['id'=>$id]); 65 $this->model->edit(['route'=>$route],['id'=>$id]);
  66 + }
  67 + //清除缓存
  68 + Common::del_user_cache('product_keyword',$this->user['project_id']);
66 DB::commit(); 69 DB::commit();
67 }catch (\Exception $e){ 70 }catch (\Exception $e){
68 DB::rollBack(); 71 DB::rollBack();
@@ -74,26 +77,6 @@ class KeywordLogic extends BaseLogic @@ -74,26 +77,6 @@ class KeywordLogic extends BaseLogic
74 } 77 }
75 78
76 /** 79 /**
77 - * @remark :编辑路由时生成路由记录  
78 - * @name :editCategoryRoute  
79 - * @author :lyh  
80 - * @method :post  
81 - * @time :2023/9/7 10:51  
82 - */  
83 - public function editCategoryRoute($id,$route){  
84 - //生成一条删除路由记录  
85 - $info = $this->model->read(['id'=>$id],['id','route']);  
86 - if($info['route'] != $route){  
87 - $data = [  
88 - 'source'=>RouteMap::SOURCE_PRODUCT_KEYWORD,  
89 - 'route'=>$info['route'],  
90 - ];  
91 - $this->setRouteDeleteSave($data);  
92 - }  
93 - return $id;  
94 - }  
95 -  
96 - /**  
97 * @remark :批量添加数据 80 * @remark :批量添加数据
98 * @name :batchAdd 81 * @name :batchAdd
99 * @author :lyh 82 * @author :lyh
@@ -132,6 +115,8 @@ class KeywordLogic extends BaseLogic @@ -132,6 +115,8 @@ class KeywordLogic extends BaseLogic
132 $this->delRoute($id); 115 $this->delRoute($id);
133 $this->model->del(['id'=>$id]); 116 $this->model->del(['id'=>$id]);
134 } 117 }
  118 + //清除缓存
  119 + Common::del_user_cache('product_keyword',$this->user['project_id']);
135 return $this->success(); 120 return $this->success();
136 } 121 }
137 122
@@ -49,7 +49,6 @@ class ProductLogic extends BaseLogic @@ -49,7 +49,6 @@ class ProductLogic extends BaseLogic
49 } 49 }
50 //路由映射 50 //路由映射
51 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); 51 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
52 - //更新路由  
53 $this->model->edit(['route'=>$route],['id'=>$id]); 52 $this->model->edit(['route'=>$route],['id'=>$id]);
54 DB::commit(); 53 DB::commit();
55 }catch (\Exception $e){ 54 }catch (\Exception $e){
@@ -287,14 +286,20 @@ class ProductLogic extends BaseLogic @@ -287,14 +286,20 @@ class ProductLogic extends BaseLogic
287 'created_at'=>date('Y-m-d H:i:s'), 286 'created_at'=>date('Y-m-d H:i:s'),
288 'updated_at'=>date('Y-m-d H:i:s'), 287 'updated_at'=>date('Y-m-d H:i:s'),
289 ]; 288 ];
290 - if(!empty($info['thumb'])){  
291 - $param['thumb']= Arr::a2s($info['thumb']); 289 + if(isset($info['icon']) && !empty($info['icon'])){
  290 + foreach ($info['icon'] as $k1 => $v1){
  291 + $info['icon'][$k1] = str_replace_url($v1);
292 } 292 }
293 - if(!empty($info['gallery'])){  
294 - $param['gallery']= Arr::a2s($info['gallery']); 293 + $param['icon'] = Arr::a2s($info['icon'] ?? '');
295 } 294 }
296 - if(!empty($info['icon'])){  
297 - $param['icon']= Arr::a2s($info['icon']); 295 + //产品图
  296 + if(isset($info['gallery']) && !empty($info['gallery'])){
  297 + foreach ($info['gallery'] as $k => $v){
  298 + $v['url'] = str_replace_url($v['url']);
  299 + $info['gallery'][$k] = $v;
  300 + }
  301 + $param['thumb'] = Arr::a2s($info['gallery'][0] ?? '');
  302 + $param['gallery'] = Arr::a2s($info['gallery'] ?? '');
298 } 303 }
299 return $param; 304 return $param;
300 } 305 }
1 <?php 1 <?php
2 2
3 -namespace App\Http\Logic\Bside; 3 +namespace App\Http\Logic\Bside\RankData;
4 4
5 5
6 use App\Helper\Arr; 6 use App\Helper\Arr;
@@ -8,6 +8,9 @@ use App\Helper\QuanqiusouApi; @@ -8,6 +8,9 @@ use App\Helper\QuanqiusouApi;
8 use App\Helper\Translate; 8 use App\Helper\Translate;
9 use App\Http\Logic\Aside\Project\DomainInfoLogic; 9 use App\Http\Logic\Aside\Project\DomainInfoLogic;
10 use App\Http\Logic\Aside\Project\ProjectLogic; 10 use App\Http\Logic\Aside\Project\ProjectLogic;
  11 +use App\Http\Logic\Bside\BaseLogic;
  12 +use App\Models\Project\DeployBuild;
  13 +use App\Models\Project\DeployOptimize;
11 use App\Models\Project\Project; 14 use App\Models\Project\Project;
12 use App\Models\RankData\ExternalLinks; 15 use App\Models\RankData\ExternalLinks;
13 use App\Models\RankData\IndexedPages; 16 use App\Models\RankData\IndexedPages;
@@ -346,4 +349,137 @@ class RankDataLogic extends BaseLogic @@ -346,4 +349,137 @@ class RankDataLogic extends BaseLogic
346 } 349 }
347 return $flg_ai; 350 return $flg_ai;
348 } 351 }
  352 +
  353 + /**
  354 + * 同步排名信息
  355 + * @throws \Exception
  356 + * @author zbj
  357 + * @date 2023/9/20
  358 + */
  359 + public function syncRankData($api_no, $site_res){
  360 + $project_id = DeployOptimize::where('api_no', $api_no)->value('project_id');
  361 + $project = Project::find($project_id);
  362 + if(!$project){
  363 + throw new \Exception($api_no . '关联的项目不存在');
  364 + }
  365 +
  366 + $api = new QuanqiusouApi();
  367 +
  368 + $model = RankData::where('project_id', $project_id)->where('lang', '')->first();
  369 + if (!$model || $model->updated_date != date('Y-m-d')) {
  370 + $res = $api->getGoogleRank($api_no);
  371 + if(!$res){
  372 + throw new \Exception('接口数据获取失败');
  373 + }
  374 + //收录数
  375 + $indexed_pages_num = $site_res[$api_no] ?? 0;
  376 + $this->save_rank($project_id, $res, $indexed_pages_num);
  377 + }
  378 + //有小语种的
  379 + $lang_list = $api->getLangList();
  380 + if(!empty($lang_list[$api_no])){
  381 + $model = RankData::where('project_id', $project_id)->where('lang', '<>', '')->first();
  382 + if (!$model || $model->updated_date != date('Y-m-d')) {
  383 + $res = $api->getGoogleRank($api_no, 1);
  384 + if(!$res){
  385 + throw new \Exception('接口数据获取失败');
  386 + }
  387 + $data = [];
  388 + //不同的小语种取出来
  389 + foreach ($res as $keyword => $v){
  390 + $data[Arr::last($v)['lang']][$keyword] = $v;
  391 + }
  392 + foreach ($data as $lang => $rank){
  393 + $this->save_rank($project_id, $rank, 0, $lang);
  394 + }
  395 + }
  396 + }
  397 + }
  398 +
  399 + /**
  400 + * @param $project_id
  401 + * @param int $indexed_pages_num
  402 + * @param $data
  403 + * @param string $lang
  404 + * @author zbj
  405 + * @date 2023/5/8
  406 + */
  407 + public function save_rank($project_id, $data, int $indexed_pages_num = 0, string $lang = ''){
  408 + $without_project_ids = []; //不用处理排名的项目
  409 +
  410 + $first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0;
  411 +
  412 + if(!$lang){
  413 + foreach ($data as &$ranks){
  414 + ksort($ranks);
  415 + foreach ($ranks as &$rank){
  416 + //处理排名
  417 + if(!in_array($project_id, $without_project_ids)){
  418 + if($rank['position'] >= 10){
  419 + $rank['position'] -= 5;
  420 + }
  421 + //todo 需要特殊处理排名的项目
  422 + }
  423 + }
  424 + $last = Arr::last($ranks);
  425 + //第一名
  426 + if($last['position'] == 1){
  427 + $first_num ++;
  428 + }
  429 + //排名第一页
  430 + if($last['position'] > 0 && $last['position'] <= 10){
  431 + $first_page_num ++;
  432 + }
  433 + //排名前三页
  434 + if($last['position'] > 0 && $last['position'] <= 30){
  435 + $first_three_pages_num ++;
  436 + }
  437 + //排名前五页
  438 + if($last['position'] > 0 && $last['position'] <= 50){
  439 + $first_five_pages_num ++;
  440 + }
  441 + //排名前十页
  442 + if($last['position'] > 0 && $last['position'] <= 100){
  443 + $first_ten_pages_num ++;
  444 + }
  445 + }
  446 + }
  447 +
  448 + $where = [
  449 + 'project_id' => $project_id,
  450 + 'lang' => $lang
  451 + ];
  452 + $model = RankData::where($where)->first();
  453 + if(!$model){
  454 + $model = new RankData();
  455 + }
  456 +
  457 + //关键词达标天数
  458 + $model->is_compliance = 0;
  459 + if($model->updated_date != date('Y-m-d')){
  460 + //保证关键词数
  461 + $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
  462 + $type = Project::where('id', $project_id)->value('type');
  463 + if($keyword_num && $type == 2 && $first_page_num >= $keyword_num){
  464 + $model->compliance_day = $model->compliance_day + 1;
  465 + $model->is_compliance = 1;
  466 +
  467 + //项目表更新
  468 + Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $model->compliance_day]);
  469 + }
  470 + }
  471 +
  472 + $model->project_id = $project_id;
  473 + $model->first_num = $first_num;
  474 + $model->first_page_num = $first_page_num;
  475 + $model->first_three_pages_num = $first_three_pages_num;
  476 + $model->first_five_pages_num = $first_five_pages_num;
  477 + $model->first_ten_pages_num = $first_ten_pages_num;
  478 + $model->indexed_pages_num = $indexed_pages_num;
  479 + $model->lang = $lang;
  480 + $model->data = $data;
  481 + $model->updated_date = date('Y-m-d');
  482 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($model, true) . PHP_EOL, FILE_APPEND);
  483 + $model->save();
  484 + }
349 } 485 }
@@ -42,10 +42,6 @@ class UserLoginLogic @@ -42,10 +42,6 @@ class UserLoginLogic
42 if($info === false){ 42 if($info === false){
43 $this->fail('当前用户不存在或者被禁用',Code::USER_REGISTER_ERROE); 43 $this->fail('当前用户不存在或者被禁用',Code::USER_REGISTER_ERROE);
44 } 44 }
45 - //查看当前账号下有几个项目  
46 - if($this->param['password'] == '123456' && $this->param['mobile'] != '15680871314'){  
47 - $this->fail('请使用短信登录,修改初始密码');  
48 - }  
49 $password = base64_encode(md5($this->param['password'])); 45 $password = base64_encode(md5($this->param['password']));
50 $list = $this->model->list(['mobile'=>$this->param['mobile'], 46 $list = $this->model->list(['mobile'=>$this->param['mobile'],
51 'password'=>$password,'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']); 47 'password'=>$password,'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']);
@@ -86,7 +82,7 @@ class UserLoginLogic @@ -86,7 +82,7 @@ class UserLoginLogic
86 $token = md5(uniqid().$info['id']); 82 $token = md5(uniqid().$info['id']);
87 //存储缓存 83 //存储缓存
88 $info['token'] = $token; 84 $info['token'] = $token;
89 - Cache::add($token,$info,3600); 85 + Cache::add($token,$info,3600 * 6);
90 //更新用户信息 86 //更新用户信息
91 $rs = $this->model->edit(['token'=>$token],['id'=>$info['id']]); 87 $rs = $this->model->edit(['token'=>$token],['id'=>$info['id']]);
92 if($rs === false){ 88 if($rs === false){
@@ -99,9 +95,11 @@ class UserLoginLogic @@ -99,9 +95,11 @@ class UserLoginLogic
99 95
100 96
101 /** 97 /**
102 - * 自动登录  
103 - * @author zbj  
104 - * @date 2023/7/25 98 + * @remark :自动登录
  99 + * @name :autologin
  100 + * @author :lyh
  101 + * @method :post
  102 + * @time :2023/9/18 11:00
105 */ 103 */
106 public function autologin($data) 104 public function autologin($data)
107 { 105 {
@@ -123,7 +121,7 @@ class UserLoginLogic @@ -123,7 +121,7 @@ class UserLoginLogic
123 //存储缓存 121 //存储缓存
124 $info['token'] = $token; 122 $info['token'] = $token;
125 $info['manager_id'] = $data['manager_id'];//代表自动登录写入日志 123 $info['manager_id'] = $data['manager_id'];//代表自动登录写入日志
126 - Cache::add($token,$info,3600); 124 + Cache::add($token,$info,3600 * 6);
127 } 125 }
128 Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip(), 126 Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip(),
129 'project_id'=>$info['project_id'], 'type'=>1 ,'remark' => '自动登录,操作管理员为:'.$data['manager_id']]); 127 'project_id'=>$info['project_id'], 'type'=>1 ,'remark' => '自动登录,操作管理员为:'.$data['manager_id']]);
1 <?php 1 <?php
2 2
3 -namespace App\Http\Logic\Bside; 3 +namespace App\Http\Logic\Bside\Visit;
4 4
5 -use App\Http\Logic\Logic; 5 +use App\Http\Logic\Bside\BaseLogic;
6 use App\Models\Visit\Visit; 6 use App\Models\Visit\Visit;
7 use App\Models\Visit\VisitItem; 7 use App\Models\Visit\VisitItem;
8 8
@@ -25,18 +25,18 @@ class LoginAuthMiddleware @@ -25,18 +25,18 @@ class LoginAuthMiddleware
25 { 25 {
26 $manage = LoginLogic::manage(); 26 $manage = LoginLogic::manage();
27 if (!$manage) { 27 if (!$manage) {
28 - return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户未登录']); 28 + return response(['code'=> Code::USER_LOGIN_ERROE,'message'=>'当前用户未登录']);
29 } 29 }
30 //权限 30 //权限
31 if($manage['id'] != Manage::ADMINISTRATOR_ID){ //排除超级管理员 31 if($manage['id'] != Manage::ADMINISTRATOR_ID){ //排除超级管理员
32 if($manage['status'] != 1){ 32 if($manage['status'] != 1){
33 - return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户被禁用']); 33 + return response(['code'=> Code::USER_LOGIN_ERROE,'message'=>'当前用户被禁用']);
34 } 34 }
35 } 35 }
36 if($manage['gid'] != 0){ 36 if($manage['gid'] != 0){
37 $groupInfo = $this->getGroup($manage); 37 $groupInfo = $this->getGroup($manage);
38 if($groupInfo['status'] != 1){ 38 if($groupInfo['status'] != 1){
39 - return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户角色被禁用']); 39 + return response(['code'=> Code::USER_LOGIN_ERROE,'message'=>'当前用户角色被禁用']);
40 } 40 }
41 //获取当前操作的路由name 41 //获取当前操作的路由name
42 $action = Route::currentRouteName(); 42 $action = Route::currentRouteName();
@@ -45,7 +45,7 @@ class LoginAuthMiddleware @@ -45,7 +45,7 @@ class LoginAuthMiddleware
45 $menu_id = $menuModel->read(['route_name'=>$action],['id']); 45 $menu_id = $menuModel->read(['route_name'=>$action],['id']);
46 if($menu_id !== false){ 46 if($menu_id !== false){
47 if(in_array($menu_id['id'],$groupInfo['rights']) === false){ 47 if(in_array($menu_id['id'],$groupInfo['rights']) === false){
48 - return response(['code'=>Code::USER_PERMISSION_ERROE,'msg'=>'当前用户没有权限']); 48 + return response(['code'=>Code::USER_PERMISSION_ERROE,'message'=>'当前用户没有权限']);
49 } 49 }
50 } 50 }
51 } 51 }
@@ -25,7 +25,7 @@ class LoginAuthMiddleware @@ -25,7 +25,7 @@ class LoginAuthMiddleware
25 $token = $request->header('token'); 25 $token = $request->header('token');
26 $info = Cache::get($token); 26 $info = Cache::get($token);
27 if(empty($info) || empty($token)){ 27 if(empty($info) || empty($token)){
28 - return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'当前用户未登录']); 28 + return response(['code'=>Code::USER_LOGIN_ERROE,'message'=>'当前用户未登录']);
29 } 29 }
30 //0代表超级管理员 30 //0代表超级管理员
31 if($info['role_id'] != 0){ 31 if($info['role_id'] != 0){
@@ -38,7 +38,7 @@ class LoginAuthMiddleware @@ -38,7 +38,7 @@ class LoginAuthMiddleware
38 // 设置数据库 38 // 设置数据库
39 $project = ProjectServer::useProject($info['project_id']); 39 $project = ProjectServer::useProject($info['project_id']);
40 if(empty($project)){ 40 if(empty($project)){
41 - return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'数据库未配置']); 41 + return response(['code'=>Code::USER_LOGIN_ERROE,'message'=>'数据库未配置']);
42 } 42 }
43 return $next($request); 43 return $next($request);
44 } 44 }
@@ -56,7 +56,7 @@ class LoginAuthMiddleware @@ -56,7 +56,7 @@ class LoginAuthMiddleware
56 $projectRoleModel = new ProjectRoleModel(); 56 $projectRoleModel = new ProjectRoleModel();
57 $role_info = $projectRoleModel->read(['id'=>$info['role_id']]); 57 $role_info = $projectRoleModel->read(['id'=>$info['role_id']]);
58 if($role_info['status'] != 0){ 58 if($role_info['status'] != 0){
59 - return response(['code'=>Code::USER_LOGIN_ERROE,'当前用户角色被禁用']); 59 + return response(['code'=>Code::USER_LOGIN_ERROE,'message'=>'当前用户角色被禁用']);
60 } 60 }
61 return $role_info; 61 return $role_info;
62 } 62 }
@@ -73,7 +73,7 @@ class LoginAuthMiddleware @@ -73,7 +73,7 @@ class LoginAuthMiddleware
73 $menu_id = $projectMenuModel->read(['action'=>$action],['id']); 73 $menu_id = $projectMenuModel->read(['action'=>$action],['id']);
74 if($menu_id !== false){ 74 if($menu_id !== false){
75 if(strpos($role_info['role_menu'], $menu_id['id']) === false){ 75 if(strpos($role_info['role_menu'], $menu_id['id']) === false){
76 - return response(['code'=>Code::USER_PERMISSION_ERROE,'msg'=>'当前用户没有权限']); 76 + return response(['code'=>Code::USER_PERMISSION_ERROE,'message'=>'当前用户没有权限']);
77 } 77 }
78 } 78 }
79 } 79 }
@@ -25,6 +25,7 @@ class BlogRequest extends FormRequest @@ -25,6 +25,7 @@ class BlogRequest extends FormRequest
25 { 25 {
26 return [ 26 return [
27 'name'=>'required|max:100', 27 'name'=>'required|max:100',
  28 + 'url'=>'required',
28 ]; 29 ];
29 } 30 }
30 31
@@ -32,6 +33,7 @@ class BlogRequest extends FormRequest @@ -32,6 +33,7 @@ class BlogRequest extends FormRequest
32 { 33 {
33 return [ 34 return [
34 'name.required'=>'请填写名称', 35 'name.required'=>'请填写名称',
  36 + 'url.required'=>'链接不能为空'
35 ]; 37 ];
36 } 38 }
37 } 39 }
  1 +<?php
  2 +
  3 +namespace App\Http\Requests\Bside\Import;
  4 +
  5 +use App\Models\Import\ImportTask;
  6 +use Illuminate\Foundation\Http\FormRequest;
  7 +use Illuminate\Validation\Rule;
  8 +
  9 +/**
  10 + * 产品新闻博客导入任务
  11 + * @author:akun
  12 + * @time 2023/9/20 11:32
  13 + * Class NavRequest
  14 + * @package App\Http\Requests\Bside\Nav
  15 + */
  16 +class ImportTaskRequest extends FormRequest
  17 +{
  18 + /**
  19 + * Determine if the user is authorized to make this request.
  20 + *
  21 + * @return bool
  22 + */
  23 + public function authorize()
  24 + {
  25 + return true;
  26 + }
  27 +
  28 + /**
  29 + * Get the validation rules that apply to the request.
  30 + *
  31 + * @return array
  32 + */
  33 + public function rules()
  34 + {
  35 + return [
  36 + 'type' => ['required', Rule::in([ImportTask::TYPE_PROJECT, ImportTask::TYPE_NEWS, ImportTask::TYPE_BLOG])],
  37 + 'file_url' => ['required'],
  38 + ];
  39 + }
  40 +
  41 + public function messages()
  42 + {
  43 + return [
  44 + 'type.required' => '导入类型必须',
  45 + 'type.in' => '导入类型错误',
  46 + 'file_url.required' => '文件地址必须',
  47 + ];
  48 + }
  49 +}
@@ -34,11 +34,6 @@ class NavRequest extends FormRequest @@ -34,11 +34,6 @@ class NavRequest extends FormRequest
34 $rule = [ 34 $rule = [
35 'pid' => ['required','integer'], 35 'pid' => ['required','integer'],
36 'name' => ['required','max:100'], 36 'name' => ['required','max:100'],
37 - 'location' => ['required','in:header,footer'],  
38 - 'url' => ['max:200'],  
39 - 'status' => ['required','in:0,1'],  
40 - 'target' => ['required','in:0,1'],  
41 - 'sort' => ['required','integer','gte:0']  
42 ]; 37 ];
43 return $rule; 38 return $rule;
44 } 39 }
@@ -46,24 +41,11 @@ class NavRequest extends FormRequest @@ -46,24 +41,11 @@ class NavRequest extends FormRequest
46 public function messages() 41 public function messages()
47 { 42 {
48 return [ 43 return [
49 - 'id.required' => '数据不存在',  
50 - 'id.integer' => '数据不存在',  
51 'pid.required' => '上级选择错误', 44 'pid.required' => '上级选择错误',
52 'pid.gte' => '上级选择错误', 45 'pid.gte' => '上级选择错误',
53 'pid.integer' => '上级选择错误', 46 'pid.integer' => '上级选择错误',
54 'name.required' => '名称必须', 47 'name.required' => '名称必须',
55 'name.max' => '名称不能超过100个字符', 48 'name.max' => '名称不能超过100个字符',
56 - 'location.required' => '位置选择错误',  
57 - 'location.in' => '位置选择错误',  
58 - 'url.required' => '链接必须',  
59 - 'url.max' => '链接不能超过200个字符',  
60 - 'status.required' => '状态选择错误',  
61 - 'status.in' => '状态必须是显示/隐藏',  
62 - 'target.required' => '打开方式必须',  
63 - 'target.in' => '打开方式选择错误',  
64 - 'sort.required' => '排序必须',  
65 - 'sort.integer' => '排序必须是一个数字',  
66 - 'sort.gte' => '排序必须大于等于0',  
67 ]; 49 ];
68 } 50 }
69 } 51 }
@@ -25,6 +25,7 @@ class NewsRequest extends FormRequest @@ -25,6 +25,7 @@ class NewsRequest extends FormRequest
25 { 25 {
26 return [ 26 return [
27 'name'=>'required|max:100', 27 'name'=>'required|max:100',
  28 + 'url'=>'required',
28 ]; 29 ];
29 } 30 }
30 31
@@ -33,6 +34,7 @@ class NewsRequest extends FormRequest @@ -33,6 +34,7 @@ class NewsRequest extends FormRequest
33 return [ 34 return [
34 'name.required'=>'请填写名称', 35 'name.required'=>'请填写名称',
35 'name.max'=>'名称最大100字', 36 'name.max'=>'名称最大100字',
  37 + 'url.required'=>'新闻链接不能为空'
36 ]; 38 ];
37 } 39 }
38 } 40 }
@@ -31,9 +31,10 @@ class CategoryRequest extends FormRequest @@ -31,9 +31,10 @@ class CategoryRequest extends FormRequest
31 { 31 {
32 return [ 32 return [
33 'title'=>'required|max:50', 33 'title'=>'required|max:50',
  34 + 'route'=>'required',
34 // 'image'=>'required', 35 // 'image'=>'required',
35 - 'keywords'=>'max:50',  
36 - 'describe'=>'max:200', 36 +// 'keywords'=>'max:50',
  37 +// 'describe'=>'max:200',
37 ]; 38 ];
38 } 39 }
39 40
@@ -42,9 +43,10 @@ class CategoryRequest extends FormRequest @@ -42,9 +43,10 @@ class CategoryRequest extends FormRequest
42 return [ 43 return [
43 'title.required' => '请输入分类名称', 44 'title.required' => '请输入分类名称',
44 'title.max' => '分类名称不能超过50个字符', 45 'title.max' => '分类名称不能超过50个字符',
  46 + 'route.required' => '路由不能为空',
45 // 'image.required' => '请上传分类图片', 47 // 'image.required' => '请上传分类图片',
46 - 'keywords.max' => '分类关键词不能超过50个字符',  
47 - 'describe.max' => '分类描述不能超过200个字符', 48 +// 'keywords.max' => '分类关键词不能超过50个字符',
  49 +// 'describe.max' => '分类描述不能超过200个字符',
48 ]; 50 ];
49 } 51 }
50 52
@@ -36,7 +36,7 @@ class CustomTemplateRequest extends FormRequest @@ -36,7 +36,7 @@ class CustomTemplateRequest extends FormRequest
36 { 36 {
37 return [ 37 return [
38 'name.required'=>'模版名称不能为空', 38 'name.required'=>'模版名称不能为空',
39 - 'url.required'=>'自定义访问地址', 39 + 'url.required'=>'自定义访问地址不能为空',
40 // 'keywords.required'=>'页面关键字不能为空', 40 // 'keywords.required'=>'页面关键字不能为空',
41 // 'description.required'=>'页面描述不能为空', 41 // 'description.required'=>'页面描述不能为空',
42 // 'title.required'=>'标题不能为空', 42 // 'title.required'=>'标题不能为空',
@@ -10,6 +10,7 @@ class NoticeLog extends Model @@ -10,6 +10,7 @@ class NoticeLog extends Model
10 protected $table = 'gl_notice_log'; 10 protected $table = 'gl_notice_log';
11 11
12 const TYPE_PROJECT = 'project'; 12 const TYPE_PROJECT = 'project';
  13 + const TYPE_RANK_DATA = 'rank_data';
13 14
14 const STATUS_PENDING = 0; 15 const STATUS_PENDING = 0;
15 const STATUS_SUCCESS = 1; 16 const STATUS_SUCCESS = 1;
  1 +<?php
  2 +
  3 +namespace App\Models\Com;
  4 +
  5 +use Illuminate\Database\Eloquent\Model;
  6 +
  7 +class UpdateLog extends Model
  8 +{
  9 + //设置关联表名
  10 + protected $table = 'gl_update_log';
  11 +
  12 + const STATUS_PENDING = 0;
  13 + const STATUS_SUCCESS = 1;
  14 + const STATUS_FAIL = 2;
  15 +
  16 + /**
  17 + * 创建更新日志
  18 + * @param $type
  19 + * @param $project_id
  20 + * @param $type
  21 + * @param $url
  22 + * @return mixed
  23 + */
  24 + public static function createLog($project_id, $type, $url)
  25 + {
  26 + $log = self::where('project_id', $project_id)->where('api_type', $type)->first();
  27 + if (!$log) {
  28 + $log = new self();
  29 + $log->project_id = $project_id;
  30 + $log->api_type = $type;
  31 + $log->api_url = $url;
  32 + return $log->save();
  33 + }
  34 + return true;
  35 + }
  36 +}
  1 +<?php
  2 +namespace App\Models\Import;
  3 +
  4 +use App\Models\Base;
  5 +
  6 +class ImportTask extends Base
  7 +{
  8 + protected $table = 'gl_import_task';
  9 +
  10 + const STATUS_UN = 0;//未开始
  11 + const STATUS_ING = 1;//导入中
  12 + const STATUS_COM = 2;//导入完成
  13 +
  14 + const TYPE_PROJECT = 1;//产品
  15 + const TYPE_NEWS = 2;//新闻
  16 + const TYPE_BLOG = 3;//博客
  17 +
  18 +
  19 +}
@@ -2,7 +2,9 @@ @@ -2,7 +2,9 @@
2 2
3 namespace App\Models\Manage; 3 namespace App\Models\Manage;
4 4
  5 +use App\Helper\Common;
5 use App\Models\Base; 6 use App\Models\Base;
  7 +use Illuminate\Support\Facades\Cache;
6 8
7 class Manage extends Base 9 class Manage extends Base
8 { 10 {
@@ -36,9 +38,17 @@ class Manage extends Base @@ -36,9 +38,17 @@ class Manage extends Base
36 */ 38 */
37 public function getName($id){ 39 public function getName($id){
38 $name = ''; 40 $name = '';
39 - $info = $this->read(['id'=>$id]); 41 + if(!empty($id)){
  42 + $info = Common::get_user_cache('manager',$id,'A');
  43 + if(empty($info)){
  44 + $info = $this->read(['id'=>$id],['id','name']);
40 if($info !== false){ 45 if($info !== false){
41 $name = $info['name']; 46 $name = $info['name'];
  47 + Common::set_user_cache($info,'manager',$id,'A');
  48 + }
  49 + }else{
  50 + $name = $info['name'];
  51 + }
42 } 52 }
43 return $name; 53 return $name;
44 } 54 }
@@ -36,8 +36,6 @@ class BNav extends Base @@ -36,8 +36,6 @@ class BNav extends Base
36 36
37 37
38 38
39 -  
40 -  
41 /** 39 /**
42 * 是否有下级 40 * 是否有下级
43 * @param int $id 41 * @param int $id
@@ -50,4 +48,18 @@ class BNav extends Base @@ -50,4 +48,18 @@ class BNav extends Base
50 { 48 {
51 return static::where(['pid'=>$id,'project_id'=>$project_id])->limit(1)->count(); 49 return static::where(['pid'=>$id,'project_id'=>$project_id])->limit(1)->count();
52 } 50 }
  51 +
  52 + /**
  53 + * @remark :获取图片
  54 + * @name :getImageAttribute
  55 + * @author :lyh
  56 + * @method :post
  57 + * @time :2023/9/18 16:20
  58 + */
  59 + public function getImageAttribute($value)
  60 + {
  61 + $value = getImageUrl($value);
  62 + return $value;
  63 + }
  64 +
53 } 65 }
@@ -29,7 +29,6 @@ class ProcessRecords extends Base @@ -29,7 +29,6 @@ class ProcessRecords extends Base
29 29
30 public function getRecordAttribute($value){ 30 public function getRecordAttribute($value){
31 $value = Arr::s2a($value); 31 $value = Arr::s2a($value);
32 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($value, true) . PHP_EOL, FILE_APPEND);  
33 foreach ($value as &$v){ 32 foreach ($value as &$v){
34 if(isset($v['image']) && !empty($v['image'])) { 33 if(isset($v['image']) && !empty($v['image'])) {
35 foreach ($v['image'] as $kImage => $vImage) { 34 foreach ($v['image'] as $kImage => $vImage) {
@@ -38,7 +38,7 @@ class Project extends Base @@ -38,7 +38,7 @@ class Project extends Base
38 public static function levelMap() 38 public static function levelMap()
39 { 39 {
40 return [ 40 return [
41 - 1 => '★★★Ads-Customer', 41 +// 1 => '★★★Ads-Customer',
42 2 => '暂停优化', 42 2 => '暂停优化',
43 3 => '告知书一', 43 3 => '告知书一',
44 4 => '告知书二', 44 4 => '告知书二',
@@ -226,12 +226,14 @@ class Project extends Base @@ -226,12 +226,14 @@ class Project extends Base
226 226
227 public function getNoticeFileAttribute($value) 227 public function getNoticeFileAttribute($value)
228 { 228 {
229 - $value = Arr::s2a($value);  
230 if(!empty($value)) { 229 if(!empty($value)) {
  230 + $value = Arr::s2a($value);
231 foreach ($value as &$v) { 231 foreach ($value as &$v) {
  232 + if(!empty($v['url'])){
232 $v['url'] = getFileUrl($v['url']); 233 $v['url'] = getFileUrl($v['url']);
233 } 234 }
234 } 235 }
  236 + }
235 return $value; 237 return $value;
236 } 238 }
237 239
@@ -245,12 +247,14 @@ class Project extends Base @@ -245,12 +247,14 @@ class Project extends Base
245 247
246 public function getConfirmFileAttribute($value) 248 public function getConfirmFileAttribute($value)
247 { 249 {
248 - $value = Arr::s2a($value);  
249 if(!empty($value)) { 250 if(!empty($value)) {
  251 + $value = Arr::s2a($value);
250 foreach ($value as &$v) { 252 foreach ($value as &$v) {
  253 + if(!empty($v['url'])){
251 $v['url'] = getFileUrl($v['url']); 254 $v['url'] = getFileUrl($v['url']);
252 } 255 }
253 } 256 }
  257 + }
254 return $value; 258 return $value;
255 } 259 }
256 260
@@ -281,4 +285,21 @@ class Project extends Base @@ -281,4 +285,21 @@ class Project extends Base
281 return $data; 285 return $data;
282 } 286 }
283 287
  288 + /**
  289 + * @remark :获取项目名称
  290 + * @name :getProjectName
  291 + * @author :lyh
  292 + * @method :post
  293 + * @time :2023/9/19 10:35
  294 + */
  295 + public function getProjectName($id){
  296 + $title = '';
  297 + if(!empty($id)){
  298 + $info = $this->read(['id'=>$id]);
  299 + if($info !== false){
  300 + $title = $info['title'];
  301 + }
  302 + }
  303 + return $title;
  304 + }
284 } 305 }
@@ -18,5 +18,70 @@ class BTemplate extends Base @@ -18,5 +18,70 @@ class BTemplate extends Base
18 protected $table = 'gl_web_template'; 18 protected $table = 'gl_web_template';
19 //连接数据库 19 //连接数据库
20 protected $connection = 'custom_mysql'; 20 protected $connection = 'custom_mysql';
  21 +
  22 + //网站装修可操作手机号
  23 + public $mobile = [
  24 + '15928018676',
  25 + '15680871314',
  26 + '18328465854',
  27 + '18008059100',
  28 + '18583337995'
  29 + ];
  30 +
  31 + //类型数据
  32 + public $product_type = [
  33 + "products"=>[
  34 + "category"=>[
  35 + [
  36 + "id"=>"all",
  37 + "title"=>"全部",
  38 + ],
  39 + [
  40 + "id"=>"hot",
  41 + "title"=>"热销产品",
  42 + ],
  43 + [
  44 + "id"=>"recommend",
  45 + "title"=>"推荐产品",
  46 + ],
  47 + ],
  48 + "imageType"=>[
  49 + [
  50 + "id"=>1,
  51 + "title"=>"产品图片",
  52 + ],[
  53 + "id"=>2,
  54 + "title"=>"产品分类图片",
  55 + ],[
  56 + "id"=>3,
  57 + "title"=>"产品图标",
  58 + ]
  59 + ],
  60 + ],
  61 + "news"=>[
  62 + "category"=>[
  63 + [
  64 + "id"=>"all",
  65 + "name"=>"全部",
  66 + ],
  67 + [
  68 + "id"=>"new",
  69 + "name"=>"最新",
  70 + ],
  71 + ],
  72 + ],
  73 + "blogs"=>[
  74 + "category"=>[
  75 + [
  76 + "id"=>"all",
  77 + "name"=>"全部",
  78 + ],
  79 + [
  80 + "id"=>"new",
  81 + "name"=>"最新",
  82 + ],
  83 + ],
  84 + ]
  85 + ];
21 } 86 }
22 87
@@ -9,7 +9,6 @@ @@ -9,7 +9,6 @@
9 namespace App\Services; 9 namespace App\Services;
10 10
11 use App\Models\Project\Project; 11 use App\Models\Project\Project;
12 -use App\Utils\EncryptUtils;  
13 use Illuminate\Support\Facades\DB; 12 use Illuminate\Support\Facades\DB;
14 use Illuminate\Support\Facades\Schema; 13 use Illuminate\Support\Facades\Schema;
15 14
@@ -85,4 +84,29 @@ class ProjectServer extends BaseService @@ -85,4 +84,29 @@ class ProjectServer extends BaseService
85 } 84 }
86 return true; 85 return true;
87 } 86 }
  87 +
  88 + /**
  89 + * @remark :执行初始数据
  90 + * @name :saveInitParam
  91 + * @author :lyh
  92 + * @method :post
  93 + * @time :2023/9/19 14:45
  94 + */
  95 + public static function saveInitParam($project_id){
  96 + $info = DB::connection('custom_mysql')->table('gl_web_nav')->first();
  97 + if(empty($info)){
  98 + $created_at = date('Y-m-d H:i:s');
  99 + $data = [
  100 + ['project_id'=>$project_id,'name'=>'Home','url'=>'nav-home-'.$project_id,'location'=>'header','created_at'=>$created_at,'updated_at'=>$created_at],
  101 + ['project_id'=>$project_id,'name'=>'Products','url'=>'nav-product'.$project_id,'location'=>'header','created_at'=>$created_at,'updated_at'=>$created_at],
  102 + ['project_id'=>$project_id,'name'=>'News','url'=>'nav-news'.$project_id,'location'=>'header','created_at'=>$created_at,'updated_at'=>$created_at],
  103 + ['project_id'=>$project_id,'name'=>'ABOUT US','url'=>'nav-about-us'.$project_id,'location'=>'footer','created_at'=>$created_at,'updated_at'=>$created_at],
  104 + ['project_id'=>$project_id,'name'=>'Contact Us','url'=>'nav-contact-us'.$project_id,'location'=>'footer','created_at'=>$created_at,'updated_at'=>$created_at],
  105 + ['project_id'=>$project_id,'name'=>'FAQ','url'=>'nav-faq'.$project_id,'location'=>'footer','created_at'=>$created_at,'updated_at'=>$created_at],
  106 + ];
  107 + DB::connection('custom_mysql')->table('gl_web_nav')->insert($data);
  108 + }
  109 + DB::disconnect('custom_mysql');
  110 + return true;
  111 + }
88 } 112 }
@@ -11,7 +11,7 @@ return [ @@ -11,7 +11,7 @@ return [
11 'access_secret' => env('ALIYUN_SMS_AS'), // accessSecret 11 'access_secret' => env('ALIYUN_SMS_AS'), // accessSecret
12 'sign_name' => env('ALIYUN_SMS_SIGN_NAME'), // 签名 12 'sign_name' => env('ALIYUN_SMS_SIGN_NAME'), // 签名
13 // login 13 // login
14 - 'login_sms_temp' => 'SMS_272545773', 14 + 'login_sms_temp' => 'SMS_162198406',
15 // 注册 15 // 注册
16 - 'register_sms_temp' => 'SMS_272430790', 16 + 'register_sms_temp' => 'SMS_162198406',
17 ]; 17 ];
@@ -181,7 +181,9 @@ Route::middleware(['aloginauth'])->group(function () { @@ -181,7 +181,9 @@ Route::middleware(['aloginauth'])->group(function () {
181 Route::any('/log', [Aside\Project\RenewProjectController::class, 'renewLists'])->name('admin.renew_renewLists'); 181 Route::any('/log', [Aside\Project\RenewProjectController::class, 'renewLists'])->name('admin.renew_renewLists');
182 Route::any('/info', [Aside\Project\RenewProjectController::class, 'info'])->name('admin.renew_info'); 182 Route::any('/info', [Aside\Project\RenewProjectController::class, 'info'])->name('admin.renew_info');
183 Route::any('/notHaveRenewItems', [Aside\Project\RenewProjectController::class, 'notHaveRenewItems'])->name('admin.renew_notHaveRenewItems'); 183 Route::any('/notHaveRenewItems', [Aside\Project\RenewProjectController::class, 'notHaveRenewItems'])->name('admin.renew_notHaveRenewItems');
184 - 184 + Route::any('/editRenew', [Aside\Project\RenewProjectController::class, 'editRenew'])->name('admin.renew_editRenew');
  185 + Route::any('/getRenewList', [Aside\Project\RenewProjectController::class, 'getRenewList'])->name('admin.renew_getRenewList');
  186 + Route::any('/editStatusRenew', [Aside\Project\RenewProjectController::class, 'editStatusRenew'])->name('admin.renew_editStatusRenew');
185 }); 187 });
186 //工单管理 188 //工单管理
187 Route::prefix('task')->group(function () { 189 Route::prefix('task')->group(function () {
@@ -320,6 +322,7 @@ Route::group([], function () { @@ -320,6 +322,7 @@ Route::group([], function () {
320 Route::any('/download_images', [\App\Http\Controllers\File\ImageController::class, 'downLoad'])->name('admin.images_downLoad');//导出图片 322 Route::any('/download_images', [\App\Http\Controllers\File\ImageController::class, 'downLoad'])->name('admin.images_downLoad');//导出图片
321 Route::any('/domain/exportData', [Aside\Domain\DomainInfoController::class, 'exportData'])->name('admin.domain_exportData');//导出数据 323 Route::any('/domain/exportData', [Aside\Domain\DomainInfoController::class, 'exportData'])->name('admin.domain_exportData');//导出数据
322 Route::any('/notice/project', [Aside\Notice\NoticeController::class, 'project'])->name('admin.notice.project'); 324 Route::any('/notice/project', [Aside\Notice\NoticeController::class, 'project'])->name('admin.notice.project');
  325 + Route::any('/notice/rank_data', [Aside\Notice\NoticeController::class, 'rank_data'])->name('admin.notice.rank_data');
323 Route::any('/sendLoginSms', [Aside\LoginController::class, 'sendLoginSms'])->name('admin.sendLoginSms');//发送验证码 326 Route::any('/sendLoginSms', [Aside\LoginController::class, 'sendLoginSms'])->name('admin.sendLoginSms');//发送验证码
324 Route::any('/getProjectInService', [Aside\Project\ProjectController::class, 'getProjectInService'])->name('admin.getProjectInService');//获取项目服务状态 327 Route::any('/getProjectInService', [Aside\Project\ProjectController::class, 'getProjectInService'])->name('admin.getProjectInService');//获取项目服务状态
325 Route::any('/getProjectByChannel', [Aside\Project\ProjectController::class, 'getProjectByChannel'])->name('admin.getProjectByChannel');//获取渠道商的项目 328 Route::any('/getProjectByChannel', [Aside\Project\ProjectController::class, 'getProjectByChannel'])->name('admin.getProjectByChannel');//获取渠道商的项目
@@ -278,6 +278,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -278,6 +278,7 @@ Route::middleware(['bloginauth'])->group(function () {
278 Route::any('/getTypeSetting', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getTypeSetting'])->name('template_getTypeSetting'); 278 Route::any('/getTypeSetting', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getTypeSetting'])->name('template_getTypeSetting');
279 Route::any('/getHeadFooter', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getHeadFooter'])->name('template_getHeadFooter'); 279 Route::any('/getHeadFooter', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getHeadFooter'])->name('template_getHeadFooter');
280 Route::any('/setHeadFooter', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'setHeadFooter'])->name('template_setHeadFooter'); 280 Route::any('/setHeadFooter', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'setHeadFooter'])->name('template_setHeadFooter');
  281 + Route::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate');
281 // 模板 282 // 模板
282 Route::prefix('module')->group(function () { 283 Route::prefix('module')->group(function () {
283 //获取所有左侧模版 284 //获取所有左侧模版
@@ -289,6 +290,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -289,6 +290,7 @@ Route::middleware(['bloginauth'])->group(function () {
289 Route::prefix('log')->group(function () { 290 Route::prefix('log')->group(function () {
290 //获取所有左侧模版 291 //获取所有左侧模版
291 Route::any('/', [\App\Http\Controllers\Bside\Template\BTemplateLogController::class, 'lists'])->name('template_log_lists'); 292 Route::any('/', [\App\Http\Controllers\Bside\Template\BTemplateLogController::class, 'lists'])->name('template_log_lists');
  293 + Route::any('/info', [\App\Http\Controllers\Bside\Template\BTemplateLogController::class, 'info'])->name('template_log_info');
292 Route::any('/rollbackVersion', [\App\Http\Controllers\Bside\Template\BTemplateLogController::class, 'rollbackVersion'])->name('template_log_rollbackVersion'); 294 Route::any('/rollbackVersion', [\App\Http\Controllers\Bside\Template\BTemplateLogController::class, 'rollbackVersion'])->name('template_log_rollbackVersion');
293 }); 295 });
294 }); 296 });
@@ -344,6 +346,11 @@ Route::middleware(['bloginauth'])->group(function () { @@ -344,6 +346,11 @@ Route::middleware(['bloginauth'])->group(function () {
344 Route::prefix('tdk')->group(function () { 346 Route::prefix('tdk')->group(function () {
345 Route::any('/', [\App\Http\Controllers\Bside\BCom\UpdateController::class, 'updateSeoTdk'])->name('tdk_updateSeoTdk'); 347 Route::any('/', [\App\Http\Controllers\Bside\BCom\UpdateController::class, 'updateSeoTdk'])->name('tdk_updateSeoTdk');
346 }); 348 });
  349 +
  350 + //导入任务
  351 + Route::prefix('import')->group(function () {
  352 + Route::any('/add_task', [\App\Http\Controllers\Bside\Import\ImportController::class, 'save'])->name('import_add_task');
  353 + });
347 }); 354 });
348 //无需登录验证的路由组 355 //无需登录验证的路由组
349 Route::group([], function () { 356 Route::group([], function () {
1 <?php 1 <?php
2 2
3 use Illuminate\Support\Facades\Route; 3 use Illuminate\Support\Facades\Route;
  4 +
4 /** 5 /**
5 * @remark : 6 * @remark :
6 * @name :wechat.php 7 * @name :wechat.php