commit 74f9f2b228f44cf4b6c674acc9ae78e518a56104
Author: gaofeng <1212121@qq.com>
Date: Fri Oct 30 13:31:25 2026 +0800
初始化 EVUS 项目并统一首页及业务页面样式
diff --git a/.example.env b/.example.env
new file mode 100644
index 0000000..a998ba3
--- /dev/null
+++ b/.example.env
@@ -0,0 +1,10 @@
+APP_DEBUG = true
+DB_TYPE = mysql
+DB_HOST = 127.0.0.1
+DB_NAME = test
+DB_USER = username
+DB_PASS = password
+DB_PORT = 3306
+DB_CHARSET = utf8
+
+DEFAULT_LANG = zh-cn
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5a00b59
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+/.idea
+/doc
+/runtime
+/data
+/.codegraph
+/.serena
\ No newline at end of file
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..e69de29
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..36f7b6f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,42 @@
+sudo: false
+
+language: php
+
+branches:
+ only:
+ - stable
+
+cache:
+ directories:
+ - $HOME/.composer/cache
+
+before_install:
+ - composer self-update
+
+install:
+ - composer install --no-dev --no-interaction --ignore-platform-reqs
+ - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
+ - composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
+ - composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
+ - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
+
+script:
+ - php think unit
+
+deploy:
+ provider: releases
+ api_key:
+ secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
+ file:
+ - ThinkPHP_Core.zip
+ - ThinkPHP_Full.zip
+ skip_cleanup: true
+ on:
+ tags: true
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..8d94897
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,32 @@
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+版权所有Copyright © 2006-2025 by ThinkPHP (http://thinkphp.cn)
+All rights reserved。
+ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
+
+Apache Licence是著名的非盈利开源组织Apache采用的协议。
+该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
+允许代码修改,再作为开源或商业软件发布。需要满足
+的条件:
+1. 需要给代码的用户一份Apache Licence ;
+2. 如果你修改了代码,需要在被修改的文件中说明;
+3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
+带有原来代码中的协议,商标,专利声明和其他原来作者规
+定需要包含的说明;
+4. 如果再发布的产品中包含一个Notice文件,则在Notice文
+件中需要带有本协议内容。你可以在Notice中增加自己的
+许可,但不可以表现为对Apache Licence构成更改。
+具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a316e2e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,92 @@
+
+
+ThinkPHP 8
+===============
+
+## 当前项目本地运行
+
+在项目的 `public` 目录启动完整应用,首页及菜单内页都通过 ThinkPHP 路由访问:
+
+```powershell
+Set-Location D:\itswork\evus.acvisa.com\public
+& 'D:\ruanjian\phpstudy\Extensions\php\php8.2.9nts\php.exe' -S 127.0.0.1:8765 -t . router.php
+```
+
+打开 `http://127.0.0.1:8765/`。如果该端口已有本项目服务运行,直接访问即可。
+
+站点配置域名在 `app/home/controller/Base.php` 中指定,当前使用 `evus.acvisa.cn`。首次访问会获取配置并缓存到已忽略版本控制的 `data/config.json`;修改配置域名后需同步刷新该缓存。
+
+`runtime/preview-router.php` 仅用于首页静态样式预览,不提供登记、查询、登录等菜单页面。需要浏览完整网站时,请使用上面的正式应用入口。完整应用会连接已配置的业务后台,本地测试不要提交真实登记或支付。
+
+## 特性
+
+* 基于PHP`8.0+`重构
+* 升级`PSR`依赖
+* 依赖`think-orm`3.0+版本
+* 全新的`think-dumper`服务,支持远程调试
+* 支持`6.0`/`6.1`无缝升级
+
+> ThinkPHP8的运行环境要求PHP8.0+
+
+现在开始,你可以使用官方提供的[ThinkChat](https://chat.topthink.com/),让你在学习ThinkPHP的旅途中享受私人AI助理服务!
+
+
+
+ThinkPHP生态服务由[顶想云](https://www.topthink.com)(TOPThink Cloud)提供,为生态提供专业的开发者服务和价值之选。
+
+## 文档
+
+[完全开发手册](https://doc.thinkphp.cn)
+
+
+## 赞助
+
+全新的[赞助计划](https://www.thinkphp.cn/sponsor)可以让你通过我们的网站、手册、欢迎页及GIT仓库获得巨大曝光,同时提升企业的品牌声誉,也更好保障ThinkPHP的可持续发展。
+
+[](https://www.thinkphp.cn/sponsor/special)
+
+[](https://www.thinkphp.cn/sponsor)
+
+## 安装
+
+~~~
+composer create-project topthink/think tp
+~~~
+
+启动服务
+
+~~~
+cd tp
+php think run
+~~~
+
+然后就可以在浏览器中访问
+
+~~~
+http://localhost:8000
+~~~
+
+如果需要更新框架使用
+~~~
+composer update topthink/framework
+~~~
+
+## 命名规范
+
+`ThinkPHP`遵循PSR-2命名规范和PSR-4自动加载规范。
+
+## 参与开发
+
+直接提交PR或者Issue即可
+
+## 版权信息
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+
+本项目包含的第三方源码和二进制文件之版权信息另行标注。
+
+版权所有Copyright © 2006-2024 by ThinkPHP (http://thinkphp.cn) All rights reserved。
+
+ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
+
+更多细节参阅 [LICENSE.txt](LICENSE.txt)
diff --git a/app/.htaccess b/app/.htaccess
new file mode 100644
index 0000000..3418e55
--- /dev/null
+++ b/app/.htaccess
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/app/AppService.php b/app/AppService.php
new file mode 100644
index 0000000..96556e8
--- /dev/null
+++ b/app/AppService.php
@@ -0,0 +1,22 @@
+app = $app;
+ $this->request = $this->app->request;
+
+ // 控制器初始化
+ $this->initialize();
+ }
+
+ // 初始化
+ protected function initialize()
+ {}
+
+ /**
+ * 验证数据
+ * @access protected
+ * @param array $data 数据
+ * @param string|array $validate 验证器名或者验证规则数组
+ * @param array $message 提示信息
+ * @param bool $batch 是否批量验证
+ * @return array|string|true
+ * @throws ValidateException
+ */
+ protected function validate(array $data, string|array $validate, array $message = [], bool $batch = false)
+ {
+ if (is_array($validate)) {
+ $v = new Validate();
+ $v->rule($validate);
+ } else {
+ if (strpos($validate, '.')) {
+ // 支持场景
+ [$validate, $scene] = explode('.', $validate);
+ }
+ $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
+ $v = new $class();
+ if (!empty($scene)) {
+ $v->scene($scene);
+ }
+ }
+
+ $v->message($message);
+
+ // 是否批量验证
+ if ($batch || $this->batchValidate) {
+ $v->batch(true);
+ }
+
+ return $v->failException(true)->check($data);
+ }
+
+}
diff --git a/app/ExceptionHandle.php b/app/ExceptionHandle.php
new file mode 100644
index 0000000..453d126
--- /dev/null
+++ b/app/ExceptionHandle.php
@@ -0,0 +1,58 @@
+where(['order_sn' => $order_sn])->where('order_status','in',[1, 3])->find();
+ if (empty($data)) {
+ return;
+ }
+ $url = 'https://manage.evus.cn/home.php?s=msg/send/id/' . $data['id'] . '.html';
+
+ Httpcurl::request($url, 'get', '', [], 3);
+ return;
+}
\ No newline at end of file
diff --git a/app/event.php b/app/event.php
new file mode 100644
index 0000000..e9851bb
--- /dev/null
+++ b/app/event.php
@@ -0,0 +1,17 @@
+ [
+ ],
+
+ 'listen' => [
+ 'AppInit' => [],
+ 'HttpRun' => [],
+ 'HttpEnd' => [],
+ 'LogLevel' => [],
+ 'LogWrite' => [],
+ ],
+
+ 'subscribe' => [
+ ],
+];
diff --git a/app/home/common.php b/app/home/common.php
new file mode 100644
index 0000000..364d7b0
--- /dev/null
+++ b/app/home/common.php
@@ -0,0 +1,575 @@
+ $value) {
+ $entry = [];
+ foreach ($fields as $field) {
+ $entry[$field] = isset($postData[$field][$index]) ? $postData[$field][$index] : null;
+ }
+ $data[] = $entry;
+ }
+
+ $postData[$kew_key] = json_encode($data, JSON_UNESCAPED_UNICODE);
+ foreach ($fields as $field) {
+ unset($postData[$field]);
+ }
+
+ return $postData;
+}
+
+function find_json($json_name, $field, $field_value)
+{
+ $data = file_get_contents($json_name);
+ $data_arr = json_decode($data, true);
+ $found = array_filter($data_arr, function ($item) use ($field, $field_value) {
+ return $item[$field] === $field_value;
+ });
+ // 输出结果
+ if ($found) {
+ $found = array_values($found); // 获取过滤后的第一个元素
+ return $found;
+ } else {
+ return false;
+ }
+}
+
+function getNameById($json_name, $id)
+{
+ $data = file_get_contents('./json/' . $json_name . '.json');
+ $data_arr = json_decode($data, true);
+ foreach ($data_arr as $item) {
+ if (array_key_exists('data', $item['data'])) {
+ foreach ($item['data']['data'] as $dataItem) {
+ if ($dataItem['id'] === $id) {
+ return $dataItem['name'];
+ }
+ }
+ }
+ }
+ return null;
+}
+
+function getIdByName($json_name, $id)
+{
+ $data = file_get_contents('./json/' . $json_name . '.json');
+ $data_arr = json_decode($data, true);
+ foreach ($data_arr as $item) {
+ if (array_key_exists('data', $item['data'])) {
+ foreach ($item['data']['data'] as $dataItem) {
+ if ($dataItem['name'] === $id) {
+ return $dataItem['id'];
+ }
+ }
+ }
+ }
+ return null;
+}
+
+function isMobile()
+{
+ $_SERVER['ALL_HTTP'] = isset($_SERVER['ALL_HTTP']) ? $_SERVER['ALL_HTTP'] : '';
+
+ if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|iphone|ipad|ipod|android|xoom)/i',
+ strtolower($_SERVER['HTTP_USER_AGENT']))) {
+ return true;
+ }
+ if ((isset($_SERVER['HTTP_ACCEPT'])) and (strpos(strtolower($_SERVER['HTTP_ACCEPT']),
+ 'application/vnd.wap.xhtml+xml') !== false)) {
+ return true;
+ }
+ if (isset($_SERVER['HTTP_X_WAP_PROFILE'])) {
+ return true;
+ }
+ if (isset($_SERVER['HTTP_PROFILE'])) {
+ return true;
+ }
+ $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4));
+ $mobile_agents = array(
+ 'w3c ',
+ 'acs-',
+ 'alav',
+ 'alca',
+ 'amoi',
+ 'audi',
+ 'avan',
+ 'benq',
+ 'bird',
+ 'blac',
+ 'blaz',
+ 'brew',
+ 'cell',
+ 'cldc',
+ 'cmd-',
+ 'dang',
+ 'doco',
+ 'eric',
+ 'hipt',
+ 'inno',
+ 'ipaq',
+ 'java',
+ 'jigs',
+ 'kddi',
+ 'keji',
+ 'leno',
+ 'lg-c',
+ 'lg-d',
+ 'lg-g',
+ 'lge-',
+ 'maui',
+ 'maxo',
+ 'midp',
+ 'mits',
+ 'mmef',
+ 'mobi',
+ 'mot-',
+ 'moto',
+ 'mwbp',
+ 'nec-',
+ 'newt',
+ 'noki',
+ 'oper',
+ 'palm',
+ 'pana',
+ 'pant',
+ 'phil',
+ 'play',
+ 'port',
+ 'prox',
+ 'qwap',
+ 'sage',
+ 'sams',
+ 'sany',
+ 'sch-',
+ 'sec-',
+ 'send',
+ 'seri',
+ 'sgh-',
+ 'shar',
+ 'sie-',
+ 'siem',
+ 'smal',
+ 'smar',
+ 'sony',
+ 'sph-',
+ 'symb',
+ 't-mo',
+ 'teli',
+ 'tim-',
+ 'tosh',
+ 'tsm-',
+ 'upg1',
+ 'upsi',
+ 'vk-v',
+ 'voda',
+ 'wap-',
+ 'wapa',
+ 'wapi',
+ 'wapp',
+ 'wapr',
+ 'webc',
+ 'winw',
+ 'winw',
+ 'xda',
+ 'xda-'
+ );
+ if (in_array($mobile_ua, $mobile_agents)) {
+ return true;
+ }
+ if (strpos(strtolower($_SERVER['ALL_HTTP']), 'operamini') !== false) {
+ return true;
+ }
+ // Pre-final check to reset everything if the user is on Windows
+ if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows') !== false) {
+ return false;
+ }
+ // But WP7 is also Windows, with a slightly different characteristic
+ if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows phone') !== false) {
+ return true;
+ }
+ return false;
+}
+
+function getOrderNumber()
+{
+ return date('YmdHis') . mt_rand(10, 99);
+}
+
+function cmf_get_current_user_id()
+{
+ $sessionUserId = session('user.id');
+ if (empty($sessionUserId)) {
+ return 0;
+ }
+ return $sessionUserId;
+
+}
+function getIP()
+{
+ $realip = '';
+ $unknown = 'unknown';
+ if (isset($_SERVER)){
+ if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) && strcasecmp($_SERVER['HTTP_X_FORWARDED_FOR'], $unknown)){
+ $arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
+ foreach($arr as $ip){
+ $ip = trim($ip);
+ if ($ip != 'unknown'){
+ $realip = $ip;
+ break;
+ }
+ }
+ }else if(isset($_SERVER['HTTP_CLIENT_IP']) && !empty($_SERVER['HTTP_CLIENT_IP']) && strcasecmp($_SERVER['HTTP_CLIENT_IP'], $unknown)){
+ $realip = $_SERVER['HTTP_CLIENT_IP'];
+ }else if(isset($_SERVER['REMOTE_ADDR']) && !empty($_SERVER['REMOTE_ADDR']) && strcasecmp($_SERVER['REMOTE_ADDR'], $unknown)){
+ $realip = $_SERVER['REMOTE_ADDR'];
+ }else{
+ $realip = $unknown;
+ }
+ }else{
+ if(getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), $unknown)){
+ $realip = getenv("HTTP_X_FORWARDED_FOR");
+ }else if(getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), $unknown)){
+ $realip = getenv("HTTP_CLIENT_IP");
+ }else if(getenv('REMOTE_ADDR') && strcasecmp(getenv('REMOTE_ADDR'), $unknown)){
+ $realip = getenv("REMOTE_ADDR");
+ }else{
+ $realip = $unknown;
+ }
+ }
+ $realip = preg_match("/[\d\.]{7,15}/", $realip, $matches) ? $matches[0] : $unknown;
+ return $realip;
+}
+function build_ocr_signature(string $appId, string $secret, ?int $timestamp = null): array
+{
+ $timestamp = $timestamp ?? time();
+ $signString = $appId . "\n" . (string)$timestamp;
+ $signature = hash_hmac('sha256', $signString, $secret);
+
+ return [
+ 'app_id' => $appId,
+ 'timestamp' => (string)$timestamp,
+ 'signature' => $signature,
+ 'base_url' => config('app.OCR_BASE_URL'),
+ ];
+}
+// 这是系统自动生成的公共文件
+
+function arrayToJson($params, $values)
+{
+
+ $datas = [];
+ $count = count($values[0]);
+ $valcount = count($params);
+ for ($i = 0; $i < $count; $i++) {
+ for ($j = 0; $j < $valcount; $j++) {
+ $data[$params[$j]] = $values[$j][$i];
+ }
+ $datas[] = $data;
+ }
+ if (empty($datas)) {
+ return '';
+ }
+ return json_encode($datas);
+}
+
+function getCate($val)
+{
+ $cates = explode('-', $val);
+ if (count($cates) == 1) {
+ if ($val == 'CNMI') {
+ return 'CW/E2C';
+ }
+ } else {
+ preg_match_all('/[A-Z]+/', $val, $matches);
+ return $matches[0][0];
+ }
+
+
+}
+//非常给力的authcode加密函数,Discuz!经典代码(带详解)
+function authcode($string, $operation = 'DECODE', $key = '20241021', $expiry = 0)
+{
+ // 动态密匙长度,相同的明文会生成不同密文就是依靠动态密匙
+ $ckey_length = 4;
+
+ // 密匙
+ $key = md5($key ? $key : $GLOBALS['discuz_auth_key']);
+
+ // 密匙a会参与加解密
+ $keya = md5(substr($key, 0, 16));
+ // 密匙b会用来做数据完整性验证
+ $keyb = md5(substr($key, 16, 16));
+ // 密匙c用于变化生成的密文
+ $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length) : substr(md5(microtime()), -$ckey_length)) : '';
+ // 参与运算的密匙
+ $cryptkey = $keya . md5($keya . $keyc);
+ $key_length = strlen($cryptkey);
+ // 明文,前10位用来保存时间戳,解密时验证数据有效性,10到26位用来保存$keyb(密匙b),
+ //解密时会通过这个密匙验证数据完整性
+ // 如果是解码的话,会从第$ckey_length位开始,因为密文前$ckey_length位保存 动态密匙,以保证解密正确
+ $string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $keyb), 0, 16) . $string;
+ $string_length = strlen($string);
+ $result = '';
+ $box = range(0, 255);
+ $rndkey = array();
+ // 产生密匙簿
+ for ($i = 0; $i <= 255; $i++) {
+ $rndkey[$i] = ord($cryptkey[$i % $key_length]);
+ }
+ // 用固定的算法,打乱密匙簿,增加随机性,好像很复杂,实际上对并不会增加密文的强度
+ for ($j = $i = 0; $i < 256; $i++) {
+ $j = ($j + $box[$i] + $rndkey[$i]) % 256;
+ $tmp = $box[$i];
+ $box[$i] = $box[$j];
+ $box[$j] = $tmp;
+ }
+ // 核心加解密部分
+ for ($a = $j = $i = 0; $i < $string_length; $i++) {
+ $a = ($a + 1) % 256;
+ $j = ($j + $box[$a]) % 256;
+ $tmp = $box[$a];
+ $box[$a] = $box[$j];
+ $box[$j] = $tmp;
+ // 从密匙簿得出密匙进行异或,再转成字符
+ $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
+ }
+ if ($operation == 'DECODE') {
+ // 验证数据有效性,请看未加密明文的格式
+ if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16)) {
+ return substr($result, 26);
+ } else {
+ return '';
+ }
+ } else {
+ // 把动态密匙保存在密文里,这也是为什么同样的明文,生产不同密文后能解密的原因
+ // 因为加密后的密文可能是一些特殊字符,复制过程可能会丢失,所以用base64编码
+ return $keyc . str_replace('=', '', base64_encode($result));
+ }
+}
+function getChineseCode($code)
+{
+ $url = "http://code.mcdvisa.com/save.php?action=getcode&i=0&w={$code}";
+ $data = file_get_contents($url);
+ if (empty($data)){
+ return [
+ 'code'=>0,
+ 'data'=>[]
+ ];
+ }
+// 创建 DOMDocument 对象并加载 HTML
+ $dom = new DOMDocument();
+ libxml_use_internal_errors(true); // 抑制 HTML 解析错误
+ $dom->loadHTML($data);
+ libxml_clear_errors();
+ // 获取所有的
元素
+ $lis = $dom->getElementsByTagName('li');
+ $pattern = '/-?\d+(?:\.\d+)?/';
+ $datas=[];
+ foreach ($lis as $li) {
+ $text = $li->textContent;
+ preg_match_all($pattern, $text, $matches);
+ $datas[] = $matches[0][0];
+ }
+ return [
+ 'code'=>200,
+ 'data'=>$datas
+ ];
+}
+/**
+ * 查询姓名电码。
+ * @param string $fullName 中文全名
+ * @param int $surnameLength 姓氏字数:单姓 1,复姓 2
+ * 依赖第三方网页结构;失败时抛出异常,由调用方转换为用户提示。
+ */
+function queryNameTelecode(string $fullName, int $surnameLength = 1): array
+{
+ $fullName = trim($fullName);
+ $length = mb_strlen($fullName, 'UTF-8');
+
+ if (!preg_match('/^\p{Han}+$/u', $fullName) || $length > 8) {
+ throw new InvalidArgumentException('请输入不超过 8 个汉字的姓名');
+ }
+
+ if ($surnameLength < 1 || $surnameLength >= $length) {
+ throw new InvalidArgumentException('姓氏字数必须小于姓名总字数');
+ }
+
+ if (!extension_loaded('curl') || !extension_loaded('dom')) {
+ throw new RuntimeException('电码查询服务未就绪,请手动填写或联系管理员');
+ }
+
+ $url = 'https://apps.chasedream.com/chinese-commercial-code/';
+ // 两次请求共用一个时间预算,避免每次都等待完整超时时间。
+ $deadline = hrtime(true) + 15 * 1000000000;
+ $curl = curl_init($url);
+
+ if ($curl === false) {
+ throw new RuntimeException('无法初始化 cURL');
+ }
+
+ curl_setopt_array($curl, [
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_CONNECTTIMEOUT => 5,
+ CURLOPT_TIMEOUT => 15,
+ CURLOPT_COOKIEFILE => '', // 内存 Cookie,会话内复用
+ CURLOPT_USERAGENT => 'NameTelecodeLookup/1.0',
+ // 协商压缩响应并自动解压,减少两次查询的网络传输量。
+ CURLOPT_ENCODING => '',
+ ]);
+
+ $request = static function () use ($curl, $deadline): string {
+ $remainingMs = (int) floor(($deadline - hrtime(true)) / 1000000);
+ if ($remainingMs <= 0) {
+ throw new RuntimeException('电码查询超时,请稍后重试或手动填写');
+ }
+ curl_setopt($curl, CURLOPT_TIMEOUT_MS, $remainingMs);
+ $html = curl_exec($curl);
+
+ if ($html === false) {
+ throw new RuntimeException('电码查询连接失败或超时,请稍后重试或手动填写');
+ }
+
+ $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
+ if ($status !== 200) {
+ throw new RuntimeException('电码查询服务暂时不可用,请稍后重试或手动填写');
+ }
+
+ if (trim($html) === '') {
+ throw new RuntimeException('电码查询返回空内容,请稍后重试或手动填写');
+ }
+ return $html;
+ };
+
+ $parse = static function (string $html): DOMXPath {
+ $previous = libxml_use_internal_errors(true);
+
+ try {
+ $dom = new DOMDocument();
+ if (!$dom->loadHTML('' . $html)) {
+ throw new RuntimeException('无法解析网页');
+ }
+ return new DOMXPath($dom);
+ } finally {
+ libxml_clear_errors();
+ libxml_use_internal_errors($previous);
+ }
+ };
+
+ try {
+ // 获取本次页面的动态隐藏字段。
+ $xpath = $parse($request());
+ $payload = [];
+
+ foreach ($xpath->query(
+ '//form[@id="form1"]//input[@type="hidden"][@name]'
+ ) as $input) {
+ $payload[$input->getAttribute('name')] =
+ $input->getAttribute('value');
+ }
+
+ if (!isset($payload['__VIEWSTATE'])) {
+ throw new RuntimeException('查询页面结构发生变化');
+ }
+
+ $payload['txtInput'] = $fullName;
+ $payload['btnSearch'] = '查询';
+
+ curl_setopt_array($curl, [
+ CURLOPT_POST => true,
+ CURLOPT_POSTFIELDS => http_build_query($payload),
+ CURLOPT_REFERER => $url,
+ CURLOPT_HTTPHEADER => [
+ 'Content-Type: application/x-www-form-urlencoded',
+ ],
+ ]);
+
+ $xpath = $parse($request());
+ $mapping = [];
+
+ // 只接受“一个汉字 + 一个四位电码”的结果行。
+ foreach ($xpath->query('//table[@id="grvDict"]//tr') as $row) {
+ $characters = [];
+ $codes = [];
+
+ foreach ($xpath->query('./td', $row) as $cell) {
+ $text = trim($cell->textContent);
+
+ if (preg_match('/^\p{Han}$/u', $text)) {
+ $characters[] = $text;
+ } elseif (preg_match('/^[0-9]{4}$/', $text)) {
+ $codes[] = $text;
+ }
+ }
+
+ if (count($characters) === 1 && count($codes) === 1) {
+ $character = $characters[0];
+ $code = $codes[0];
+
+ if (isset($mapping[$character])
+ && $mapping[$character] !== $code) {
+ throw new RuntimeException("“{$character}”返回多个电码");
+ }
+
+ $mapping[$character] = $code;
+ }
+ }
+
+ $characters = preg_split('//u', $fullName, -1, PREG_SPLIT_NO_EMPTY);
+ $codes = [];
+
+ foreach ($characters as $character) {
+ if (!isset($mapping[$character])) {
+ throw new RuntimeException(
+ "未取得“{$character}”的电码,请人工核实或检查网页结构"
+ );
+ }
+ $codes[] = $mapping[$character];
+ }
+
+ return [
+ 'full_name' => $fullName,
+ 'surname' => mb_substr($fullName, 0, $surnameLength, 'UTF-8'),
+ 'given_name' => mb_substr($fullName, $surnameLength, null, 'UTF-8'),
+ 'surname_code' => implode('', array_slice($codes, 0, $surnameLength)),
+ 'given_name_code' => implode('', array_slice($codes, $surnameLength)),
+ 'full_code' => implode('', $codes),
+ 'characters' => $mapping,
+ ];
+ } finally {
+ curl_close($curl);
+ }
+}
\ No newline at end of file
diff --git a/app/home/controller/Base.php b/app/home/controller/Base.php
new file mode 100644
index 0000000..ab9ae81
--- /dev/null
+++ b/app/home/controller/Base.php
@@ -0,0 +1,165 @@
+param('source', '');
+ $sesson = Session::get('source');
+ if (empty($sesson)) {
+ $source = $source ?: SOURCE;
+ Session::set('source', $source);
+ }
+
+ // 获取 当前用户ID
+ $this->_userId = cmf_get_current_user_id();
+ // 网站配置信息获取
+ if (!file_exists(app()->getRootPath().'data/config.json')) {
+// $domain = $_SERVER['HTTP_HOST'];
+ $domain = "evus.acvisa.cn";
+ $web_config = Httpcurl::request(GET_WEB_CONFIG_URL . '/domain/' . $domain, 'get');
+
+ if ($web_config[3]) {
+ abort(500, '网站配置信息获取失败');
+ }
+ $config_result = json_decode($web_config[0], true);
+ if (empty($config_result)) {
+ abort(500, '网站配置信息获取失败');
+ }
+ if ($config_result['code'] != 1) {
+ abort(500, '网站配置信息获取失败');
+ }
+ file_put_contents(app()->getRootPath().'data/config.json', json_encode($config_result));
+ } else {
+ $config_result = json_decode(file_get_contents(app()->getRootPath().'data/config.json'), true);
+ }
+
+ Config::set(['domain' => $_SERVER['HTTP_HOST']], 'app');
+ Config::set(['EVUS_GOODS' => $config_result['data']['EVUS_GOODS']], 'app');
+ Config::set(['ESTA_GOODS' => $config_result['data']['ESTA_GOODS']], 'app');
+
+ /*语言切换*/
+ Lang::setLangSet(Cookie::get('think_var', 'zh-cn'));
+ /*语言切换*/
+ /*配置*/
+ Config::set(['wechatpay' => $config_result['data']['pay']['wechatpay']], 'app');
+ Config::set(['wechath5pay' => $config_result['data']['pay']['wechath5pay']], 'app');
+ Config::set(['wechatpcpay' => $config_result['data']['pay']['wechatpcpay']], 'app');
+ Config::set(['alipcpay' => $config_result['data']['pay']['alipcpay']], 'app');
+ Config::set(['pay_url' => $config_result['data']['pay']['pay_url']], 'app');
+ Config::set(['order_url' => $config_result['data']['order_url']], 'app');
+ Config::set(['user_url' => $config_result['data']['user_url']], 'app');
+ Config::set(['principals' => $config_result['data']['principals']], 'app');
+ Config::set(['get_evus_detail_url' => $config_result['data']['get_evus_detail_url']], 'app');
+ Config::set(['get_order_detail_url' => $config_result['data']['get_order_detail_url']], 'app');
+ Config::set(['download_evus_url' => $config_result['data']['download_evus_url']], 'app');
+ Config::set(['update_order_url' => $config_result['data']['update_order_url']], 'app');
+
+ /*ocr 识别 配置参数 */
+ Config::set(['OCR_BASE_URL' => $config_result['data']['ocr_base_url']], 'app');
+ Config::set(['OCR_APP_ID' => $config_result['data']['ocr_app_id']], 'app');
+ Config::set(['OCR_SECRET' => $config_result['data']['ocr_secret']], 'app');
+ Config::set(['LOOKUP_URL' => $config_result['data']['evus_look_url']], 'app');
+ $ocr_config = build_ocr_signature($config_result['data']['ocr_app_id'], $config_result['data']['ocr_secret']);
+ View::assign('ocr_config', json_encode($ocr_config));
+ View::assign('footer', $config_result['data']['footer']);
+ View::assign('phone', $config_result['data']['phone']);
+ View::assign('logo_icon', $config_result['data']['logo_icon']);
+ View::assign('logo', $config_result['data']['logo']);
+ View::assign('fapiao_kefu', $config_result['data']['fapiao_png']);
+ View::assign('order_kefu', $config_result['data']['visa_png']);
+ View::assign('invoice_url', $config_result['data']['invoice_url']);
+ View::assign('menu_url', strtolower(Request::controller() . '/' . Request::action()));
+ $this->assignSeo();
+ }
+
+ protected function assignSeo(array $overrides = []): void
+ {
+ $query = Request::instance()->get();
+ if (!is_array($query)) {
+ $query = [];
+ }
+
+ $seo = (new SeoMetaService())->forRoute(
+ 'home',
+ (string) Request::controller(),
+ (string) Request::action(),
+ $query,
+ $overrides
+ );
+
+ View::assign('seo', $seo);
+ View::assign('asset_version', (string) (config('app.asset_version') ?: '1'));
+ }
+
+ public function success($msg = '操作成功', $url = '', $data = [], $wait = 3)
+ {
+ if (is_null($url) && isset($_SERVER["HTTP_REFERER"])) {
+ $url = $_SERVER["HTTP_REFERER"];
+ } elseif ('' !== $url && is_object($url)) {
+ $url = $url->build();
+ }
+ if (request()->isAjax()) {
+ return json([
+ 'code' => 1,
+ 'msg' => $msg,
+ 'data' => $data,
+ 'url' => $url
+ ]);
+ } else {
+ return View::fetch('public/jump', [
+ 'msg' => $msg,
+ 'url' => $url,
+ 'wait' => $wait,
+ 'type' => 'success',
+ ]);
+ }
+ }
+
+ public function error($msg = '操作失败', $url = '', $wait = 3, $data = [])
+ {
+ if (is_null($url) && isset($_SERVER["HTTP_REFERER"])) {
+ $url = $_SERVER["HTTP_REFERER"];
+ } elseif ('' !== $url && is_object($url)) {
+ $url = $url->build();
+ }
+ if (request()->isAjax()) {
+ return json([
+ 'code' => 0,
+ 'msg' => $msg,
+ 'data' => $data,
+ 'url' => $url
+ ]);
+ } else {
+ return View::fetch('public/jump', [
+ 'msg' => $msg,
+ 'url' => $url,
+ 'wait' => $wait,
+ 'type' => 'error',
+ ]);
+ }
+ }
+}
diff --git a/app/home/controller/Company.php b/app/home/controller/Company.php
new file mode 100644
index 0000000..6a10421
--- /dev/null
+++ b/app/home/controller/Company.php
@@ -0,0 +1,14 @@
+error('价格错误');
+ }
+ /*判断价格是否正确*/
+ $_REQUEST['birth_date_day'] = (string)date_parse($_REQUEST['birth_date'])['day'] ?:'0';
+ $_REQUEST['birth_date_month'] = (string)date_parse($_REQUEST['birth_date'])['month'] ?:'0';
+ $_REQUEST['birth_date_year'] = (string)date_parse($_REQUEST['birth_date'])['year'] ?:'0';
+
+ $_REQUEST['passport_expedition_date_day'] = (string)date_parse($_REQUEST['passport_expedition_date'])['day'] ?:'';
+ $_REQUEST['passport_expedition_date_month'] = (string)date_parse($_REQUEST['passport_expedition_date'])['month'] ?:'';
+ $_REQUEST['passport_expedition_date_year'] = (string)date_parse($_REQUEST['passport_expedition_date'])['year'] ?:'';
+
+ $_REQUEST['passport_expiration_date_day'] = (string)date_parse($_REQUEST['passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['passport_expiration_date_month'] = (string)date_parse($_REQUEST['passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['passport_expiration_date_year'] = (string)date_parse($_REQUEST['passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_passport_issue_date_day'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['day'] ?:'';
+ $_REQUEST['us_visa_passport_issue_date_month'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['month'] ?:'';
+ $_REQUEST['us_visa_passport_issue_date_year'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_passport_expiration_date_day'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['us_visa_passport_expiration_date_month'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['us_visa_passport_expiration_date_year'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_birth_date_day'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['day'] ?:'';
+ $_REQUEST['us_visa_birth_date_month'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['month'] ?:'';
+ $_REQUEST['us_visa_birth_date_year'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['year'] ?:'';
+
+ $_REQUEST = formDataToJson(['vist_country', 'vist_from_date', 'vist_end_date', 'vist_country_des'], $_REQUEST, 'vistitem', 'question_i');
+
+ $_REQUEST['other_country_acquired_other'] = isset($_REQUEST['other_country_acquired_other']) ? $_REQUEST['other_country_acquired_other'] : '';
+ $_REQUEST['source'] = Session::get('source' );
+ $_REQUEST['is_mobile'] = isMobile() ? 1 : 0;
+ $_REQUEST['total_price'] = $total_price;
+ $_REQUEST['origin_price'] = $total_price;
+ $_REQUEST['ip'] = getIP();
+ $_REQUEST['coupon_code'] = isset($_REQUEST['coupon_code']) ? $_REQUEST['coupon_code']: '';
+ $_REQUEST['model'] = MODEL;
+ $_REQUEST['token'] = md5(MODEL);
+
+ $order_res = Httpcurl::request(CREATE_EVUS_ORDER_URL, 'post', $_REQUEST);
+ Log::info(json_encode($order_res));
+ $order = json_decode($order_res[0], true);
+ if (!$order['code']) {
+ return $this->error("提交失败,请联系管理员!");
+ }
+ if ($order['is_pay'] == 1) {
+ return $this->success('操作成功', url('home/pay/succ', ['order_sn' => $order_sn])->build());
+ }
+ return $this->success('操作成功', url('home/pay/index', ['order_sn' => $order_sn])->build());
+ }
+
+
+ public function wxminievus()
+ {
+ $openid = input('openid');
+ if (empty($openid)) {
+ return $this->error('请先授权登录');
+ }
+ $user_id = input('user_id');
+ if (empty($user_id)) {
+ return $this->error('请先授权登录');
+ }
+ $price = input('price');
+ $price = $price * 100;
+ /*判断价格是否正确*/
+ $config_price = array_map(function($item) {
+ return $item['value'];
+ }, config('app.EVUS_GOODS'));
+ if (!in_array($price, $config_price)) {
+ return $this->error('价格错误');
+ }
+ View::assign('openid', $openid);
+ View::assign('user_id', $user_id);
+ View::assign('price', $price);
+ View::assign('country_list', json_decode(file_get_contents('./json/country.json'), true));
+ View::assign('phone_prefix', json_decode(file_get_contents('./json/phone_prefix.json'), true));
+ View::assign('us', json_decode(file_get_contents('./json/us.json'), true));
+ View::assign('goods', config('app.EVUS_GOODS'));
+ View::assign('ismobile', isMobile() ? 1 : 0);
+ return View::fetch();
+
+ }
+ public function applyminievus()
+ {
+ $openid = input('openid');
+ if (empty($openid)) {
+ return $this->error('请先授权登录');
+ }
+ $user_id = input('user_id');
+ if (empty($user_id)) {
+ return $this->error('请先授权登录');
+ }
+ $user_id = authcode($user_id);
+ if (!is_numeric($user_id)) {
+ return $this->error('请先授权登录');
+ }
+ unset($_REQUEST['s']);
+ unset($_REQUEST['openid']);
+ $order_sn = $_REQUEST['order_sn'] = getOrderNumber();
+ $total_price = $_REQUEST['total_price'];
+ /*判断价格是否正确*/
+ $config_price = array_map(function($item) {
+ return $item['value'];
+ }, config('app.EVUS_GOODS'));
+ if (!in_array($total_price, $config_price)) {
+ return $this->error('价格错误');
+ }
+ /*判断价格是否正确*/
+ $_REQUEST['birth_date_day'] = (string)date_parse($_REQUEST['birth_date'])['day'] ?:'0';
+ $_REQUEST['birth_date_month'] = (string)date_parse($_REQUEST['birth_date'])['month'] ?:'0';
+ $_REQUEST['birth_date_year'] = (string)date_parse($_REQUEST['birth_date'])['year'] ?:'0';
+
+ $_REQUEST['passport_expedition_date_day'] = (string)date_parse($_REQUEST['passport_expedition_date'])['day'] ?:'';
+ $_REQUEST['passport_expedition_date_month'] = (string)date_parse($_REQUEST['passport_expedition_date'])['month'] ?:'';
+ $_REQUEST['passport_expedition_date_year'] = (string)date_parse($_REQUEST['passport_expedition_date'])['year'] ?:'';
+
+ $_REQUEST['passport_expiration_date_day'] = (string)date_parse($_REQUEST['passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['passport_expiration_date_month'] = (string)date_parse($_REQUEST['passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['passport_expiration_date_year'] = (string)date_parse($_REQUEST['passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_passport_issue_date_day'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['day'] ?:'';
+ $_REQUEST['us_visa_passport_issue_date_month'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['month'] ?:'';
+ $_REQUEST['us_visa_passport_issue_date_year'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_passport_expiration_date_day'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['us_visa_passport_expiration_date_month'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['us_visa_passport_expiration_date_year'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_birth_date_day'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['day'] ?:'';
+ $_REQUEST['us_visa_birth_date_month'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['month'] ?:'';
+ $_REQUEST['us_visa_birth_date_year'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['year'] ?:'';
+
+ $_REQUEST = formDataToJson(['vist_country', 'vist_from_date', 'vist_end_date', 'vist_country_des'], $_REQUEST, 'vistitem', 'question_i');
+
+ $_REQUEST['other_country_acquired_other'] = isset($_REQUEST['other_country_acquired_other']) ? $_REQUEST['other_country_acquired_other'] : '';
+ $_REQUEST['source'] = 'qlwxmini';
+ $_REQUEST['is_mobile'] = isMobile() ? 1 : 0;
+ $_REQUEST['total_price'] = $total_price;
+ $_REQUEST['origin_price'] = $total_price;
+ $_REQUEST['ip'] = getIP();
+ $_REQUEST['coupon_code'] = isset($_REQUEST['coupon_code']) ? $_REQUEST['coupon_code']: '';
+ $_REQUEST['model'] = MODEL;
+ $_REQUEST['token'] = md5(MODEL);
+
+ $order_res = Httpcurl::request(CREATE_EVUS_ORDER_URL, 'post', $_REQUEST);
+ Log::info(json_encode($order_res));
+ $order = json_decode($order_res[0], true);
+ if (!$order['code']) {
+ return $this->error("提交失败,请联系管理员!");
+ }
+ $order_url = 'https://pay.qlevisa.com/home/pay/miniwxevuspay';
+ $response = Httpcurl::request($order_url, 'post', ['order_sn' => $order_sn, 'body' => 'evus登记签证服务费', 'money' => $total_price, 'openid' => $openid, 'attach' => 'msg']);
+ if ($response[3]) {
+ return json([
+ 'code' => 0,
+ 'msg' => '异常错误,请重新提交',
+ ]);
+ }
+ $pay_result = json_decode($response[0], true);
+ if (empty($pay_result)) {
+ return json([
+ 'code' => 0,
+ 'msg' => '异常错误,请重新提交',
+ ]);
+ }
+ if ($pay_result['code'] !== 200) {
+ return json([
+ 'code' => 0,
+ 'msg' => $pay_result['msg'],
+ ]);
+ }
+ $pay_result['data']['package'] = urlencode($pay_result['data']['package']);
+ return json([
+ 'code' => 1,
+ 'msg' => '提交成功',
+ 'data' => $pay_result['data']
+ ]);
+ }
+}
diff --git a/app/home/controller/Esta.php b/app/home/controller/Esta.php
new file mode 100644
index 0000000..cdbd3fc
--- /dev/null
+++ b/app/home/controller/Esta.php
@@ -0,0 +1,201 @@
+error('价格错误');
+ }
+ /*判断价格是否正确*/
+
+ $_REQUEST['birth_date_day'] = (string)date_parse($_REQUEST['birth_date'])['day'] ?:'0';
+ $_REQUEST['birth_date_month'] = (string)date_parse($_REQUEST['birth_date'])['month'] ?:'0';
+ $_REQUEST['birth_date_year'] = (string)date_parse($_REQUEST['birth_date'])['year'] ?:'0';
+
+ $_REQUEST['passport_expedition_date_day'] = (string)date_parse($_REQUEST['passport_expedition_date'])['day'] ?:'';
+ $_REQUEST['passport_expedition_date_month'] = (string)date_parse($_REQUEST['passport_expedition_date'])['month'] ?:'';
+ $_REQUEST['passport_expedition_date_year'] = (string)date_parse($_REQUEST['passport_expedition_date'])['year'] ?:'';
+
+ $_REQUEST['passport_expiration_date_day'] = (string)date_parse($_REQUEST['passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['passport_expiration_date_month'] = (string)date_parse($_REQUEST['passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['passport_expiration_date_year'] = (string)date_parse($_REQUEST['passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['other_country_date_day'] = (string)date_parse($_REQUEST['other_country_date'])['day'] ?:'';
+ $_REQUEST['other_country_date_month'] = (string)date_parse($_REQUEST['other_country_date'])['month'] ?:'';
+ $_REQUEST['other_country_date_year'] = (string)date_parse($_REQUEST['other_country_date'])['year'] ?:'';
+ unset($_REQUEST['other_country_date']);
+
+ $_REQUEST['other_country_edate_day'] = (string)date_parse($_REQUEST['other_country_edate'])['day'] ?:'';
+ $_REQUEST['other_country_edate_month'] = (string)date_parse($_REQUEST['other_country_edate'])['month'] ?:'';
+ $_REQUEST['other_country_edate_year'] = (string)date_parse($_REQUEST['other_country_edate'])['year'] ?:'';
+ unset($_REQUEST['other_country_edate']);
+
+ $_REQUEST['ip'] = getIP();
+ $_REQUEST['source'] = Session::get('source' );
+ $_REQUEST['total_price'] = $total_price;
+ $_REQUEST['model'] = ESTA_MODEL;
+ $_REQUEST['token'] = md5(ESTA_MODEL);
+ $_REQUEST['other_country_acquired_other'] = isset($_REQUEST['other_country_acquired_other']) ? $_REQUEST['other_country_acquired_other'] : '';
+
+
+ $order_res = Httpcurl::request(CREATE_ORDER_URL, 'post', $_REQUEST);
+ Log::info(json_encode($order_res));
+ $order = json_decode($order_res[0], true);
+ if (!$order['code']) {
+ return $this->error("提交失败,请联系管理员!");
+ }
+ return $this->success('操作成功', url('home/payesta/index', ['order_sn' => $order_sn])->build());
+ }
+ public function wxmini()
+ {
+ $openid = input('openid');
+ if (empty($openid)) {
+ return $this->error('请先授权登录');
+ }
+ $user_id = input('user_id');
+ if (empty($user_id)) {
+ return $this->error('请先授权登录');
+ }
+ $price = input('price');
+ $price = $price * 100;
+ /*判断价格是否正确*/
+ $config_price = array_map(function($item) {
+ return $item['value'];
+ }, config('app.ESTA_GOODS'));
+ if (!in_array($price, $config_price)) {
+ return $this->error('价格错误');
+ }
+ View::assign('openid', $openid);
+ View::assign('user_id', $user_id);
+ View::assign('price', $price);
+ View::assign('country_list', json_decode(file_get_contents('./json/country.json'), true));
+ View::assign('phone_prefix', json_decode(file_get_contents('./json/phone_prefix.json'), true));
+ View::assign('us', json_decode(file_get_contents('./json/us.json'), true));
+ View::assign('goods', config('app.ESTA_GOODS'));
+ View::assign('ismobile', isMobile() ? 1 : 0);
+ View::assign('ppt_sample_url', '/new/assets/images/shili.jpg');
+ View::assign('per_sample_url', '/new/assets/images/persion2.png');
+ return View::fetch();
+
+ }
+ public function applymini()
+ {
+ $openid = input('openid');
+ if (empty($openid)) {
+ return $this->error('请先授权登录');
+ }
+ $user_id = input('user_id');
+ if (empty($user_id)) {
+ return $this->error('请先授权登录');
+ }
+ $user_id = authcode($user_id);
+ if (!is_numeric($user_id)) {
+ return $this->error('请先授权登录');
+ }
+ unset($_REQUEST['s']);
+ unset($_REQUEST['openid']);
+ unset($_REQUEST['file']);
+ $order_sn = $_REQUEST['order_sn'] = getOrderNumber();
+ $total_price = $_REQUEST['total_price'];
+ /*判断价格是否正确*/
+ $config_price = array_map(function($item) {
+ return $item['value'];
+ }, config('app.ESTA_GOODS'));
+ if (!in_array($total_price, $config_price)) {
+ return $this->error('价格错误');
+ }
+ $_REQUEST['birth_date_day'] = (string)date_parse($_REQUEST['birth_date'])['day'] ?:'0';
+ $_REQUEST['birth_date_month'] = (string)date_parse($_REQUEST['birth_date'])['month'] ?:'0';
+ $_REQUEST['birth_date_year'] = (string)date_parse($_REQUEST['birth_date'])['year'] ?:'0';
+
+ $_REQUEST['passport_expedition_date_day'] = (string)date_parse($_REQUEST['passport_expedition_date'])['day'] ?:'';
+ $_REQUEST['passport_expedition_date_month'] = (string)date_parse($_REQUEST['passport_expedition_date'])['month'] ?:'';
+ $_REQUEST['passport_expedition_date_year'] = (string)date_parse($_REQUEST['passport_expedition_date'])['year'] ?:'';
+
+ $_REQUEST['passport_expiration_date_day'] = (string)date_parse($_REQUEST['passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['passport_expiration_date_month'] = (string)date_parse($_REQUEST['passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['passport_expiration_date_year'] = (string)date_parse($_REQUEST['passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['other_country_date_day'] = (string)date_parse($_REQUEST['other_country_date'])['day'] ?:'';
+ $_REQUEST['other_country_date_month'] = (string)date_parse($_REQUEST['other_country_date'])['month'] ?:'';
+ $_REQUEST['other_country_date_year'] = (string)date_parse($_REQUEST['other_country_date'])['year'] ?:'';
+ unset($_REQUEST['other_country_date']);
+
+ $_REQUEST['other_country_edate_day'] = (string)date_parse($_REQUEST['other_country_edate'])['day'] ?:'';
+ $_REQUEST['other_country_edate_month'] = (string)date_parse($_REQUEST['other_country_edate'])['month'] ?:'';
+ $_REQUEST['other_country_edate_year'] = (string)date_parse($_REQUEST['other_country_edate'])['year'] ?:'';
+ unset($_REQUEST['other_country_edate']);
+
+ $_REQUEST['ip'] = getIP();
+ $_REQUEST['source'] = 'qlwxmini';
+ $_REQUEST['total_price'] = $total_price;
+ $_REQUEST['model'] = ESTA_MODEL;
+ $_REQUEST['token'] = md5(ESTA_MODEL);
+ $_REQUEST['other_country_acquired_other'] = isset($_REQUEST['other_country_acquired_other']) ? $_REQUEST['other_country_acquired_other'] : '';
+
+
+ $order_res = Httpcurl::request(CREATE_ORDER_URL, 'post', $_REQUEST);
+ $order = json_decode($order_res[0], true);
+ if (!$order['code']) {
+ return $this->error("提交失败,请联系管理员!");
+ }
+ $order_url = 'https://pay.qlevisa.com/home/pay/miniwxevuspay';
+ $response = Httpcurl::request($order_url, 'post', ['order_sn' => $order_sn, 'body' => 'esta登记签证服务费', 'money' => $total_price, 'openid' => $openid, 'attach' => 'esta']);
+ if ($response[3]) {
+ return json([
+ 'code' => 0,
+ 'msg' => '异常错误,请重新提交',
+ ]);
+ }
+ $pay_result = json_decode($response[0], true);
+ if (empty($pay_result)) {
+ return json([
+ 'code' => 0,
+ 'msg' => '异常错误,请重新提交',
+ ]);
+ }
+ if ($pay_result['code'] !== 200) {
+ return json([
+ 'code' => 0,
+ 'msg' => $pay_result['msg'],
+ ]);
+ }
+ $pay_result['data']['package'] = urlencode($pay_result['data']['package']);
+ return json([
+ 'code' => 1,
+ 'msg' => '提交成功',
+ 'data' => $pay_result['data']
+ ]);
+ }
+}
diff --git a/app/home/controller/Help.php b/app/home/controller/Help.php
new file mode 100644
index 0000000..9e57b74
--- /dev/null
+++ b/app/home/controller/Help.php
@@ -0,0 +1,14 @@
+ 'article',
+ 'source_code' => DOMAIN,
+ 'page' => 1,
+ 'size' => 10,
+ ]);
+ $news_list = json_decode($news_list[0], true);
+ Log::info(json_encode($news_list));
+
+ if (!empty($news_list) && $news_list['code'] == 1) {
+ View::assign('data', $news_list['data']);
+ } else {
+ View::assign('data', []);
+ }
+
+ return View::fetch();
+ }
+ public function screen()
+ {
+ return View::fetch();
+ }
+ public function test()
+ {
+ $order_sn = '2026061008342768';
+ $wechaturl = 'https://pay.qlevisa.cn/home/bjqzpay/wechat';
+ $wechaturl .= '?order_sn=' . $order_sn . '&mark=qlmsg' . '&body=' . urlencode(COUNTRY . '服务费');
+ header('location:' . $wechaturl); // 跳转到 user/profile
+ exit;
+ }
+
+}
diff --git a/app/home/controller/Invoice.php b/app/home/controller/Invoice.php
new file mode 100644
index 0000000..910644e
--- /dev/null
+++ b/app/home/controller/Invoice.php
@@ -0,0 +1,89 @@
+param('order_sn');
+
+ if (empty($order_sn)) {
+ return $this->error('参数错误');
+ }
+ $order_url = config('app.get_evus_detail_url');
+ $response = Httpcurl::request($order_url, 'post', ['order_sn' => $order_sn, 'model' => MODEL]);
+ if ($response[3]) {
+ return $this->error('异常错误,请重新提交');
+ }
+ $pay_result = json_decode($response[0], true);
+ if (empty($pay_result)) {
+ return $this->error('异常错误,请重新提交');
+ }
+ Log::info(json_encode($pay_result));
+ if (!$pay_result['code']) {
+ return $this->error($pay_result['msg']);
+ }
+ $data = $pay_result['data'];
+ if (empty($data)) {
+ return $this->error('无此数据');
+ }
+ $total_price = $data['total_price'] ? $data['total_price'] : $data['origin_price'];
+ $data['total_price'] = ($total_price / 100) . "元";
+ return view('', [
+ 'data' => $data,
+ ]);
+
+ }
+
+ public function add_invoice()
+ {
+ $res = [
+ 'status' => 0,
+ 'msg' => '操作失败,请重新填写'
+ ];
+ unset($_REQUEST['s']);
+ $_REQUEST['invoiceType'] = INCOICETYPE;
+ $_REQUEST['model'] = MODEL;
+ $_REQUEST['principals'] = config('app.principals');
+ $_REQUEST['uid'] = $this->_userId;
+ $base_url = config('app.order_url');
+ $order_url = $base_url . 'add_invoice';
+ $response = Httpcurl::request($order_url, 'post', $_REQUEST);
+ if ($response[3]) {
+ return json($res);
+ }
+ $pay_result = json_decode($response[0], true);
+ Log::info(json_encode($pay_result));
+ if (empty($pay_result)) {
+ return json($res);
+ }
+ if (!$pay_result['code']) {
+ $res['msg'] = $pay_result['msg'];
+ return json($res);
+ }
+ $res['status'] = 1;
+ $res['msg'] = $pay_result['msg'];
+ $res['url'] = '/home/user/order';
+ return json($res);
+ }
+
+}
+
diff --git a/app/home/controller/Login.php b/app/home/controller/Login.php
new file mode 100644
index 0000000..5aed96f
--- /dev/null
+++ b/app/home/controller/Login.php
@@ -0,0 +1,110 @@
+request->post();
+ try {
+ $this->validate($param, ['mobile' => 'require'], ['mobile.require' => '手机号不能为空']);
+ } catch (ValidateException $e) {
+ return $this->error($e->getError());
+ }
+// $code = 1234;
+// $result['code'] = 1;
+ $code = mt_rand(1001, 9999);
+ //进行发送验证 走接口
+ $res = Httpcurl::request(YZM_URL, 'post', [
+ 'mobile' => $param['mobile'],
+ 'code' => $code,
+ ]);
+ $result = json_decode($res[0], true);
+ Log::info(json_encode($result));
+ if (!$result['code']) {
+ return $this->error('发送验证码失败');
+ }
+ // 进行记录
+ if ($result['code'] == 1) {
+ //把内容存入session
+ Session::set($param['mobile'] . '_code', $code);
+ Session::set($param['mobile'] . '_' . $code, time());
+ return $this->success('发送成功');
+ } else {
+ return $this->error('发送失败');
+ }
+
+ }
+
+ // 登录
+ public function dologin()
+ {
+ $param = $this->request->post();
+ try {
+ $this->validate($param, ['phone' => 'require', 'vercode' => 'require'], ['phone.require' => '手机号不能为空', 'vercode.require' => '验证码不能为空']);
+ } catch (ValidateException $e) {
+ return $this->error($e->getError());
+ }
+ $mobile = $param['phone'];
+ $code = $param['vercode'];
+ $res = 0;
+ $sms = Session::get($mobile . '_code');
+ if (empty($sms)) {
+ return $this->error('登录失败');
+ }
+ if ($sms != $code) {
+ return $this->error('验证码不正确');
+ }
+ $time = time();
+ $code_time = Session::get($mobile . '_' . $code);
+ //判断是否已经超时5分钟
+ if (($time - $code_time) > 300) {
+ Session::delete($mobile . '_code');
+ Session::delete($mobile . '_' . $code);
+ return $this->error('验证码超时,请重新发送');
+ }
+ //查询evus账号
+ $user_url = config('app.user_url');
+ $res = Httpcurl::request($user_url, 'post', [
+ 'model' => MODEL,
+ 'mobile' => $mobile,
+ ]);
+ $result = json_decode($res[0], true);
+ Log::info(json_encode($result));
+ if (!$result['code']) {
+ return $this->error('账号不存在');
+ }
+ //查询esta账号
+ $res = Httpcurl::request($user_url, 'post', [
+ 'model' => ESTA_MODEL,
+ 'mobile' => $mobile,
+ ]);
+ $result = json_decode($res[0], true);
+ Log::info(json_encode($result));
+ if (!$result['code']) {
+ return $this->error('账号不存在');
+ }
+ Session::set('user', $result['data']);
+ return $this->success('登录成功', url('user/order'));
+
+ }
+
+ public function logout()
+ {
+ Session::delete('user');
+ return redirect('/home/index');
+ }
+}
diff --git a/app/home/controller/Lookup.php b/app/home/controller/Lookup.php
new file mode 100644
index 0000000..b30d044
--- /dev/null
+++ b/app/home/controller/Lookup.php
@@ -0,0 +1,54 @@
+param();
+ $params = [
+ 'passportNum' => $data['passport_number'],
+ 'b1b2Num' => $data['visa_foil_number'],
+ 'surname' => $data['last_name'],
+ 'givenname' => $data['first_name'],
+ 'year_birthday' => (string)date_parse($data['birth_date'])['year'],
+ 'month_birthday' => (string)date_parse($data['birth_date'])['month'],
+ 'day_birthday' => (string)date_parse($data['birth_date'])['day'],
+ 'country_birth' => $data['country_birth'],
+ ];
+ $result = Httpcurl::request(config('app.LOOKUP_URL'), 'post', json_encode($params),[
+ 'Content-Type: application/json',
+ ]);
+ $config_result = json_decode($result[0], true);
+ if (empty($config_result)) {
+ return json([
+ 'error_code'=>22,
+ 'msg'=>"服务器错误,请稍后重试"
+ ]);
+ }
+ return json($config_result);
+ }
+ /**
+ * 微信小程序专用
+ */
+ public function wxmini()
+ {
+
+ View::assign('country_list', json_decode(file_get_contents('./json/country.json'), true));
+
+ return View::fetch();
+
+ }
+}
\ No newline at end of file
diff --git a/app/home/controller/Miniinvoice.php b/app/home/controller/Miniinvoice.php
new file mode 100644
index 0000000..1ad9e02
--- /dev/null
+++ b/app/home/controller/Miniinvoice.php
@@ -0,0 +1,137 @@
+error('请先授权登录');
+ }
+ $origin_userid = $user_id = input('user_id');
+ if (empty($user_id)) {
+ return $this->error('请先授权登录');
+ }
+ $user_id = authcode($user_id);
+ if (!is_numeric($user_id)) {
+ return $this->error('请先授权登录');
+ }
+ $principals = Db::name('order_principals')->where(['order_sn' => $_REQUEST['order_sn']])->find();
+
+ if (empty($principals)) {
+ $res['msg'] = '无此数据';
+ return json($res);
+ }
+ if ($principals['type']==1){
+ $data = Db::name('msg')->where(['order_sn' => $_REQUEST['order_sn']])->where('order_status','>',0)->find();
+ }elseif ($principals['type']==2){
+
+ $data = Db::name('esta')->where(['order_sn' => $_REQUEST['order_sn']])->where('order_status','>',0)->find();
+ }elseif ($principals['type']==3){
+ $data = Db::name('visa')->where(['order_sn' => $_REQUEST['order_sn']])->where('order_status','>',0)->find();
+ }
+ //获取数据
+
+ if (empty($data)) {
+ return $this->error('无此数据');
+ }
+ $total_price = $data['total_price'] ? $data['total_price'] : $data['origin_price'];
+ $data['total_price'] = ($total_price / 100) . "元";
+ View::assign('data', $data);
+ View::assign('openid', $openid);
+ View::assign('user_id', $origin_userid);
+ return View::fetch();
+
+ }
+ public function add_invoice()
+ {
+ $openid = input('openid');
+ if (empty($openid)) {
+ return $this->error('请先授权登录');
+ }
+ $user_id = input('user_id');
+ if (empty($user_id)) {
+ return $this->error('请先授权登录');
+ }
+ $user_id = authcode($user_id);
+ if (!is_numeric($user_id)) {
+ return $this->error('请先授权登录');
+ }
+ $res = [
+ 'status' => 0,
+ 'msg' => '操作失败,请重新填写'
+ ];
+ unset($_REQUEST['s'],$_REQUEST['openid'],$_REQUEST['user_id']);
+
+
+ $_REQUEST['uid'] = $user_id;
+ if(strpos( $_REQUEST['tax_number']," ")){
+ $res['msg'] = '税号包含空格,请删除后重新填写';
+ return json($res);
+ }
+
+ $principals = Db::name('order_principals')->where(['order_sn' => $_REQUEST['order_sn']])->find();
+ if (empty($principals)) {
+ $res['msg'] = '无此数据';
+ return json($res);
+ }
+ if ($principals['type']==1){
+ $content = "EVUS有新的发票申请,请及时处理";
+ $order = Db::name('msg')->where(['order_sn' => $_REQUEST['order_sn']])->where('order_status','>',0)->find();
+ }elseif ($principals['type']==2){
+ $content = "ESTA有新的发票申请,请及时处理";
+ $order = Db::name('esta')->where(['order_sn' => $_REQUEST['order_sn']])->where('order_status','>',0)->find();
+ }elseif ($principals['type']==3){
+ $content = "美签有新的发票申请,请及时处理";
+ $order = Db::name('visa')->where(['order_sn' => $_REQUEST['order_sn']])->where('order_status','>',0)->find();
+ }
+ if (empty($order)) {
+ $res['msg'] = '无此数据';
+ return json($res);
+ }
+ $data = Db::name('userinvoice')->where([ 'order_id' => $order['id'],'type'=>$principals['type'] ])->find();
+ if (!empty($data)) {
+ $res['msg'] = '请勿重复开票';
+ return json($res);
+ }
+
+ $lastyear = date('Y',strtotime($order['reg_time']));
+ $year = date('Y');
+ if ($year-$lastyear > 2) {
+ $res['msg'] = '开票期限已过';
+ return json($res);
+ }
+ $_REQUEST['title'] = trim($_REQUEST['title']);
+ $_REQUEST['money'] = $order['total_price'] ? $order['total_price'] : $order['origin_price'];
+ //进行插入
+ unset($_REQUEST['etype']);
+ $re = Db::name('userinvoice')->insert($_REQUEST);
+ if (!$re) {
+ $res['msg'] = '操作失败,请重新填写';
+ return json($res);
+ }
+ $res = [
+ 'status' => 1,
+ 'msg' => '操作成功',
+ 'url' => url('user/order', [], '', true)->build()
+ ];
+
+ //推送发票
+ $url='https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=a0d594ce-0580-4a9a-bf4f-712193b65531';
+ $data = array('msgtype' => 'text', 'text' => [
+ 'content' => $content,
+ ]);
+ Httpcurl::request($url, 'post', json_encode($data), [
+ 'Content-Type: application/json'
+ ]);
+ return json($res);
+ }
+
+}
+
diff --git a/app/home/controller/Multiple.php b/app/home/controller/Multiple.php
new file mode 100644
index 0000000..63765ad
--- /dev/null
+++ b/app/home/controller/Multiple.php
@@ -0,0 +1,217 @@
+redirect('login/index');
+ }
+ }
+
+ /**个人中心
+ */
+ public function index()
+ {
+ //获取用户的登记信息
+ $id = Request::instance()->param('id');
+
+ if (empty($id)) {
+ return $this->error('参数错误');
+ }
+ $datas = base64_decode($id);
+ $order_sns = explode('-', $datas);
+ //判断是否有重复订单
+ if (count($order_sns) != count(array_unique($order_sns))) {
+ return $this->error('有重复订单,请删除后重新提交');
+ }
+ $real_ordersn = [];
+ $total_price = 0;
+ $base_url = config('app.order_url');
+ $evus_order_url = config('app.get_evus_detail_url');
+ $order_url = config('app.get_order_detail_url');
+ $invoice_url = $base_url . 'getInvoice';
+ $type = Request::instance()->param('type', 'evus');
+ foreach ($order_sns as $da) {
+ //获取信息
+ if ($type == 'evus') {
+ $response = Httpcurl::request($evus_order_url, 'post', [
+ 'order_sn' => $da,
+ 'model' => MODEL
+ ]);
+ } else {
+ $response = Httpcurl::request($order_url, 'post', [
+ 'order_sn' => $da,
+ 'model' => ESTA_MODEL
+ ]);
+ }
+
+ $data = json_decode($response[0], true);
+ if (empty($data)) {
+ continue;
+ }
+ //查询是否已经开票了
+ $invoice = Httpcurl::request($invoice_url, 'post', [
+ 'order_sn' => $da,
+ 'invoiceType' => INCOICETYPE,
+ 'model' => MODEL
+ ]);
+ if ($invoice[3]) {
+ $res['msg'] = '参数错误';
+ return json($res);
+ }
+ $order = json_decode($invoice[0], true);
+ Log::info(json_encode($order));
+ if (empty($order)) {
+ $res['msg'] = '系统错误,请联系管理员!';
+ return json($res);
+ }
+ if (!$order['code']) {
+ $res['msg'] = $order['msg'];
+ return json($res);
+ }
+ if (!empty($order['data'])) {
+ $res['msg'] = '订单号:' . $da . '已经开票';
+ return json($res);
+ }
+ $real_ordersn[] = $da;
+ $total_price += $data['data']['total_price'];
+ }
+ $data['total_price'] = ($total_price / 100) . "元";
+ $data['order_sn'] = implode(',', $real_ordersn);
+ View::assign('data', $data);
+ View::assign('type', $type);
+ return View::fetch();
+ }
+
+
+ public function add_invoice()
+ {
+ $res = [
+ 'status' => 0,
+ 'msg' => '操作失败,请重新填写'
+ ];
+ unset($_REQUEST['s']);
+ $type = $_REQUEST['type'];
+ if ($_REQUEST['type'] == 'evus') {
+ $_REQUEST['type'] = 1;
+ } else {
+ $_REQUEST['type'] = 6;
+ }
+ $_REQUEST['uid'] = $this->_userId;
+ if (empty($_REQUEST['order_sn'])) {
+ $res['msg'] = '请选择订单';
+ return json($res);
+ }
+ if (strpos($_REQUEST['tax_number'], " ")) {
+ $res['msg'] = '税号包含空格,请删除后重新填写';
+ return json($res);
+ }
+ $order_sns = explode(',', $_REQUEST['order_sn']);
+ //判断是否有重复订单
+ if (count($order_sns) != count(array_unique($order_sns))) {
+ $res['msg'] = '有重复订单,请删除后重新提交';
+ return json($res);
+ }
+ $real_ordersn = [];
+ $total_price = 0;
+
+ $base_url = config('app.order_url');
+ $evus_order_url = config('app.get_evus_detail_url');
+ $order_url = config('app.get_order_detail_url');
+ $invoice_url = $base_url . 'getInvoice';
+ foreach ($order_sns as $da) {
+ //获取信息
+ if ($type == 'evus') {
+ $response = Httpcurl::request($evus_order_url, 'post', [
+ 'order_sn' => $da,
+ 'model' => MODEL
+ ]);
+ } else {
+ $response = Httpcurl::request($order_url, 'post', [
+ 'order_sn' => $da,
+ 'model' => ESTA_MODEL
+ ]);
+ }
+ $data = json_decode($response[0], true);
+ if (empty($data)) {
+ $res['msg'] = '未找到订单信息';
+ return json($res);
+ }
+ //判断是否已经开票了
+ $invoice = Httpcurl::request($invoice_url, 'post', [
+ 'order_sn' => $da,
+ 'invoiceType' => INCOICETYPE,
+ 'model' => MODEL
+ ]);
+ if ($invoice[3]) {
+ $res['msg'] = '参数错误';
+ return json($res);
+ }
+ $order = json_decode($invoice[0], true);
+ if (empty($order)) {
+ $res['msg'] = '系统错误,请联系管理员!';
+ return json($res);
+ }
+ if (!$order['code']) {
+ $res['msg'] = $order['msg'];
+ return json($res);
+ }
+ if (!empty($order['data'])) {
+ $res['msg'] = '订单号:' . $da . '已经开票';
+ return json($res);
+ }
+ $real_ordersn[] = $da;
+ $total_price += $data['data']['total_price'];
+ }
+
+ if (empty($real_ordersn)) {
+ $res['msg'] = '暂无开票订单';
+ return json($res);
+ }
+ $_REQUEST['invoiceType'] = INCOICETYPE;
+ $_REQUEST['model'] = MODEL;
+ $_REQUEST['principals'] = config('app.principals');
+ $_REQUEST['title'] = trim($_REQUEST['title']);
+ $_REQUEST['money'] = $total_price;
+ $_REQUEST['multiple'] = md5(implode(',', $real_ordersn));
+
+ $order_urls = $base_url . 'addMultiple';
+ $response = Httpcurl::request($order_urls, 'post', $_REQUEST);
+
+ if ($response[3]) {
+ return json($res);
+ }
+ $pay_result = json_decode($response[0], true);
+ if (empty($pay_result)) {
+ return json($res);
+ }
+ if (!$pay_result['code']) {
+ $res['msg'] = $pay_result['msg'];
+ return json($res);
+ }
+
+ $res = [
+ 'status' => 1,
+ 'msg' => '操作成功',
+ 'url' => '/home/user/order'
+ ];
+ return json($res);
+ }
+
+}
+
diff --git a/app/home/controller/News.php b/app/home/controller/News.php
new file mode 100644
index 0000000..722e510
--- /dev/null
+++ b/app/home/controller/News.php
@@ -0,0 +1,228 @@
+requestNewsList($page, $size);
+ if (!empty($news_list) && isset($news_list['code']) && $news_list['code'] == 1) {
+ $data = $this->normalizeNewsList(isset($news_list['data']) ? $news_list['data'] : []);
+ $count = isset($news_list['count']) ? intval($news_list['count']) : count($data);
+ } else {
+ $data = [];
+ $count = 0;
+ }
+
+ View::assign('data', $data);
+ View::assign('count', $count);
+ View::assign('page', $page);
+ View::assign('size', $size);
+ $this->assignSeo([
+ 'title' => $page > 1
+ ? 'EVUS与美国签证新闻资讯 - 第' . $page . '页'
+ : 'EVUS与美国签证新闻资讯',
+ 'canonical_path' => '/home/news/index',
+ 'canonical_query_keys' => ['page'],
+ ]);
+ return View::fetch();
+ }
+
+ public function detail()
+ {
+ $id = Request::instance()->param('id');
+ if (
+ !is_scalar($id)
+ || filter_var((string) $id, FILTER_VALIDATE_INT, [
+ 'options' => ['min_range' => 1],
+ ]) === false
+ ) {
+ abort(404, '新闻不存在');
+ }
+ $id = (int) $id;
+
+ $info = $this->requestNewsDetail($id);
+ if ($info === null) {
+ abort(503, '新闻服务暂时不可用');
+ }
+ if (empty($info) || !isset($info['code']) || $info['code'] != 1 || empty($info['data'])) {
+ abort(404, '新闻不存在');
+ }
+
+ $info_detail = $this->normalizeNewsItem($info['data']);
+ $latest = $this->requestNewsList(1, 50);
+ $latest_data = [];
+ if (!empty($latest) && isset($latest['code']) && $latest['code'] == 1) {
+ $latest_data = $this->normalizeNewsList(isset($latest['data']) ? $latest['data'] : [], true);
+ }
+
+ $nav = $this->resolveArticleNav($id, $latest_data);
+ $article = $this->filterRelatedArticles($id, $latest_data, 8);
+
+ View::assign('data', $info_detail);
+ View::assign('last', $nav['last']);
+ View::assign('next', $nav['next']);
+ View::assign('article', $article);
+
+ $seoService = new SeoMetaService();
+ $title = $seoService->descriptionFromHtml((string) $info_detail['title'], 60);
+ $description = $seoService->descriptionFromHtml(
+ (string) $info_detail['contents']
+ );
+ $seo = [
+ 'canonical_path' => '/home/news/detail',
+ 'canonical_query_keys' => ['id'],
+ ];
+ if ($title !== '') {
+ $seo['title'] = $title;
+ }
+ if ($description !== '') {
+ $seo['description'] = $description;
+ }
+ $this->assignSeo($seo);
+
+ return View::fetch();
+ }
+
+ private function requestNewsList($page, $size)
+ {
+ $response = Httpcurl::request(NEWS_LIST, 'post', [
+ 'model' => 'article',
+ 'source_code' => DOMAIN,
+ 'page' => $page,
+ 'size' => $size,
+ ]);
+
+ return $this->decodeApiResponse($response, 'news list');
+ }
+
+ private function requestNewsDetail($id)
+ {
+ $response = Httpcurl::request(NEWS_DETAIL, 'post', [
+ 'model' => 'article',
+ 'id' => $id,
+ ]);
+
+ return $this->decodeApiResponse($response, 'news detail');
+ }
+
+ private function decodeApiResponse($response, $scene)
+ {
+ if (!is_array($response) || !isset($response[0]) || !empty($response[3])) {
+ Log::error($scene . ' api request failed: ' . json_encode($response));
+ return null;
+ }
+
+ $status_code = intval(isset($response[2]['http_code']) ? $response[2]['http_code'] : 0);
+ if ($status_code < 200 || $status_code >= 300) {
+ Log::error($scene . ' api returned HTTP status: ' . $status_code);
+ return null;
+ }
+
+ $result = json_decode($response[0], true);
+ Log::info(json_encode($result));
+ return is_array($result) ? $result : null;
+ }
+
+ private function normalizeNewsList($list, $short_date = false)
+ {
+ if (!is_array($list)) {
+ return [];
+ }
+
+ $data = [];
+ foreach ($list as $item) {
+ $item = $this->normalizeNewsItem($item);
+ if ($short_date) {
+ $item['create_time'] = $this->formatDate($item['create_time']);
+ }
+ $data[] = $item;
+ }
+
+ return $data;
+ }
+
+ private function normalizeNewsItem($item)
+ {
+ if (!is_array($item)) {
+ return [];
+ }
+
+ $item['id'] = isset($item['id']) ? $item['id'] : 0;
+ $item['title'] = isset($item['title']) ? $item['title'] : '';
+ $contents = isset($item['contents'])
+ ? $item['contents']
+ : (isset($item['content']) ? $item['content'] : '');
+ $item['contents'] = is_scalar($contents)
+ ? str_replace('https://www.evus.gov/', '', (string) $contents)
+ : '';
+ $item['create_time'] = isset($item['create_time']) ? $item['create_time'] : '';
+
+ return $item;
+ }
+
+ private function resolveArticleNav($id, $list)
+ {
+ $id = intval($id);
+ $last = [];
+ $next = [];
+
+ foreach ($list as $item) {
+ $item_id = intval(isset($item['id']) ? $item['id'] : 0);
+ if ($item_id <= 0 || $item_id == $id) {
+ continue;
+ }
+
+ if ($item_id < $id && (empty($last) || $item_id > intval($last['id']))) {
+ $last = $item;
+ }
+
+ if ($item_id > $id && (empty($next) || $item_id < intval($next['id']))) {
+ $next = $item;
+ }
+ }
+
+ return ['last' => $last, 'next' => $next];
+ }
+
+ private function filterRelatedArticles($id, $list, $limit)
+ {
+ $data = [];
+ $id = intval($id);
+
+ foreach ($list as $item) {
+ if (intval($item['id']) == $id) {
+ continue;
+ }
+
+ $data[] = $item;
+ if (count($data) >= $limit) {
+ break;
+ }
+ }
+
+ return $data;
+ }
+
+ private function formatDate($date)
+ {
+ if (empty($date)) {
+ return '';
+ }
+
+ $timestamp = strtotime($date);
+ return $timestamp ? date('Y-m-d', $timestamp) : $date;
+ }
+}
diff --git a/app/home/controller/Panel.php b/app/home/controller/Panel.php
new file mode 100644
index 0000000..74ab01a
--- /dev/null
+++ b/app/home/controller/Panel.php
@@ -0,0 +1,22 @@
+fetch();
+
+ }
+
+}
+
+
diff --git a/app/home/controller/Pay.php b/app/home/controller/Pay.php
new file mode 100644
index 0000000..6d2e477
--- /dev/null
+++ b/app/home/controller/Pay.php
@@ -0,0 +1,240 @@
+order_sn = Request::instance()->param('order_sn', '');
+ if (empty($this->order_sn)) {
+ throw new HttpResponseException(Response::create($this->error('缺少订单号,请重新填写', url('detail/index'))));
+ }
+ }
+
+ public function index()
+ {
+
+ if (isMobile()) {
+
+ if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
+ return redirect(url('pay/wxpay', ['order_sn' => $this->order_sn])->build());
+ }
+ return redirect(url('pay/h5pay', ['order_sn' => $this->order_sn])->build());
+ }
+ return redirect(url('pay/pcpay', ['order_sn' => $this->order_sn])->build());
+ }
+
+ /**
+ * 跳到微信支付
+ */
+ public function wxpay()
+ {
+ $wechaturl = config('app.wechatpay');
+ $wechaturl .= '?order_sn=' . $this->order_sn . '&mark=' . PAY_MARK . '&body=' . urlencode(COUNTRY . '服务费');
+ header('location:' . $wechaturl); // 跳转到 user/profile
+ exit;
+
+ }
+
+ /**
+ * 跳转到pc支付
+ */
+ public function pcpay()
+ {
+ $order_sn = $this->order_sn;
+ //判断支付是否已完成
+ $order_url = config('app.get_evus_detail_url');
+ $response = Httpcurl::request($order_url, 'post', ['order_sn' => $order_sn, 'model' => MODEL]);
+ if ($response[3]) {
+ return $this->error("异常错误,请重新提交", url('detail/index'));
+ }
+ $pay_result = json_decode($response[0], true);
+ Log::info(json_encode($pay_result));
+ if (empty($pay_result)) {
+ return $this->error("异常错误,请重新提交", url('detail/index'));
+ }
+ if (!$pay_result['code']) {
+ return $this->error($pay_result['msg'], url('detail/index'));
+ }
+ $pay_result = $pay_result['data'];
+ if ($pay_result['pay_status']) {
+ return $this->success('您已支付成功,请勿重复支付', url('detail/index'));
+ }
+ //微信pc
+ $cfg = config('app.wechatpcpay');
+
+ $res = Httpcurl::request($cfg, 'get', array('order_sn' => $order_sn, 'mark' => PAY_MARK, 'body' => COUNTRY . '服务费'));
+
+ $wxurl = "";
+ if (!$res[3]) {
+ $result = json_decode($res[0], true);
+ $wxurl = $result['url'];
+ }
+ Log::info(json_encode($res));
+ //支付宝pc
+ $cfg = config('app.alipcpay');
+
+ $res = Httpcurl::request($cfg, 'get', array('order_sn' => $order_sn, 'mark' => PAY_MARK, 'body' => urlencode(COUNTRY . '服务费')));
+ $aliurl = "";
+ if (!$res[3]) {
+ $result = json_decode($res[0], true);
+ $aliurl = $result['url'];
+ }
+ Log::info(json_encode($res));
+ View::assign('url', $wxurl);
+ View::assign('aliurl', $aliurl);
+ View::assign('order_sn', $order_sn);
+ View::assign('total_fee', number_format($pay_result['total_price'] / 100, 2));
+
+ return View::fetch();
+
+ }
+
+ /**
+ * 跳转到H5支付
+ */
+ public function h5pay()
+ {
+
+ $wechaturl = config('app.wechath5pay');
+ $wechaturl .= '?order_sn=' . $this->order_sn . '&mark=' . PAY_MARK . '&body=' . urlencode(COUNTRY . '服务费');
+ header('location:' . $wechaturl); // 跳转到 user/profile
+ exit;
+ }
+
+ public function succ()
+ {
+ $order_sn = $this->order_sn;
+ View::assign('order_sn', $order_sn);
+
+ return View::fetch();
+ }
+
+ /**
+ * h5支付结果页面
+ */
+ public function h5result()
+ {
+ if (Request::instance()->isAjax()) {
+ $order_sn = $this->order_sn;
+
+ if (!$order_sn) {
+ return json([
+ 'status' => 0,
+ 'msg' => '订单号不存在,请重新支付',
+ 'url' => url('pay/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ $order_url = config('app.get_evus_detail_url');
+ $response = Httpcurl::request($order_url, 'post', ['order_sn' => $order_sn, 'model' => MODEL]);
+ if ($response[3]) {
+ return json([
+ 'status' => 0,
+ 'msg' => '异常错误,请重新提交',
+ 'url' => url('pay/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ $pay_result = json_decode($response[0], true);
+ Log::info(json_encode($pay_result));
+ if (empty($pay_result)) {
+ return json([
+ 'status' => 0,
+ 'msg' => '异常错误,请重新提交',
+ 'url' => url('pay/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ if (!$pay_result['code']) {
+ return json([
+ 'status' => 0,
+ 'msg' => $pay_result['msg'],
+ 'url' => url('pay/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ $pay_result = $pay_result['data'];
+ if ($pay_result['pay_status']) {
+ return json([
+ 'status' => 1,
+ 'msg' => '支付成功',
+ 'url' => url('pay/succ', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ return json([
+ 'status' => 0,
+ 'msg' => '您还未支付,请重新支付',
+ 'url' => url('pay/h5pay', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ return View::fetch();
+
+ }
+
+ /**
+ * pc支付结果页面
+ */
+ public function pcresult()
+ {
+ if (Request::instance()->isAjax()) {
+ $order_sn = $this->order_sn;
+
+ if (!$order_sn) {
+ return json([
+ 'status' => 0,
+ 'msg' => '订单号不存在,请重新支付',
+ 'url' => url('pay/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ $order_url = config('app.get_evus_detail_url');
+ $response = Httpcurl::request($order_url, 'post', ['order_sn' => $order_sn, 'model' => MODEL]);
+ if ($response[3]) {
+ return json([
+ 'status' => 0,
+ 'msg' => '异常错误,请重新提交',
+ 'url' => url('pay/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ $pay_result = json_decode($response[0], true);
+ Log::info(json_encode($pay_result));
+ if (empty($pay_result)) {
+ return json([
+ 'status' => 0,
+ 'msg' => '异常错误,请重新提交',
+ 'url' => url('pay/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ if (!$pay_result['code']) {
+ return json([
+ 'status' => 0,
+ 'msg' => $pay_result['msg'],
+ 'url' => url('pay/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ $pay_result = $pay_result['data'];
+ if ($pay_result['pay_status']) {
+ return json([
+ 'status' => 1,
+ 'msg' => '支付成功',
+ 'url' => url('pay/succ', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ return json([
+ 'status' => 0,
+ 'msg' => '您还未支付,请重新支付',
+ 'url' => url('pay/pcpay', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ }
+
+}
diff --git a/app/home/controller/Payesta.php b/app/home/controller/Payesta.php
new file mode 100644
index 0000000..712ad0b
--- /dev/null
+++ b/app/home/controller/Payesta.php
@@ -0,0 +1,240 @@
+order_sn = Request::instance()->param('order_sn', '');
+ if (empty($this->order_sn)) {
+ throw new HttpResponseException(Response::create($this->error('缺少订单号,请重新填写', url('esta/index'))));
+ }
+ }
+
+ public function index()
+ {
+
+ if (isMobile()) {
+
+ if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
+ return redirect(url('payesta/wxpay', ['order_sn' => $this->order_sn])->build());
+ }
+ return redirect(url('payesta/h5pay', ['order_sn' => $this->order_sn])->build());
+ }
+ return redirect(url('payesta/pcpay', ['order_sn' => $this->order_sn])->build());
+ }
+
+ /**
+ * 跳到微信支付
+ */
+ public function wxpay()
+ {
+ $wechaturl = config('app.wechatpay');
+ $wechaturl .= '?order_sn=' . $this->order_sn . '&mark=' . PAY_ESTA_MARK . '&body=' . urlencode(ESTA_COUNTRY . '服务费');
+ header('location:' . $wechaturl); // 跳转到 user/profile
+ exit;
+
+ }
+
+ /**
+ * 跳转到pc支付
+ */
+ public function pcpay()
+ {
+ $order_sn = $this->order_sn;
+ //判断支付是否已完成
+ $order_url = config('app.get_order_detail_url');
+ $response = Httpcurl::request($order_url, 'post', ['order_sn' => $order_sn, 'model' => ESTA_MODEL]);
+ if ($response[3]) {
+ return $this->error("异常错误,请重新提交", url('detail/index'));
+ }
+ $pay_result = json_decode($response[0], true);
+ Log::info(json_encode($pay_result));
+ if (empty($pay_result)) {
+ return $this->error("异常错误,请重新提交", url('detail/index'));
+ }
+ if (!$pay_result['code']) {
+ return $this->error($pay_result['msg'], url('detail/index'));
+ }
+ $pay_result = $pay_result['data'];
+ if ($pay_result['pay_status']) {
+ return $this->success('您已支付成功,请勿重复支付', url('detail/index'));
+ }
+ //微信pc
+ $cfg = config('app.wechatpcpay');
+
+ $res = Httpcurl::request($cfg, 'get', array('order_sn' => $order_sn, 'mark' => PAY_ESTA_MARK, 'body' => ESTA_COUNTRY . '服务费'));
+ $wxurl = "";
+ if (!$res[3]) {
+ $result = json_decode($res[0], true);
+ $wxurl = $result['url'];
+ }
+ Log::info(json_encode($res));
+ //支付宝pc
+ $cfg = config('app.alipcpay');
+
+ $res = Httpcurl::request($cfg, 'get', array('order_sn' => $order_sn, 'mark' => PAY_ESTA_MARK, 'body' => urlencode(ESTA_COUNTRY . '服务费')));
+ $aliurl = "";
+ if (!$res[3]) {
+ $result = json_decode($res[0], true);
+ $aliurl = $result['url'];
+ }
+ Log::info(json_encode($res));
+ View::assign('url', $wxurl);
+ View::assign('aliurl', $aliurl);
+ View::assign('order_sn', $order_sn);
+ View::assign('total_fee', number_format($pay_result['total_price'] / 100, 2));
+
+
+ return View::fetch();
+
+ }
+
+ /**
+ * 跳转到H5支付
+ */
+ public function h5pay()
+ {
+
+ $wechaturl = config('app.wechath5pay');
+ $wechaturl .= '?order_sn=' . $this->order_sn . '&mark=' . PAY_ESTA_MARK . '&body=' . urlencode(ESTA_COUNTRY . '服务费');
+ header('location:' . $wechaturl); // 跳转到 user/profile
+ exit;
+ }
+
+ public function succ()
+ {
+ $order_sn = $this->order_sn;
+ View::assign('order_sn', $order_sn);
+
+ return View::fetch();
+ }
+
+ /**
+ * h5支付结果页面
+ */
+ public function h5result()
+ {
+ if (Request::instance()->isAjax()) {
+ $order_sn = $this->order_sn;
+
+ if (!$order_sn) {
+ return json([
+ 'status' => 0,
+ 'msg' => '订单号不存在,请重新支付',
+ 'url' => url('payesta/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ $order_url = config('app.get_order_detail_url');
+ $response = Httpcurl::request($order_url, 'post', ['order_sn' => $order_sn, 'model' => ESTA_MODEL]);
+ if ($response[3]) {
+ return json([
+ 'status' => 0,
+ 'msg' => '异常错误,请重新提交',
+ 'url' => url('payesta/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ $pay_result = json_decode($response[0], true);
+ Log::info(json_encode($pay_result));
+ if (empty($pay_result)) {
+ return json([
+ 'status' => 0,
+ 'msg' => '异常错误,请重新提交',
+ 'url' => url('payesta/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ if (!$pay_result['code']) {
+ return json([
+ 'status' => 0,
+ 'msg' => $pay_result['msg'],
+ 'url' => url('payesta/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ $pay_result = $pay_result['data'];
+ if ($pay_result['pay_status']) {
+ return json([
+ 'status' => 1,
+ 'msg' => '支付成功',
+ 'url' => url('payesta/succ', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ return json([
+ 'status' => 0,
+ 'msg' => '您还未支付,请重新支付',
+ 'url' => url('payesta/h5pay', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ return View::fetch();
+
+ }
+
+ /**
+ * pc支付结果页面
+ */
+ public function pcresult()
+ {
+ if (Request::instance()->isAjax()) {
+ $order_sn = $this->order_sn;
+
+ if (!$order_sn) {
+ return json([
+ 'status' => 0,
+ 'msg' => '订单号不存在,请重新支付',
+ 'url' => url('payesta/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ $order_url = config('app.get_order_detail_url');
+ $response = Httpcurl::request($order_url, 'post', ['order_sn' => $order_sn, 'model' => ESTA_MODEL]);
+ if ($response[3]) {
+ return json([
+ 'status' => 0,
+ 'msg' => '异常错误,请重新提交',
+ 'url' => url('payesta/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ $pay_result = json_decode($response[0], true);
+ Log::info(json_encode($pay_result));
+ if (empty($pay_result)) {
+ return json([
+ 'status' => 0,
+ 'msg' => '异常错误,请重新提交',
+ 'url' => url('payesta/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ if (!$pay_result['code']) {
+ return json([
+ 'status' => 0,
+ 'msg' => $pay_result['msg'],
+ 'url' => url('payesta/index', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ $pay_result = $pay_result['data'];
+ if ($pay_result['pay_status']) {
+ return json([
+ 'status' => 1,
+ 'msg' => '支付成功',
+ 'url' => url('payesta/succ', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ return json([
+ 'status' => 0,
+ 'msg' => '您还未支付,请重新支付',
+ 'url' => url('payesta/pcpay', ['order_sn' => $order_sn])->build()
+ ]);
+ }
+ }
+
+}
diff --git a/app/home/controller/Seo.php b/app/home/controller/Seo.php
new file mode 100644
index 0000000..59c53be
--- /dev/null
+++ b/app/home/controller/Seo.php
@@ -0,0 +1,227 @@
+baseUrl();
+ if ($baseUrl === '') {
+ return response(
+ 'SEO_BASE_URL is not configured.',
+ 503,
+ ['Content-Type' => 'text/plain; charset=UTF-8']
+ );
+ }
+
+ $cacheSeconds = max(60, (int) ($sitemapConfig['cache_seconds'] ?? 3600));
+ $cacheDirectory = runtime_path('seo');
+ $cacheFile = $cacheDirectory
+ . 'sitemap-'
+ . substr(hash('sha256', $baseUrl), 0, 16)
+ . '.xml';
+ $cachedXml = $this->readCache($cacheFile);
+ $cacheTime = is_file($cacheFile) ? filemtime($cacheFile) : false;
+ if (
+ $cachedXml !== ''
+ && $cacheTime !== false
+ && $cacheTime + $cacheSeconds > time()
+ ) {
+ return $this->xmlResponse($cachedXml, $cacheSeconds);
+ }
+
+ $service = new SitemapService($baseUrl);
+ $entries = $this->staticEntries($seoConfig);
+ [$newsEntries, $newsComplete] = $this->newsEntries($sitemapConfig);
+
+ if (!$newsComplete && $cachedXml !== '') {
+ return $this->xmlResponse($cachedXml, 300);
+ }
+
+ $xml = $service->render(array_merge($entries, $newsEntries));
+ if ($newsComplete) {
+ $this->writeCache($cacheDirectory, $cacheFile, $xml);
+ }
+
+ return $this->xmlResponse($xml, $newsComplete ? $cacheSeconds : 300);
+ }
+
+ public function robots()
+ {
+ $seoConfig = (array) config('seo');
+ $baseUrl = (new SeoMetaService($seoConfig))->baseUrl();
+ $service = new SitemapService($baseUrl);
+ $robots = $service->renderRobots($this->disallowPaths($seoConfig));
+
+ return response($robots, 200, [
+ 'Content-Type' => 'text/plain; charset=UTF-8',
+ 'Cache-Control' => 'public, max-age=3600',
+ ]);
+ }
+
+ private function staticEntries(array $seoConfig): array
+ {
+ $entries = [];
+ foreach ((array) ($seoConfig['pages'] ?? []) as $route => $page) {
+ $page = (array) $page;
+ if (!str_starts_with((string) $route, 'home/')) {
+ continue;
+ }
+ if (!str_starts_with((string) ($page['robots'] ?? ''), 'index')) {
+ continue;
+ }
+ if ($route === 'home/news/detail') {
+ continue;
+ }
+
+ $path = (string) ($page['canonical_path'] ?? '');
+ if ($path !== '') {
+ $entries[] = ['path' => $path];
+ }
+ }
+
+ return $entries;
+ }
+
+ private function newsEntries(array $sitemapConfig): array
+ {
+ $url = trim((string) ($sitemapConfig['news_list_url'] ?? ''));
+ if (filter_var($url, FILTER_VALIDATE_URL) === false) {
+ Log::warning('SEO sitemap news URL is invalid.');
+ return [[], false];
+ }
+
+ $pageSize = max(1, min(500, (int) ($sitemapConfig['news_page_size'] ?? 100)));
+ $maxPages = max(1, min(500, (int) ($sitemapConfig['max_news_pages'] ?? 100)));
+ $entries = [];
+ $fetchedItems = 0;
+
+ for ($page = 1; $page <= $maxPages; $page++) {
+ try {
+ $response = Httpcurl::request($url, 'post', [
+ 'model' => 'article',
+ 'source_code' => 'cn',
+ 'page' => $page,
+ 'size' => $pageSize,
+ ], [], 5);
+ } catch (Throwable $exception) {
+ Log::warning('SEO sitemap news request failed: ' . $exception->getMessage());
+ return [$entries, false];
+ }
+
+ if (!is_array($response) || !isset($response[0]) || !empty($response[3])) {
+ Log::warning('SEO sitemap news request returned an invalid response.');
+ return [$entries, false];
+ }
+
+ $statusCode = (int) ($response[2]['http_code'] ?? 0);
+ if ($statusCode < 200 || $statusCode >= 300) {
+ Log::warning('SEO sitemap news request returned an invalid HTTP status.');
+ return [$entries, false];
+ }
+
+ $result = json_decode((string) $response[0], true);
+ if (
+ !is_array($result)
+ || (int) ($result['code'] ?? 0) !== 1
+ || !is_array($result['data'] ?? null)
+ ) {
+ Log::warning('SEO sitemap news response could not be decoded.');
+ return [$entries, false];
+ }
+
+ $items = $result['data'];
+ $fetchedItems += count($items);
+ foreach ($items as $item) {
+ if (!is_array($item)) {
+ continue;
+ }
+
+ $id = filter_var($item['id'] ?? null, FILTER_VALIDATE_INT, [
+ 'options' => ['min_range' => 1],
+ ]);
+ if ($id === false) {
+ continue;
+ }
+
+ $entries[] = [
+ 'path' => '/home/news/detail',
+ 'query' => ['id' => $id],
+ 'lastmod' => $this->articleDate((string) ($item['create_time'] ?? '')),
+ ];
+ }
+
+ $total = max(0, (int) ($result['count'] ?? 0));
+ if (
+ $items === []
+ || ($total > 0 && $fetchedItems >= $total)
+ || ($total === 0 && count($items) < $pageSize)
+ ) {
+ return [$entries, true];
+ }
+ }
+
+ Log::warning('SEO sitemap news pagination reached the configured page limit.');
+ return [$entries, false];
+ }
+
+ private function disallowPaths(array $seoConfig): array
+ {
+ $paths = [];
+ foreach ((array) ($seoConfig['noindex_controllers'] ?? []) as $controller) {
+ $controller = trim((string) $controller, '/');
+ if ($controller !== '') {
+ $paths[] = '/home/' . $controller . '/';
+ }
+ }
+
+ return $paths;
+ }
+
+ private function articleDate(string $date): string
+ {
+ $timestamp = strtotime($date);
+ return $timestamp === false ? '' : date('Y-m-d', $timestamp);
+ }
+
+ private function readCache(string $cacheFile): string
+ {
+ if (!is_file($cacheFile) || !is_readable($cacheFile)) {
+ return '';
+ }
+
+ $contents = file_get_contents($cacheFile);
+ return is_string($contents) ? $contents : '';
+ }
+
+ private function writeCache(string $directory, string $cacheFile, string $xml): void
+ {
+ if (!is_dir($directory) && !mkdir($directory, 0775, true) && !is_dir($directory)) {
+ Log::warning('SEO sitemap cache directory could not be created.');
+ return;
+ }
+
+ if (file_put_contents($cacheFile, $xml, LOCK_EX) === false) {
+ Log::warning('SEO sitemap cache could not be written.');
+ }
+ }
+
+ private function xmlResponse(string $xml, int $maxAge)
+ {
+ return response($xml, 200, [
+ 'Content-Type' => 'application/xml; charset=UTF-8',
+ 'Cache-Control' => 'public, max-age=' . max(0, $maxAge),
+ 'X-Robots-Tag' => 'noindex',
+ ]);
+ }
+}
diff --git a/app/home/controller/Update.php b/app/home/controller/Update.php
new file mode 100644
index 0000000..8321bbf
--- /dev/null
+++ b/app/home/controller/Update.php
@@ -0,0 +1,434 @@
+error('参数错误');
+ }
+ //获取数据
+ $data = Db::name('msg')->where(['id' => $id, 'order_sn' => $order_sn])->find();
+ if (empty($data)) {
+ return $this->error('无此数据');
+ }
+ $refer_url = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '';
+ if ($refer_url){
+ Session::set('update_refer_url',$refer_url);
+ }
+ View::assign('data', $data);
+ View::assign('id', $id);
+ View::assign('order_sn', $order_sn);
+ return View::fetch();
+
+ }
+
+ function do_apply()
+ {
+
+ unset($_REQUEST['s']);
+ $id = Request::param('id');
+ $order_sn = Request::param('order_sn');
+ file_put_contents('/www/newevus/update.log',
+ "{$order_sn}.'-'.{$id}===" . json_encode($_REQUEST) . "\r\n", FILE_APPEND);
+ $insert_id = Db::name('msg')->where(['id' => $id, 'order_sn' => $order_sn])->update($_REQUEST);
+ $refer_url= Session::get('update_refer_url');
+ if ($insert_id >= 0) {
+ return $this->success('修改成功',$refer_url);
+ } else {
+ return $this->error("提交失败,请联系管理员!",$refer_url);
+ }
+ }
+ public function adminindex()
+ {
+ $order_sn = Request::param('order_sn');
+ if (empty($order_sn)) {
+ return $this->error('参数错误');
+ }
+ $response = Httpcurl::request(config('app.get_evus_detail_url'), 'post', ['order_sn' => $order_sn, 'model' => MODEL]);
+ if ($response[3]) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+
+ $pay_result = json_decode($response[0], true);
+ if (empty($pay_result)) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+ if (!$pay_result['code']) {
+ return $this->error($pay_result['msg'], url('detail/index'));
+ }
+ $refer_url = Request::param('return_url');
+ if ($refer_url) {
+ Session::set('update_refer_url', $refer_url);
+ }
+ View::assign('country_list', json_decode(file_get_contents('./json/country.json'), true));
+ View::assign('phone_prefix', json_decode(file_get_contents('./json/phone_prefix.json'), true));
+ View::assign('us', json_decode(file_get_contents('./json/us.json'), true));
+ View::assign('data', $pay_result['data']);
+ return View::fetch();
+
+ }
+ public function order_apply()
+ {
+ $order_sn = Request::param('order_sn');
+ if (!$order_sn) {
+ return $this->error(lang('controller.order_not_exist'));
+ }
+
+ $response = Httpcurl::request(config('app.get_evus_detail_url'), 'post', ['order_sn' => $order_sn, 'model' => MODEL]);
+ if ($response[3]) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+ $pay_result = json_decode($response[0], true);
+ if (empty($pay_result)) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+ if (!$pay_result['code']) {
+ return $this->error($pay_result['msg'], url('detail/index'));
+ }
+ unset($_REQUEST['s']);
+ $_REQUEST['birth_date_day'] = (string)date_parse($_REQUEST['birth_date'])['day'] ?:'0';
+ $_REQUEST['birth_date_month'] = (string)date_parse($_REQUEST['birth_date'])['month'] ?:'0';
+ $_REQUEST['birth_date_year'] = (string)date_parse($_REQUEST['birth_date'])['year'] ?:'0';
+
+ $_REQUEST['passport_expedition_date_day'] = (string)date_parse($_REQUEST['passport_expedition_date'])['day'] ?:'';
+ $_REQUEST['passport_expedition_date_month'] = (string)date_parse($_REQUEST['passport_expedition_date'])['month'] ?:'';
+ $_REQUEST['passport_expedition_date_year'] = (string)date_parse($_REQUEST['passport_expedition_date'])['year'] ?:'';
+
+ $_REQUEST['passport_expiration_date_day'] = (string)date_parse($_REQUEST['passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['passport_expiration_date_month'] = (string)date_parse($_REQUEST['passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['passport_expiration_date_year'] = (string)date_parse($_REQUEST['passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_passport_issue_date_day'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['day'] ?:'';
+ $_REQUEST['us_visa_passport_issue_date_month'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['month'] ?:'';
+ $_REQUEST['us_visa_passport_issue_date_year'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_passport_expiration_date_day'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['us_visa_passport_expiration_date_month'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['us_visa_passport_expiration_date_year'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_birth_date_day'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['day'] ?:'';
+ $_REQUEST['us_visa_birth_date_month'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['month'] ?:'';
+ $_REQUEST['us_visa_birth_date_year'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['year'] ?:'';
+ $_REQUEST = formDataToJson(['vist_country', 'vist_from_date', 'vist_end_date', 'vist_country_des'], $_REQUEST, 'vistitem', 'question_i');
+ $_REQUEST['other_country_acquired_other'] = isset($_REQUEST['other_country_acquired_other']) ? $_REQUEST['other_country_acquired_other'] : '';
+
+ $_REQUEST['model'] = MODEL;
+ $_REQUEST['token'] = md5(MODEL);
+ $_REQUEST['order_sn'] = $order_sn;
+ $_REQUEST['total_price'] = $pay_result['data']['total_price'];
+
+ try {
+ $insert_id = Httpcurl::request(UPDATE_EVUS_ORDER_URL, 'post', $_REQUEST);
+ $result = json_decode($insert_id[0], true);
+ $refer_url= Session::get('update_refer_url');
+ if (empty($result)) {
+ return $this->error(lang('controller.fail'));
+ }
+ if (!$result['code']) {
+ return $this->error(lang('controller.fail'));
+ }
+ return $this->success(lang('controller.success'), $refer_url);
+ } catch (\Exception $e) {
+ return $this->error(lang('controller.fail'));
+ }
+ }
+ public function adminesta()
+ {
+ $order_sn = Request::param('order_sn');
+ if (empty($order_sn)) {
+ return $this->error('参数错误');
+ }
+ $response = Httpcurl::request(config('app.get_order_detail_url'), 'post', ['order_sn' => $order_sn, 'model' => ESTA_MODEL]);
+ if ($response[3]) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+ $pay_result = json_decode($response[0], true);
+ if (empty($pay_result)) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+ if (!$pay_result['code']) {
+ return $this->error($pay_result['msg'], url('detail/index'));
+ }
+ $refer_url = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '';
+ if ($refer_url) {
+ Session::set('update_refer_url', $refer_url);
+ }
+ View::assign('country_list', json_decode(file_get_contents('./json/country.json'), true));
+ View::assign('phone_prefix', json_decode(file_get_contents('./json/phone_prefix.json'), true));
+ View::assign('us', json_decode(file_get_contents('./json/us.json'), true));
+ View::assign('goods', config('app.ESTA_GOODS'));
+ View::assign('ismobile', isMobile() ? 1 : 0);
+ View::assign('ppt_sample_url', '/new/assets/images/shili.jpg');
+ View::assign('per_sample_url', '/new/assets/images/persion2.png');
+ View::assign('data', $pay_result['data']);
+ View::assign('id', $pay_result['data']['id']);
+ return View::fetch();
+
+ }
+ public function detail()
+ {
+ $order_sn = Request::param('id');
+ if (empty($order_sn)) {
+ return $this->error('参数错误');
+ }
+ $response = Httpcurl::request(config('app.get_evus_detail_url'), 'post', ['order_sn' => $order_sn, 'model' => MODEL]);
+ if ($response[3]) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+ $pay_result = json_decode($response[0], true);
+ if (empty($pay_result)) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+ if (!$pay_result['code']) {
+ return $this->error($pay_result['msg'], url('detail/index'));
+ }
+ View::assign('country_list', json_decode(file_get_contents('./json/country.json'), true));
+ View::assign('phone_prefix', json_decode(file_get_contents('./json/phone_prefix.json'), true));
+ View::assign('us', json_decode(file_get_contents('./json/us.json'), true));
+ View::assign('data', $pay_result['data']);
+ return View::fetch();
+
+ }
+ /**
+ * 未支付订单去支付
+ */
+ public function do_unpay()
+ {
+ $order_sn = Request::param('order_sn');
+ if (empty($order_sn)) {
+ return $this->error('参数错误');
+ }
+ $response = Httpcurl::request(config('app.get_evus_detail_url'), 'post', ['order_sn' => $order_sn, 'model' => MODEL]);
+ if ($response[3]) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+ $pay_result = json_decode($response[0], true);
+ if (empty($pay_result)) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+ if (!$pay_result['code']) {
+ return $this->error($pay_result['msg'], url('detail/index'));
+ }
+ $order_sn = $_REQUEST['order_sn'] = getOrderNumber();
+ $total_price =$pay_result['data']['total_price'];
+ /*判断价格是否正确*/
+ $config_price = array_map(function($item) {
+ return $item['value'];
+ }, config('app.EVUS_GOODS'));
+ if (!in_array($total_price, $config_price)) {
+ return $this->error('价格错误');
+ }
+ /*判断价格是否正确*/
+ $_REQUEST['birth_date_day'] = (string)date_parse($_REQUEST['birth_date'])['day'] ?:'0';
+ $_REQUEST['birth_date_month'] = (string)date_parse($_REQUEST['birth_date'])['month'] ?:'0';
+ $_REQUEST['birth_date_year'] = (string)date_parse($_REQUEST['birth_date'])['year'] ?:'0';
+
+ $_REQUEST['passport_expedition_date_day'] = (string)date_parse($_REQUEST['passport_expedition_date'])['day'] ?:'';
+ $_REQUEST['passport_expedition_date_month'] = (string)date_parse($_REQUEST['passport_expedition_date'])['month'] ?:'';
+ $_REQUEST['passport_expedition_date_year'] = (string)date_parse($_REQUEST['passport_expedition_date'])['year'] ?:'';
+
+ $_REQUEST['passport_expiration_date_day'] = (string)date_parse($_REQUEST['passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['passport_expiration_date_month'] = (string)date_parse($_REQUEST['passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['passport_expiration_date_year'] = (string)date_parse($_REQUEST['passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_passport_issue_date_day'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['day'] ?:'';
+ $_REQUEST['us_visa_passport_issue_date_month'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['month'] ?:'';
+ $_REQUEST['us_visa_passport_issue_date_year'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_passport_expiration_date_day'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['us_visa_passport_expiration_date_month'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['us_visa_passport_expiration_date_year'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_birth_date_day'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['day'] ?:'';
+ $_REQUEST['us_visa_birth_date_month'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['month'] ?:'';
+ $_REQUEST['us_visa_birth_date_year'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['year'] ?:'';
+
+ $_REQUEST = formDataToJson(['vist_country', 'vist_from_date', 'vist_end_date', 'vist_country_des'], $_REQUEST, 'vistitem', 'question_i');
+
+ $_REQUEST['other_country_acquired_other'] = isset($_REQUEST['other_country_acquired_other']) ? $_REQUEST['other_country_acquired_other'] : '';
+ $_REQUEST['source'] = Session::get('source' );
+ $_REQUEST['is_mobile'] = isMobile() ? 1 : 0;
+ $_REQUEST['total_price'] = $total_price;
+ $_REQUEST['origin_price'] = $total_price;
+ $_REQUEST['ip'] = getIP();
+ $_REQUEST['coupon_code'] = isset($_REQUEST['coupon_code']) ? $_REQUEST['coupon_code']: '';
+ $_REQUEST['model'] = MODEL;
+ $_REQUEST['token'] = md5(MODEL);
+ $_REQUEST['user_id'] = $this->_userId;
+ $order_res = Httpcurl::request(CREATE_EVUS_ORDER_URL, 'post', $_REQUEST);
+
+ $order = json_decode($order_res[0], true);
+ if (!$order['code']) {
+ return $this->error("提交失败,请联系管理员!");
+ }
+ if ($order['is_pay'] == 1) {
+ return $this->success('操作成功', url('home/pay/succ', ['order_sn' => $order_sn])->build());
+ }
+ return $this->success('操作成功', url('home/pay/index', ['order_sn' => $order_sn])->build());
+ }
+
+ public function upevus()
+ {
+ $id = Request::param('id');
+ if (empty($id)) {
+ return $this->error('参数错误');
+ }
+ $order_sn = base64_decode($id);
+
+ $response = Httpcurl::request(config('app.get_evus_detail_url'), 'post', ['order_sn' => $order_sn, 'model' => MODEL]);
+
+ if ($response[3]) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+
+ $pay_result = json_decode($response[0], true);
+
+ if (empty($pay_result)) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+ if (!$pay_result['code']) {
+ return $this->error($pay_result['msg'], url('detail/index'));
+ }
+ View::assign('country_list', json_decode(file_get_contents('./json/country.json'), true));
+ View::assign('phone_prefix', json_decode(file_get_contents('./json/phone_prefix.json'), true));
+ View::assign('us', json_decode(file_get_contents('./json/us.json'), true));
+ View::assign('goods', config('app.EVUS_GOODS'));
+ View::assign('data', $pay_result['data']);
+ return View::fetch();
+
+ }
+ public function do_update()
+ {
+ unset($_REQUEST['s']);
+ $order_sn = $_REQUEST['order_sn'] = getOrderNumber();
+ $total_price = $_REQUEST['total_price'];
+ /*判断价格是否正确*/
+ $config_price = array_map(function($item) {
+ return $item['value'];
+ }, config('app.EVUS_GOODS'));
+ if (!in_array($total_price, $config_price)) {
+ return $this->error('价格错误');
+ }
+ /*判断价格是否正确*/
+ $_REQUEST['birth_date_day'] = (string)date_parse($_REQUEST['birth_date'])['day'] ?:'0';
+ $_REQUEST['birth_date_month'] = (string)date_parse($_REQUEST['birth_date'])['month'] ?:'0';
+ $_REQUEST['birth_date_year'] = (string)date_parse($_REQUEST['birth_date'])['year'] ?:'0';
+
+ $_REQUEST['passport_expedition_date_day'] = (string)date_parse($_REQUEST['passport_expedition_date'])['day'] ?:'';
+ $_REQUEST['passport_expedition_date_month'] = (string)date_parse($_REQUEST['passport_expedition_date'])['month'] ?:'';
+ $_REQUEST['passport_expedition_date_year'] = (string)date_parse($_REQUEST['passport_expedition_date'])['year'] ?:'';
+
+ $_REQUEST['passport_expiration_date_day'] = (string)date_parse($_REQUEST['passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['passport_expiration_date_month'] = (string)date_parse($_REQUEST['passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['passport_expiration_date_year'] = (string)date_parse($_REQUEST['passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_passport_issue_date_day'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['day'] ?:'';
+ $_REQUEST['us_visa_passport_issue_date_month'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['month'] ?:'';
+ $_REQUEST['us_visa_passport_issue_date_year'] = (string)date_parse($_REQUEST['us_visa_passport_issue_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_passport_expiration_date_day'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['us_visa_passport_expiration_date_month'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['us_visa_passport_expiration_date_year'] = (string)date_parse($_REQUEST['us_visa_passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['us_visa_birth_date_day'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['day'] ?:'';
+ $_REQUEST['us_visa_birth_date_month'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['month'] ?:'';
+ $_REQUEST['us_visa_birth_date_year'] = (string)date_parse($_REQUEST['us_visa_birth_date'])['year'] ?:'';
+
+ $_REQUEST = formDataToJson(['vist_country', 'vist_from_date', 'vist_end_date', 'vist_country_des'], $_REQUEST, 'vistitem', 'question_i');
+
+ $_REQUEST['other_country_acquired_other'] = isset($_REQUEST['other_country_acquired_other']) ? $_REQUEST['other_country_acquired_other'] : '';
+ $_REQUEST['source'] = Session::get('source' );
+ $_REQUEST['is_mobile'] = isMobile() ? 1 : 0;
+ $_REQUEST['total_price'] = $total_price;
+ $_REQUEST['origin_price'] = $total_price;
+ $_REQUEST['ip'] = getIP();
+ $_REQUEST['coupon_code'] = isset($_REQUEST['coupon_code']) ? $_REQUEST['coupon_code']: '';
+ $_REQUEST['model'] = MODEL;
+ $_REQUEST['token'] = md5(MODEL);
+ $_REQUEST['user_id'] = $this->_userId;
+ $order_res = Httpcurl::request(CREATE_EVUS_ORDER_URL, 'post', $_REQUEST);
+ $order = json_decode($order_res[0], true);
+ if (!$order['code']) {
+ return $this->error("提交失败,请联系管理员!");
+ }
+ if ($order['is_pay'] == 1) {
+ return $this->success('操作成功', url('home/pay/succ', ['order_sn' => $order_sn])->build());
+ }
+ return $this->success('操作成功', url('home/pay/index', ['order_sn' => $order_sn])->build());
+ }
+ function do_esta_apply()
+ {
+ unset($_REQUEST['s']);
+ unset($_REQUEST['file']);
+ /*判断价格是否正确*/
+
+ $_REQUEST['birth_date_day'] = (string)date_parse($_REQUEST['birth_date'])['day'] ?:'0';
+ $_REQUEST['birth_date_month'] = (string)date_parse($_REQUEST['birth_date'])['month'] ?:'0';
+ $_REQUEST['birth_date_year'] = (string)date_parse($_REQUEST['birth_date'])['year'] ?:'0';
+
+ $_REQUEST['passport_expedition_date_day'] = (string)date_parse($_REQUEST['passport_expedition_date'])['day'] ?:'';
+ $_REQUEST['passport_expedition_date_month'] = (string)date_parse($_REQUEST['passport_expedition_date'])['month'] ?:'';
+ $_REQUEST['passport_expedition_date_year'] = (string)date_parse($_REQUEST['passport_expedition_date'])['year'] ?:'';
+
+ $_REQUEST['passport_expiration_date_day'] = (string)date_parse($_REQUEST['passport_expiration_date'])['day'] ?:'';
+ $_REQUEST['passport_expiration_date_month'] = (string)date_parse($_REQUEST['passport_expiration_date'])['month'] ?:'';
+ $_REQUEST['passport_expiration_date_year'] = (string)date_parse($_REQUEST['passport_expiration_date'])['year'] ?:'';
+
+ $_REQUEST['other_country_date_day'] = (string)date_parse($_REQUEST['other_country_date'])['day'] ?:'';
+ $_REQUEST['other_country_date_month'] = (string)date_parse($_REQUEST['other_country_date'])['month'] ?:'';
+ $_REQUEST['other_country_date_year'] = (string)date_parse($_REQUEST['other_country_date'])['year'] ?:'';
+ unset($_REQUEST['other_country_date']);
+
+ $_REQUEST['other_country_edate_day'] = (string)date_parse($_REQUEST['other_country_edate'])['day'] ?:'';
+ $_REQUEST['other_country_edate_month'] = (string)date_parse($_REQUEST['other_country_edate'])['month'] ?:'';
+ $_REQUEST['other_country_edate_year'] = (string)date_parse($_REQUEST['other_country_edate'])['year'] ?:'';
+ unset($_REQUEST['other_country_edate']);
+ $_REQUEST['model'] = ESTA_MODEL;
+ $_REQUEST['token'] = md5(ESTA_MODEL);
+ $_REQUEST['other_country_acquired_other'] = isset($_REQUEST['other_country_acquired_other']) ? $_REQUEST['other_country_acquired_other'] : '';
+ $refer_url= Session::get('update_refer_url');
+
+ $order_res = Httpcurl::request(config('app.update_order_url'), 'post', $_REQUEST);
+
+ $order = json_decode($order_res[0], true);
+ if (!$order['code']) {
+ return $this->error("提交失败,请联系管理员!");
+ }
+ // python($order_sn);
+ return $this->success('修改成功', $refer_url);
+
+ }
+ function do_admin_apply()
+ {
+
+ unset($_REQUEST['s'],$_REQUEST['id']);
+ $id = Request::param('id');
+ $order_sn = think_decrypt($id);
+ if (empty($_REQUEST['family_name_alias']) || empty($_REQUEST['given_name_alias'])){
+ $_REQUEST['have_alias'] = 2;
+ }
+ $data = Db::name('msg')->where(['order_sn' => $order_sn])->find();
+ $insert_id = Db::name('msg')->where(['order_sn' => $order_sn])->update($_REQUEST);
+// $url = "http://manage.evus.cn/index.php?s=/Immigrant/index.html";
+ $url='https://manage.evus.cn/index.php?s=/Immigrant/detail/id/'.$data['id'];
+ Db::name('msg_format')->where(['order_sn' => $order_sn])->delete();
+ if ($insert_id >= 0) {
+ // python($order_sn);
+ return $this->success('修改成功', $url);
+ // $this->redirect($url);
+ } else {
+ return $this->error("提交失败,请联系管理员!", $url);
+ }
+ }
+}
diff --git a/app/home/controller/Upload.php b/app/home/controller/Upload.php
new file mode 100644
index 0000000..4bbf846
--- /dev/null
+++ b/app/home/controller/Upload.php
@@ -0,0 +1,153 @@
+param('id');
+ !empty($order_sn) or $this->error('参数错误');
+ //获取数据
+ $response = Httpcurl::request(config('app.get_evus_detail_url'), 'post', ['order_sn' => $order_sn, 'model' => MODEL]);
+ if ($response[3]) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+ $pay_result = json_decode($response[0], true);
+ if (empty($pay_result)) {
+ return $this->error("订单不存在,请重新提交", url('detail/index'));
+ }
+ if (!$pay_result['code']) {
+ return $this->error($pay_result['msg'], url('detail/index'));
+ }
+
+ Db::name('images_log')->where(['order_sn' => $order_sn, 'type' => 'evus登记信息(护照、签证)有误'])->update([
+ 'is_read' => 1
+ ]);
+ View::assign('data', $pay_result['data']);
+ return View::fetch();
+
+ }
+ public function upload_file()
+ {
+ // 获取上传的文件
+ $file = request()->file('file');
+
+ if (!$file) {
+ return json([
+ 'code' => 0,
+ 'msg' => '请选择上传文件',
+ ]);
+ }
+ $imgdata = file_get_contents($file->getPathname());
+ /*同时上传护照文件*/
+ $fileName = date('YmdHis') . uniqid() . '.' . pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
+ try {
+ $client = SwooleService::getInstance();
+
+ $client->sendTask([
+ 'type' => 'upload_ali',
+ 'data' => [
+ 'Bucket' => BUCKET,
+ 'Key' => $fileName, //重命名的文件名
+ 'file_content' => base64_encode($imgdata),
+ ]
+ ]);
+ $client->close();
+ return json([
+ 'code' => 1,
+ 'msg' => '上传成功',
+ 'path' => OSS_URL . $fileName,
+ ]);
+ } catch (\Exception $e) {
+ return json([
+ 'code' => 0,
+ 'msg' => '上传失败',
+ 'path' => ''
+ ]);
+ }
+ }
+
+ public function file_upload()
+ {
+ // 获取上传的文件
+ $file = request()->file('file');
+
+ if (!$file) {
+ return json([
+ 'code' => 0,
+ 'msg' => '请选择上传文件',
+ ]);
+ }
+ $imgdata = file_get_contents($file->getPathname());
+ $fileName = date('YmdHis') . uniqid() . '.' . pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
+ try {
+ $client = SwooleService::getInstance();
+ $client->sendTask([
+ 'type' => 'upload_ali',
+ 'data' => [
+ 'Bucket' => BUCKET,
+ 'Key' => $fileName, //重命名的文件名
+ 'file_content' => base64_encode($imgdata),
+ ]
+ ]);
+ $client->close();
+ return json([
+ 'code' => 1,
+ 'msg' => '上传成功',
+ 'path' => OSS_URL . $fileName,
+ ]);
+ } catch (\Exception $e) {
+ return json([
+ 'code' => 0,
+ 'msg' => '上传失败',
+ 'path' => '',
+ ]);
+ }
+ }
+ public function doapply()
+ {
+ $params = Request::instance()->param();
+ !empty($params['order_sn']) or $this->error('参数错误');
+ $imgs = array_filter($params['imgs']);
+ if (empty($imgs)) {
+ return $this->error('请上传照片');
+ }
+ $order = Db::name('msg')->where(['order_sn' => $params['order_sn']])->find();
+ if (empty($order)) {
+ return $this->error('数据错误,请联系管理员');
+ }
+ $data = [];
+ foreach ($imgs as $ig) {
+ $data[] = [
+ 'order_id' => $order['id'],
+ 'order_sn' => $order['order_sn'],
+ 'last_name' => $order['last_name'],
+ 'first_name' => $order['first_name'],
+ 'passport_number' => $order['passport_number'],
+ 'visa_foil_number' => $order['visa_foil_number'],
+ 'img' => $ig
+ ];
+ }
+ $res = Db::name('images')->insertAll($data);
+ if ($res > 0) {
+ //推送发票
+ $url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4c22d454-4abf-48bb-8512-fb591a3ac545';
+ $data = array('msgtype' => 'text', 'text' => [
+ 'content' => "订单号{$order['order_sn']}已成功更新护照信息,请及时处理",
+ ]);
+ Httpcurl::request($url, 'post', json_encode($data), [
+ 'Content-Type: application/json'
+ ]);
+ return $this->success('上传成功', url('home/index/index'));
+ } else {
+ return $this->error('数据错误,请联系管理员');
+ }
+ }
+}
diff --git a/app/home/controller/User.php b/app/home/controller/User.php
new file mode 100644
index 0000000..cff696c
--- /dev/null
+++ b/app/home/controller/User.php
@@ -0,0 +1,278 @@
+ '未跟进',
+ '1' => '跟进中',
+ '3' => '已完成',
+ ];
+
+ public function initialize()
+ {
+ parent::initialize();
+ if (!Session::has('user') || Session::get('user')['id'] <= 0) {
+ throw new HttpResponseException(redirect('/home/login'));
+ }
+ $this->userinfo = Session::get('user');
+ View::assign('userinfo', $this->userinfo);
+ View::assign('is_user_center', true);
+ }
+
+ /**个人中心
+ */
+ public function order()
+ {
+ $paystatus = Request::instance()->param('paystatus', '');
+ $paystatus = $paystatus ? $paystatus : 'pay';
+ if (!in_array($paystatus, ['pay', 'nopay'])) {
+ return $this->error('参数错误');
+ }
+ $list = Httpcurl::request(GET_ORDER_URL, 'post', [
+ 'model' => MODEL,
+ 'user_id' => $this->_userId,
+ 'invoiceType' => INCOICETYPE,
+ 'pay_status' => $paystatus,
+ ]);
+ $result = json_decode($list[0], true);
+ Log::info(json_encode($result));
+ if (empty($result)) {
+ return $this->error('获取订单失败');
+ }
+ if (!$result['code']) {
+ return $this->error('获取订单失败');
+ }
+ return view('', [
+ 'paystauts' => $paystatus,
+ 'data' => $result['data'],
+ ]);
+ }
+ public function orderEsta()
+ {
+ $paystatus = Request::instance()->param('paystatus', '');
+ $paystatus = $paystatus ? $paystatus : 'pay';
+ if (!in_array($paystatus, ['pay', 'nopay'])) {
+ return $this->error('参数错误');
+ }
+ $list = Httpcurl::request(GET_ORDER_URL, 'post', [
+ 'model' => ESTA_MODEL,
+ 'user_id' => $this->_userId,
+ 'invoiceType' => ESTA_INCOICETYPE,
+ 'pay_status' => $paystatus,
+ ]);
+ $result = json_decode($list[0], true);
+ Log::info(json_encode($result));
+ if (empty($result)) {
+ return $this->error('获取订单失败');
+ }
+ if (!$result['code']) {
+ return $this->error('获取订单失败');
+ }
+ return view('', [
+ 'paystauts' => $paystatus,
+ 'data' => $result['data'],
+ ]);
+
+ }
+ public function invoice()
+ {
+ return View::fetch();
+ }
+ public function multiple()
+ {
+ return View::fetch();
+ }
+
+ public function logout()
+ {
+ Session::delete('user');
+ return redirect('/home/index');
+ }
+
+ public function checkInvoice()
+ {
+ $res = [
+ 'status' => 0,
+ 'msg' => '操作失败'
+ ];
+ $passport_number = Request::instance()->param('passport_number');
+ $order_sn = Request::instance()->param('order_sn');
+ $last_name = Request::instance()->param('last_name');
+ $first_name = Request::instance()->param('first_name');
+ if (empty($passport_number) || empty($order_sn) || empty($last_name) || empty($first_name)) {
+ $res['msg'] = '参数错误';
+ return json($res);
+ }
+ $base_url = config('app.order_url');
+
+ $order_url = $base_url . 'checkInvoice';
+ $response = Httpcurl::request($order_url, 'post', [
+ 'passport_number' => trim($passport_number),
+ 'order_sn' => trim($order_sn),
+ 'last_name' => trim($last_name),
+ 'first_name' => trim($first_name),
+ 'model' => MODEL
+ ]);
+ if ($response[3]) {
+ $res['msg'] = '参数错误';
+ return json($res);
+ }
+ $data = json_decode($response[0], true);
+ Log::info(json_encode($data));
+ if (empty($data)) {
+ $res['msg'] = '系统错误,请联系管理员!';
+ return json($res);
+ }
+ if (!$data['code']) {
+ $res['msg'] = "暂无订单信息";
+ return json($res);
+ }
+ $invoice_url = $base_url . 'getInvoice';
+ //判断是否已经开票了
+ $response = Httpcurl::request($invoice_url, 'post', [
+ 'order_sn' => $order_sn,
+ 'invoiceType' => INCOICETYPE,
+ 'model' => MODEL
+ ]);
+ if ($response[3]) {
+ $res['msg'] = '参数错误';
+ return json($res);
+ }
+ $order = json_decode($response[0], true);
+ Log::info(json_encode($order));
+ if (empty($order)) {
+ $res['msg'] = '系统错误,请联系管理员!';
+ return json($res);
+ }
+ if (!$order['code']) {
+ return json($res);
+ }
+ if (!empty($order['data'])) {
+ $res['msg'] = '发票已受理,请勿重复提交';
+ return json($res);
+ }
+ $res = [
+ 'status' => 1,
+ 'msg' => '操作成功',
+ 'url' => '/home/invoice/index/order_sn/' . $order_sn
+ ];
+ return json($res);
+
+ }
+
+ public function checkMultiple()
+ {
+ $res = [
+ 'status' => 0,
+ 'msg' => '操作失败'
+ ];
+ $datas = Request::instance()->param('datas');
+ if (empty($datas)) {
+ $res['msg'] = '参数错误';
+ return json($res);
+ }
+ $datas = json_decode(html_entity_decode(stripslashes($datas)), true);
+ if (empty($datas)) {
+ $res['msg'] = '数据错误';
+ return json($res);
+ }
+ $order_sns = array_column($datas, 'order_sn');
+ //判断是否有重复订单
+ if (count($order_sns) != count(array_unique($order_sns))) {
+ $res['msg'] = '有重复订单,请删除后重新提交';
+ return json($res);
+ }
+ $base_url = config('app.order_url');
+
+ $order_url = $base_url . 'checkInvoice';
+ $invoice_url = $base_url . 'getInvoice';
+ foreach ($datas as $da) {
+ //获取信息
+ $response = Httpcurl::request($order_url, 'post', [
+ 'passport_number' => trim($da['passport_number']),
+ 'order_sn' => trim($da['order_sn']),
+ 'last_name' => trim($da['last_name']),
+ 'first_name' => trim($da['first_name']),
+ 'model' => MODEL
+ ]);
+ if ($response[3]) {
+ $res['msg'] = '参数错误';
+ return json($res);
+ }
+ $data = json_decode($response[0], true);
+ Log::info(json_encode($data));
+ if (empty($data)) {
+ $res['msg'] = '未查到订单信息';
+ return json($res);
+ }
+ //查询是否已经开票了
+ $response = Httpcurl::request($invoice_url, 'post', [
+ 'order_sn' => trim($da['order_sn']),
+ 'invoiceType' => INCOICETYPE,
+ 'model' => MODEL
+ ]);
+ if ($response[3]) {
+ $res['msg'] = '参数错误';
+ return json($res);
+ }
+ $order = json_decode($response[0], true);
+ Log::info(json_encode($order));
+ if (empty($order)) {
+ $res['msg'] = '系统错误,请联系管理员!';
+ return json($res);
+ }
+ if (!$order['code']) {
+ $res['msg'] = $order['msg'];
+ return json($res);
+ }
+ if (!empty($order['data'])) {
+ $res['msg'] = '订单号:' . $da['order_sn'] . '已经开票';
+ return json($res);
+ }
+ }
+ $order_sns = implode('-', $order_sns);
+
+ $res = [
+ 'status' => 1,
+ 'msg' => '操作成功',
+ 'url' => url('home/multiple/index', ['id' => base64_encode($order_sns)])->build()
+ ];
+ return json($res);
+
+ }
+
+ public function pay()
+ {
+ $order_sn = Request::instance()->param('order_sn');
+ if (empty($order_sn)) {
+ return $this->error('参数错误');
+ }
+ $order_url = config('app.get_evus_detail_url');
+ $response = Httpcurl::request($order_url, 'post', ['order_sn' => $order_sn, 'model' => MODEL]);
+ if ($response[3]) {
+ return $this->error("订单不存在,请重新提交", url('visa/index'));
+ }
+ $pay_result = json_decode($response[0], true);
+ Log::info(json_encode($pay_result));
+ if (empty($pay_result)) {
+ return $this->error("订单不存在,请重新提交", url('visa/index'));
+ }
+ if (!$pay_result['code']) {
+ return $this->error($pay_result['msg'], url('visa/index'));
+ }
+ return redirect(url('home/pay/index', ['order_sn' => $pay_result['data']['order_sn']])->build());
+
+ }
+}
+
diff --git a/app/home/controller/Usvisa.php b/app/home/controller/Usvisa.php
new file mode 100644
index 0000000..af9675f
--- /dev/null
+++ b/app/home/controller/Usvisa.php
@@ -0,0 +1,72 @@
+pageContext(Request::instance()->param()));
+
+ return View::fetch();
+ }
+
+ public function submit()
+ {
+ if (!request()->isPost()) {
+ return json([
+ 'code' => -1,
+ 'msg' => '请通过页面提交信息',
+ ]);
+ }
+
+ $intake = new UsvisaIntakeService();
+ $params = Request::instance()->param();
+ unset($params['s']);
+
+ $branch = $intake->branchByCode($params['branch_code'] ?? '');
+ if (empty($branch)) {
+ return json([
+ 'code' => -1,
+ 'msg' => '请确认扫码支行信息',
+ ]);
+ }
+
+ $submission = $intake->submissionFrom($params, $branch);
+ $requiredMessage = $intake->requiredMessage($submission);
+ if ($requiredMessage !== '') {
+ return json([
+ 'code' => -1,
+ 'msg' => $requiredMessage,
+ ]);
+ }
+
+ try {
+ $result = $intake->submitToApi($submission);
+ } catch (\Throwable $e) {
+ Log::error('Failed to submit usvisa to OA: ' . $e->getMessage());
+
+ return json([
+ 'code' => -1,
+ 'msg' => '提交失败,请稍后再试',
+ ]);
+ }
+
+ if (!$intake->apiSuccess($result)) {
+ Log::warning('OA usvisa api returned failure: ' . json_encode([
+ 'code' => $result['code'] ?? null,
+ 'msg' => $result['msg'] ?? '',
+ ], JSON_UNESCAPED_UNICODE));
+ }
+
+ return json($result);
+ }
+}
diff --git a/app/home/controller/Visa.php b/app/home/controller/Visa.php
new file mode 100644
index 0000000..d528009
--- /dev/null
+++ b/app/home/controller/Visa.php
@@ -0,0 +1,783 @@
+error('参数错误');
+ }
+ $data = Db::name('visa')->where(['order_sn' => $order_sn])->find();
+ $data['accom_people'] = $data['accom_people'] ? json_decode($data['accom_people'], true) : [];
+ $data['to_us_info'] = $data['to_us_info'] ? json_decode($data['to_us_info'], true) : [];
+ $data['job_info'] = $data['job_info'] ? json_decode($data['job_info'], true) : [];
+ $data['educational_info'] = $data['educational_info'] ? json_decode($data['educational_info'], true) : [];
+ $data['language'] = $data['language'] ? json_decode($data['language'], true) : [];
+ $data['other_countries'] = $data['other_countries'] ? json_decode($data['other_countries'], true) : [];
+ $data['province'] = $data['province'] ? $data['province'] : '北京市';
+ $data['city_birth'] = $data['city_birth'] ? $data['city_birth'] : '北京市';
+ $data['issue_province'] = $data['issue_province'] ? $data['issue_province'] : '北京市';
+ $data['issue_city'] = $data['issue_city'] ? $data['issue_city'] : '北京市';
+ $data['home_address_line_spr'] = $data['home_address_line_spr'] ? $data['home_address_line_spr'] : '北京市';
+ $data['home_address_line_city'] = $data['home_address_line_city'] ? $data['home_address_line_city'] : '北京市';
+ $data['mail_province'] = $data['mail_province'] ? $data['mail_province'] : '北京市';
+ $data['mail_city'] = $data['mail_city'] ? $data['mail_city'] : '北京市';
+ $data['paying_province'] = $data['paying_province'] ? $data['paying_province'] : '北京市';
+ $data['paying_city'] = $data['paying_city'] ? $data['paying_city'] : '北京市';
+ $data['paying_other_province'] = $data['paying_other_province'] ? $data['paying_other_province'] : '北京市';
+ $data['paying_other_city'] = $data['paying_other_city'] ? $data['paying_other_city'] : '北京市';
+ $data['driver_info'] = $data['driver_info'] ? json_decode($data['driver_info'], true) : [];
+ $data['professional'] = $data['professional'] ? json_decode($data['professional'], true) : [];
+ $data['military_country'] = $data['military_country'] ? json_decode($data['military_country'], true) : [];
+ $data['formers_info'] = $data['formers_info'] ? json_decode($data['formers_info'], true) : [];
+ $data['immediate_info'] = $data['immediate_info'] ? json_decode($data['immediate_info'], true) : [];
+ View::assign('data', $data);
+ View::assign('flag', $flag);
+ return View::fetch('upvisa');
+ }
+
+ public function submit()
+ {
+ $id = Request::param('order_sn');
+ if (empty($id)) {
+ return $this->error('参数不能为空!');
+ }
+ if (empty($_REQUEST['captcha'])) {
+ return $this->error('验证码不能为空!');
+ }
+ $verify = new \api\Verify();
+ if (!$verify->check($_REQUEST['captcha'], 1)) {
+ return $this->error('验证码错误!');
+ }
+ unset($_REQUEST['s'], $_REQUEST['file'], $_REQUEST['captcha']);
+ $res = Db::name('visa')->where(['order_sn' => $id])->find();
+ if (empty($res)) {
+ return $this->error('参数错误');
+ }
+ if (empty($res['is_effective'])) {
+ return $this->error('链接已失效');
+ }
+ //随行人员信息json
+ if (isset($_REQUEST['is_accom_people']) && $_REQUEST['is_accom_people'] == 1) {
+ $_REQUEST['accom_people'] = arrayToJson(['accom_people_last_name', 'accom_people_first_name', 'relationship'], [
+ $_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']
+ ]);
+ unset($_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']);
+ } else {
+ unset($_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']);
+ }
+ if (isset($_REQUEST['is_to_us']) && $_REQUEST['is_to_us'] == 1) {
+ //去过美国信息
+ $_REQUEST['to_us_info'] = arrayToJson(['to_us_date', 'to_us_stay_date', 'to_us_stay_type'], [
+ $_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']
+ ]);
+ unset($_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']);
+
+ } else {
+ unset($_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']);
+
+ }
+ //是否有驾照信息
+ if (isset($_REQUEST['is_us_driver']) && !empty($_REQUEST['is_us_driver'])) {
+ $_REQUEST['driver_info'] = arrayToJson(['driver_number', 'driver_state'], [
+ $_REQUEST['driver_number'], $_REQUEST['driver_state']
+ ]);
+ unset($_REQUEST['driver_number'], $_REQUEST['driver_state']);
+
+ } else {
+ unset($_REQUEST['driver_number'], $_REQUEST['driver_state']);
+ }
+ if (isset($_REQUEST['is_job']) && $_REQUEST['is_job'] == 1) {
+ //你以前是否有过工作
+ $_REQUEST['job_info'] = arrayToJson([
+ 'job_unit_name', 'job_country', 'job_province', 'job_city',
+ 'job_first_address', 'job_second_address', 'job_mobile', 'job_zip_code',
+ 'job_title', 'supervisor_last_name', 'supervisor_first_name', 'job_startime',
+ 'job_endtime', 'job_response'
+ ], [
+ $_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province'],
+ $_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address'],
+ $_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title'],
+ $_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime'],
+ $_REQUEST['job_endtime'], $_REQUEST['job_response']
+ ]);
+ unset($_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province']);
+ unset($_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address']);
+ unset($_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title']);
+ unset($_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime']);
+ unset($_REQUEST['job_endtime'], $_REQUEST['job_response']);
+ } else {
+ unset($_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province']);
+ unset($_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address']);
+ unset($_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title']);
+ unset($_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime']);
+ unset($_REQUEST['job_endtime'], $_REQUEST['job_response']);
+ }
+ if (isset($_REQUEST['is_educational']) && $_REQUEST['is_educational'] == 1) {
+ //你是否曾就读于任何中学或以上程度的教育机构
+ $_REQUEST['educational_info'] = arrayToJson([
+ 'edu_name', 'edu_country', 'edu_province', 'edu_city',
+ 'edu_first_address', 'edu_second_address', 'edu_zip_code', 'edu_course', 'edu_startime', 'edu_endtime'
+ ], [
+ $_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city'],
+ $_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
+ $_REQUEST['edu_startime'], $_REQUEST['edu_endtime'],
+ ]);
+ unset($_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city']);
+ unset($_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
+ $_REQUEST['edu_startime'], $_REQUEST['edu_endtime']);
+
+ } else {
+ unset($_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city']);
+ unset($_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
+ $_REQUEST['edu_startime'], $_REQUEST['edu_endtime']);
+
+ }
+ if (isset($_REQUEST['language']) && !empty($_REQUEST['language'])) {
+ //请提供你所使用的语言
+ $language = array_filter($_REQUEST['language']);
+ if (empty($language)) {
+ $_REQUEST['language'] = '';
+ } else {
+ $_REQUEST['language'] = json_encode($language);
+ }
+
+ } else {
+ unset($_REQUEST['language']);
+ }
+ if (isset($_REQUEST['professional']) && !empty($_REQUEST['professional'])) {
+ //请提供你所使用的语言
+ $language = array_filter($_REQUEST['professional']);
+ if (empty($language)) {
+ $_REQUEST['professional'] = '';
+ } else {
+ $_REQUEST['professional'] = json_encode($language);
+ }
+
+ } else {
+ unset($_REQUEST['professional']);
+ }
+ //服役的国家
+ if (isset($_REQUEST['military_country']) && !empty($_REQUEST['military_country'])) {
+
+ $_REQUEST['military_country'] = arrayToJson([
+ 'military_country', 'services', 'military_rank', 'military_specialties', 'military_start_date', 'military_end_date'
+ ], [
+ $_REQUEST['military_country'], $_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']
+ ]);
+ unset($_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']);
+ } else {
+ unset($_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']);
+ }
+ //美国是否有不包括父母在内的直系亲属
+ if (isset($_REQUEST['is_immediate']) && !empty($_REQUEST['is_immediate'])) {
+
+ $_REQUEST['immediate_info'] = arrayToJson([
+ 'immediate_last_name', 'immediate_first_name', 'you_ship', 'identity'
+ ], [
+ $_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']
+ ]);
+ unset($_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']);
+ } else {
+ unset($_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']);
+ }
+
+ if (isset($_REQUEST['is_other_countries']) && $_REQUEST['is_other_countries'] == 1) {
+ $other_countries = array_filter($_REQUEST['other_countries']);
+ if (empty($other_countries)) {
+ $_REQUEST['other_countries'] = '';
+ } else {
+ $_REQUEST['other_countries'] = json_encode($other_countries);
+ }
+
+ } else {
+ unset($_REQUEST['other_countries']);
+ }
+ if ($_REQUEST['marital'] == 'D' && !empty($_REQUEST['formers_last_name'])) {
+ //婚姻状况选择“离异”时 增加前任信息
+ $_REQUEST['formers_info'] = arrayToJson([
+ 'formers_last_name', 'formers_first_name', 'formers_birth_date', 'formers_nationality',
+ 'formers_birth_country', 'formers_birth_city', 'formers_marriage_date', 'formers_marriage_end_date',
+ 'formers_marriage_end_explain', 'formers_marriage_end_country',
+ ], [
+ $_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'], $_REQUEST['formers_nationality'],
+ $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'], $_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'],
+ $_REQUEST['formers_marriage_end_explain'], $_REQUEST['formers_marriage_end_country']
+ ]);
+ unset(
+ $_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'],
+ $_REQUEST['formers_nationality'], $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'],
+ $_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'], $_REQUEST['formers_marriage_end_explain'],
+ $_REQUEST['formers_marriage_end_country']
+ );
+ } else {
+ unset(
+ $_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'],
+ $_REQUEST['formers_nationality'], $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'],
+ $_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'], $_REQUEST['formers_marriage_end_explain'],
+ $_REQUEST['formers_marriage_end_country']
+ );
+ }
+// var_dump($_REQUEST);exit;
+ for ($i = 1; $i < 28; $i++) {
+ unset($_REQUEST['safety' . $i]);
+ }
+ $_REQUEST['visa_cate'] = getCate($_REQUEST['visa_detail']);
+ $_REQUEST['is_effective'] = 0;
+ $_REQUEST['progress'] = 100;
+ $resd = Db::name('visa')->where(['order_sn' => $id])->update($_REQUEST);
+ if ($resd !== false) {
+ $url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=cbe82d37-ede8-474b-81dc-1ca7dcf56d80';
+ $datas = array('msgtype' => 'text', 'text' => [
+ 'content' => "订单号:{$res['order_sn']},姓名:{$_REQUEST['last_name_zn']}{$_REQUEST['first_name_zn']}美签表单已提交,请及时审核",
+ ]);
+ Httpcurl::request($url, 'post', json_encode($datas), [
+ 'Content-Type: application/json'
+ ]);
+
+ return $this->success("提交成功", url('visa/upvisa')->build());
+ } else {
+ return $this->error('提交失败!');
+ }
+ }
+
+ public function saves()
+ {
+ $verify = new \api\Verify();
+ $id = Request::param('order_sn');
+ if (empty($id)) {
+ return $this->error('参数不能为空!');
+ }
+ if (empty($_REQUEST['captcha'])) {
+ return $this->error('验证码不能为空!');
+ }
+ if (!$verify->check($_REQUEST['captcha'], 1)) {
+ return $this->error('验证码错误!');
+ }
+ unset($_REQUEST['s'], $_REQUEST['file'], $_REQUEST['captcha']);
+ $res = Db::name('visa')->where(['order_sn' => $id])->find();
+ if (empty($res)) {
+ return $this->error('参数错误');
+ }
+ $ip = getIp();
+ Log::write('ip:' . $ip . '=====id:' . $id);
+ $disableips = Config::get('disable_ip');
+ if (in_array($ip, $disableips)) {
+ return $this->error('非法请求');
+ }
+
+ if (empty($res['is_effective'])) {
+ return $this->error('链接已失效');
+ }
+ //随行人员信息json
+ if (isset($_REQUEST['is_accom_people']) && $_REQUEST['is_accom_people'] == 1) {
+ $_REQUEST['accom_people'] = arrayToJson(['accom_people_last_name', 'accom_people_first_name', 'relationship'], [
+ $_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']
+ ]);
+ unset($_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']);
+ } else {
+ unset($_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']);
+ }
+ if (isset($_REQUEST['is_to_us']) && $_REQUEST['is_to_us'] == 1) {
+ //去过美国信息
+ $_REQUEST['to_us_info'] = arrayToJson(['to_us_date', 'to_us_stay_date', 'to_us_stay_type'], [
+ $_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']
+ ]);
+ unset($_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']);
+
+ } else {
+ unset($_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']);
+
+ }
+ //是否有驾照信息
+ if (isset($_REQUEST['is_us_driver']) && !empty($_REQUEST['is_us_driver'])) {
+ $_REQUEST['driver_info'] = arrayToJson(['driver_number', 'driver_state'], [
+ $_REQUEST['driver_number'], $_REQUEST['driver_state']
+ ]);
+ unset($_REQUEST['driver_number'], $_REQUEST['driver_state']);
+
+ } else {
+ unset($_REQUEST['driver_number'], $_REQUEST['driver_state']);
+ }
+ if (isset($_REQUEST['is_job']) && $_REQUEST['is_job'] == 1) {
+ //你以前是否有过工作
+ $_REQUEST['job_info'] = arrayToJson([
+ 'job_unit_name', 'job_country', 'job_province', 'job_city',
+ 'job_first_address', 'job_second_address', 'job_mobile', 'job_zip_code',
+ 'job_title', 'supervisor_last_name', 'supervisor_first_name', 'job_startime',
+ 'job_endtime', 'job_response'
+ ], [
+ $_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province'],
+ $_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address'],
+ $_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title'],
+ $_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime'],
+ $_REQUEST['job_endtime'], $_REQUEST['job_response']
+ ]);
+ unset($_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province']);
+ unset($_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address']);
+ unset($_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title']);
+ unset($_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime']);
+ unset($_REQUEST['job_endtime'], $_REQUEST['job_response']);
+ } else {
+ unset($_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province']);
+ unset($_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address']);
+ unset($_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title']);
+ unset($_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime']);
+ unset($_REQUEST['job_endtime'], $_REQUEST['job_response']);
+ }
+ if (isset($_REQUEST['is_educational']) && $_REQUEST['is_educational'] == 1) {
+ //你是否曾就读于任何中学或以上程度的教育机构
+ $_REQUEST['educational_info'] = arrayToJson([
+ 'edu_name', 'edu_country', 'edu_province', 'edu_city',
+ 'edu_first_address', 'edu_second_address', 'edu_zip_code', 'edu_course', 'edu_startime', 'edu_endtime'
+ ], [
+ $_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city'],
+ $_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
+ $_REQUEST['edu_startime'], $_REQUEST['edu_endtime'],
+ ]);
+ unset($_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city']);
+ unset($_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
+ $_REQUEST['edu_startime'], $_REQUEST['edu_endtime']);
+
+ } else {
+ unset($_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city']);
+ unset($_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
+ $_REQUEST['edu_startime'], $_REQUEST['edu_endtime']);
+
+ }
+ if (isset($_REQUEST['language']) && !empty($_REQUEST['language'])) {
+ //请提供你所使用的语言
+ $language = array_filter($_REQUEST['language']);
+ if (empty($language)) {
+ $_REQUEST['language'] = '';
+ } else {
+ $_REQUEST['language'] = json_encode($language);
+ }
+
+ } else {
+ unset($_REQUEST['language']);
+ }
+ if (isset($_REQUEST['professional']) && !empty($_REQUEST['professional'])) {
+ //请提供你所使用的语言
+ $language = array_filter($_REQUEST['professional']);
+ if (empty($language)) {
+ $_REQUEST['professional'] = '';
+ } else {
+ $_REQUEST['professional'] = json_encode($language);
+ }
+
+ } else {
+ unset($_REQUEST['professional']);
+ }
+ //服役的国家
+ if (isset($_REQUEST['military_country']) && !empty($_REQUEST['military_country'])) {
+
+ $_REQUEST['military_country'] = arrayToJson([
+ 'military_country', 'services', 'military_rank', 'military_specialties', 'military_start_date', 'military_end_date'
+ ], [
+ $_REQUEST['military_country'], $_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']
+ ]);
+ unset($_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']);
+ } else {
+ unset($_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']);
+ }
+ //美国是否有不包括父母在内的直系亲属
+ if (isset($_REQUEST['is_immediate']) && !empty($_REQUEST['is_immediate'])) {
+
+ $_REQUEST['immediate_info'] = arrayToJson([
+ 'immediate_last_name', 'immediate_first_name', 'you_ship', 'identity'
+ ], [
+ $_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']
+ ]);
+ unset($_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']);
+ } else {
+ unset($_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']);
+ }
+
+ if (isset($_REQUEST['is_other_countries']) && $_REQUEST['is_other_countries'] == 1) {
+ $other_countries = array_filter($_REQUEST['other_countries']);
+ if (empty($other_countries)) {
+ $_REQUEST['other_countries'] = '';
+ } else {
+ $_REQUEST['other_countries'] = json_encode($other_countries);
+ }
+
+ } else {
+ unset($_REQUEST['other_countries']);
+ }
+ if ($_REQUEST['marital'] == 'D' && !empty($_REQUEST['formers_last_name'])) {
+ //婚姻状况选择“离异”时 增加前任信息
+ $_REQUEST['formers_info'] = arrayToJson([
+ 'formers_last_name', 'formers_first_name', 'formers_birth_date', 'formers_nationality',
+ 'formers_birth_country', 'formers_birth_city', 'formers_marriage_date', 'formers_marriage_end_date',
+ 'formers_marriage_end_explain', 'formers_marriage_end_country',
+ ], [
+ $_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'], $_REQUEST['formers_nationality'],
+ $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'], $_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'],
+ $_REQUEST['formers_marriage_end_explain'], $_REQUEST['formers_marriage_end_country']
+ ]);
+ unset(
+ $_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'],
+ $_REQUEST['formers_nationality'], $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'],
+ $_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'], $_REQUEST['formers_marriage_end_explain'],
+ $_REQUEST['formers_marriage_end_country']
+ );
+ } else {
+ unset(
+ $_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'],
+ $_REQUEST['formers_nationality'], $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'],
+ $_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'], $_REQUEST['formers_marriage_end_explain'],
+ $_REQUEST['formers_marriage_end_country']
+ );
+ }
+// var_dump($_REQUEST);exit;
+ for ($i = 1; $i < 28; $i++) {
+ unset($_REQUEST['safety' . $i]);
+ }
+ $_REQUEST['visa_cate'] = getCate($_REQUEST['visa_detail']);
+ $res = Db::name('visa')->where(['order_sn' => $id])->update($_REQUEST);
+ if ($res !== false) {
+ return $this->success("提交成功", url('visa/upvisa')->build());
+ } else {
+ return $this->error('提交失败!');
+ }
+ }
+
+ public function zancun()
+ {
+ $id = Request::param('order_sn');
+ if (empty($id)) {
+ return $this->error('参数不能为空!');
+ }
+
+ unset($_REQUEST['s'], $_REQUEST['file'], $_REQUEST['captcha']);
+ $res = Db::name('visa')->where(['order_sn' => $id])->find();
+ if (empty($res)) {
+ return $this->error('参数错误');
+ }
+ $ip = getIp();
+ Log::write('ip:' . $ip . '=====id:' . $id);
+ $disableips = Config::get('disable_ip');
+ if (in_array($ip, $disableips)) {
+ return $this->error('非法请求');
+ }
+
+ if (empty($res['is_effective'])) {
+ return $this->error('链接已失效');
+ }
+ //随行人员信息json
+ if (isset($_REQUEST['is_accom_people']) && $_REQUEST['is_accom_people'] == 1) {
+ $_REQUEST['accom_people'] = arrayToJson(['accom_people_last_name', 'accom_people_first_name', 'relationship'], [
+ $_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']
+ ]);
+ unset($_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']);
+ } else {
+ unset($_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']);
+ }
+ if (isset($_REQUEST['is_to_us']) && $_REQUEST['is_to_us'] == 1) {
+ //去过美国信息
+ $_REQUEST['to_us_info'] = arrayToJson(['to_us_date', 'to_us_stay_date', 'to_us_stay_type'], [
+ $_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']
+ ]);
+ unset($_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']);
+
+ } else {
+ unset($_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']);
+
+ }
+ //是否有驾照信息
+ if (isset($_REQUEST['is_us_driver']) && !empty($_REQUEST['is_us_driver'])) {
+ $_REQUEST['driver_info'] = arrayToJson(['driver_number', 'driver_state'], [
+ $_REQUEST['driver_number'], $_REQUEST['driver_state']
+ ]);
+ unset($_REQUEST['driver_number'], $_REQUEST['driver_state']);
+
+ } else {
+ unset($_REQUEST['driver_number'], $_REQUEST['driver_state']);
+ }
+ if (isset($_REQUEST['is_job']) && $_REQUEST['is_job'] == 1) {
+ //你以前是否有过工作
+ $_REQUEST['job_info'] = arrayToJson([
+ 'job_unit_name', 'job_country', 'job_province', 'job_city',
+ 'job_first_address', 'job_second_address', 'job_mobile', 'job_zip_code',
+ 'job_title', 'supervisor_last_name', 'supervisor_first_name', 'job_startime',
+ 'job_endtime', 'job_response'
+ ], [
+ $_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province'],
+ $_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address'],
+ $_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title'],
+ $_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime'],
+ $_REQUEST['job_endtime'], $_REQUEST['job_response']
+ ]);
+ unset($_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province']);
+ unset($_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address']);
+ unset($_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title']);
+ unset($_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime']);
+ unset($_REQUEST['job_endtime'], $_REQUEST['job_response']);
+ } else {
+ unset($_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province']);
+ unset($_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address']);
+ unset($_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title']);
+ unset($_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime']);
+ unset($_REQUEST['job_endtime'], $_REQUEST['job_response']);
+ }
+ if (isset($_REQUEST['is_educational']) && $_REQUEST['is_educational'] == 1) {
+ //你是否曾就读于任何中学或以上程度的教育机构
+ $_REQUEST['educational_info'] = arrayToJson([
+ 'edu_name', 'edu_country', 'edu_province', 'edu_city',
+ 'edu_first_address', 'edu_second_address', 'edu_zip_code', 'edu_course', 'edu_startime', 'edu_endtime'
+ ], [
+ $_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city'],
+ $_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
+ $_REQUEST['edu_startime'], $_REQUEST['edu_endtime'],
+ ]);
+ unset($_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city']);
+ unset($_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
+ $_REQUEST['edu_startime'], $_REQUEST['edu_endtime']);
+
+ } else {
+ unset($_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city']);
+ unset($_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
+ $_REQUEST['edu_startime'], $_REQUEST['edu_endtime']);
+
+ }
+ if (isset($_REQUEST['language']) && !empty($_REQUEST['language'])) {
+ //请提供你所使用的语言
+ $language = array_filter($_REQUEST['language']);
+ if (empty($language)) {
+ $_REQUEST['language'] = '';
+ } else {
+ $_REQUEST['language'] = json_encode($language);
+ }
+
+ } else {
+ unset($_REQUEST['language']);
+ }
+ if (isset($_REQUEST['professional']) && !empty($_REQUEST['professional'])) {
+ //请提供你所使用的语言
+ $language = array_filter($_REQUEST['professional']);
+ if (empty($language)) {
+ $_REQUEST['professional'] = '';
+ } else {
+ $_REQUEST['professional'] = json_encode($language);
+ }
+
+ } else {
+ unset($_REQUEST['professional']);
+ }
+ //服役的国家
+ if (isset($_REQUEST['military_country']) && !empty($_REQUEST['military_country'])) {
+
+ $_REQUEST['military_country'] = arrayToJson([
+ 'military_country', 'services', 'military_rank', 'military_specialties', 'military_start_date', 'military_end_date'
+ ], [
+ $_REQUEST['military_country'], $_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']
+ ]);
+ unset($_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']);
+ } else {
+ unset($_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']);
+ }
+ //美国是否有不包括父母在内的直系亲属
+ if (isset($_REQUEST['is_immediate']) && !empty($_REQUEST['is_immediate'])) {
+
+ $_REQUEST['immediate_info'] = arrayToJson([
+ 'immediate_last_name', 'immediate_first_name', 'you_ship', 'identity'
+ ], [
+ $_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']
+ ]);
+ unset($_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']);
+ } else {
+ unset($_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']);
+ }
+
+ if (isset($_REQUEST['is_other_countries']) && $_REQUEST['is_other_countries'] == 1) {
+ $other_countries = array_filter($_REQUEST['other_countries']);
+ if (empty($other_countries)) {
+ $_REQUEST['other_countries'] = '';
+ } else {
+ $_REQUEST['other_countries'] = json_encode($other_countries);
+ }
+
+ } else {
+ unset($_REQUEST['other_countries']);
+ }
+ if ($_REQUEST['marital'] == 'D' && !empty($_REQUEST['formers_last_name'])) {
+ //婚姻状况选择“离异”时 增加前任信息
+ $_REQUEST['formers_info'] = arrayToJson([
+ 'formers_last_name', 'formers_first_name', 'formers_birth_date', 'formers_nationality',
+ 'formers_birth_country', 'formers_birth_city', 'formers_marriage_date', 'formers_marriage_end_date',
+ 'formers_marriage_end_explain', 'formers_marriage_end_country',
+ ], [
+ $_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'], $_REQUEST['formers_nationality'],
+ $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'], $_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'],
+ $_REQUEST['formers_marriage_end_explain'], $_REQUEST['formers_marriage_end_country']
+ ]);
+ unset(
+ $_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'],
+ $_REQUEST['formers_nationality'], $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'],
+ $_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'], $_REQUEST['formers_marriage_end_explain'],
+ $_REQUEST['formers_marriage_end_country']
+ );
+ } else {
+ unset(
+ $_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'],
+ $_REQUEST['formers_nationality'], $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'],
+ $_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'], $_REQUEST['formers_marriage_end_explain'],
+ $_REQUEST['formers_marriage_end_country']
+ );
+ }
+// var_dump($_REQUEST);exit;
+ for ($i = 1; $i < 28; $i++) {
+ unset($_REQUEST['safety' . $i]);
+ }
+ $_REQUEST['visa_cate'] = getCate($_REQUEST['visa_detail']);
+ $res = Db::name('visa')->where(['order_sn' => $id])->update($_REQUEST);
+ if ($res !== false) {
+ return $this->success("提交成功", url('visa/upvisa')->build());
+ } else {
+ return $this->error('提交失败!');
+ }
+ }
+
+ /**
+ * 跳转到pc
+ */
+ public function feepay()
+ {
+ $cfg = Config::get('wxpayvisa');
+ $app = Factory::payment($cfg);
+ $order_sn = Request::param('order_sn');
+
+ //判断支付是否已完成
+ $pay_result = Db::name('visa')->where(['order_sn' => $order_sn])->find();
+ if (empty($pay_result)) {
+ return ajaxReturn([
+ 'code' => 0,
+ 'msg' => '订单号错误',
+ ]);
+ }
+ $order_sn = 'visa' . $order_sn;
+ $result = $app->order->unify([
+ 'body' => '美国签证登记服务费',
+ 'out_trade_no' => $order_sn,
+ 'total_fee' => $pay_result['other_fee'],
+ 'trade_type' => 'NATIVE',
+ 'product_id' => $order_sn, // $message['product_id'] 则为生成二维码时的产品 ID
+ // ...
+ ]);
+ if (!isset($result['result_code']) || ($result['result_code'] == 'FAIL')) {
+ return $this->error('初始化支付异常,请稍后重试');
+ }
+ $url = "/uploads/qrcode/{$order_sn}.png";
+ QRcode::png($result['code_url'], "." . $url, 'L', 4, 2);
+
+ //判断文件是否存在
+ if (!is_file("." . $url)) {
+ return ajaxReturn([
+ 'code' => 0,
+ 'msg' => '请重新支付',
+ ]);
+ }
+ return ajaxReturn([
+ 'code' => 1,
+ 'msg' => '提交成功',
+ 'data' => $url
+ ]);
+ return $this->success('');
+
+ }
+
+ /**
+ * @return void
+ * 请求姓名电码
+ */
+ public function telecode()
+ {
+ $last_name_zn = Request::param('last_name_zn');
+ $first_name_zn = Request::param('first_name_zn');
+ if (empty($last_name_zn) || empty($first_name_zn)) {
+ return $this->error("姓名为空");
+ }
+ try {
+ $res = queryNameTelecode($last_name_zn . $first_name_zn, mb_strlen($last_name_zn, 'UTF-8'));
+ } catch (\InvalidArgumentException $e) {
+ return $this->error($e->getMessage());
+ } catch (\RuntimeException $e) {
+ return $this->error($e->getMessage());
+ } catch (\Throwable $e) {
+ return $this->error("电码查询暂时不可用,请稍后重试或手动填写");
+ }
+ // 保持前端字段和每个汉字四位电码之间的空格,保留前导零。
+ return $this->success("请求成功", '', [
+ 'code_last_name' => implode(' ', str_split($res['surname_code'], 4)),
+ 'code_first_name' => implode(' ', str_split($res['given_name_code'], 4)),
+ ]);
+ }
+
+
+ /**
+ * @return void
+ * 请求姓名电码
+ */
+ public function addprocess()
+ {
+ $process = Request::param('process');
+ $order_sn = Request::param('order_sn');
+ if (empty($process) || empty($order_sn)) {
+ return $this->error("参数错误");
+ }
+ $order = Db::name('visa')->where(['order_sn' => $order_sn])->find();
+ if (empty($order)) {
+ return $this->error("订单不存在");
+ }
+ if ($order['progress'] > $process) {
+ return $this->error("进度已存在");
+ }
+ Db::name('visa')->where(['order_sn' => $order_sn])->update([
+ 'progress' => $process,
+ ]);
+ return $this->success("请求成功");
+ }
+
+ public function upsucc()
+ {
+// $order_sn = Session::get('visa_order_sn');
+// View::assign('order_sn',$order_sn);
+ return View::fetch('upsucc');
+ }
+
+ public function verify()
+ {
+ $verify = new \api\Verify();
+ $verify->entry(1);
+ }
+}
diff --git a/app/home/controller/Wechatpay.php b/app/home/controller/Wechatpay.php
new file mode 100644
index 0000000..7772958
--- /dev/null
+++ b/app/home/controller/Wechatpay.php
@@ -0,0 +1,73 @@
+param('order_sn');
+ if (!$order_sn) {
+ return $this->error('缺少订单号');
+ }
+ //获取订单信息
+ $order_url = Config::get('app.get_evus_detail_url');
+ $response = Httpcurl::request($order_url, 'post', ['order_sn'=>$order_sn,'model'=>MODEL]);
+ if ($response[3]) {
+ return $this->error('支付失败,请稍后重试', '/home/detail/index');
+ }
+ $pay_result = json_decode($response[0], true);
+ if (empty($pay_result)) {
+ return $this->error('支付失败,请稍后重试', '/home/detail/index');
+ }
+ if (!$pay_result['code']){
+ return $this->error('支付失败,请稍后重试', '/home/detail/index');
+ }
+ $pay_result = $pay_result['data'];
+ if ($pay_result['pay_status']) {
+
+ return redirect(url('home/pay/succ', ['order_sn' => $order_sn])->build());
+ }else{
+ return $this->error('支付失败,请稍后重试', '/home/detail/index');
+ }
+
+ }
+ public function esta()
+ {
+ $order_sn = Request::instance()->param('order_sn');
+ if (!$order_sn) {
+ return $this->error('缺少订单号');
+ }
+ //获取订单信息
+ $order_url = Config::get('app.get_order_detail_url');
+ $response = Httpcurl::request($order_url, 'post', ['order_sn'=>$order_sn,'model'=>ESTA_MODEL]);
+ if ($response[3]) {
+ return $this->error('支付失败,请稍后重试', '/home/esta/index');
+ }
+ $pay_result = json_decode($response[0], true);
+ if (empty($pay_result)) {
+ return $this->error('支付失败,请稍后重试', '/home/esta/index');
+ }
+ if (!$pay_result['code']){
+ return $this->error('支付失败,请稍后重试', '/home/esta/index');
+ }
+ $pay_result = $pay_result['data'];
+ if ($pay_result['pay_status']) {
+
+ return redirect(url('home/payesta/succ', ['order_sn' => $order_sn])->build());
+ }else{
+ return $this->error('支付失败,请稍后重试', '/home/esta/index');
+ }
+
+ }
+
+
+}
+
diff --git a/app/home/controller/Wxmini.php b/app/home/controller/Wxmini.php
new file mode 100644
index 0000000..f5f2867
--- /dev/null
+++ b/app/home/controller/Wxmini.php
@@ -0,0 +1,35 @@
+ 'article',
+// 'page' => 1,
+// 'size' => 10,
+// ]);
+// $news_list = json_decode($news_list[0], true);
+// Log::info(json_encode($news_list));
+//
+// if (!empty($news_list) && $news_list['code'] == 1) {
+// View::assign('data', $news_list['data']);
+// } else {
+// View::assign('data', []);
+// }
+
+ return View::fetch();
+ }
+ public function screen()
+ {
+ return View::fetch();
+ }
+
+}
diff --git a/app/home/event.php b/app/home/event.php
new file mode 100644
index 0000000..4eff890
--- /dev/null
+++ b/app/home/event.php
@@ -0,0 +1,5 @@
+
+
+
+
+
+
+
+ 关于我们
+
+
+
公司简介
+
+
济南经纬九州出入境服务有限公司,于2014年4月4日经山东省工商局批准成立。2016年5月,我公司职员受邀参加山东省外事机关组织的“EVUS”登记说明会,由当时的现任美国签证官亲自解说指导,我司员工是唯一的非政府机构参会人员。自该业务开展以来,我司的EVUS登记业务,所有的有效签证已全部登记成功;有一部分客户因签证本身无效无法登记成功,我司职员凭借专业的经验引导这部分客户重新获取签证,并登记成功。
+
多年来,经纬九州出入境始终追求“专业化,规范化”的经营理念,践行“一带一路”伟大倡议,为我国公民提供因私出入境服务,经纬九州员工锐意进取,不断开拓精品项目。独立开发的eVUS大数据模型系统,能够快速的协助客户完成美签电子更新。
+
历经市场考验,经纬九州人坚守“不忘初心,不辱使命”之愿景,立志成为业务门类齐全、有相当社会知名度的中介服务机构。evus.cn网热忱欢迎中外企业和各类优秀人才加盟合作,共创未来。
+
+
+
+
+
+
+
签证服务价目表
+
+
+
+
+
+
+
+
+
+
+
+
+ | 国家 |
+ 签证类型 |
+ 出签时间(工作日) |
+ 签证费 |
+ 服务费/人(不含签证费及保险) |
+ 合计 |
+
+
+
+
+ | 美国 |
+ B1/B2 |
+ 30 |
+ 1369元 |
+ 731元 |
+ 2100元 |
+
+
+ | 美国 |
+ 续签(同类型) |
+ 30 |
+ 1369元 |
+ 731元 |
+ 2100元 |
+
+
+ | 美国 |
+ 留学签 |
+ 30 |
+ 1369元 |
+ 2131元 |
+ 3500元 |
+
+
+ | 美国 |
+ evus |
+ 6小时内 |
+ - |
+ 350元 |
+ 350元 |
+
+
+ | 美国 |
+ evus |
+ 3小时内 |
+ - |
+ 499元 |
+ 499元 |
+
+
+ | 美国 |
+ evus |
+ 15分钟内 |
+ - |
+ 799元 |
+ 799元 |
+
+
+ | 加拿大 |
+ 旅游、商务、探亲 |
+ 30 |
+ 1000元 |
+ 800元 |
+ 1800元 |
+
+
+ | 澳大利亚 |
+ 旅游、商务、探亲 |
+ 20 |
+ 1000元 |
+ 600元 |
+ 1600元 |
+
+
+ | 新西兰 |
+ 旅游、商务、探亲 |
+ 25 |
+ 2000元 |
+ 700元 |
+ 2700元 |
+
+
+ | 申根 |
+ 旅游、商务、探亲 |
+ 30 |
+ 750元左右签证费(不代收签证费)含14天行程保险 |
+ 800元 |
+ 800元 |
+
+
+ | 英国 |
+ 旅游、商务、探亲 |
+ 30 |
+ 1300元(济南、西安、长沙、昆明额外收取800元场地费) |
+ 700元 |
+ 2000元(不含场地费) |
+
+
+ | 日本(山东、北京) |
+ 单次旅游 |
+ 8 |
+ 300元 |
+ 300元 |
+ 600元 |
+
+
+ | 日本(山东、北京) |
+ 3年/5年多次旅游 |
+ 8 |
+ 400元 |
+ 300元 |
+ 700元 |
+
+
+ | 韩国 |
+ 单次旅游 |
+ 15 |
+ 领馆+签证中心400元 |
+ 300元 |
+ 700元 |
+
+
+ | 韩国 |
+ 5年旅游 |
+ 15 |
+ 领馆+签证中心800元 |
+ 300元 |
+ 1100元 |
+
+
+ | 巴西 |
+ 旅游、商务、探亲 |
+ 以网站通知为准 |
+ 1100元(不代收签证费) |
+ 700元 |
+ 700元 |
+
+
+ | 越南 |
+ 单次电子签 |
+ 5 |
+ 25美元 |
+ 200 |
+ 398元 |
+
+
+ | 越南 |
+ 多次电子签 |
+ 5 |
+ 50美元 |
+ 400 |
+ 598元 |
+
+
+ | 俄罗斯 |
+ 单次电子签 |
+ 8 |
+ |
+ |
+ 558元 |
+
+
+ | 俄罗斯 |
+ 单次电子签 |
+ 4 |
+ |
+ |
+ 768元 |
+
+
+ | 土耳其 |
+ 电子签 |
+ 6小时 |
+ |
+ |
+ 658元 |
+
+
+ | 土耳其 |
+ 电子签 |
+ 15分钟 |
+ |
+ |
+ 988元 |
+
+
+ | 注:签证费因汇率问题实时波动,费用以每次央行公布汇率为准 |
+
+
+
+
+
+
+
+
+{include file="public/footer" /}
+
+