Merge remote-tracking branch 'origin/master' into akun
正在显示
6 个修改的文件
包含
69 行增加
和
39 行删除
| @@ -59,15 +59,30 @@ class MonthProjectCount extends Command | @@ -59,15 +59,30 @@ class MonthProjectCount extends Command | ||
| 59 | * @time :2024/1/8 9:05 | 59 | * @time :2024/1/8 9:05 |
| 60 | */ | 60 | */ |
| 61 | public function count($project_id,$url,$is_upgrade = 0){ | 61 | public function count($project_id,$url,$is_upgrade = 0){ |
| 62 | - $data = []; | ||
| 63 | $list = DB::connection('custom_mysql')->table('gl_customer_visit') | 62 | $list = DB::connection('custom_mysql')->table('gl_customer_visit') |
| 64 | ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month')) | 63 | ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month')) |
| 65 | ->orderBy('month', 'asc') | 64 | ->orderBy('month', 'asc') |
| 66 | ->groupBy('month')->get()->toArray(); | 65 | ->groupBy('month')->get()->toArray(); |
| 67 | - foreach ($list as $v){ | ||
| 68 | - $data[] = $v->month; | 66 | + $data = []; |
| 67 | + if (!empty($list)) { | ||
| 68 | + // 提取已有月份 | ||
| 69 | + foreach ($list as $v) { | ||
| 70 | + $data[] = $v->month; | ||
| 71 | + } | ||
| 72 | + // 生成连续月份 | ||
| 73 | + $startMonth = $data[0]; | ||
| 74 | + $endMonth = end($data); | ||
| 75 | + $fullMonths = []; | ||
| 76 | + $current = $startMonth; | ||
| 77 | + while ($current <= $endMonth) { | ||
| 78 | + $fullMonths[] = $current; | ||
| 79 | + $current = date('Y-m', strtotime($current . ' +1 month')); | ||
| 80 | + } | ||
| 81 | + $data = $fullMonths; | ||
| 82 | + } else { | ||
| 83 | + $data = []; | ||
| 69 | } | 84 | } |
| 70 | - $list = $this->fillMissingMonths($data); | 85 | + $list = $data; |
| 71 | foreach ($list as $v){ | 86 | foreach ($list as $v){ |
| 72 | $arr = []; | 87 | $arr = []; |
| 73 | $monthCountModel = new MonthCount(); | 88 | $monthCountModel = new MonthCount(); |
| @@ -179,38 +194,4 @@ class MonthProjectCount extends Command | @@ -179,38 +194,4 @@ class MonthProjectCount extends Command | ||
| 179 | $arr['referrer_port'] = json_encode($referrer_port); | 194 | $arr['referrer_port'] = json_encode($referrer_port); |
| 180 | return $arr; | 195 | return $arr; |
| 181 | } | 196 | } |
| 182 | - | ||
| 183 | - /** | ||
| 184 | - * @remark :补齐月份 | ||
| 185 | - * @name :fillMissingMonths | ||
| 186 | - * @author :lyh | ||
| 187 | - * @method :post | ||
| 188 | - * @time :2024/8/14 11:11 | ||
| 189 | - */ | ||
| 190 | - public function fillMissingMonths($dates) { | ||
| 191 | - // 将字符串日期转换为 Carbon 对象 | ||
| 192 | - $carbonDates = array_map(function($date) { | ||
| 193 | - return Carbon::createFromFormat('Y-m', $date); | ||
| 194 | - }, $dates); | ||
| 195 | - // 排序日期,确保列表按时间顺序排列 | ||
| 196 | - usort($carbonDates, function($a, $b) { | ||
| 197 | - return $a->gt($b); | ||
| 198 | - }); | ||
| 199 | - // 用于存储完整日期的数组 | ||
| 200 | - $completeDates = []; | ||
| 201 | - // 遍历日期列表,补齐中间缺失的月份 | ||
| 202 | - for ($i = 0; $i < count($carbonDates) - 1; $i++) { | ||
| 203 | - $current = $carbonDates[$i]; | ||
| 204 | - $next = $carbonDates[$i + 1]; | ||
| 205 | - // 将当前月份加入完整日期数组 | ||
| 206 | - array_push($completeDates, $current->format('Y-m')); | ||
| 207 | - // 循环补齐中间缺失的月份 | ||
| 208 | - while ($current->addMonth()->lt($next)) { | ||
| 209 | - array_push($completeDates, $current->format('Y-m')); | ||
| 210 | - } | ||
| 211 | - } | ||
| 212 | - // 加入最后一个月份 | ||
| 213 | - array_push($completeDates, $carbonDates[count($carbonDates) - 1]->format('Y-m')); | ||
| 214 | - return $completeDates; | ||
| 215 | - } | ||
| 216 | } | 197 | } |
| @@ -41,7 +41,7 @@ class GeoController extends BaseController | @@ -41,7 +41,7 @@ class GeoController extends BaseController | ||
| 41 | $projectModel = new Project(); | 41 | $projectModel = new Project(); |
| 42 | $projectInfo = $projectModel->read(['id' => $project_id],['title','version']); | 42 | $projectInfo = $projectModel->read(['id' => $project_id],['title','version']); |
| 43 | $geoWritingsModel = new GeoWritings(); | 43 | $geoWritingsModel = new GeoWritings(); |
| 44 | - $lists = $geoWritingsModel->list(['project_id' => $project_id, 'status' => 2 ,'is_del' => GeoWritings::IS_DEL_FALSE],'id',['title', 'status', 'uniqid', 'confirm_at']); | 44 | + $lists = $geoWritingsModel->list(['project_id' => $project_id, 'status' => ['in',[GeoWritings::STATUS_RUNNING,GeoWritings::STATUS_FINISH]] ,'is_del' => GeoWritings::IS_DEL_FALSE],'id',['title', 'status', 'uniqid', 'confirm_at']); |
| 45 | $result = [ | 45 | $result = [ |
| 46 | 'project' => $projectInfo, | 46 | 'project' => $projectInfo, |
| 47 | 'list' => $lists | 47 | 'list' => $lists |
| @@ -71,4 +71,26 @@ class GeoConfirmController extends BaseController | @@ -71,4 +71,26 @@ class GeoConfirmController extends BaseController | ||
| 71 | $data = $this->logic->saveConfirmContent($this->param); | 71 | $data = $this->logic->saveConfirmContent($this->param); |
| 72 | $this->response('success', Code::SUCCESS, $data); | 72 | $this->response('success', Code::SUCCESS, $data); |
| 73 | } | 73 | } |
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * @remark :保存确认信息 | ||
| 77 | + * @name :saveInfo | ||
| 78 | + * @author :lyh | ||
| 79 | + * @method :post | ||
| 80 | + * @time :2025/10/30 11:30 | ||
| 81 | + */ | ||
| 82 | + public function saveInfo() | ||
| 83 | + { | ||
| 84 | + $this->request->validate([ | ||
| 85 | + 'id' => 'required', | ||
| 86 | + 'confirm' => 'required', | ||
| 87 | + 'confirm_num' => 'required', | ||
| 88 | + ], [ | ||
| 89 | + 'id.required' => '主键id不能为空', | ||
| 90 | + 'confirm.required' => '客户确认内容不能为空', | ||
| 91 | + 'confirm_num.max' => '客户确认数量不能为空', | ||
| 92 | + ]); | ||
| 93 | + $data = $this->logic->saveConfirmInfo(); | ||
| 94 | + $this->response('success', Code::SUCCESS, $data); | ||
| 95 | + } | ||
| 74 | } | 96 | } |
| @@ -68,6 +68,24 @@ class GeoConfirmLogic extends BaseLogic | @@ -68,6 +68,24 @@ class GeoConfirmLogic extends BaseLogic | ||
| 68 | public function getConfirmInfo() | 68 | public function getConfirmInfo() |
| 69 | { | 69 | { |
| 70 | $data = $this->model->read($this->param); | 70 | $data = $this->model->read($this->param); |
| 71 | + if($data === false){ | ||
| 72 | + $this->fail('当前数据不存在或者已被删除'); | ||
| 73 | + } | ||
| 74 | + $data['confirm'] = $data['content']; | ||
| 71 | return $this->success($data); | 75 | return $this->success($data); |
| 72 | } | 76 | } |
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * @remark :保存确认信息 | ||
| 80 | + * @name :saveConfirmInfo | ||
| 81 | + * @author :lyh | ||
| 82 | + * @method :post | ||
| 83 | + * @time :2025/10/30 11:41 | ||
| 84 | + */ | ||
| 85 | + public function saveConfirmInfo() | ||
| 86 | + { | ||
| 87 | + $this->param['status'] = GeoConfirm::STATUS_FINISH; | ||
| 88 | + $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 89 | + return $this->success(['id'=>$this->param['id']]); | ||
| 90 | + } | ||
| 73 | } | 91 | } |
| @@ -479,6 +479,14 @@ class SyncSubmitTaskService | @@ -479,6 +479,14 @@ class SyncSubmitTaskService | ||
| 479 | ){ | 479 | ){ |
| 480 | throw new InquiryFilterException( '全局过滤'); | 480 | throw new InquiryFilterException( '全局过滤'); |
| 481 | } | 481 | } |
| 482 | + if( | ||
| 483 | + empty($data['data']['name']) && | ||
| 484 | + strlen($data['data']['message']??'') >= 8 && | ||
| 485 | + preg_match('/^[a-zA-Z]+$/', $data['data']['message']??'') && | ||
| 486 | + in_array($data['country']??'', ['荷兰', '俄罗斯']) | ||
| 487 | + ){ | ||
| 488 | + throw new InquiryFilterException( '全局过滤'); | ||
| 489 | + } | ||
| 482 | //全局过滤 ip 荷兰 有name、phone、email字段,但都是空 | 490 | //全局过滤 ip 荷兰 有name、phone、email字段,但都是空 |
| 483 | if( | 491 | if( |
| 484 | in_array($data['country']??'', ['荷兰', '俄罗斯']) && | 492 | in_array($data['country']??'', ['荷兰', '俄罗斯']) && |
| @@ -597,6 +597,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -597,6 +597,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 597 | Route::prefix('confirm')->group(function () { | 597 | Route::prefix('confirm')->group(function () { |
| 598 | Route::any('/saveConfirmContent', [Aside\Geo\GeoConfirmController::class, 'saveConfirmContent'])->name('admin.geo_confirm_saveConfirmContent'); | 598 | Route::any('/saveConfirmContent', [Aside\Geo\GeoConfirmController::class, 'saveConfirmContent'])->name('admin.geo_confirm_saveConfirmContent'); |
| 599 | Route::any('/getInfo', [Aside\Geo\GeoConfirmController::class, 'getInfo'])->name('admin.geo_confirm_getInfo'); | 599 | Route::any('/getInfo', [Aside\Geo\GeoConfirmController::class, 'getInfo'])->name('admin.geo_confirm_getInfo'); |
| 600 | + Route::any('/saveInfo', [Aside\Geo\GeoConfirmController::class, 'saveInfo'])->name('admin.geo_confirm_saveInfo'); | ||
| 600 | }); | 601 | }); |
| 601 | //geoai文章任务管理 | 602 | //geoai文章任务管理 |
| 602 | Route::prefix('writing_task')->group(function () { | 603 | Route::prefix('writing_task')->group(function () { |
-
请 注册 或 登录 后发表评论