作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !3146
@@ -23,6 +23,7 @@ use App\Models\Project\Project; @@ -23,6 +23,7 @@ use App\Models\Project\Project;
23 use App\Models\Project\ProjectAiSetting; 23 use App\Models\Project\ProjectAiSetting;
24 use App\Models\Project\ProjectWhiteHatAffix; 24 use App\Models\Project\ProjectWhiteHatAffix;
25 use App\Models\RouteMap\RouteMap; 25 use App\Models\RouteMap\RouteMap;
  26 +use App\Models\SeoSetting\LinkData;
26 use App\Models\Template\BTemplateMain; 27 use App\Models\Template\BTemplateMain;
27 use App\Models\Template\TemplateTypeMain; 28 use App\Models\Template\TemplateTypeMain;
28 use App\Models\WebSetting\Translate; 29 use App\Models\WebSetting\Translate;
@@ -115,13 +116,23 @@ class lyhDemo extends Command @@ -115,13 +116,23 @@ class lyhDemo extends Command
115 public function _actionRoute(){ 116 public function _actionRoute(){
116 $projectModel = new Project(); 117 $projectModel = new Project();
117 $lists = $projectModel->list(['type'=>['in',[1,2,3,4,6]]], 'id', ['id']); 118 $lists = $projectModel->list(['type'=>['in',[1,2,3,4,6]]], 'id', ['id']);
118 - $data = []; 119 + $geoLinkModel = new GeoLink();
119 foreach ($lists as $item){ 120 foreach ($lists as $item){
120 echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL; 121 echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;
121 - $letters = range('A', 'X'); // 只取前 24 个字母(A ~ X)  
122 - $randomLetter = $letters[array_rand($letters)];  
123 - $data['post_id'] = $randomLetter.mt_rand(100000, 999999).$item['id'];  
124 - $projectModel->edit(['post_id'=>$data['post_id']],['id'=>$item['id']]); 122 + ProjectServer::useProject($item['project_id']);
  123 + $linkDataModel = new LinkData();
  124 + $linkList = $linkDataModel->list();
  125 + foreach ($linkList as $link){
  126 + $geoLinkModel->add([
  127 + 'project_id'=>$item['id'],
  128 + 'url'=>$link['url'],
  129 + 'type'=>2,
  130 + 'da'=>$link['da_values'],
  131 + 'send_time'=>$link['send_time'],
  132 + 'time'=>$link['time'],
  133 + ]);
  134 + }
  135 + DB::disconnect('custom_mysql');
125 } 136 }
126 return true; 137 return true;
127 } 138 }
@@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\SeoSetting; @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\SeoSetting;
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 use App\Http\Logic\Bside\SeoSetting\LinkDataLogic; 14 use App\Http\Logic\Bside\SeoSetting\LinkDataLogic;
  15 +use App\Models\Geo\GeoLink;
