作者 刘锟

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

@@ -78,10 +78,10 @@ class DeleteBlogCategory extends Command @@ -78,10 +78,10 @@ class DeleteBlogCategory extends Command
78 $this->updateCategory(); 78 $this->updateCategory();
79 DB::disconnect('custom_mysql'); 79 DB::disconnect('custom_mysql');
80 $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]); 80 $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]);
81 - echo 'success:' . $item['id'] . PHP_EOL; 81 + echo 'success:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
82 }catch (\Exception $e){ 82 }catch (\Exception $e){
83 - echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL;  
84 - errorLog('delete_blog_category删除失败', $item, $e); 83 + echo 'error:' . $item['id'] . $e->getMessage() . '执行时间:'.date('Y-m-d H:i:s') . PHP_EOL;
  84 + errorLog('delete_blog_category删除失败'.date('Y-m-d H:i:s'), $item, $e);
85 } 85 }
86 } 86 }
87 return true; 87 return true;
@@ -78,9 +78,9 @@ class DeleteCustomCategory extends Command @@ -78,9 +78,9 @@ class DeleteCustomCategory extends Command
78 $this->updateCategory(); 78 $this->updateCategory();
79 DB::disconnect('custom_mysql'); 79 DB::disconnect('custom_mysql');
80 $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]); 80 $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]);
81 - echo 'success:' . $item['id'] . PHP_EOL; 81 + echo 'success:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
82 }catch (\Exception $e){ 82 }catch (\Exception $e){
83 - echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; 83 + echo 'error:' . $item['id'] . $e->getMessage() . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
84 errorLog('delete_custom_category删除失败', $item, $e); 84 errorLog('delete_custom_category删除失败', $item, $e);
85 } 85 }
86 } 86 }
@@ -78,9 +78,9 @@ class DeleteNewsCategory extends Command @@ -78,9 +78,9 @@ class DeleteNewsCategory extends Command
78 $this->updateCategory(); 78 $this->updateCategory();
79 DB::disconnect('custom_mysql'); 79 DB::disconnect('custom_mysql');
80 $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]); 80 $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]);
81 - echo 'success:' . $item['id'] . PHP_EOL; 81 + echo 'success:' . $item['id'] . '执行时间:'.date('Y-m-d H:i:s') . PHP_EOL;
82 }catch (\Exception $e){ 82 }catch (\Exception $e){
83 - echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; 83 + echo 'error:' . $item['id'] . $e->getMessage() . '执行时间:'.date('Y-m-d H:i:s') . PHP_EOL;
84 errorLog('delete_news_category删除失败', $item, $e); 84 errorLog('delete_news_category删除失败', $item, $e);
85 } 85 }
86 } 86 }
@@ -79,10 +79,10 @@ class DeleteProductCategory extends Command @@ -79,10 +79,10 @@ class DeleteProductCategory extends Command
79 $this->updateCategory(); 79 $this->updateCategory();
80 DB::disconnect('custom_mysql'); 80 DB::disconnect('custom_mysql');
81 $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]); 81 $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]);
82 - echo 'success:' . $item['id'] . PHP_EOL; 82 + echo 'success:' . $item['id'] . '执行时间:'.date('Y-m-d H:i:s') . PHP_EOL;
83 }catch (\Exception $e){ 83 }catch (\Exception $e){
84 echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; 84 echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL;
85 - errorLog('delete_product_category删除失败', $item, $e); 85 + errorLog('delete_product_category删除失败'.',执行时间:'.date('Y-m-d H:i:s'), $item, $e);
86 } 86 }
87 } 87 }
88 return true; 88 return true;
@@ -61,6 +61,7 @@ class RemainDay extends Command @@ -61,6 +61,7 @@ class RemainDay extends Command
61 { 61 {
62 $list = Project::whereIn('type', [Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR])->get(); 62 $list = Project::whereIn('type', [Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR])->get();
63 foreach ($list as $item){ 63 foreach ($list as $item){
  64 + echo '项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
64 if(in_array($item->id,$this->ceaseProjectId)){//暂停的项目 65 if(in_array($item->id,$this->ceaseProjectId)){//暂停的项目
65 if(($item['type'] == Project::TYPE_TWO) && ($item->is_remain_today == 1)){ 66 if(($item['type'] == Project::TYPE_TWO) && ($item->is_remain_today == 1)){
66 $item->pause_days = $item->pause_days + 1; 67 $item->pause_days = $item->pause_days + 1;
@@ -79,7 +79,7 @@ class InitKeyword extends Command @@ -79,7 +79,7 @@ class InitKeyword extends Command
79 ProjectServer::useProject($notice['data']['project_id']); 79 ProjectServer::useProject($notice['data']['project_id']);
80 $keyword = Keyword::whereNull('route')->get(); 80 $keyword = Keyword::whereNull('route')->get();
81 foreach ($keyword as $val) { 81 foreach ($keyword as $val) {
82 - $this->output(' keywordID: ' . $val->id . ', title: ' . $val->title); 82 + $this->output(' keywordID: ' . $val->id . ', title: ' . $val->title . '时间:'. date('Y-m-d H:i:s'));
83 try { 83 try {
84 if(contains_russian($val['title'])){ 84 if(contains_russian($val['title'])){
85 $title = Translate::tran($val['title'], 'en'); 85 $title = Translate::tran($val['title'], 'en');
@@ -90,7 +90,7 @@ class InitKeyword extends Command @@ -90,7 +90,7 @@ class InitKeyword extends Command
90 $val->route = $route; 90 $val->route = $route;
91 $val->save(); 91 $val->save();
92 } catch (\Exception $e) { 92 } catch (\Exception $e) {
93 - $this->output(' keywordID: ' . $val->id . ', title: ' . $val->title . ', error: ' . $e->getMessage()); 93 + $this->output(' keywordID: ' . $val->id . ', title: ' . $val->title . ', error: ' . $e->getMessage() . '执行时间:'.date('Y-m-d H:i:s'));
94 } 94 }
95 } 95 }
96 96
@@ -63,9 +63,9 @@ class InitProject extends Command @@ -63,9 +63,9 @@ class InitProject extends Command
63 $project_logic->createdRole($project['id']); 63 $project_logic->createdRole($project['id']);
64 $item->status = NoticeLog::STATUS_SUCCESS; 64 $item->status = NoticeLog::STATUS_SUCCESS;
65 $item->save(); 65 $item->save();
66 - echo 'success:' . $item['id'] . PHP_EOL; 66 + echo 'success:' . $item['id'] . PHP_EOL . date('Y-m-d H:i:s');
67 }catch (\Exception $e){ 67 }catch (\Exception $e){
68 - echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; 68 + echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL . date('Y-m-d H:i:s');
69 errorLog('项目初始化失败', $item, $e); 69 errorLog('项目初始化失败', $item, $e);
70 $this->retry($item, $e->getMessage()); 70 $this->retry($item, $e->getMessage());
71 } 71 }
@@ -96,9 +96,9 @@ class SyncProject extends Command @@ -96,9 +96,9 @@ class SyncProject extends Command
96 } 96 }
97 $item->status = NoticeLog::STATUS_SUCCESS; 97 $item->status = NoticeLog::STATUS_SUCCESS;
98 $item->save(); 98 $item->save();
99 - echo 'success:' . $item['id'] . PHP_EOL; 99 + echo 'success:' . $item['id'] . '执行时间:' . date('Y-m-d H:i:s') . PHP_EOL;
100 }catch (\Exception $e){ 100 }catch (\Exception $e){
101 - echo 'error:' . $item['id'] . $e->getMessage() .' line ' . $e->getLine() . PHP_EOL; 101 + echo 'error:' . $item['id'] . $e->getMessage() .' line ' . $e->getLine() . '执行时间:' . PHP_EOL;
102 errorLog('项目同步失败', $item, $e); 102 errorLog('项目同步失败', $item, $e);
103 $this->retry($item, $e->getMessage()); 103 $this->retry($item, $e->getMessage());
104 } 104 }
@@ -13,7 +13,6 @@ use Illuminate\Support\Facades\DB; @@ -13,7 +13,6 @@ use Illuminate\Support\Facades\DB;
13 use Illuminate\Support\Facades\Redis; 13 use Illuminate\Support\Facades\Redis;
14 use Illuminate\Support\Facades\Schema; 14 use Illuminate\Support\Facades\Schema;
15 use Illuminate\Support\Str; 15 use Illuminate\Support\Str;
16 -  
17 /** 16 /**
18 * 17 *
19 * Class SyncSubmitTask 18 * Class SyncSubmitTask
@@ -30,6 +29,7 @@ class SyncSubmitTaskDistribution extends Command @@ -30,6 +29,7 @@ class SyncSubmitTaskDistribution extends Command
30 public function handle() 29 public function handle()
31 { 30 {
32 while (true) { 31 while (true) {
  32 + try {
33 $len = Redis::llen('sync_submit_task'); 33 $len = Redis::llen('sync_submit_task');
34 if (!$len) { 34 if (!$len) {
35 $max_id = SyncSubmitTaskModel::orderBy('id', 'desc')->value('id'); 35 $max_id = SyncSubmitTaskModel::orderBy('id', 'desc')->value('id');
@@ -41,8 +41,12 @@ class SyncSubmitTaskDistribution extends Command @@ -41,8 +41,12 @@ class SyncSubmitTaskDistribution extends Command
41 $task->status = 3; 41 $task->status = 3;
42 $task->save(); 42 $task->save();
43 Redis::lpush('sync_submit_task', $task->id); 43 Redis::lpush('sync_submit_task', $task->id);
  44 + $this->output('分发:' . $task->id);
  45 + }
44 } 46 }
45 } 47 }
  48 + }catch (\Exception $e){
  49 + $this->output('异常:' . $e->getMessage());
46 } 50 }
47 } 51 }
48 } 52 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :SyncTimeFiles.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/8/14 14:23
  8 + */
  9 +
  10 +namespace App\Console\Commands\Sync;
  11 +
  12 +use App\Models\File\ErrorFile;
  13 +use App\Models\File\File;
  14 +use Illuminate\Console\Command;
  15 +
  16 +class SyncTimeMinuteFile extends Command
  17 +{
  18 + /**
  19 + * The name and signature of the console command.
  20 + *
  21 + * @var string
  22 + */
  23 + protected $signature = 'sync_minute_file';
  24 +
  25 + /**
  26 + * The console command description.
  27 + *
  28 + * @var string
  29 + */
  30 + protected $description = '按时间同步图片与文件(每分钟执行前面10分钟的数据)';
  31 +
  32 + public function handle()
  33 + {
  34 + $dir = '/www/wwwroot/cos';
  35 + // 获取当前时间的 Unix 时间戳
  36 + $currentTime = time();
  37 + // 获取当前时间前10分钟的 Unix 时间戳
  38 + $time10MinutesAgo = $currentTime - 10 * 60;
  39 + // 将 Unix 时间戳格式化为标准的日期时间格式
  40 + $start = date('Y-m-d H:i:s', $time10MinutesAgo);
  41 + $end = date('Y-m-d H:i:s');
  42 + $fileModel = new File();
  43 + $lists = $fileModel->list(['created_at'=>['between',[$start,$end]]]);
  44 + if(empty($lists)){
  45 + echo date('Y-m-d H:i:s') . ' | 无数据:' . PHP_EOL;
  46 + return true;
  47 + }
  48 + foreach ($lists as $v){
  49 + $path = $v['path'];
  50 + if (file_exists($dir.$path)) {
  51 + echo date('Y-m-d H:i:s') . ' | file_ok:' . $dir.$path . PHP_EOL;
  52 + continue;
  53 + }
  54 + $this->param['name'] = basename($path);
  55 + $this->param['path'] = str_replace('/'.$this->param['name'],'',$path);
  56 + $file_path = $this->getUrl($this->param['path'].'/'.$this->param['name'], 0,0);
  57 + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php';
  58 + echo date('Y-m-d H:i:s') . ' | ' . $cmd . PHP_EOL;
  59 + $code = shell_exec($cmd);
  60 + if(200 != (int)$code){
  61 + echo date('Y-m-d H:i:s') . ' | 错误状态:' . $code . PHP_EOL;
  62 + $errorFileModel = new ErrorFile();
  63 + $errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]);
  64 + }
  65 + echo date('Y-m-d H:i:s') . ' | ok:' . $code . PHP_EOL;
  66 + }
  67 + return true;
  68 + }
  69 +
  70 + /**
  71 + * @remark :获取图片文件链接
  72 + * @name :getUrl
  73 + * @author :lyh
  74 + * @method :post
  75 + * @time :2024/5/22 11:53
  76 + */
  77 + public function getUrl($path,$storage_type,$location){
  78 + if(is_array($path)){
  79 + $url =[];
  80 + foreach ($path as $v){
  81 + $url[] = $this->getUrl($v,$storage_type,$location);
  82 + }
  83 + }else{
  84 + if(empty($path)){
  85 + return '';
  86 + }
  87 + if((strpos($path,'https://')!== false) || (strpos($path,'http://') !== false)){
  88 + return $path;
  89 + }
  90 + if(substr($path,0,2) == '//'){
  91 + return 'https:'.$path;
  92 + }
  93 + if($location == 0){
  94 + $cos = config('filesystems.disks.cos');
  95 + $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
  96 + $url = $cosCdn.$path;
  97 + }else{
  98 + $s3 = config('filesystems.disks.s3');
  99 + $cdn = $s3['cdn'];
  100 + $url = $cdn.$path;
  101 + }
  102 + }
  103 + return $url;
  104 + }
  105 +}
@@ -32,7 +32,7 @@ class SyncTimeFiles extends Command @@ -32,7 +32,7 @@ class SyncTimeFiles extends Command
32 public function handle() 32 public function handle()
33 { 33 {
34 $fileModel = new File(); 34 $fileModel = new File();
35 - $start = '2024-08-10 00:00:00'; 35 + $start = '2024-08-26 00:00:00';
36 $end = date('Y-m-d H:i:s'); 36 $end = date('Y-m-d H:i:s');
37 $lists = $fileModel->list(['created_at'=>['between',[$start,$end]]]); 37 $lists = $fileModel->list(['created_at'=>['between',[$start,$end]]]);
38 foreach ($lists as $v){ 38 foreach ($lists as $v){
@@ -266,6 +266,11 @@ class CustomModuleContentController extends BaseController @@ -266,6 +266,11 @@ class CustomModuleContentController extends BaseController
266 * @time :2024/4/28 16:31 266 * @time :2024/4/28 16:31
267 */ 267 */
268 public function copyModuleContent(CustomModuleContentLogic $logic){ 268 public function copyModuleContent(CustomModuleContentLogic $logic){
  269 + $this->request->validate([
  270 + 'id'=>['required'],
  271 + ],[
  272 + 'id.required' => 'ID不能为空',
  273 + ]);
269 $data = $logic->copyModuleContentInfo(); 274 $data = $logic->copyModuleContentInfo();
270 $this->response('success',Code::SUCCESS,$data); 275 $this->response('success',Code::SUCCESS,$data);
271 } 276 }
@@ -192,7 +192,7 @@ class ExtensionModuleController extends BaseController @@ -192,7 +192,7 @@ class ExtensionModuleController extends BaseController
192 ]; 192 ];
193 $moduleValueModel->addReturnId($data); 193 $moduleValueModel->addReturnId($data);
194 }else{ 194 }else{
195 - $moduleValueModel->edit(['value'=>$v['value']],['id'=>$info['id']]); 195 + $moduleValueModel->edit(['value'=>$v['value'] ?? ''],['id'=>$info['id']]);
196 } 196 }
197 } 197 }
198 $this->response('success',Code::SUCCESS,['uuid'=>$this->param['uuid']]); 198 $this->response('success',Code::SUCCESS,['uuid'=>$this->param['uuid']]);
@@ -349,4 +349,6 @@ class ExtensionModuleController extends BaseController @@ -349,4 +349,6 @@ class ExtensionModuleController extends BaseController
349 $moduleValueModel->del(['module_id'=>$this->param['module_id'],'uuid'=>$this->param['uuid']]); 349 $moduleValueModel->del(['module_id'=>$this->param['module_id'],'uuid'=>$this->param['uuid']]);
350 $this->response('success'); 350 $this->response('success');
351 } 351 }
  352 +
  353 +
