作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-server

... ... @@ -12,6 +12,7 @@ use App\Models\Nav\BNav;
use App\Models\Nav\BNavGroup;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use App\Models\Project\ProjectUpdateTdk;
use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel;
use App\Models\WebSetting\Translate as TranslateModel;
use App\Models\WebSetting\WebLanguage;
... ... @@ -58,6 +59,13 @@ class Test extends Command
*/
public function handle()
{
$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';
$ids = explode(',' ,$ids);
foreach ($ids as $id){
ProjectUpdateTdk::add_task($id);
}
exit;
$date = '2024-05-16';
$list = $this->getProjectList();
foreach ($list as $item){
... ...
... ... @@ -15,6 +15,7 @@ use App\Models\Project\Project;
use App\Services\AmazonS3Service;
use App\Services\CosService;
use App\Services\TencentCosService;
use App\Services\UpyunService;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Cache;
... ... @@ -517,6 +518,28 @@ class ImageController extends Controller
}
/**
* @remark :覆盖原图
* @name :coverOriginalImage
* @author :lyh
* @method :post
* @time :2024/8/21 11:45
*/
public function coverOriginalImage(){
$this->request->validate([
'url'=>['required'],
'saveUrl'=>['required'],
],[
'url.required'=>'请填写预览的链接',
'saveUrl.required'=>'保存的路径',
]);
$cos = new CosService();
$url = $cos->coverOriginalImage($this->param['url'],$this->param['saveUrl']);
$upYun = new UpyunService();
$upYun->purgePush($url);
$this->response('success',Code::SUCCESS,['url'=>$url]);
}
/**
* @remark :设置图片水印
* @name :setWatermark
* @author :lyh
... ... @@ -532,7 +555,7 @@ class ImageController extends Controller
'is_image.required'=>'请设置文本水印还是图片水印',
]);
$cos = new CosService();
$url = $cos->setWatermark($this->param['url'], $this->param['data'],true);
$url = $cos->setWatermark($this->param['url'], $this->param['data'],$this->param['is_image']);
$this->response('success',Code::SUCCESS,['url'=>$url]);
}
... ...
... ... @@ -114,7 +114,7 @@ class BTemplateLogic extends BaseLogic
$condition = ['common_type'=>BTemplate::COMMON_HEAD,'source'=>'','is_list'=>$is_list,'is_custom'=>$is_custom,'template_id'=>$template_id];
$headComInfo = $this->getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id);
$bTemplateComModel = new BTemplateCom();
$otherInfo = $bTemplateComModel->read(['source'=>$headComInfo['source'],'common_type'=>BTemplate::COMMON_OTHER,'is_list'=>$headComInfo['is_list'],'is_custom'=>$headComInfo['is_custom']]);
$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]);
if($otherInfo === false){
$this->fail('获取失败,请联系管理员222');
}
... ... @@ -139,7 +139,7 @@ class BTemplateLogic extends BaseLogic
$headComInfo = $bTemplateComModel->read($condition);
if($headComInfo === false){
//取默认公共的
$headComInfo = $bTemplateComModel->read(['source'=>BTemplate::SOURCE_COM,'common_type'=>BTemplate::COMMON_HEAD]);
$headComInfo = $bTemplateComModel->read(['source'=>BTemplate::SOURCE_COM,'common_type'=>BTemplate::COMMON_HEAD,'template_id'=>$template_id]);
if($headComInfo === false){
$this->fail('获取失败,请联系管理员111');
}
... ... @@ -160,7 +160,7 @@ class BTemplateLogic extends BaseLogic
$footerComInfo = $bTemplateComModel->read($condition);
if($footerComInfo === false){
//取默认首页的
$footerComInfo = $bTemplateComModel->read(['source'=>BTemplate::SOURCE_COM,'common_type'=>BTemplate::COMMON_FOOTER]);
$footerComInfo = $bTemplateComModel->read(['source'=>BTemplate::SOURCE_COM,'common_type'=>BTemplate::COMMON_FOOTER,'template_id'=>$template_id]);
if($footerComInfo === false){
$this->fail('获取失败,请联系管理员');
}
... ...
... ... @@ -51,33 +51,50 @@ class CustomTemplateLogic extends BaseLogic
$this->fail('当前数据不存在');
}
if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){
$html = $this->getTemplateComHtml($info['html'],$info['html_style']);
$template_id = $this->getTemplateId();
$html = $this->getTemplateComHtml($info['html'],$info['html_style'],$template_id);
$info['html'] = $this->getHeadFooter($html);
}
return $this->success($info);
}
/**
* @remark :获取模版id
* @name :getTemplateId
* @author :lyh
* @method :post
* @time :2023/12/27 10:51
*/
public function getTemplateId(){
$bSettingModel = new Setting();
$bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']],['id','template_id']);
if($bSettingInfo === false){
$this->fail('请先设置模板');
}
return $this->success($bSettingInfo['template_id']);
}
/**
* @remark :非定制获取头部+底部
* @name :getTemplateComHtml
* @author :lyh
* @method :post
* @time :2024/4/29 16:53
*/
public function getTemplateComHtml($html,$html_style){
public function getTemplateComHtml($html,$html_style,$template_id){
if(empty($html)){
$html = "<main></main>";
$html_style = "<style id='globalsojs-styles'></style>";
}
$headComInfo = $this->getHeadComHtml(['common_type'=>BTemplate::COMMON_HEAD]);
$headComInfo = $this->getHeadComHtml(['common_type'=>BTemplate::COMMON_HEAD,'template_id'=>$template_id]);
$bTemplateComModel = new BTemplateCom();
$condition['common_type'] = BTemplate::COMMON_OTHER;
$condition['source'] = $headComInfo['source'];
$condition['template_id'] = $template_id;
$otherInfo = $bTemplateComModel->read($condition);
if($otherInfo === false){
$this->fail('获取失败,请联系管理员');
}
$footerComInfo = $this->getFooterComHtml();
$footerComInfo = $this->getFooterComHtml($template_id);
$commonInfo = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '',
'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? ''];
$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
$headComInfo = $bTemplateComModel->read($condition);
if($headComInfo === false){
//取默认公共的
$template_id = $this->getTemplateId();
$condition['source'] = BTemplate::SOURCE_COM;
$headComInfo = $bTemplateComModel->read($condition);
if($headComInfo === false){
... ... @@ -113,12 +131,14 @@ class CustomTemplateLogic extends BaseLogic
* @method :post
* @time :2024/4/29 17:18
*/
public function getFooterComHtml(){
public function getFooterComHtml($template_id){
$bTemplateComModel = new BTemplateCom();
$condition['template_id'] = $template_id;
$condition['common_type'] = BTemplate::COMMON_FOOTER;
$condition['source'] = $this->getType(BTemplate::COMMON_FOOTER);
$footerComInfo = $bTemplateComModel->read($condition);
if($footerComInfo === false){
$template_id = $this->getTemplateId();
//取默认首页的
$condition['source'] = BTemplate::SOURCE_COM;
$footerComInfo = $bTemplateComModel->read($condition);
... ...
... ... @@ -72,7 +72,7 @@ class InitHtmlLogic extends BaseLogic
$condition = ['common_type'=>BTemplate::COMMON_HEAD,'source'=>$source,'is_list'=>$is_list,'is_custom'=>$is_custom,'template_id'=>$template_id];
$headComInfo = $this->getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id);
$bTemplateComModel = new BTemplateCom();
$otherInfo = $bTemplateComModel->read(['source'=>$headComInfo['source'],'common_type'=>BTemplate::COMMON_OTHER,'is_list'=>$headComInfo['is_list'],'is_custom'=>$headComInfo['is_custom']]);
$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']]);
if($otherInfo === false){
$this->fail('获取失败,请联系管理员2');
}
... ...
... ... @@ -187,13 +187,13 @@ class CosService
$url = $domain . $cdnUrl;
if($is_image){
$param = [
'image/'.$this->urlSafeBase64Encode($domain.$data['image'] ?? ''),//文字水印名称
'image/'.$this->urlSafeBase64Encode($domain.$data['image'] ?? ''),//图片
'gravity/'.($data['gravity'] ?? 'SouthEast'),
'dx/'.($data['dx'] ?? 0),
'dy/'. ($data['dy'] ?? 0),
'batch/'.($data['batch'] ?? 0),//平铺水印功能
'dissolve/'.($data['dissolve'] ?? 50),//透明度
'degree/'.($data['degree'] ?? 0),//文字水印的旋转角度设置,取值范围为0 - 360,默认0
'degree/'.($data['degree'] ?? 0),//旋转角度设置,取值范围为0 - 360,默认0
];
$url = $url.'?watermark/1/'.implode('/',$param);
}else{
... ... @@ -216,13 +216,13 @@ class CosService
}
/**
* @remark :添加水印后保存图片(覆盖)
* @remark :添加水印后保存图片(覆盖/非覆盖的文件未存入数据库
* @name :uploadImages
* @author :lyh
* @method :post
* @time :2024/8/19 17:06
*/
public function uploadImages($url,$cdnUrl){
public function coverOriginalImage($url,$cdnUrl){
// 获取水印后的图片内容
$imageContent = file_get_contents($url);
// 使用 COS SDK 将图片重新上传并覆盖原图
... ...
... ... @@ -319,6 +319,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::post('/getFont', [\App\Http\Controllers\File\ImageController::class, 'getFont'])->name('images_getFont');
Route::post('/getPosition', [\App\Http\Controllers\File\ImageController::class, 'getPosition'])->name('images_getPosition');
Route::post('/setWatermark', [\App\Http\Controllers\File\ImageController::class, 'setWatermark'])->name('images_setWatermark');
Route::post('/coverOriginalImage', [\App\Http\Controllers\File\ImageController::class, 'coverOriginalImage'])->name('images_coverOriginalImage');
Route::any('/getImageList', [\App\Http\Controllers\File\ImageController::class, 'getImageList'])->name('image_getImageList');
});
//文件操作
... ...