作者 lyh

gx

@@ -49,12 +49,14 @@ class SyncMobile extends Command @@ -49,12 +49,14 @@ class SyncMobile extends Command
49 }catch (\Exception $e){ 49 }catch (\Exception $e){
50 echo date('Y-m-d H:i:s').':未拉起到数据'.PHP_EOL; 50 echo date('Y-m-d H:i:s').':未拉起到数据'.PHP_EOL;
51 } 51 }
  52 + $saveData = [];
52 if(!empty($data)){ 53 if(!empty($data)){
53 $mobileModel = new Mobile(); 54 $mobileModel = new Mobile();
54 $mobileModel->truncate(); 55 $mobileModel->truncate();
55 $data = json_decode($data, true); 56 $data = json_decode($data, true);
56 $userModel = new User(); 57 $userModel = new User();
57 foreach ($data as $mobile){ 58 foreach ($data as $mobile){
  59 + $saveData[] = $mobile;
58 $param = [ 60 $param = [
59 'mobile'=>$mobile, 61 'mobile'=>$mobile,
60 'created_at'=>date('Y-m-d H:i:s') 62 'created_at'=>date('Y-m-d H:i:s')
@@ -63,22 +65,21 @@ class SyncMobile extends Command @@ -63,22 +65,21 @@ class SyncMobile extends Command
63 //查看当前用户是否存在 65 //查看当前用户是否存在
64 $info = $userModel->read(['mobile'=>$mobile,'project_id'=>1],['id']); 66 $info = $userModel->read(['mobile'=>$mobile,'project_id'=>1],['id']);
65 if($info === false){ 67 if($info === false){
66 - $data = [ 68 + $userModel->add([
67 'mobile'=>$mobile, 69 'mobile'=>$mobile,
68 'password'=>base64_encode(md5('123456')), 70 'password'=>base64_encode(md5('123456')),
69 'project_id'=>1, 71 'project_id'=>1,
70 'name'=>$mobile, 72 'name'=>$mobile,
71 'type'=>$userModel::TYPE_ONE 73 'type'=>$userModel::TYPE_ONE
72 - ];  
73 - $userModel->add($data); 74 + ]);
74 } 75 }
75 } 76 }
76 - $data[] = '13083988828'; 77 + $saveData[] = '13083988828';
77 $managerModel = new Manage(); 78 $managerModel = new Manage();
78 $mobileArr = $managerModel->selectField(['status'=>1],'mobile'); 79 $mobileArr = $managerModel->selectField(['status'=>1],'mobile');
79 - $data = array_values(array_unique(array_merge($data,$mobileArr)));  
80 - $userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$data]]);  
81 - $userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$data]]); 80 + $saveData = array_values(array_unique(array_merge($saveData,$mobileArr)));
  81 + $userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$saveData]]);
  82 + $userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$saveData]]);