352 } 354 }
@@ -703,4 +703,22 @@ class ProductController extends BaseController @@ -703,4 +703,22 @@ class ProductController extends BaseController
703 } 703 }
704 $this->response('success',Code::SUCCESS,['id'=>$id]); 704 $this->response('success',Code::SUCCESS,['id'=>$id]);
705 } 705 }
  706 +
  707 + /**
  708 + * @remark :删除
  709 + * @name :delProductType
  710 + * @author :lyh
  711 + * @method :post
  712 + * @time :2024/8/27 9:44
  713 + */
  714 + public function delProductType(){
  715 + $this->request->validate([
  716 + 'name'=>'required',
  717 + ],[
  718 + 'name.required' => 'id不为空',
  719 + ]);
  720 + $typeModel = new ProductType();
  721 + $typeModel->del(['project_id'=>$this->user['project_id'],'name'=>$this->param['name']]);
  722 + $this->response('success');
  723 + }
706 } 724 }
@@ -146,15 +146,7 @@ class FileController @@ -146,15 +146,7 @@ class FileController
146 * @time :2024/4/8 11:10 146 * @time :2024/4/8 11:10
147 */ 147 */
148 public function synchronizationFile($fileName,$location){ 148 public function synchronizationFile($fileName,$location){
149 - //同步到大文件  
150 - $file_path = $this->getUrl($this->path.'/'.$fileName, 0,$location);  
151 - $headers = get_headers($file_path, 1);  
152 - if (strpos($headers[0], '200') === false) {  
153 - $errorFileModel = new ErrorFile();  
154 - $errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]);  
155 - }else{  
156 SyncImageFileJob::dispatch(['path'=>$this->path,'name'=>$fileName,'location'=>$location]); 149 SyncImageFileJob::dispatch(['path'=>$this->path,'name'=>$fileName,'location'=>$location]);
157 - }  
158 return true; 150 return true;
159 } 151 }
160 152
@@ -207,8 +207,9 @@ class ImageController extends Controller @@ -207,8 +207,9 @@ class ImageController extends Controller
207 $fileName = $this->getOnlyFilename($name,$param['project_id'] ?? 0); 207 $fileName = $this->getOnlyFilename($name,$param['project_id'] ?? 0);
208 //上传到cos 208 //上传到cos
209 if($this->upload_location == 0){ 209 if($this->upload_location == 0){
  210 + $watermarkOptions = $this->getProjectConfig($this->cache['project_id'] ?? 0);
210 $cosService = new CosService(); 211 $cosService = new CosService();
211 - $cosService->uploadFile($files,$this->path,$fileName); 212 + $cosService->uploadFile($files,$this->path,$fileName,false,$watermarkOptions);
212 }else{ 213 }else{
213 //TODO::上传亚马逊 214 //TODO::上传亚马逊
214 $amazonS3Service = new AmazonS3Service(); 215 $amazonS3Service = new AmazonS3Service();
@@ -231,6 +232,9 @@ class ImageController extends Controller @@ -231,6 +232,9 @@ class ImageController extends Controller
231 $suffix = array_pop($nameArr) ?? 'jpg'; 232 $suffix = array_pop($nameArr) ?? 'jpg';
232 $nameStr = implode('-', $nameArr); 233 $nameStr = implode('-', $nameArr);
233 $enName = generateRoute(Translate::tran($nameStr, 'en')); 234 $enName = generateRoute(Translate::tran($nameStr, 'en'));
  235 + if(substr($enName, 0, 1) === '-'){
  236 + $enName = $nameStr;
  237 + }
234 $fileName = $enName; 238 $fileName = $enName;
235 $i=1; 239 $i=1;
236 while($this->onlyName($enName.'.'.$suffix,$project_id)){ 240 while($this->onlyName($enName.'.'.$suffix,$project_id)){
@@ -342,7 +346,7 @@ class ImageController extends Controller @@ -342,7 +346,7 @@ class ImageController extends Controller
342 if($this->upload_location == 0){ 346 if($this->upload_location == 0){
343 $watermarkOptions = $this->getProjectConfig($this->cache['project_id'] ?? 0); 347 $watermarkOptions = $this->getProjectConfig($this->cache['project_id'] ?? 0);
344 $cosService = new CosService(); 348 $cosService = new CosService();
345 - $cosService->uploadFile($file,$this->path,$fileName,$watermarkOptions); 349 + $cosService->uploadFile($file,$this->path,$fileName,false,$watermarkOptions);
346 }else{ 350 }else{
347 //TODO::上传亚马逊 351 //TODO::上传亚马逊
348 $amazonS3Service = new AmazonS3Service(); 352 $amazonS3Service = new AmazonS3Service();
@@ -365,37 +369,44 @@ class ImageController extends Controller @@ -365,37 +369,44 @@ class ImageController extends Controller
365 * @time :2024/8/24 11:03 369 * @time :2024/8/24 11:03
366 */ 370 */
367 public function getProjectConfig($project_id = 0){ 371 public function getProjectConfig($project_id = 0){
  372 + $str = '';
368 $imageSettingModel = new ImageSetting(); 373 $imageSettingModel = new ImageSetting();
369 $settingInfo = $imageSettingModel->read(['project_id'=>$project_id]); 374 $settingInfo = $imageSettingModel->read(['project_id'=>$project_id]);
370 if($settingInfo !== false){ 375 if($settingInfo !== false){
371 if($settingInfo['status'] == 1 && !empty($settingInfo['image_data'])){ 376 if($settingInfo['status'] == 1 && !empty($settingInfo['image_data'])){
372 $image_data = json_decode($settingInfo['image_data'],true); 377 $image_data = json_decode($settingInfo['image_data'],true);
373 foreach ($image_data as $k => $v){ 378 foreach ($image_data as $k => $v){
374 - $arr = implode('/',$v);  
375 - if ($arr[0] == 'image') {  
376 - $arr[1] = urlSafeBase64Encode($arr[1]); 379 + if (str_starts_with($v, "image/")) {
  380 + $v = 'image/'.urlSafeBase64Encode(substr($v, strlen("image/")));
377 } 381 }
378 $image_data[$k] = $v; 382 $image_data[$k] = $v;
379 } 383 }
  384 + $str = 'watermark/1/'.implode('/',$image_data);
  385 + return $str;
380 } 386 }
381 if($settingInfo['status'] == 2 && !empty($settingInfo['str_data'])){ 387 if($settingInfo['status'] == 2 && !empty($settingInfo['str_data'])){
382 $str_data = json_decode($settingInfo['str_data'],true); 388 $str_data = json_decode($settingInfo['str_data'],true);
383 foreach ($str_data as $k => $v){ 389 foreach ($str_data as $k => $v){
384 - $arr = implode('/',$v); 390 + $arr = explode('/',$v);
385 if ($arr[0] == 'text') { 391 if ($arr[0] == 'text') {
386 $arr[1] = urlSafeBase64Encode($arr[1]); 392 $arr[1] = urlSafeBase64Encode($arr[1]);
  393 + $v = implode('/',$arr);
387 } 394 }
388 if ($arr[0] == 'font') { 395 if ($arr[0] == 'font') {
389 $arr[1] = urlSafeBase64Encode($arr[1]); 396 $arr[1] = urlSafeBase64Encode($arr[1]);
  397 + $v = implode('/',$arr);
390 } 398 }
391 if ($arr[0] == 'fill') { 399 if ($arr[0] == 'fill') {
392 $arr[1] = urlSafeBase64Encode($arr[1]); 400 $arr[1] = urlSafeBase64Encode($arr[1]);
  401 + $v = implode('/',$arr);
393 } 402 }
394 - $str_data[$k] = $arr; 403 + $str_data[$k] = $v;
395 } 404 }
  405 + $str = 'watermark/2/'.implode('/',$str_data);
  406 + return $str;
396 } 407 }
397 } 408 }
398 - return null; 409 + return $str;
399 } 410 }
400 411
401 /** 412 /**
@@ -726,10 +737,10 @@ class ImageController extends Controller @@ -726,10 +737,10 @@ class ImageController extends Controller
726 if($info === false){ 737 if($info === false){
727 $this->response('请先设置水印',Code::SYSTEM_ERROR); 738 $this->response('请先设置水印',Code::SYSTEM_ERROR);
728 } 739 }
729 - if($info['status'] == 1 && !empty($info['image_data'])){ 740 + if($info['status'] == 1 && empty($info['image_data'])){
730 $this->response('请先设置水印',Code::SYSTEM_ERROR); 741 $this->response('请先设置水印',Code::SYSTEM_ERROR);
731 } 742 }
732 - if($info['status'] == 2 && !empty($info['str_data'])){ 743 + if($info['status'] == 2 && empty($info['str_data'])){
733 $this->response('请先设置水印',Code::SYSTEM_ERROR); 744 $this->response('请先设置水印',Code::SYSTEM_ERROR);
734 } 745 }
735 $imageSetting->edit(['status'=>$this->param['status']],['project_id'=>$this->cache['project_id']]); 746 $imageSetting->edit(['status'=>$this->param['status']],['project_id'=>$this->cache['project_id']]);
@@ -753,7 +764,9 @@ class ImageController extends Controller @@ -753,7 +764,9 @@ class ImageController extends Controller
753 if(!empty($info['str_data'])){ 764 if(!empty($info['str_data'])){
754 $info['str_data'] = json_decode($info['str_data'],true); 765 $info['str_data'] = json_decode($info['str_data'],true);
755 } 766 }
  767 + $info['domain'] = 'http://globalso-v6-1309677403.cos.ap-hongkong.myqcloud.com';
756 } 768 }
  769 +
757 $this->response('success',Code::SUCCESS,$info); 770 $this->response('success',Code::SUCCESS,$info);
758 } 771 }
759 } 772 }
@@ -9,6 +9,7 @@ use App\Models\CustomModule\CustomModuleCategory; @@ -9,6 +9,7 @@ use App\Models\CustomModule\CustomModuleCategory;
9 use App\Models\IsCom\ProjectComConfig; 9 use App\Models\IsCom\ProjectComConfig;
10 use App\Models\News\NewsCategory; 10 use App\Models\News\NewsCategory;
11 use App\Models\Product\Category; 11 use App\Models\Product\Category;
  12 +use App\Models\Product\ProductType;
12 use App\Models\Project\PageSetting; 13 use App\Models\Project\PageSetting;
13 use App\Models\RouteMap\RouteMap; 14 use App\Models\RouteMap\RouteMap;
14 use App\Models\Service\Service as ServiceSettingModel; 15 use App\Models\Service\Service as ServiceSettingModel;
@@ -777,6 +778,15 @@ class BTemplateLogic extends BaseLogic @@ -777,6 +778,15 @@ class BTemplateLogic extends BaseLogic
777 $productCategory = $this->getCategoryList((new Category()),1); 778 $productCategory = $this->getCategoryList((new Category()),1);
778 $newCategory = $this->getCategoryList((new NewsCategory())); 779 $newCategory = $this->getCategoryList((new NewsCategory()));
779 $blogCategory = $this->getCategoryList((new BlogCategory())); 780 $blogCategory = $this->getCategoryList((new BlogCategory()));
  781 + $productTypeModel = new ProductType();
  782 + $productTypeList = $productTypeModel->list(['project_id'=>$this->user['project_id']],'id',['id','name']);
  783 + if(!empty($productTypeList)){
  784 + foreach ($productTypeList as $item){
  785 + $items['id'] = 'product_type_'.$item['id'];
  786 + $items['title'] = $item['name'];
  787 + $data["products"]["category"][] =$items;
  788 + }
  789 + }
780 if (!empty($productCategory)){ 790 if (!empty($productCategory)){
781 foreach ($productCategory as $item){$data["products"]["category"][] =$item;} 791 foreach ($productCategory as $item){$data["products"]["category"][] =$item;}
782 } 792 }
@@ -831,6 +841,15 @@ class BTemplateLogic extends BaseLogic @@ -831,6 +841,15 @@ class BTemplateLogic extends BaseLogic
831 foreach ($data as $key => $values){ 841 foreach ($data as $key => $values){
832 switch ($values['name']){ 842 switch ($values['name']){
833 case '产品': 843 case '产品':
  844 + $productTypeModel = new ProductType();
  845 + $productTypeList = $productTypeModel->list(['project_id'=>$this->user['project_id']],'id',['id','name']);
  846 + if(!empty($productTypeList)){
  847 + foreach ($productTypeList as $item){
  848 + $items['id'] = 'product_type_'.$item['id'];
  849 + $items['title'] = $item['name'];
  850 + $values['category'][] = $items;
  851 + }
  852 + }
834 $productCategory = $this->getCategoryList((new Category()),1,['id','title','pid']); 853 $productCategory = $this->getCategoryList((new Category()),1,['id','title','pid']);
835 if(!empty($productCategory)){ 854 if(!empty($productCategory)){
836 foreach ($productCategory as $item){ 855 foreach ($productCategory as $item){
@@ -23,7 +23,7 @@ class CosService @@ -23,7 +23,7 @@ class CosService
23 * @method :post 23 * @method :post
24 * @time :2023/7/19 15:28 24 * @time :2023/7/19 15:28
25 */ 25 */
26 - public function uploadFile(&$files,$path,$filename, $binary = false,$watermarkOptions = null) 26 + public function uploadFile(&$files,$path,$filename, $binary = false,$watermarkOptions = '')
27 { 27 {
28 $cos = config('filesystems.disks.cos'); 28 $cos = config('filesystems.disks.cos');
29 $cosClient = new Client([ 29 $cosClient = new Client([
@@ -42,18 +42,17 @@ class CosService @@ -42,18 +42,17 @@ class CosService
42 ]; 42 ];
43 //水印 43 //水印
44 if ($watermarkOptions) { 44 if ($watermarkOptions) {
45 - $options['Pic-Operations'] = json_encode([ 45 + $options['PicOperations'] = json_encode([
46 'is_pic_info' => 1, 46 'is_pic_info' => 1,
47 'rules' => [ 47 'rules' => [
48 [ 48 [
49 - 'fileid' => $filename, // 使用相同的文件名保存  
50 - 'rule' => 'watermark/1/'.implode('/',$watermarkOptions), 49 + 'fileid' => $key, // 使用相同的文件名保存
  50 + 'rule' => $watermarkOptions,
51 ] 51 ]
52 ] 52 ]
53 - ]); 53 + ], true);
54 } 54 }
55 - // 上传文件  
56 - $cosClient->putObject($options); 55 + $res = $cosClient->putObject($options);
57 return $key; 56 return $key;
58 } 57 }
59 58
@@ -189,7 +188,7 @@ class CosService @@ -189,7 +188,7 @@ class CosService
189 if($is_image){ 188 if($is_image){
190 $param = [ 189 $param = [
191 'image/'.urlSafeBase64Encode($domain.$data['image'] ?? ''),//图片 190 'image/'.urlSafeBase64Encode($domain.$data['image'] ?? ''),//图片
192 - 'gravity/'.($data['gravity'] ?? 'SouthEast'), 191 + 'gravity/'.($data['gravity'] ?? 'southeast'),
193 'dx/'.($data['dx'] ?? 0), 192 'dx/'.($data['dx'] ?? 0),
194 'dy/'. ($data['dy'] ?? 0), 193 'dy/'. ($data['dy'] ?? 0),
195 'batch/'.($data['batch'] ?? 0),//平铺水印功能 194 'batch/'.($data['batch'] ?? 0),//平铺水印功能
@@ -200,7 +199,7 @@ class CosService @@ -200,7 +199,7 @@ class CosService
200 }else{ 199 }else{
201 $param = [ 200 $param = [
202 'text/'.urlSafeBase64Encode($data['text'] ?? ''),//文字水印名称 201 'text/'.urlSafeBase64Encode($data['text'] ?? ''),//文字水印名称
203 - 'gravity/'.($data['gravity'] ?? 'SouthEast'), 202 + 'gravity/'.($data['gravity'] ?? 'southeast'),
204 'dx/'.($data['dx'] ?? 10), 203 'dx/'.($data['dx'] ?? 10),
205 'dy/'. ($data['dy'] ?? 10), 204 'dy/'. ($data['dy'] ?? 10),
206 'font/'.urlSafeBase64Encode($data['font'] ?? 'tahoma.ttf'),//默认宋体 205 'font/'.urlSafeBase64Encode($data['font'] ?? 'tahoma.ttf'),//默认宋体
@@ -259,6 +259,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -259,6 +259,7 @@ Route::middleware(['bloginauth'])->group(function () {
259 Route::any('/delProductKeyword', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductKeyword'])->name('product_delProductKeyword'); 259 Route::any('/delProductKeyword', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductKeyword'])->name('product_delProductKeyword');
260 Route::any('/getProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getProductType'])->name('product_getProductType'); 260 Route::any('/getProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getProductType'])->name('product_getProductType');
261 Route::any('/saveType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'saveType'])->name('product_saveType'); 261 Route::any('/saveType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'saveType'])->name('product_saveType');
  262 + Route::any('/delProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductType'])->name('product_delProductType');
262 //产品分类 263 //产品分类
263 Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category'); 264 Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category');
264 Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info'); 265 Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info');