Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-server
正在显示
7 个修改的文件
包含
66 行增加
和
14 行删除
| @@ -12,6 +12,7 @@ use App\Models\Nav\BNav; | @@ -12,6 +12,7 @@ use App\Models\Nav\BNav; | ||
| 12 | use App\Models\Nav\BNavGroup; | 12 | use App\Models\Nav\BNavGroup; |
| 13 | use App\Models\Project\OnlineCheck; | 13 | use App\Models\Project\OnlineCheck; |
| 14 | use App\Models\Project\Project; | 14 | use App\Models\Project\Project; |
| 15 | +use App\Models\Project\ProjectUpdateTdk; | ||
| 15 | use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel; | 16 | use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel; |
| 16 | use App\Models\WebSetting\Translate as TranslateModel; | 17 | use App\Models\WebSetting\Translate as TranslateModel; |
| 17 | use App\Models\WebSetting\WebLanguage; | 18 | use App\Models\WebSetting\WebLanguage; |
| @@ -58,6 +59,13 @@ class Test extends Command | @@ -58,6 +59,13 @@ class Test extends Command | ||
| 58 | */ | 59 | */ |
| 59 | public function handle() | 60 | public function handle() |
| 60 | { | 61 | { |
| 62 | + | ||
| 63 | + $ids = '295,792,1788,968,1678,1408,1780,104,1720,160,1337,1382,1773,1787,1261,1872,185,1889,1823,1572,696,1632,1504,1042,1252,491,1867,1277,1712,1939,1577,499,1812,1852,235,732,388,1848,1880,1885,1920,826,1368,1535,1679,1584,1665,773,1841,1303,1442,13,1591,1894,2066,1887,1888,1817,1778,1673,1391,1751,1607,2010,1483,2062,2000,2019,2091,1602,1985,1514,1768,1703,1596,1955,1989,1900,1373,1779,1619,1824,404,1869,1891,1215,1589,1686,1322,1681,1378,1487,1431,1133,1415,1876,1911,1672,1992,1715,1929,1171,1997,1816,1842,2017,2107,1644,2104,2201,1468,2092,211,2097,1993,829,2124,1241'; | ||
| 64 | + $ids = explode(',' ,$ids); | ||
| 65 | + foreach ($ids as $id){ | ||
| 66 | + ProjectUpdateTdk::add_task($id); | ||
| 67 | + } | ||
| 68 | + exit; | ||
| 61 | $date = '2024-05-16'; | 69 | $date = '2024-05-16'; |
| 62 | $list = $this->getProjectList(); | 70 | $list = $this->getProjectList(); |
| 63 | foreach ($list as $item){ | 71 | foreach ($list as $item){ |
| @@ -15,6 +15,7 @@ use App\Models\Project\Project; | @@ -15,6 +15,7 @@ use App\Models\Project\Project; | ||
| 15 | use App\Services\AmazonS3Service; | 15 | use App\Services\AmazonS3Service; |
| 16 | use App\Services\CosService; | 16 | use App\Services\CosService; |
| 17 | use App\Services\TencentCosService; | 17 | use App\Services\TencentCosService; |
| 18 | +use App\Services\UpyunService; | ||
| 18 | use Illuminate\Http\Exceptions\HttpResponseException; | 19 | use Illuminate\Http\Exceptions\HttpResponseException; |
| 19 | use Illuminate\Http\JsonResponse; | 20 | use Illuminate\Http\JsonResponse; |
| 20 | use Illuminate\Support\Facades\Cache; | 21 | use Illuminate\Support\Facades\Cache; |
| @@ -517,6 +518,28 @@ class ImageController extends Controller | @@ -517,6 +518,28 @@ class ImageController extends Controller | ||
| 517 | } | 518 | } |
| 518 | 519 | ||
| 519 | /** | 520 | /** |
| 521 | + * @remark :覆盖原图 | ||
| 522 | + * @name :coverOriginalImage | ||
| 523 | + * @author :lyh | ||
| 524 | + * @method :post | ||
| 525 | + * @time :2024/8/21 11:45 | ||
| 526 | + */ | ||
| 527 | + public function coverOriginalImage(){ | ||
| 528 | + $this->request->validate([ | ||
| 529 | + 'url'=>['required'], | ||
| 530 | + 'saveUrl'=>['required'], | ||
| 531 | + ],[ | ||
| 532 | + 'url.required'=>'请填写预览的链接', | ||
| 533 | + 'saveUrl.required'=>'保存的路径', | ||
| 534 | + ]); | ||
| 535 | + $cos = new CosService(); | ||
| 536 | + $url = $cos->coverOriginalImage($this->param['url'],$this->param['saveUrl']); | ||
| 537 | + $upYun = new UpyunService(); | ||
| 538 | + $upYun->purgePush($url); | ||
| 539 | + $this->response('success',Code::SUCCESS,['url'=>$url]); | ||
| 540 | + } | ||
| 541 | + | ||
| 542 | + /** | ||
| 520 | * @remark :设置图片水印 | 543 | * @remark :设置图片水印 |
| 521 | * @name :setWatermark | 544 | * @name :setWatermark |
| 522 | * @author :lyh | 545 | * @author :lyh |
| @@ -532,7 +555,7 @@ class ImageController extends Controller | @@ -532,7 +555,7 @@ class ImageController extends Controller | ||
| 532 | 'is_image.required'=>'请设置文本水印还是图片水印', | 555 | 'is_image.required'=>'请设置文本水印还是图片水印', |
| 533 | ]); | 556 | ]); |
| 534 | $cos = new CosService(); | 557 | $cos = new CosService(); |
| 535 | - $url = $cos->setWatermark($this->param['url'], $this->param['data'],true); | 558 | + $url = $cos->setWatermark($this->param['url'], $this->param['data'],$this->param['is_image']); |
| 536 | $this->response('success',Code::SUCCESS,['url'=>$url]); | 559 | $this->response('success',Code::SUCCESS,['url'=>$url]); |
| 537 | } | 560 | } |
| 538 | 561 |
| @@ -114,7 +114,7 @@ class BTemplateLogic extends BaseLogic | @@ -114,7 +114,7 @@ class BTemplateLogic extends BaseLogic | ||
| 114 | $condition = ['common_type'=>BTemplate::COMMON_HEAD,'source'=>'','is_list'=>$is_list,'is_custom'=>$is_custom,'template_id'=>$template_id]; | 114 | $condition = ['common_type'=>BTemplate::COMMON_HEAD,'source'=>'','is_list'=>$is_list,'is_custom'=>$is_custom,'template_id'=>$template_id]; |
| 115 | $headComInfo = $this->getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id); | 115 | $headComInfo = $this->getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id); |
| 116 | $bTemplateComModel = new BTemplateCom(); | 116 | $bTemplateComModel = new BTemplateCom(); |
| 117 | - $otherInfo = $bTemplateComModel->read(['source'=>$headComInfo['source'],'common_type'=>BTemplate::COMMON_OTHER,'is_list'=>$headComInfo['is_list'],'is_custom'=>$headComInfo['is_custom']]); | 117 | + $otherInfo = $bTemplateComModel->read(['source'=>$headComInfo['source'],'common_type'=>BTemplate::COMMON_OTHER,'is_list'=>$headComInfo['is_list'],'is_custom'=>$headComInfo['is_custom'],'template_id'=>$template_id]); |
| 118 | if($otherInfo === false){ | 118 | if($otherInfo === false){ |
| 119 | $this->fail('获取失败,请联系管理员222'); | 119 | $this->fail('获取失败,请联系管理员222'); |
| 120 | } | 120 | } |
| @@ -139,7 +139,7 @@ class BTemplateLogic extends BaseLogic | @@ -139,7 +139,7 @@ class BTemplateLogic extends BaseLogic | ||
| 139 | $headComInfo = $bTemplateComModel->read($condition); | 139 | $headComInfo = $bTemplateComModel->read($condition); |
| 140 | if($headComInfo === false){ | 140 | if($headComInfo === false){ |
| 141 | //取默认公共的 | 141 | //取默认公共的 |
| 142 | - $headComInfo = $bTemplateComModel->read(['source'=>BTemplate::SOURCE_COM,'common_type'=>BTemplate::COMMON_HEAD]); | 142 | + $headComInfo = $bTemplateComModel->read(['source'=>BTemplate::SOURCE_COM,'common_type'=>BTemplate::COMMON_HEAD,'template_id'=>$template_id]); |
| 143 | if($headComInfo === false){ | 143 | if($headComInfo === false){ |
| 144 | $this->fail('获取失败,请联系管理员111'); | 144 | $this->fail('获取失败,请联系管理员111'); |
| 145 | } | 145 | } |
| @@ -160,7 +160,7 @@ class BTemplateLogic extends BaseLogic | @@ -160,7 +160,7 @@ class BTemplateLogic extends BaseLogic | ||
| 160 | $footerComInfo = $bTemplateComModel->read($condition); | 160 | $footerComInfo = $bTemplateComModel->read($condition); |
| 161 | if($footerComInfo === false){ | 161 | if($footerComInfo === false){ |
| 162 | //取默认首页的 | 162 | //取默认首页的 |
| 163 | - $footerComInfo = $bTemplateComModel->read(['source'=>BTemplate::SOURCE_COM,'common_type'=>BTemplate::COMMON_FOOTER]); | 163 | + $footerComInfo = $bTemplateComModel->read(['source'=>BTemplate::SOURCE_COM,'common_type'=>BTemplate::COMMON_FOOTER,'template_id'=>$template_id]); |
| 164 | if($footerComInfo === false){ | 164 | if($footerComInfo === false){ |
| 165 | $this->fail('获取失败,请联系管理员'); | 165 | $this->fail('获取失败,请联系管理员'); |
| 166 | } | 166 | } |
| @@ -51,33 +51,50 @@ class CustomTemplateLogic extends BaseLogic | @@ -51,33 +51,50 @@ class CustomTemplateLogic extends BaseLogic | ||
| 51 | $this->fail('当前数据不存在'); | 51 | $this->fail('当前数据不存在'); |
| 52 | } | 52 | } |
| 53 | if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){ | 53 | if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){ |
| 54 | - $html = $this->getTemplateComHtml($info['html'],$info['html_style']); | 54 | + $template_id = $this->getTemplateId(); |
| 55 | + $html = $this->getTemplateComHtml($info['html'],$info['html_style'],$template_id); | ||
| 55 | $info['html'] = $this->getHeadFooter($html); | 56 | $info['html'] = $this->getHeadFooter($html); |
| 56 | } | 57 | } |
| 57 | return $this->success($info); | 58 | return $this->success($info); |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | /** | 61 | /** |
| 62 | + * @remark :获取模版id | ||
| 63 | + * @name :getTemplateId | ||
| 64 | + * @author :lyh | ||
| 65 | + * @method :post | ||
| 66 | + * @time :2023/12/27 10:51 | ||
| 67 | + */ | ||
| 68 | + public function getTemplateId(){ | ||
| 69 | + $bSettingModel = new Setting(); | ||
| 70 | + $bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']],['id','template_id']); | ||
| 71 | + if($bSettingInfo === false){ | ||
| 72 | + $this->fail('请先设置模板'); | ||
| 73 | + } | ||
| 74 | + return $this->success($bSettingInfo['template_id']); | ||
| 75 | + } | ||
| 76 | + /** | ||
| 61 | * @remark :非定制获取头部+底部 | 77 | * @remark :非定制获取头部+底部 |
| 62 | * @name :getTemplateComHtml | 78 | * @name :getTemplateComHtml |
| 63 | * @author :lyh | 79 | * @author :lyh |
| 64 | * @method :post | 80 | * @method :post |
| 65 | * @time :2024/4/29 16:53 | 81 | * @time :2024/4/29 16:53 |
| 66 | */ | 82 | */ |
| 67 | - public function getTemplateComHtml($html,$html_style){ | 83 | + public function getTemplateComHtml($html,$html_style,$template_id){ |
| 68 | if(empty($html)){ | 84 | if(empty($html)){ |
| 69 | $html = "<main></main>"; | 85 | $html = "<main></main>"; |
| 70 | $html_style = "<style id='globalsojs-styles'></style>"; | 86 | $html_style = "<style id='globalsojs-styles'></style>"; |
| 71 | } | 87 | } |
| 72 | - $headComInfo = $this->getHeadComHtml(['common_type'=>BTemplate::COMMON_HEAD]); | 88 | + $headComInfo = $this->getHeadComHtml(['common_type'=>BTemplate::COMMON_HEAD,'template_id'=>$template_id]); |
| 73 | $bTemplateComModel = new BTemplateCom(); | 89 | $bTemplateComModel = new BTemplateCom(); |
| 74 | $condition['common_type'] = BTemplate::COMMON_OTHER; | 90 | $condition['common_type'] = BTemplate::COMMON_OTHER; |
| 75 | $condition['source'] = $headComInfo['source']; | 91 | $condition['source'] = $headComInfo['source']; |
| 92 | + $condition['template_id'] = $template_id; | ||
| 76 | $otherInfo = $bTemplateComModel->read($condition); | 93 | $otherInfo = $bTemplateComModel->read($condition); |
| 77 | if($otherInfo === false){ | 94 | if($otherInfo === false){ |
| 78 | $this->fail('获取失败,请联系管理员'); | 95 | $this->fail('获取失败,请联系管理员'); |
| 79 | } | 96 | } |
| 80 | - $footerComInfo = $this->getFooterComHtml(); | 97 | + $footerComInfo = $this->getFooterComHtml($template_id); |
| 81 | $commonInfo = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '', | 98 | $commonInfo = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '', |
| 82 | 'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? '']; | 99 | 'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? '']; |
| 83 | $html = $commonInfo['head_style'].$html_style.$commonInfo['footer_style'].$commonInfo['other']. $commonInfo['head_html'].$html.$commonInfo['footer_html']; | 100 | $html = $commonInfo['head_style'].$html_style.$commonInfo['footer_style'].$commonInfo['other']. $commonInfo['head_html'].$html.$commonInfo['footer_html']; |
| @@ -98,6 +115,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -98,6 +115,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 98 | $headComInfo = $bTemplateComModel->read($condition); | 115 | $headComInfo = $bTemplateComModel->read($condition); |
| 99 | if($headComInfo === false){ | 116 | if($headComInfo === false){ |
| 100 | //取默认公共的 | 117 | //取默认公共的 |
| 118 | + $template_id = $this->getTemplateId(); | ||
| 101 | $condition['source'] = BTemplate::SOURCE_COM; | 119 | $condition['source'] = BTemplate::SOURCE_COM; |
| 102 | $headComInfo = $bTemplateComModel->read($condition); | 120 | $headComInfo = $bTemplateComModel->read($condition); |
| 103 | if($headComInfo === false){ | 121 | if($headComInfo === false){ |
| @@ -113,12 +131,14 @@ class CustomTemplateLogic extends BaseLogic | @@ -113,12 +131,14 @@ class CustomTemplateLogic extends BaseLogic | ||
| 113 | * @method :post | 131 | * @method :post |
| 114 | * @time :2024/4/29 17:18 | 132 | * @time :2024/4/29 17:18 |
| 115 | */ | 133 | */ |
| 116 | - public function getFooterComHtml(){ | 134 | + public function getFooterComHtml($template_id){ |
| 117 | $bTemplateComModel = new BTemplateCom(); | 135 | $bTemplateComModel = new BTemplateCom(); |
| 136 | + $condition['template_id'] = $template_id; | ||
| 118 | $condition['common_type'] = BTemplate::COMMON_FOOTER; | 137 | $condition['common_type'] = BTemplate::COMMON_FOOTER; |
| 119 | $condition['source'] = $this->getType(BTemplate::COMMON_FOOTER); | 138 | $condition['source'] = $this->getType(BTemplate::COMMON_FOOTER); |
| 120 | $footerComInfo = $bTemplateComModel->read($condition); | 139 | $footerComInfo = $bTemplateComModel->read($condition); |
| 121 | if($footerComInfo === false){ | 140 | if($footerComInfo === false){ |
| 141 | + $template_id = $this->getTemplateId(); | ||
| 122 | //取默认首页的 | 142 | //取默认首页的 |
| 123 | $condition['source'] = BTemplate::SOURCE_COM; | 143 | $condition['source'] = BTemplate::SOURCE_COM; |
| 124 | $footerComInfo = $bTemplateComModel->read($condition); | 144 | $footerComInfo = $bTemplateComModel->read($condition); |
| @@ -72,7 +72,7 @@ class InitHtmlLogic extends BaseLogic | @@ -72,7 +72,7 @@ class InitHtmlLogic extends BaseLogic | ||
| 72 | $condition = ['common_type'=>BTemplate::COMMON_HEAD,'source'=>$source,'is_list'=>$is_list,'is_custom'=>$is_custom,'template_id'=>$template_id]; | 72 | $condition = ['common_type'=>BTemplate::COMMON_HEAD,'source'=>$source,'is_list'=>$is_list,'is_custom'=>$is_custom,'template_id'=>$template_id]; |
| 73 | $headComInfo = $this->getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id); | 73 | $headComInfo = $this->getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id); |
| 74 | $bTemplateComModel = new BTemplateCom(); | 74 | $bTemplateComModel = new BTemplateCom(); |
| 75 | - $otherInfo = $bTemplateComModel->read(['source'=>$headComInfo['source'],'common_type'=>BTemplate::COMMON_OTHER,'is_list'=>$headComInfo['is_list'],'is_custom'=>$headComInfo['is_custom']]); | 75 | + $otherInfo = $bTemplateComModel->read(['template_id'=>$template_id,'source'=>$headComInfo['source'],'common_type'=>BTemplate::COMMON_OTHER,'is_list'=>$headComInfo['is_list'],'is_custom'=>$headComInfo['is_custom']]); |
| 76 | if($otherInfo === false){ | 76 | if($otherInfo === false){ |
| 77 | $this->fail('获取失败,请联系管理员2'); | 77 | $this->fail('获取失败,请联系管理员2'); |
| 78 | } | 78 | } |
| @@ -187,13 +187,13 @@ class CosService | @@ -187,13 +187,13 @@ class CosService | ||
| 187 | $url = $domain . $cdnUrl; | 187 | $url = $domain . $cdnUrl; |
| 188 | if($is_image){ | 188 | if($is_image){ |
| 189 | $param = [ | 189 | $param = [ |
| 190 | - 'image/'.$this->urlSafeBase64Encode($domain.$data['image'] ?? ''),//文字水印名称 | 190 | + 'image/'.$this->urlSafeBase64Encode($domain.$data['image'] ?? ''),//图片 |
| 191 | 'gravity/'.($data['gravity'] ?? 'SouthEast'), | 191 | 'gravity/'.($data['gravity'] ?? 'SouthEast'), |
| 192 | 'dx/'.($data['dx'] ?? 0), | 192 | 'dx/'.($data['dx'] ?? 0), |
| 193 | 'dy/'. ($data['dy'] ?? 0), | 193 | 'dy/'. ($data['dy'] ?? 0), |
| 194 | 'batch/'.($data['batch'] ?? 0),//平铺水印功能 | 194 | 'batch/'.($data['batch'] ?? 0),//平铺水印功能 |
| 195 | 'dissolve/'.($data['dissolve'] ?? 50),//透明度 | 195 | 'dissolve/'.($data['dissolve'] ?? 50),//透明度 |
| 196 | - 'degree/'.($data['degree'] ?? 0),//文字水印的旋转角度设置,取值范围为0 - 360,默认0 | 196 | + 'degree/'.($data['degree'] ?? 0),//旋转角度设置,取值范围为0 - 360,默认0 |
| 197 | ]; | 197 | ]; |
| 198 | $url = $url.'?watermark/1/'.implode('/',$param); | 198 | $url = $url.'?watermark/1/'.implode('/',$param); |
| 199 | }else{ | 199 | }else{ |
| @@ -216,13 +216,13 @@ class CosService | @@ -216,13 +216,13 @@ class CosService | ||
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | /** | 218 | /** |
| 219 | - * @remark :添加水印后保存图片(覆盖) | 219 | + * @remark :添加水印后保存图片(覆盖/非覆盖的文件未存入数据库) |
| 220 | * @name :uploadImages | 220 | * @name :uploadImages |
| 221 | * @author :lyh | 221 | * @author :lyh |
| 222 | * @method :post | 222 | * @method :post |
| 223 | * @time :2024/8/19 17:06 | 223 | * @time :2024/8/19 17:06 |
| 224 | */ | 224 | */ |
| 225 | - public function uploadImages($url,$cdnUrl){ | 225 | + public function coverOriginalImage($url,$cdnUrl){ |
| 226 | // 获取水印后的图片内容 | 226 | // 获取水印后的图片内容 |
| 227 | $imageContent = file_get_contents($url); | 227 | $imageContent = file_get_contents($url); |
| 228 | // 使用 COS SDK 将图片重新上传并覆盖原图 | 228 | // 使用 COS SDK 将图片重新上传并覆盖原图 |
| @@ -319,6 +319,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -319,6 +319,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 319 | Route::post('/getFont', [\App\Http\Controllers\File\ImageController::class, 'getFont'])->name('images_getFont'); | 319 | Route::post('/getFont', [\App\Http\Controllers\File\ImageController::class, 'getFont'])->name('images_getFont'); |
| 320 | Route::post('/getPosition', [\App\Http\Controllers\File\ImageController::class, 'getPosition'])->name('images_getPosition'); | 320 | Route::post('/getPosition', [\App\Http\Controllers\File\ImageController::class, 'getPosition'])->name('images_getPosition'); |
| 321 | Route::post('/setWatermark', [\App\Http\Controllers\File\ImageController::class, 'setWatermark'])->name('images_setWatermark'); | 321 | Route::post('/setWatermark', [\App\Http\Controllers\File\ImageController::class, 'setWatermark'])->name('images_setWatermark'); |
| 322 | + Route::post('/coverOriginalImage', [\App\Http\Controllers\File\ImageController::class, 'coverOriginalImage'])->name('images_coverOriginalImage'); | ||
| 322 | Route::any('/getImageList', [\App\Http\Controllers\File\ImageController::class, 'getImageList'])->name('image_getImageList'); | 323 | Route::any('/getImageList', [\App\Http\Controllers\File\ImageController::class, 'getImageList'])->name('image_getImageList'); |
| 323 | }); | 324 | }); |
| 324 | //文件操作 | 325 | //文件操作 |
-
请 注册 或 登录 后发表评论