15 use App\Models\SeoSetting\LinkData; 16 use App\Models\SeoSetting\LinkData;
16 17
17 class LinkDataController extends BaseController 18 class LinkDataController extends BaseController
@@ -23,7 +24,10 @@ class LinkDataController extends BaseController @@ -23,7 +24,10 @@ class LinkDataController extends BaseController
23 * @method :post 24 * @method :post
24 * @time :2025/3/14 16:33 25 * @time :2025/3/14 16:33
25 */ 26 */
26 - public function lists(LinkData $linkData){ 27 + public function lists(GeoLink $linkData){
  28 + if(!isset($this->map['type']) || empty($this->map['type'])){
  29 + $this->map['type'] = $linkData::TYPE_LINK;
  30 + }
27 $lists = $linkData->lists($this->map,$this->page,$this->row); 31 $lists = $linkData->lists($this->map,$this->page,$this->row);
28 $this->response('success',Code::SUCCESS,$lists); 32 $this->response('success',Code::SUCCESS,$lists);
29 } 33 }
@@ -35,7 +39,7 @@ class LinkDataController extends BaseController @@ -35,7 +39,7 @@ class LinkDataController extends BaseController
35 * @method :post 39 * @method :post
36 * @time :2025/3/14 17:41 40 * @time :2025/3/14 17:41
37 */ 41 */
38 - public function info(LinkData $linkData){ 42 + public function info(GeoLink $linkData){
39 $this->request->validate([ 43 $this->request->validate([
40 'id'=>['required'], 44 'id'=>['required'],
41 ],[ 45 ],[
@@ -69,7 +73,7 @@ class LinkDataController extends BaseController @@ -69,7 +73,7 @@ class LinkDataController extends BaseController
69 * @method :post 73 * @method :post
70 * @time :2025/3/14 16:45 74 * @time :2025/3/14 16:45
71 */ 75 */
72 - public function del(LinkData $linkData){ 76 + public function del(GeoLink $linkData){
73 $this->request->validate([ 77 $this->request->validate([
74 'id'=>'required|array', 78 'id'=>'required|array',
75 ],[ 79 ],[
@@ -39,11 +39,13 @@ class GeoLinkLogic extends BaseLogic @@ -39,11 +39,13 @@ class GeoLinkLogic extends BaseLogic
39 * @time :2025/7/14 16:47 39 * @time :2025/7/14 16:47
40 */ 40 */
41 public function getLinkList($map = [],$page = 1,$row = 20,$order = 'id'){ 41 public function getLinkList($map = [],$page = 1,$row = 20,$order = 'id'){
42 - $filed = ['*'];  
43 if(isset($map['url']) && !empty($map['url'])){ 42 if(isset($map['url']) && !empty($map['url'])){
44 $map['url'] = ['like','%'.$map['url'].'%']; 43 $map['url'] = ['like','%'.$map['url'].'%'];
45 } 44 }
46 - $lists = $this->model->lists($map,$page,$row,$order,$filed); 45 + if(!isset($map['type']) || empty($map['type'])){
  46 + $map['type'] = GeoLink::TYPE_NEWS;
  47 + }
  48 + $lists = $this->model->lists($map,$page,$row,$order,['*']);
47 return $this->success($lists); 49 return $this->success($lists);
48 } 50 }
49 51
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 namespace App\Http\Logic\Aside\Project; 10 namespace App\Http\Logic\Aside\Project;
11 11
12 use App\Http\Logic\Aside\BaseLogic; 12 use App\Http\Logic\Aside\BaseLogic;
  13 +use App\Models\Geo\GeoLink;
13 use App\Models\Project\EnterpriseProduct; 14 use App\Models\Project\EnterpriseProduct;
14 use App\Models\SeoSetting\LinkData; 15 use App\Models\SeoSetting\LinkData;
15 use App\Services\ProjectServer; 16 use App\Services\ProjectServer;
@@ -56,8 +57,7 @@ class EnterpriseProductLogic extends BaseLogic @@ -56,8 +57,7 @@ class EnterpriseProductLogic extends BaseLogic
56 * @time :2025/4/2 9:08 57 * @time :2025/4/2 9:08
57 */ 58 */
58 public function saveLinkData(){ 59 public function saveLinkData(){
59 - ProjectServer::useProject($this->param['project_id']);  
60 - $linkModel = new LinkData(); 60 + $linkModel = new GeoLink();
61 $data = []; 61 $data = [];
62 $count = count($this->param['data']); 62 $count = count($this->param['data']);
63 $error_num = 0; 63 $error_num = 0;
@@ -68,6 +68,7 @@ class EnterpriseProductLogic extends BaseLogic @@ -68,6 +68,7 @@ class EnterpriseProductLogic extends BaseLogic
68 } 68 }
69 $data[] = [ 69 $data[] = [
70 'url'=>$v['url'], 70 'url'=>$v['url'],
  71 + 'type'=>$linkModel::TYPE_LINK,
71 'da_values'=>$v['da_values'], 72 'da_values'=>$v['da_values'],
72 'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s') 73 'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s')
73 ]; 74 ];
@@ -75,7 +76,6 @@ class EnterpriseProductLogic extends BaseLogic @@ -75,7 +76,6 @@ class EnterpriseProductLogic extends BaseLogic
75 if(!empty($data)){ 76 if(!empty($data)){
76 $linkModel->insertAll($data); 77 $linkModel->insertAll($data);
77 } 78 }
78 - DB::disconnect('custom_mysql');  
79 return $this->success(['success'=>$count,'error'=>$error_num]); 79 return $this->success(['success'=>$count,'error'=>$error_num]);
80 } 80 }
81 } 81 }
@@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\SeoSetting; @@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\SeoSetting;
11 11
12 use App\Http\Logic\Bside\BaseLogic; 12 use App\Http\Logic\Bside\BaseLogic;
13 use App\Models\Geo\DomainDa; 13 use App\Models\Geo\DomainDa;
  14 +use App\Models\Geo\GeoLink;
14 use App\Models\SeoSetting\LinkData; 15 use App\Models\SeoSetting\LinkData;
15 use App\Services\Geo\GeoService; 16 use App\Services\Geo\GeoService;
16 use Illuminate\Support\Carbon; 17 use Illuminate\Support\Carbon;
@@ -29,7 +30,7 @@ class LinkDataLogic extends BaseLogic @@ -29,7 +30,7 @@ class LinkDataLogic extends BaseLogic
29 { 30 {
30 parent::__construct(); 31 parent::__construct();
31 $this->param = $this->requestAll; 32 $this->param = $this->requestAll;
32 - $this->model = new LinkData(); 33 + $this->model = new GeoLink();
33 } 34 }
34 35
35 /** 36 /**
@@ -20,5 +20,8 @@ use App\Models\Base; @@ -20,5 +20,8 @@ use App\Models\Base;
20 */ 20 */
21 class GeoLink extends Base 21 class GeoLink extends Base
22 { 22 {
  23 + const TYPE_NEWS = 1;//权威新闻
  24 + const TYPE_LINK = 2;//外链数据
  25 +
23 protected $table = 'gl_geo_link'; 26 protected $table = 'gl_geo_link';
24 } 27 }