Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
25 个修改的文件
包含
377 行增加
和
65 行删除
| @@ -122,13 +122,13 @@ class AiBlogAutoPublish extends Command | @@ -122,13 +122,13 @@ class AiBlogAutoPublish extends Command | ||
| 122 | } | 122 | } |
| 123 | } | 123 | } |
| 124 | } else { | 124 | } else { |
| 125 | - if(strpos($frequency[0],'/')){//一天2篇 | 125 | + if(strpos($frequency[0],'/')){//一天2/3篇 |
| 126 | $aiBlogTaskModel = new AiBlogTaskModel(); | 126 | $aiBlogTaskModel = new AiBlogTaskModel(); |
| 127 | $frequency = explode('/', $frequency[0]); | 127 | $frequency = explode('/', $frequency[0]); |
| 128 | //查询当前已发布几篇 | 128 | //查询当前已发布几篇 |
| 129 | - $count = $aiBlogTaskModel->counts(['next_auto_date' => date('Y-m-d'),'project_id' => $project->id]); | ||
| 130 | - while ($count < ($frequency[1] ?? 2)){ | ||
| 131 | - $this->createTask($keywords, $project->id, [$frequency[0],$frequency[0]]); | 129 | + $count = $aiBlogTaskModel->counts(['next_auto_date' => date('Y-m-d', strtotime('+1 day')),'project_id' => $project->id]); |
| 130 | + while ($count < ($frequency[1] ?? 2) && ($count <= 3)){ | ||
| 131 | + $this->createTask($keywords, $project->id, [1,1]); | ||
| 132 | $count++; | 132 | $count++; |
| 133 | } | 133 | } |
| 134 | }else{ | 134 | }else{ |
| @@ -74,7 +74,7 @@ class DomainInfo extends Command | @@ -74,7 +74,7 @@ class DomainInfo extends Command | ||
| 74 | $serverIpModel = new ServersIp(); | 74 | $serverIpModel = new ServersIp(); |
| 75 | $domainCreateTaskModel = new DomainCreateTask(); | 75 | $domainCreateTaskModel = new DomainCreateTask(); |
| 76 | $end_day = date('Y-m-d H:i:s', strtotime('+1 month'));//域名1月后到期 | 76 | $end_day = date('Y-m-d H:i:s', strtotime('+1 month'));//域名1月后到期 |
| 77 | - $list = $domainModel->where('status', '=', 1)->get(); | 77 | + $list = $domainModel->select(['id', 'project_id', 'domain', 'domain_end_time', 'is_expire_remind', 'amp_status'])->where('status', '=', 1)->get(); |
| 78 | foreach ($list as $v) { | 78 | foreach ($list as $v) { |
| 79 | $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id', 'project_type']); | 79 | $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id', 'project_type']); |
| 80 | if (!$project_info) { | 80 | if (!$project_info) { |
| @@ -195,7 +195,7 @@ class DomainInfo extends Command | @@ -195,7 +195,7 @@ class DomainInfo extends Command | ||
| 195 | $serverIpModel = new ServersIp(); | 195 | $serverIpModel = new ServersIp(); |
| 196 | $domainCreateTaskModel = new DomainCreateTask(); | 196 | $domainCreateTaskModel = new DomainCreateTask(); |
| 197 | $end_day = date('Y-m-d H:i:s', strtotime('+3 day'));//3天后到期 | 197 | $end_day = date('Y-m-d H:i:s', strtotime('+3 day'));//3天后到期 |
| 198 | - $list = $domainModel->where('status', '=', 1)->where('type', '!=', 2)->where('certificate_end_time', '<', $end_day)->get()->toArray(); | 198 | + $list = $domainModel->select(['id', 'project_id', 'domain'])->where('status', '=', 1)->where('type', '!=', 2)->where('certificate_end_time', '<', $end_day)->get()->toArray(); |
| 199 | foreach ($list as $v) { | 199 | foreach ($list as $v) { |
| 200 | $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id', 'project_type']); | 200 | $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id', 'project_type']); |
| 201 | if (!$project_info) { | 201 | if (!$project_info) { |
| @@ -248,7 +248,7 @@ class DomainInfo extends Command | @@ -248,7 +248,7 @@ class DomainInfo extends Command | ||
| 248 | $serverIpModel = new ServersIp(); | 248 | $serverIpModel = new ServersIp(); |
| 249 | $domainCreateTaskModel = new DomainCreateTask(); | 249 | $domainCreateTaskModel = new DomainCreateTask(); |
| 250 | $end_day = date('Y-m-d H:i:s', strtotime('+3 day'));//3天后到期 | 250 | $end_day = date('Y-m-d H:i:s', strtotime('+3 day'));//3天后到期 |
| 251 | - $list = $domainModel->where('status', '=', 1)->where('amp_status', 1)->where('amp_type', '!=', 2)->where('amp_certificate_end_time', '<', $end_day)->get()->toArray(); | 251 | + $list = $domainModel->select(['id', 'project_id', 'domain'])->where('status', '=', 1)->where('amp_status', 1)->where('amp_type', '!=', 2)->where('amp_certificate_end_time', '<', $end_day)->get()->toArray(); |
| 252 | foreach ($list as $v) { | 252 | foreach ($list as $v) { |
| 253 | $domain_array = parse_url($v['domain']); | 253 | $domain_array = parse_url($v['domain']); |
| 254 | $host = $domain_array['host'] ?? $domain_array['path']; | 254 | $host = $domain_array['host'] ?? $domain_array['path']; |
| @@ -305,7 +305,7 @@ class DomainInfo extends Command | @@ -305,7 +305,7 @@ class DomainInfo extends Command | ||
| 305 | $serverIpModel = new ServersIp(); | 305 | $serverIpModel = new ServersIp(); |
| 306 | $domainCreateTaskModel = new DomainCreateTask(); | 306 | $domainCreateTaskModel = new DomainCreateTask(); |
| 307 | $end_day = date('Y-m-d H:i:s', strtotime('+3 day'));//3天后到期 | 307 | $end_day = date('Y-m-d H:i:s', strtotime('+3 day'));//3天后到期 |
| 308 | - $list = $customModel->where('status', 1)->where('is_create', 1)->where('type', '=', 1)->where('certificate_end_time', '<', $end_day)->get()->toArray(); | 308 | + $list = $customModel->select(['id', 'project_id', 'custom_domain'])->where('status', 1)->where('is_create', 1)->where('type', '=', 1)->where('certificate_end_time', '<', $end_day)->get()->toArray(); |
| 309 | foreach ($list as $v) { | 309 | foreach ($list as $v) { |
| 310 | $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id']); | 310 | $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id']); |
| 311 | if (!$project_info) { | 311 | if (!$project_info) { |
| @@ -359,12 +359,11 @@ class GeoQuestionRes extends Command | @@ -359,12 +359,11 @@ class GeoQuestionRes extends Command | ||
| 359 | $ids = GeoQuestion::where('status', GeoQuestion::STATUS_OPEN) | 359 | $ids = GeoQuestion::where('status', GeoQuestion::STATUS_OPEN) |
| 360 | ->whereIn('project_id', $project_ids) | 360 | ->whereIn('project_id', $project_ids) |
| 361 | ->where(function ($query){ | 361 | ->where(function ($query){ |
| 362 | - $query->where('current_time', '!=', date('Y-m-d')) | ||
| 363 | - ->orWhereNull('current_time'); | 362 | + $query->where('next_time', '<=', date('Y-m-d')) |
| 363 | + ->orWhereNull('next_time'); | ||
| 364 | }) | 364 | }) |
| 365 | - ->orderBy('project_id', 'asc') | 365 | + ->orderBy('next_time', 'asc') |
| 366 | ->pluck('id'); | 366 | ->pluck('id'); |
| 367 | - | ||
| 368 | foreach ($ids as $id) { | 367 | foreach ($ids as $id) { |
| 369 | Redis::lpush($key, $id); | 368 | Redis::lpush($key, $id); |
| 370 | } | 369 | } |
| @@ -31,12 +31,12 @@ class SyncTimeFiles extends Command | @@ -31,12 +31,12 @@ class SyncTimeFiles extends Command | ||
| 31 | 31 | ||
| 32 | public function handle() | 32 | public function handle() |
| 33 | { | 33 | { |
| 34 | -// $fileModel = new File(); | ||
| 35 | - $imagesModel = new Image(); | 34 | + $fileModel = new File(); |
| 35 | +// $imagesModel = new Image(); | ||
| 36 | // $start = '2025-10-14 00:00:00'; | 36 | // $start = '2025-10-14 00:00:00'; |
| 37 | - $start = '2025-10-25 00:00:00'; | 37 | + $start = '2025-10-01 00:00:00'; |
| 38 | $end = '2025-10-31 23:59:59'; | 38 | $end = '2025-10-31 23:59:59'; |
| 39 | - $lists = $imagesModel->list(['created_at'=>['between',[$start,$end]]],'id',['path'],'desc'); | 39 | + $lists = $fileModel->list(['created_at'=>['between',[$start,$end]]],'id',['path'],'asc'); |
| 40 | foreach ($lists as $v){ | 40 | foreach ($lists as $v){ |
| 41 | $path = $v['path']; | 41 | $path = $v['path']; |
| 42 | echo date('Y-m-d H:i:s') . ' | 图片链接:' . $path . PHP_EOL; | 42 | echo date('Y-m-d H:i:s') . ' | 图片链接:' . $path . PHP_EOL; |
| @@ -154,6 +154,8 @@ class FetchTicketProjects extends Command | @@ -154,6 +154,8 @@ class FetchTicketProjects extends Command | ||
| 154 | 'status' => $status, // 项目状态 | 154 | 'status' => $status, // 项目状态 |
| 155 | 'wechat_group_id' => $item['wx_id'], | 155 | 'wechat_group_id' => $item['wx_id'], |
| 156 | 'team' => $team_ids ? json_encode($team_ids) : null, | 156 | 'team' => $team_ids ? json_encode($team_ids) : null, |
| 157 | + 'flg_show'=>$item['flg_show'] ?? 1, | ||
| 158 | + 'split'=>$item['split'] ?? 0, | ||
| 157 | ]; | 159 | ]; |
| 158 | if (!$project) { | 160 | if (!$project) { |
| 159 | $new = new TicketProject(); | 161 | $new = new TicketProject(); |
| @@ -117,7 +117,7 @@ class Common | @@ -117,7 +117,7 @@ class Common | ||
| 117 | * @author :liyuhang | 117 | * @author :liyuhang |
| 118 | * @method | 118 | * @method |
| 119 | */ | 119 | */ |
| 120 | - public static function set_user_cache($data = [],$table,$id,$type = 'B'){ | 120 | + public static function set_user_cache($data,$table,$id,$type = 'B'){ |
| 121 | $cache = config('cache.user_is_cache'); | 121 | $cache = config('cache.user_is_cache'); |
| 122 | if(isset($cache) && ($cache['is_cache'] == true)){ | 122 | if(isset($cache) && ($cache['is_cache'] == true)){ |
| 123 | $key = 'cache_'.$table.'_'.$id.'_type'; | 123 | $key = 'cache_'.$table.'_'.$id.'_type'; |
| @@ -685,7 +685,20 @@ if (!function_exists('getImageUrl')) { | @@ -685,7 +685,20 @@ if (!function_exists('getImageUrl')) { | ||
| 685 | if ($image_cdn == 0) {//v6链接 | 685 | if ($image_cdn == 0) {//v6链接 |
| 686 | $cosCdn = $cos['cdn2']; | 686 | $cosCdn = $cos['cdn2']; |
| 687 | } else { | 687 | } else { |
| 688 | - $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; | 688 | + switch ($storage_type) { |
| 689 | + case 0: | ||
| 690 | + $cosCdn = $cos['cdn']; | ||
| 691 | + break; | ||
| 692 | + case 1: | ||
| 693 | + $cosCdn = $cos['cdn1']; | ||
| 694 | + break; | ||
| 695 | + case 2: | ||
| 696 | + $cosCdn = $cos['cdn3']; | ||
| 697 | + break; | ||
| 698 | + default: | ||
| 699 | + $cosCdn = $cos['cdn2']; | ||
| 700 | + break; | ||
| 701 | + } | ||
| 689 | } | 702 | } |
| 690 | $url = $cosCdn . $path; | 703 | $url = $cosCdn . $path; |
| 691 | } else { | 704 | } else { |
| @@ -731,7 +744,20 @@ if (!function_exists('getFileUrl')) { | @@ -731,7 +744,20 @@ if (!function_exists('getFileUrl')) { | ||
| 731 | } | 744 | } |
| 732 | if ($location == 0) { | 745 | if ($location == 0) { |
| 733 | $cos = config('filesystems.disks.cos'); | 746 | $cos = config('filesystems.disks.cos'); |
| 734 | - $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; | 747 | + switch ($storage_type) { |
| 748 | + case 0: | ||
| 749 | + $cosCdn = $cos['cdn']; | ||
| 750 | + break; | ||
| 751 | + case 1: | ||
| 752 | + $cosCdn = $cos['cdn1']; | ||
| 753 | + break; | ||
| 754 | + case 2: | ||
| 755 | + $cosCdn = $cos['cdn3']; | ||
| 756 | + break; | ||
| 757 | + default: | ||
| 758 | + $cosCdn = $cos['cdn2']; | ||
| 759 | + break; | ||
| 760 | + } | ||
| 735 | return $cosCdn . $path; | 761 | return $cosCdn . $path; |
| 736 | } else { | 762 | } else { |
| 737 | $s3 = config('filesystems.disks.s3'); | 763 | $s3 = config('filesystems.disks.s3'); |
| @@ -141,5 +141,22 @@ class BaseController extends Controller | @@ -141,5 +141,22 @@ class BaseController extends Controller | ||
| 141 | throw new HttpResponseException($response); | 141 | throw new HttpResponseException($response); |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | + /** | ||
| 145 | + * 表单单独响应数据格式 | ||
| 146 | + */ | ||
| 147 | + public function responseA($data = [], $code = 200, $msg = 'success', $result_code = 200, $type = 'application/json') | ||
| 148 | + { | ||
| 149 | + $result = [ | ||
| 150 | + 'msg' => $msg, | ||
| 151 | + 'code' => $code, | ||
| 152 | + 'data' => $data, | ||
| 153 | + ]; | ||
| 154 | + $header = [ | ||
| 155 | + 'Content-Type' => $type, | ||
| 156 | + ]; | ||
| 157 | + $response = response($result, $result_code, $header); | ||
| 158 | + throw new HttpResponseException($response); | ||
| 159 | + } | ||
| 160 | + | ||
| 144 | 161 | ||
| 145 | } | 162 | } |
| @@ -12,9 +12,11 @@ use App\Models\Project\Project; | @@ -12,9 +12,11 @@ use App\Models\Project\Project; | ||
| 12 | use App\Models\SyncSubmitTask\SyncSubmitTask; | 12 | use App\Models\SyncSubmitTask\SyncSubmitTask; |
| 13 | use App\Models\Visit\Visit; | 13 | use App\Models\Visit\Visit; |
| 14 | use App\Models\WebSetting\WebLanguage; | 14 | use App\Models\WebSetting\WebLanguage; |
| 15 | +use App\Models\WebSetting\WebSettingFormBack; | ||
| 15 | use App\Services\CosService; | 16 | use App\Services\CosService; |
| 16 | use App\Services\ProjectServer; | 17 | use App\Services\ProjectServer; |
| 17 | use Illuminate\Http\Request; | 18 | use Illuminate\Http\Request; |
| 19 | +use Illuminate\Support\Facades\Cache; | ||
| 18 | use Illuminate\Support\Facades\DB; | 20 | use Illuminate\Support\Facades\DB; |
| 19 | 21 | ||
| 20 | /** | 22 | /** |
| @@ -59,7 +61,34 @@ class InquiryController extends BaseController | @@ -59,7 +61,34 @@ class InquiryController extends BaseController | ||
| 59 | if(!SyncSubmitTask::addTask(SyncSubmitTask::TYPE_INQUIRY, $data)){ | 61 | if(!SyncSubmitTask::addTask(SyncSubmitTask::TYPE_INQUIRY, $data)){ |
| 60 | return $this->error(); | 62 | return $this->error(); |
| 61 | } | 63 | } |
| 62 | - return $this->success(); | 64 | + //return $this->success(); |
| 65 | + //新增表单提,返回跳转链接 | ||
| 66 | + return $this->responseA($this->inquiryResult()); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 新增表单提交返回跳转链接 | ||
| 71 | + */ | ||
| 72 | + protected function inquiryResult(){ | ||
| 73 | + $domain = $this->param['globalso-domain'] ?? ''; | ||
| 74 | + $cache_key = 'inquiry_form_back_' . $domain; | ||
| 75 | + $result = Cache::get($cache_key); | ||
| 76 | + if(!$result){ | ||
| 77 | + $result = [ | ||
| 78 | + 'message' => "1", | ||
| 79 | + 'url' => "1", | ||
| 80 | + 'other' => "1" | ||
| 81 | + ]; | ||
| 82 | + $projectDomain = Project::getProjectByDomain($domain); | ||
| 83 | + $webFormBack = WebSettingFormBack::where("project_id", $projectDomain['id']??0)->first(); | ||
| 84 | + if (!empty($webFormBack)) { | ||
| 85 | + $result["message"] = $webFormBack->message ?? ""; | ||
| 86 | + $result["url"] = $webFormBack->url ?? ""; | ||
| 87 | + $result["other"] = $webFormBack->other ?? ""; | ||
| 88 | + Cache::put($cache_key, $result, 3600); | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + return $result; | ||
| 63 | } | 92 | } |
| 64 | 93 | ||
| 65 | /** | 94 | /** |
| @@ -12,11 +12,18 @@ namespace App\Http\Controllers\Api\WorkOrder; | @@ -12,11 +12,18 @@ namespace App\Http\Controllers\Api\WorkOrder; | ||
| 12 | use App\Enums\Common\Code; | 12 | use App\Enums\Common\Code; |
| 13 | use App\Http\Controllers\Api\BaseController; | 13 | use App\Http\Controllers\Api\BaseController; |
| 14 | use App\Models\Ticket\Project5Cate; | 14 | use App\Models\Ticket\Project5Cate; |
| 15 | +use App\Models\Ticket\TicketUploadData; | ||
| 15 | use App\Models\WorkOrder\TicketProject; | 16 | use App\Models\WorkOrder\TicketProject; |
| 17 | +use Illuminate\Http\Request; | ||
| 16 | use Illuminate\Support\Facades\Http; | 18 | use Illuminate\Support\Facades\Http; |
| 17 | 19 | ||
| 18 | class Ticket5UploadDataController extends BaseController | 20 | class Ticket5UploadDataController extends BaseController |
| 19 | { | 21 | { |
| 22 | + public function __construct(Request $request) | ||
| 23 | + { | ||
| 24 | + parent::__construct($request); | ||
| 25 | + $this->model = new TicketUploadData(); | ||
| 26 | + } | ||
| 20 | /** | 27 | /** |
| 21 | * @remark :获取对应项目的分类 | 28 | * @remark :获取对应项目的分类 |
| 22 | * @name :getProject5Cate | 29 | * @name :getProject5Cate |
| @@ -45,25 +52,29 @@ class Ticket5UploadDataController extends BaseController | @@ -45,25 +52,29 @@ class Ticket5UploadDataController extends BaseController | ||
| 45 | if($projectInfo === false){ | 52 | if($projectInfo === false){ |
| 46 | $this->response('当前项目不存在或数据未同步',Code::SYSTEM_ERROR); | 53 | $this->response('当前项目不存在或数据未同步',Code::SYSTEM_ERROR); |
| 47 | } | 54 | } |
| 48 | - //todo::目前写死 | ||
| 49 | - $projectInfo['website'] = 'https://devmark.globalso.com/'; | 55 | + if(isset($projectInfo['split']) && $projectInfo['split'] == 1){ |
| 56 | + $projectInfo['website'] = $projectInfo['test_website'] ?? ''; | ||
| 57 | + } | ||
| 50 | $action = $project5CateModel->getCateTypeAction($this->param['type']); | 58 | $action = $project5CateModel->getCateTypeAction($this->param['type']); |
| 51 | if(empty($action)){ | 59 | if(empty($action)){ |
| 52 | $this->response('未知请求',Code::SYSTEM_ERROR); | 60 | $this->response('未知请求',Code::SYSTEM_ERROR); |
| 53 | } | 61 | } |
| 54 | $url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action; | 62 | $url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action; |
| 55 | - $data = http_get($url); | ||
| 56 | - if($data && $data['status'] == 200){ | ||
| 57 | - $resultData = $data['data']; | 63 | + $response = Http::withHeaders([])->asForm()->get($url); |
| 64 | + if ($response->successful()) { | ||
| 65 | + $result = $response->json(); // 获取 JSON 响应体 | ||
| 66 | + if ($result && $result['status'] == 200) { | ||
| 67 | + $resultData = $result['data']; | ||
| 58 | $saveData = [ | 68 | $saveData = [ |
| 59 | 'project_id' => $projectInfo['post_id'], | 69 | 'project_id' => $projectInfo['post_id'], |
| 60 | 'domain' => $projectInfo['website'], | 70 | 'domain' => $projectInfo['website'], |
| 61 | - 'text'=>json_encode($data['data']), | 71 | + 'text'=>json_encode($result['data']), |
| 62 | 'type' => $this->param['type'], | 72 | 'type' => $this->param['type'], |
| 63 | ]; | 73 | ]; |
| 64 | $project5CateModel->addReturnId($saveData); | 74 | $project5CateModel->addReturnId($saveData); |
| 65 | $this->response('success', Code::SUCCESS,$resultData); | 75 | $this->response('success', Code::SUCCESS,$resultData); |
| 66 | } | 76 | } |
| 77 | + } | ||
| 67 | $this->response('success',Code::SUCCESS,$url); | 78 | $this->response('success',Code::SUCCESS,$url); |
| 68 | } | 79 | } |
| 69 | 80 | ||
| @@ -93,9 +104,10 @@ class Ticket5UploadDataController extends BaseController | @@ -93,9 +104,10 @@ class Ticket5UploadDataController extends BaseController | ||
| 93 | if($projectInfo === false){ | 104 | if($projectInfo === false){ |
| 94 | $this->response('当前项目不存在或数据未同步',Code::SYSTEM_ERROR); | 105 | $this->response('当前项目不存在或数据未同步',Code::SYSTEM_ERROR); |
| 95 | } | 106 | } |
| 107 | + if(isset($projectInfo['split']) && $projectInfo['split'] == 1){ | ||
| 108 | + $projectInfo['website'] = $projectInfo['test_website'] ?? ''; | ||
| 109 | + } | ||
| 96 | $project5CateModel = new Project5Cate(); | 110 | $project5CateModel = new Project5Cate(); |
| 97 | - //todo::目前写死,上线放开 | ||
| 98 | - $projectInfo['website'] = 'https://devmark.globalso.com/'; | ||
| 99 | $action = $project5CateModel->saveCateTypeAction($this->param['type']); | 111 | $action = $project5CateModel->saveCateTypeAction($this->param['type']); |
| 100 | $url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action; | 112 | $url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action; |
| 101 | if(empty($action)){ | 113 | if(empty($action)){ |
| @@ -111,15 +123,18 @@ class Ticket5UploadDataController extends BaseController | @@ -111,15 +123,18 @@ class Ticket5UploadDataController extends BaseController | ||
| 111 | //todo::更新分类数据 | 123 | //todo::更新分类数据 |
| 112 | $action1 = $project5CateModel->getCateTypeAction($this->param['type']); | 124 | $action1 = $project5CateModel->getCateTypeAction($this->param['type']); |
| 113 | $url1 = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action1; | 125 | $url1 = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action1; |
| 114 | - $data = http_get($url1); | ||
| 115 | - if($data && $data['status'] == 200){ | ||
| 116 | - $resultData = $data['data']; | 126 | + $response = Http::withHeaders([])->asForm()->get($url1); |
| 127 | + if ($response->successful()) { | ||
| 128 | + $result = $response->json(); | ||
| 129 | + if($result && $result['status'] == 200){ | ||
| 130 | + $resultData = $result['data']; | ||
| 117 | $saveData = [ | 131 | $saveData = [ |
| 118 | - 'text'=>json_encode($data['data']), | 132 | + 'text'=>json_encode($result['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), |
| 119 | ]; | 133 | ]; |
| 120 | $project5CateModel->edit($saveData,['project_id' => $projectInfo['post_id'],'type'=>$this->param['type']]); | 134 | $project5CateModel->edit($saveData,['project_id' => $projectInfo['post_id'],'type'=>$this->param['type']]); |
| 121 | $this->response('success', Code::SUCCESS,$resultData); | 135 | $this->response('success', Code::SUCCESS,$resultData); |
| 122 | } | 136 | } |
| 137 | + } | ||
| 123 | $this->response('success'); | 138 | $this->response('success'); |
| 124 | } | 139 | } |
| 125 | } | 140 | } |
| @@ -140,8 +155,8 @@ class Ticket5UploadDataController extends BaseController | @@ -140,8 +155,8 @@ class Ticket5UploadDataController extends BaseController | ||
| 140 | 'type' => 'required', | 155 | 'type' => 'required', |
| 141 | 'text' => 'required' | 156 | 'text' => 'required' |
| 142 | ], [ | 157 | ], [ |
| 143 | - 'post_od.required' => 'project_id不能为空', | ||
| 144 | - 'type.required' => '上传类型不能为空', | 158 | + 'post_id.required' => 'post_id不能为空', |
| 159 | + 'type.required' => '类型不能为空', | ||
| 145 | 'text' => '数据详情不为空' | 160 | 'text' => '数据详情不为空' |
| 146 | ]); | 161 | ]); |
| 147 | if(empty($this->param['text']['image'])){ | 162 | if(empty($this->param['text']['image'])){ |
| @@ -152,7 +167,7 @@ class Ticket5UploadDataController extends BaseController | @@ -152,7 +167,7 @@ class Ticket5UploadDataController extends BaseController | ||
| 152 | } | 167 | } |
| 153 | //验证当前数据是否已提交 | 168 | //验证当前数据是否已提交 |
| 154 | $this->param['text'] = json_encode($this->param['text'], true); | 169 | $this->param['text'] = json_encode($this->param['text'], true); |
| 155 | - $this->pushTicketByBots($this->param['post_id'],$this->param['type']); | 170 | + $this->pushTicketByBots($this->param['post_id'],1); |
| 156 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 171 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 157 | //执行编辑 | 172 | //执行编辑 |
| 158 | $info = $this->model->read(['id'=>$this->param['id']]); | 173 | $info = $this->model->read(['id'=>$this->param['id']]); |
| @@ -163,8 +178,10 @@ class Ticket5UploadDataController extends BaseController | @@ -163,8 +178,10 @@ class Ticket5UploadDataController extends BaseController | ||
| 163 | } | 178 | } |
| 164 | $this->response('success'); | 179 | $this->response('success'); |
| 165 | }else{ | 180 | }else{ |
| 166 | - $info = $this->model->read(['project_id' => $this->param['project_id'], 'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]); | 181 | + $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]); |
| 167 | if ($info === false) { | 182 | if ($info === false) { |
| 183 | + $this->param['project_type'] = $this->model::TYPE_FIVE ; | ||
| 184 | + $this->param['project_id'] = $this->param['post_id']; | ||
| 168 | $id = $this->model->addReturnId($this->param); | 185 | $id = $this->model->addReturnId($this->param); |
| 169 | } else { | 186 | } else { |
| 170 | $id = $info['id']; | 187 | $id = $info['id']; |
| @@ -177,9 +194,9 @@ class Ticket5UploadDataController extends BaseController | @@ -177,9 +194,9 @@ class Ticket5UploadDataController extends BaseController | ||
| 177 | /** | 194 | /** |
| 178 | * @remark :钉钉通知 | 195 | * @remark :钉钉通知 |
| 179 | * @name :pushTicketByBots | 196 | * @name :pushTicketByBots |
| 180 | - * @author :lyh | ||
| 181 | * @method :post | 197 | * @method :post |
| 182 | * @time :2025/11/10 11:10 | 198 | * @time :2025/11/10 11:10 |
| 199 | + * @author :lyh | ||
| 183 | */ | 200 | */ |
| 184 | public function pushTicketByBots($post_id,$type = 1) | 201 | public function pushTicketByBots($post_id,$type = 1) |
| 185 | { | 202 | { |
| @@ -54,6 +54,11 @@ class TicketUploadDataController extends BaseController | @@ -54,6 +54,11 @@ class TicketUploadDataController extends BaseController | ||
| 54 | 'project_id.required' => 'project_id不能为空', | 54 | 'project_id.required' => 'project_id不能为空', |
| 55 | ]); | 55 | ]); |
| 56 | $data = $this->model->lists($this->map, $this->page, $this->row, $this->order); | 56 | $data = $this->model->lists($this->map, $this->page, $this->row, $this->order); |
| 57 | + | ||
| 58 | + if(!isset($this->param['project_type']) || empty($this->param['project_type'])) { | ||
| 59 | + $this->param['project_type'] = 2; | ||
| 60 | + } | ||
| 61 | + if($this->param['project_type'] == 2){ | ||
| 57 | ProjectServer::useProject($this->map['project_id']); | 62 | ProjectServer::useProject($this->map['project_id']); |
| 58 | if(!empty($data) && !empty($data['list'])){ | 63 | if(!empty($data) && !empty($data['list'])){ |
| 59 | foreach ($data['list'] as &$item) { | 64 | foreach ($data['list'] as &$item) { |
| @@ -62,6 +67,7 @@ class TicketUploadDataController extends BaseController | @@ -62,6 +67,7 @@ class TicketUploadDataController extends BaseController | ||
| 62 | } | 67 | } |
| 63 | } | 68 | } |
| 64 | DB::disconnect('custom_mysql'); | 69 | DB::disconnect('custom_mysql'); |
| 70 | + } | ||
| 65 | $this->response('success', Code::SUCCESS, $data); | 71 | $this->response('success', Code::SUCCESS, $data); |
| 66 | } | 72 | } |
| 67 | 73 | ||
| @@ -146,10 +152,12 @@ class TicketUploadDataController extends BaseController | @@ -146,10 +152,12 @@ class TicketUploadDataController extends BaseController | ||
| 146 | if($info === false){ | 152 | if($info === false){ |
| 147 | $this->response('当前数据不存在或已被删除',Code::SYSTEM_ERROR); | 153 | $this->response('当前数据不存在或已被删除',Code::SYSTEM_ERROR); |
| 148 | } | 154 | } |
| 155 | + if($info['project_type'] == $this->model::TYPE_SIX){ | ||
| 149 | ProjectServer::useProject($info['project_id']); | 156 | ProjectServer::useProject($info['project_id']); |
| 150 | $info['text']['cate_name'] = $this->cateText($info['type'],$info['text']['category_id'] ?? [],$info['text']['keyword_id'] ?? [],true); | 157 | $info['text']['cate_name'] = $this->cateText($info['type'],$info['text']['category_id'] ?? [],$info['text']['keyword_id'] ?? [],true); |
| 151 | $info = $this->getHandleFileImage($info); | 158 | $info = $this->getHandleFileImage($info); |
| 152 | DB::disconnect('custom_mysql'); | 159 | DB::disconnect('custom_mysql'); |
| 160 | + } | ||
| 153 | $this->response('success', Code::SUCCESS, $info); | 161 | $this->response('success', Code::SUCCESS, $info); |
| 154 | } | 162 | } |
| 155 | 163 |
| @@ -271,7 +271,11 @@ class OptimizeController extends BaseController | @@ -271,7 +271,11 @@ class OptimizeController extends BaseController | ||
| 271 | if($this->map['seo_plan'] == 0){ | 271 | if($this->map['seo_plan'] == 0){ |
| 272 | $query = $query->where('gl_project_deploy_build.plan','!=',0); | 272 | $query = $query->where('gl_project_deploy_build.plan','!=',0); |
| 273 | }elseif(is_array($this->map['seo_plan'])){ | 273 | }elseif(is_array($this->map['seo_plan'])){ |
| 274 | - $query = $query->whereIn('gl_project_deploy_build.seo_plan',$this->map['seo_plan'])->where('gl_project_deploy_build.plan',0); | 274 | + $query = $query->whereIn('gl_project_deploy_build.seo_plan',$this->map['seo_plan']); |
| 275 | +// ->where(function ($subQuery) { | ||
| 276 | +// $subQuery->where('gl_project_deploy_build.plan', '=', 0) | ||
| 277 | +// ->orWhere('gl_project_deploy_build.seo_plan', '!=', 9); | ||
| 278 | +// }); | ||
| 275 | }else{ | 279 | }else{ |
| 276 | $query = $query->where('gl_project_deploy_build.seo_plan',$this->map['seo_plan']); | 280 | $query = $query->where('gl_project_deploy_build.seo_plan',$this->map['seo_plan']); |
| 277 | } | 281 | } |
| @@ -332,11 +332,11 @@ class ProjectController extends BaseController | @@ -332,11 +332,11 @@ class ProjectController extends BaseController | ||
| 332 | } | 332 | } |
| 333 | } | 333 | } |
| 334 | if (isset($this->map['seo_plan'])) { | 334 | if (isset($this->map['seo_plan'])) { |
| 335 | - $query = $query->where('gl_project_deploy_build.seo_plan', '!=', 0) | ||
| 336 | - ->where(function ($subQuery) { | ||
| 337 | - $subQuery->where('gl_project_deploy_build.plan', '=', 0) | ||
| 338 | - ->orWhere('gl_project_deploy_build.seo_plan', '!=', 9); | ||
| 339 | - }); | 335 | + $query = $query->where('gl_project_deploy_build.seo_plan', '!=', 0); |
| 336 | +// ->where(function ($subQuery) { | ||
| 337 | +// $subQuery->where('gl_project_deploy_build.plan', '=', 0) | ||
| 338 | +// ->orWhere('gl_project_deploy_build.seo_plan', '!=', 9); | ||
| 339 | +// }); | ||
| 340 | } | 340 | } |
| 341 | if (isset($this->map['site_status'])) { | 341 | if (isset($this->map['site_status'])) { |
| 342 | $query = $query->where('gl_project.site_status', $this->map['site_status']); | 342 | $query = $query->where('gl_project.site_status', $this->map['site_status']); |
| @@ -27,6 +27,4 @@ class Project5CateController extends BaseController | @@ -27,6 +27,4 @@ class Project5CateController extends BaseController | ||
| 27 | parent::__construct($request); | 27 | parent::__construct($request); |
| 28 | $this->logic = new Project5CateLogic(); | 28 | $this->logic = new Project5CateLogic(); |
| 29 | } | 29 | } |
| 30 | - | ||
| 31 | - | ||
| 32 | } | 30 | } |
| @@ -77,7 +77,7 @@ class TicketUploadDataController extends BaseController | @@ -77,7 +77,7 @@ class TicketUploadDataController extends BaseController | ||
| 77 | { | 77 | { |
| 78 | $this->request->validate([ | 78 | $this->request->validate([ |
| 79 | 'status'=>'required', | 79 | 'status'=>'required', |
| 80 | - 'id'=>'required' | 80 | + 'id'=>'required', |
| 81 | ],[ | 81 | ],[ |
| 82 | 'status.required' => '提交状态不能为空', | 82 | 'status.required' => '提交状态不能为空', |
| 83 | 'id.required' => '主键ID不能为空', | 83 | 'id.required' => '主键ID不能为空', |
| @@ -85,4 +85,22 @@ class TicketUploadDataController extends BaseController | @@ -85,4 +85,22 @@ class TicketUploadDataController extends BaseController | ||
| 85 | $data = $this->logic->saveData(); | 85 | $data = $this->logic->saveData(); |
| 86 | $this->response('success',Code::SUCCESS,$data); | 86 | $this->response('success',Code::SUCCESS,$data); |
| 87 | } | 87 | } |
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * @remark :删除数据 | ||
| 91 | + * @name :del | ||
| 92 | + * @author :lyh | ||
| 93 | + * @method :post | ||
| 94 | + * @time :2025/11/14 11:05 | ||
| 95 | + */ | ||
| 96 | + public function del() | ||
| 97 | + { | ||
| 98 | + $this->request->validate([ | ||
| 99 | + 'id'=>'required', | ||
| 100 | + ],[ | ||
| 101 | + 'id.required' => '主键ID不能为空', | ||
| 102 | + ]); | ||
| 103 | + $data = $this->logic->delData(); | ||
| 104 | + $this->response('success',Code::SUCCESS,$data); | ||
| 105 | + } | ||
| 88 | } | 106 | } |
| @@ -118,7 +118,7 @@ class AsideTicketController extends BaseController | @@ -118,7 +118,7 @@ class AsideTicketController extends BaseController | ||
| 118 | $manageIdArr = $manageHrModel->selectField(['entry_position' => ['in', [42, 43, 45, 48, 51]], 'status' => 1], 'manage_id'); | 118 | $manageIdArr = $manageHrModel->selectField(['entry_position' => ['in', [42, 43, 45, 48, 51]], 'status' => 1], 'manage_id'); |
| 119 | } | 119 | } |
| 120 | $query->whereHas('logs', function ($q) use ($manageIdArr) { | 120 | $query->whereHas('logs', function ($q) use ($manageIdArr) { |
| 121 | - $q->whereIn('engineer_id', $manageIdArr); | 121 | + $q->whereIn('engineer_id', $manageIdArr)->where('is_engineer',1); |
| 122 | }); | 122 | }); |
| 123 | }else{ | 123 | }else{ |
| 124 | $manageIdArr = $manageHrModel->selectField(['dept_id'=>$this->param['dept_id'],'status'=>1],'manage_id'); | 124 | $manageIdArr = $manageHrModel->selectField(['dept_id'=>$this->param['dept_id'],'status'=>1],'manage_id'); |
| @@ -17,12 +17,15 @@ use App\Models\CustomModule\CustomModule; | @@ -17,12 +17,15 @@ use App\Models\CustomModule\CustomModule; | ||
| 17 | use App\Models\CustomModule\CustomModuleCategory; | 17 | use App\Models\CustomModule\CustomModuleCategory; |
| 18 | use App\Models\CustomModule\CustomModuleContent; | 18 | use App\Models\CustomModule\CustomModuleContent; |
| 19 | use App\Models\News\News; | 19 | use App\Models\News\News; |
| 20 | +use App\Models\Product\Category; | ||
| 21 | +use App\Models\Product\CategoryRelated; | ||
| 20 | use App\Models\Product\Product; | 22 | use App\Models\Product\Product; |
| 21 | use App\Models\Project\Project; | 23 | use App\Models\Project\Project; |
| 22 | use App\Models\RouteMap\RouteMap; | 24 | use App\Models\RouteMap\RouteMap; |
| 23 | use App\Models\WebSetting\SettingNum; | 25 | use App\Models\WebSetting\SettingNum; |
| 24 | use App\Models\WebSetting\Translate; | 26 | use App\Models\WebSetting\Translate; |
| 25 | use App\Models\WebSetting\TranslateKey; | 27 | use App\Models\WebSetting\TranslateKey; |
| 28 | +use Illuminate\Support\Facades\Cache; | ||
| 26 | 29 | ||
| 27 | class TranslateController extends BaseController | 30 | class TranslateController extends BaseController |
| 28 | { | 31 | { |
| @@ -351,7 +354,20 @@ class TranslateController extends BaseController | @@ -351,7 +354,20 @@ class TranslateController extends BaseController | ||
| 351 | if($v['route'] == 'products'){ | 354 | if($v['route'] == 'products'){ |
| 352 | $count = $productModel->formatQuery(['status'=>1])->count(); | 355 | $count = $productModel->formatQuery(['status'=>1])->count(); |
| 353 | }else{ | 356 | }else{ |
| 354 | - $count = $productModel->formatQuery(['category_id'=>['like','%,'.$v['source_id'].',%'],'status'=>1])->count(); | 357 | + $catelists = Cache::get('product_category_trans'); |
| 358 | + if(!$catelists){ | ||
| 359 | + $cateModel = new Category(); | ||
| 360 | + $catelists = $cateModel->list(['status'=>1],'id',['id','pid']); | ||
| 361 | + Cache::put('product_category_trans',$catelists,3600 * 24); | ||
| 362 | + } | ||
| 363 | + $ids = $this->getCategoryWithChildrenIds($catelists,$v['source_id']); | ||
| 364 | + if (empty($ids) || !is_array($ids)) { | ||
| 365 | + // 处理空值情况,返回0或者默认值 | ||
| 366 | + $count = 0; | ||
| 367 | + } else { | ||
| 368 | + $cateRelateModel = new CategoryRelated(); | ||
| 369 | + $count = $cateRelateModel->whereIn('cateid', $ids)->distinct('product_id')->count(); | ||
| 370 | + } | ||
| 355 | } | 371 | } |
| 356 | $this->pageSixList($data,$count,$v,1,15); | 372 | $this->pageSixList($data,$count,$v,1,15); |
| 357 | break; | 373 | break; |
| @@ -474,4 +490,27 @@ class TranslateController extends BaseController | @@ -474,4 +490,27 @@ class TranslateController extends BaseController | ||
| 474 | } | 490 | } |
| 475 | return true; | 491 | return true; |
| 476 | } | 492 | } |
| 493 | + | ||
| 494 | + /** | ||
| 495 | + * 迭代方式获取分类及所有子分类的总数 | ||
| 496 | + * @param array $categories 所有分类数据 | ||
| 497 | + * @param int $categoryId 分类ID | ||
| 498 | + * @return int 分类总数 | ||
| 499 | + */ | ||
| 500 | + public function getCategoryWithChildrenIds($categories, $categoryId) { | ||
| 501 | + $ids = []; // 存储所有ID的数组 | ||
| 502 | + $queue = [$categoryId]; // 待处理的ID队列 | ||
| 503 | + while (!empty($queue)) { | ||
| 504 | + $currentId = array_shift($queue); | ||
| 505 | + // 将当前ID添加到结果数组 | ||
| 506 | + $ids[] = $currentId; | ||
| 507 | + // 查找所有子分类 | ||
| 508 | + foreach ($categories as $category) { | ||
| 509 | + if (isset($category['pid']) && $category['pid'] == $currentId) { | ||
| 510 | + $queue[] = $category['id']; // 将子分类ID加入队列 | ||
| 511 | + } | ||
| 512 | + } | ||
| 513 | + } | ||
| 514 | + return $ids; | ||
| 515 | + } | ||
| 477 | } | 516 | } |
| @@ -76,6 +76,9 @@ class GeoLinkLogic extends BaseLogic | @@ -76,6 +76,9 @@ class GeoLinkLogic extends BaseLogic | ||
| 76 | if(!empty($this->param['data'])){ | 76 | if(!empty($this->param['data'])){ |
| 77 | $data = []; | 77 | $data = []; |
| 78 | foreach ($this->param['data'] as $item){ | 78 | foreach ($this->param['data'] as $item){ |
| 79 | + //查看当前Url是否存在 | ||
| 80 | + $info = $this->model->read(['url'=>$item['url'],'type'=>$this->model::TYPE_NEWS,'project_id'=>$this->param['project_id']]); | ||
| 81 | + if($info === false){ | ||
| 79 | $data[] = [ | 82 | $data[] = [ |
| 80 | 'project_id'=>$this->param['project_id'], | 83 | 'project_id'=>$this->param['project_id'], |
| 81 | 'da'=>$item['da'] ?? 0, | 84 | 'da'=>$item['da'] ?? 0, |
| @@ -83,6 +86,7 @@ class GeoLinkLogic extends BaseLogic | @@ -83,6 +86,7 @@ class GeoLinkLogic extends BaseLogic | ||
| 83 | 'send_time'=>$item['send_time'] | 86 | 'send_time'=>$item['send_time'] |
| 84 | ]; | 87 | ]; |
| 85 | } | 88 | } |
| 89 | + } | ||
| 86 | $this->model->insertAll($data); | 90 | $this->model->insertAll($data); |
| 87 | } | 91 | } |
| 88 | }catch (\Exception $e){ | 92 | }catch (\Exception $e){ |
| @@ -84,10 +84,11 @@ class GeoQuestionLogic extends BaseLogic | @@ -84,10 +84,11 @@ class GeoQuestionLogic extends BaseLogic | ||
| 84 | */ | 84 | */ |
| 85 | public function saveGeoQuestion(){ | 85 | public function saveGeoQuestion(){ |
| 86 | //处理数据 | 86 | //处理数据 |
| 87 | - $this->param['question'] = json_encode($this->param['question'] ?? [],true); | 87 | + $count = count($this->param['question']); |
| 88 | + $question = $this->param['question']; | ||
| 88 | $this->param['url'] = json_encode($this->param['url'] ?? [],true); | 89 | $this->param['url'] = json_encode($this->param['url'] ?? [],true); |
| 89 | $this->param['keywords'] = json_encode($this->param['keywords'] ?? [],true); | 90 | $this->param['keywords'] = json_encode($this->param['keywords'] ?? [],true); |
| 90 | - //执行时间设置为今天 | 91 | + if($count <= 20){ |
| 91 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 92 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 92 | $id = $this->param['id']; | 93 | $id = $this->param['id']; |
| 93 | $this->model->edit($this->param,['id'=>$id]); | 94 | $this->model->edit($this->param,['id'=>$id]); |
| @@ -96,6 +97,28 @@ class GeoQuestionLogic extends BaseLogic | @@ -96,6 +97,28 @@ class GeoQuestionLogic extends BaseLogic | ||
| 96 | $id = $this->model->addReturnId($this->param); | 97 | $id = $this->model->addReturnId($this->param); |
| 97 | } | 98 | } |
| 98 | return $this->success(['id'=>$id]); | 99 | return $this->success(['id'=>$id]); |
| 100 | + }else{ | ||
| 101 | + $chunks = array_chunk($question, 20); | ||
| 102 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 103 | + foreach ($chunks as $index => $chunk) { | ||
| 104 | + $this->param['question'] = json_encode($chunk ?? [],true); | ||
| 105 | + if($index == 0){ | ||
| 106 | + $id = $this->param['id']; | ||
| 107 | + $this->model->edit($this->param,['id'=>$id]); | ||
| 108 | + }else{ | ||
| 109 | + unset($this->param['id']); | ||
| 110 | + $id = $this->model->addReturnId($this->param); | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + }else{ | ||
| 114 | + $this->param['next_time'] = date('Y-m-d'); | ||
| 115 | + foreach ($chunks as $chunk) { | ||
| 116 | + $this->param['question'] = json_encode($chunk ?? [],true); | ||
| 117 | + $id = $this->model->addReturnId($this->param); | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + return $this->success(['id'=>$id]); | ||
| 121 | + } | ||
| 99 | } | 122 | } |
| 100 | 123 | ||
| 101 | /** | 124 | /** |
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Http\Logic\Aside\Ticket; | 10 | namespace App\Http\Logic\Aside\Ticket; |
| 11 | 11 | ||
| 12 | +use App\Enums\Common\Code; | ||
| 12 | use App\Helper\Arr; | 13 | use App\Helper\Arr; |
| 13 | use App\Http\Logic\Aside\BaseLogic; | 14 | use App\Http\Logic\Aside\BaseLogic; |
| 14 | use App\Models\Blog\Blog; | 15 | use App\Models\Blog\Blog; |
| @@ -23,8 +24,10 @@ use App\Models\Product\KeywordRelated; | @@ -23,8 +24,10 @@ use App\Models\Product\KeywordRelated; | ||
| 23 | use App\Models\Product\Product; | 24 | use App\Models\Product\Product; |
| 24 | use App\Models\RouteMap\RouteMap; | 25 | use App\Models\RouteMap\RouteMap; |
| 25 | use App\Models\Ticket\TicketUploadData; | 26 | use App\Models\Ticket\TicketUploadData; |
| 27 | +use App\Models\WorkOrder\TicketProject; | ||
| 26 | use App\Services\ProjectServer; | 28 | use App\Services\ProjectServer; |
| 27 | use Illuminate\Support\Facades\DB; | 29 | use Illuminate\Support\Facades\DB; |
| 30 | +use Illuminate\Support\Facades\Http; | ||
| 28 | 31 | ||
| 29 | class TicketUploadDataLogic extends BaseLogic | 32 | class TicketUploadDataLogic extends BaseLogic |
| 30 | { | 33 | { |
| @@ -43,11 +46,15 @@ class TicketUploadDataLogic extends BaseLogic | @@ -43,11 +46,15 @@ class TicketUploadDataLogic extends BaseLogic | ||
| 43 | * @time :2025/9/25 14:17 | 46 | * @time :2025/9/25 14:17 |
| 44 | */ | 47 | */ |
| 45 | public function getDataList($map = [],$page = 1,$row = 20,$order = 'id'){ | 48 | public function getDataList($map = [],$page = 1,$row = 20,$order = 'id'){ |
| 46 | - if(isset($this->map['text']) && !empty($this->map['text'])){ | ||
| 47 | - $this->map['text'] = ['like','%'.$this->map['text'].'%']; | 49 | + if(isset($map['text']) && !empty($map['text'])){ |
| 50 | + $map['text'] = ['like','%'.$map['text'].'%']; | ||
| 51 | + } | ||
| 52 | + if(!isset($map['project_type']) || empty($map['project_type'])){ | ||
| 53 | + $map['project_type'] = $this->model::TYPE_SIX; | ||
| 48 | } | 54 | } |
| 49 | - ProjectServer::useProject($map['project_id']); | ||
| 50 | $data = $this->model->lists($map,$page,$row,$order); | 55 | $data = $this->model->lists($map,$page,$row,$order); |
| 56 | + if($map['project_type'] == $this->model::TYPE_SIX){ | ||
| 57 | + ProjectServer::useProject($map['project_id']); | ||
| 51 | if(!empty($data) && !empty($data['list'])){ | 58 | if(!empty($data) && !empty($data['list'])){ |
| 52 | foreach ($data['list'] as &$v){ | 59 | foreach ($data['list'] as &$v){ |
| 53 | $v = $this->getHandleFileImage($v); | 60 | $v = $this->getHandleFileImage($v); |
| @@ -55,6 +62,8 @@ class TicketUploadDataLogic extends BaseLogic | @@ -55,6 +62,8 @@ class TicketUploadDataLogic extends BaseLogic | ||
| 55 | } | 62 | } |
| 56 | } | 63 | } |
| 57 | DB::disconnect('custom_mysql'); | 64 | DB::disconnect('custom_mysql'); |
| 65 | + } | ||
| 66 | + | ||
| 58 | return $this->success($data); | 67 | return $this->success($data); |
| 59 | } | 68 | } |
| 60 | 69 | ||
| @@ -133,10 +142,12 @@ class TicketUploadDataLogic extends BaseLogic | @@ -133,10 +142,12 @@ class TicketUploadDataLogic extends BaseLogic | ||
| 133 | if($info === false){ | 142 | if($info === false){ |
| 134 | $this->fail('当前数据不存在或已被删除'); | 143 | $this->fail('当前数据不存在或已被删除'); |
| 135 | } | 144 | } |
| 145 | + if($info['project_type'] == $this->model::TYPE_SIX){ | ||
| 136 | ProjectServer::useProject($info['project_id']); | 146 | ProjectServer::useProject($info['project_id']); |
| 137 | $info['text']['cate_name'] = $this->cateText($info['type'],$info['text']['category_id'] ?? [],$info['text']['keyword_id'] ?? [],true); | 147 | $info['text']['cate_name'] = $this->cateText($info['type'],$info['text']['category_id'] ?? [],$info['text']['keyword_id'] ?? [],true); |
| 138 | $info = $this->getHandleFileImage($info); | 148 | $info = $this->getHandleFileImage($info); |
| 139 | DB::disconnect('custom_mysql'); | 149 | DB::disconnect('custom_mysql'); |
| 150 | + } | ||
| 140 | return $this->success($info); | 151 | return $this->success($info); |
| 141 | } | 152 | } |
| 142 | 153 | ||
| @@ -154,22 +165,100 @@ class TicketUploadDataLogic extends BaseLogic | @@ -154,22 +165,100 @@ class TicketUploadDataLogic extends BaseLogic | ||
| 154 | if($info === false){ | 165 | if($info === false){ |
| 155 | $this->fail('当前数据不存在或已被删除'); | 166 | $this->fail('当前数据不存在或已被删除'); |
| 156 | } | 167 | } |
| 168 | + if($info['project_type'] == $this->model::TYPE_SIX){//6.0数据 | ||
| 157 | //审核成功执行 | 169 | //审核成功执行 |
| 158 | - if($this->param['status'] == 1){ | 170 | + if($this->param['status'] == $this->model::STATUS_SUCCESS){ |
| 159 | ProjectServer::useProject($info['project_id']); | 171 | ProjectServer::useProject($info['project_id']); |
| 160 | - if($info['type'] == 1){ | 172 | + if($info['type'] == $this->model::TYPE_PRODUCT){ |
| 161 | $this->saveProductData($info); | 173 | $this->saveProductData($info); |
| 162 | - }elseif ($info['type'] == 2){ | 174 | + }elseif ($info['type'] == $this->model::TYPE_BLOG){ |
| 163 | $this->saveBlogData($info); | 175 | $this->saveBlogData($info); |
| 164 | }else{ | 176 | }else{ |
| 165 | $this->saveNewsData($info); | 177 | $this->saveNewsData($info); |
| 166 | } | 178 | } |
| 167 | DB::disconnect('custom_mysql'); | 179 | DB::disconnect('custom_mysql'); |
| 168 | } | 180 | } |
| 181 | + }else{ | ||
| 182 | + if($this->param['status'] == $this->model::STATUS_SUCCESS){ | ||
| 183 | + $ticketProjectMdoel = new TicketProject(); | ||
| 184 | + $projectInfo = $ticketProjectMdoel->read(['post_id' => $info['project_id']]); | ||
| 185 | + if($projectInfo === false){ | ||
| 186 | + $this->fail('当前项目不存在或数据未同步'); | ||
| 187 | + } | ||
| 188 | + if(isset($projectInfo['split']) && $projectInfo['split'] == 1){ | ||
| 189 | + $projectInfo['website'] = $projectInfo['test_website'] ?? ''; | ||
| 190 | + } | ||
| 191 | + $action = $this->model->saveAction($info['type']); | ||
| 192 | + $url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action; | ||
| 193 | + if(empty($action)){ | ||
| 194 | + $this->fail('未知请求,请联系管理员!'); | ||
| 195 | + } | ||
| 196 | + if($info['type'] == $this->model::TYPE_PRODUCT){ | ||
| 197 | + $this->save5ProductData($info,$url); | ||
| 198 | + }else{ | ||
| 199 | + $this->save5NewsData($info,$url); | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + } | ||
| 169 | $data = $this->model->edit(['status'=>$this->param['status'],'operator_id'=>$this->manager['id'],'remark'=>$this->param['remark'] ?? ''],['id'=>$this->param['id']]); | 203 | $data = $this->model->edit(['status'=>$this->param['status'],'operator_id'=>$this->manager['id'],'remark'=>$this->param['remark'] ?? ''],['id'=>$this->param['id']]); |
| 170 | return $this->success($data); | 204 | return $this->success($data); |
| 171 | } | 205 | } |
| 172 | 206 | ||
| 207 | + /** | ||
| 208 | + * @remark :保存5.0产品数据 | ||
| 209 | + * @name :save5ProductData | ||
| 210 | + * @author :lyh | ||
| 211 | + * @method :post | ||
| 212 | + * @time :2025/11/10 14:18 | ||
| 213 | + */ | ||
| 214 | + public function save5ProductData($info,$url){ | ||
| 215 | + $response = Http::withHeaders([])->asForm()->post($url, [ | ||
| 216 | + 'title' => $info['text']['title'], | ||
| 217 | + 'cate_id' => isset($info['text']['cate']) ? implode(',', $info['text']['cate']) : '', | ||
| 218 | + 'content'=>$info['text']['content'] ?? '', | ||
| 219 | + 'short_description'=>$info['text']['short_description'] ?? '', | ||
| 220 | + 'images'=>$info['text']['image'] ?? '', | ||
| 221 | + ]); | ||
| 222 | + if ($response->successful()) { | ||
| 223 | + $result = $response->json(); // 获取 JSON 响应体 | ||
| 224 | + if ($result && $result['status'] == 200) { | ||
| 225 | + return $this->success(); | ||
| 226 | + } | ||
| 227 | + } | ||
| 228 | + $this->fail('未知请求,请联系管理员!'); | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + /** | ||
| 232 | + * @remark :保存新闻 | ||
| 233 | + * @name :save5NewsData | ||
| 234 | + * @author :lyh | ||
| 235 | + * @method :post | ||
| 236 | + * @time :2025/11/10 14:43 | ||
| 237 | + */ | ||
| 238 | + public function save5NewsData($info,$url){ | ||
| 239 | + $response = Http::withHeaders([])->asForm()->post($url, [ | ||
| 240 | + 'title' => $info['text']['title'] ?? 'ceshi123', | ||
| 241 | + 'cate' => isset($info['text']['cate']) ? implode(',', $info['text']['cate']) : '', | ||
| 242 | + 'content'=>$info['text']['content'] ?? '', | ||
| 243 | + 'image'=>$info['text']['image'] ?? '', | ||
| 244 | + ]); | ||
| 245 | + if ($response->successful()) { | ||
| 246 | + $result = $response->json(); // 获取 JSON 响应体 | ||
| 247 | + if ($result && $result['status'] == 200) { | ||
| 248 | + return $this->success(); | ||
| 249 | + } | ||
| 250 | + } | ||
| 251 | + $this->fail('未知请求,请联系管理员!'); | ||
| 252 | + } | ||
| 253 | + | ||
| 254 | + | ||
| 255 | + /** | ||
| 256 | + * @remark :设置排序 | ||
| 257 | + * @name :setProductSort | ||
| 258 | + * @author :lyh | ||
| 259 | + * @method :post | ||
| 260 | + * @time :2025/11/10 14:11 | ||
| 261 | + */ | ||
| 173 | public function setProductSort($mdoel){ | 262 | public function setProductSort($mdoel){ |
| 174 | $info = $mdoel->orderBy('sort','desc')->first(); | 263 | $info = $mdoel->orderBy('sort','desc')->first(); |
| 175 | if(empty($info)){ | 264 | if(empty($info)){ |
| @@ -308,4 +397,17 @@ class TicketUploadDataLogic extends BaseLogic | @@ -308,4 +397,17 @@ class TicketUploadDataLogic extends BaseLogic | ||
| 308 | } | 397 | } |
| 309 | return $this->success(); | 398 | return $this->success(); |
| 310 | } | 399 | } |
| 400 | + | ||
| 401 | + /** | ||
| 402 | + * @remark :删除 | ||
| 403 | + * @name :delData | ||
| 404 | + * @author :lyh | ||
| 405 | + * @method :post | ||
| 406 | + * @time :2025/11/14 11:04 | ||
| 407 | + */ | ||
| 408 | + public function delData() | ||
| 409 | + { | ||
| 410 | + $this->model->del(['id'=>['in',$this->param['id']]]); | ||
| 411 | + return $this->success(); | ||
| 412 | + } | ||
| 311 | } | 413 | } |
| @@ -237,6 +237,9 @@ class KeywordLogic extends BaseLogic | @@ -237,6 +237,9 @@ class KeywordLogic extends BaseLogic | ||
| 237 | $productModel = new Product(); | 237 | $productModel = new Product(); |
| 238 | foreach ($this->param['title'] as $v){ | 238 | foreach ($this->param['title'] as $v){ |
| 239 | $info = $this->model->read(['title'=>$v]); | 239 | $info = $this->model->read(['title'=>$v]); |
| 240 | + if($info === false){ | ||
| 241 | + $info = $this->model->read(['route'=>$v]); | ||
| 242 | + } | ||
| 240 | if($info){ | 243 | if($info){ |
| 241 | $this->delRoute($info['id']); | 244 | $this->delRoute($info['id']); |
| 242 | $this->model->del(['id'=>$info['id']]); | 245 | $this->model->del(['id'=>$info['id']]); |
| @@ -44,14 +44,17 @@ class LinkDataLogic extends BaseLogic | @@ -44,14 +44,17 @@ class LinkDataLogic extends BaseLogic | ||
| 44 | public function batchSave(){ | 44 | public function batchSave(){ |
| 45 | $data = []; | 45 | $data = []; |
| 46 | foreach ($this->param['data'] as $v){ | 46 | foreach ($this->param['data'] as $v){ |
| 47 | + $info = $this->model->read(['da'=>$v['da_values'],'project_id'=>$this->user['project_id'],'type'=>GeoLink::TYPE_LINK]); | ||
| 48 | + if($info === false){ | ||
| 47 | $data[] = [ | 49 | $data[] = [ |
| 48 | 'url'=>$v['url'], | 50 | 'url'=>$v['url'], |
| 49 | - 'da_values'=>$v['da_values'], | 51 | + 'da'=>$v['da_values'], |
| 50 | 'type'=>GeoLink::TYPE_LINK, | 52 | 'type'=>GeoLink::TYPE_LINK, |
| 51 | 'project_id'=>$this->user['project_id'], | 53 | 'project_id'=>$this->user['project_id'], |
| 52 | 'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s') | 54 | 'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s') |
| 53 | ]; | 55 | ]; |
| 54 | } | 56 | } |
| 57 | + } | ||
| 55 | if(!empty($data)){ | 58 | if(!empty($data)){ |
| 56 | $this->model->insertAll($data); | 59 | $this->model->insertAll($data); |
| 57 | } | 60 | } |
| @@ -80,8 +83,8 @@ class LinkDataLogic extends BaseLogic | @@ -80,8 +83,8 @@ class LinkDataLogic extends BaseLogic | ||
| 80 | $end = Carbon::parse(date('Y-m-d')); | 83 | $end = Carbon::parse(date('Y-m-d')); |
| 81 | $diff = $start->diffInDays($end); | 84 | $diff = $start->diffInDays($end); |
| 82 | if($diff <= 60){ | 85 | if($diff <= 60){ |
| 83 | - $info['da_values'] = $daInfo['da']; | ||
| 84 | - $this->model->edit(['da_values'=>$daInfo['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); | 86 | + $info['da'] = $daInfo['da']; |
| 87 | + $this->model->edit(['da'=>$daInfo['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); | ||
| 85 | return $this->success($info); | 88 | return $this->success($info); |
| 86 | } | 89 | } |
| 87 | } | 90 | } |
| @@ -90,14 +93,14 @@ class LinkDataLogic extends BaseLogic | @@ -90,14 +93,14 @@ class LinkDataLogic extends BaseLogic | ||
| 90 | if(!isset($result['data']) || empty($result['data'])){ | 93 | if(!isset($result['data']) || empty($result['data'])){ |
| 91 | return $this->success($info); | 94 | return $this->success($info); |
| 92 | } | 95 | } |
| 93 | - $info['da_values'] = (int)$result['data']['mozDA'];//获取数据中的da值 | 96 | + $info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值 |
| 94 | //保存数据 | 97 | //保存数据 |
| 95 | if($daInfo !== false){ | 98 | if($daInfo !== false){ |
| 96 | - $domainDaModel->edit(['da'=>$info['da_values'],'result'=>json_encode($result,true)],['id'=>$daInfo['id']]); | 99 | + $domainDaModel->edit(['da'=>$info['da'],'result'=>json_encode($result,true)],['id'=>$daInfo['id']]); |
| 97 | }else{ | 100 | }else{ |
| 98 | - $domainDaModel->addReturnId(['da'=>$info['da_values'],'domain'=>$host,'result'=>json_encode($result,true)]); | 101 | + $domainDaModel->addReturnId(['da'=>$info['da'],'domain'=>$host,'result'=>json_encode($result,true)]); |
| 99 | } | 102 | } |
| 100 | - $this->model->edit(['da_values'=>$info['da_values'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); | 103 | + $this->model->edit(['da'=>$info['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); |
| 101 | return $this->success($info); | 104 | return $this->success($info); |
| 102 | } | 105 | } |
| 103 | 106 |
| @@ -44,8 +44,8 @@ class GeoConfirm extends Base | @@ -44,8 +44,8 @@ class GeoConfirm extends Base | ||
| 44 | public static function typeMapping() | 44 | public static function typeMapping() |
| 45 | { | 45 | { |
| 46 | return [ | 46 | return [ |
| 47 | - self::TYPE_TITLE => '核心关键词问题已整理,请查看并确认', | ||
| 48 | - self::TYPE_KEYWORD => '文章标题已整理,请查看并确认' | 47 | + self::TYPE_TITLE => '文章标题已整理,请查看并确认', |
| 48 | + self::TYPE_KEYWORD => '核心关键词问题已整理,请查看并确认' | ||
| 49 | ]; | 49 | ]; |
| 50 | } | 50 | } |
| 51 | 51 |
| @@ -23,10 +23,29 @@ class TicketUploadData extends Base | @@ -23,10 +23,29 @@ class TicketUploadData extends Base | ||
| 23 | { | 23 | { |
| 24 | protected $table = 'gl_tickets_upload_data'; | 24 | protected $table = 'gl_tickets_upload_data'; |
| 25 | 25 | ||
| 26 | + const TYPE_SIX = 2;//6.0 | ||
| 27 | + const TYPE_FIVE = 1;//5.0 | ||
| 28 | + | ||
| 29 | + const STATUS_SUCCESS = 1;//审核成功 | ||
| 30 | + | ||
| 31 | + const TYPE_PRODUCT = 1;//产品 | ||
| 32 | + const TYPE_BLOG = 2;//blog | ||
| 33 | + const TYPE_NEWS = 3;//新闻 | ||
| 34 | + | ||
| 26 | public function getTextAttribute($value){ | 35 | public function getTextAttribute($value){ |
| 27 | if(!empty($value)){ | 36 | if(!empty($value)){ |
| 28 | $value = Arr::s2a($value); | 37 | $value = Arr::s2a($value); |
| 29 | } | 38 | } |
| 30 | return $value; | 39 | return $value; |
| 31 | } | 40 | } |
| 41 | + | ||
| 42 | + | ||
| 43 | + public function saveAction($type) | ||
| 44 | + { | ||
| 45 | + $data = [ | ||
| 46 | + 1 => 'add_products', | ||
| 47 | + 3 => 'add_news_api', | ||
| 48 | + ]; | ||
| 49 | + return $data[$type] ?? ''; | ||
| 50 | + } | ||
| 32 | } | 51 | } |
| @@ -680,6 +680,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -680,6 +680,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 680 | Route::any('/', [Aside\Ticket\TicketUploadDataController::class,'lists'])->name('ticket_upload_lists'); | 680 | Route::any('/', [Aside\Ticket\TicketUploadDataController::class,'lists'])->name('ticket_upload_lists'); |
| 681 | Route::any('/save', [Aside\Ticket\TicketUploadDataController::class,'save'])->name('ticket_upload_save'); | 681 | Route::any('/save', [Aside\Ticket\TicketUploadDataController::class,'save'])->name('ticket_upload_save'); |
| 682 | Route::any('/detail', [Aside\Ticket\TicketUploadDataController::class,'detail'])->name('ticket_upload_detail'); | 682 | Route::any('/detail', [Aside\Ticket\TicketUploadDataController::class,'detail'])->name('ticket_upload_detail'); |
| 683 | + Route::any('/del', [Aside\Ticket\TicketUploadDataController::class,'del'])->name('ticket_upload_del'); | ||
| 683 | }); | 684 | }); |
| 684 | //岗位管理 | 685 | //岗位管理 |
| 685 | Route::prefix('entry_position')->group(function () { | 686 | Route::prefix('entry_position')->group(function () { |
-
请 注册 或 登录 后发表评论