Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
22 个修改的文件
包含
650 行增加
和
209 行删除
| @@ -100,9 +100,11 @@ class UpdateKeyword extends Command | @@ -100,9 +100,11 @@ class UpdateKeyword extends Command | ||
| 100 | }else{ | 100 | }else{ |
| 101 | $randomNumber = $text[$key] ?? rand(0, $number - 1); | 101 | $randomNumber = $text[$key] ?? rand(0, $number - 1); |
| 102 | } | 102 | } |
| 103 | + if(isset($text[$randomNumber])){ | ||
| 103 | $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>$item]); | 104 | $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>$item]); |
| 104 | } | 105 | } |
| 105 | } | 106 | } |
| 107 | + } | ||
| 106 | //按给定的数量更新 | 108 | //按给定的数量更新 |
| 107 | if(!empty($updateObject['number']) && ($updateObject['number'] != 0)){ | 109 | if(!empty($updateObject['number']) && ($updateObject['number'] != 0)){ |
| 108 | $keywordIdArr = $keywordModel->where("status",1)->inRandomOrder()->take($updateObject['number'])->pluck('id')->toArray(); | 110 | $keywordIdArr = $keywordModel->where("status",1)->inRandomOrder()->take($updateObject['number'])->pluck('id')->toArray(); |
| @@ -112,10 +114,12 @@ class UpdateKeyword extends Command | @@ -112,10 +114,12 @@ class UpdateKeyword extends Command | ||
| 112 | }else{ | 114 | }else{ |
| 113 | $randomNumber = $text[$key] ?? rand(0, $number - 1); | 115 | $randomNumber = $text[$key] ?? rand(0, $number - 1); |
| 114 | } | 116 | } |
| 117 | + if(isset($text[$randomNumber])){ | ||
| 115 | $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>$item]); | 118 | $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>$item]); |
| 116 | } | 119 | } |
| 117 | } | 120 | } |
| 118 | } | 121 | } |
| 122 | + } | ||
| 119 | return true; | 123 | return true; |
| 120 | } | 124 | } |
| 121 | 125 |
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | */ | 7 | */ |
| 8 | namespace App\Http\Controllers\Api; | 8 | namespace App\Http\Controllers\Api; |
| 9 | 9 | ||
| 10 | +use App\Enums\Common\Code; | ||
| 10 | use App\Models\Geo\GeoConfirm; | 11 | use App\Models\Geo\GeoConfirm; |
| 11 | use App\Models\Geo\GeoWritings; | 12 | use App\Models\Geo\GeoWritings; |
| 12 | use App\Models\Project\Project; | 13 | use App\Models\Project\Project; |
| @@ -35,13 +36,15 @@ class GeoController extends BaseController | @@ -35,13 +36,15 @@ class GeoController extends BaseController | ||
| 35 | } catch (\Exception $e) { | 36 | } catch (\Exception $e) { |
| 36 | return $this->error('非法请求'); | 37 | return $this->error('非法请求'); |
| 37 | } | 38 | } |
| 38 | - $project = Project::select('title', 'version')->where(['project_id' => $this->param['project_id']])->first(); | ||
| 39 | - $list = GeoWritings::select(['title', 'status', 'uniqid', 'confirm_at'])->where(['project_id' => $project_id, 'is_del' => GeoWritings::IS_DEL_FALSE])->get(); | 39 | + $projectModel = new Project(); |
| 40 | + $projectInfo = $projectModel->read(['project_id' => $project_id],['title','version']); | ||
| 41 | + $geoWritingsModel = new GeoWritings(); | ||
| 42 | + $lists = $geoWritingsModel->list(['project_id' => $project_id, 'is_del' => GeoWritings::IS_DEL_FALSE],'id',['title', 'status', 'uniqid', 'confirm_at']); | ||
| 40 | $result = [ | 43 | $result = [ |
| 41 | - 'project' => $project, | ||
| 42 | - 'list' => $list | 44 | + 'project' => $projectInfo, |
| 45 | + 'list' => $lists | ||
| 43 | ]; | 46 | ]; |
| 44 | - return $this->success($result); | 47 | + $this->response('success',Code::SUCCESS,$result); |
| 45 | } | 48 | } |
| 46 | 49 | ||
| 47 | /** | 50 | /** |
| @@ -49,11 +52,12 @@ class GeoController extends BaseController | @@ -49,11 +52,12 @@ class GeoController extends BaseController | ||
| 49 | * @param Request $request | 52 | * @param Request $request |
| 50 | * @return false|string | 53 | * @return false|string |
| 51 | */ | 54 | */ |
| 52 | - public function getWritingsDetail(Request $request) | 55 | + public function getWritingsDetail() |
| 53 | { | 56 | { |
| 54 | - $token = trim($request->input('token')); | ||
| 55 | - $detail = GeoWritings::select(['title', 'content', 'status'])->where(['uniqid' => $token])->first(); | ||
| 56 | - return $this->success($detail); | 57 | + $geoWritingsModel = new GeoWritings(); |
| 58 | + $token = trim($this->param['token']); | ||
| 59 | + $detail = $geoWritingsModel->read(['uniqid' => $token],['title', 'content', 'status']); | ||
| 60 | + $this->response('success',Code::SUCCESS,$detail); | ||
| 57 | } | 61 | } |
| 58 | 62 | ||
| 59 | 63 | ||
| @@ -95,9 +99,9 @@ class GeoController extends BaseController | @@ -95,9 +99,9 @@ class GeoController extends BaseController | ||
| 95 | * @param Request $request | 99 | * @param Request $request |
| 96 | * @return false|string | 100 | * @return false|string |
| 97 | */ | 101 | */ |
| 98 | - public function getConfirm(Request $request) | 102 | + public function getConfirm() |
| 99 | { | 103 | { |
| 100 | - $token = trim($request->input('token')); | 104 | + $token = trim($this->param['token']); |
| 101 | $data = GeoConfirm::where(['uniqid' => $token])->first(); | 105 | $data = GeoConfirm::where(['uniqid' => $token])->first(); |
| 102 | if (empty($data)){ | 106 | if (empty($data)){ |
| 103 | return $this->error('当前授权已失效'); | 107 | return $this->error('当前授权已失效'); |
| @@ -107,7 +111,7 @@ class GeoController extends BaseController | @@ -107,7 +111,7 @@ class GeoController extends BaseController | ||
| 107 | $type = $data->type; | 111 | $type = $data->type; |
| 108 | $status = $data->status; | 112 | $status = $data->status; |
| 109 | $result = compact('content', 'confirm', 'type', 'status'); | 113 | $result = compact('content', 'confirm', 'type', 'status'); |
| 110 | - return $this->success($result); | 114 | + $this->response('success',Code::SUCCESS,$result); |
| 111 | } | 115 | } |
| 112 | 116 | ||
| 113 | /** | 117 | /** |
| @@ -115,6 +119,20 @@ class GeoController extends BaseController | @@ -115,6 +119,20 @@ class GeoController extends BaseController | ||
| 115 | * 验证当前确认数据状态, 不可重复确认 | 119 | * 验证当前确认数据状态, 不可重复确认 |
| 116 | * @param Request $request | 120 | * @param Request $request |
| 117 | */ | 121 | */ |
| 118 | - public function saveConfirm(Request $request) | ||
| 119 | - {} | 122 | + public function saveConfirm() |
| 123 | + { | ||
| 124 | + $this->request->validate([ | ||
| 125 | + 'uniqid' => 'required', | ||
| 126 | + 'confirm' => 'required', | ||
| 127 | + 'confirm_num' => 'required', | ||
| 128 | + ], [ | ||
| 129 | + 'uniqid.required' => '非法请求', | ||
| 130 | + 'confirm.required' => '客户确认内容不能为空', | ||
| 131 | + 'confirm_num.max' => '客户确认数量不能为空', | ||
| 132 | + ]); | ||
| 133 | + $geoConfirmModel = new GeoConfirm(); | ||
| 134 | + $this->param['status'] = $geoConfirmModel::STATUS_FINISH; | ||
| 135 | + $result = $geoConfirmModel->edit($this->param,['uniqid'=>$this->param['uniqid']]); | ||
| 136 | + $this->response('success',Code::SUCCESS,$result); | ||
| 137 | + } | ||
| 120 | } | 138 | } |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :GeoConfirmController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/10/25 11:35 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Aside\Geo; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Aside\BaseController; | ||
| 14 | +use App\Http\Logic\Aside\Geo\GeoConfirmLogic; | ||
| 15 | +use Illuminate\Http\Request; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @remark :用户确认信息表 | ||
| 19 | + * @name :GeoConfirmController | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2025/10/25 11:37 | ||
| 23 | + */ | ||
| 24 | +class GeoConfirmController extends BaseController | ||
| 25 | +{ | ||
| 26 | + public function __construct(Request $request){ | ||
| 27 | + parent::__construct($request); | ||
| 28 | + $this->logic = new GeoConfirmLogic(); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 保存确认数据, 并推送微信群 | ||
| 33 | + * @param Request $request | ||
| 34 | + * @throws \App\Exceptions\AsideGlobalException | ||
| 35 | + */ | ||
| 36 | + public function saveConfirmContent() | ||
| 37 | + { | ||
| 38 | + $this->request->validate([ | ||
| 39 | + 'project_id' => 'required', | ||
| 40 | + 'type' => 'required|integer', | ||
| 41 | + 'content' => 'required', | ||
| 42 | + 'max_num' => 'required', | ||
| 43 | + ], [ | ||
| 44 | + 'project_id.required' => '项目ID不能为空', | ||
| 45 | + 'type.required' => '确定数据类型不能为空', | ||
| 46 | + 'type.integer' => '确定数据类型不正确', | ||
| 47 | + 'content.required' => '确定数据不能为空', | ||
| 48 | + 'max_num.required' => '最大确认数量不能为空', | ||
| 49 | + ]); | ||
| 50 | + $data = $this->logic->saveConfirmContent($this->param); | ||
| 51 | + $this->response('success', Code::SUCCESS, $data); | ||
| 52 | + } | ||
| 53 | +} |
| @@ -9,6 +9,7 @@ namespace App\Http\Controllers\Aside\Geo; | @@ -9,6 +9,7 @@ namespace App\Http\Controllers\Aside\Geo; | ||
| 9 | 9 | ||
| 10 | use App\Enums\Common\Code; | 10 | use App\Enums\Common\Code; |
| 11 | use App\Http\Controllers\Aside\BaseController; | 11 | use App\Http\Controllers\Aside\BaseController; |
| 12 | +use App\Http\Logic\Aside\Geo\GeoLogic; | ||
| 12 | use App\Models\Geo\GeoConf; | 13 | use App\Models\Geo\GeoConf; |
| 13 | use App\Models\Geo\GeoConfirm; | 14 | use App\Models\Geo\GeoConfirm; |
| 14 | use App\Models\Manage\ManageHr; | 15 | use App\Models\Manage\ManageHr; |
| @@ -23,6 +24,11 @@ use Illuminate\Http\Request; | @@ -23,6 +24,11 @@ use Illuminate\Http\Request; | ||
| 23 | */ | 24 | */ |
| 24 | class GeoController extends BaseController | 25 | class GeoController extends BaseController |
| 25 | { | 26 | { |
| 27 | + public function __construct(Request $request){ | ||
| 28 | + parent::__construct($request); | ||
| 29 | + $this->logic = new GeoLogic(); | ||
| 30 | + } | ||
| 31 | + | ||
| 26 | /** | 32 | /** |
| 27 | * 获取GEO相关配置 | 33 | * 获取GEO相关配置 |
| 28 | * @param Request $request | 34 | * @param Request $request |
| @@ -34,36 +40,8 @@ class GeoController extends BaseController | @@ -34,36 +40,8 @@ class GeoController extends BaseController | ||
| 34 | ], [ | 40 | ], [ |
| 35 | 'project_id.required' => '项目ID不能为空', | 41 | 'project_id.required' => '项目ID不能为空', |
| 36 | ]); | 42 | ]); |
| 37 | - $projectModel = new Project(); | ||
| 38 | - $project_geo_conf = $projectModel->read(['id' => $this->param['project_id']],['title', 'version', 'geo_status', 'geo_qualify_num']); | ||
| 39 | - $geoConfModel = new GeoConf(); | ||
| 40 | - $geo_conf = $geoConfModel->read(['project_id' => $this->param['project_id']]); | ||
| 41 | - if($geo_conf === false){//数据未初始化 | ||
| 42 | - $geo_conf = [ | ||
| 43 | - 'project_id' => $this->param['project_id'], | ||
| 44 | - 'manager_id'=>0, | ||
| 45 | - 'company'=>$project_geo_conf['title'], | ||
| 46 | - 'brand'=>'', | ||
| 47 | - 'description'=>'' | ||
| 48 | - ]; | ||
| 49 | - } | ||
| 50 | - //负责人集合 | ||
| 51 | - $geo_manage_list = $geoConfModel->geoManage(); | ||
| 52 | - // geo配置管理员,已经移除管理员列表,补充管理员信息 | ||
| 53 | - if ($geo_conf && $geo_conf['manager_id'] && empty($geo_manage_list[$geo_conf['manager_id']])) { | ||
| 54 | - $manage = ManageHr::where(['id' => $geo_conf['manager_id']])->pluck('name', 'id')->toArray(); | ||
| 55 | - $geo_manage_list = array_merge($geo_manage_list, $manage); | ||
| 56 | - } | ||
| 57 | - $result = [ | ||
| 58 | - 'project_geo_conf' => $project_geo_conf, | ||
| 59 | - 'geo_conf' => $geo_conf, | ||
| 60 | - 'geo_manage_list' => $geo_manage_list, | ||
| 61 | - 'geo_keyword' => [ | ||
| 62 | - 'prefix' => KeywordPrefix::getKeyword($this->param['project_id'], KeywordPrefix::TYPE_GEO_PREFIX), | ||
| 63 | - 'suffix' => KeywordPrefix::getKeyword($this->param['project_id'], KeywordPrefix::TYPE_GEO_SUFFIX), | ||
| 64 | - ], | ||
| 65 | - ]; | ||
| 66 | - $this->response('success', Code::SUCCESS, $result); | 43 | + $data = $this->logic->getCongInfo($this->param['project_id']); |
| 44 | + $this->response('success', Code::SUCCESS, $data); | ||
| 67 | } | 45 | } |
| 68 | 46 | ||
| 69 | /** | 47 | /** |
| @@ -87,47 +65,11 @@ class GeoController extends BaseController | @@ -87,47 +65,11 @@ class GeoController extends BaseController | ||
| 87 | 'brand.max' => '品牌名不能超过200个字符', | 65 | 'brand.max' => '品牌名不能超过200个字符', |
| 88 | 'description.max' => '描述不能超过500个字符', | 66 | 'description.max' => '描述不能超过500个字符', |
| 89 | ]); | 67 | ]); |
| 90 | - try { | ||
| 91 | - $data = GeoConf::saveConf($this->param['project_id'], $this->param['manager_id'], $this->param['company'], $this->param['brand'], $this->param['description'], $this->param['prefix'], $this->param['suffix']); | ||
| 92 | - # FIXME 保存GEO状态 达标数量 | 68 | + $data = $this->logic->saveConfig($this->param); |
| 93 | $this->response('success', Code::SUCCESS, $data); | 69 | $this->response('success', Code::SUCCESS, $data); |
| 94 | - } catch (\Exception $e) { | ||
| 95 | - $this->fail('配置保存失败, error:' . $e->getMessage()); | ||
| 96 | - } | ||
| 97 | } | 70 | } |
| 98 | 71 | ||
| 99 | 72 | ||
| 100 | - /** | ||
| 101 | - * 保存确认数据, 并推送微信群 | ||
| 102 | - * @param Request $request | ||
| 103 | - * @throws \App\Exceptions\AsideGlobalException | ||
| 104 | - */ | ||
| 105 | - public function saveConfirmContent() | ||
| 106 | - { | ||
| 107 | - $this->request->validate([ | ||
| 108 | - 'project_id' => 'required', | ||
| 109 | - 'type' => 'required|integer', | ||
| 110 | - 'content' => 'required', | ||
| 111 | - 'max_num' => 'required', | ||
| 112 | - ], [ | ||
| 113 | - 'project_id.required' => '项目ID不能为空', | ||
| 114 | - 'type.required' => '确定数据类型不能为空', | ||
| 115 | - 'type.integer' => '确定数据类型不正确', | ||
| 116 | - 'content.required' => '确定数据不能为空', | ||
| 117 | - 'max_num.required' => '最大确认数量不能为空', | ||
| 118 | - ]); | ||
| 119 | - try { | ||
| 120 | - $data = GeoConfirm::saveContent($this->param['project_id'], $this->param['type'], $this->param['content'], $this->param['max_num']); | ||
| 121 | - $friend = ProjectAssociation::where(['project_id' => $this->param['project_id']])->first(); | ||
| 122 | - if (empty($friend)){ | ||
| 123 | - $this->fail('项目未绑定微信群, 推送消息失败!'); | ||
| 124 | - } | ||
| 125 | - $data = GeoConfirm::sendConfirmMessage($data->id, $friend->friend_id); | ||
| 126 | - $this->response('success', Code::SUCCESS, $data); | ||
| 127 | - } catch (\Exception $e) { | ||
| 128 | - $this->fail('操作失败, error:' . $e->getMessage()); | ||
| 129 | - } | ||
| 130 | - } | ||
| 131 | 73 | ||
| 132 | /** | 74 | /** |
| 133 | * OA后台管理员,保存确认数据 | 75 | * OA后台管理员,保存确认数据 |
| @@ -11,7 +11,7 @@ namespace App\Http\Controllers\Aside\Geo; | @@ -11,7 +11,7 @@ namespace App\Http\Controllers\Aside\Geo; | ||
| 11 | 11 | ||
| 12 | use App\Enums\Common\Code; | 12 | use App\Enums\Common\Code; |
| 13 | use App\Http\Controllers\Aside\BaseController; | 13 | use App\Http\Controllers\Aside\BaseController; |
| 14 | -use App\Http\Logic\Aside\Geo\GeoLogic; | 14 | +use App\Http\Logic\Aside\Geo\GeoQuestionLogic; |
| 15 | use Illuminate\Http\Request; | 15 | use Illuminate\Http\Request; |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| @@ -26,7 +26,7 @@ class GeoQuestionController extends BaseController | @@ -26,7 +26,7 @@ class GeoQuestionController extends BaseController | ||
| 26 | public function __construct(Request $request) | 26 | public function __construct(Request $request) |
| 27 | { | 27 | { |
| 28 | parent::__construct($request); | 28 | parent::__construct($request); |
| 29 | - $this->logic = new GeoLogic(); | 29 | + $this->logic = new GeoQuestionLogic(); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| @@ -9,7 +9,11 @@ | @@ -9,7 +9,11 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Http\Controllers\Aside\Geo; | 10 | namespace App\Http\Controllers\Aside\Geo; |
| 11 | 11 | ||
| 12 | +use App\Enums\Common\Code; | ||
| 12 | use App\Http\Controllers\Aside\BaseController; | 13 | use App\Http\Controllers\Aside\BaseController; |
| 14 | +use App\Http\Logic\Aside\Geo\GeoWritingsTaskLogic; | ||
| 15 | +use App\Http\Requests\Aside\Geo\GeoWritingsTaskRequest; | ||
| 16 | +use Illuminate\Http\Request; | ||
| 13 | 17 | ||
| 14 | /** | 18 | /** |
| 15 | * @remark :文章任务(收集数据) | 19 | * @remark :文章任务(收集数据) |
| @@ -20,14 +24,53 @@ use App\Http\Controllers\Aside\BaseController; | @@ -20,14 +24,53 @@ use App\Http\Controllers\Aside\BaseController; | ||
| 20 | */ | 24 | */ |
| 21 | class GeoWritingTaskController extends BaseController | 25 | class GeoWritingTaskController extends BaseController |
| 22 | { | 26 | { |
| 27 | + public function __construct(Request $request) | ||
| 28 | + { | ||
| 29 | + parent::__construct($request); | ||
| 30 | + $this->logic = new GeoWritingsTaskLogic(); | ||
| 31 | + } | ||
| 32 | + | ||
| 23 | /** | 33 | /** |
| 24 | - * @remark :文章任务列表 | 34 | + * @remark :ai文章列表页 |
| 25 | * @name :lists | 35 | * @name :lists |
| 26 | * @author :lyh | 36 | * @author :lyh |
| 27 | * @method :post | 37 | * @method :post |
| 28 | - * @time :2025/10/25 10:41 | 38 | + * @time :2025/10/25 15:12 |
| 29 | */ | 39 | */ |
| 30 | public function lists(){ | 40 | public function lists(){ |
| 41 | + $data = $this->logic->listWritingTask($this->map,$this->page,$this->row,$this->order); | ||
| 42 | + $this->response('success',Code::SUCCESS,$data); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @remark :保存geoAi文章生成数据 | ||
| 47 | + * @name :lists | ||
| 48 | + * @author :lyh | ||
| 49 | + * @method :post | ||
| 50 | + * @time :2025/10/25 10:41 | ||
| 51 | + */ | ||
| 52 | + public function saveWritingTask(){ | ||
| 53 | + $request = new GeoWritingsTaskRequest(); | ||
| 54 | + $request->validated(); | ||
| 55 | + $data = $this->logic->saveWritingTask(); | ||
| 56 | + $this->response('success',Code::SUCCESS,$data); | ||
| 57 | + } | ||
| 31 | 58 | ||
| 59 | + /** | ||
| 60 | + * @remark :批量删除文章任务 | ||
| 61 | + * @name :delWritingTask | ||
| 62 | + * @author :lyh | ||
| 63 | + * @method :post | ||
| 64 | + * @time :2025/10/25 15:03 | ||
| 65 | + */ | ||
| 66 | + public function delWritingTask(){ | ||
| 67 | + $this->request->validate([ | ||
| 68 | + 'id'=>'required|array', | ||
| 69 | + ],[ | ||
| 70 | + 'id.required' => 'ID不能为空', | ||
| 71 | + 'id.array' => 'ID为数组', | ||
| 72 | + ]); | ||
| 73 | + $data = $this->logic->delWritingTask(); | ||
| 74 | + $this->response('success',Code::SUCCESS,$data); | ||
| 32 | } | 75 | } |
| 33 | } | 76 | } |
| @@ -9,7 +9,11 @@ | @@ -9,7 +9,11 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Http\Controllers\Aside\Geo; | 10 | namespace App\Http\Controllers\Aside\Geo; |
| 11 | 11 | ||
| 12 | +use App\Enums\Common\Code; | ||
| 12 | use App\Http\Controllers\Aside\BaseController; | 13 | use App\Http\Controllers\Aside\BaseController; |
| 14 | +use App\Http\Logic\Aside\Geo\GeoWritingsLogic; | ||
| 15 | +use App\Http\Requests\Aside\Geo\GeoWritingsRequest; | ||
| 16 | +use Illuminate\Http\Request; | ||
| 13 | 17 | ||
| 14 | /** | 18 | /** |
| 15 | * @remark :geo文章 | 19 | * @remark :geo文章 |
| @@ -20,5 +24,54 @@ use App\Http\Controllers\Aside\BaseController; | @@ -20,5 +24,54 @@ use App\Http\Controllers\Aside\BaseController; | ||
| 20 | */ | 24 | */ |
| 21 | class GeoWritingsController extends BaseController | 25 | class GeoWritingsController extends BaseController |
| 22 | { | 26 | { |
| 27 | + public function __construct(Request $request) | ||
| 28 | + { | ||
| 29 | + parent::__construct($request); | ||
| 30 | + $this->logic = new GeoWritingsLogic(); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * @remark :文章列表数据 | ||
| 35 | + * @name :lists | ||
| 36 | + * @author :lyh | ||
| 37 | + * @method :post | ||
| 38 | + * @time :2025/10/25 15:53 | ||
| 39 | + */ | ||
| 40 | + public function lists(){ | ||
| 41 | + $data = $this->logic->listWriting($this->map,$this->page,$this->row,$this->order); | ||
| 42 | + $this->response('success',Code::SUCCESS,$data); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @remark :保存geoAi文章生成数据 | ||
| 47 | + * @name :lists | ||
| 48 | + * @author :lyh | ||
| 49 | + * @method :post | ||
| 50 | + * @time :2025/10/25 10:41 | ||
| 51 | + */ | ||
| 52 | + public function saveWriting(){ | ||
| 53 | + $request = new GeoWritingsRequest(); | ||
| 54 | + $request->validated(); | ||
| 55 | + $data = $this->logic->saveWriting(); | ||
| 56 | + $this->response('success',Code::SUCCESS,$data); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * @remark :批量删除文章任务 | ||
| 61 | + * @name :delWritingTask | ||
| 62 | + * @author :lyh | ||
| 63 | + * @method :post | ||
| 64 | + * @time :2025/10/25 15:03 | ||
| 65 | + */ | ||
| 66 | + public function delWriting(){ | ||
| 67 | + $this->request->validate([ | ||
| 68 | + 'id'=>'required|array', | ||
| 69 | + ],[ | ||
| 70 | + 'id.required' => 'ID不能为空', | ||
| 71 | + 'id.array' => 'ID为数组', | ||
| 72 | + ]); | ||
| 73 | + $data = $this->logic->delWriting(); | ||
| 74 | + $this->response('success',Code::SUCCESS,$data); | ||
| 75 | + } | ||
| 23 | 76 | ||
| 24 | } | 77 | } |
| @@ -160,7 +160,7 @@ class OptimizeController extends BaseController | @@ -160,7 +160,7 @@ class OptimizeController extends BaseController | ||
| 160 | $manageModel = new ManageHr(); | 160 | $manageModel = new ManageHr(); |
| 161 | $plan = Project::planMap(); | 161 | $plan = Project::planMap(); |
| 162 | $seo_plan = Project::seoMap(); | 162 | $seo_plan = Project::seoMap(); |
| 163 | - $item['plan'] = $plan[$item['plan']] ?? $seo_plan[1]; | 163 | + $item['plan'] = $plan[$item['plan']] ?? ($seo_plan[$item['seo_plan']] ?? ''); |
| 164 | $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0); | 164 | $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0); |
| 165 | $item['build_leader'] = $manageModel->getName($item['leader_mid']); | 165 | $item['build_leader'] = $manageModel->getName($item['leader_mid']); |
| 166 | $item['build_manager'] = $manageModel->getName($item['manager_mid']); | 166 | $item['build_manager'] = $manageModel->getName($item['manager_mid']); |
app/Http/Logic/Aside/Geo/GeoConfirmLogic.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :GeoConfirmLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/10/25 11:36 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Aside\Geo; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 14 | +use App\Models\Geo\GeoConfirm; | ||
| 15 | +use App\Models\ProjectAssociation\ProjectAssociation; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @remark :用户确认信息 | ||
| 19 | + * @name :GeoConfirmLogic | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2025/10/25 11:37 | ||
| 23 | + */ | ||
| 24 | +class GeoConfirmLogic extends BaseLogic | ||
| 25 | +{ | ||
| 26 | + public function __construct() | ||
| 27 | + { | ||
| 28 | + parent::__construct(); | ||
| 29 | + $this->param = $this->requestAll; | ||
| 30 | + $this->model = new GeoConfirm(); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * @remark :保存数据->并推送微信群客户确认 | ||
| 35 | + * @name :saveConfirmContent | ||
| 36 | + * @author :lyh | ||
| 37 | + * @method :post | ||
| 38 | + * @time :2025/10/25 11:41 | ||
| 39 | + */ | ||
| 40 | + public function saveConfirmContent($param) | ||
| 41 | + { | ||
| 42 | + try { | ||
| 43 | + $info = $this->model->read(['project_id' => $param['project_id']]); | ||
| 44 | + if($info === false){ | ||
| 45 | + $id = $this->model->addReturnId($param); | ||
| 46 | + }else{ | ||
| 47 | + $id = $param['id']; | ||
| 48 | + $this->model->edit($param,['id'=>$info['id']]); | ||
| 49 | + } | ||
| 50 | + $friend = ProjectAssociation::where(['project_id' => $param['project_id']])->first(); | ||
| 51 | + if (empty($friend)){ | ||
| 52 | + $this->fail('项目未绑定微信群, 推送消息失败!'); | ||
| 53 | + } | ||
| 54 | + GeoConfirm::sendConfirmMessage($id, $friend->friend_id); | ||
| 55 | + } catch (\Exception $e) { | ||
| 56 | + $this->fail('操作失败, error:' . $e->getMessage()); | ||
| 57 | + } | ||
| 58 | + return $this->success(['id'=>$id]); | ||
| 59 | + } | ||
| 60 | +} |
| @@ -4,109 +4,99 @@ | @@ -4,109 +4,99 @@ | ||
| 4 | * @name :GeoLogic.php | 4 | * @name :GeoLogic.php |
| 5 | * @author :lyh | 5 | * @author :lyh |
| 6 | * @method :post | 6 | * @method :post |
| 7 | - * @time :2025/7/2 17:51 | 7 | + * @time :2025/10/25 11:08 |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | namespace App\Http\Logic\Aside\Geo; | 10 | namespace App\Http\Logic\Aside\Geo; |
| 11 | 11 | ||
| 12 | +use App\Enums\Common\Code; | ||
| 12 | use App\Http\Logic\Aside\BaseLogic; | 13 | use App\Http\Logic\Aside\BaseLogic; |
| 13 | -use App\Models\Geo\GeoPlatform; | 14 | +use App\Models\Geo\GeoConf; |
| 14 | use App\Models\Geo\GeoQuestion; | 15 | use App\Models\Geo\GeoQuestion; |
| 16 | +use App\Models\Manage\ManageHr; | ||
| 17 | +use App\Models\Project\KeywordPrefix; | ||
| 15 | use App\Models\Project\Project; | 18 | use App\Models\Project\Project; |
| 16 | 19 | ||
| 20 | +/** | ||
| 21 | + * @remark :geo设置 | ||
| 22 | + * @name :GeoLogic | ||
| 23 | + * @author :lyh | ||
| 24 | + * @method :post | ||
| 25 | + * @time :2025/10/25 11:08 | ||
| 26 | + */ | ||
| 17 | class GeoLogic extends BaseLogic | 27 | class GeoLogic extends BaseLogic |
| 18 | { | 28 | { |
| 19 | public function __construct() | 29 | public function __construct() |
| 20 | { | 30 | { |
| 21 | parent::__construct(); | 31 | parent::__construct(); |
| 22 | $this->param = $this->requestAll; | 32 | $this->param = $this->requestAll; |
| 23 | - $this->model = new GeoQuestion(); | 33 | + $this->model = new GeoConf(); |
| 24 | } | 34 | } |
| 25 | 35 | ||
| 26 | /** | 36 | /** |
| 27 | - * @remark :设置geo状态 | ||
| 28 | - * @name :setGeoStatus | 37 | + * @remark :获取geo设置数据详情 |
| 38 | + * @name :getCongInfo | ||
| 29 | * @author :lyh | 39 | * @author :lyh |
| 30 | * @method :post | 40 | * @method :post |
| 31 | - * @time :2025/7/2 17:51 | 41 | + * @time :2025/10/25 11:10 |
| 32 | */ | 42 | */ |
| 33 | - public function setGeoStatus(){ | 43 | + public function getCongInfo($project_id) |
| 44 | + { | ||
| 34 | $projectModel = new Project(); | 45 | $projectModel = new Project(); |
| 35 | - $data = $projectModel->edit(['geo_status'=>$this->param['geo_status'],'geo_frequency'=>$this->param['geo_frequency']],['id'=>$this->param['project_id']]); | ||
| 36 | - $questionModel = new GeoQuestion(); | ||
| 37 | - $questionModel->edit(['status'=>$this->param['geo_status']],['project_id'=>$this->param['project_id']]); | ||
| 38 | - return $this->success($data); | 46 | + $project_geo_conf = $projectModel->read(['id' => $project_id],['title', 'version', 'geo_status', 'geo_qualify_num']); |
| 47 | + $geoConfModel = new GeoConf(); | ||
| 48 | + $geo_conf = $geoConfModel->read(['project_id' => $project_id]); | ||
| 49 | + if($geo_conf === false){//数据未初始化 | ||
| 50 | + $geo_conf = [ | ||
| 51 | + 'project_id' => $project_id, 'manager_id'=>0, 'company'=>$project_geo_conf['title'], 'brand'=>'', 'description'=>'' | ||
| 52 | + ]; | ||
| 39 | } | 53 | } |
| 40 | - | ||
| 41 | - /** | ||
| 42 | - * @remark :获取类型 | ||
| 43 | - * @name :getType | ||
| 44 | - * @author :lyh | ||
| 45 | - * @method :post | ||
| 46 | - * @time :2025/7/3 10:47 | ||
| 47 | - */ | ||
| 48 | - public function getType(){ | ||
| 49 | - $data['type'] = $this->model->brandType(); | ||
| 50 | - $data['frequency'] = $this->model->frequency; | ||
| 51 | - $geoPlatformModel = new GeoPlatform(); | ||
| 52 | - $data['platform'] = $geoPlatformModel->getList(); | ||
| 53 | - return $this->success($data); | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - /** | ||
| 57 | - * @remark :获取问题列表 | ||
| 58 | - * @name :getGeoQuestionList | ||
| 59 | - * @author :lyh | ||
| 60 | - * @method :post | ||
| 61 | - * @time :2025/7/3 9:12 | ||
| 62 | - */ | ||
| 63 | - public function getGeoQuestionList($map,$page,$row,$order,$field = ['*']){ | ||
| 64 | - $data = $this->model->lists($map,$page,$row,$order,$field); | ||
| 65 | - if(!empty($data) && !empty($data['list'])){ | ||
| 66 | - foreach ($data['list'] as $key => $item){ | ||
| 67 | - $item['type_name'] = $this->model->brandType()[$item['type']]; | ||
| 68 | - $data['list'][$key] = $item; | 54 | + //负责人集合 |
| 55 | + $geo_manage_list = $geoConfModel->geoManage(); | ||
| 56 | + // geo配置管理员,已经移除管理员列表,补充管理员信息 | ||
| 57 | + if ($geo_conf && $geo_conf['manager_id'] && empty($geo_manage_list[$geo_conf['manager_id']])) { | ||
| 58 | + $manage = ManageHr::where(['id' => $geo_conf['manager_id']])->pluck('name', 'id')->toArray(); | ||
| 59 | + $geo_manage_list = array_merge($geo_manage_list, $manage); | ||
| 69 | } | 60 | } |
| 70 | - } | ||
| 71 | - return $this->success($data); | 61 | + $result = [ |
| 62 | + 'project_geo_conf' => $project_geo_conf, | ||
| 63 | + 'geo_conf' => $geo_conf, | ||
| 64 | + 'geo_manage_list' => $geo_manage_list, | ||
| 65 | + 'geo_keyword' => [ | ||
| 66 | + 'prefix' => KeywordPrefix::getKeyword($project_id, KeywordPrefix::TYPE_GEO_PREFIX), | ||
| 67 | + 'suffix' => KeywordPrefix::getKeyword($project_id, KeywordPrefix::TYPE_GEO_SUFFIX), | ||
| 68 | + ], | ||
| 69 | + ]; | ||
| 70 | + return $this->success($result); | ||
| 72 | } | 71 | } |
| 73 | 72 | ||
| 74 | /** | 73 | /** |
| 75 | - * @remark :保存数据 | ||
| 76 | - * @name :saveGeoQuestion | 74 | + * @remark :保存数据详情 |
| 75 | + * @name :saveCongInfo | ||
| 77 | * @author :lyh | 76 | * @author :lyh |
| 78 | * @method :post | 77 | * @method :post |
| 79 | - * @time :2025/7/3 9:47 | ||
| 80 | - * @param : question->提交的问题 | ||
| 81 | - * @param : url->提交的网址 | ||
| 82 | - * @param : keywords->提交的关键字 | ||
| 83 | - * @param : project_id->项目id | 78 | + * @time :2025/10/25 11:14 |
| 79 | + * @param->gl_geo_conf : project_id->项目id;manager_id->管理员id;company->公司名称;brand->品牌名;description->描述(必传) | ||
| 80 | + * @param :prefix->前缀;suffix->后缀(非必传) | ||
| 81 | + * @param->gl_project : geo_status->开启/关闭状态 geo_qualify_num->达标数量 | ||
| 84 | */ | 82 | */ |
| 85 | - public function saveGeoQuestion(){ | ||
| 86 | - //处理数据 | ||
| 87 | - $this->param['question'] = json_encode($this->param['question'] ?? [],true); | ||
| 88 | - $this->param['url'] = json_encode($this->param['url'] ?? [],true); | ||
| 89 | - $this->param['keywords'] = json_encode($this->param['keywords'] ?? [],true); | ||
| 90 | - //执行时间设置为今天 | ||
| 91 | - if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 92 | - $id = $this->param['id']; | ||
| 93 | - $this->model->edit($this->param,['id'=>$id]); | 83 | + public function saveConfig($param) |
| 84 | + { | ||
| 85 | + $projectModel = new Project(); | ||
| 86 | + $projectModel->edit(['geo_status'=>$param['geo_status'],'geo_qualify_num'=>$param['geo_qualify_num']],['id'=>$param['project_id']]); | ||
| 87 | + try { | ||
| 88 | + unset($param['geo_status'],$param['geo_qualify_num']);//无需保存 | ||
| 89 | + $info = $this->model->read(['project_id' => $param['project_id']]); | ||
| 90 | + if($info === false){ | ||
| 91 | + $id = $this->model->addReturnId($param); | ||
| 94 | }else{ | 92 | }else{ |
| 95 | - $this->param['next_time'] = date('Y-m-d'); | ||
| 96 | - $id = $this->model->addReturnId($this->param); | 93 | + $id = $param['id']; |
| 94 | + $this->model->edit($param,['id'=>$info['id']]); | ||
| 95 | + } | ||
| 96 | + } catch (\Exception $e) { | ||
| 97 | + $this->fail('配置保存失败, error:' . $e->getMessage()); | ||
| 97 | } | 98 | } |
| 98 | return $this->success(['id'=>$id]); | 99 | return $this->success(['id'=>$id]); |
| 99 | } | 100 | } |
| 100 | 101 | ||
| 101 | - /** | ||
| 102 | - * @remark :删除数据 | ||
| 103 | - * @name :delGeoQuestion | ||
| 104 | - * @author :lyh | ||
| 105 | - * @method :post | ||
| 106 | - * @time :2025/7/3 10:13 | ||
| 107 | - */ | ||
| 108 | - public function delGeoQuestion(){ | ||
| 109 | - $data = $this->model->del(['id'=>['in',$this->param['ids']]]); | ||
| 110 | - return $this->success($data); | ||
| 111 | - } | ||
| 112 | } | 102 | } |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :GeoQuestionLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/7/2 17:51 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Aside\Geo; | ||
| 11 | + | ||
| 12 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 13 | +use App\Models\Geo\GeoPlatform; | ||
| 14 | +use App\Models\Geo\GeoQuestion; | ||
| 15 | +use App\Models\Project\Project; | ||
| 16 | + | ||
| 17 | +class GeoQuestionLogic extends BaseLogic | ||
| 18 | +{ | ||
| 19 | + public function __construct() | ||
| 20 | + { | ||
| 21 | + parent::__construct(); | ||
| 22 | + $this->param = $this->requestAll; | ||
| 23 | + $this->model = new GeoQuestion(); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * @remark :设置geo状态 | ||
| 28 | + * @name :setGeoStatus | ||
| 29 | + * @author :lyh | ||
| 30 | + * @method :post | ||
| 31 | + * @time :2025/7/2 17:51 | ||
| 32 | + */ | ||
| 33 | + public function setGeoStatus(){ | ||
| 34 | + $projectModel = new Project(); | ||
| 35 | + $data = $projectModel->edit(['geo_status'=>$this->param['geo_status'],'geo_frequency'=>$this->param['geo_frequency']],['id'=>$this->param['project_id']]); | ||
| 36 | + $questionModel = new GeoQuestion(); | ||
| 37 | + $questionModel->edit(['status'=>$this->param['geo_status']],['project_id'=>$this->param['project_id']]); | ||
| 38 | + return $this->success($data); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * @remark :获取类型 | ||
| 43 | + * @name :getType | ||
| 44 | + * @author :lyh | ||
| 45 | + * @method :post | ||
| 46 | + * @time :2025/7/3 10:47 | ||
| 47 | + */ | ||
| 48 | + public function getType(){ | ||
| 49 | + $data['type'] = $this->model->brandType(); | ||
| 50 | + $data['frequency'] = $this->model->frequency; | ||
| 51 | + $geoPlatformModel = new GeoPlatform(); | ||
| 52 | + $data['platform'] = $geoPlatformModel->getList(); | ||
| 53 | + return $this->success($data); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * @remark :获取问题列表 | ||
| 58 | + * @name :getGeoQuestionList | ||
| 59 | + * @author :lyh | ||
| 60 | + * @method :post | ||
| 61 | + * @time :2025/7/3 9:12 | ||
| 62 | + */ | ||
| 63 | + public function getGeoQuestionList($map,$page,$row,$order,$field = ['*']){ | ||
| 64 | + $data = $this->model->lists($map,$page,$row,$order,$field); | ||
| 65 | + if(!empty($data) && !empty($data['list'])){ | ||
| 66 | + foreach ($data['list'] as $key => $item){ | ||
| 67 | + $item['type_name'] = $this->model->brandType()[$item['type']]; | ||
| 68 | + $data['list'][$key] = $item; | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + return $this->success($data); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * @remark :保存数据 | ||
| 76 | + * @name :saveGeoQuestion | ||
| 77 | + * @author :lyh | ||
| 78 | + * @method :post | ||
| 79 | + * @time :2025/7/3 9:47 | ||
| 80 | + * @param : question->提交的问题 | ||
| 81 | + * @param : url->提交的网址 | ||
| 82 | + * @param : keywords->提交的关键字 | ||
| 83 | + * @param : project_id->项目id | ||
| 84 | + */ | ||
| 85 | + public function saveGeoQuestion(){ | ||
| 86 | + //处理数据 | ||
| 87 | + $this->param['question'] = json_encode($this->param['question'] ?? [],true); | ||
| 88 | + $this->param['url'] = json_encode($this->param['url'] ?? [],true); | ||
| 89 | + $this->param['keywords'] = json_encode($this->param['keywords'] ?? [],true); | ||
| 90 | + //执行时间设置为今天 | ||
| 91 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 92 | + $id = $this->param['id']; | ||
| 93 | + $this->model->edit($this->param,['id'=>$id]); | ||
| 94 | + }else{ | ||
| 95 | + $this->param['next_time'] = date('Y-m-d'); | ||
| 96 | + $id = $this->model->addReturnId($this->param); | ||
| 97 | + } | ||
| 98 | + return $this->success(['id'=>$id]); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * @remark :删除数据 | ||
| 103 | + * @name :delGeoQuestion | ||
| 104 | + * @author :lyh | ||
| 105 | + * @method :post | ||
| 106 | + * @time :2025/7/3 10:13 | ||
| 107 | + */ | ||
| 108 | + public function delGeoQuestion(){ | ||
| 109 | + $data = $this->model->del(['id'=>['in',$this->param['ids']]]); | ||
| 110 | + return $this->success($data); | ||
| 111 | + } | ||
| 112 | +} |
| @@ -27,4 +27,57 @@ class GeoWritingsLogic extends BaseLogic | @@ -27,4 +27,57 @@ class GeoWritingsLogic extends BaseLogic | ||
| 27 | $this->param = $this->requestAll; | 27 | $this->param = $this->requestAll; |
| 28 | $this->model = new GeoWritings(); | 28 | $this->model = new GeoWritings(); |
| 29 | } | 29 | } |
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * @remark :列表数据 | ||
| 33 | + * @name :listWriting | ||
| 34 | + * @author :lyh | ||
| 35 | + * @method :post | ||
| 36 | + * @time :2025/10/25 15:57 | ||
| 37 | + */ | ||
| 38 | + public function listWriting($map,$page,$row,$order){ | ||
| 39 | + $data = $this->model->lists($map,$page,$row,$order); | ||
| 40 | + return $this->success($data); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * @remark :手动上传数据 | ||
| 45 | + * @name :saveWriting | ||
| 46 | + * @author :lyh | ||
| 47 | + * @method :post | ||
| 48 | + * @time :2025/10/25 16:07 | ||
| 49 | + */ | ||
| 50 | + public function saveWriting(){ | ||
| 51 | + try { | ||
| 52 | + $this->param['content_length'] = strlen($this->param['content']); | ||
| 53 | + $this->param['confirm_ip'] = $this->request->ip(); | ||
| 54 | + $this->param['confirm_at'] = date('Y-m-d H:i:s'); | ||
| 55 | + if(isset($this->param['id']) &&!empty($this->param['id'])){ | ||
| 56 | + $id = $this->param['id']; | ||
| 57 | + $this->model->edit($this->param,['id'=>$id]); | ||
| 58 | + }else{ | ||
| 59 | + $this->param['uniqid'] = uniqid().$this->param['project_id']; | ||
| 60 | + $id = $this->model->addReturnId($this->param); | ||
| 61 | + } | ||
| 62 | + }catch (\Exception $e){ | ||
| 63 | + $this->fail('保存数据失败,请联系管理员'.$e->getMessage()); | ||
| 64 | + } | ||
| 65 | + return $this->success(['id'=>$id]); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * @remark :删除数据 | ||
| 70 | + * @name :delWritingTask | ||
| 71 | + * @author :lyh | ||
| 72 | + * @method :post | ||
| 73 | + * @time :2025/10/25 15:05 | ||
| 74 | + */ | ||
| 75 | + public function delWriting() | ||
| 76 | + { | ||
| 77 | + $res = $this->model->del(['id'=>['in',$this->param['id']]]); | ||
| 78 | + if($res === false){ | ||
| 79 | + $this->fail('删除失败,请联系管理员'); | ||
| 80 | + } | ||
| 81 | + return $this->success(); | ||
| 82 | + } | ||
| 30 | } | 83 | } |
| @@ -21,4 +21,55 @@ class GeoWritingsTaskLogic extends BaseLogic | @@ -21,4 +21,55 @@ class GeoWritingsTaskLogic extends BaseLogic | ||
| 21 | $this->param = $this->requestAll; | 21 | $this->param = $this->requestAll; |
| 22 | $this->model = new GeoWritingsTask(); | 22 | $this->model = new GeoWritingsTask(); |
| 23 | } | 23 | } |
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * @remark : | ||
| 27 | + * @name :listWritingTask | ||
| 28 | + * @author :lyh | ||
| 29 | + * @method :post | ||
| 30 | + * @time :2025/10/25 15:13 | ||
| 31 | + */ | ||
| 32 | + public function listWritingTask($map,$page,$row,$order){ | ||
| 33 | + $data = $this->model->lists($map,$page,$row,$order); | ||
| 34 | + return $this->success($data); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * @remark :保存AI文章数据 | ||
| 39 | + * @name :saveWritingTask | ||
| 40 | + * @author :lyh | ||
| 41 | + * @method :post | ||
| 42 | + * @time :2025/10/25 14:41 | ||
| 43 | + * @param :project_id->项目ID;company->公司名称;brand->品牌词;keyword->关键词;prefix->前缀;suffix->后缀;event_title->事件标题; | ||
| 44 | + * event_content->事件内容;title->标题;description->描述;footer->结尾引用;img->图片;ai_model->ai_model | ||
| 45 | + */ | ||
| 46 | + public function saveWritingTask(){ | ||
| 47 | + try { | ||
| 48 | + if(isset($this->param['id']) &&!empty($this->param['id'])){ | ||
| 49 | + $id = $this->param['id']; | ||
| 50 | + $this->model->edit($this->param,['id'=>$id]); | ||
| 51 | + }else{ | ||
| 52 | + $id = $this->model->addReturnId($this->param); | ||
| 53 | + } | ||
| 54 | + }catch (\Exception $e){ | ||
| 55 | + $this->fail('保存数据失败,请联系管理员'.$e->getMessage()); | ||
| 56 | + } | ||
| 57 | + return $this->success(['id'=>$id]); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * @remark :删除数据 | ||
| 62 | + * @name :delWritingTask | ||
| 63 | + * @author :lyh | ||
| 64 | + * @method :post | ||
| 65 | + * @time :2025/10/25 15:05 | ||
| 66 | + */ | ||
| 67 | + public function delWritingTask() | ||
| 68 | + { | ||
| 69 | + $res = $this->model->del(['id'=>['in',$this->param['id']]]); | ||
| 70 | + if($res === false){ | ||
| 71 | + $this->fail('删除失败,请联系管理员'); | ||
| 72 | + } | ||
| 73 | + return $this->success(); | ||
| 74 | + } | ||
| 24 | } | 75 | } |
| @@ -401,7 +401,7 @@ class InquiryForwardLogic extends BaseLogic | @@ -401,7 +401,7 @@ class InquiryForwardLogic extends BaseLogic | ||
| 401 | $text = Translate::tran($text, $lang); | 401 | $text = Translate::tran($text, $lang); |
| 402 | } | 402 | } |
| 403 | 403 | ||
| 404 | - return $this->success(['ai_message' => Common::deal_str($text)]); | 404 | + return $this->success(['ai_message' => str_replace('<br/>', PHP_EOL, Common::deal_str($text))]); |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | /** | 407 | /** |
| @@ -35,6 +35,9 @@ class WebSettingReceivingLogic extends BaseLogic | @@ -35,6 +35,9 @@ class WebSettingReceivingLogic extends BaseLogic | ||
| 35 | */ | 35 | */ |
| 36 | public function setting_receiving_save(){ | 36 | public function setting_receiving_save(){ |
| 37 | $data = []; | 37 | $data = []; |
| 38 | + if(!isset($this->param['data']) || empty($this->param['data'])){ | ||
| 39 | + $this->fail('参数错误,请联系管理员'); | ||
| 40 | + } | ||
| 38 | foreach ($this->param['data'] as $v){ | 41 | foreach ($this->param['data'] as $v){ |
| 39 | if($v['type'] == 1){ | 42 | if($v['type'] == 1){ |
| 40 | // 使用正则表达式匹配中国大陆手机号 | 43 | // 使用正则表达式匹配中国大陆手机号 |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :GeoWritingsTaskRequest.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/10/25 14:21 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Requests\Aside\Geo; | ||
| 11 | + | ||
| 12 | +use Illuminate\Foundation\Http\FormRequest; | ||
| 13 | + | ||
| 14 | +class GeoWritingsRequest extends FormRequest | ||
| 15 | +{ | ||
| 16 | + /** | ||
| 17 | + * Determine if the user is authorized to make this request. | ||
| 18 | + * | ||
| 19 | + * @return bool | ||
| 20 | + */ | ||
| 21 | + public function authorize() | ||
| 22 | + { | ||
| 23 | + return true; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * Get the validation rules that apply to the request. | ||
| 28 | + * | ||
| 29 | + * @return array | ||
| 30 | + */ | ||
| 31 | + public function rules() | ||
| 32 | + { | ||
| 33 | + return [ | ||
| 34 | + 'project_id' => 'required', | ||
| 35 | + 'title' => 'required|string', | ||
| 36 | + 'content' => 'required|string', | ||
| 37 | + ]; | ||
| 38 | + } | ||
| 39 | +} |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :GeoWritingsTaskRequest.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/10/25 14:21 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Requests\Aside\Geo; | ||
| 11 | + | ||
| 12 | +use Illuminate\Foundation\Http\FormRequest; | ||
| 13 | + | ||
| 14 | +class GeoWritingsTaskRequest extends FormRequest | ||
| 15 | +{ | ||
| 16 | + /** | ||
| 17 | + * Determine if the user is authorized to make this request. | ||
| 18 | + * | ||
| 19 | + * @return bool | ||
| 20 | + */ | ||
| 21 | + public function authorize() | ||
| 22 | + { | ||
| 23 | + return true; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * Get the validation rules that apply to the request. | ||
| 28 | + * | ||
| 29 | + * @return array | ||
| 30 | + */ | ||
| 31 | + public function rules() | ||
| 32 | + { | ||
| 33 | + return [ | ||
| 34 | + 'project_id' => 'required', | ||
| 35 | + 'company' => 'required|string', | ||
| 36 | + 'brand' => 'required|string', | ||
| 37 | + 'keyword' => 'required|string', | ||
| 38 | + 'prefix' => 'required|string', | ||
| 39 | + 'suffix' => 'required|string', | ||
| 40 | + 'event_title' => 'required|string', | ||
| 41 | + 'event_content' => 'required|string', | ||
| 42 | + 'title' => 'required|string|max:120', | ||
| 43 | + 'description' => 'required|string', | ||
| 44 | + 'footer' => 'required|string', | ||
| 45 | + 'img' => 'required|string', | ||
| 46 | + 'ai_model' => 'required|string', | ||
| 47 | + ]; | ||
| 48 | + } | ||
| 49 | +} |
| @@ -26,7 +26,7 @@ class NewsRequest extends FormRequest | @@ -26,7 +26,7 @@ class NewsRequest extends FormRequest | ||
| 26 | return [ | 26 | return [ |
| 27 | 'name'=>'required|max:200', | 27 | 'name'=>'required|max:200', |
| 28 | 'url'=>'required', | 28 | 'url'=>'required', |
| 29 | -// 'seo_title' => 'max:70', | 29 | + 'seo_title' => 'max:70', |
| 30 | 'seo_keywords' => 'max:300', | 30 | 'seo_keywords' => 'max:300', |
| 31 | 'seo_description' => 'max:200', | 31 | 'seo_description' => 'max:200', |
| 32 | ]; | 32 | ]; |
| @@ -38,7 +38,7 @@ class NewsRequest extends FormRequest | @@ -38,7 +38,7 @@ class NewsRequest extends FormRequest | ||
| 38 | 'name.required'=>'请填写名称', | 38 | 'name.required'=>'请填写名称', |
| 39 | 'name.max'=>'名称超过最长长度200', | 39 | 'name.max'=>'名称超过最长长度200', |
| 40 | 'url.required'=>'链接不能为空', | 40 | 'url.required'=>'链接不能为空', |
| 41 | -// 'seo_title.max' => 'SEO标题不能超过70个字符', | 41 | + 'seo_title.max' => 'SEO标题不能超过70个字符', |
| 42 | 'seo_keywords.max' => 'SEO关键词不能超过300个字符', | 42 | 'seo_keywords.max' => 'SEO关键词不能超过300个字符', |
| 43 | 'seo_description.max' => 'SEO描述不能超过200个字符', | 43 | 'seo_description.max' => 'SEO描述不能超过200个字符', |
| 44 | ]; | 44 | ]; |
| @@ -23,33 +23,6 @@ class GeoConf extends Base | @@ -23,33 +23,6 @@ class GeoConf extends Base | ||
| 23 | */ | 23 | */ |
| 24 | protected $table = 'gl_project_geo_conf'; | 24 | protected $table = 'gl_project_geo_conf'; |
| 25 | 25 | ||
| 26 | - /** | ||
| 27 | - * 保存GEO相关配置 | ||
| 28 | - * @param $project_id | ||
| 29 | - * @param $manager_id | ||
| 30 | - * @param $company | ||
| 31 | - * @param $brand | ||
| 32 | - * @param $description | ||
| 33 | - * @param $prefix | ||
| 34 | - * @param $suffix | ||
| 35 | - * @return GeoConf | ||
| 36 | - */ | ||
| 37 | - public static function saveConf($project_id, $manager_id, $company, $brand, $description, $prefix, $suffix) | ||
| 38 | - { | ||
| 39 | - $data = self::where(compact('project_id'))->first(); | ||
| 40 | - if (empty($data)) { | ||
| 41 | - $data = new self(); | ||
| 42 | - $data->project_id = $project_id; | ||
| 43 | - } | ||
| 44 | - $data->manager_id = $manager_id; | ||
| 45 | - $data->company = $company; | ||
| 46 | - $data->brand = $brand; | ||
| 47 | - $data->description = $description; | ||
| 48 | - $data->prefix = $prefix; | ||
| 49 | - $data->suffix = $suffix; | ||
| 50 | - $data->save(); | ||
| 51 | - return $data; | ||
| 52 | - } | ||
| 53 | 26 | ||
| 54 | /** | 27 | /** |
| 55 | * GEO 负责人集合 | 28 | * GEO 负责人集合 |
| @@ -60,26 +60,6 @@ class GeoConfirm extends Base | @@ -60,26 +60,6 @@ class GeoConfirm extends Base | ||
| 60 | ]; | 60 | ]; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | - /** | ||
| 64 | - * @param $project_id | ||
| 65 | - * @param $type | ||
| 66 | - * @param $content | ||
| 67 | - * @param $max_num | ||
| 68 | - * @return GeoConfirm | ||
| 69 | - */ | ||
| 70 | - public static function saveContent($project_id, $type, $content, $max_num) | ||
| 71 | - { | ||
| 72 | - $data = self::where(compact('project_id', 'type'))->first(); | ||
| 73 | - if (empty($data)) { | ||
| 74 | - $data = new self(); | ||
| 75 | - $data->project_id = $project_id; | ||
| 76 | - $data->type = $type; | ||
| 77 | - } | ||
| 78 | - $data->content = $content; | ||
| 79 | - $data->max_num = $max_num; | ||
| 80 | - $data->save(); | ||
| 81 | - return $data; | ||
| 82 | - } | ||
| 83 | 63 | ||
| 84 | /** | 64 | /** |
| 85 | * 保存确认数据 | 65 | * 保存确认数据 |
| @@ -110,5 +110,8 @@ Route::prefix('ticket_upload')->group(function () { | @@ -110,5 +110,8 @@ Route::prefix('ticket_upload')->group(function () { | ||
| 110 | //geo设置 | 110 | //geo设置 |
| 111 | Route::prefix('geo')->group(function () { | 111 | Route::prefix('geo')->group(function () { |
| 112 | Route::any('/getConfirm', [\App\Http\Controllers\Api\GeoController::class, 'getConfirm'])->name('geo.getConfirm'); | 112 | Route::any('/getConfirm', [\App\Http\Controllers\Api\GeoController::class, 'getConfirm'])->name('geo.getConfirm'); |
| 113 | + Route::any('/getWritingsList', [\App\Http\Controllers\Api\GeoController::class, 'getWritingsList'])->name('geo.getWritingsList');//确认文章数据 | ||
| 114 | + Route::any('/getWritingsDetail', [\App\Http\Controllers\Api\GeoController::class, 'getWritingsDetail'])->name('geo.getWritingsDetail');//文章数据详情 | ||
| 115 | + Route::any('/saveConfirm', [\App\Http\Controllers\Api\GeoController::class, 'saveConfirm'])->name('geo.saveConfirm');//保存用户确认信息 | ||
| 113 | }); | 116 | }); |
| 114 | 117 |
| @@ -586,11 +586,26 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -586,11 +586,26 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 586 | Route::any('/downloadGeoLink', [Aside\Geo\GeoLinkController::class, 'downloadGeoLink'])->name('admin.geo_link_downloadGeoLink'); | 586 | Route::any('/downloadGeoLink', [Aside\Geo\GeoLinkController::class, 'downloadGeoLink'])->name('admin.geo_link_downloadGeoLink'); |
| 587 | Route::any('/daResultData', [Aside\Geo\GeoLinkController::class, 'daResultData'])->name('admin.geo_link_daResultData'); | 587 | Route::any('/daResultData', [Aside\Geo\GeoLinkController::class, 'daResultData'])->name('admin.geo_link_daResultData'); |
| 588 | }); | 588 | }); |
| 589 | - //geo设置 | 589 | + //geo信息详情设置 |
| 590 | Route::prefix('conf')->group(function () { | 590 | Route::prefix('conf')->group(function () { |
| 591 | Route::any('/getConfig', [Aside\Geo\GeoController::class, 'getConfig'])->name('admin.geo_conf_getConfig'); | 591 | Route::any('/getConfig', [Aside\Geo\GeoController::class, 'getConfig'])->name('admin.geo_conf_getConfig'); |
| 592 | Route::any('/saveConfig', [Aside\Geo\GeoController::class, 'saveConfig'])->name('admin.geo_conf_saveConfig'); | 592 | Route::any('/saveConfig', [Aside\Geo\GeoController::class, 'saveConfig'])->name('admin.geo_conf_saveConfig'); |
| 593 | - Route::any('/saveConfirmContent', [Aside\Geo\GeoController::class, 'saveConfirmContent'])->name('admin.geo_conf_saveConfirmContent'); | 593 | + }); |
| 594 | + //geo客户确认信息 | ||
| 595 | + Route::prefix('confirm')->group(function () { | ||
| 596 | + Route::any('/saveConfirmContent', [Aside\Geo\GeoConfirmController::class, 'saveConfirmContent'])->name('admin.geo_confirm_saveConfirmContent'); | ||
| 597 | + }); | ||
| 598 | + //geoai文章任务管理 | ||
| 599 | + Route::prefix('writing_task')->group(function () { | ||
| 600 | + Route::any('/', [Aside\Geo\GeoWritingTaskController::class, 'lists'])->name('admin.geo_writing_task_lists'); | ||
| 601 | + Route::any('/saveWritingTask', [Aside\Geo\GeoWritingTaskController::class, 'saveWritingTask'])->name('admin.geo_writing_task_saveWritingTask'); | ||
| 602 | + Route::any('/delWritingTask', [Aside\Geo\GeoWritingTaskController::class, 'delWritingTask'])->name('admin.geo_writing_task_delWritingTask'); | ||
| 603 | + }); | ||
| 604 | + //geo文章管理 | ||
| 605 | + Route::prefix('writing')->group(function () { | ||
| 606 | + Route::any('/', [Aside\Geo\GeoWritingsController::class, 'lists'])->name('admin.geo_writing_task'); | ||
| 607 | + Route::any('/saveWriting', [Aside\Geo\GeoWritingsController::class, 'saveWriting'])->name('admin.geo_writing_saveWriting'); | ||
| 608 | + Route::any('/delWriting', [Aside\Geo\GeoWritingsController::class, 'delWriting'])->name('admin.geo_writing_delWriting'); | ||
| 594 | }); | 609 | }); |
| 595 | }); | 610 | }); |
| 596 | // 任务相关 | 611 | // 任务相关 |
-
请 注册 或 登录 后发表评论