作者 刘锟

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

... ... @@ -111,7 +111,7 @@ class VideoTask extends Command
}
$logo_bg = $this->getImage($domainInfo);
foreach ($keyword as $val) {
$log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id])->first();
$log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id , 'result_status'=>'200'])->first();
if ($log){
continue;
}
... ...
... ... @@ -12,9 +12,15 @@ use App\Models\Channel\Channel;
use App\Models\Com\KeywordVideoTask;
use App\Models\Domain\DomainInfo;
use App\Models\Manage\ManageHr;
use App\Models\Product\Category;
use App\Models\Product\Keyword;
use App\Models\Product\Product;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use App\Models\RankData\RankData;
use App\Models\RouteMap\RouteMap;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
/**
* @remark :优化
... ... @@ -426,4 +432,58 @@ class OptimizeController extends BaseController
$optimizeModel->edit(['ai_video'=>$this->param['status']],['project_id'=>$this->param['project_id']]);
$this->response('success');
}
/**
* @remark :锚文本链接
* @name :anchorTextList
* @author :lyh
* @method :post
* @time :2024/7/17 14:04
*/
public function anchorTextList(){
$this->request->validate([
'project_id' => 'required',
], [
'project_id.required' => 'project_id不能为空',
]);
// 获取当前网站正式域名
$domainModel = new DomainInfo();
$domainInfo = $domainModel->read(['project_id' => $this->param['project_id']], ['domain']);
if ($domainInfo === false) {
$this->fail('请先设置域名');
}
$domain = 'https://' . $domainInfo['domain'] . '/';
$data = [];
ProjectServer::useProject($this->param['project_id']);
$productModel = new Product();
$this->processChunkedList($productModel, ['status' => $productModel::STATUS_ON], ['id', 'title', 'route'], $domain, $data, 'product');
$productCategoryModel = new Category();
$this->processChunkedList($productCategoryModel, ['status' => $productCategoryModel::STATUS_ACTIVE], ['id', 'title', 'route'], $domain, $data, 'product_category');
$productKeywordModel = new Keyword();
$this->processChunkedList($productKeywordModel, ['status' => $productKeywordModel::STATUS_ACTIVE], ['id', 'title', 'route'], $domain, $data, 'product_keyword');
DB::disconnect('custom_mysql');
$this->response('success', Code::SUCCESS, $data);
}
/**
* @remark :分片查询
* @name :processChunkedList
* @author :lyh
* @method :post
* @time :2024/7/17 14:55
*/
public function processChunkedList($model, $conditions, $fields, $domain, &$data, $key) {
$offset = 1;
$chunkSize = 5000; // 每次查询的记录数
while (true) {
$chunk = $model->lists($conditions,$offset,$chunkSize, 'id', $fields);
if (count($chunk['list']) == 0) {
break;
}
foreach ($chunk['list'] as $item) {
$data[$key][] = $domain . $item['route'] . '/{' . $item['title'] . '}';
}
$offset++;
}
}
}
... ...
... ... @@ -70,7 +70,7 @@ class AutoTaskController extends BaseController
}
}
// 映射信息 以及解析信息
$val['type'] = $type[$val['type']];
$val['type'] = $type[$val['type']] ?? '';
$val['route'] = $route[$val['route']];
$val['status'] = $status[$val['status']];
$val['project_title'] = $projects[$val['project_id']] ?? '';
... ...
... ... @@ -64,18 +64,13 @@ class AyrShareController extends BaseController
$str = json_encode($share_info['activeSocialAccounts']);
if($str != $info['bind_platforms']){
$ayrShareLogic->ayr_share_edit(['bind_platforms'=>$str],$this->param['id']);
$res = true;
}else{
$res = false;
}
}else{
if(!empty($info['bind_platforms'])){
$ayrShareLogic->ayr_share_edit(['bind_platforms'=>''],$this->param['id']);
return true;
}
$res = false;
}
$this->response('success',Code::SUCCESS,['is_true'=>$res]);
$this->response('success',Code::SUCCESS,$share_info['activeSocialAccounts'] ?? []);
}
/**
* @name :(创建ayr_share账户)create_account
... ...
... ... @@ -13,6 +13,7 @@ use App\Http\Logic\Aside\BaseLogic;
use App\Models\CustomModule\CustomModule;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
use App\Models\RouteMap\RouteMap;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
... ... @@ -84,9 +85,16 @@ class CustomModuleLogic extends BaseLogic
* @time :2023/12/5 9:39
*/
public function moduleAdd(){
$rs = (new CustomModule())->add($this->param);
if($rs === false){
$this->fail('系统错误,请联系管理员');
$id = (new CustomModule())->addReturnId($this->param);
if($id){
//同时创建对应route的分类
$customModuleCateModel = new CustomModuleCategory();
$data = [
'name'=>$this->param['route'],
'module_id'=>$id,
'route'=>RouteMap::setRoute($this->param['route'],RouteMap::SOURCE_MODULE_CATE,$id,$this->param['project_id'])
];
$customModuleCateModel->add($data);
}
return $this->success();
}
... ...
... ... @@ -66,7 +66,7 @@ class AyrReleaseLogic extends BaseLogic
$arr[] = getImageUrl($v1);
}
}else{
$arr[] = getFileUrl($v,$this->user['storage_type'] ?? 0,$this->user['project_location'] ?? 0,$this->user['file_cdn'] ?? 0);
$arr[] = getFileUrl($v,$this->user['storage_type'] ?? 0,$this->user['project_location'] ?? 0,1);
}
}
}
... ...
... ... @@ -30,8 +30,6 @@ class BlogLogic extends BaseLogic
*/
public function blogSave(){
//拼接参数
DB::beginTransaction();
try {
$this->param = $this->paramProcessing($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
... ... @@ -48,11 +46,6 @@ class BlogLogic extends BaseLogic
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
$this->edit(['url'=>$route],['id'=>$id]);
}
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
$this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
$this->curlDelRoute(['new_route'=>$route]);
return $this->success(['id'=>$id]);
... ...
... ... @@ -61,7 +61,7 @@ class CountLogic extends BaseLogic
$data = [
'company'=>$this->project['company'] ?? '',
'scheme'=>!empty($this->project['deploy_build']['plan']) ? Project::planMap()[$this->project['deploy_build']['plan']] : '',
'service_duration'=>$this->project['deploy_build']['service_duration'],
'service_duration'=>$this->project['deploy_build']['service_duration'] ?? 0,
];
return $this->success($data);
}
... ...
... ... @@ -304,7 +304,7 @@ class ProductLogic extends BaseLogic
$param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? '');
$param['describe'] = Arr::a2s($param['describe'] ?? []);
$param['describe_id'] = Arr::arrToSet($param['describe_id'] ?? '');
$param['seo_mate'] = Arr::a2s($param['seo_mate'] ?? '');
$param['seo_mate'] = Arr::a2s($param['seo_mate'] ?? []);
$param['related_product_id'] = Arr::arrToSet($param['related_product_id'] ?? '');
if(isset($param['icon'])){
foreach ($param['icon'] as $k1 => $v1){
... ...
... ... @@ -26,7 +26,9 @@ class BlogRequest extends FormRequest
return [
'name'=>'required|max:200',
'seo_keywords'=>'max:500',
'remark'=>'max:1000',
'url'=>'required',
// 'text'=>'max:5000',
];
}
... ... @@ -36,7 +38,9 @@ class BlogRequest extends FormRequest
'name.required'=>'请填写名称',
'name.max'=>'名称超过最长长度200',
'url.required'=>'链接不能为空',
'seo_keywords.max'=>'seo_keywords太长,请重新编辑'
'seo_keywords.max'=>'seo_keywords太长,请重新编辑',
'remark.max'=>'描述超过最长长度1000',
// 'text.max'=>'详情内容超过最大长度',
];
}
}
... ...
... ... @@ -16,6 +16,7 @@ class Keyword extends Base
//连接数据库
protected $connection = 'custom_mysql';
const STATUS_ACTIVE = 1;
/**
* @remark :视频
* @name :getKeywordVideoAttribute
... ...
... ... @@ -281,6 +281,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/setRobots', [Aside\Optimize\OptimizeController::class, 'setRobots'])->name('admin.optimize_setRobots');//设置robots开关
Route::any('/editBacklink', [Aside\Optimize\OptimizeController::class, 'editBacklink'])->name('admin.optimize_editBacklink');//设置backlink开关
Route::any('/setAiVideo', [Aside\Optimize\OptimizeController::class, 'setAiVideo'])->name('admin.optimize_setAiVideo');//设置backlink开关
Route::any('/anchorTextList', [Aside\Optimize\OptimizeController::class, 'anchorTextList'])->name('admin.optimize_anchorTextList');//设置backlink开关
Route::any('/editTranslateStatus', [Aside\Optimize\OptimizeController::class, 'editTranslateStatus'])->name('admin.optimize_editTranslateStatus');//设置robots开关
});
//生成关键字
... ...