作者 刘锟

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

... ... @@ -122,13 +122,13 @@ class AiBlogAutoPublish extends Command
}
}
} else {
if(strpos($frequency[0],'/')){//一天2篇
if(strpos($frequency[0],'/')){//一天2/3
$aiBlogTaskModel = new AiBlogTaskModel();
$frequency = explode('/', $frequency[0]);
//查询当前已发布几篇
$count = $aiBlogTaskModel->counts(['next_auto_date' => date('Y-m-d'),'project_id' => $project->id]);
while ($count < ($frequency[1] ?? 2)){
$this->createTask($keywords, $project->id, [$frequency[0],$frequency[0]]);
$count = $aiBlogTaskModel->counts(['next_auto_date' => date('Y-m-d', strtotime('+1 day')),'project_id' => $project->id]);
while ($count < ($frequency[1] ?? 2) && ($count <= 3)){
$this->createTask($keywords, $project->id, [1,1]);
$count++;
}
}else{
... ...
... ... @@ -359,12 +359,11 @@ class GeoQuestionRes extends Command
$ids = GeoQuestion::where('status', GeoQuestion::STATUS_OPEN)
->whereIn('project_id', $project_ids)
->where(function ($query){
$query->where('current_time', '!=', date('Y-m-d'))
->orWhereNull('current_time');
$query->where('next_time', '<=', date('Y-m-d'))
->orWhereNull('next_time');
})
->orderBy('project_id', 'asc')
->orderBy('next_time', 'asc')
->pluck('id');
foreach ($ids as $id) {
Redis::lpush($key, $id);
}
... ...
... ... @@ -31,12 +31,12 @@ class SyncTimeFiles extends Command
public function handle()
{
// $fileModel = new File();
$imagesModel = new Image();
$fileModel = new File();
// $imagesModel = new Image();
// $start = '2025-10-14 00:00:00';
$start = '2025-10-25 00:00:00';
$start = '2025-10-01 00:00:00';
$end = '2025-10-31 23:59:59';
$lists = $imagesModel->list(['created_at'=>['between',[$start,$end]]],'id',['path'],'desc');
$lists = $fileModel->list(['created_at'=>['between',[$start,$end]]],'id',['path'],'asc');
foreach ($lists as $v){
$path = $v['path'];
echo date('Y-m-d H:i:s') . ' | 图片链接:' . $path . PHP_EOL;
... ...
... ... @@ -154,6 +154,7 @@ class FetchTicketProjects extends Command
'status' => $status, // 项目状态
'wechat_group_id' => $item['wx_id'],
'team' => $team_ids ? json_encode($team_ids) : null,
'flg_show'=>$item['flg_show'] ?? 1,
];
if (!$project) {
$new = new TicketProject();
... ...
... ... @@ -141,5 +141,22 @@ class BaseController extends Controller
throw new HttpResponseException($response);
}
/**
* 表单单独响应数据格式
*/
public function responseA($data = [], $code = 200, $msg = 'success', $result_code = 200, $type = 'application/json')
{
$result = [
'msg' => $msg,
'code' => $code,
'data' => $data,
];
$header = [
'Content-Type' => $type,
];
$response = response($result, $result_code, $header);
throw new HttpResponseException($response);
}
}
... ...
... ... @@ -12,9 +12,11 @@ use App\Models\Project\Project;
use App\Models\SyncSubmitTask\SyncSubmitTask;
use App\Models\Visit\Visit;
use App\Models\WebSetting\WebLanguage;
use App\Models\WebSetting\WebSettingFormBack;
use App\Services\CosService;
use App\Services\ProjectServer;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
/**
... ... @@ -59,7 +61,34 @@ class InquiryController extends BaseController
if(!SyncSubmitTask::addTask(SyncSubmitTask::TYPE_INQUIRY, $data)){
return $this->error();
}
return $this->success();
//return $this->success();
//新增表单提,返回跳转链接
return $this->responseA($this->inquiryResult());
}
/**
* 新增表单提交返回跳转链接
*/
protected function inquiryResult(){
$domain = $this->param['globalso-domain'] ?? '';
$cache_key = 'inquiry_form_back_' . $domain;
$result = Cache::get($cache_key);
if(!$result){
$result = [
'message' => "1",
'url' => "1",
'other' => "1"
];
$projectDomain = Project::getProjectByDomain($domain);
$webFormBack = WebSettingFormBack::where("project_id", $projectDomain['id']??0)->first();
if (!empty($webFormBack)) {
$result["message"] = $webFormBack->message ?? "";
$result["url"] = $webFormBack->url ?? "";
$result["other"] = $webFormBack->other ?? "";
Cache::put($cache_key, $result, 3600);
}
}
return $result;
}
/**
... ...
... ... @@ -12,11 +12,18 @@ namespace App\Http\Controllers\Api\WorkOrder;
use App\Enums\Common\Code;
use App\Http\Controllers\Api\BaseController;
use App\Models\Ticket\Project5Cate;
use App\Models\Ticket\TicketUploadData;
use App\Models\WorkOrder\TicketProject;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
class Ticket5UploadDataController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->model = new TicketUploadData();
}
/**
* @remark :获取对应项目的分类
* @name :getProject5Cate
... ... @@ -46,23 +53,28 @@ class Ticket5UploadDataController extends BaseController
$this->response('当前项目不存在或数据未同步',Code::SYSTEM_ERROR);
}
//todo::目前写死
$projectInfo['website'] = 'https://devmark.globalso.com/';
if($projectInfo['website'] != 'https://www.lstchocolatemachine.com/'){
$this->response('当前项目不允许操作',Code::SYSTEM_ERROR);
}
$action = $project5CateModel->getCateTypeAction($this->param['type']);
if(empty($action)){
$this->response('未知请求',Code::SYSTEM_ERROR);
}
$url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action;
$data = http_get($url);
if($data && $data['status'] == 200){
$resultData = $data['data'];
$saveData = [
'project_id' => $projectInfo['post_id'],
'domain' => $projectInfo['website'],
'text'=>json_encode($data['data']),
'type' => $this->param['type'],
];
$project5CateModel->addReturnId($saveData);
$this->response('success', Code::SUCCESS,$resultData);
$response = Http::withHeaders([])->asForm()->get($url);
if ($response->successful()) {
$result = $response->json(); // 获取 JSON 响应体
if ($result && $result['status'] == 200) {
$resultData = $result['data'];
$saveData = [
'project_id' => $projectInfo['post_id'],
'domain' => $projectInfo['website'],
'text'=>json_encode($result['data']),
'type' => $this->param['type'],
];
$project5CateModel->addReturnId($saveData);
$this->response('success', Code::SUCCESS,$resultData);
}
}
$this->response('success',Code::SUCCESS,$url);
}
... ... @@ -95,7 +107,9 @@ class Ticket5UploadDataController extends BaseController
}
$project5CateModel = new Project5Cate();
//todo::目前写死,上线放开
$projectInfo['website'] = 'https://devmark.globalso.com/';
if($projectInfo['website'] != 'https://www.lstchocolatemachine.com/'){
$this->response('当前项目不允许操作',Code::SYSTEM_ERROR);
}
$action = $project5CateModel->saveCateTypeAction($this->param['type']);
$url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action;
if(empty($action)){
... ... @@ -111,14 +125,17 @@ class Ticket5UploadDataController extends BaseController
//todo::更新分类数据
$action1 = $project5CateModel->getCateTypeAction($this->param['type']);
$url1 = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action1;
$data = http_get($url1);
if($data && $data['status'] == 200){
$resultData = $data['data'];
$saveData = [
'text'=>json_encode($data['data']),
];
$project5CateModel->edit($saveData,['project_id' => $projectInfo['post_id'],'type'=>$this->param['type']]);
$this->response('success', Code::SUCCESS,$resultData);
$response = Http::withHeaders([])->asForm()->get($url1);
if ($response->successful()) {
$result = $response->json();
if($result && $result['status'] == 200){
$resultData = $result['data'];
$saveData = [
'text'=>json_encode($result['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
];
$project5CateModel->edit($saveData,['project_id' => $projectInfo['post_id'],'type'=>$this->param['type']]);
$this->response('success', Code::SUCCESS,$resultData);
}
}
$this->response('success');
}
... ... @@ -133,15 +150,15 @@ class Ticket5UploadDataController extends BaseController
* @method :post
* @time :2025/11/10 11:01
*/
public function save()
public function save5Data()
{
$this->request->validate([
'post_id' => 'required',
'type' => 'required',
'text' => 'required'
], [
'post_od.required' => 'project_id不能为空',
'type.required' => '上传类型不能为空',
'post_id.required' => 'post_id不能为空',
'type.required' => '类型不能为空',
'text' => '数据详情不为空'
]);
if(empty($this->param['text']['image'])){
... ... @@ -152,7 +169,7 @@ class Ticket5UploadDataController extends BaseController
}
//验证当前数据是否已提交
$this->param['text'] = json_encode($this->param['text'], true);
$this->pushTicketByBots($this->param['post_id'],$this->param['type']);
// $this->pushTicketByBots($this->param['post_id'],$this->param['project_type']);
if(isset($this->param['id']) && !empty($this->param['id'])){
//执行编辑
$info = $this->model->read(['id'=>$this->param['id']]);
... ... @@ -163,8 +180,10 @@ class Ticket5UploadDataController extends BaseController
}
$this->response('success');
}else{
$info = $this->model->read(['project_id' => $this->param['project_id'], 'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]);
$info = $this->model->read(['project_id' => $this->param['post_id'],'project_type'=>$this->model::TYPE_FIVE ,'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]);
if ($info === false) {
$this->param['project_type'] = $this->model::TYPE_FIVE ;
$this->param['project_id'] = $this->param['post_id'];
$id = $this->model->addReturnId($this->param);
} else {
$id = $info['id'];
... ... @@ -177,16 +196,16 @@ class Ticket5UploadDataController extends BaseController
/**
* @remark :钉钉通知
* @name :pushTicketByBots
* @author :lyh
* @method :post
* @time :2025/11/10 11:10
* @author :lyh
*/
public function pushTicketByBots($post_id,$type = 1)
{
$project = TicketProject::where('post_id', $post_id)->where('project_cate',$type)->where('is_del', 0)->first();
if (!$project){
return response()->json(['message' => '未找到对应的工单项目'], 404);
if ($project){
return $project->pushWechatGroupMsg("您好,用户已上传数据,请审核!");
}
return $project->pushWechatGroupMsg("您好,用户已上传数据,请审核!");
return true;
}
}
... ...
... ... @@ -54,14 +54,20 @@ class TicketUploadDataController extends BaseController
'project_id.required' => 'project_id不能为空',
]);
$data = $this->model->lists($this->map, $this->page, $this->row, $this->order);
ProjectServer::useProject($this->map['project_id']);
if(!empty($data) && !empty($data['list'])){
foreach ($data['list'] as &$item) {
$item = $this->getHandleFileImage($item);
$item['text']['cate_name'] = $this->cateText($item['type'],$item['text']['category_id'] ?? []);
if(!isset($this->param['project_type']) || empty($this->param['project_type'])) {
$this->param['project_type'] = 2;
}
if($this->param['project_type'] == 2){
ProjectServer::useProject($this->map['project_id']);
if(!empty($data) && !empty($data['list'])){
foreach ($data['list'] as &$item) {
$item = $this->getHandleFileImage($item);
$item['text']['cate_name'] = $this->cateText($item['type'],$item['text']['category_id'] ?? []);
}
}
DB::disconnect('custom_mysql');
}
DB::disconnect('custom_mysql');
$this->response('success', Code::SUCCESS, $data);
}
... ... @@ -146,10 +152,12 @@ class TicketUploadDataController extends BaseController
if($info === false){
$this->response('当前数据不存在或已被删除',Code::SYSTEM_ERROR);
}
ProjectServer::useProject($info['project_id']);
$info['text']['cate_name'] = $this->cateText($info['type'],$info['text']['category_id'] ?? [],$info['text']['keyword_id'] ?? [],true);
$info = $this->getHandleFileImage($info);
DB::disconnect('custom_mysql');
if($info['project_type'] == $this->model::TYPE_SIX){
ProjectServer::useProject($info['project_id']);
$info['text']['cate_name'] = $this->cateText($info['type'],$info['text']['category_id'] ?? [],$info['text']['keyword_id'] ?? [],true);
$info = $this->getHandleFileImage($info);
DB::disconnect('custom_mysql');
}
$this->response('success', Code::SUCCESS, $info);
}
... ...
... ... @@ -271,7 +271,11 @@ class OptimizeController extends BaseController
if($this->map['seo_plan'] == 0){
$query = $query->where('gl_project_deploy_build.plan','!=',0);
}elseif(is_array($this->map['seo_plan'])){
$query = $query->whereIn('gl_project_deploy_build.seo_plan',$this->map['seo_plan'])->where('gl_project_deploy_build.plan',0);
$query = $query->whereIn('gl_project_deploy_build.seo_plan',$this->map['seo_plan'])
->where(function ($subQuery) {
$subQuery->where('gl_project_deploy_build.plan', '=', 0)
->orWhere('gl_project_deploy_build.seo_plan', '!=', 9);
});;
}else{
$query = $query->where('gl_project_deploy_build.seo_plan',$this->map['seo_plan']);
}
... ...
... ... @@ -27,6 +27,4 @@ class Project5CateController extends BaseController
parent::__construct($request);
$this->logic = new Project5CateLogic();
}
}
... ...
... ... @@ -77,7 +77,7 @@ class TicketUploadDataController extends BaseController
{
$this->request->validate([
'status'=>'required',
'id'=>'required'
'id'=>'required',
],[
'status.required' => '提交状态不能为空',
'id.required' => '主键ID不能为空',
... ...
... ... @@ -9,6 +9,7 @@
namespace App\Http\Logic\Aside\Ticket;
use App\Enums\Common\Code;
use App\Helper\Arr;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Blog\Blog;
... ... @@ -23,8 +24,10 @@ use App\Models\Product\KeywordRelated;
use App\Models\Product\Product;
use App\Models\RouteMap\RouteMap;
use App\Models\Ticket\TicketUploadData;
use App\Models\WorkOrder\TicketProject;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
class TicketUploadDataLogic extends BaseLogic
{
... ... @@ -43,18 +46,24 @@ class TicketUploadDataLogic extends BaseLogic
* @time :2025/9/25 14:17
*/
public function getDataList($map = [],$page = 1,$row = 20,$order = 'id'){
if(isset($this->map['text']) && !empty($this->map['text'])){
$this->map['text'] = ['like','%'.$this->map['text'].'%'];
if(isset($map['text']) && !empty($map['text'])){
$map['text'] = ['like','%'.$map['text'].'%'];
}
if(!isset($map['project_type']) || empty($map['project_type'])){
$map['project_type'] = $this->model::TYPE_SIX;
}
ProjectServer::useProject($map['project_id']);
$data = $this->model->lists($map,$page,$row,$order);
if(!empty($data) && !empty($data['list'])){
foreach ($data['list'] as &$v){
$v = $this->getHandleFileImage($v);
$v['text']['cate_name'] = $this->cateText($v['type'],$v['text']['category_id'] ?? []);
if($map['project_type'] == $this->model::TYPE_SIX){
ProjectServer::useProject($map['project_id']);
if(!empty($data) && !empty($data['list'])){
foreach ($data['list'] as &$v){
$v = $this->getHandleFileImage($v);
$v['text']['cate_name'] = $this->cateText($v['type'],$v['text']['category_id'] ?? []);
}
}
DB::disconnect('custom_mysql');
}
DB::disconnect('custom_mysql');
return $this->success($data);
}
... ... @@ -154,22 +163,100 @@ class TicketUploadDataLogic extends BaseLogic
if($info === false){
$this->fail('当前数据不存在或已被删除');
}
//审核成功执行
if($this->param['status'] == 1){
ProjectServer::useProject($info['project_id']);
if($info['type'] == 1){
$this->saveProductData($info);
}elseif ($info['type'] == 2){
$this->saveBlogData($info);
}else{
$this->saveNewsData($info);
if($info['project_type'] == $this->model::TYPE_SIX){//6.0数据
//审核成功执行
if($this->param['status'] == $this->model::STATUS_SUCCESS){
ProjectServer::useProject($info['project_id']);
if($info['type'] == $this->model::TYPE_PRODUCT){
$this->saveProductData($info);
}elseif ($info['type'] == $this->model::TYPE_BLOG){
$this->saveBlogData($info);
}else{
$this->saveNewsData($info);
}
DB::disconnect('custom_mysql');
}
}else{
if($this->param['status'] == $this->model::STATUS_SUCCESS){
$ticketProjectMdoel = new TicketProject();
$projectInfo = $ticketProjectMdoel->read(['post_id' => $info['project_id']]);
if($projectInfo === false){
$this->fail('当前项目不存在或数据未同步');
}
if($projectInfo['website'] != 'https://www.lstchocolatemachine.com/'){
$this->fail('当前项目不允许操作');
}
$action = $this->model->saveAction($info['type']);
$url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action;
if(empty($action)){
$this->fail('未知请求,请联系管理员!');
}
if($info['type'] == $this->model::TYPE_PRODUCT){
$this->save5ProductData($info,$url);
}else{
$this->save5NewsData($info,$url);
}
}
DB::disconnect('custom_mysql');
}
$data = $this->model->edit(['status'=>$this->param['status'],'operator_id'=>$this->manager['id'],'remark'=>$this->param['remark'] ?? ''],['id'=>$this->param['id']]);
return $this->success($data);
}
/**
* @remark :保存5.0产品数据
* @name :save5ProductData
* @author :lyh
* @method :post
* @time :2025/11/10 14:18
*/
public function save5ProductData($info,$url){
$response = Http::withHeaders([])->asForm()->post($url, [
'title' => $info['text']['title'],
'cate_id' => isset($info['text']['cate']) ? implode(',', $info['text']['cate']) : '',
'content'=>$info['text']['content'] ?? '',
'short_description'=>$info['text']['short_description'] ?? '',
'images'=>$info['text']['image'] ?? '',
]);
if ($response->successful()) {
$result = $response->json(); // 获取 JSON 响应体
if ($result && $result['status'] == 200) {
return $this->success();
}
}
$this->fail('未知请求,请联系管理员!');
}
/**
* @remark :保存新闻
* @name :save5NewsData
* @author :lyh
* @method :post
* @time :2025/11/10 14:43
*/
public function save5NewsData($info,$url){
$response = Http::withHeaders([])->asForm()->post($url, [
'title' => $info['text']['title'] ?? 'ceshi123',
'cate' => isset($info['text']['cate']) ? implode(',', $info['text']['cate']) : '',
'content'=>$info['text']['content'] ?? '',
'image'=>$info['text']['image'] ?? '',
]);
if ($response->successful()) {
$result = $response->json(); // 获取 JSON 响应体
if ($result && $result['status'] == 200) {
return $this->success();
}
}
$this->fail('未知请求,请联系管理员!');
}
/**
* @remark :设置排序
* @name :setProductSort
* @author :lyh
* @method :post
* @time :2025/11/10 14:11
*/
public function setProductSort($mdoel){
$info = $mdoel->orderBy('sort','desc')->first();
if(empty($info)){
... ...
... ... @@ -46,7 +46,7 @@ class LinkDataLogic extends BaseLogic
foreach ($this->param['data'] as $v){
$data[] = [
'url'=>$v['url'],
'da_values'=>$v['da_values'],
'da'=>$v['da_values'],
'type'=>GeoLink::TYPE_LINK,
'project_id'=>$this->user['project_id'],
'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s')
... ... @@ -80,8 +80,8 @@ class LinkDataLogic extends BaseLogic
$end = Carbon::parse(date('Y-m-d'));
$diff = $start->diffInDays($end);
if($diff <= 60){
$info['da_values'] = $daInfo['da'];
$this->model->edit(['da_values'=>$daInfo['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]);
$info['da'] = $daInfo['da'];
$this->model->edit(['da'=>$daInfo['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]);
return $this->success($info);
}
}
... ... @@ -90,14 +90,14 @@ class LinkDataLogic extends BaseLogic
if(!isset($result['data']) || empty($result['data'])){
return $this->success($info);
}
$info['da_values'] = (int)$result['data']['mozDA'];//获取数据中的da值
$info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值
//保存数据
if($daInfo !== false){
$domainDaModel->edit(['da'=>$info['da_values'],'result'=>json_encode($result,true)],['id'=>$daInfo['id']]);
$domainDaModel->edit(['da'=>$info['da'],'result'=>json_encode($result,true)],['id'=>$daInfo['id']]);
}else{
$domainDaModel->addReturnId(['da'=>$info['da_values'],'domain'=>$host,'result'=>json_encode($result,true)]);
$domainDaModel->addReturnId(['da'=>$info['da'],'domain'=>$host,'result'=>json_encode($result,true)]);
}
$this->model->edit(['da_values'=>$info['da_values'],'time'=>date('Y-m-d')], ['id'=>$info['id']]);
$this->model->edit(['da'=>$info['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]);
return $this->success($info);
}
... ...
... ... @@ -23,10 +23,29 @@ class TicketUploadData extends Base
{
protected $table = 'gl_tickets_upload_data';
const TYPE_SIX = 2;//6.0
const TYPE_FIVE = 1;//5.0
const STATUS_SUCCESS = 1;//审核成功
const TYPE_PRODUCT = 1;//产品
const TYPE_BLOG = 2;//blog
const TYPE_NEWS = 3;//新闻
public function getTextAttribute($value){
if(!empty($value)){
$value = Arr::s2a($value);
}
return $value;
}
public function saveAction($type)
{
$data = [
1 => 'add_products',
3 => 'add_news_api',
];
return $data[$type] ?? '';
}
}
... ...
... ... @@ -112,7 +112,7 @@ Route::prefix('ticket_upload')->group(function () {
//5.0获取分类
Route::any('/getProject5Cate', [\App\Http\Controllers\Api\WorkOrder\Ticket5UploadDataController::class, 'getProject5Cate'])->name('ticket_upload.getProject5Cate');
Route::any('/addProject5Cate', [\App\Http\Controllers\Api\WorkOrder\Ticket5UploadDataController::class, 'addProject5Cate'])->name('ticket_upload.addProject5Cate');
Route::any('/save5Data', [\App\Http\Controllers\Api\WorkOrder\Ticket5UploadDataController::class, 'save5Data'])->name('ticket_upload.save5Data');
});
//geo设置
Route::prefix('geo')->group(function () {
... ...