作者 李宇航

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

gx



查看合并请求 !2364
... ... @@ -49,12 +49,14 @@ class SyncMobile extends Command
}catch (\Exception $e){
echo date('Y-m-d H:i:s').':未拉起到数据'.PHP_EOL;
}
$saveData = [];
if(!empty($data)){
$mobileModel = new Mobile();
$mobileModel->truncate();
$data = json_decode($data, true);
$userModel = new User();
foreach ($data as $mobile){
$saveData[] = $mobile;
$param = [
'mobile'=>$mobile,
'created_at'=>date('Y-m-d H:i:s')
... ... @@ -63,22 +65,21 @@ class SyncMobile extends Command
//查看当前用户是否存在
$info = $userModel->read(['mobile'=>$mobile,'project_id'=>1],['id']);
if($info === false){
$data = [
$userModel->add([
'mobile'=>$mobile,
'password'=>base64_encode(md5('123456')),
'project_id'=>1,
'name'=>$mobile,
'type'=>$userModel::TYPE_ONE
];
$userModel->add($data);
]);
}
}
$data[] = '13083988828';
$saveData[] = '13083988828';
$managerModel = new Manage();
$mobileArr = $managerModel->selectField(['status'=>1],'mobile');
$data = array_values(array_unique(array_merge($data,$mobileArr)));
$userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$data]]);
$userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$data]]);
$saveData = array_values(array_unique(array_merge($saveData,$mobileArr)));
$userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$saveData]]);
$userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$saveData]]);
}
echo 'end.'.PHP_EOL;
return true;
... ...
<?php
/**
* @remark :
* @name :GeoArticleController.php
* @author :lyh
* @method :post
* @time :2025/7/14 16:19
*/
namespace App\Http\Controllers\Aside\Geo;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Geo\GeoArticleLogic;
/**
* @remark :GEO文章列表数据
* @name :GeoArticleController
* @author :lyh
* @method :post
* @time :2025/7/14 16:19
*/
class GeoArticleController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new GeoArticleLogic();
}
/**
* @remark :文章列表数据
* @name :lists
* @author :lyh
* @method :post
* @time :2025/7/14 16:22
*/
public function lists(){
$this->request->validate([
'project_id'=>'required',
],[
'project_id.required' => '项目ID不能为空',
]);
$lists = $this->logic->getArticleList($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :获取数据详情
* @name :info
* @author :lyh
* @method :post
* @time :2025/7/14 17:05
*/
public function info(){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'ID不能为空',
]);
$data = $this->logic->getArticleInfo();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存数据
* @name :save
* @author :lyh
* @method :post
* @time :2025/7/14 17:05
*/
public function save(){
$this->request->validate([
'project_id'=>'required',
'data'=>'required|array'
],[
'project_id.required' => '项目ID不能为空',
'data.required' => '数据详情不能为空',
'data.array' => '数据详情为数组',
]);
$data = $this->logic->saveArticle();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :删除数据
* @name :del
* @author :lyh
* @method :post
* @time :2025/7/14 17:05
*/
public function del(){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'ID不能为空',
]);
$data = $this->logic->delArticle();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
<?php
/**
* @remark :
* @name :GeoLinkController.php
* @author :lyh
* @method :post
* @time :2025/7/14 16:17
*/
namespace App\Http\Controllers\Aside\Geo;
use App\Http\Controllers\Aside\BaseController;
/**
* @remark :geo权威新闻(链接数据)
* @name :GeoLinkController
* @author :lyh
* @method :post
* @time :2025/7/14 16:18
*/
class GeoLinkController extends BaseController
{
}
... ...
<?php
/**
* @remark :
* @name :GeoArticleLogic.php
* @author :lyh
* @method :post
* @time :2025/7/14 16:21
*/
namespace App\Http\Logic\Aside\Geo;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Geo\GeoArticle;
/**
* @remark :GEO文章列表
* @name :GeoArticleLogic
* @author :lyh
* @method :post
* @time :2025/7/14 16:22
*/
class GeoArticleLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new GeoArticle();
}
/**
* @remark :列表数据
* @name :getArticleList
* @author :lyh
* @method :post
* @time :2025/7/14 16:24
*/
public function getArticleList($map = [],$page = 1,$row = 20,$order = 'id'){
if(isset($map['filename']) && !empty($map['filename'])){
$map['filename'] = ['like','%'.$map['filename'].'%'];
}
$filed = ['*'];
$lists = $this->model->lists($map,$page,$row,$order,$filed);
return $this->success($lists);
}
/**
* @remark :获取数据详情
* @name :getArticleInfo
* @author :lyh
* @method :post
* @time :2025/7/14 16:26
*/
public function getArticleInfo(){
$info = $this->model->read($this->param);
if($info === false){
$this->fail('当前数据不存在或者已被删除');
}
return $this->success($info);
}
/**
* @remark :保存数据
* @name :saveArticle
* @author :lyh
* @method :post
* @time :2025/7/14 16:26
*/
public function saveArticle(){
try {
if(!empty($this->param['data'])){
$data = [];
foreach ($this->param['data'] as $item){
$data[] = [
'filename' => $item['filename'],
'url'=> $item['url'],
'project_id'=>$this->param['project_id']
];
}
$this->model->insertAll($data);
}
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
return $this->success();
}
/**
* @remark :删除数据
* @name :delArticle
* @author :lyh
* @method :post
* @time :2025/7/14 16:28
*/
public function delArticle(){
try {
$this->model->del($this->param);
}catch (\Exception $e){
$this->fail('删除失败,请联系管理员.');
}
return $this->success();
}
}
... ...
<?php
/**
* @remark :
* @name :GeoLinkLogic.php
* @author :lyh
* @method :post
* @time :2025/7/14 16:20
*/
namespace App\Http\Logic\Aside\Geo;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Geo\GeoLink;
/**
* @remark :geo权威新闻(链接数据)
* @name :GeoLinkLogic
* @author :lyh
* @method :post
* @time :2025/7/14 16:20
*/
class GeoLinkLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new GeoLink();
}
/**
* @remark :获取权威新闻链接数据
* @name :getLinkList
* @author :lyh
* @method :post
* @time :2025/7/14 16:47
*/
public function getLinkList($map = [],$page = 1,$row = 20,$order = 'id'){
$filed = ['*'];
$lists = $this->model->lists($map,$page,$row,$order,$filed);
return $this->success($lists);
}
/**
* @remark :获取链接数据详情
* @name :getLinkInfo
* @author :lyh
* @method :post
* @time :2025/7/14 16:51
*/
public function getLinkInfo(){
$info = $this->model->read($this->param);
if($info === false){
$this->fail('当前数据不存在或者已被删除');
}
return $this->success($info);
}
/**
* @remark :保存链接数据
* @name :saveLink
* @author :lyh
* @method :post
* @time :2025/7/14 16:50
*/
public function saveLink(){
try {
if(!empty($this->param['data'])){
$data = [];
foreach ($this->param['data'] as $item){
$data[] = [
'project_id'=>$this->param['project_id'],
'da'=>$item['da'],
'url'=>$item['url'],
'send_time'=>$item['send_time']
];
}
$this->model->insertAll($data);
}
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
return $this->success();
}
/**
* @remark :删除数据
* @name :delLink
* @author :lyh
* @method :post
* @time :2025/7/14 16:51
*/
public function delLink(){
try {
$this->model->del($this->param);
}catch (\Exception $e){
$this->fail('删除失败,请联系管理员.');
}
return $this->success();
}
}
... ...
<?php
/**
* @remark :
* @name :GeoArticle.php
* @author :lyh
* @method :post
* @time :2025/7/14 16:06
*/
namespace App\Models\Geo;
use App\Models\Base;
/**
* @remark :geo文章列表
* @name :GeoArticle
* @author :lyh
* @method :post
* @time :2025/7/14 16:07
*/
class GeoArticle extends Base
{
protected $table = 'gl_geo_article';
}
... ...
<?php
/**
* @remark :
* @name :GeoLink.php
* @author :lyh
* @method :post
* @time :2025/7/14 16:05
*/
namespace App\Models\Geo;
use App\Models\Base;
/**
* @remark :geo权威新闻外链数据
* @name :GeoLink
* @author :lyh
* @method :post
* @time :2025/7/14 16:05
*/
class GeoLink extends Base
{
protected $table = 'gl_geo_link';
}
... ...