作者 刘锟

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

@@ -111,7 +111,7 @@ class VideoTask extends Command @@ -111,7 +111,7 @@ class VideoTask extends Command
111 } 111 }
112 $logo_bg = $this->getImage($domainInfo); 112 $logo_bg = $this->getImage($domainInfo);
113 foreach ($keyword as $val) { 113 foreach ($keyword as $val) {
114 - $log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id])->first(); 114 + $log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id , 'result_status'=>'200'])->first();
115 if ($log){ 115 if ($log){
116 continue; 116 continue;
117 } 117 }
@@ -12,9 +12,15 @@ use App\Models\Channel\Channel; @@ -12,9 +12,15 @@ use App\Models\Channel\Channel;
12 use App\Models\Com\KeywordVideoTask; 12 use App\Models\Com\KeywordVideoTask;
13 use App\Models\Domain\DomainInfo; 13 use App\Models\Domain\DomainInfo;
14 use App\Models\Manage\ManageHr; 14 use App\Models\Manage\ManageHr;
  15 +use App\Models\Product\Category;
  16 +use App\Models\Product\Keyword;
  17 +use App\Models\Product\Product;
15 use App\Models\Project\DeployOptimize; 18 use App\Models\Project\DeployOptimize;
16 use App\Models\Project\Project; 19 use App\Models\Project\Project;
17 use App\Models\RankData\RankData; 20 use App\Models\RankData\RankData;
  21 +use App\Models\RouteMap\RouteMap;
  22 +use App\Services\ProjectServer;
  23 +use Illuminate\Support\Facades\DB;
18 24
19 /** 25 /**
20 * @remark :优化 26 * @remark :优化
@@ -426,4 +432,58 @@ class OptimizeController extends BaseController @@ -426,4 +432,58 @@ class OptimizeController extends BaseController
426 $optimizeModel->edit(['ai_video'=>$this->param['status']],['project_id'=>$this->param['project_id']]); 432 $optimizeModel->edit(['ai_video'=>$this->param['status']],['project_id'=>$this->param['project_id']]);
427 $this->response('success'); 433 $this->response('success');
428 } 434 }
  435 +
  436 + /**
  437 + * @remark :锚文本链接
  438 + * @name :anchorTextList
  439 + * @author :lyh
  440 + * @method :post
  441 + * @time :2024/7/17 14:04
  442 + */
  443 + public function anchorTextList(){
  444 + $this->request->validate([
  445 + 'project_id' => 'required',
  446 + ], [
  447 + 'project_id.required' => 'project_id不能为空',
  448 + ]);
  449 + // 获取当前网站正式域名
  450 + $domainModel = new DomainInfo();
  451 + $domainInfo = $domainModel->read(['project_id' => $this->param['project_id']], ['domain']);
  452 + if ($domainInfo === false) {
  453 + $this->fail('请先设置域名');
  454 + }
  455 + $domain = 'https://' . $domainInfo['domain'] . '/';
  456 + $data = [];
  457 + ProjectServer::useProject($this->param['project_id']);
  458 + $productModel = new Product();
  459 + $this->processChunkedList($productModel, ['status' => $productModel::STATUS_ON], ['id', 'title', 'route'], $domain, $data, 'product');
  460 + $productCategoryModel = new Category();
  461 + $this->processChunkedList($productCategoryModel, ['status' => $productCategoryModel::STATUS_ACTIVE], ['id', 'title', 'route'], $domain, $data, 'product_category');
  462 + $productKeywordModel = new Keyword();
  463 + $this->processChunkedList($productKeywordModel, ['status' => $productKeywordModel::STATUS_ACTIVE], ['id', 'title', 'route'], $domain, $data, 'product_keyword');
  464 + DB::disconnect('custom_mysql');
  465 + $this->response('success', Code::SUCCESS, $data);
  466 + }
  467 +
  468 + /**
  469 + * @remark :分片查询
  470 + * @name :processChunkedList
  471 + * @author :lyh
  472 + * @method :post
  473 + * @time :2024/7/17 14:55
  474 + */
  475 + public function processChunkedList($model, $conditions, $fields, $domain, &$data, $key) {
  476 + $offset = 1;
  477 + $chunkSize = 5000; // 每次查询的记录数
  478 + while (true) {
  479 + $chunk = $model->lists($conditions,$offset,$chunkSize, 'id', $fields);
  480 + if (count($chunk['list']) == 0) {
  481 + break;
  482 + }
  483 + foreach ($chunk['list'] as $item) {
  484 + $data[$key][] = $domain . $item['route'] . '/{' . $item['title'] . '}';
  485 + }
  486 + $offset++;
  487 + }
  488 + }
