Merge branch 'dev' of http://47.244.231.31:8099/zhl/globalso-v6 into dev
正在显示
7 个修改的文件
包含
76 行增加
和
68 行删除
| @@ -139,7 +139,7 @@ if (!function_exists('checkDomain')) { | @@ -139,7 +139,7 @@ if (!function_exists('checkDomain')) { | ||
| 139 | return false; | 139 | return false; |
| 140 | } | 140 | } |
| 141 | if (preg_match('/^(?:[-A-Za-z0-9]+\.)+[A-Za-z]{2,6}$/', $host)) { | 141 | if (preg_match('/^(?:[-A-Za-z0-9]+\.)+[A-Za-z]{2,6}$/', $host)) { |
| 142 | - return $scheme . '://' . $host; | 142 | + return $scheme . '://' . $host . '/'; |
| 143 | } else { | 143 | } else { |
| 144 | return false; | 144 | return false; |
| 145 | } | 145 | } |
| @@ -6,6 +6,7 @@ use App\Helper\Arr; | @@ -6,6 +6,7 @@ use App\Helper\Arr; | ||
| 6 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| 7 | use App\Http\Logic\Aside\Project\ProjectLogic; | 7 | use App\Http\Logic\Aside\Project\ProjectLogic; |
| 8 | use App\Http\Requests\Aside\Project\ProjectRequest; | 8 | use App\Http\Requests\Aside\Project\ProjectRequest; |
| 9 | +use App\Models\InquirySet; | ||
| 9 | use App\Rules\Ids; | 10 | use App\Rules\Ids; |
| 10 | use Illuminate\Http\Request; | 11 | use Illuminate\Http\Request; |
| 11 | 12 | ||
| @@ -47,4 +48,34 @@ class ProjectController extends BaseController | @@ -47,4 +48,34 @@ class ProjectController extends BaseController | ||
| 47 | $data = $logic->save($this->param); | 48 | $data = $logic->save($this->param); |
| 48 | return $this->success($data); | 49 | return $this->success($data); |
| 49 | } | 50 | } |
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 询盘通知设置 | ||
| 54 | + * @param ProjectRequest $request | ||
| 55 | + * @param ProjectLogic $logic | ||
| 56 | + * @return \Illuminate\Http\JsonResponse | ||
| 57 | + * @throws \Psr\Container\ContainerExceptionInterface | ||
| 58 | + * @throws \Psr\Container\NotFoundExceptionInterface | ||
| 59 | + * @author zbj | ||
| 60 | + * @date 2023/5/17 | ||
| 61 | + */ | ||
| 62 | + public function inquiry_set(Request $request, ProjectLogic $logic){ | ||
| 63 | + $request->validate([ | ||
| 64 | + 'project_id'=>'required' | ||
| 65 | + ],[ | ||
| 66 | + 'project_id.required' => '项目ID不能为空' | ||
| 67 | + ]); | ||
| 68 | + if($request->isMethod('get')){ | ||
| 69 | + $data = InquirySet::where('project_id', $request->project_id)->first(); | ||
| 70 | + if(!$data){ | ||
| 71 | + $data = ['emails' => '', 'phones' => '']; | ||
| 72 | + }else{ | ||
| 73 | + $data = $data->toArray(); | ||
| 74 | + } | ||
| 75 | + return $this->success($data); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + $data = $logic->saveInquirySet($this->param); | ||
| 79 | + return $this->success($data); | ||
| 80 | + } | ||
| 50 | } | 81 | } |
| @@ -83,17 +83,4 @@ class InquiryController extends BaseController | @@ -83,17 +83,4 @@ class InquiryController extends BaseController | ||
| 83 | // return Storage::disk('runtime')->download($file); //直接下载 | 83 | // return Storage::disk('runtime')->download($file); //直接下载 |
| 84 | return $this->success(['url' => $fileurl]); | 84 | return $this->success(['url' => $fileurl]); |
| 85 | } | 85 | } |
| 86 | - | ||
| 87 | - /** | ||
| 88 | - * 询盘通知设置 | ||
| 89 | - * @author zbj | ||
| 90 | - * @date 2023/5/17 | ||
| 91 | - */ | ||
| 92 | - public function set(Request $request, InquiryLogic $logic){ | ||
| 93 | - if($request->isMethod('get')){ | ||
| 94 | - return $this->success($logic->getSet()); | ||
| 95 | - } | ||
| 96 | - $logic->saveSet(); | ||
| 97 | - return $this->success(); | ||
| 98 | - } | ||
| 99 | } | 86 | } |
| @@ -4,11 +4,14 @@ namespace App\Http\Logic\Aside\Project; | @@ -4,11 +4,14 @@ namespace App\Http\Logic\Aside\Project; | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | use App\Helper\Arr; | 6 | use App\Helper\Arr; |
| 7 | +use App\Helper\FormGlobalsoApi; | ||
| 7 | use App\Http\Logic\Aside\BaseLogic; | 8 | use App\Http\Logic\Aside\BaseLogic; |
| 9 | +use App\Models\InquirySet; | ||
| 8 | use App\Models\Project\DeployBuild; | 10 | use App\Models\Project\DeployBuild; |
| 9 | use App\Models\Project\DeployOptimize; | 11 | use App\Models\Project\DeployOptimize; |
| 10 | use App\Models\Project\Payment; | 12 | use App\Models\Project\Payment; |
| 11 | use App\Models\Project\Project; | 13 | use App\Models\Project\Project; |
| 14 | +use Illuminate\Database\Eloquent\Model; | ||
| 12 | use Illuminate\Support\Facades\DB; | 15 | use Illuminate\Support\Facades\DB; |
| 13 | 16 | ||
| 14 | /** | 17 | /** |
| @@ -39,15 +42,15 @@ class ProjectLogic extends BaseLogic | @@ -39,15 +42,15 @@ class ProjectLogic extends BaseLogic | ||
| 39 | } | 42 | } |
| 40 | 43 | ||
| 41 | public function save($param){ | 44 | public function save($param){ |
| 42 | - if(!empty($param['test_domain'])){ | ||
| 43 | - $param['test_domain'] = checkDomain($param['test_domain']); | ||
| 44 | - if(!$param['test_domain']){ | 45 | + if(!empty($param['deploy_build']['test_domain'])){ |
| 46 | + $param['deploy_build']['test_domain'] = checkDomain($param['deploy_build']['test_domain']); | ||
| 47 | + if(!$param['deploy_build']['test_domain']){ | ||
| 45 | $this->fail('测试域名格式不正确'); | 48 | $this->fail('测试域名格式不正确'); |
| 46 | } | 49 | } |
| 47 | } | 50 | } |
| 48 | - if(!empty($param['domain'])){ | ||
| 49 | - $param['domain'] = checkDomain($param['domain']); | ||
| 50 | - if(!$param['domain']){ | 51 | + if(!empty($param['deploy_optimize']['domain'])){ |
| 52 | + $param['deploy_optimize']['domain'] = checkDomain($param['deploy_optimize']['domain']); | ||
| 53 | + if(!$param['deploy_optimize']['domain']){ | ||
| 51 | $this->fail('正式域名格式不正确'); | 54 | $this->fail('正式域名格式不正确'); |
| 52 | } | 55 | } |
| 53 | } | 56 | } |
| @@ -122,4 +125,38 @@ class ProjectLogic extends BaseLogic | @@ -122,4 +125,38 @@ class ProjectLogic extends BaseLogic | ||
| 122 | parent::setWith(['payment', 'deploy_build', 'deploy_optimize']); | 125 | parent::setWith(['payment', 'deploy_build', 'deploy_optimize']); |
| 123 | parent::clearCache($id); | 126 | parent::clearCache($id); |
| 124 | } | 127 | } |
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * 保存询盘通知设置 | ||
| 131 | + * @author zbj | ||
| 132 | + * @date 2023/5/17 | ||
| 133 | + */ | ||
| 134 | + public function saveInquirySet($param) | ||
| 135 | + { | ||
| 136 | + $project = $this->getCacheInfo($param['project_id']); | ||
| 137 | + | ||
| 138 | + //同步到接口 | ||
| 139 | + $domain = parse_url($project['deploy_optimize']['domain'])['host']; | ||
| 140 | + $emails = Arr::arrToSet($param['emails']??'', 'trim'); | ||
| 141 | + $phones = Arr::arrToSet($param['phones']??'', 'trim'); | ||
| 142 | + $form_globalso_api = new FormGlobalsoApi(); | ||
| 143 | + $res = $form_globalso_api->setInquiry($domain, $emails, $phones); | ||
| 144 | + | ||
| 145 | + if (!$res) { | ||
| 146 | + $this->fail('保存失败'); | ||
| 147 | + } | ||
| 148 | + if ($res['status'] != 200) { | ||
| 149 | + $this->fail($res['message'] ?? '保存失败'); | ||
| 150 | + } | ||
| 151 | + //保存 | ||
| 152 | + $set = InquirySet::where('project_id', $param['project_id'])->first(); | ||
| 153 | + if (!$set) { | ||
| 154 | + $set = new InquirySet(); | ||
| 155 | + } | ||
| 156 | + $set->project_id = $param['project_id']; | ||
| 157 | + $set->emails = $emails; | ||
| 158 | + $set->phones = $phones; | ||
| 159 | + $set->save(); | ||
| 160 | + return $this->success(); | ||
| 161 | + } | ||
| 125 | } | 162 | } |
| @@ -79,54 +79,7 @@ class InquiryLogic extends BaseLogic | @@ -79,54 +79,7 @@ class InquiryLogic extends BaseLogic | ||
| 79 | return $this->success(); | 79 | return $this->success(); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | - /** | ||
| 83 | - * 读取设置 | ||
| 84 | - * @return array | ||
| 85 | - * @author zbj | ||
| 86 | - * @date 2023/5/17 | ||
| 87 | - */ | ||
| 88 | - public function getSet() | ||
| 89 | - { | ||
| 90 | - $set = InquirySet::where('project_id', $this->user['project_id'])->first(); | ||
| 91 | - if ($set) { | ||
| 92 | - return $this->success(Arr::twoKeepKeys($set->toArray(), ['emails', 'phones'])); | ||
| 93 | - } else { | ||
| 94 | - return $this->success(['emails' => '', 'phones' => '']); | ||
| 95 | - } | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - /** | ||
| 99 | - * 保存设置 | ||
| 100 | - * @author zbj | ||
| 101 | - * @date 2023/5/17 | ||
| 102 | - */ | ||
| 103 | - public function saveSet() | ||
| 104 | - { | ||
| 105 | - $project = (new ProjectLogic())->getInfo($this->user['project_id']); | ||
| 106 | 82 | ||
| 107 | - //同步到接口 | ||
| 108 | - $domain = parse_url($project['deploy_optimize']['domain'])['host'] ?? ['path']; | ||
| 109 | - $emails = Arr::arrToSet($this->request['emails'], 'trim'); | ||
| 110 | - $phones = Arr::arrToSet($this->request['phones'], 'trim'); | ||
| 111 | - | ||
| 112 | - $res = $this->form_globalso_api->setInquiry($domain, $emails, $phones); | ||
| 113 | - | ||
| 114 | - if (!$res) { | ||
| 115 | - $this->fail('保存失败'); | ||
| 116 | - } | ||
| 117 | - if ($res['status'] != 200) { | ||
| 118 | - $this->fail($res['message'] ?? '保存失败'); | ||
| 119 | - } | ||
| 120 | - //保存 | ||
| 121 | - $set = InquirySet::where('project_id', $this->user['project_id'])->first(); | ||
| 122 | - if (!$set) { | ||
| 123 | - $set = new InquirySet(); | ||
| 124 | - } | ||
| 125 | - $set->project_id = $this->user['project_id']; | ||
| 126 | - $set->emails = $emails; | ||
| 127 | - $set->phones = $phones; | ||
| 128 | - $set->save(); | ||
| 129 | - } | ||
| 130 | 83 | ||
| 131 | 84 | ||
| 132 | } | 85 | } |
| @@ -103,6 +103,7 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w | @@ -103,6 +103,7 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w | ||
| 103 | Route::get('/', [Aside\Project\ProjectController::class, 'list'])->name('admin.project'); | 103 | Route::get('/', [Aside\Project\ProjectController::class, 'list'])->name('admin.project'); |
| 104 | Route::get('/info', [Aside\Project\ProjectController::class, 'info'])->name('admin.project_info'); | 104 | Route::get('/info', [Aside\Project\ProjectController::class, 'info'])->name('admin.project_info'); |
| 105 | Route::post('/save', [Aside\Project\ProjectController::class, 'save'])->name('admin.project_save'); | 105 | Route::post('/save', [Aside\Project\ProjectController::class, 'save'])->name('admin.project_save'); |
| 106 | + Route::any('/inquiry_set', [Aside\Project\ProjectController::class, 'inquiry_set'])->name('admin.project_inquiry_set'); | ||
| 106 | }); | 107 | }); |
| 107 | 108 | ||
| 108 | //工单管理 | 109 | //工单管理 |
| @@ -199,7 +199,6 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -199,7 +199,6 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 199 | //精准询盘 | 199 | //精准询盘 |
| 200 | Route::prefix('inquiry')->group(function () { | 200 | Route::prefix('inquiry')->group(function () { |
| 201 | Route::get('/', [\App\Http\Controllers\Bside\InquiryController::class, 'index'])->name('inquiry'); | 201 | Route::get('/', [\App\Http\Controllers\Bside\InquiryController::class, 'index'])->name('inquiry'); |
| 202 | - Route::any('/set', [\App\Http\Controllers\Bside\InquiryController::class, 'set'])->name('inquiry_set'); | ||
| 203 | Route::get('/info', [\App\Http\Controllers\Bside\InquiryController::class, 'info'])->name('inquiry_info'); | 202 | Route::get('/info', [\App\Http\Controllers\Bside\InquiryController::class, 'info'])->name('inquiry_info'); |
| 204 | Route::any('/delete', [\App\Http\Controllers\Bside\InquiryController::class, 'delete'])->name('inquiry_delete'); | 203 | Route::any('/delete', [\App\Http\Controllers\Bside\InquiryController::class, 'delete'])->name('inquiry_delete'); |
| 205 | Route::any('/export', [\App\Http\Controllers\Bside\InquiryController::class, 'export'])->name('inquiry_export'); | 204 | Route::any('/export', [\App\Http\Controllers\Bside\InquiryController::class, 'export'])->name('inquiry_export'); |
-
请 注册 或 登录 后发表评论