Merge remote-tracking branch 'origin/master' into akun
正在显示
15 个修改的文件
包含
231 行增加
和
50 行删除
| @@ -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{ |
| @@ -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,7 @@ class FetchTicketProjects extends Command | @@ -154,6 +154,7 @@ 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, | ||
| 157 | ]; | 158 | ]; |
| 158 | if (!$project) { | 159 | if (!$project) { |
| 159 | $new = new TicketProject(); | 160 | $new = new TicketProject(); |
| @@ -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 |
| @@ -46,24 +53,29 @@ class Ticket5UploadDataController extends BaseController | @@ -46,24 +53,29 @@ class Ticket5UploadDataController extends BaseController | ||
| 46 | $this->response('当前项目不存在或数据未同步',Code::SYSTEM_ERROR); | 53 | $this->response('当前项目不存在或数据未同步',Code::SYSTEM_ERROR); |
| 47 | } | 54 | } |
| 48 | //todo::目前写死 | 55 | //todo::目前写死 |
| 49 | - $projectInfo['website'] = 'https://devmark.globalso.com/'; | 56 | + if($projectInfo['website'] != 'https://www.lstchocolatemachine.com/'){ |
| 57 | + $this->response('当前项目不允许操作',Code::SYSTEM_ERROR); | ||
| 58 | + } | ||
| 50 | $action = $project5CateModel->getCateTypeAction($this->param['type']); | 59 | $action = $project5CateModel->getCateTypeAction($this->param['type']); |
| 51 | if(empty($action)){ | 60 | if(empty($action)){ |
| 52 | $this->response('未知请求',Code::SYSTEM_ERROR); | 61 | $this->response('未知请求',Code::SYSTEM_ERROR); |
| 53 | } | 62 | } |
| 54 | $url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action; | 63 | $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']; | 64 | + $response = Http::withHeaders([])->asForm()->get($url); |
| 65 | + if ($response->successful()) { | ||
| 66 | + $result = $response->json(); // 获取 JSON 响应体 | ||
| 67 | + if ($result && $result['status'] == 200) { | ||
| 68 | + $resultData = $result['data']; | ||
| 58 | $saveData = [ | 69 | $saveData = [ |
| 59 | 'project_id' => $projectInfo['post_id'], | 70 | 'project_id' => $projectInfo['post_id'], |
| 60 | 'domain' => $projectInfo['website'], | 71 | 'domain' => $projectInfo['website'], |
| 61 | - 'text'=>json_encode($data['data']), | 72 | + 'text'=>json_encode($result['data']), |
| 62 | 'type' => $this->param['type'], | 73 | 'type' => $this->param['type'], |
| 63 | ]; | 74 | ]; |
| 64 | $project5CateModel->addReturnId($saveData); | 75 | $project5CateModel->addReturnId($saveData); |
| 65 | $this->response('success', Code::SUCCESS,$resultData); | 76 | $this->response('success', Code::SUCCESS,$resultData); |
| 66 | } | 77 | } |
| 78 | + } | ||
| 67 | $this->response('success',Code::SUCCESS,$url); | 79 | $this->response('success',Code::SUCCESS,$url); |
| 68 | } | 80 | } |
| 69 | 81 | ||
| @@ -95,7 +107,9 @@ class Ticket5UploadDataController extends BaseController | @@ -95,7 +107,9 @@ class Ticket5UploadDataController extends BaseController | ||
| 95 | } | 107 | } |
| 96 | $project5CateModel = new Project5Cate(); | 108 | $project5CateModel = new Project5Cate(); |
| 97 | //todo::目前写死,上线放开 | 109 | //todo::目前写死,上线放开 |
| 98 | - $projectInfo['website'] = 'https://devmark.globalso.com/'; | 110 | + if($projectInfo['website'] != 'https://www.lstchocolatemachine.com/'){ |
| 111 | + $this->response('当前项目不允许操作',Code::SYSTEM_ERROR); | ||
| 112 | + } | ||
| 99 | $action = $project5CateModel->saveCateTypeAction($this->param['type']); | 113 | $action = $project5CateModel->saveCateTypeAction($this->param['type']); |
| 100 | $url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action; | 114 | $url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action; |
| 101 | if(empty($action)){ | 115 | if(empty($action)){ |
| @@ -111,15 +125,18 @@ class Ticket5UploadDataController extends BaseController | @@ -111,15 +125,18 @@ class Ticket5UploadDataController extends BaseController | ||
| 111 | //todo::更新分类数据 | 125 | //todo::更新分类数据 |
| 112 | $action1 = $project5CateModel->getCateTypeAction($this->param['type']); | 126 | $action1 = $project5CateModel->getCateTypeAction($this->param['type']); |
| 113 | $url1 = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action1; | 127 | $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']; | 128 | + $response = Http::withHeaders([])->asForm()->get($url1); |
| 129 | + if ($response->successful()) { | ||
| 130 | + $result = $response->json(); | ||
| 131 | + if($result && $result['status'] == 200){ | ||
| 132 | + $resultData = $result['data']; | ||
| 117 | $saveData = [ | 133 | $saveData = [ |
| 118 | - 'text'=>json_encode($data['data']), | 134 | + 'text'=>json_encode($result['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), |
| 119 | ]; | 135 | ]; |
| 120 | $project5CateModel->edit($saveData,['project_id' => $projectInfo['post_id'],'type'=>$this->param['type']]); | 136 | $project5CateModel->edit($saveData,['project_id' => $projectInfo['post_id'],'type'=>$this->param['type']]); |
| 121 | $this->response('success', Code::SUCCESS,$resultData); | 137 | $this->response('success', Code::SUCCESS,$resultData); |
| 122 | } | 138 | } |
| 139 | + } | ||
| 123 | $this->response('success'); | 140 | $this->response('success'); |
| 124 | } | 141 | } |
| 125 | } | 142 | } |
| @@ -133,15 +150,15 @@ class Ticket5UploadDataController extends BaseController | @@ -133,15 +150,15 @@ class Ticket5UploadDataController extends BaseController | ||
| 133 | * @method :post | 150 | * @method :post |
| 134 | * @time :2025/11/10 11:01 | 151 | * @time :2025/11/10 11:01 |
| 135 | */ | 152 | */ |
| 136 | - public function save() | 153 | + public function save5Data() |
| 137 | { | 154 | { |
| 138 | $this->request->validate([ | 155 | $this->request->validate([ |
| 139 | 'post_id' => 'required', | 156 | 'post_id' => 'required', |
| 140 | 'type' => 'required', | 157 | 'type' => 'required', |
| 141 | 'text' => 'required' | 158 | 'text' => 'required' |
| 142 | ], [ | 159 | ], [ |
| 143 | - 'post_od.required' => 'project_id不能为空', | ||
| 144 | - 'type.required' => '上传类型不能为空', | 160 | + 'post_id.required' => 'post_id不能为空', |
| 161 | + 'type.required' => '类型不能为空', | ||
| 145 | 'text' => '数据详情不为空' | 162 | 'text' => '数据详情不为空' |
| 146 | ]); | 163 | ]); |
| 147 | if(empty($this->param['text']['image'])){ | 164 | if(empty($this->param['text']['image'])){ |
| @@ -152,7 +169,7 @@ class Ticket5UploadDataController extends BaseController | @@ -152,7 +169,7 @@ class Ticket5UploadDataController extends BaseController | ||
| 152 | } | 169 | } |
| 153 | //验证当前数据是否已提交 | 170 | //验证当前数据是否已提交 |
| 154 | $this->param['text'] = json_encode($this->param['text'], true); | 171 | $this->param['text'] = json_encode($this->param['text'], true); |
| 155 | - $this->pushTicketByBots($this->param['post_id'],$this->param['type']); | 172 | +// $this->pushTicketByBots($this->param['post_id'],$this->param['project_type']); |
| 156 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 173 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 157 | //执行编辑 | 174 | //执行编辑 |
| 158 | $info = $this->model->read(['id'=>$this->param['id']]); | 175 | $info = $this->model->read(['id'=>$this->param['id']]); |
| @@ -163,8 +180,10 @@ class Ticket5UploadDataController extends BaseController | @@ -163,8 +180,10 @@ class Ticket5UploadDataController extends BaseController | ||
| 163 | } | 180 | } |
| 164 | $this->response('success'); | 181 | $this->response('success'); |
| 165 | }else{ | 182 | }else{ |
| 166 | - $info = $this->model->read(['project_id' => $this->param['project_id'], 'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]); | 183 | + $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) { | 184 | if ($info === false) { |
| 185 | + $this->param['project_type'] = $this->model::TYPE_FIVE ; | ||
| 186 | + $this->param['project_id'] = $this->param['post_id']; | ||
| 168 | $id = $this->model->addReturnId($this->param); | 187 | $id = $this->model->addReturnId($this->param); |
| 169 | } else { | 188 | } else { |
| 170 | $id = $info['id']; | 189 | $id = $info['id']; |
| @@ -177,16 +196,16 @@ class Ticket5UploadDataController extends BaseController | @@ -177,16 +196,16 @@ class Ticket5UploadDataController extends BaseController | ||
| 177 | /** | 196 | /** |
| 178 | * @remark :钉钉通知 | 197 | * @remark :钉钉通知 |
| 179 | * @name :pushTicketByBots | 198 | * @name :pushTicketByBots |
| 180 | - * @author :lyh | ||
| 181 | * @method :post | 199 | * @method :post |
| 182 | * @time :2025/11/10 11:10 | 200 | * @time :2025/11/10 11:10 |
| 201 | + * @author :lyh | ||
| 183 | */ | 202 | */ |
| 184 | public function pushTicketByBots($post_id,$type = 1) | 203 | public function pushTicketByBots($post_id,$type = 1) |
| 185 | { | 204 | { |
| 186 | $project = TicketProject::where('post_id', $post_id)->where('project_cate',$type)->where('is_del', 0)->first(); | 205 | $project = TicketProject::where('post_id', $post_id)->where('project_cate',$type)->where('is_del', 0)->first(); |
| 187 | - if (!$project){ | ||
| 188 | - return response()->json(['message' => '未找到对应的工单项目'], 404); | ||
| 189 | - } | 206 | + if ($project){ |
| 190 | return $project->pushWechatGroupMsg("您好,用户已上传数据,请审核!"); | 207 | return $project->pushWechatGroupMsg("您好,用户已上传数据,请审核!"); |
| 191 | } | 208 | } |
| 209 | + return true; | ||
| 210 | + } | ||
| 192 | } | 211 | } |
| @@ -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 | } |
| @@ -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不能为空', |
| @@ -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 | ||
| @@ -154,22 +163,100 @@ class TicketUploadDataLogic extends BaseLogic | @@ -154,22 +163,100 @@ class TicketUploadDataLogic extends BaseLogic | ||
| 154 | if($info === false){ | 163 | if($info === false){ |
| 155 | $this->fail('当前数据不存在或已被删除'); | 164 | $this->fail('当前数据不存在或已被删除'); |
| 156 | } | 165 | } |
| 166 | + if($info['project_type'] == $this->model::TYPE_SIX){//6.0数据 | ||
| 157 | //审核成功执行 | 167 | //审核成功执行 |
| 158 | - if($this->param['status'] == 1){ | 168 | + if($this->param['status'] == $this->model::STATUS_SUCCESS){ |
| 159 | ProjectServer::useProject($info['project_id']); | 169 | ProjectServer::useProject($info['project_id']); |
| 160 | - if($info['type'] == 1){ | 170 | + if($info['type'] == $this->model::TYPE_PRODUCT){ |
| 161 | $this->saveProductData($info); | 171 | $this->saveProductData($info); |
| 162 | - }elseif ($info['type'] == 2){ | 172 | + }elseif ($info['type'] == $this->model::TYPE_BLOG){ |
| 163 | $this->saveBlogData($info); | 173 | $this->saveBlogData($info); |
| 164 | }else{ | 174 | }else{ |
| 165 | $this->saveNewsData($info); | 175 | $this->saveNewsData($info); |
| 166 | } | 176 | } |
| 167 | DB::disconnect('custom_mysql'); | 177 | DB::disconnect('custom_mysql'); |
| 168 | } | 178 | } |
| 179 | + }else{ | ||
| 180 | + if($this->param['status'] == $this->model::STATUS_SUCCESS){ | ||
| 181 | + $ticketProjectMdoel = new TicketProject(); | ||
| 182 | + $projectInfo = $ticketProjectMdoel->read(['post_id' => $info['project_id']]); | ||
| 183 | + if($projectInfo === false){ | ||
| 184 | + $this->fail('当前项目不存在或数据未同步'); | ||
| 185 | + } | ||
| 186 | + if($projectInfo['website'] != 'https://www.lstchocolatemachine.com/'){ | ||
| 187 | + $this->fail('当前项目不允许操作'); | ||
| 188 | + } | ||
| 189 | + $action = $this->model->saveAction($info['type']); | ||
| 190 | + $url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action; | ||
| 191 | + if(empty($action)){ | ||
| 192 | + $this->fail('未知请求,请联系管理员!'); | ||
| 193 | + } | ||
| 194 | + if($info['type'] == $this->model::TYPE_PRODUCT){ | ||
| 195 | + $this->save5ProductData($info,$url); | ||
| 196 | + }else{ | ||
| 197 | + $this->save5NewsData($info,$url); | ||
| 198 | + } | ||
| 199 | + } | ||
| 200 | + } | ||
| 169 | $data = $this->model->edit(['status'=>$this->param['status'],'operator_id'=>$this->manager['id'],'remark'=>$this->param['remark'] ?? ''],['id'=>$this->param['id']]); | 201 | $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); | 202 | return $this->success($data); |
| 171 | } | 203 | } |
| 172 | 204 | ||
| 205 | + /** | ||
| 206 | + * @remark :保存5.0产品数据 | ||
| 207 | + * @name :save5ProductData | ||
| 208 | + * @author :lyh | ||
| 209 | + * @method :post | ||
| 210 | + * @time :2025/11/10 14:18 | ||
| 211 | + */ | ||
| 212 | + public function save5ProductData($info,$url){ | ||
| 213 | + $response = Http::withHeaders([])->asForm()->post($url, [ | ||
| 214 | + 'title' => $info['text']['title'], | ||
| 215 | + 'cate_id' => isset($info['text']['cate']) ? implode(',', $info['text']['cate']) : '', | ||
| 216 | + 'content'=>$info['text']['content'] ?? '', | ||
| 217 | + 'short_description'=>$info['text']['short_description'] ?? '', | ||
| 218 | + 'images'=>$info['text']['image'] ?? '', | ||
| 219 | + ]); | ||
| 220 | + if ($response->successful()) { | ||
| 221 | + $result = $response->json(); // 获取 JSON 响应体 | ||
| 222 | + if ($result && $result['status'] == 200) { | ||
| 223 | + return $this->success(); | ||
| 224 | + } | ||
| 225 | + } | ||
| 226 | + $this->fail('未知请求,请联系管理员!'); | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + /** | ||
| 230 | + * @remark :保存新闻 | ||
| 231 | + * @name :save5NewsData | ||
| 232 | + * @author :lyh | ||
| 233 | + * @method :post | ||
| 234 | + * @time :2025/11/10 14:43 | ||
| 235 | + */ | ||
| 236 | + public function save5NewsData($info,$url){ | ||
| 237 | + $response = Http::withHeaders([])->asForm()->post($url, [ | ||
| 238 | + 'title' => $info['text']['title'] ?? 'ceshi123', | ||
| 239 | + 'cate' => isset($info['text']['cate']) ? implode(',', $info['text']['cate']) : '', | ||
| 240 | + 'content'=>$info['text']['content'] ?? '', | ||
| 241 | + 'image'=>$info['text']['image'] ?? '', | ||
| 242 | + ]); | ||
| 243 | + if ($response->successful()) { | ||
| 244 | + $result = $response->json(); // 获取 JSON 响应体 | ||
| 245 | + if ($result && $result['status'] == 200) { | ||
| 246 | + return $this->success(); | ||
| 247 | + } | ||
| 248 | + } | ||
| 249 | + $this->fail('未知请求,请联系管理员!'); | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + | ||
| 253 | + /** | ||
| 254 | + * @remark :设置排序 | ||
| 255 | + * @name :setProductSort | ||
| 256 | + * @author :lyh | ||
| 257 | + * @method :post | ||
| 258 | + * @time :2025/11/10 14:11 | ||
| 259 | + */ | ||
| 173 | public function setProductSort($mdoel){ | 260 | public function setProductSort($mdoel){ |
| 174 | $info = $mdoel->orderBy('sort','desc')->first(); | 261 | $info = $mdoel->orderBy('sort','desc')->first(); |
| 175 | if(empty($info)){ | 262 | if(empty($info)){ |
| @@ -46,7 +46,7 @@ class LinkDataLogic extends BaseLogic | @@ -46,7 +46,7 @@ class LinkDataLogic extends BaseLogic | ||
| 46 | foreach ($this->param['data'] as $v){ | 46 | foreach ($this->param['data'] as $v){ |
| 47 | $data[] = [ | 47 | $data[] = [ |
| 48 | 'url'=>$v['url'], | 48 | 'url'=>$v['url'], |
| 49 | - 'da_values'=>$v['da_values'], | 49 | + 'da'=>$v['da_values'], |
| 50 | 'type'=>GeoLink::TYPE_LINK, | 50 | 'type'=>GeoLink::TYPE_LINK, |
| 51 | 'project_id'=>$this->user['project_id'], | 51 | 'project_id'=>$this->user['project_id'], |
| 52 | 'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s') | 52 | 'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s') |
| @@ -80,8 +80,8 @@ class LinkDataLogic extends BaseLogic | @@ -80,8 +80,8 @@ class LinkDataLogic extends BaseLogic | ||
| 80 | $end = Carbon::parse(date('Y-m-d')); | 80 | $end = Carbon::parse(date('Y-m-d')); |
| 81 | $diff = $start->diffInDays($end); | 81 | $diff = $start->diffInDays($end); |
| 82 | if($diff <= 60){ | 82 | 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']]); | 83 | + $info['da'] = $daInfo['da']; |
| 84 | + $this->model->edit(['da'=>$daInfo['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); | ||
| 85 | return $this->success($info); | 85 | return $this->success($info); |
| 86 | } | 86 | } |
| 87 | } | 87 | } |
| @@ -90,14 +90,14 @@ class LinkDataLogic extends BaseLogic | @@ -90,14 +90,14 @@ class LinkDataLogic extends BaseLogic | ||
| 90 | if(!isset($result['data']) || empty($result['data'])){ | 90 | if(!isset($result['data']) || empty($result['data'])){ |
| 91 | return $this->success($info); | 91 | return $this->success($info); |
| 92 | } | 92 | } |
| 93 | - $info['da_values'] = (int)$result['data']['mozDA'];//获取数据中的da值 | 93 | + $info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值 |
| 94 | //保存数据 | 94 | //保存数据 |
| 95 | if($daInfo !== false){ | 95 | if($daInfo !== false){ |
| 96 | - $domainDaModel->edit(['da'=>$info['da_values'],'result'=>json_encode($result,true)],['id'=>$daInfo['id']]); | 96 | + $domainDaModel->edit(['da'=>$info['da'],'result'=>json_encode($result,true)],['id'=>$daInfo['id']]); |
| 97 | }else{ | 97 | }else{ |
| 98 | - $domainDaModel->addReturnId(['da'=>$info['da_values'],'domain'=>$host,'result'=>json_encode($result,true)]); | 98 | + $domainDaModel->addReturnId(['da'=>$info['da'],'domain'=>$host,'result'=>json_encode($result,true)]); |
| 99 | } | 99 | } |
| 100 | - $this->model->edit(['da_values'=>$info['da_values'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); | 100 | + $this->model->edit(['da'=>$info['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); |
| 101 | return $this->success($info); | 101 | return $this->success($info); |
| 102 | } | 102 | } |
| 103 | 103 |
| @@ -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 | } |
| @@ -112,7 +112,7 @@ Route::prefix('ticket_upload')->group(function () { | @@ -112,7 +112,7 @@ Route::prefix('ticket_upload')->group(function () { | ||
| 112 | //5.0获取分类 | 112 | //5.0获取分类 |
| 113 | Route::any('/getProject5Cate', [\App\Http\Controllers\Api\WorkOrder\Ticket5UploadDataController::class, 'getProject5Cate'])->name('ticket_upload.getProject5Cate'); | 113 | Route::any('/getProject5Cate', [\App\Http\Controllers\Api\WorkOrder\Ticket5UploadDataController::class, 'getProject5Cate'])->name('ticket_upload.getProject5Cate'); |
| 114 | Route::any('/addProject5Cate', [\App\Http\Controllers\Api\WorkOrder\Ticket5UploadDataController::class, 'addProject5Cate'])->name('ticket_upload.addProject5Cate'); | 114 | Route::any('/addProject5Cate', [\App\Http\Controllers\Api\WorkOrder\Ticket5UploadDataController::class, 'addProject5Cate'])->name('ticket_upload.addProject5Cate'); |
| 115 | - | 115 | + Route::any('/save5Data', [\App\Http\Controllers\Api\WorkOrder\Ticket5UploadDataController::class, 'save5Data'])->name('ticket_upload.save5Data'); |
| 116 | }); | 116 | }); |
| 117 | //geo设置 | 117 | //geo设置 |
| 118 | Route::prefix('geo')->group(function () { | 118 | Route::prefix('geo')->group(function () { |
-
请 注册 或 登录 后发表评论