429 } 489 }
@@ -70,7 +70,7 @@ class AutoTaskController extends BaseController @@ -70,7 +70,7 @@ class AutoTaskController extends BaseController
70 } 70 }
71 } 71 }
72 // 映射信息 以及解析信息 72 // 映射信息 以及解析信息
73 - $val['type'] = $type[$val['type']]; 73 + $val['type'] = $type[$val['type']] ?? '';
74 $val['route'] = $route[$val['route']]; 74 $val['route'] = $route[$val['route']];
75 $val['status'] = $status[$val['status']]; 75 $val['status'] = $status[$val['status']];
76 $val['project_title'] = $projects[$val['project_id']] ?? ''; 76 $val['project_title'] = $projects[$val['project_id']] ?? '';
@@ -64,18 +64,13 @@ class AyrShareController extends BaseController @@ -64,18 +64,13 @@ class AyrShareController extends BaseController
64 $str = json_encode($share_info['activeSocialAccounts']); 64 $str = json_encode($share_info['activeSocialAccounts']);
65 if($str != $info['bind_platforms']){ 65 if($str != $info['bind_platforms']){
66 $ayrShareLogic->ayr_share_edit(['bind_platforms'=>$str],$this->param['id']); 66 $ayrShareLogic->ayr_share_edit(['bind_platforms'=>$str],$this->param['id']);
67 - $res = true;  
68 - }else{  
69 - $res = false;  
70 } 67 }
71 }else{ 68 }else{
72 if(!empty($info['bind_platforms'])){ 69 if(!empty($info['bind_platforms'])){
73 $ayrShareLogic->ayr_share_edit(['bind_platforms'=>''],$this->param['id']); 70 $ayrShareLogic->ayr_share_edit(['bind_platforms'=>''],$this->param['id']);
74 - return true;  
75 } 71 }
76 - $res = false;  
77 } 72 }
78 - $this->response('success',Code::SUCCESS,['is_true'=>$res]); 73 + $this->response('success',Code::SUCCESS,$share_info['activeSocialAccounts'] ?? []);
79 } 74 }
80 /** 75 /**
81 * @name :(创建ayr_share账户)create_account 76 * @name :(创建ayr_share账户)create_account
@@ -13,6 +13,7 @@ use App\Http\Logic\Aside\BaseLogic; @@ -13,6 +13,7 @@ use App\Http\Logic\Aside\BaseLogic;
13 use App\Models\CustomModule\CustomModule; 13 use App\Models\CustomModule\CustomModule;
14 use App\Models\CustomModule\CustomModuleCategory; 14 use App\Models\CustomModule\CustomModuleCategory;
15 use App\Models\CustomModule\CustomModuleContent; 15 use App\Models\CustomModule\CustomModuleContent;
  16 +use App\Models\RouteMap\RouteMap;
16 use App\Services\ProjectServer; 17 use App\Services\ProjectServer;
17 use Illuminate\Support\Facades\DB; 18 use Illuminate\Support\Facades\DB;
18 19
@@ -84,9 +85,16 @@ class CustomModuleLogic extends BaseLogic @@ -84,9 +85,16 @@ class CustomModuleLogic extends BaseLogic
84 * @time :2023/12/5 9:39 85 * @time :2023/12/5 9:39
85 */ 86 */
86 public function moduleAdd(){ 87 public function moduleAdd(){
87 - $rs = (new CustomModule())->add($this->param);  
88 - if($rs === false){  
89 - $this->fail('系统错误,请联系管理员'); 88 + $id = (new CustomModule())->addReturnId($this->param);
  89 + if($id){
  90 + //同时创建对应route的分类
  91 + $customModuleCateModel = new CustomModuleCategory();
  92 + $data = [
  93 + 'name'=>$this->param['route'],
  94 + 'module_id'=>$id,
  95 + 'route'=>RouteMap::setRoute($this->param['route'],RouteMap::SOURCE_MODULE_CATE,$id,$this->param['project_id'])
  96 + ];
  97 + $customModuleCateModel->add($data);
90 } 98 }
91 return $this->success(); 99 return $this->success();
92 } 100 }
@@ -66,7 +66,7 @@ class AyrReleaseLogic extends BaseLogic @@ -66,7 +66,7 @@ class AyrReleaseLogic extends BaseLogic
66 $arr[] = getImageUrl($v1); 66 $arr[] = getImageUrl($v1);
67 } 67 }
68 }else{ 68 }else{
69 - $arr[] = getFileUrl($v,$this->user['storage_type'] ?? 0,$this->user['project_location'] ?? 0,$this->user['file_cdn'] ?? 0); 69 + $arr[] = getFileUrl($v,$this->user['storage_type'] ?? 0,$this->user['project_location'] ?? 0,1);
70 } 70 }
71 } 71 }
72 } 72 }
@@ -30,28 +30,21 @@ class BlogLogic extends BaseLogic @@ -30,28 +30,21 @@ class BlogLogic extends BaseLogic
30 */ 30 */
31 public function blogSave(){ 31 public function blogSave(){
32 //拼接参数 32 //拼接参数
33 - DB::beginTransaction();  
34 - try {  
35 - $this->param = $this->paramProcessing($this->param);  
36 - if(isset($this->param['id']) && !empty($this->param['id'])){  
37 - $id = $this->param['id'];  
38 - $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0  
39 - $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示  
40 - if($is_upgrade == 0 || $six_read == 1){  
41 - $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);  
42 - }  
43 - $route = $this->param['url'];  
44 - $this->edit($this->param,['id'=>$id]);  
45 - }else{  
46 - $this->param['sort'] = $this->setNewsSort();  
47 - $id = $this->model->addReturnId($this->param);  
48 - $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);  
49 - $this->edit(['url'=>$route],['id'=>$id]); 33 + $this->param = $this->paramProcessing($this->param);
  34 + if(isset($this->param['id']) && !empty($this->param['id'])){
  35 + $id = $this->param['id'];
  36 + $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
  37 + $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
  38 + if($is_upgrade == 0 || $six_read == 1){
  39 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
50 } 40 }
51 - DB::commit();  
52 - }catch (\Exception $e){  
53 - DB::rollBack();  
54 - $this->fail('系统错误,请联系管理员'); 41 + $route = $this->param['url'];
  42 + $this->edit($this->param,['id'=>$id]);
  43 + }else{
  44 + $this->param['sort'] = $this->setNewsSort();
  45 + $id = $this->model->addReturnId($this->param);
  46 + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
  47 + $this->edit(['url'=>$route],['id'=>$id]);
55 } 48 }
56 $this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route); 49 $this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
57 $this->curlDelRoute(['new_route'=>$route]); 50 $this->curlDelRoute(['new_route'=>$route]);
@@ -61,7 +61,7 @@ class CountLogic extends BaseLogic @@ -61,7 +61,7 @@ class CountLogic extends BaseLogic
61 $data = [ 61 $data = [
62 'company'=>$this->project['company'] ?? '', 62 'company'=>$this->project['company'] ?? '',
63 'scheme'=>!empty($this->project['deploy_build']['plan']) ? Project::planMap()[$this->project['deploy_build']['plan']] : '', 63 'scheme'=>!empty($this->project['deploy_build']['plan']) ? Project::planMap()[$this->project['deploy_build']['plan']] : '',
64 - 'service_duration'=>$this->project['deploy_build']['service_duration'], 64 + 'service_duration'=>$this->project['deploy_build']['service_duration'] ?? 0,
65 ]; 65 ];
66 return $this->success($data); 66 return $this->success($data);
67 } 67 }
@@ -304,7 +304,7 @@ class ProductLogic extends BaseLogic @@ -304,7 +304,7 @@ class ProductLogic extends BaseLogic
304 $param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? ''); 304 $param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? '');
305 $param['describe'] = Arr::a2s($param['describe'] ?? []); 305 $param['describe'] = Arr::a2s($param['describe'] ?? []);
306 $param['describe_id'] = Arr::arrToSet($param['describe_id'] ?? ''); 306 $param['describe_id'] = Arr::arrToSet($param['describe_id'] ?? '');
307 - $param['seo_mate'] = Arr::a2s($param['seo_mate'] ?? ''); 307 + $param['seo_mate'] = Arr::a2s($param['seo_mate'] ?? []);
308 $param['related_product_id'] = Arr::arrToSet($param['related_product_id'] ?? ''); 308 $param['related_product_id'] = Arr::arrToSet($param['related_product_id'] ?? '');
309 if(isset($param['icon'])){ 309 if(isset($param['icon'])){
310 foreach ($param['icon'] as $k1 => $v1){ 310 foreach ($param['icon'] as $k1 => $v1){
@@ -26,7 +26,9 @@ class BlogRequest extends FormRequest @@ -26,7 +26,9 @@ class BlogRequest extends FormRequest
26 return [ 26 return [
27 'name'=>'required|max:200', 27 'name'=>'required|max:200',
28 'seo_keywords'=>'max:500', 28 'seo_keywords'=>'max:500',
  29 + 'remark'=>'max:1000',
29 'url'=>'required', 30 'url'=>'required',
  31 +// 'text'=>'max:5000',
30 ]; 32 ];
31 } 33 }
32 34
@@ -36,7 +38,9 @@ class BlogRequest extends FormRequest @@ -36,7 +38,9 @@ class BlogRequest extends FormRequest
36 'name.required'=>'请填写名称', 38 'name.required'=>'请填写名称',
37 'name.max'=>'名称超过最长长度200', 39 'name.max'=>'名称超过最长长度200',
38 'url.required'=>'链接不能为空', 40 'url.required'=>'链接不能为空',
39 - 'seo_keywords.max'=>'seo_keywords太长,请重新编辑' 41 + 'seo_keywords.max'=>'seo_keywords太长,请重新编辑',
  42 + 'remark.max'=>'描述超过最长长度1000',
  43 +// 'text.max'=>'详情内容超过最大长度',
40 ]; 44 ];
41 } 45 }
42 } 46 }
@@ -16,6 +16,7 @@ class Keyword extends Base @@ -16,6 +16,7 @@ class Keyword extends Base
16 //连接数据库 16 //连接数据库
17 protected $connection = 'custom_mysql'; 17 protected $connection = 'custom_mysql';
18 18
  19 + const STATUS_ACTIVE = 1;
