作者 Your Name
... ... @@ -78,10 +78,10 @@ class DeleteBlogCategory extends Command
$this->updateCategory();
DB::disconnect('custom_mysql');
$noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]);
echo 'success:' . $item['id'] . PHP_EOL;
echo 'success:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
}catch (\Exception $e){
echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL;
errorLog('delete_blog_category删除失败', $item, $e);
echo 'error:' . $item['id'] . $e->getMessage() . '执行时间:'.date('Y-m-d H:i:s') . PHP_EOL;
errorLog('delete_blog_category删除失败'.date('Y-m-d H:i:s'), $item, $e);
}
}
return true;
... ...
... ... @@ -78,9 +78,9 @@ class DeleteCustomCategory extends Command
$this->updateCategory();
DB::disconnect('custom_mysql');
$noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]);
echo 'success:' . $item['id'] . PHP_EOL;
echo 'success:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
}catch (\Exception $e){
echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL;
echo 'error:' . $item['id'] . $e->getMessage() . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
errorLog('delete_custom_category删除失败', $item, $e);
}
}
... ...
... ... @@ -78,9 +78,9 @@ class DeleteNewsCategory extends Command
$this->updateCategory();
DB::disconnect('custom_mysql');
$noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]);
echo 'success:' . $item['id'] . PHP_EOL;
echo 'success:' . $item['id'] . '执行时间:'.date('Y-m-d H:i:s') . PHP_EOL;
}catch (\Exception $e){
echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL;
echo 'error:' . $item['id'] . $e->getMessage() . '执行时间:'.date('Y-m-d H:i:s') . PHP_EOL;
errorLog('delete_news_category删除失败', $item, $e);
}
}
... ...
... ... @@ -79,10 +79,10 @@ class DeleteProductCategory extends Command
$this->updateCategory();
DB::disconnect('custom_mysql');
$noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]);
echo 'success:' . $item['id'] . PHP_EOL;
echo 'success:' . $item['id'] . '执行时间:'.date('Y-m-d H:i:s') . PHP_EOL;
}catch (\Exception $e){
echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL;
errorLog('delete_product_category删除失败', $item, $e);
errorLog('delete_product_category删除失败'.',执行时间:'.date('Y-m-d H:i:s'), $item, $e);
}
}
return true;
... ...
... ... @@ -79,7 +79,7 @@ class InitKeyword extends Command
ProjectServer::useProject($notice['data']['project_id']);
$keyword = Keyword::whereNull('route')->get();
foreach ($keyword as $val) {
$this->output(' keywordID: ' . $val->id . ', title: ' . $val->title);
$this->output(' keywordID: ' . $val->id . ', title: ' . $val->title . '时间:'. date('Y-m-d H:i:s'));
try {
if(contains_russian($val['title'])){
$title = Translate::tran($val['title'], 'en');
... ... @@ -90,7 +90,7 @@ class InitKeyword extends Command
$val->route = $route;
$val->save();
} catch (\Exception $e) {
$this->output(' keywordID: ' . $val->id . ', title: ' . $val->title . ', error: ' . $e->getMessage());
$this->output(' keywordID: ' . $val->id . ', title: ' . $val->title . ', error: ' . $e->getMessage() . '执行时间:'.date('Y-m-d H:i:s'));
}
}
... ...
... ... @@ -63,9 +63,9 @@ class InitProject extends Command
$project_logic->createdRole($project['id']);
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
echo 'success:' . $item['id'] . PHP_EOL;
echo 'success:' . $item['id'] . PHP_EOL . date('Y-m-d H:i:s');
}catch (\Exception $e){
echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL;
echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL . date('Y-m-d H:i:s');
errorLog('项目初始化失败', $item, $e);
$this->retry($item, $e->getMessage());
}
... ...
... ... @@ -96,9 +96,9 @@ class SyncProject extends Command
}
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
echo 'success:' . $item['id'] . PHP_EOL;
echo 'success:' . $item['id'] . '执行时间:' . date('Y-m-d H:i:s') . PHP_EOL;
}catch (\Exception $e){
echo 'error:' . $item['id'] . $e->getMessage() .' line ' . $e->getLine() . PHP_EOL;
echo 'error:' . $item['id'] . $e->getMessage() .' line ' . $e->getLine() . '执行时间:' . PHP_EOL;
errorLog('项目同步失败', $item, $e);
$this->retry($item, $e->getMessage());
}
... ...
... ... @@ -13,7 +13,6 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
/**
*
* Class SyncSubmitTask
... ... @@ -30,6 +29,7 @@ class SyncSubmitTaskDistribution extends Command
public function handle()
{
while (true) {
try {
$len = Redis::llen('sync_submit_task');
if (!$len) {
$max_id = SyncSubmitTaskModel::orderBy('id', 'desc')->value('id');
... ... @@ -41,8 +41,12 @@ class SyncSubmitTaskDistribution extends Command
$task->status = 3;
$task->save();
Redis::lpush('sync_submit_task', $task->id);
$this->output('分发:' . $task->id);
}
}
}
}catch (\Exception $e){
$this->output('异常:' . $e->getMessage());
}
}
}
... ...
... ... @@ -32,7 +32,7 @@ class SyncTimeFiles extends Command
public function handle()
{
$fileModel = new File();
$start = '2024-08-10 00:00:00';
$start = '2024-08-26 00:00:00';
$end = date('Y-m-d H:i:s');
$lists = $fileModel->list(['created_at'=>['between',[$start,$end]]]);
foreach ($lists as $v){
... ...
... ... @@ -349,4 +349,6 @@ class ExtensionModuleController extends BaseController
$moduleValueModel->del(['module_id'=>$this->param['module_id'],'uuid'=>$this->param['uuid']]);
$this->response('success');
}
}
... ...
... ... @@ -703,4 +703,22 @@ class ProductController extends BaseController
}
$this->response('success',Code::SUCCESS,['id'=>$id]);
}
/**
* @remark :删除
* @name :delProductType
* @author :lyh
* @method :post
* @time :2024/8/27 9:44
*/
public function delProductType(){
$this->request->validate([
'name'=>'required',
],[
'name.required' => 'id不为空',
]);
$typeModel = new ProductType();
$typeModel->del(['project_id'=>$this->user['project_id'],'name'=>$this->param['name']]);
$this->response('success');
}
}
... ...
... ... @@ -207,8 +207,9 @@ class ImageController extends Controller
$fileName = $this->getOnlyFilename($name,$param['project_id'] ?? 0);
//上传到cos
if($this->upload_location == 0){
$watermarkOptions = $this->getProjectConfig($this->cache['project_id'] ?? 0);
$cosService = new CosService();
$cosService->uploadFile($files,$this->path,$fileName);
$cosService->uploadFile($files,$this->path,$fileName,false,$watermarkOptions);
}else{
//TODO::上传亚马逊
$amazonS3Service = new AmazonS3Service();
... ... @@ -342,7 +343,7 @@ class ImageController extends Controller
if($this->upload_location == 0){
$watermarkOptions = $this->getProjectConfig($this->cache['project_id'] ?? 0);
$cosService = new CosService();
$cosService->uploadFile($file,$this->path,$fileName,$watermarkOptions);
$cosService->uploadFile($file,$this->path,$fileName,false,$watermarkOptions);
}else{
//TODO::上传亚马逊
$amazonS3Service = new AmazonS3Service();
... ... @@ -365,37 +366,44 @@ class ImageController extends Controller
* @time :2024/8/24 11:03
*/
public function getProjectConfig($project_id = 0){
$str = '';
$imageSettingModel = new ImageSetting();
$settingInfo = $imageSettingModel->read(['project_id'=>$project_id]);
if($settingInfo !== false){
if($settingInfo['status'] == 1 && !empty($settingInfo['image_data'])){
$image_data = json_decode($settingInfo['image_data'],true);
foreach ($image_data as $k => $v){
$arr = implode('/',$v);
if ($arr[0] == 'image') {
$arr[1] = urlSafeBase64Encode($arr[1]);
if (str_starts_with($v, "image/")) {
$v = 'image/'.urlSafeBase64Encode(substr($v, strlen("image/")));
}
$image_data[$k] = $v;
}
$str = 'watermark/1/'.implode('/',$image_data);
return $str;
}
if($settingInfo['status'] == 2 && !empty($settingInfo['str_data'])){
$str_data = json_decode($settingInfo['str_data'],true);
foreach ($str_data as $k => $v){
$arr = implode('/',$v);
$arr = explode('/',$v);
if ($arr[0] == 'text') {
$arr[1] = urlSafeBase64Encode($arr[1]);
$v = implode('/',$arr);
}
if ($arr[0] == 'font') {
$arr[1] = urlSafeBase64Encode($arr[1]);
$v = implode('/',$arr);
}
if ($arr[0] == 'fill') {
$arr[1] = urlSafeBase64Encode($arr[1]);
$v = implode('/',$arr);
}
$str_data[$k] = $arr;
$str_data[$k] = $v;
}
$str = 'watermark/2/'.implode('/',$str_data);
return $str;
}
}
return null;
return $str;
}
/**
... ... @@ -726,10 +734,10 @@ class ImageController extends Controller
if($info === false){
$this->response('请先设置水印',Code::SYSTEM_ERROR);
}
if($info['status'] == 1 && !empty($info['image_data'])){
if($info['status'] == 1 && empty($info['image_data'])){
$this->response('请先设置水印',Code::SYSTEM_ERROR);
}
if($info['status'] == 2 && !empty($info['str_data'])){
if($info['status'] == 2 && empty($info['str_data'])){
$this->response('请先设置水印',Code::SYSTEM_ERROR);
}
$imageSetting->edit(['status'=>$this->param['status']],['project_id'=>$this->cache['project_id']]);
... ... @@ -753,7 +761,9 @@ class ImageController extends Controller
if(!empty($info['str_data'])){
$info['str_data'] = json_decode($info['str_data'],true);
}
$info['domain'] = 'http://globalso-v6-1309677403.cos.ap-hongkong.myqcloud.com';
}
$this->response('success',Code::SUCCESS,$info);
}
}
... ...
... ... @@ -9,6 +9,7 @@ use App\Models\CustomModule\CustomModuleCategory;
use App\Models\IsCom\ProjectComConfig;
use App\Models\News\NewsCategory;
use App\Models\Product\Category;
use App\Models\Product\ProductType;
use App\Models\Project\PageSetting;
use App\Models\RouteMap\RouteMap;
use App\Models\Service\Service as ServiceSettingModel;
... ... @@ -777,6 +778,14 @@ class BTemplateLogic extends BaseLogic
$productCategory = $this->getCategoryList((new Category()),1);
$newCategory = $this->getCategoryList((new NewsCategory()));
$blogCategory = $this->getCategoryList((new BlogCategory()));
$productTypeModel = new ProductType();
$productTypeList = $productTypeModel->list(['project_id'=>$this->user['project_id']],'id',['id','name']);
if(!empty($productTypeList)){
foreach ($productTypeList as $items){
$items['id'] = 'product_type_'.$items['id'];
$data["products"]["category"][] =$items;
}
}
if (!empty($productCategory)){
foreach ($productCategory as $item){$data["products"]["category"][] =$item;}
}
... ... @@ -837,6 +846,14 @@ class BTemplateLogic extends BaseLogic
$values['category'][] = $item;
}
}
$productTypeModel = new ProductType();
$productTypeList = $productTypeModel->list(['project_id'=>$this->user['project_id']],'id',['id','name']);
if(!empty($productTypeList)){
foreach ($productTypeList as $items){
$items['id'] = 'product_type_'.$items['id'];
$values['category'][] = $items;
}
}
break;
case '新闻':
$newCategory = $this->getCategoryList((new NewsCategory()),0,['id','name','pid']);
... ...
... ... @@ -23,7 +23,7 @@ class CosService
* @method :post
* @time :2023/7/19 15:28
*/
public function uploadFile(&$files,$path,$filename, $binary = false,$watermarkOptions = null)
public function uploadFile(&$files,$path,$filename, $binary = false,$watermarkOptions = '')
{
$cos = config('filesystems.disks.cos');
$cosClient = new Client([
... ... @@ -42,18 +42,18 @@ class CosService
];
//水印
if ($watermarkOptions) {
$options['Pic-Operations'] = json_encode([
$options['PicOperations'] = json_encode([
'is_pic_info' => 1,
'rules' => [
[
'fileid' => $filename, // 使用相同的文件名保存
'rule' => 'watermark/1/'.implode('/',$watermarkOptions),
'fileid' => $key, // 使用相同的文件名保存
'rule' => $watermarkOptions,
]
]
]);
], true);
}
// 上传文件
$cosClient->putObject($options);
$res = $cosClient->putObject($options);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($res, true) . PHP_EOL, FILE_APPEND);
return $key;
}
... ... @@ -189,7 +189,7 @@ class CosService
if($is_image){
$param = [
'image/'.urlSafeBase64Encode($domain.$data['image'] ?? ''),//图片
'gravity/'.($data['gravity'] ?? 'SouthEast'),
'gravity/'.($data['gravity'] ?? 'southeast'),
'dx/'.($data['dx'] ?? 0),
'dy/'. ($data['dy'] ?? 0),
'batch/'.($data['batch'] ?? 0),//平铺水印功能
... ... @@ -200,7 +200,7 @@ class CosService
}else{
$param = [
'text/'.urlSafeBase64Encode($data['text'] ?? ''),//文字水印名称
'gravity/'.($data['gravity'] ?? 'SouthEast'),
'gravity/'.($data['gravity'] ?? 'southeast'),
'dx/'.($data['dx'] ?? 10),
'dy/'. ($data['dy'] ?? 10),
'font/'.urlSafeBase64Encode($data['font'] ?? 'tahoma.ttf'),//默认宋体
... ...
... ... @@ -259,6 +259,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/delProductKeyword', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductKeyword'])->name('product_delProductKeyword');
Route::any('/getProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getProductType'])->name('product_getProductType');
Route::any('/saveType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'saveType'])->name('product_saveType');
Route::any('/delProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductType'])->name('product_delProductType');
//产品分类
Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category');
Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info');
... ...