82 } 83 }
83 echo 'end.'.PHP_EOL; 84 echo 'end.'.PHP_EOL;
84 return true; 85 return true;
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :GeoArticleController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/7/14 16:19
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Aside\Geo;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Aside\BaseController;
  14 +use App\Http\Logic\Aside\Geo\GeoArticleLogic;
  15 +
  16 +/**
  17 + * @remark :GEO文章列表数据
  18 + * @name :GeoArticleController
  19 + * @author :lyh
  20 + * @method :post
  21 + * @time :2025/7/14 16:19
  22 + */
  23 +class GeoArticleController extends BaseController
  24 +{
  25 + public function __construct(Request $request)
  26 + {
  27 + parent::__construct($request);
  28 + $this->logic = new GeoArticleLogic();
  29 + }
  30 + /**
  31 + * @remark :文章列表数据
  32 + * @name :lists
  33 + * @author :lyh
  34 + * @method :post
  35 + * @time :2025/7/14 16:22
  36 + */
  37 + public function lists(){
  38 + $this->request->validate([
  39 + 'project_id'=>'required',
  40 + ],[
  41 + 'project_id.required' => '项目ID不能为空',
  42 + ]);
  43 + $lists = $this->logic->getArticleList($this->map,$this->page,$this->row,$this->order);
  44 + $this->response('success',Code::SUCCESS,$lists);
  45 + }
  46 +
  47 + /**
  48 + * @remark :获取数据详情
  49 + * @name :info
  50 + * @author :lyh
  51 + * @method :post
  52 + * @time :2025/7/14 17:05
  53 + */
  54 + public function info(){
  55 + $this->request->validate([
  56 + 'id'=>'required',
  57 + ],[
  58 + 'id.required' => 'ID不能为空',
  59 + ]);
  60 + $data = $this->logic->getArticleInfo();
  61 + $this->response('success',Code::SUCCESS,$data);
  62 + }
  63 +
  64 + /**
  65 + * @remark :保存数据
  66 + * @name :save
  67 + * @author :lyh
  68 + * @method :post
  69 + * @time :2025/7/14 17:05
  70 + */
  71 + public function save(){
  72 + $this->request->validate([
  73 + 'project_id'=>'required',
  74 + 'data'=>'required|array'
  75 + ],[
  76 + 'project_id.required' => '项目ID不能为空',
  77 + 'data.required' => '数据详情不能为空',
  78 + 'data.array' => '数据详情为数组',
  79 + ]);
  80 + $data = $this->logic->saveArticle();
  81 + $this->response('success',Code::SUCCESS,$data);
  82 + }
  83 +
  84 + /**
  85 + * @remark :删除数据
  86 + * @name :del
  87 + * @author :lyh
  88 + * @method :post
  89 + * @time :2025/7/14 17:05
  90 + */
  91 + public function del(){
  92 + $this->request->validate([
  93 + 'id'=>'required',
  94 + ],[
  95 + 'id.required' => 'ID不能为空',
  96 + ]);
  97 + $data = $this->logic->delArticle();
  98 + $this->response('success',Code::SUCCESS,$data);
  99 + }
  100 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :GeoLinkController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/7/14 16:17
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Aside\Geo;
  11 +
  12 +use App\Http\Controllers\Aside\BaseController;
  13 +
  14 +/**
  15 + * @remark :geo权威新闻(链接数据)
  16 + * @name :GeoLinkController
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2025/7/14 16:18
  20 + */
  21 +class GeoLinkController extends BaseController
  22 +{
  23 +
  24 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :GeoArticleLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/7/14 16:21
  8 + */
  9 +
  10 +namespace App\Http\Logic\Aside\Geo;
  11 +
  12 +use App\Http\Logic\Aside\BaseLogic;
  13 +use App\Models\Geo\GeoArticle;
  14 +
  15 +/**
  16 + * @remark :GEO文章列表
  17 + * @name :GeoArticleLogic
  18 + * @author :lyh
  19 + * @method :post
  20 + * @time :2025/7/14 16:22
  21 + */
  22 +class GeoArticleLogic extends BaseLogic
  23 +{
  24 + public function __construct()
  25 + {
  26 + parent::__construct();
  27 + $this->param = $this->requestAll;
  28 + $this->model = new GeoArticle();
  29 + }
  30 +
  31 + /**
  32 + * @remark :列表数据
  33 + * @name :getArticleList
  34 + * @author :lyh
  35 + * @method :post
  36 + * @time :2025/7/14 16:24
  37 + */
  38 + public function getArticleList($map = [],$page = 1,$row = 20,$order = 'id'){
  39 + if(isset($map['filename']) && !empty($map['filename'])){
  40 + $map['filename'] = ['like','%'.$map['filename'].'%'];
  41 + }
  42 + $filed = ['*'];
  43 + $lists = $this->model->lists($map,$page,$row,$order,$filed);
  44 + return $this->success($lists);
  45 + }
  46 +
  47 + /**
  48 + * @remark :获取数据详情
  49 + * @name :getArticleInfo
  50 + * @author :lyh
  51 + * @method :post
  52 + * @time :2025/7/14 16:26
  53 + */
  54 + public function getArticleInfo(){
  55 + $info = $this->model->read($this->param);
  56 + if($info === false){
  57 + $this->fail('当前数据不存在或者已被删除');
  58 + }
  59 + return $this->success($info);
  60 + }
  61 +
  62 + /**
  63 + * @remark :保存数据
  64 + * @name :saveArticle
  65 + * @author :lyh
  66 + * @method :post
  67 + * @time :2025/7/14 16:26
  68 + */
  69 + public function saveArticle(){
  70 + try {
  71 + if(!empty($this->param['data'])){
  72 + $data = [];
  73 + foreach ($this->param['data'] as $item){
  74 + $data[] = [
  75 + 'filename' => $item['filename'],
  76 + 'url'=> $item['url'],
  77 + 'project_id'=>$this->param['project_id']
  78 + ];
  79 + }
  80 + $this->model->insertAll($data);
  81 + }
  82 + }catch (\Exception $e){
  83 + $this->fail('保存失败,请联系管理员');
  84 + }
  85 + return $this->success();
  86 + }
  87 +
  88 + /**
  89 + * @remark :删除数据
  90 + * @name :delArticle
  91 + * @author :lyh
  92 + * @method :post
  93 + * @time :2025/7/14 16:28
  94 + */
  95 + public function delArticle(){
  96 + try {
  97 + $this->model->del($this->param);
  98 + }catch (\Exception $e){
  99 + $this->fail('删除失败,请联系管理员.');
  100 + }
  101 + return $this->success();
  102 + }
  103 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :GeoLinkLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/7/14 16:20
  8 + */
  9 +
  10 +namespace App\Http\Logic\Aside\Geo;
  11 +
  12 +use App\Http\Logic\Aside\BaseLogic;
  13 +use App\Models\Geo\GeoLink;
  14 +
  15 +/**
  16 + * @remark :geo权威新闻(链接数据)
  17 + * @name :GeoLinkLogic
  18 + * @author :lyh
  19 + * @method :post
  20 + * @time :2025/7/14 16:20
  21 + */
  22 +class GeoLinkLogic extends BaseLogic
  23 +{
  24 + public function __construct()
  25 + {
  26 + parent::__construct();
  27 + $this->param = $this->requestAll;
  28 + $this->model = new GeoLink();
  29 + }
  30 +
  31 + /**
  32 + * @remark :获取权威新闻链接数据
  33 + * @name :getLinkList
  34 + * @author :lyh
  35 + * @method :post
  36 + * @time :2025/7/14 16:47
  37 + */
  38 + public function getLinkList($map = [],$page = 1,$row = 20,$order = 'id'){
  39 + $filed = ['*'];
  40 + $lists = $this->model->lists($map,$page,$row,$order,$filed);
  41 + return $this->success($lists);
  42 + }
  43 +
  44 + /**
  45 + * @remark :获取链接数据详情
  46 + * @name :getLinkInfo
  47 + * @author :lyh
  48 + * @method :post
  49 + * @time :2025/7/14 16:51
  50 + */
  51 + public function getLinkInfo(){
  52 + $info = $this->model->read($this->param);
  53 + if($info === false){
  54 + $this->fail('当前数据不存在或者已被删除');
  55 + }
  56 + return $this->success($info);
  57 + }
  58 +
  59 + /**
  60 + * @remark :保存链接数据
  61 + * @name :saveLink
  62 + * @author :lyh
  63 + * @method :post
  64 + * @time :2025/7/14 16:50
  65 + */
  66 + public function saveLink(){
  67 + try {
  68 + if(!empty($this->param['data'])){
  69 + $data = [];
  70 + foreach ($this->param['data'] as $item){
  71 + $data[] = [
  72 + 'project_id'=>$this->param['project_id'],
  73 + 'da'=>$item['da'],
  74 + 'url'=>$item['url'],
  75 + 'send_time'=>$item['send_time']
  76 + ];
  77 + }
  78 + $this->model->insertAll($data);
  79 + }
  80 + }catch (\Exception $e){
  81 + $this->fail('保存失败,请联系管理员');
  82 + }
  83 + return $this->success();
  84 + }
  85 +
  86 + /**
  87 + * @remark :删除数据
  88 + * @name :delLink
  89 + * @author :lyh
  90 + * @method :post
  91 + * @time :2025/7/14 16:51
  92 + */
  93 + public function delLink(){
  94 + try {
  95 + $this->model->del($this->param);
  96 + }catch (\Exception $e){
  97 + $this->fail('删除失败,请联系管理员.');
  98 + }
  99 + return $this->success();
  100 + }
  101 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :GeoArticle.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/7/14 16:06
  8 + */
  9 +
  10 +namespace App\Models\Geo;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :geo文章列表
  16 + * @name :GeoArticle
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2025/7/14 16:07
  20 + */
  21 +class GeoArticle extends Base
  22 +{
  23 + protected $table = 'gl_geo_article';
  24 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :GeoLink.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/7/14 16:05
  8 + */
  9 +
  10 +namespace App\Models\Geo;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :geo权威新闻外链数据
  16 + * @name :GeoLink
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2025/7/14 16:05
  20 + */
  21 +class GeoLink extends Base
  22 +{
  23 + protected $table = 'gl_geo_link';
  24 +}