19 /** 20 /**
20 * @remark :视频 21 * @remark :视频
21 * @name :getKeywordVideoAttribute 22 * @name :getKeywordVideoAttribute
@@ -281,6 +281,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -281,6 +281,7 @@ Route::middleware(['aloginauth'])->group(function () {
281 Route::any('/setRobots', [Aside\Optimize\OptimizeController::class, 'setRobots'])->name('admin.optimize_setRobots');//设置robots开关 281 Route::any('/setRobots', [Aside\Optimize\OptimizeController::class, 'setRobots'])->name('admin.optimize_setRobots');//设置robots开关
282 Route::any('/editBacklink', [Aside\Optimize\OptimizeController::class, 'editBacklink'])->name('admin.optimize_editBacklink');//设置backlink开关 282 Route::any('/editBacklink', [Aside\Optimize\OptimizeController::class, 'editBacklink'])->name('admin.optimize_editBacklink');//设置backlink开关
283 Route::any('/setAiVideo', [Aside\Optimize\OptimizeController::class, 'setAiVideo'])->name('admin.optimize_setAiVideo');//设置backlink开关 283 Route::any('/setAiVideo', [Aside\Optimize\OptimizeController::class, 'setAiVideo'])->name('admin.optimize_setAiVideo');//设置backlink开关
  284 + Route::any('/anchorTextList', [Aside\Optimize\OptimizeController::class, 'anchorTextList'])->name('admin.optimize_anchorTextList');//设置backlink开关
284 Route::any('/editTranslateStatus', [Aside\Optimize\OptimizeController::class, 'editTranslateStatus'])->name('admin.optimize_editTranslateStatus');//设置robots开关 285 Route::any('/editTranslateStatus', [Aside\Optimize\OptimizeController::class, 'editTranslateStatus'])->name('admin.optimize_editTranslateStatus');//设置robots开关
285 }); 286 });
286 //生成关键字 287 //生成关键字