From 8a94de610db9d5ec16c265885dcb9b0e745b6ab9 Mon Sep 17 00:00:00 2001
From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com>
Date: Sat, 29 Nov 2025 15:36:53 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=A2=E7=9B=98=E8=BD=AC=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../InquiryTransmitConfigController.php | 33 +++
.../controller/InquiryTransmitController.php | 268 ++++++++++++++++++
.../logic/InquiryTransmitConfigLogic.php | 17 ++
app/common/logic/InquiryTransmitLogic.php | 17 ++
app/common/model/InquiryTransmit.php | 49 ++++
app/common/model/InquiryTransmitConfig.php | 49 ++++
.../service/InquiryTransmitConfigService.php | 31 ++
app/common/service/InquiryTransmitService.php | 31 ++
.../InquiryTransmitConfigValidate.php | 29 ++
.../validate/InquiryTransmitValidate.php | 29 ++
composer.json | 3 +-
composer.lock | 72 ++++-
config/route.php | 5 +
13 files changed, 631 insertions(+), 2 deletions(-)
create mode 100644 app/admin/controller/InquiryTransmitConfigController.php
create mode 100644 app/admin/controller/InquiryTransmitController.php
create mode 100644 app/common/logic/InquiryTransmitConfigLogic.php
create mode 100644 app/common/logic/InquiryTransmitLogic.php
create mode 100644 app/common/model/InquiryTransmit.php
create mode 100644 app/common/model/InquiryTransmitConfig.php
create mode 100644 app/common/service/InquiryTransmitConfigService.php
create mode 100644 app/common/service/InquiryTransmitService.php
create mode 100644 app/common/validate/InquiryTransmitConfigValidate.php
create mode 100644 app/common/validate/InquiryTransmitValidate.php
diff --git a/app/admin/controller/InquiryTransmitConfigController.php b/app/admin/controller/InquiryTransmitConfigController.php
new file mode 100644
index 0000000..87761bf
--- /dev/null
+++ b/app/admin/controller/InquiryTransmitConfigController.php
@@ -0,0 +1,33 @@
+service = new InquiryTransmitConfigService();
+ }
+
+ /**
+ * 列表页数据格式化
+ *
+ * @param array $data
+ * @return array
+ */
+ // protected function indexFormat($data)
+ // {
+ // if (isset($data['created_at']))
+ // $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
+ // if (isset($data['updated_at']))
+ // $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
+ // return $data;
+ // }
+}
\ No newline at end of file
diff --git a/app/admin/controller/InquiryTransmitController.php b/app/admin/controller/InquiryTransmitController.php
new file mode 100644
index 0000000..ee789c2
--- /dev/null
+++ b/app/admin/controller/InquiryTransmitController.php
@@ -0,0 +1,268 @@
+service = new InquiryTransmitService();
+ }
+
+ /**
+ * 列表页数据格式化
+ *
+ * @param array $data
+ * @return array
+ */
+ // protected function indexFormat($data)
+ // {
+ // if (isset($data['created_at']))
+ // $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
+ // if (isset($data['updated_at']))
+ // $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
+ // return $data;
+ // }
+
+
+ // }
+
+ public function form(Request $request, int $id)
+ {
+ try {
+ $params = $request->all();
+
+ if ($id == 1) {
+ $mailto = '1696136552@qq.com';
+ $fromDomain = 'magicbridgeauto.com';
+ } else {
+ $mailto = '1696136552@qq.com';
+ $fromDomain = 'magicbridgeauto.com';
+ }
+
+ if ($request->method() == 'GET') {
+ $config = [
+ 'iLang' => 'en',
+ 'Act' => 'Inquiry',
+ 'post_url' => getenv('MAIN_DOMAIN').'/form'.'?m=Data&a=save',
+ 'mailto' => $mailto,
+ 'fromDomain' => $fromDomain,
+ 'fromPath' => parse_url($params['fromlink'], PHP_URL_PATH),
+ 'm' => $params['m'],
+ 'a' => $params['a'],
+ 'tid' => $params['tid'],
+ 'cid' => $params['cid'],
+ 'version' => $params['version'],
+ 'fromlink' => $params['fromlink']
+ ];
+
+ $html = match ($params['tid']) {
+ 'en-5-LP-pnx' => $this->formHmtl($config),
+ 'en-3-P-vdx' => $this->formHmtl2($config)
+ };
+
+ return json([
+ 'code' => 200,
+ 'data' => [
+ 'html' => $html
+ ],
+ 'message' => 'success'
+ ]);
+ }
+
+ if ($request->method() == 'POST') {
+ $ip = $request->getRealIp($safe_mode=true);
+ $edata = [
+ 'mailto' => $params['mailto'],
+
+ 'Date' => date('Y-m-d H:i:s', time()),
+ 'Email' => $params['userEMail'],
+ 'Name' => $params['userName'],
+ 'Tel' => $params['userTel'],
+ 'Company' => '',
+ 'Country' => $params['uCountry'],
+ 'Form Url' => $params['fromlink'],
+ 'Message' => $params['Message'],
+ 'Ip' => $ip,
+ 'IpLocation' => ip2region($ip).'(仅供参考)',
+
+ 'iLang' => $params['iLang'],
+ 'mailto' => $params['mailto'],
+ 'navigator_language' => $params['navigator_language'],
+ 'navigator_platform' => $params['navigator_platform'],
+ 'screen_width' => $params['screen_width'],
+ 'screen_height' => $params['screen_height'],
+ 'uCountry' => $params['uCountry']
+ ];
+
+ $this->emailHtml($edata);
+
+ return json([
+ 'code' => 200,
+ 'data' => [],
+ 'message' => 'Thank you for your message! We will contact with you soon.'
+ ]);
+ }
+ } catch (\Throwable $th) {
+ Log::info('Data:'.date('Y-m-d H:i:s').':'.$th->getMessage().'|'.$th->getLine().'|'.$th->getFile());
+ }
+ }
+
+ public function formHmtl($config)
+ {
+ // https://v1.xzgoogle.com/form.php?m=Temp&a=getTpl&tid=en-5-LP-pnx&cid=760&version=v4&fromlink=https://magicbridgeauto.com/contact-us/
+ $html = '
';
+ return $html;
+ }
+
+ public function formHmtl2($config)
+ {
+ // https://v1.xzgoogle.com/form.php?m=Temp&a=getTpl&tid=en-3-P-vdx&cid=760&version=v4&fromlink=https://magicbridgeauto.com/news/
+ $html = '';
+ return $html;
+ }
+
+
+ public function emailHtml($data)
+ {
+ $html = '
+
+
+
+ Lead Preview
+
+
+
+
+
+
+
+
+
+
+ |
+ Preview
+ |
+
+
+
+
+
+
+
+
+ | Date: |
+ '.$data['Date'].' |
+
+
+ | Email: |
+
+ '.$data['Email'].'
+ |
+
+
+ | Name: |
+ '.$data['Name'].' |
+
+
+ | Tel: |
+ '.$data['Tel'].' |
+
+
+ | Company: |
+ |
+
+
+ | Country: |
+ '.$data['Country'].' |
+
+
+ | Form Url: |
+
+ '.$data['Form Url'].'
+ |
+
+
+ | Message: |
+ '.$data['Message'].' |
+
+
+ | Ip: |
+ '.$data['Ip'].' |
+
+
+ | IpLocation: |
+ '.$data['IpLocation'].' |
+
+
+ |
+
+
+
+
+ |
+
+ |
+
+
+ | More |
+
+
+
+
+
+ | iLang: |
+ '.$data['iLang'].' |
+
+
+ | mailto: |
+
+ '.$data['mailto'].'
+ |
+
+
+ | navigator_language: |
+ '.$data['navigator_language'].' |
+
+
+ | navigator_platform: |
+ '.$data['navigator_platform'].' |
+
+
+ | screen_width: |
+ '.$data['screen_width'].' |
+
+
+ | screen_height: |
+ '.$data['screen_height'].' |
+
+
+ | uCountry: |
+ '.$data['uCountry'].' |
+
+
+ |
+
+
+
+
+ |
+
+
+
+ ';
+
+// $email = new Email();
+ //return $email->send($data['mailto'], 'Inquiry_Of_'.$data['Name'], $html);
+ return \app\common\utils\email\MailSend::send($data['mailto'], 'Inquiry_Of_'.$data['Name'], $html);
+ }
+}
\ No newline at end of file
diff --git a/app/common/logic/InquiryTransmitConfigLogic.php b/app/common/logic/InquiryTransmitConfigLogic.php
new file mode 100644
index 0000000..3c6782d
--- /dev/null
+++ b/app/common/logic/InquiryTransmitConfigLogic.php
@@ -0,0 +1,17 @@
+validator;
+ }
+}
\ No newline at end of file
diff --git a/app/common/service/InquiryTransmitService.php b/app/common/service/InquiryTransmitService.php
new file mode 100644
index 0000000..a046056
--- /dev/null
+++ b/app/common/service/InquiryTransmitService.php
@@ -0,0 +1,31 @@
+validator;
+ }
+}
\ No newline at end of file
diff --git a/app/common/validate/InquiryTransmitConfigValidate.php b/app/common/validate/InquiryTransmitConfigValidate.php
new file mode 100644
index 0000000..f80ec8d
--- /dev/null
+++ b/app/common/validate/InquiryTransmitConfigValidate.php
@@ -0,0 +1,29 @@
+ [
+
+ ],
+
+ 'update' => [
+
+ ]
+ ];
+}
\ No newline at end of file
diff --git a/app/common/validate/InquiryTransmitValidate.php b/app/common/validate/InquiryTransmitValidate.php
new file mode 100644
index 0000000..58c120a
--- /dev/null
+++ b/app/common/validate/InquiryTransmitValidate.php
@@ -0,0 +1,29 @@
+ [
+
+ ],
+
+ 'update' => [
+
+ ]
+ ];
+}
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 7ff8ace..693315e 100644
--- a/composer.json
+++ b/composer.json
@@ -47,7 +47,8 @@
"phpmailer/phpmailer": "^6.10",
"webman/gateway-worker": "^1.0",
"mpdf/mpdf": "^8.2",
- "jaeger/querylist": "^4.4"
+ "jaeger/querylist": "^4.4",
+ "zoujingli/ip2region": "3.0"
},
"suggest": {
"ext-event": "For better performance. "
diff --git a/composer.lock b/composer.lock
index c3a23c9..ba35bd5 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "865e38bae84e7de0c95098cc87135440",
+ "content-hash": "ac2fa5a625069729975d072614509e1f",
"packages": [
{
"name": "aliyuncs/oss-sdk-php",
@@ -6919,6 +6919,76 @@
}
],
"time": "2025-06-12T13:34:04+00:00"
+ },
+ {
+ "name": "zoujingli/ip2region",
+ "version": "v3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zoujingli/ip2region.git",
+ "reference": "fd31d7a023f28f4e2f3e63f46f1fd51f8b2672f6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zoujingli/ip2region/zipball/fd31d7a023f28f4e2f3e63f46f1fd51f8b2672f6",
+ "reference": "fd31d7a023f28f4e2f3e63f46f1fd51f8b2672f6",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4"
+ },
+ "suggest": {
+ "ext-opcache": "启用 OPcache 以获得更好的性能"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0.x-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "ip2region.php"
+ ],
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "Anyon",
+ "email": "zoujingli@qq.com",
+ "homepage": "https://thinkadmin.top"
+ }
+ ],
+ "description": "Ip2Region v3.0 for PHP - 企业级 IP 地理位置查询库,支持 IPv4/IPv6,分片文件管理,智能缓存,零依赖",
+ "homepage": "https://github.com/zoujingli/Ip2Region",
+ "keywords": [
+ "IP",
+ "IP定位",
+ "Ip2Region",
+ "geoip",
+ "geolocation",
+ "ipv4",
+ "ipv6",
+ "location",
+ "企业级",
+ "分片数据库",
+ "压缩",
+ "地理位置",
+ "地理位置查询",
+ "缓存",
+ "高性能"
+ ],
+ "support": {
+ "issues": "https://github.com/zoujingli/ip2region/issues",
+ "source": "https://github.com/zoujingli/ip2region/tree/v3.0.0"
+ },
+ "time": "2025-09-15T12:27:22+00:00"
}
],
"packages-dev": [],
diff --git a/config/route.php b/config/route.php
index c49f9dc..11631e4 100644
--- a/config/route.php
+++ b/config/route.php
@@ -194,6 +194,11 @@ Route::group('/admin', function () {
Route::any('/update/sign', [app\admin\controller\UserController::class, 'updateSign']);
});
+ // 询单
+ Route::group('/inquiry/transmit', function () {
+ Route::any('/form', [app\admin\controller\TransmitController::class, 'form']);
+ });
+
// 询单
Route::group('/inquiry', function () {
Route::any('/list', [app\inquiry\controller\InquiryLogController::class, 'index']);