作者 赵彬吉
... ... @@ -125,6 +125,9 @@ class ProjectController extends BaseController
$query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]);
}
}
if(isset($this->map['uptime']) && is_array($this->map['uptime'])){
$query->whereBetween('gl_project.uptime', $this->map['uptime']);
}
return $query;
}
... ... @@ -153,6 +156,7 @@ class ProjectController extends BaseController
'gl_project.channel AS channel',
'gl_project.company AS company',
'gl_project.type AS type',
'gl_project.is_upgrade AS is_upgrade',
'gl_project.created_at AS created_at',
'gl_project.cooperate_date AS cooperate_date',
'gl_project_online_check.id AS online_check_id',
... ...
... ... @@ -38,8 +38,8 @@ class CustomModuleContentController extends BaseController
$data = $this->getAllCategoryName();
foreach ($lists['list'] as $k=>$v){
$v['url'] = $this->getUrl($v);
$v = $this->getHandleImageFile($v);
$v['category_name'] = $this->categoryName($v['category_id'],$data);
$v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']);
$v['operator_name'] = (new User())->getName($v['operator_id']);
$lists['list'][$k] = $v;
}
... ... @@ -48,6 +48,24 @@ class CustomModuleContentController extends BaseController
}
/**
* @remark :获取时处理视频,图片,文件
* @name :getHandleImageFile
* @author :lyh
* @method :post
* @time :2024/1/31 15:48
*/
public function getHandleImageFile($v){
if(!empty($v['image'])){
$v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
if(!empty($v['video'])){
$v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
$v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
return $this->success($v);
}
/**
* @remark :获取连接
* @name :getUrl
* @author :lyh
... ... @@ -141,6 +159,7 @@ class CustomModuleContentController extends BaseController
'id.required' => 'ID不能为空',
]);
$info = $logic->getContentInfo();
$info = $this->getHandleImageFile($info);
$this->response('success',Code::SUCCESS,$info);
}
... ...
... ... @@ -135,7 +135,10 @@ class KeywordController extends BaseController
'title.array' => 'title为数组',
'title.max' => '批量操作不能超过1000条数据'
]);
$logic->batchAdd();
$rs = $logic->batchAdd();
if($rs === false){
$this->response('创建任务添加关键词任务失败,请稍后重试!',Code::SYSTEM_ERROR);
}
$this->response('关键词后台异步添加中,请稍后刷新查看!');
}
... ...
... ... @@ -20,10 +20,12 @@ use App\Models\Product\Product;
use App\Models\Template\Setting;
use App\Models\Template\BTemplate;
use App\Models\User\User;
use App\Models\WebSetting\SettingNum;
use App\Rules\Ids;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class ProductController
... ... @@ -92,11 +94,12 @@ class ProductController extends BaseController
$v['icon'][$icon_k] = $icon_v;
}
}
if(!empty($v['video']) && !empty($v['video']['url'])){
$v['video']['url'] = getImageUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
if(!empty($v['video'])){
$v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
$v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
if(!empty($v['files']) && !empty($v['files']['url'])){
$v['files']['url'] = getImageUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
$v['files']['url'] = getFileUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
return $this->success($v);
}
... ... @@ -468,4 +471,54 @@ class ProductController extends BaseController
$logic->setAllSort();
$this->response('success');
}
/**
* @remark :设置产品排序
* @name :setProductSort
* @author :lyh
* @method :post
* @time :2024/1/31 10:14
*/
public function setProductSort(){
$setNumModel = new SettingNum();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
//执行编辑
$param = [
'data'=>json_encode($this->param['data']),
];
$setNumModel->edit($param,['id'=>$this->param['id']]);
}else{
//执行新增
$param = [
'type'=>$setNumModel::TYPE_PRODUCT_SORT,
'project_id'=>$this->user['project_id'],
'data'=>json_encode($this->param['data']),
];
$setNumModel->add($param);
}
}catch (\Exception $e){
Log::info('error file: ' . __CLASS__ . __FUNCTION__ . $e->getMessage());
$this->response('设置排序失败,请稍后重试',Code::SYSTEM_ERROR);
}
$this->response('success');
}
/**
* @remark :获取产品排序
* @name :getProductSort
* @author :lyh
* @method :post
* @time :2024/1/31 10:24
*/
public function getProductSort(){
$setNumModel = new SettingNum();
$info = $setNumModel->read(['type'=>$setNumModel::TYPE_PRODUCT_SORT]);
if($info === false){
$info = [];
}else{
$info['data'] = json_decode($info['data']);
}
$this->response('success',Code::SUCCESS,$info);
}
}
... ...
... ... @@ -55,7 +55,7 @@ class OnlineCheckLogic extends BaseLogic
$param['type'] = $this->param['project_type'];
}
if(isset($param)){
$projectModel->edit(['type'=>$this->param['project_type']],['id'=>$this->param['id']]);
$projectModel->edit($param,['id'=>$this->param['id']]);
}
}
$data = [
... ...
... ... @@ -9,6 +9,7 @@
namespace App\Http\Logic\Bside\CustomModule;
use App\Helper\Arr;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
... ... @@ -39,7 +40,6 @@ class CustomModuleContentLogic extends BaseLogic
if($info === false){
$this->fail('当前数据不存在或已被删除');
}
$info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']);
$info['extend'] = $this->getExtendInfo($info['module_id'],$info['id']);
return $this->success($info);
}
... ... @@ -217,6 +217,11 @@ class CustomModuleContentLogic extends BaseLogic
if(isset($param['image']) && !empty($param['image'])){
$param['image'] = str_replace_url($param['image']);
}
if(isset($param['video'])){
$param['video']['url'] = str_replace_url($param['video']['url']);
$param['video']['video_image'] = str_replace_url($param['video']['video_image']);
$param['video'] = Arr::a2s($param['video'] ?? []);
}
return $this->success($param);
}
... ...
... ... @@ -145,10 +145,10 @@ class KeywordLogic extends BaseLogic
$this->model->insertGetId($param);
}
}
NoticeLog::createLog(NoticeLog::TYPE_INIT_KEYWORD, ['project_id' => $this->user['project_id']]);
}catch (\Exception $e){
$this->fail('创建任务添加关键词任务失败,请稍后重试!');
return false;
}
NoticeLog::createLog(NoticeLog::TYPE_INIT_KEYWORD, ['project_id' => $this->user['project_id']]);
return $this->success();
}
... ...
... ... @@ -287,6 +287,7 @@ class ProductLogic extends BaseLogic
}
if(isset($param['video'])){
$param['video']['url'] = str_replace_url($param['video']['url']);
$param['video']['video_image'] = str_replace_url($param['video']['video_image']);
$param['video'] = Arr::a2s($param['video'] ?? []);
}
if(isset($param['keyword_id']) && !empty($param['keyword_id'])){
... ...
... ... @@ -21,4 +21,18 @@ class CustomModuleContent extends Base
public function getCategoryIdAttribute($value){
return explode(',',trim($value,','));
}
/**
* @remark :视频
* @name :getVideoAttribute
* @author :lyh
* @method :post
* @time :2024/1/23 14:31
*/
public function getVideoAttribute($value){
if(!empty($value)){
$value = Arr::s2a($value);
}
return $value;
}
}
... ...
... ... @@ -20,6 +20,8 @@ use App\Models\Base;
*/
class SettingNum extends Base
{
const TYPE_PRODUCT_SORT = 10;//c端显示排序
protected $table = 'gl_setting_num';
//连接数据库
protected $connection = 'custom_mysql';
... ...
... ... @@ -223,6 +223,8 @@ Route::middleware(['bloginauth'])->group(function () {
Route::post('/editList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'editList'])->name('product_editList');
Route::post('/sort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sort'])->name('product_sort');
Route::post('/allSort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'allSort'])->name('product_allSort');
Route::post('/setProductSort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'setProductSort'])->name('product_setProductSort');
Route::post('/getProductSort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getProductSort'])->name('product_getProductSort');
Route::any('/delete', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delete'])->name('product_delete');
Route::any('/statusNum', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getStatusNumber'])->name('product_statusNum');
Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct');
... ...