正在显示
4 个修改的文件
包含
45 行增加
和
4 行删除
| @@ -62,10 +62,14 @@ class Validate | @@ -62,10 +62,14 @@ class Validate | ||
| 62 | */ | 62 | */ |
| 63 | public static function check_data($data,$type) | 63 | public static function check_data($data,$type) |
| 64 | { | 64 | { |
| 65 | - if($type == 1){ | ||
| 66 | - $res = HttpUtils::get('https://fob.ai.cc/api/check_email', ['email' => $data]); | ||
| 67 | - }else{ | ||
| 68 | - $res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $data]); | 65 | + try { |
| 66 | + if($type == 1){ | ||
| 67 | + $res = HttpUtils::get('https://fob.ai.cc/api/check_email', ['email' => $data]); | ||
| 68 | + }else{ | ||
| 69 | + $res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $data]); | ||
| 70 | + } | ||
| 71 | + }catch (\Exception $e){ | ||
| 72 | + return []; | ||
| 69 | } | 73 | } |
| 70 | return Arr::s2a($res); | 74 | return Arr::s2a($res); |
| 71 | } | 75 | } |
| @@ -270,4 +270,21 @@ class InquiryController extends BaseController | @@ -270,4 +270,21 @@ class InquiryController extends BaseController | ||
| 270 | // return Storage::disk('runtime')->download($file); //直接下载 | 270 | // return Storage::disk('runtime')->download($file); //直接下载 |
| 271 | $this->response('success',Code::SUCCESS,['url' => $fileurl]); | 271 | $this->response('success',Code::SUCCESS,['url' => $fileurl]); |
| 272 | } | 272 | } |
| 273 | + | ||
| 274 | + /** | ||
| 275 | + * @remark :翻译国家 | ||
| 276 | + * @name :tranCountry | ||
| 277 | + * @author :lyh | ||
| 278 | + * @method :post | ||
| 279 | + * @time :2025/3/11 14:18 | ||
| 280 | + */ | ||
| 281 | + public function tranCountry(InquiryLogic $logic){ | ||
| 282 | + $this->request->validate([ | ||
| 283 | + 'phone_region' => 'required', | ||
| 284 | + ],[ | ||
| 285 | + 'phone_region.required' => '国家译文不能为空' | ||
| 286 | + ]); | ||
| 287 | + $data = $logic->tranCountry(); | ||
| 288 | + $this->response('success',Code::SUCCESS,$data); | ||
| 289 | + } | ||
| 273 | } | 290 | } |
| @@ -212,10 +212,29 @@ class InquiryLogic extends BaseLogic | @@ -212,10 +212,29 @@ class InquiryLogic extends BaseLogic | ||
| 212 | 'country_code'=>$data['country_code'] ?? '', | 212 | 'country_code'=>$data['country_code'] ?? '', |
| 213 | 'phone_region'=>$data['phone_region'] ?? '', | 213 | 'phone_region'=>$data['phone_region'] ?? '', |
| 214 | ]; | 214 | ]; |
| 215 | + if(!empty($param['phone_region'])){ | ||
| 216 | + $param['country'] = Translate::tran($this->param['phone_region'], 'zh') ?? ''; | ||
| 217 | + } | ||
| 215 | (new PhoneData())->addReturnId($param); | 218 | (new PhoneData())->addReturnId($param); |
| 216 | return $this->success($param); | 219 | return $this->success($param); |
| 217 | } | 220 | } |
| 218 | } | 221 | } |
| 219 | return $this->success($data); | 222 | return $this->success($data); |
| 220 | } | 223 | } |
| 224 | + | ||
| 225 | + /** | ||
| 226 | + * @remark :翻译国家 | ||
| 227 | + * @name :tranCountry | ||
| 228 | + * @author :lyh | ||
| 229 | + * @method :post | ||
| 230 | + * @time :2025/3/11 14:11 | ||
| 231 | + */ | ||
| 232 | + public function tranCountry(){ | ||
| 233 | + $country = Translate::tran($this->param['phone_region'], 'zh') ?? ''; | ||
| 234 | + if(!empty($country)){ | ||
| 235 | + $phoneDataModel = new PhoneData(); | ||
| 236 | + $phoneDataModel->edit(['country'=>$country],['phone_region'=>$this->param['phone_region']]); | ||
| 237 | + } | ||
| 238 | + return $this->success(['country'=>$country]); | ||
| 239 | + } | ||
| 221 | } | 240 | } |
| @@ -371,6 +371,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -371,6 +371,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 371 | Route::any('/export', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'export'])->name('inquiry_export'); | 371 | Route::any('/export', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'export'])->name('inquiry_export'); |
| 372 | Route::any('/send', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'sendMobileVerifyData'])->name('inquiry_sendMobileVerifyData'); | 372 | Route::any('/send', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'sendMobileVerifyData'])->name('inquiry_sendMobileVerifyData'); |
| 373 | Route::any('/checkEmail', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'checkEmail'])->name('inquiry_checkEmail'); | 373 | Route::any('/checkEmail', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'checkEmail'])->name('inquiry_checkEmail'); |
| 374 | + Route::any('/tranCountry', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'tranCountry'])->name('inquiry_tranCountry'); | ||
| 374 | }); | 375 | }); |
| 375 | 376 | ||
| 376 | //生成路由 | 377 | //生成路由 |
-
请 注册 或 登录 后发表评论