diff --git a/.gitignore b/.gitignore index 69148d7..2295f56 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,11 @@ -node_modules/ -yarn-error.log -miniprogram/ -miniprogram_npm/ -miniprogram_dist/ -.DS_Store -$node_modules/ -.history/ -**/dist -components/**/*.lock -components/**/package-lock.json -package-lock.json -yarn.lock -project.private.config.json -.eslintcache \ No newline at end of file +/.idea +/.vscode +*.log +.env +/public/uploads/** +!/public/uploads/.gitkeep +/public/upload +/public/web +/public/web_act1/ +/public/output/** +!/public/outout/.gitkeep 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..574a39c --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,32 @@ + +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 +版权所有Copyright © 2006-2016 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/app.js b/app.js deleted file mode 100644 index 42037fe..0000000 --- a/app.js +++ /dev/null @@ -1,9 +0,0 @@ -import updateManager from './common/updateManager'; - -App({ - onLaunch: function () { - }, - onShow: function () { - updateManager(); - }, -}); diff --git a/app.json b/app.json deleted file mode 100644 index 4914b7f..0000000 --- a/app.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "pages": [ - "pages/home/home", - "pages/paylist/paylist", - "pages/news_list/home", - "pages/news_admin_list/home", - "pages/usercenter/index", - "pages/detail/detail", - "pages/detail_admin/detail", - "pages/takephoto/takephoto", - "pages/faxianlist/faxianlist", - "pages/test/test", - "pages/shop/shop", - "pages/pay/pay", - "pages/createpay/createpay", - "pages/sharebuy/sharebuy", - "pages/usercenter/info", - "pages/sharelist/sharelist", - "pages/webview/webview" - ], - "tabBar": { - "custom": true, - "color": "#666666", - "selectedColor": "#FF5F15", - "backgroundColor": "#ffffff", - "borderStyle": "black", - "list": [ - { - "pagePath": "pages/home/home", - "text": "首页" - }, - { - "pagePath": "pages/faxianlist/faxianlist", - "text": "分销" - }, - { - "pagePath": "pages/usercenter/index", - "text": "我的" - } - ] - }, - "requiredPrivateInfos": [], - "lazyCodeLoading": "requiredComponents", - "usingComponents": {}, - "window": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "Weixin", - "navigationBarTextStyle": "black" - }, - "sitemapLocation": "sitemap.json", - "permission": {} -} \ No newline at end of file diff --git a/app.wxss b/app.wxss deleted file mode 100644 index 9ff2554..0000000 --- a/app.wxss +++ /dev/null @@ -1,3 +0,0 @@ -@import 'style/iconfont.wxss'; - -@import 'style/theme.wxss'; \ No newline at end of file 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/Act1AdminBaseController.php b/app/Act1AdminBaseController.php new file mode 100644 index 0000000..9c23178 --- /dev/null +++ b/app/Act1AdminBaseController.php @@ -0,0 +1,249 @@ +app = $app; + $this->request = $this->app->request; + + // 参数校验 + $this->valid_params(); + // 控制器初始化 + $this->initialize(); + } + + // 初始化 + protected function initialize() + { + $action_name = $this->request->action(); + $this->log_notice(['请求参数', $this->request->param(false)], '记录动作', 'action-log:' . $action_name); + } + + /** + * 验证数据 + * @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, $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); + } + $result = $v->failException(false)->check($data); + if (!$result) { + throw new ParamsValidateException($v->getError()); + } + return true; + } + + protected function valid_params() + { + + $is_logined = false; + $cookie_user_id = cookie('act_admin_id'); + if (!empty($cookie_user_id)) { + if ($cookie_user_id) { + $cookie_user_id = \a_decode($cookie_user_id); + if ($cookie_user_id) { + $cookie_user_id_sp = explode('|', $cookie_user_id); + //查看是否有这个用户 + $admin = D('act1_user')->where(array('id' => $cookie_user_id_sp[0], 'deleted' => 0, 'role'=> 'admin'))->find(); + if (!empty($admin)) { + $is_logined = true; + $this->user_id = $cookie_user_id_sp[0]; + $this->user_info = $admin; + } + } + } + } else { + $this->user_id = null; + } + + + $request = $this->app->request; + $action_name = $request->action(); + if(isset($this->not_check_action_login) && (in_array($action_name, $this->not_check_action_login) || in_array('*', $this->not_check_action_login))) { + // if($action_name == 'login' || $action_name == 'login_id' || $action_name == 'get_code') { + // + }else { + if ($is_logined) { + //logined + } else { + //not login + throw new NotLoginException(); + } + } + // 判断是否需要校验接口权限 + if (array_key_exists($action_name, $this->role_actions ?? [])) { + //判断是否登录了 + if ($is_logined && $this->user_info) { + //logined + $roles = explode(',', $this->user_info['role'] ?? ''); + $is_allow = false; + foreach ($roles as $role) { + foreach ($this->role_actions[$action_name] as $one) { + if ($one == $role) { + $is_allow = true; + } + } + } + if (!$is_allow) { + throw new NoAccessException(); + } + } else { + //no access + throw new NoAccessException(); + } + } + //没有列举出来的action也不校验登录 + //带#的action_name是不校验是否登录,但是要校验参数 + if (array_key_exists($action_name, $this->check_actions)) { + //判断是否登录了 + if ($is_logined) { + //logined + } else { + //not login + throw new NotLoginException(); + } + } + //校验参数 + $checks = array(); + if (array_key_exists($action_name, $this->check_actions)) { + $checks = $this->check_actions[$action_name]; + } + if (array_key_exists('#' . $action_name, $this->check_actions)) { + $checks = $this->check_actions['#' . $action_name]; + } + + if (!empty($checks)) { + $valid_rule = []; + $valid_msg = []; + $valid_data = []; + foreach ($checks as $k => $v) { + if (\substr($k, 0, 1) === '#') { + $k = \substr($k, 1); + if (!isset($v[0])) { + $v[] = ''; + } + } else { + if (isset($v[0])) { + if (strpos($v[0], 'require') === false) { + $v[0] = 'require|' . $v[0]; + } + } else { + $v[] = 'require'; + } + } + $valid_data[$k] = input($k . ''); + $valid_rule[$k] = $v[0]; + if (count($v) > 1) { + $msg = $v[1]; + foreach ($msg as $k1 => $v1) { + $valid_msg[$k . '.' . $k1] = $k . $v1; + } + } + } + $this->validate($valid_data, $valid_rule, $valid_msg); + } + } + + protected function log_notice($any, $msg = '', $tag = 'log_notice') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . $str . '][WHO:' . $this->user_id . ']', 'NOTICE'); + } + protected function log_warn($any, $msg = '', $tag = 'log_warn') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . json_encode($any, JSON_UNESCAPED_UNICODE) . '][WHO:' . $this->user_id . ']', 'WARN'); + } + protected function log_error($any, $msg = '', $tag = 'log_error') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . json_encode($any, JSON_UNESCAPED_UNICODE) . '][WHO:' . $this->user_id . ']', 'ERROR'); + } +} diff --git a/app/Act1Controller.php b/app/Act1Controller.php new file mode 100644 index 0000000..13f066d --- /dev/null +++ b/app/Act1Controller.php @@ -0,0 +1,224 @@ +app = $app; + $this->request = $this->app->request; + + // 参数校验 + $this->valid_params(); + // 控制器初始化 + $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, $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); + } + $result = $v->failException(false)->check($data); + if (!$result) { + throw new ParamsValidateException($v->getError()); + } + return true; + } + + + protected function valid_params() + { + + $is_logined = false; + $cookie_act_user_id = cookie('act_user_id'); + if (!empty($cookie_act_user_id)) { + if ($cookie_act_user_id) { + $cookie_act_user_id = \a_decode($cookie_act_user_id); + if ($cookie_act_user_id) { + $cookie_act_user_id_sp = explode('|', $cookie_act_user_id); + //查看是否有这个用户 + // c_debug($cookie_user_id_sp[0]); + // if($cookie_user_id_sp[0] == 3){ + // $cookie_user_id_sp[0] = 13; + // } + $db_user = D('act1_user'); + $user = $db_user->where(array('id' => $cookie_act_user_id_sp[0]))->find(); + if (!empty($user)) { + $is_logined = true; + $this->act_user_id = $cookie_act_user_id_sp[0]; + $this->act_user_info = $user; + } + } + } + } else { + $this->act_user_id = null; + $this->act_user_info = null; + } + + + $request = $this->app->request; + $action_name = $request->action(); + //没有列举出来的action也不校验登录 + //带#的action_name是不校验是否登录,但是要校验参数 + if (array_key_exists($action_name, $this->check_actions)) { + //判断是否登录了 + if ($is_logined) { + //logined + } else { + //not login + throw new NotLoginException(); + } + } + //校验参数 + $checks = array(); + if (array_key_exists($action_name, $this->check_actions)) { + $checks = $this->check_actions[$action_name]; + } + if (array_key_exists('#' . $action_name, $this->check_actions)) { + $checks = $this->check_actions['#' . $action_name]; + } +// echo json_encode($checks); + if (!empty($checks)) { + $valid_rule = []; + $valid_msg = []; + $valid_data = []; + foreach ($checks as $k => $v) { + if (\substr($k, 0, 1) === '#') { + $k = \substr($k, 1); + if (!isset($v[0])) { + $v = []; + } + } else { + if (isset($v[0])) { + if (strpos($v[0], 'require') === false) { + $v[0] = 'require|' . $v[0]; + } + } else { + $v[] = 'require'; + } + } + if(empty($v)){ + continue; + } + $valid_data[$k] = input($k . ''); + $valid_rule[$k] = $v[0]; + if (count($v) > 1) { + $msg = $v[1]; + foreach ($msg as $k1 => $v1) { + $valid_msg[$k . '.' . $k1] = $k . $v1; + } + } + } + $this->validate($valid_data, $valid_rule, $valid_msg); + } + } + + protected function log_notice($any, $msg = '', $tag = 'log_notice') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . $str . ']', 'NOTICE'); + } + protected function log_warn($any, $msg = '', $tag = 'log_warn') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . json_encode($any, JSON_UNESCAPED_UNICODE) . ']', 'WARN'); + } + protected function log_error($any, $msg = '', $tag = 'log_error') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . json_encode($any, JSON_UNESCAPED_UNICODE) . ']', 'ERROR'); + } +} diff --git a/app/AdminBaseController.php b/app/AdminBaseController.php new file mode 100644 index 0000000..8d7ac6d --- /dev/null +++ b/app/AdminBaseController.php @@ -0,0 +1,250 @@ +app = $app; + $this->request = $this->app->request; + + // 参数校验 + $this->valid_params(); + // 控制器初始化 + $this->initialize(); + } + + // 初始化 + protected function initialize() + { + $action_name = $this->request->action(); + $this->log_notice(['请求参数', $this->request->param(false)], '记录动作', 'action-log:' . $action_name); + } + + /** + * 验证数据 + * @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, $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); + } + $result = $v->failException(false)->check($data); + if (!$result) { + throw new ParamsValidateException($v->getError()); + } + return true; + } + + protected function valid_params() + { + + $is_logined = false; + $cookie_user_id = cookie('admin_id'); + if (!empty($cookie_user_id)) { + if ($cookie_user_id) { + $cookie_user_id = \a_decode($cookie_user_id); + if ($cookie_user_id) { + $cookie_user_id_sp = explode('|', $cookie_user_id); + //查看是否有这个用户 + $admin = D('admin')->where(array('id' => $cookie_user_id_sp[0], 'deleted' => 0))->find(); + if (!empty($admin)) { + // $user = D('gzh_auth')->where(array('id' => $merchant['gzh_auth_id']))->find(); + $is_logined = true; + $this->user_id = $cookie_user_id_sp[0]; + $this->user_info = $admin; + } + } + } + } else { + $this->user_id = null; + } + + + $request = $this->app->request; + $action_name = $request->action(); + if(isset($this->not_check_action_login) && (in_array($action_name, $this->not_check_action_login) || in_array('*', $this->not_check_action_login))) { + // if($action_name == 'login' || $action_name == 'login_id' || $action_name == 'get_code') { + // + }else { + if ($is_logined) { + //logined + } else { + //not login + throw new NotLoginException(); + } + } + // 判断是否需要校验接口权限 + if (array_key_exists($action_name, $this->role_actions ?? [])) { + //判断是否登录了 + if ($is_logined && $this->user_info) { + //logined + $roles = explode(',', $this->user_info['role'] ?? ''); + $is_allow = false; + foreach ($roles as $role) { + foreach ($this->role_actions[$action_name] as $one) { + if ($one == $role) { + $is_allow = true; + } + } + } + if (!$is_allow) { + throw new NoAccessException(); + } + } else { + //no access + throw new NoAccessException(); + } + } + //没有列举出来的action也不校验登录 + //带#的action_name是不校验是否登录,但是要校验参数 + if (array_key_exists($action_name, $this->check_actions)) { + //判断是否登录了 + if ($is_logined) { + //logined + } else { + //not login + throw new NotLoginException(); + } + } + //校验参数 + $checks = array(); + if (array_key_exists($action_name, $this->check_actions)) { + $checks = $this->check_actions[$action_name]; + } + if (array_key_exists('#' . $action_name, $this->check_actions)) { + $checks = $this->check_actions['#' . $action_name]; + } + + if (!empty($checks)) { + $valid_rule = []; + $valid_msg = []; + $valid_data = []; + foreach ($checks as $k => $v) { + if (\substr($k, 0, 1) === '#') { + $k = \substr($k, 1); + if (!isset($v[0])) { + $v[] = ''; + } + } else { + if (isset($v[0])) { + if (strpos($v[0], 'require') === false) { + $v[0] = 'require|' . $v[0]; + } + } else { + $v[] = 'require'; + } + } + $valid_data[$k] = input($k . ''); + $valid_rule[$k] = $v[0]; + if (count($v) > 1) { + $msg = $v[1]; + foreach ($msg as $k1 => $v1) { + $valid_msg[$k . '.' . $k1] = $k . $v1; + } + } + } + $this->validate($valid_data, $valid_rule, $valid_msg); + } + } + + protected function log_notice($any, $msg = '', $tag = 'log_notice') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . $str . '][WHO:' . $this->user_id . ']', 'NOTICE'); + } + protected function log_warn($any, $msg = '', $tag = 'log_warn') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . json_encode($any, JSON_UNESCAPED_UNICODE) . '][WHO:' . $this->user_id . ']', 'WARN'); + } + protected function log_error($any, $msg = '', $tag = 'log_error') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . json_encode($any, JSON_UNESCAPED_UNICODE) . '][WHO:' . $this->user_id . ']', 'ERROR'); + } +} diff --git a/app/AppCache.php b/app/AppCache.php new file mode 100644 index 0000000..ab83f8f --- /dev/null +++ b/app/AppCache.php @@ -0,0 +1,11 @@ +app = $app; + $this->request = $this->app->request; + + // 参数校验 + $this->valid_params(); + // 控制器初始化 + $this->initialize(); + } + + // 初始化 + protected function initialize() + { + if(isset($this->ignore_log_params) && $this->ignore_log_params) return; + $action_name = $this->request->action(); + $this->log_notice(['请求参数', $this->request->param(false)], '记录动作', 'action-log:' . $action_name); + } + + /** + * 验证数据 + * @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, $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); + } + $result = $v->failException(false)->check($data); + if (!$result) { + throw new ParamsValidateException($v->getError()); + } + return true; + } + + + protected function valid_params() + { + + $is_logined = false; + $cookie_user_id = cookie('user_id'); + if (!empty($cookie_user_id)) { + if ($cookie_user_id) { + $cookie_user_id = \a_decode($cookie_user_id); + if ($cookie_user_id) { + $cookie_user_id_sp = explode('|', $cookie_user_id); + //查看是否有这个用户 + // c_debug($cookie_user_id_sp[0]); + // if($cookie_user_id_sp[0] == 3){ + // $cookie_user_id_sp[0] = 13; + // } + $db_user = D('user'); + $user = $db_user->where(array('id' => $cookie_user_id_sp[0]))->find(); + if (!empty($user)) { + $is_logined = true; + $this->user_id = $cookie_user_id_sp[0]; + $this->user_info = $user; + } + } + } + } else { + // $is_logined = true; + // $this->user_id = 1; + // $this->user_info = []; + } + + + $request = $this->app->request; + $action_name = $request->action(); + //没有列举出来的action也不校验登录 + //带#的action_name是不校验是否登录,但是要校验参数 + if (array_key_exists($action_name, $this->check_actions)) { + //判断是否登录了 + if ($is_logined) { + //logined + } else { + //not login + throw new NotLoginException(); + } + } + //校验参数 + $checks = array(); + if (array_key_exists($action_name, $this->check_actions)) { + $checks = $this->check_actions[$action_name]; + } + if (array_key_exists('#' . $action_name, $this->check_actions)) { + $checks = $this->check_actions['#' . $action_name]; + } +// echo json_encode($checks); + if (!empty($checks)) { + $valid_rule = []; + $valid_msg = []; + $valid_data = []; + foreach ($checks as $k => $v) { + if (\substr($k, 0, 1) === '#') { + $k = \substr($k, 1); + if (!isset($v[0])) { + $v = []; + } + } else { + if (isset($v[0])) { + if (strpos($v[0], 'require') === false) { + $v[0] = 'require|' . $v[0]; + } + } else { + $v[] = 'require'; + } + } + if(empty($v)){ + continue; + } + $valid_data[$k] = input($k . ''); + $valid_rule[$k] = $v[0]; + if (count($v) > 1) { + $msg = $v[1]; + foreach ($msg as $k1 => $v1) { + $valid_msg[$k . '.' . $k1] = $k . $v1; + } + } + } + $this->validate($valid_data, $valid_rule, $valid_msg); + } + } + + protected function log_notice($any, $msg = '', $tag = 'log_notice') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . $str . ']', 'NOTICE'); + } + protected function log_warn($any, $msg = '', $tag = 'log_warn') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . json_encode($any, JSON_UNESCAPED_UNICODE) . ']', 'WARN'); + } + protected function log_error($any, $msg = '', $tag = 'log_error') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . json_encode($any, JSON_UNESCAPED_UNICODE) . ']', 'ERROR'); + } +} diff --git a/app/Constant.php b/app/Constant.php new file mode 100644 index 0000000..0ac5b6d --- /dev/null +++ b/app/Constant.php @@ -0,0 +1,31 @@ + [ + "text" => "待支付", + "value" => "init" + ], + "payed" => [ + "text" => "已支付", + "value" => "payed" + ], + "cancel" => [ + "text" => "已取消", + "value" => "cancel" + ], + "need_refund" => [ + "text" => "待退款", + "value" => "need_refund" + ], + "refund" => [ + "text" => "已退款", + "value" => "refund" + ] + ]; +} \ No newline at end of file diff --git a/app/ExceptionHandle.php b/app/ExceptionHandle.php new file mode 100644 index 0000000..ada7c42 --- /dev/null +++ b/app/ExceptionHandle.php @@ -0,0 +1,109 @@ +getStatusCode() === 404) { + //$resp = Response::create(json_encode(ajaxFail($e->getMessage(), -1003, null, true))); + $resp = ajaxFail($e->getMessage(), -1003); + $handle_flag = true; + $e = []; + } + if ($e instanceof ParamsValidateException) { + $resp = ajaxFail('参数' . $e->getMessage(), -1002); + $handle_flag = true; + if (Config::get('app.APP_DEBUG')) { + $e = '参数' . $e->getMessage() . ' request_uri:' . $_SERVER['REQUEST_URI']; + }else{ + $e = []; + } + } + if ($e instanceof NotLoginException) { + $resp = ajaxFail("未登录或登录超时", -1000); + $handle_flag = true; + $e = []; + } + if ($e instanceof NoAccessException) { + $resp = ajaxFail("权限不足,拒绝操作", -1003); + $handle_flag = true; + $e = []; + } + if ($e != []) { + $txt = sprintf("异常信息(" . $trace_id . "): %s \r\n", $e); + Log::write($txt, 'ERROR'); + } + + if ($handle_flag) { + $resp->contentType('application/json'); + return $resp; + } + if (!Config::get('app.APP_DEBUG')) { + $resp = ajaxFail("系统异常", -1001, $trace_id); + $resp->contentType('application/json'); + return $resp; + } + + // 其他错误交给系统处理 + return parent::render($request, $e); + } +} diff --git a/app/Request.php b/app/Request.php new file mode 100644 index 0000000..fc9aba0 --- /dev/null +++ b/app/Request.php @@ -0,0 +1,8 @@ +table($name, [], false); +} +function DQ2($sql, $value = []) { + return Db::connect('mysql2')->query($sql, $value); +} +/** +* 加密 +* +* @param string $string +* @param string $skey +*/ +function a_encode($string = "", $skey = '') { + if (strlen($skey) === 0) { + $skey = Config::get('app.ENCODE_KEY'); + } + $data = openssl_encrypt($string, 'AES-128-ECB', $skey, OPENSSL_RAW_DATA); + $data = strtolower(bin2hex($data)); + return $data; +} + +/** +* 解密 +* +* @param string $string +* @param string $skey +*/ +function a_decode($string = "", $skey = '') { + if (strlen($skey) === 0) { + $skey = Config::get('app.ENCODE_KEY'); + } + if (empty($string) || strlen($string) % 2 == 1) { + return ''; + } + return openssl_decrypt(hex2bin($string), 'AES-128-ECB', $skey, OPENSSL_RAW_DATA); +} + + +/** +* https get +* +* @param [string] $url +* @return string +*/ +function curl_get_https($url) { + $curl = curl_init(); // 启动一个CURL会话 + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_HEADER, 0); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查 + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在 + $tmpInfo = curl_exec($curl); //返回api的json对象 + //关闭URL请求 + curl_close($curl); + return $tmpInfo; //返回json对象 +} + +function http_post_json($url, $jsonStr, $header = []) { + c_debug('http_post_json:'.$jsonStr . '----$header:' . json_encode($header)); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonStr); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt( + $ch, + CURLOPT_HTTPHEADER, + array_merge( + $header, + [ + 'Content-Type: application/json; charset=utf-8', + 'Content-Length: ' . strlen($jsonStr), + ] + ) + ); + $response = curl_exec($ch); + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + + return $response; +} + +function c_post_http($url, $data) { + $data = http_build_query($data); + $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $data)); + $context = stream_context_create($opts); + return file_get_contents($url, false, $context); +} +/** +* https post +* +* @param [string] $url +* @param [array(k=>v)] $data +* @return string +*/ +function curl_post_https($url, $data, $opt = []) { + $opt = array_merge([ + 'path_cert' => '', + 'path_key' => '', + 'header' => [] + ], $opt); + // Log::write(json_encode($opt) . '== curl_post_https', 'notice'); + $with_ca = false; + if ($opt && $opt['path_cert'] && $opt['path_key']) { + $with_ca = true; + } + // 模拟提交数据函数 + $curl = curl_init(); // 启动一个CURL会话 + curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址 + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $with_ca); // 对认证证书来源的检查 + if ($with_ca) { + curl_setopt($curl, CURLOPT_SSLCERT, $opt['path_cert']); + curl_setopt($curl, CURLOPT_SSLKEY, $opt['path_key']); + } + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在 + curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器 + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转 + curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer + curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求 + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包 + curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环 + curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容 + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 + curl_setopt($curl, CURLOPT_HTTPHEADER, $opt['header']); + $tmpInfo = curl_exec($curl); // 执行操作 + if (curl_errno($curl)) { + echo 'Errno' . curl_error($curl); //捕抓异常 + } + curl_close($curl); // 关闭CURL会话 + return $tmpInfo; // 返回数据,json格式 +} +function ajaxSuccessPage($data = "", $current = 1, $pageSize = 10, $total = 0, $code = 0, $only_json = false) { + $json = array( + "success" => true, + "errorMsg" => "", + "errorCode" => $code, + "model" => $data, + "current" => $current, + "pageSize" => $pageSize, + "total" => $total, + ); + return $only_json ? $json : json($json); +} + +function ajaxSuccess($data = "", $code = '0', $only_json = false) { + $json = array( + "success" => true, + "errorMsg" => "", + "errorCode" => $code, + "model" => $data, + ); + return $only_json ? $json : json($json); +} + +function ajaxFail($errorMsg = "", $errorCode = -1, $data = null, $only_json = false) { + $json = array( + "success" => false, + "errorMsg" => $errorMsg, + "errorCode" => $errorCode, + "model" => $data, + ); + return $only_json ? $json : json($json); +} + +/** +* 解密微信加密数据 +*/ +function decrypt_wx_data($encrypted_data, $iv, $session_key) { + if (strlen($session_key) != 24) { + return -1; + } + if (strlen($iv) != 24) { + return -2; + } + $aes_cipher = base64_decode($encrypted_data); + $aes_key = base64_decode($session_key); + $aes_iv = base64_decode($iv); + $result = openssl_decrypt($aes_cipher, "AES-128-CBC", $aes_key, 1, $aes_iv); + $data = json_decode($result, true); + if ($data == null) { + Log::write([ + 'encrypted_data' => $encrypted_data, + 'iv' => $iv, + 'session_key' => $session_key, + 'result' => $result, + ], 'notice'); + return -3; + } + return $data; +} + +/** +* 获取session_key +*/ +function code_2_session($js_code) { + $appid = Config::get('app.APPID'); + $secret = Config::get('app.SECERT_KEY'); + $url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' . $appid . '&secret=' . $secret . '&js_code=' . $js_code . '&grant_type=authorization_code'; + $result = curl_get_https($url); + think\facade\Log::record($url . '--' . $result, 'notice'); + $result_json = json_decode($result, true); + if (array_key_exists('errcode', $result_json) && $result_json['errcode'] != 0) { + think\facade\Log::record($result, 'notice'); + return null; + } + return $result_json; +} +/** +*随机字符串数字 +* +* @param integer $len +*/ +function random_vcode($len = 6) { + srand((float) microtime() * 1000000); //create a random number feed. + $ychar = "0,1,2,3,4,5,6,7,8,9"; + $list = explode(",", $ychar); + $authnum = ''; + for ($i = 0; $i < $len; $i++) { + $randnum = rand(0, 9); // 10+26; + $authnum .= $list[$randnum]; + } + return $authnum; +} +function rad($d) { + return $d * M_PI / 180.0; +} + +function random_password($len = 6) { + srand((float) microtime() * 1000000); //create a random number feed. + $ychar = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,P,Q,R,S,T,U,V,W,X,Y,Z"; + $list = explode(",", $ychar); + $authnum = ''; + for ($i = 0; $i < $len; $i++) { + $randnum = rand(0, count($list)-1); // 10+26; + $authnum .= $list[$randnum]; + } + return $authnum; +} + +/** +* 计算两个经纬度距离 +*/ +function c_lon_lat_distance($lon1, $lat1, $lon2, $lat2) { + $radLat1 = rad($lat1); + $radLat2 = rad($lat2); + $a = $radLat1 - $radLat2; + $b = rad($lon1) - rad($lon2); + $s = 2 * asin( + sqrt( + pow(sin($a / 2), 2) + + cos($radLat1) + * cos($radLat2) + * pow(sin($b / 2), 2) + ) + ); + return ceil($s * 6378137.0); +} + +/** +* 分隔成数组 +* +* @param [type] $str +* @return array +*/ +function c_dot_str_2_array($str): array +{ + $list = []; + if ($str) { + $list = explode(',', $str); + } + return $list; +} + +/** +* 对象筛选属性 +* +* @param array $obj +* @param array $keys +* @param boolean $pass_keys 是否去掉传入的属性 +*/ +function c_filter_property($obj, $keys, $pass_keys = false) { + $re = []; + if (!$pass_keys) { + foreach ($keys as $k) { + if (array_key_exists($k, $obj)) { + $re[$k] = $obj[$k]; + } + } + } else { + // echo in_array('c',['a','b']) ? 'in--':'on=='; + foreach ($obj as $k => $v) { + if (!in_array($k, $keys)) { + $re[$k] = $v; + } + } + } + return $re; +} + +/** +* 列表筛选属性 +* +* @param [type] $list +* @param [type] $keys +* @param boolean $pass_keys 是否去掉传入的属性 +*/ +function c_filter_property_list($list, $keys, $pass_keys = false) { + $re_list = []; + foreach ($list as $one) { + $re_list[] = c_filter_property($one, $keys, $pass_keys); + } + return $re_list; +} + +/** +* 生成订单号 +* +* @param [type] $order_type +* @return string +*/ +function s_order_id_render($order_type) { + //1+1+2+2+2+2+2+2=14 + $y = substr(date('y'), 1, 1); + $pre = $y . date('mdHis'); + $s_map = Cache::get(Constant::$ORDER_S_PTR); + + if (isset($s_map['pre']) && $s_map['pre'] == $pre) { + $s_map['ptr'] += 1; + } else { + $s_map = ['pre' => $pre, + 'ptr' => 1]; + } + + Cache::set(Constant::$ORDER_S_PTR, $s_map); + + $ptr = $s_map['ptr']; + $ptr = sprintf('%02d', $ptr); + + return $order_type . $pre . $ptr; +} +/** +* 生成订单核销码 +* +* @param [type] $order_id +* @return void +*/ +function s_order_use_code($order_id) { + return substr($order_id, -6); +} + +function c_read_xml_to_map($res) { + /* + + + + + + + + + + + */ + // $res = str_replace(' ', '', $res); + // $res = str_replace('', '', $res); + // $res = str_replace('', '', $res); + // $res = str_replace("\r", "\n", $res); + // $res = str_replace("\n\n", "\n", $res); + // $res = trim($res); + // $res = str_replace("\n", '&', $res); + // $res = str_replace(']', '', $res); + // $res = str_replace('', '=', $res); + // $res = str_replace('=<', '', $res); + // $res = trim($res, '<='); + // $res = str_replace('=&', '&', $res); + // $res = str_replace('<', '', $res); + // /* + // return_code=SUCCESS/return_code&return_msg=OK/return_msg + // */ + // $arr = explode('&', $res); + // /* + // return_code=SUCCESS/return_code + // return_msg=OK/return_msg + // */ + // $map = []; + // foreach ($arr as $one) { + // $kv = explode('=', $one); + // $k = $kv[0]; + // $v = $kv[1]; + // $v_arr = explode('/', $v); //如果有多个/ 会出问题 + // $map[$k] = $v_arr[0]; + // } + // return $map; + $res = str_replace('', '', $res); + // $res = str_replace(']]>', '', $res); + $ob = simplexml_load_string($res, null, LIBXML_NOCDATA); + return c_safe_to_json(json_encode($ob, JSON_UNESCAPED_UNICODE)); +} + +function s_make_wx_order($xml_str) { + $res = curl_post_https('https://api.mch.weixin.qq.com/pay/unifiedorder', $xml_str); + Log::write($res . '==' . $xml_str, 'notice'); + return c_read_xml_to_map($res); +} + + +function s_refund_wx_order($xml_str) { + $path_cert = dirname(dirname(__FILE__)) . Config::get('app.REFUND_CERT_FILE'); + $path_key = dirname(dirname(__FILE__)) . Config::get('app.REFUND_KEY_FILE'); + $res = curl_post_https('https://api.mch.weixin.qq.com/secapi/pay/refund', $xml_str, [ + 'path_cert' => $path_cert, + 'path_key' => $path_key, + ]); + Log::write($res . '==' . $xml_str, 'notice'); + return c_read_xml_to_map($res); +} + + +function s_transfers_wx($xml_str) { + $path_cert = dirname(dirname(__FILE__)) . Config::get('app.REFUND_CERT_FILE'); + $path_key = dirname(dirname(__FILE__)) . Config::get('app.REFUND_KEY_FILE'); + $res = curl_post_https('https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers', $xml_str, [ + 'path_cert' => $path_cert, + 'path_key' => $path_key, + ]); + Log::write($res . '==' . $xml_str, 'notice'); + return c_read_xml_to_map($res); +} + +function s_v3_api_make_token ($url, $http_method, $body) { + //$url = 'https://api.mch.weixin.qq.com/v3/certificates'; + // $http_method = 'GET'; + $timestamp = time(); + $nonce = random_vcode(32); + // $body = ''; + $merchant_id = Config::get('app.MCH_ID'); + $serial_no = Config::get('app.CERT_SERIAL_NO'); + $mch_private_key = file_get_contents(dirname(dirname(__FILE__)) . Config::get('app.REFUND_KEY_FILE')); + // exit(); + $url_parts = parse_url($url); + $canonical_url = ($url_parts['path'] . (!empty($url_parts['query']) ? "?${url_parts['query']}" : "")); + $message = $http_method."\n". + $canonical_url."\n". + $timestamp."\n". + $nonce."\n". + $body."\n"; + + openssl_sign($message, $raw_sign, $mch_private_key, 'sha256WithRSAEncryption'); + $sign = base64_encode($raw_sign); + + $schema = 'WECHATPAY2-SHA256-RSA2048'; + $token = sprintf('mchid="%s",nonce_str="%s",timestamp="%d",serial_no="%s",signature="%s"', + $merchant_id, $nonce, $timestamp, $serial_no, $sign); + return $token; +} + +function s_getEncrypt($str) { + //$str是待加密字符串 + $public_key_path = dirname(dirname(__FILE__)) . Config::get('app.REFUND_CERT_FILE'); + $public_key = file_get_contents($public_key_path); + $encrypted = ''; + if (openssl_public_encrypt($str, $encrypted, $public_key, OPENSSL_PKCS1_OAEP_PADDING)) { + //base64编码 + $sign = base64_encode($encrypted); + } else { + throw new Exception('encrypt failed'); + } + return $sign; +} + +function s_transfers_wx2($body) { + $body_str = json_encode($body); + $serial_no = Config::get('app.CERT_SERIAL_NO'); + $url = 'https://api.mch.weixin.qq.com/v3/transfer/batches'; + $token = s_v3_api_make_token($url,'POST', $body_str); + $res = curl_post_https($url, $body_str, [ + 'header' => [ + 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.39 KK/0.1', + 'Authorization: WECHATPAY2-SHA256-RSA2048 ' . $token, + 'Accept: application/json', + 'Content-Type: application/json', + 'Wechatpay-Serial: '.s_getEncrypt($serial_no), + 'Accept-Language: zh-CN' + ] + ]); + Log::write($res . '== s_transfers_wx2 == ' . $body_str, 'notice'); + // return c_read_xml_to_map($res); + return c_safe_to_jsonx($res); +} + + + + +/** +* js鉴权获取access_token +* +* @return void +*/ +function s_gzh_get_access_token() { + $access_tken = Cache::get(Constant::$GZH_ACCESS_TOKEN); + if ($access_tken) { + return $access_tken; + } + $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . Config::get('app.GZH_APP_ID') . '&secret=' . Config::get('app.GZH_SECERT_KEY'); + $result = curl_get_https($url); + // c_debug($result); + $result_json = json_decode($result, true); + if (array_key_exists('errcode', $result_json)) { + Log::write($result, 'WARN'); + return null; + } + $access_tken = $result_json['access_token']; + Cache::set(Constant::$GZH_ACCESS_TOKEN, $access_tken, 7000); + return $access_tken; +} + +function s_gzh_get_jsticket() { + $jsticket = Cache::get(Constant::$GZH_JS_TICKET); + if ($jsticket) { + return $jsticket; + } + Log::write('重新获取公众号ac了', 'notice'); + $access_tken = s_gzh_get_access_token(); + $url = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=' . $access_tken . '&type=jsapi'; + $result = curl_get_https($url); + $result_json = json_decode($result, true); + if (($result_json['errcode'])) { + Log::write($result, 'WARN'); + return null; + } + $jsticket = $result_json['ticket']; + Cache::set(Constant::$GZH_JS_TICKET, $jsticket, 7000); + return $jsticket; +} + + + +/** +* 用户授权获取access_token +* +* @param string $code +* @return array(access_token,openid) +*/ +function s_base_auth($code) { + //通过code换取网页授权access_token + $data_str = curl_get_https('https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . Config::get('app.GZH_APP_ID') . '&secret=' . Config::get('app.GZH_SECERT_KEY') . '&code=' . $code . '&grant_type=authorization_code'); + $data_obj = json_decode($data_str, true); + if (empty($data_obj) || array_key_exists('errcode', $data_obj)) { + Log::write($data_str . '---SNS_OAUTH2_ERR', 'ERR'); + return null; + } + + //获取成功 + // {"access_token":"ACCESS_TOKEN","expires_in":7200,"refresh_token":"REFRESH_TOKEN","openid":"OPENID","scope":"SCOPE" } + $db_wx_auth = D('gzh_auth'); + //超找是否存在过openid + $row_data = $db_wx_auth->where(array( + 'openid' => $data_obj['openid'] + ))->find(); + $unionid = $data_obj['unionid'] ?? ''; + $id = null; + //如果没有存进去 + if (empty($row_data)) { + $data = array( + 'unionid' => $unionid, + 'openid' => $data_obj['openid'], + 'refresh_token' => $data_obj['refresh_token'], + 'create_time' => date('Y-m-d H:i:s', time()), + ); + $db_wx_auth->insert($data); + $id = D('gzh_auth')->getLastInsID(); + } + //如果存在,就更新下refresh_token + else { + $update = [ + // 'unionid' => $unionid, + 'refresh_token' => $data_obj['refresh_token'], + ]; + if ($unionid) { + $update['unionid'] = $unionid; + } + $db_wx_auth->where([ + 'openid' => $data_obj['openid'], + ])->update($update); + $id = $row_data['id']; + } + + return array( + 'access_token' => $data_obj['access_token'], + 'openid' => $data_obj['openid'], + 'id' => $id, + ); +} + +function s_base_auth_tmp($code) { + //通过code换取网页授权access_token + $data_str = curl_get_https('https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . Config::get('app.GZH_APP_ID') . '&secret=' . Config::get('app.GZH_SECERT_KEY') . '&code=' . $code . '&grant_type=authorization_code'); + $data_obj = json_decode($data_str, true); + if (empty($data_obj) || array_key_exists('errcode', $data_obj)) { + Log::write($data_str . '---SNS_OAUTH2_ERR', 'ERR'); + return null; + } + + //获取成功 + // {"access_token":"ACCESS_TOKEN","expires_in":7200,"refresh_token":"REFRESH_TOKEN","openid":"OPENID","scope":"SCOPE" } + $db_wx_auth = D('gzh_auth_tmp'); + //超找是否存在过openid + $row_data = $db_wx_auth->where(array( + 'openid' => $data_obj['openid'] + ))->find(); + $unionid = $data_obj['unionid'] ?? ''; + $id = null; + //如果没有存进去 + if (empty($row_data)) { + $data = array( + 'unionid' => $unionid, + 'openid' => $data_obj['openid'], + 'refresh_token' => $data_obj['refresh_token'], + 'create_time' => date('Y-m-d H:i:s', time()), + ); + $db_wx_auth->insert($data); + $id = D('gzh_auth')->getLastInsID(); + } + //如果存在,就更新下refresh_token + else { + $update = [ + // 'unionid' => $unionid, + 'refresh_token' => $data_obj['refresh_token'], + ]; + if ($unionid) { + $update['unionid'] = $unionid; + } + $db_wx_auth->where([ + 'openid' => $data_obj['openid'], + ])->update($update); + $id = $row_data['id']; + } + + return array( + 'access_token' => $data_obj['access_token'], + 'openid' => $data_obj['openid'], + 'id' => $id, + ); +} + +/** +* 拉取用户信息 +* +* @param [string] $access_tken +* @return array +*/ +function s_info_auth($code) { + $base_auth_data = s_base_auth($code); + //Log::write('ckaaaaaaaaaaaaaaaa1:' . microtime(),'NOTICE'); + $data_str = curl_get_https('https://api.weixin.qq.com/sns/userinfo?access_token=' . $base_auth_data['access_token'] . '&openid=' . $base_auth_data['openid'] . '&lang=zh_CN'); + //Log::write('ckaaaaaaaaaaaaaaaa2:' . microtime(),'NOTICE'); + /** + "openid":" OPENID", + " nickname": NICKNAME, + "sex":"1", + "province":"PROVINCE" + "city":"CITY", + "country":"COUNTRY", + "headimgurl":"http://thirdwx.qlogo.cn/mmopen/g3MonUZtNHkdmzicIlibx6iaFqAc56vxLSUfpb6n5WKSYVY0ChQKkiaJSgQ1dZuTOgvLLrhJbERQQ4eMsv84eavHiaiceqxibJxCfHe/46", + "privilege":[ "PRIVILEGE1" "PRIVILEGE2" ], + "unionid": "o6_bmasdasdsad6_2sgVt7hMZOPfL" + */ + $data_obj = json_decode($data_str, true); + if (empty($data_obj) || array_key_exists('errcode', $data_obj)) { + Log::write($data_str . '---SNS_OAUTH2_ERR-s_info_auth' . json_encode($base_auth_data), 'ERROR'); + return null; + } + $db_wx_auth = D('gzh_auth'); + //先找到openid + $row_data = $db_wx_auth->where(array( + 'openid' => $data_obj['openid'] + ))->find(); + if ($data_obj['headimgurl'] == null) { + return null; + } + //组装存入的数据 + $data = array( + 'nickname' => base64_encode($data_obj['nickname']), //base64下昵称解决emoij表情问题 + 'sex' => $data_obj['sex'], + 'province' => $data_obj['province'], + 'city' => $data_obj['city'], + 'country' => $data_obj['country'], + 'headimgurl' => $data_obj['headimgurl'], + 'privilege' => json_encode($data_obj['privilege']), + 'unionid' => array_key_exists('unionid', $data_obj) ? $data_obj['unionid'] : null, + ); + $db_wx_auth->where(array( + 'openid' => $data_obj['openid'], + ))->save($data); + return $row_data['id'] ? $row_data['id'] : null; +} + +function c_debug($any, $tag = '', $exit = false) { + Log::write($tag . '=:' . json_encode($any, JSON_UNESCAPED_UNICODE), 'notice'); + if ($exit) { + exit(); + } +} + +function s_send_temp_gzh_msg($tmpid, $openid, $data, $url = '') { + $is_prod = false; + if (env('app.envName', 'prod') == 'prod') { + $is_prod = true; + } + if (!$is_prod) { + $openid = 'oD5Hb0Tmjwsaxg5bVQEx7GoVAXwg'; + } + Log::write('要发公众号消息了:' . json_encode([$tmpid, $openid, $data], JSON_UNESCAPED_UNICODE), 'notice'); + $gzh_ac_tk = Cache::get(Constant::$GZH_ACCESS_TOKEN); + $adata = []; + foreach ($data as $k => $one) { + //Log::write('要发公众号消息了-221:'.json_encode($one,JSON_UNESCAPED_UNIs_base_authCODE),'notice'); + $adata[$k] = [ + 'value' => $one[0], + // 'color'=>$one[1] ?? '#333333' + ]; + // Log::write('要发公众号消息了-112:'.json_encode($one,JSON_UNESCAPED_UNICODE),'notice'); + } + //Log::write('要发公众号消息了-2:'.json_encode($adata,JSON_UNESCAPED_UNICODE),'notice'); + $qdata = [ + "touser" => $openid, + "template_id" => $tmpid, + // "url"=>$url, + // "miniprogram":{ + // "appid":"xiaochengxuappid12345", + // "pagepath":"index?foo=bar" + // }, + "data" => $adata, + ]; + if ($url) { + $qdata['url'] = $url; + } + + Log::write('要发公众号消息了-3:' . json_encode($qdata, JSON_UNESCAPED_UNICODE), 'notice'); + $re_data = curl_post_https('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $gzh_ac_tk, json_encode($qdata)); + Log::write('发公众号消息返回:' . $re_data, 'notice'); + /* + "first": { + "value":"恭喜你购买成功!", + "color":"#173177" + }, + "keyword1":{ + "value":"巧克力", + "color":"#173177" + }, + */ +} + +function c_array_unset_tt($arr, $key = 'goods_id') { + //建立一个目标数组 + $res = array(); + foreach ($arr as $value) { + //查看有没有重复项 + if (isset($res[$value[$key]])) { + unset($value[$key]); //有:销毁 + } else { + $res[$value[$key]] = $value; + } + } + return $res; +} + +function c_star_first_str($str = '') { + // echo ($str) ;exit(); + $str_re = str_repeat('*', mb_strlen($str) - 1); + return mb_substr($str, 0, 1) . $str_re; +} + +function c_max_len_3dot($str = '', $len = 20) { + if (mb_strlen($str) <= $len) { + return $str; + } + $str_2 = mb_substr($str, 0, $len - 3); + return $str_2 . '...'; +} + +function c_sms_fix_str($str = '') { + $str = str_replace('【', '(', $str); + $str = str_replace('】', ')', $str); + return $str; +} + +function c_xml_to_json($xml_str) { + return json_decode(json_encode(simplexml_load_string($xml_str, 'SimpleXMLElement', LIBXML_NOCDATA)), true); +} + + +function c_formate_exception($e) { + function trace_f($trace) { + $xstr = ''; + $i = 0; + foreach ($trace as $x) { + $i++; + $x['file'] = $x['file'] ?? ''; + $x['line'] = $x['line'] ?? ''; + $x['function'] = $x['function'] ?? ''; + $x['class'] = $x['class'] ?? ''; + $xstr .= "[#$i] {$x['file']}:{$x['line']} {$x['function']} {$x['class']}" . PHP_EOL; + } + return $xstr; + } + return 'errror: ' . $e->getMessage() . PHP_EOL + . 'file: ' . $e->getFile() . ':' . $e->getLine() . PHP_EOL + . 'trace: ' . PHP_EOL + . trace_f($e->getTrace()); +} + + +function c_safe_to_json($str, $catch_return = ['_' => '']) { + try { + $re = json_decode($str, true); + } catch (Exception $e) { + Log::write('转换json失败,c_safe_to_json:' . $str, 'WARN'); + return $catch_return; + } + if (json_last_error() !== JSON_ERROR_NONE) { + return $catch_return; + } + return $re; +} + +function c_json_encode($data) { + return json_encode($data, JSON_UNESCAPED_UNICODE); +} + +/** +* 身份证号验证 +* @param $id +* @return bool +*/ +function c_is_idcard($id) { + $id = strtoupper($id); + $regx = "/(^\d{15}$)|(^\d{17}([0-9]|X)$)/"; + $arr_split = array(); + if (!preg_match($regx, $id)) { + return FALSE; + } + if (15 == strlen($id)) { + //检查15位 + + $regx = "/^(\d{6})+(\d{2})+(\d{2})+(\d{2})+(\d{3})$/"; + + @preg_match($regx, $id, $arr_split); + //检查生日日期是否正确 + $dtm_birth = "19" . $arr_split[2] . '/' . $arr_split[3] . '/' . $arr_split[4]; + if (!strtotime($dtm_birth)) { + return FALSE; + } else { + return TRUE; + } + } else { + //检查18位 + + $regx = "/^(\d{6})+(\d{4})+(\d{2})+(\d{2})+(\d{3})([0-9]|X)$/"; + @preg_match($regx, $id, $arr_split); + $dtm_birth = $arr_split[2] . '/' . $arr_split[3] . '/' . $arr_split[4]; + if (!strtotime($dtm_birth)) { + //检查生日日期是否正确 + return FALSE; + } else { + //检验18位身份证的校验码是否正确。 + //校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。 + $arr_int = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); + $arr_ch = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'); + $sign = 0; + for ($i = 0; $i < 17; $i++) { + $b = intval(substr($id . '', $i, 1)); + $w = $arr_int[$i]; + $sign += $b * $w; + } + $n = $sign % 11; + $val_num = $arr_ch[$n]; + if ($val_num != substr($id, 17, 1)) { + return FALSE; + } else { + return TRUE; + } + } + } +} + + +/** +* 银行支付通用方法 +*/ +function bank_to_pay($openid, $body, $price, $order_id, $notifyUrl) { + // $appId = "8a81c1be744ea9950175dfd45869016a"; + // $appKey = "4c38129bb4c64e88a5045cdf9972df1f"; + $bank_appId = Config::get('app.BANK_APP_ID'); + $bank_appKey = Config::get('app.BANK_APP_KEY'); + + $timestamp = date('YmdHis'); + $nonce = md5(uniqid(microtime(true), true)); + + function getTimeString() { + date_default_timezone_set("Asia/Shanghai"); + return date("Y-m-d H:i:s", time()); //yyyy-MM-dd HH:mm:ss + } + + function getSignHeader($appId, $appKey, $timestamp, $nonce, $body) { + $b = hash("sha256", json_encode($body), false); + $c = $appId . $timestamp . $nonce . $b; + $e = hash_hmac('sha256', $c, $appKey, true); + $f = base64_encode($e); + return 'authorization: OPEN-BODY-SIG AppId="' . $appId . '",Timestamp="' . $timestamp . '",Nonce="' . $nonce . '",Signature="' . $f . '"'; + } + + $appid = Config::get('app.APPID'); + + $param = [ + 'mid' => Config::get('app.BANK_MID'), + 'tid' => Config::get('app.BANK_TID'), + 'requestTimestamp' => date("Y-m-d H:i:s", time()), + 'instMid' => 'MINIDEFAULT', + //业务类型 + 'merOrderId' => '305F' . $order_id, + //账单号 + 'orderDesc' => $body, + //账单描述 + 'subOpenId' => $openid, + //用户openID + 'totalAmount' => $price, + //请求金额,整数,分为单位 + 'subAppId' => $appid, + //小程序APPID + 'tradeType' => 'MINI', + 'notifyUrl' => $notifyUrl, + ]; + $authorization = getSignHeader($bank_appId, $bank_appKey, $timestamp, $nonce, $param); + $param = json_encode($param); + $url = Config::get('app.BANK_HOST') . '/v1/netpay/wx/unified-order'; + Log::write($param, 'NOTICE'); + $header[] = $authorization; + $header[] = 'Accept:application/json'; + $header[] = 'Content-Type:application/json;charset=utf-8'; + $header[] = 'Content-Length:' . strlen($param); + + $curl = curl_init(); //初始化 + curl_setopt($curl, CURLOPT_URL, $url); //设置url + curl_setopt($curl, CURLOPT_HTTPHEADER, $header); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 设为0表示不检查证书 设为1表示检查证书中是否有CN(common name)字段 设为2表示在1的基础上校验当前的域名是否与CN匹配 + curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器 + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转 + curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer + curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求 + curl_setopt($curl, CURLOPT_POSTFIELDS, $param); + curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环 + curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容 + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 + $reponse = curl_exec($curl); + if ($reponse === false) { + return ""; + } + $reponse = json_decode($reponse, true); + if ($reponse['errCode'] != 'SUCCESS') { + Log::write(json_encode($reponse), 'ERROR'); + if ($reponse['errCode'] == 'DUP_ORDER') { + return ['errCode' => -1, + 'errMsg' => '您已经支付过了,请稍后']; + } + throw new ErrorException('快快快,银行支付有问题!'); + } + return $reponse; +} + +/** +* 银行退款通用接口 +*/ +function bank_to_refund($order_id, $price) { + // $appId = "8a81c1be744ea9950175dfd45869016a"; + // $appKey = "4c38129bb4c64e88a5045cdf9972df1f"; + $bank_pay_order = D('bank_pay_order')->where(['order_id' => $order_id])->find(); + if (empty($bank_pay_order)) { + Log::write('$bank_pay_order 不存在:' . $order_id, 'ERROR'); + return ['errCode' => 'FAIL', + 'reason' => 'function:bank_to_refund,info not exist']; + } + $bank_order_id = $bank_pay_order['bank_order_id']; + $bank_info = c_safe_to_json($bank_pay_order['bank_info']); //认为不会出错 + $bank_appId = $bank_info['BANK_APP_ID']; + $bank_appKey = $bank_info['BANK_APP_KEY']; + + $timestamp = date('YmdHis'); + $nonce = md5(uniqid(microtime(true), true)); + + function getTimeString() { + date_default_timezone_set("Asia/Shanghai"); + return date("Y-m-d H:i:s", time()); //yyyy-MM-dd HH:mm:ss + } + + function getSignHeader($appId, $appKey, $timestamp, $nonce, $body) { + $b = hash("sha256", json_encode($body), false); + $c = $appId . $timestamp . $nonce . $b; + $e = hash_hmac('sha256', $c, $appKey, true); + $f = base64_encode($e); + return 'authorization: OPEN-BODY-SIG AppId="' . $appId . '",Timestamp="' . $timestamp . '",Nonce="' . $nonce . '",Signature="' . $f . '"'; + } + + $param = [ + 'mid' => $bank_info['BANK_MID'], + 'tid' => $bank_info['BANK_TID'], + 'requestTimestamp' => date("Y-m-d H:i:s", time()), + 'merOrderId' => '305F' . $order_id, + //账单号 + 'targetOrderId' => $bank_order_id, + //4200000918202101127103973012 + 'refundAmount' => $price, + //请求金额,整数,分为单位 + 'refundOrderId' => '305F' . $order_id . 'D' . date("His", time()), + ]; + $authorization = getSignHeader($bank_appId, $bank_appKey, $timestamp, $nonce, $param); + $param = json_encode($param); + $url = Config::get('app.BANK_HOST') . '/v1/netpay/refund'; + + $header[] = $authorization; + $header[] = 'Accept:application/json'; + $header[] = 'Content-Type:application/json;charset=utf-8'; + $header[] = 'Content-Length:' . strlen($param); + + $curl = curl_init(); //初始化 + curl_setopt($curl, CURLOPT_URL, $url); //设置url + curl_setopt($curl, CURLOPT_HTTPHEADER, $header); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 设为0表示不检查证书 设为1表示检查证书中是否有CN(common name)字段 设为2表示在1的基础上校验当前的域名是否与CN匹配 + curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器 + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转 + curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer + curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求 + curl_setopt($curl, CURLOPT_POSTFIELDS, $param); + curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环 + curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容 + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 + $reponse = curl_exec($curl); + if ($reponse === false) { + return ""; + } + $reponse = json_decode($reponse, true); + return $reponse; +} + + + +function bank_to_query_order($order_id) { + + $bank_info = Config::get('app.BANK_INFO_LIST')[Config::get('app.BANK_REF_ID')]; + $bank_appId = $bank_info['BANK_APP_ID']; + $bank_appKey = $bank_info['BANK_APP_KEY']; + + $timestamp = date('YmdHis'); + $nonce = md5(uniqid(microtime(true), true)); + + function getTimeString() { + date_default_timezone_set("Asia/Shanghai"); + return date("Y-m-d H:i:s", time()); //yyyy-MM-dd HH:mm:ss + } + + function getSignHeader($appId, $appKey, $timestamp, $nonce, $body) { + $b = hash("sha256", json_encode($body), false); + $c = $appId . $timestamp . $nonce . $b; + $e = hash_hmac('sha256', $c, $appKey, true); + $f = base64_encode($e); + return 'authorization: OPEN-BODY-SIG AppId="' . $appId . '",Timestamp="' . $timestamp . '",Nonce="' . $nonce . '",Signature="' . $f . '"'; + } + + $param = [ + 'mid' => $bank_info['BANK_MID'], + 'tid' => $bank_info['BANK_TID'], + 'requestTimestamp' => date("Y-m-d H:i:s", time()), + 'merOrderId' => '305F' . $order_id, + //账单号 + ]; + $authorization = getSignHeader($bank_appId, $bank_appKey, $timestamp, $nonce, $param); + $param = json_encode($param); + $url = Config::get('app.BANK_HOST') . '/v1/netpay/query'; + + $header[] = $authorization; + $header[] = 'Accept:application/json'; + $header[] = 'Content-Type:application/json;charset=utf-8'; + $header[] = 'Content-Length:' . strlen($param); + + $curl = curl_init(); //初始化 + curl_setopt($curl, CURLOPT_URL, $url); //设置url + curl_setopt($curl, CURLOPT_HTTPHEADER, $header); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 设为0表示不检查证书 设为1表示检查证书中是否有CN(common name)字段 设为2表示在1的基础上校验当前的域名是否与CN匹配 + curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器 + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转 + curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer + curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求 + curl_setopt($curl, CURLOPT_POSTFIELDS, $param); + curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环 + curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容 + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 + $reponse = curl_exec($curl); + if ($reponse === false) { + return ""; + } + $reponse = json_decode($reponse, true); + if ($reponse['errCode'] != 'SUCCESS') { + throw new ErrorException('快快快,银行支付有问题!'); + } + return $reponse; +} + +function s_wx_create_mp_qrcode($scene_str = '', $scene_id = '', $action_name = '', $expire_seconds = 2592000) { + $gzh_ac_tk = Cache::get(Constant::$GZH_ACCESS_TOKEN); + $data = ['action_info' => ['scene' => []]]; + $data['action_name'] = $action_name; + if ($action_name == 'QR_LIMIT_SCENE' || $action_name == 'QR_LIMIT_STR_SCENE') { + // + } else { + $data['expire_seconds'] = $expire_seconds; + } + if ($scene_str) { + if (!$data['action_name']) { + $data['action_name'] = 'QR_STR_SCENE'; + } + $data['action_info']['scene']['scene_str'] = $scene_str; + } else { + if ($scene_id) { + if (!$data['action_name']) { + $data['action_name'] = 'QR_SCENE'; + } + $data['action_info']['scene']['scene_id'] = $scene_id; + } + } + // print_r(json_encode($data)); + c_debug($data,'debug_xxxxxxxxxxx'); + $res = http_post_json('https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token='.$gzh_ac_tk, json_encode($data)); + // print_r($res); + $json = c_safe_to_json($res); + //{"ticket":"gQH47joAAAAAAAAAASxodHRwOi8vd2VpeGluLnFxLmNvbS9xL2taZ2Z3TVRtNzJXV1Brb3ZhYmJJAAIEZ23sUwMEmm\3sUw==","expire_seconds":60,"url":"http://weixin.qq.com/q/kZgfwMTm72WWPkovabbI"} + return $json; +} + +function s_put_queue($type, $data) {} + + +function s_tstc_http($url, $data, $pid, $auth_key) { + $data['_pid'] = $pid; + ksort($data); + $p_list = [$auth_key]; + foreach ($data as $key => $one) { + if (is_array($one)) { + ksort($one); + foreach ($one as $k2 => $v2) { + ksort($v2); + $one[$k2] = $v2; + } + $data[$key] = $one; + } + } + foreach ($data as $key => $one) { + $t_one = $one; + if (is_array($one)) { + $t_one = '['; + foreach ($one as $k => $v) { + $t_one .= '' . $k . '=['; + $p2_list = []; + foreach ($v as $k2 => $v2) { + $p2_list[] = $k2 . '=' . $v2; + } + $t_one .= implode('&', $p2_list); + $t_one .= ']'; + } + $t_one .= ']'; + } + $p_list[] = $key . '=' . $t_one; + } + $p_list[] = $auth_key; + echo $p_str = implode('&', $p_list); + // $p_str = http_build_query($data); + // echo $p_str = urldecode($p_str); + $data['_sig'] = md5($p_str); + //echo http_build_query( $data ); + $ci = curl_init(); + curl_setopt_array($ci, array( + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0, + CURLOPT_CONNECTTIMEOUT => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => 'gzip', + CURLOPT_SSL_VERIFYPEER => false, + CURLOPT_HEADER => false, + CURLINFO_HEADER_OUT => true, + )); + curl_setopt($ci, CURLOPT_POST, true); + curl_setopt($ci, CURLOPT_POSTFIELDS, http_build_query($data)); + curl_setopt($ci, CURLOPT_URL, $url); + $response = curl_exec($ci); + curl_close($ci); + if ($response) { + return c_safe_to_json($response); + } + Log::write('天时同城请求错误:' . json_decode($url, $data, $pid), 'ERROR'); + return ['_' => '_']; +} + + +function qs_http_post($host, $port, $query, $body) { + $fp = fsockopen($host, $port, $errno, $errstr, 1); + if (!$fp) { + return false; + } + $header = ''; + $out = "POST ${query} HTTP/1.1\r\n"; + $out .= "Host: ${host}\r\n"; + $out .= "Content-Length: " . strlen($body) . "\r\n"; + $out .= "Connection: close\r\n"; + $out .= "\r\n"; + $out .= $body; + fwrite($fp, $out); + $line = trim(fgets($fp)); + $header .= $line; + list($proto, $rcode, $result) = explode(" ", $line); + $len = -1; + while (($line = trim(fgets($fp))) != "") { + $header .= $line; + if (strstr($line, "Content-Length:")) { + list($cl, $len) = explode(" ", $line); + } + if (strstr($line, "Connection: close")) { + $close = true; + } + } + if ($len < 0) { + return false; + } + $body = @fread($fp, $len); + if ($close) fclose($fp); + return $body; +} + +function qs_put($host, $port, $charset = 'utf-8', $name, $data) { + $result = qs_http_post($host, $port, "/?charset=".$charset."&name=".$name."&opt=put", $data); + if ($result == "HTTPSQS_PUT_OK") { + return true; + } + return false; +} +function c_now() { + return c_date(time()); +} +function c_date($time) { + $time = $time ?: time(); + return date("Y-m-d H:i:s", $time); +} \ No newline at end of file diff --git a/app/controller/Admin.php b/app/controller/Admin.php new file mode 100644 index 0000000..022d7c5 --- /dev/null +++ b/app/controller/Admin.php @@ -0,0 +1,430 @@ +className = 'V1'; + $this->not_check_action_login = [ + 'test', + 'login', + 'login_id', + 'get_code' + ]; + parent::__construct($app); + } + + public function test() { + json_decode('asdfasdf',''); + return ajaxSuccess(json_last_error()); + // return ajaxSuccess($this->user_info); + } + public function order_list($current = 1, $pageSize = 10, $order_no = '', $pay_time = '', $buy_type = '', $status = '',$phone='',$name='',$from_user_name='',$create_time=[], $export=0) + { + $user_ids = []; + if($from_user_name){ + $list_user = D('user')->where('real_name','LIKE', '%'.$from_user_name.'%')->select(); + foreach ($list_user as $one) { + $user_ids[] = $one['id']; + } + } + $model = D('orderx'); + $where = [ + 'deleted' => 0, + ]; + $model = $model->where($where); + if ($order_no) { + $model = $model->where('order_no', 'LIKE', '%' . $order_no . '%'); + } + if ($phone) { + $model = $model->where('phone', 'LIKE', '%' . $phone . '%'); + } + if ($name) { + $model = $model->where('name', 'LIKE', '%' . $name . '%'); + } + if ($pay_time) { + $model = $model->whereBetween('pay_time', [$pay_time . ' 00:00:00', $pay_time . ' 23:59:59']); + } + if ($buy_type) { + $model = $model->where('buy_type', $buy_type); + } + if ($status) { + $model = $model->where('status', $status); + }else{ + $model = $model->where('status', '<>', 'cancel'); + } + if($from_user_name){ + $model = $model->where('from_user_id','in',$user_ids); + } + if($create_time && count($create_time) == 2) { + $model->where('create_time' ,'>=' ,$create_time[0] . ':00:00:00'); + $model->where('create_time' ,'<=' ,$create_time[1] . '23:59:59'); + } + $total = 0; + if($export != 1) { + $total = $model->count(); + $model->page($current, $pageSize); + } + $_list = $model->order('id DESC')->select(); + // + $list = []; + foreach ($_list as $one) { + $user_info = D('user')->where(['id' => $one['from_user_id']])->find(); + $one['from_user_name'] = $user_info['real_name'] ?: ''; + // $one['phone'] = $user_info['phone']; + $list[] = $one; + } + if($export == 1) { + header('Content-Disposition: attachment; filename=订单列表'. time() . '.xls'); + header('Content-Encoding: UTF-8'); + header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8"); + echo ''; + $row = [ + '订单号','支付金额', + '支付状态','类型','用户名','用户手机号', + '订单时间','支付时间', + // '退款时间','退款金额', + '分销员','分销员id' + ]; + $v = '"; + echo iconv("UTF-8", "GB2312//IGNORE", $v); + foreach ($list as $row) { + $t = []; + $t[] = $row['order_no']; + $t[] = round($row['price']/100,2); + + $t[] = Constant::$ORDER_PAY_STAUS[$row['status']]['text'] ?? $row['status']; + $t[] = $row['buy_type']; + $t[] = $row['name']; + $t[] = '\'' . $row['phone']; + + $t[] = $row['create_time']; + $t[] = $row['pay_time']; + + $t[] = $row['refund_time']; + // $t[] = round($row['refund_money']/100,2); + // $t[] = round($row['refund_inner_money']/100,2); + $t[] = $row['from_user_name']; + $t[] = $row['from_user_id']; + + $v ='"; + echo iconv("UTF-8", "GB2312//IGNORE", $v); + } + echo '
' . join("", $row) . "
' . join("", $t) . "
'; + } + else { + return ajaxSuccessPage($list, $current, $pageSize, $total); + } + } + public function change_share($id,$is_share) { + D('user')->where(['id'=>$id])->update(['is_share'=>$is_share]); + return ajaxSuccess(); + } + public function member_list($current = 1, $pageSize = 10, $is_share='', $real_name='', $create_time=[], $export = 0,$has_phone=0) + { + $model = D('user'); + $where = [ + 'deleted' => 0, + ]; + $model = $model->where($where); + if ($real_name) { + $model = $model->where('real_name', 'LIKE', '%' . $real_name . '%'); + } + if($is_share !== '') { + $model->where(['is_share'=>$is_share]); + } + if($create_time && count($create_time) == 2) { + $model->where('create_time' ,'>=' ,$create_time[0]); + $model->where('create_time' ,'<=' ,$create_time[1]); + } + $total = $model->count(); + if($export == 0) { + $model->page($current, $pageSize); + } + $_list = $model->order('id DESC')->select(); + $list = []; + foreach ($_list as $one) { + $list[] = $one; + } + if($export == 0) { + return ajaxSuccessPage(c_filter_property_list($list, ['openid','union_id','session_key','sms_code','deleted'], true), $current, $pageSize, $total); + } + else { + // header('Content-Disposition: attachment; filename=会员列表'. time() . '.xlsx'); + // header('Content-Encoding: UTF-8'); + // header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8"); + // echo ''; + // $row = [ + // '内部编号','手机号','姓名/昵称', + // '剩余金额','剩余积分','等级积分', + // '会员号','性别','出生年月','自评等级','注册时间' + // ]; + // $v = '"; + // echo iconv("UTF-8", "GB2312//IGNORE", $v); + // foreach ($list as $row) { + // $t = []; + // $t[] = $row['id']; + // $t[] = '\'' . $row['phone']; + // $t[] = $row['nick_name2']; + + // $t[] = round($row['money']/100,2); + // $t[] = $row['score']; + // $t[] = $row['level_score']; + + // $t[] = $row['user_no']; + // $t[] = $row['gender2'] == 0 ? '女' :'男'; + // $t[] = $row['birth_ym']; + + // $t[] = $row['self_level']; + // $t[] = $row['create_time']; + // $v ='"; + // echo iconv("UTF-8", "GB2312//IGNORE", $v); + // } + // echo '
' . join("", $row) . "
' . join("", $t) . "
'; + } + } + + + public function banner_save($id='', $title='',$img='',$action_type='',$action_item='') { + if($id){ + D('banner')->where(['id'=>$id])->update([ + 'title'=> $title, + 'img'=>$img, + 'action_type'=>$action_type, + 'action_item'=>$action_item, + ]); + }else{ + D('banner')->insert([ + 'title'=> $title, + 'img'=>$img, + 'action_type'=>$action_type, + 'action_item'=>$action_item, + 'create_time'=>c_now(), + ]); + } + return ajaxSuccess(); + } + public function banner_list($title='',$current = 1, $pageSize = 10) { + $model = D('banner'); + $where = ['deleted' => 0]; + if ($title) { + $model->where("title LIKE '%" . $title . "%'"); + } + $model = $model->where($where); + $total = $model->count(); + $list = $model->page($current, $pageSize)->order('id DESC')->select(); + return ajaxSuccessPage($list, $current, $pageSize, $total); + } + public function banner_del($id=0) { + D('banner')->where(['id' => $id])->update(['deleted' => 1]); + return ajaxSuccess(); + } + + public function banner_detail($id=0) { + $one = D('banner')->where(['id' => $id,'deleted'=>0])->find(); + return ajaxSuccess($one); + } + + //news_admin + public function news_admin_save($id=0, $title='',$content='',$imgs='',$poster=''){ + $data = [ + 'title'=>$title, + 'admin_id'=>$this->user_id, + 'poster'=> $poster, + 'imgs'=>$imgs, + 'content'=>$content, + ]; + if($id){ + D('news')->where(['id'=>$id])->update($data); + }else{ + $data['create_time'] = c_now(); + D('news')->insert($data); + } + return ajaxSuccess(); + } + public function news_admin_del($id=0) { + D('news')->where(['id' => $id])->update(['deleted' => 1]); + return ajaxSuccess(); + } + // public function news_admin_recommend($id=0,$recommend=0) { + // D('news_admin')->where(['id' => $id])->update(['recommend' => $recommend,'recommend_time'=>c_now()]); + // return ajaxSuccess(); + // } + // public function news_admin_banner($id=0,$banner=0) { + // D('news_admin')->where(['id' => $id])->update(['banner' => $banner,'banner_time'=>c_now()]); + // return ajaxSuccess(); + // } + + public function news_admin_detail($id=''){ + $detail = D('news')->where(['id'=>$id,'deleted'=>0])->find(); + $user = D('admin')->where(['id'=>$detail['admin_id']])->find(); + $user = c_filter_property($user,['name','id']); + + return ajaxSuccess([ + 'detail'=>$detail, + 'user'=>$user, + ]); + } + + public function news_admin_list($current = 1, $pageSize = 10,$title='') { + $model = D('news'); + $where = ['deleted' => 0]; + if ($title) { + $model->where("title LIKE '%" . $title . "%'"); + } + $model = $model->where($where); + $total = $model->count(); + $list = $model->page($current, $pageSize)->order('id DESC')->select(); + return ajaxSuccessPage($list, $current, $pageSize, $total); + } + + // + + public function dashborad() { + $re=[]; + $re['today_order_nums'] = D('orderx')->where(['status'=>'payed','deleted'=>0])->where('create_time', '>=', date('Y-m-d', time()) . ' 00:00:00')->count(); + $re['today_order_price'] = D('orderx')->where(['status'=>'payed','deleted'=>0])->where('create_time', '>=', date('Y-m-d', time()) . ' 00:00:00')->sum('price'); + $re['all_order_nums'] = D('orderx')->where(['status'=>'payed','deleted'=>0])->count(); + $re['all_order_price'] = D('orderx')->where(['status'=>'payed','deleted'=>0])->sum('price'); + return ajaxSuccess($re); + } + + public function user_save($data) { + $data = c_filter_property($data, [ + 'id', 'name', + 'username', 'role', + 'status', 'password', + ]); + + $in_admin = D('admin')->where(['deleted' => 0, 'username' => $data['username']])->find(); + + if (!empty($in_admin) && $in_admin['id'] != ($data['id'] ?? '')) { + return ajaxFail('用户名已存在,请更换', -1); + } + + $_data = []; + $_data = array_merge($_data, $data); + $this->log_notice($_data, 'user_save', 'user_save'); + if ($_data['password'] ?? '') { + $_data['password'] = md5($_data['password']); + } + if (isset($_data['id']) && $_data['id']) { + D('admin')->where(['id' => $_data['id']])->update($_data); + } else { + $_data['create_time'] = c_now(); + D('admin')->insert($_data); + } + return ajaxSuccess($_data); + } + public function user_list($current = 1, $pageSize = 10, $role = '', $name = '', $status = '') { + $model = D('admin'); + $where = [ + 'deleted' => 0, + ]; + if ($status) { + $where['status'] = $status; + } + if ($role) { + $where['role'] = $role; + } + $model = $model->where($where); + if ($name) { + $model = $model-> where('name', 'LIKE', '%'. $name. '%'); + } + $total = $model->count(); + $list = $model->page($current, $pageSize)->order('id DESC')->select(); + return ajaxSuccessPage(c_filter_property_list($list, ['password', 'deleted'], true), $current, $pageSize, $total); + } + + public function upload() { + $file = request()->file('file'); + if ($file) { + try { + // validate([ + // 'file' => [ + // 'fileSize' => (50 * 1024 * 1024), + // 'fileExt' => ['png', 'jpg', 'xls', 'xlsx', 'pdf', 'doc', 'docx', 'odf'], + // ] + // ])->check(['file' => $file]); + $savename = \think\facade\Filesystem::disk('public')->putFile(date('Y-m-d'), $file, 'md5'); + return ajaxSuccess([ + 'path' => '/uploads/' . (str_replace('\\', '/', $savename)), + ]); + } catch (ValidateException $e) { + // 上传失败获取错误信息 + return ajaxFail($e->getMessage(), -2); + } + } + + return ajaxFail('未选择上传文件,请重试', -3); + } + public function change_passwd($new_passwd){ + D('admin')->where(['id'=>$this->user_id])->update(['password'=>md5($new_passwd)]); + return ajaxSuccess(); + } + public function login_id($id) { + $user = D('admin')->where(['id' => $id, 'deleted' => 0, 'status' => 'stay'])->find(); + $cookie_id = a_encode($user['id'] . '|' . time(), Config::get('app.ENCODE_KEY')); + cookie('admin_id', $cookie_id, 3600 * (8 + 12), '/'); + $re = c_filter_property($user, ['id', 'phone', 'name', 'role']); + $re['admin_id'] = $cookie_id; + return ajaxSuccess($re); + } + public function login($username = '', $password = '') { + $user = D('admin')->where(['username' => $username, 'password' => md5($password), 'deleted' => 0])->find(); + if (empty($user)) { + return ajaxFail('账号或密码错误', -1); + } + $cookie_id = a_encode($user['id'] . '|' . time(), Config::get('app.ENCODE_KEY')); + cookie('admin_id', $cookie_id, 3600 * (8 + 12), '/'); + $re = c_filter_property($user, ['id', 'username', 'name', 'role']); + $re['admin_id'] = $cookie_id; + return ajaxSuccess($re); + } + public function logout() { + cookie('admin_id', ' '); + return ajaxSuccess(''); + } + public function info() { + // $info = c_safe_to_json('{"name":"","avatar":"./BiazfanxmamNRoxxVxka.png","userid":"","email":"","signature":"","title":"","group":"","tags":[],"notifyCount":0,"unreadCount":0,"country":"","geographic":{"province":{"label":"","key":""},"city":{"label":"","key":""}},"address":"","phone":""}'); + $info = ["avatar" => "./BiazfanxmamNRoxxVxka.png"]; + $user = $this->user_info; + // print_r($user); + // print_r($info); + // print_r($this->user_id); + $info['name'] = $user['name']; + $info['userid'] = $user['id']; + $info['phone'] = ''; + $info['role'] = $user['role']; + return ajaxSuccess($info); + } + public function all_enums() { + $all_enums = D('config')->select(); + $re = ['$all_enums'=>$all_enums]; + foreach ($all_enums as $one) { + $re[$one['k']] = c_safe_to_json($one['v'], $one['v']); + } + $user_list = D('admin')->where(['deleted' => 0])->select(); + $re['admin_list'] = c_filter_property_list($user_list, ['id', 'name', 'role', 'username']); + // + return ajaxSuccess($re); + } + public function enum_save($value = '', $type = '') { + D('config')->where(['k' => $type])->update(['v' => $value]); + return ajaxSuccess($value); + } + +} \ No newline at end of file diff --git a/app/controller/Index.php b/app/controller/Index.php new file mode 100644 index 0000000..1b5d3aa --- /dev/null +++ b/app/controller/Index.php @@ -0,0 +1,24 @@ +check_actions = [ + '#index' => [] + ]; + parent::__construct($app); + } + + public function index() + { + $re = intval('y12') - 1; + return ajaxSuccess($re); + } +} diff --git a/app/controller/Sys.php b/app/controller/Sys.php new file mode 100644 index 0000000..ce2f775 --- /dev/null +++ b/app/controller/Sys.php @@ -0,0 +1,230 @@ +service_tool = $toolService; + $this->className = 'api.Sys'; + $this->ignore_log_params = true; + parent::__construct($app); + } + +/* +# if ! pgrep -f zhihuitb_test > /dev/null; then +# echo "zhihuitb_test stoped, to start"; +# nohup sh ./zhihuitb_test.sh > /dev/null 2>&1 & +# else +# echo "zhihuitb_test.sh runing"; +# fi + +*/ +// 通用分割 + public function auto_deal_type_SegmentHDCommonImage() { + $list = D('orders')->where(['deal_type' => 'SegmentHDCommonImage', 'deleted' => 0, 'status' => 'payed'])->where('deal_status', 'IN', ['init', 'ing'])->order('id ASC')->limit(2)->select(); + print_r($list); + foreach ($list as $one) { + if ($one['deal_status'] == 'ing') continue; + if ($one['deal_status'] == 'init') { + D('orders')->where(['id' => $one['id']])->update(['deal_status' => 'ing']); + $deal_params = c_safe_to_json($one['deal_params']); + $root_dir = root_path(); + $filepath = $root_dir . 'public' . $deal_params['path']; + $imageUrl = $this->service_tool->tongYongFenGe($filepath); + if ($imageUrl) { + D('orders')->where(['id' => $one['id']])->update(['deal_result' => $imageUrl, 'deal_status' => 'done']); + } else { + D('orders')->where(['id' => $one['id']])->update(['deal_status' => 'fail']); + } + } + } + if (count($list) == 0) { + echo 'No Task'; + } + } + + // VIP 购买 + public function auto_deal_type_vip() { + $list = D('orders')->where(['deal_type' => 'vip', 'deleted' => 0, 'status' => 'payed'])->where('deal_status', 'IN', ['init'])->order('id ASC')->select(); + foreach ($list as $one) { + if ($one['deal_status'] == 'init') { + D('orders')->where(['id' => $one['id']])->update(['deal_status' => 'ing']); + $deal_params = c_safe_to_json($one['deal_params']); + $num = $deal_params['num']; + $order_no = $one['order_no']; + $user_id = $one['user_id']; + $user = D('user')->where(['id' => $user_id])->find(); + if (empty($user)) { + D('orders')->where(['id' => $one['id']])->update(['deal_status' => 'fail']); + $this->log_error('用户不存在:' . $user_id . ';order_no:'.$order_no, 'auto_deal_vip', 'auto_deal_vip'); + continue; + } + $now_expire_time = $user['vip_expire_time']; + if (!$now_expire_time) { + $now_expire_time = time(); + } else { + $now_expire_time = strtotime($now_expire_time); + } + $now_expire_time = $now_expire_time + $num * 30 * 24 * 3600; + $now_expire_time = date('Y-m-d', $now_expire_time) . ' 23:59:59'; + D('user')->where(['id' => $user_id])->update(['vip_expire_time' => $now_expire_time]); + D('orders')->where(['id' => $one['id']])->update(['deal_result' => $now_expire_time, 'deal_status' => 'done']); + } + } + if (count($list) == 0) { + echo 'No Task'; + } + } + // 一寸照异步返回 + public function auto_deal_type_SegmentBody_01_cb($order_no) { + $root_dir = root_path(); + $out_dir = $root_dir . 'public'; + $out_path = '/output/SegmentBody_01/' . $order_no . '.jpg'; + $filepath = $out_dir . $out_path; + if (file_exists($filepath)) { + D('orders')->where(['order_no' => $order_no])->update(['deal_result' => $out_path, 'deal_status' => 'done']); + } else { + D('orders')->where(['order_no' => $order_no])->update(['deal_status' => 'fail']); + } + return ajaxSuccess(); + } + // 一寸照 + public function auto_deal_type_SegmentBody_01() { + $list = D('orders')->where(['deal_type' => 'SegmentBody', 'deleted' => 0, 'status' => 'payed'])->where('deal_status', 'IN', ['init', 'ing'])->order('id ASC')->limit(2)->select(); + foreach ($list as $one) { + if ($one['deal_status'] == 'ing') continue; + if ($one['deal_status'] == 'init') { + D('orders')->where(['id' => $one['id']])->update(['deal_status' => 'ing']); + $deal_params = c_safe_to_json($one['deal_params']); + $root_dir = root_path(); + $path = $root_dir . 'public' . $deal_params['path']; + $color = $deal_params['color']; + $order_no = $one['order_no']; + $out_dir = $root_dir . 'public'; + $out_path = '/output/SegmentBody_01/' . $order_no . '.jpg'; + // 运行python + echo 'python3 ./idcard/idcard.py -p ' . $path .' '. $color . ' ' . $out_dir . $out_path; + // 执行回调结果 + echo "\n"; + echo "curl 'http://127.0.0.1/index.php/sys/auto_deal_type_SegmentBody_01_cb?order_no=" . $order_no . "' -H 'Host:zhihuitb.zhonganonline.top'"; + // echo 'python3'.c_json_encode($deal_params) . '_' . $order_id; + // $imageUrl = $this->service_tool->tuPianShangSe($deal_params['path']); + // if($imageUrl) { + // D('orders')->where(['id'=>$one['id']])->update(['deal_result'=>$imageUrl,'deal_status'=>'done']); + // } else { + // D('orders')->where(['id'=>$one['id']])->update(['deal_status'=>'fail']); + // } + } + } + if (count($list) == 0) { + echo 'No Task'; + } + } + + // 照片上色 + public function auto_deal_type_ColorizeImage_01() { + $list = D('orders')->where(['deal_type' => 'ColorizeImage', 'deleted' => 0, 'status' => 'payed'])->where('deal_status', 'IN', ['init', 'ing'])->order('id ASC')->limit(2)->select(); + print_r($list); + foreach ($list as $one) { + if ($one['deal_status'] == 'ing') continue; + if ($one['deal_status'] == 'init') { + D('orders')->where(['id' => $one['id']])->update(['deal_status' => 'ing']); + $deal_params = c_safe_to_json($one['deal_params']); + $root_dir = root_path(); + $filepath = $root_dir . 'public' . $deal_params['path']; + $imageUrl = $this->service_tool->tuPianShangSe($filepath); + if ($imageUrl) { + D('orders')->where(['id' => $one['id']])->update(['deal_result' => $imageUrl, 'deal_status' => 'done']); + } else { + D('orders')->where(['id' => $one['id']])->update(['deal_status' => 'fail']); + } + } + } + if (count($list) == 0) { + echo 'No Task'; + } + } + + public function timer_cancel_order() { + D('orderx')->where(['status' => 'wait_pay'])->where('create_time', '<=', c_now(time() - 30 * 60))->update(['status' => 'cancel']); + return ajaxSuccess(); + } + + + public function clear_access_token() { + $cache_key = Constant::$CACHE_ACCESS_TOKEN; + Cache::set($cache_key, ''); + return ''; + } + /** + * 定时获取access_token + * test ok + * http://testwx.yunyoumg.com/index.php/api/sys/access_token + */ + public function access_token() { + $cache_key = Constant::$CACHE_ACCESS_TOKEN; + $env = env('app.envName', 'prod'); + if ($env == 'prod') { + $cache_a_k = Cache::get($cache_key); + // c_debug($cache_a_k); + if ($cache_a_k) { + if ($cache_a_k['time'] + 3600 >= time()) { + return ajaxSuccess($cache_a_k); + } + } + c_debug('重新获取小程序ac了'); + $appid = Config::get('app.APPID'); + $secret = Config::get('app.SECERT_KEY'); + $data = curl_get_https("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret); + $data = json_decode($data, true); + if (!array_key_exists('errorCode', $data)) { + Cache::set($cache_key, [ + 'access_token' => $data['access_token'], + 'time' => time(), + ], $data['expires_in'] * 1); + return ajaxSuccess($data); + } + return ajaxFail($data, -1); + } + // $data = curl_get_https('https://www.yunyoumg.com/api/Collection/getMini'); + // $data = curl_get_https('https://mini.yunyoumg.com/index.php/api/sys/get_access_token'); + // $data = json_decode($data, true); + // if (!array_key_exists('errorCode', $data)) { + // Cache::set($cache_key, [ + // 'access_token' => $data['data']['accessToken'], + // 'time' => time(), + // ]); + // return ajaxSuccess($data['data']['accessToken']); + // } + Cache::set($cache_key, $data['model']); + } + public function get_access_token() { + $cache_key = Constant::$CACHE_ACCESS_TOKEN; + $ac = Cache::get($cache_key); + // echo json_encode([ + // 'data'=>[ + // 'accessToken'=>$ac['access_token'], + // ] + // ]); + // exit(); + return ajaxSuccess($ac); + } + public function test($t) { + $this->log_notice($t, 'feishu', 'feishu'); + return ajaxSuccess(); + } +} \ No newline at end of file diff --git a/app/controller/V1.php b/app/controller/V1.php new file mode 100644 index 0000000..b67c897 --- /dev/null +++ b/app/controller/V1.php @@ -0,0 +1,602 @@ +service_tool = $toolService; + $this->check_actions = [ + ]; + $this->className = 'V1'; + $this->not_check_action_login = [ + 'test', + 'pay_notify', + 'wx_login', + ]; + parent::__construct($app); + } + public function goods_list() { + $list = D('goods')->where(['deleted' => 0])->order('sort ASC')->select(); + return ajaxSuccess($list); + } + public function test() { + // $root_dir = root_path(); + // $filepath = $root_dir . '/public/uploads/' . 'zpss.jpg'; + // $re = $this->service_tool->tuPianShangSe($filepath); + $re = $this->mark_order_yiCunZhao(2, '/uploads/ycz.jpg', 'white'); + return ajaxSuccess($re); + } + public function mark_order_vip($goods_id = '', $num = 1) { + $deal_params = ['num' => $num]; + $goods = D('goods')->where(['id' => $goods_id, 'deleted' => 0])->find(); + if (empty($goods)) { + return ajaxFail('不存在的服务', -1); + } + $order_no = s_order_id_render('Z'); + $order = [ + 'user_id' => $this->user_id, + 'goods_id' => $goods_id, + // 'from_user_id' => $share['from_user_id'], + 'create_time' => c_now(), + 'status' => 'wait_pay', + 'order_no' => $order_no, + 'price' => $goods['price'] * $num, + 'deal_type' => $goods['deal_type'], + 'funct_name' => $goods['funct_name'], + 'deal_params' => c_json_encode($deal_params), + ]; + D('orders')->insert($order); + return ajaxSuccess(['order_no' => $order_no]); + } + public function mark_order_tongYongFenGe($goods_id='',$path='') { + $deal_params = ['path' => $path]; + return $this->mark_order_base($goods_id, $deal_params); + } + // color: red blue white; + public function mark_order_yiCunZhao($goods_id = '', $path = '', $color = '') { + $deal_params = ['path' => $path, + 'color' => $color]; + return $this->mark_order_base($goods_id, $deal_params); + } + public function mark_order_zhaopianshangse($goods_id = '', $path = '') { + $deal_params = ['path' => $path]; + return $this->mark_order_base($goods_id, $deal_params); + } + private function mark_order_base($goods_id, $deal_params) { + // 是否是vip + $is_vip = strtotime($this->user_info['vip_expire_time'] ?: c_now()) > time(); + if (!$is_vip) { + $goods_free_use_limit = D('config')->where(['k' => 'goods_free_use_limit'])->value('v'); + $find_user_use = D('user_use_cnt')->where(['goods_id' => $goods_id, 'user_id' => $this->user_id])->find(); + $use_cnt = 0; + if($find_user_use) { + $use_cnt = $find_user_use['use_cnt']; + }else{ + D('user_use_cnt')->insert(['goods_id' => $goods_id, 'user_id' => $this->user_id, 'use_cnt'=>0]); + } + if ($use_cnt >= $goods_free_use_limit) { + return ajaxFail('免费次数使用结束,请先充值', -1); + } + } + $goods = D('goods')->where(['id' => $goods_id, 'deleted' => 0])->find(); + if (empty($goods)) { + return ajaxFail('不存在的服务', -2); + } + $order_no = s_order_id_render('Z'); + $order = [ + 'user_id' => $this->user_id, + 'goods_id' => $goods_id, + // 'from_user_id' => $share['from_user_id'], + 'create_time' => c_now(), + 'status' => 'wait_pay', + 'order_no' => $order_no, + 'price' => $goods['price'], + 'deal_type' => $goods['deal_type'], + 'funct_name' => $goods['funct_name'], + 'deal_params' => c_json_encode($deal_params), + ]; + D('orders')->insert($order); + D('user_use_cnt')->where(['goods_id' => $goods_id, 'user_id' => $this->user_id])->inc('use_cnt'); + $this->pay_notify($order_no); + return ajaxSuccess(['order_no' => $order_no]); + } + public function order_list($page = 1) { + $list = D('orders')->where(['deleted' => 0, 'user_id' => $this->user_id])->where(['status' => 'payed'])->page($page, 10)->order('id DESC')->select(); + return ajaxSuccess($list); + } + + public function config_one($k) { + $v = D('config')->where(['k' => $k])->value('v'); + $v = c_safe_to_json($v, $v); + return ajaxSuccess($v); + } + + public function configs($ks = '') { + $model = D('config'); + if ($ks) { + $model->where('k', 'in', $ks); + } + $all_enums = $model->select(); + $re = []; + foreach ($all_enums as $one) { + $re[$one['k']] = c_safe_to_json($one['v'], $one['v']); + } + // + return ajaxSuccess($re); + } + public function my() { + $info = $this->user_info; + if ($info['is_share']) { + $info['price_sum'] = D('orderx')->where(['status' => 'payed'])->where(['from_user_id' => $this->user_id])->sum('price'); + $info['share_cnt'] = D('share')->where(['from_user_id' => $this->user_id])->count(); + $info['share_view_cnt'] = D('share')->where(['from_user_id' => $this->user_id])->sum('view_cnt'); + } + $show_vip_link = $info['is_share'] ? true : false; + if (!$show_vip_link) { + if (D('orderx')->where(['status' => 'payed'])->where(['user_id' => $this->user_id])->find()) { + $show_vip_link = true; + } + } + $info['show_vip_link'] = $show_vip_link; + $info['payed_vip_link'] = D('config')->where(['k' => 'payed_vip_link'])->value('v'); + return ajaxSuccess($info); + } + public function set_name($name = '') { + D('user')->where(['id' => $this->user_id])->update(['real_name' => $name]); + return ajaxSuccess(); + } + + public function bind_auth_phone($code = '') { + $row_user = D('user')->where([ + 'id' => $this->user_id, + ])->find(); + + $cache_a_k = Cache::get(Constant::$CACHE_ACCESS_TOKEN); + $qdata = [ + 'code' => $code, + ]; + $re_data = curl_post_https('https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=' . $cache_a_k['access_token'], json_encode($qdata)); + $this->log_notice([$re_data], '授权手机号返回', 'bind_auth_phone'); + // $session_key = $row_user['session_key']; + // $data = decrypt_wx_data($encrypted_data, $iv, $session_key); + // if (is_int($data) && $data < 0) { + // return ajaxFail('数据解析失败', -1); + // } + // /* + // { + // "phoneNumber": "13580006666", + // "purePhoneNumber": "13580006666", + // "countryCode": "86", + // "watermark": + // { + // "appid":"APPID", + // "timestamp": TIMESTAMP + // } + // } + // */ + // //更新数据 + // $pure_phone_number = $data['purePhoneNumber']; + // $country_code = $data['countryCode']; + $re_data_json = c_safe_to_json($re_data); + if (isset($re_data_json['errcode']) && $re_data_json['errcode'] == 0) { + $pure_phone_number = $re_data_json['phone_info']['purePhoneNumber']; + $country_code = $re_data_json['phone_info']['countryCode']; + D('user')->where([ + 'id' => $this->user_id, + ])->update([ + 'phone' => $pure_phone_number, + 'phone_country_code' => $country_code, + ]); + return ajaxSuccess($pure_phone_number); + } + return ajaxFail('获取手机号失败', -1); + } + + public function static_data_get($id) { + $row = D('static_data')->where(['id' => $id])->find(); + return ajaxSuccess($row); + } + + /** + *小程序上传文件 + */ + public function wx_upload() { + $file = request()->file('img_file'); + if ($file) { + try { + validate([ + 'img_file' => [ + 'fileSize' => (20 * 1024 * 1024), + 'fileExt' => ['png', 'jpg', 'jpeg'], + ] + ])->check(['img_file' => $file]); + $savename = \think\facade\Filesystem::disk('public')->putFile(date('Y-m-d'), $file, 'md5'); + return ajaxSuccess([ + 'path' => '/uploads/' . str_replace('\\', '/', $savename), + ]); + } catch (ValidateException $e) { + // 上传失败获取错误信息 + $this->log_notice($e->getMessage(), '上传失败获取错误信息', 'wx_upload'); + return ajaxFail($e->getMessage(), -2); + } + } + + $file = request()->file('audio_file'); + if ($file) { + try { + validate([ + 'audio_file' => [ + 'fileSize' => (20 * 1024 * 1024), + 'fileExt' => ['mp3'], + ] + ])->check(['audio_file' => $file]); + $savename = \think\facade\Filesystem::disk('public')->putFile(date('Y-m-d'), $file, 'md5'); + return ajaxSuccess([ + 'path' => '/uploads/' . str_replace('\\', '/', $savename), + ]); + } catch (ValidateException $e) { + // 上传失败获取错误信息 + return ajaxFail($e->getMessage(), -2); + } + } + + + $file = request()->file('video_file'); + if ($file) { + try { + validate([ + 'video_file' => [ + 'fileSize' => (200 * 1024 * 1024), + 'fileExt' => ['mp4'], + ] + ])->check(['video_file' => $file]); + $savename = \think\facade\Filesystem::disk('public')->putFile(date('Y-m-d'), $file, 'md5'); + return ajaxSuccess([ + 'path' => '/uploads/' . str_replace('\\', '/', $savename), + ]); + } catch (ValidateException $e) { + // 上传失败获取错误信息 + return ajaxFail($e->getMessage(), -3); + } + } + return ajaxFail('未选择上传文件,请重试', -3); + } + public function wx_login($code) { + if ($code != 'test') { + $data = code_2_session($code); + if ($data == null) { + return ajaxFail('授权失败', -1); + } + } else { + $data['openid'] = 'o3CkR7ecDQlsBfAW88Cmjin4YkmI'; + $data['unionid'] = 'oV_Fvs_X63XiA1UDc2Bvx1YbD3bk'; + $data['session_key'] = 'HBwb0sNhajpzzgM4nuMt6w=='; + } + + $openid = $data['openid']; + $unionid = $data['unionid'] ?? ''; + $session_key = $data['session_key']; + $row_user = D('user')->where('openid', $openid)->where(['deleted' => 0])->find(); + if (empty($row_user)) { + D('user')->insert([ + 'union_id' => $unionid, + 'openid' => $openid, + 'session_key' => $session_key, + 'create_time' => date('Y-m-d H:i:s', time()), + ]); + $user_id = D('user')->getLastInsID(); + } + //update + else { + $user_id = $row_user['id']; + $update = [ + 'session_key' => $session_key, + // 'union_id'=>$unionid, + ]; + if ($unionid) { + $update['union_id'] = $unionid; + } + D('user')->where('openid', $openid)->update($update); + } + // c_debug('有人登录了:' . $user_id); + return ajaxSuccess([ + // 'union_id' => $unionid, + 'user_id' => a_encode($user_id . '|' . time()), + 'openid' => $openid, + 'phone' => empty($row_user) ? '' : $row_user['phone'], + ]); + } + public function login_id($id=0) { + $row_user = D('user')->where(['id'=>$id])->find(); + setcookie('user_id', a_encode($id . '|' . time())); + return ajaxSuccess([ + // 'union_id' => $unionid, + 'user_id' => a_encode($id . '|' . time()), + 'openid' => $row_user['openid'], + 'phone' => empty($row_user) ? '' : $row_user['phone'], + ]); + } + + public function fetch_order($order_no) { + $order = D('orders')->where([ + 'order_no' => $order_no, + 'user_id' => $this->user_id, + ])->find(); + return ajaxSuccess(c_filter_property($order, ['deleted', 'pay_wx_data', 'need_auto_refund', 'deal_type', 'deal_params', 'deal_result'], true)); + } + + public function pay_order($order_no = '') { + $order = D('orders')->where([ + 'order_no' => $order_no, + // 'user_id' => $this->user_id, + ])->find(); + if (empty($order)) { + return ajaxFail('不存在的订单', -2); + } + $price = intval($order['price']); + // $debug = false; + // $debug = Config::get('app.APP_DEBUG'); + // if ($debug) { + // $price = 1; + // } + $appid = Config::get('app.APPID'); + $body = '商城订单' . $order_no; + $mch_id = Config::get('app.MCH_ID'); + $pay_url = Config::get('app.PAY_NOTIFY_URL_SHOP'); + $key = Config::get('app.PAY_KEY'); + $nonce_str = '0123456789'; + $openid = $this->user_info['openid']; + $create_ip = '127.0.0.1'; + $need_encode_str = "appid=" . $appid + . "&body=" . $body + . "&mch_id=" . $mch_id + . "&nonce_str=" . $nonce_str + . "¬ify_url=" . $pay_url + . "&openid=" . $openid + . "&out_trade_no=" . $order_no + . "&sign_type=MD5" + . "&spbill_create_ip=" . $create_ip + . "&total_fee=" . $price + . "&trade_type=JSAPI" + . "&key=" . $key; + $this->log_notice($need_encode_str, '$need_encode_str', 'pay_order'); + $sign = strtoupper(md5($need_encode_str)); + $xml = '' + . '' . $appid . '' + . '' + . '' . $mch_id . '' + . '' . $nonce_str . '' + . '' . $pay_url . '' + . '' . $openid . '' + . '' . $order_no . '' + . 'MD5' + . '' . $create_ip . '' + . '' . $price . '' + . 'JSAPI' + . '' . $sign . '' + . ''; + $res_map = \s_make_wx_order($xml); + // Log::write(json_encode($res_map), 'notice'); + $this->log_notice($res_map, '请求支付参数', 'pay_order'); + if ($res_map['return_code'] == 'SUCCESS') { + $timeStamp = time(); + $paySign = md5('appId=' . $appid + . '&nonceStr=' . $nonce_str + . '&package=prepay_id=' . $res_map['prepay_id'] + . '&signType=MD5' + . '&timeStamp=' . $timeStamp + . '&key=' . $key); + return ajaxSuccess([ + 'timeStamp' => '' . $timeStamp, + 'nonceStr' => $nonce_str, + 'package' => 'prepay_id=' . $res_map['prepay_id'], + 'signType' => 'MD5', + 'paySign' => $paySign, + ]); + } + return ajaxFail('调用支付接口失败', -3); + } + + // 微信支付回调 + public function pay_notify($_test_success_order_no = '') { + $str = file_get_contents('php://input'); + if ($_test_success_order_no) { + $str = ''; + } + // 模拟支付成功 + if (!$str && $_test_success_order_no) { + $map = ['out_trade_no' => $_test_success_order_no, + '系统默认支付成功,0元或测试单']; + } else { + $this->log_notice($str, '支付通知', 'pay_notify'); + $map = c_read_xml_to_map($str); + if (empty($map) || !isset($map['out_trade_no'])) { + $this->log_warn($map['out_trade_no'], '错误的支付消息', 'pay_notify'); + echo ''; + exit(); + } + } + + $order_no = $map['out_trade_no']; + $notify_return = 0; + $order_detail = D('orders')->where(['order_no' => $order_no])->find(); // 查询包含已删除 + if (empty($order_detail)) { + $notify_return = -1; + } + if ($order_detail['status'] != 'wait_pay') { + // 只记录,不失败 + $this->log_warn($map['out_trade_no'], '订单状态不正确', 'pay_notify'); + // $this->service_any->sendqywx_test($map['out_trade_no'] . '订单状态不正确',''); + if ($order_detail['status'] != 'payed') { + D('orders')->where(['id' => $order_detail['id']])->update(['need_auto_refund' => 1]); + } + } + //超时支付和正常支付都算能支付 + D('orders')->where(['id' => $order_detail['id'], 'deleted' => 0])->update(['status' => 'payed', 'pay_time' => c_now(), 'pay_wx_data' => $str]); + if ($notify_return == -1) { + if ($_test_success_order_no) { + return ajaxFail([$order_no], '订单ID不存在', 'pay_notify'); + } + echo ''; + } else if ($notify_return == 0) { + if ($_test_success_order_no) { + return ajaxSuccess(); + } + echo ''; + } + if ($_test_success_order_no) { + return ajaxFail([$order_no], '支付通知', 'pay_notify'); + } + } + // + public function ______unuse_function_start______() {} + public function notice_list() { + $list = D('notice')->where(['delete' => 0]) + ->where('start_time', '<=', date('Y-m-d H:i:s', time())) + ->where('end_time', '>=', date('Y-m-d H:i:s', time()))->select(); + return ajaxSuccess(c_filter_property_list($list, ['id', 'title', 'content', 'create_time'])); + } + public function notice_deital($id) { + $detail = D('notice')->where(['id' => $id, 'delete' => 0])->find(); + return ajaxSuccess(\c_filter_property($detail, ['delete', 'start_time', 'end_time'], true)); + } + public function mark_order_info($order_no, $name = '', $phone = '', $position = '') { + D('orderx')->where(['order_no' => $order_no])->update([ + 'name' => $name, + 'phone' => $phone, + 'position' => $position, + ]); + return ajaxSuccess(); + } + + public function make_order($share_id) { + $share = D('share')->where(['id' => $share_id, 'deleted' => 0])->find(); + if (empty($share)) { + return ajaxFail('链接已失效,请联系客服'); + } + if ($share['expire_time']) { + if ($share['expire_time'] <= c_now()) { + return ajaxFail('购买链接已过期,请重新联系客服'); + } + } + $order_no = s_order_id_render('P'); + $order = [ + 'user_id' => $this->user_id, + 'share_id' => $share_id, + 'from_user_id' => $share['from_user_id'], + 'create_time' => c_now(), + 'status' => 'wait_pay', + 'order_no' => $order_no, + 'price' => $share['price'], + 'buy_type' => $share['buy_type'], + ]; + D('orderx')->insert($order); + return ajaxSuccess(['order_no' => $order_no]); + } + public function get_share($id) { + $data = D('share')->where(['id' => $id, 'deleted' => 0])->find(); + // if(strtotime($data['expire_time']) >= time()) { + // return ajaxFail('支付链接已超时,请联系客服'); + // } + // $v = D('config')->where(['k' => 'buy_types'])->value('v'); + // $data['buy_types'] = c_safe_to_json($v, $v); + // $v = D('config')->where(['k' => 'tip_before_pay'])->value('v'); + // $data['tip_before_pay'] = c_safe_to_json($v, $v); + // $v = D('config')->where(['k' => 'tip_after_pay'])->value('v'); + // $data['tip_after_pay'] = c_safe_to_json($v, $v); + + return ajaxSuccess($data); + } + public function view_share($id) { + D('share')->where(['id' => $id, 'deleted' => 0])->inc('view_cnt')->update(); + return ajaxSuccess(); + } + public function del_share($id) { + D('share')->where(['id' => $id])->update(['deleted' => 1]); + return ajaxSuccess(); + } + public function share_link_list($page = 1, $pageSize = 10) { + $list = D('share')->where(['from_user_id' => $this->user_id, 'deleted' => 0])->where('expire_time', '>=', c_now())->page($page, $pageSize)->select(); + return ajaxSuccess($list); + } + public function create_share($price, $expireDate, $buy_type = '') { + if (!$this->user_info['is_share']) { + return ajaxFail('您暂无分销权限', -1); + } + $data = [ + 'from_user_id' => $this->user_id, + 'price' => $price * 100, + 'expire_time' => $expireDate . ' 23:59:59', + 'create_time' => c_now(), + 'title' => '推荐您购买' . $buy_type, + 'img' => 'http://cdn.zhonganonline.top/liiistem/static/liii_icon.png', + 'buy_type' => $buy_type, + ]; + D('share')->insert($data); + $id = D('share')->getLastInsID(); + $data['id'] = $id; + // $data['path'] = + return ajaxSuccess($data); + } + public function mark($id, $remark = '') { + $one = D('orderx')->where(['id' => $id, 'from_user_id' => $this->user_id])->find(); + if (empty($one)) { + return ajaxFail('不存在的内容', -1); + } + D('orderx')->where(['id' => $id])->update(['remark' => $remark]); + return ajaxSuccess(); + } + public function share_list($page = 1, $status = '') { + $model = D('orderx')->where(['from_user_id' => $this->user_id]); + if ($status) { + $model->where(['status' => $status]); + } else { + $model->where('status', 'IN', ['payed', 'wait_pay']); + } + $list = $model->page($page, 10)->order('id DESC')->select(); + return ajaxSuccess($list); + } + + public function banner_list() { + $where = ['deleted' => 0]; + $list = D('banner')->where($where)->order('id DESC')->select(); + return ajaxSuccess($list); + } + + public function news_list($page = 1, $pageSize = 10) { + $where = ['deleted' => 0, + 'status' => 1]; + $model = D('news')->order('id DESC')->where($where); + $list = $model->page($page, $pageSize)->select(); + return ajaxSuccess($list); + } + + public function news_detail($id = '') { + $detail = D('news')->where(['id' => $id, 'deleted' => 0])->find(); + if (!$detail) { + return ajaxFail('数据不存在', -1); + } + $detail['view_cnt'] = $detail['view_cnt'] + 1; + D('news')->where(['id' => $id, 'deleted' => 0])->update(['view_cnt' => $detail['view_cnt']]); + return ajaxSuccess([ + 'detail' => $detail, + ]); + } + +} \ No newline at end of file diff --git a/app/event.php b/app/event.php new file mode 100644 index 0000000..bfe3c2d --- /dev/null +++ b/app/event.php @@ -0,0 +1,15 @@ + [], + + 'listen' => [ + 'AppInit' => [], + 'HttpRun' => [], + 'HttpEnd' => [], + 'LogLevel' => [], + 'LogWrite' => [], + ], + + 'subscribe' => [], +]; diff --git a/app/exceptions/NoAccessException.php b/app/exceptions/NoAccessException.php new file mode 100644 index 0000000..233f77f --- /dev/null +++ b/app/exceptions/NoAccessException.php @@ -0,0 +1,12 @@ + Request::class, + 'think\exception\Handle' => ExceptionHandle::class, +]; diff --git a/app/service.php b/app/service.php new file mode 100644 index 0000000..db1ee6a --- /dev/null +++ b/app/service.php @@ -0,0 +1,9 @@ +className = $className; + } + protected function log_notice($any, $msg = '', $tag = 'log_notice') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . $str . ']', 'NOTICE'); + } + protected function log_warn($any, $msg = '', $tag = 'log_warn') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . json_encode($any, JSON_UNESCAPED_UNICODE) . ']', 'WARN'); + } + protected function log_error($any, $msg = '', $tag = 'log_error') + { + if ($any instanceof ErrorException || $any instanceof Exception) { + $str = c_formate_exception($any); + } else { + $str = json_encode($any, JSON_UNESCAPED_UNICODE); + } + Log::write('[' . $this->className . ']' . '[' . $tag . ']' . '[' . $msg . ']' . '[' . json_encode($any, JSON_UNESCAPED_UNICODE) . ']', 'ERROR'); + } + protected function alarm($type = '', $content = '') + { + D('alarm')->insert([ + 'type' => $type, + 'content' => $content, + 'create_time' => c_now(), + ]); + } +} diff --git a/app/service/ToolService.php b/app/service/ToolService.php new file mode 100644 index 0000000..99d5b89 --- /dev/null +++ b/app/service/ToolService.php @@ -0,0 +1,177 @@ +config = new DaraConfig([ + "accessKeyId" => $this->access_key_id, + "accessKeySecret" => $this->access_secret, + ]); + } + + public function tongYongFenGe($imgUrl) { + $this->config->endpoint = "imageseg.cn-shanghai.aliyuncs.com"; + $client = new Imageseg($this->config); + $file = fopen($imgUrl, 'rb'); + $stream = new Stream($file); + $segmentCommonImageAdvanceRequest = new SegmentCommonImageAdvanceRequest([ + "imageURLObject" => $stream, + "returnForm" => "whiteBK" + ]); + $runtime = new RuntimeOptions([]); + try { + $resp = $client->segmentCommonImageAdvance($segmentCommonImageAdvanceRequest, $runtime); + # 获取整体结果 + $json_str = Utils::toJSONString($resp->body); + $json = c_safe_to_json($json_str); + // return ['code'=>0,$json]; + $this->log_notice($json, '照片上色结果', 'tuPianShangSe'); + return $json['Data']['ImageURL'] ?? ''; + } catch (Exception $exception) { + # 获取整体报错信息 + $this->log_error(Utils::toJSONString($exception), '照片上色失败', 'tuPianShangSe'); + } + return ''; + } + + public function tuPianShangSe($imgUrl) { + $this->config->endpoint = "imageenhan.cn-shanghai.aliyuncs.com"; + $client = new Imageenhan($this->config); + $file = fopen($imgUrl, 'rb'); + //$stream = new Stream($file); + // 场景二,使用任意可访问的url + // $file = fopen('http://viapi-test.oss-cn-shanghai.aliyuncs.com/viapi-3.0domepic/imageenhan/ColorizeImage/ColorizeImage1.jpg', 'rb'); + $stream = new Stream($file); + $colorizeImageAdvanceRequest = new ColorizeImageAdvanceRequest([ + "imageURLObject" => $stream + ]); + $runtime = new RuntimeOptions([]); + try { + $resp = $client->colorizeImageAdvance($colorizeImageAdvanceRequest, $runtime); + # 获取整体结果 + $json_str = Utils::toJSONString($resp->body); + $json = c_safe_to_json($json_str); + // return ['code'=>0,$json]; + $this->log_notice($json, '照片上色结果', 'tuPianShangSe'); + return $json['Data']['ImageURL'] ?? ''; + } catch (Exception $exception) { + # 获取整体报错信息 + $this->log_error(Utils::toJSONString($exception), '照片上色失败', 'tuPianShangSe'); + } + return ''; + } + + // private function base($options_query): bool + // { + // $is_prod = false; + // if (env('app.envName', 'prod') == 'prod') { + // $is_prod = true; + // } + // if (!$is_prod) { + // $this->log_notice($options_query, '', 'base'); + // if (!isset($options_query['Test'])) { + // return true; + // } + // } + // $options_query['RegionId'] = 'cn-hangzhou'; + // $options_query['SignName'] = $this->sign_name; + // try { + // $result = AlibabaCloud::rpc() + // ->product('Dysmsapi') + // // ->scheme('https') // https | http + // ->version('2017-05-25') + // ->action('SendSms') + // ->method('POST') + // ->host('dysmsapi.aliyuncs.com') + // ->options([ + // 'query' => $options_query + // ]) + // ->request(); + // $this->log_notice(['发送结果:' => $result->toArray(), "发送内容" => $options_query], '短信发送成功', 'base'); + // return true; + // } catch (ClientException $e) { + // $this->log_error(['发送结果:' => $e->getErrorMessage(), "发送内容" => $options_query], '短信发送失败', 'base'); + // } catch (ServerException $e) { + // $this->log_error(['发送结果:' => $e->getErrorMessage(), "发送内容" => $options_query], '短信发送失败', 'base'); + // } + // return false; + // } + + // public function sendTest() { + // return $this->base([ + // 'Test' => 'test', + // 'TemplateCode' => "SMS_173476256", + // 'PhoneNumbers' => '13873044202', + // 'TemplateParam' => c_json_encode([ + // 'OrderNo' => '11111111111111', + // 'CustomerName' => '测试', + // 'ProductName' => c_max_len_3dot('裸心堡红宝石水疗送双人下午茶/每天限量抢购'), + // 'ProductCount' => 2, + // ]), + // ]); + // } + + // public function sendSMS($body_arr): bool + // { + // return $this->base($body_arr); + // } + + // public function sendBindPhoneVcode($user_id, $phone): string + // { + // $vcode = random_vcode(6); + // $this->base([ + // 'TemplateCode' => "SMS_307600272", + // 'PhoneNumbers' => $phone, + // 'TemplateParam' => c_json_encode(['code' => $vcode]), + // ]); + // return $vcode; + // } + + public function sendqywx($text, $phone) { + $this->log_notice([$text, $phone], 'sendqywx', 'sendqywx'); + return curl_post_https(Config::get('app.order_qywx_webhook'), + json_encode([ + 'msgtype' => 'text', + 'text' => [ + 'content' => $text, + 'mentioned_mobile_list' => [$phone], + ], + ]), + ['header' => ['Content-Type:application/json']]); + } + public function sendqywx_test($text, $phone) { + $this->log_notice([$text, $phone], 'sendqywx_test', 'sendqywx_test'); + return curl_post_https(Config::get('app.self_qxwx_alarm_webhook'), + json_encode([ + 'msgtype' => 'text', + 'text' => [ + 'content' => $text, + 'mentioned_mobile_list' => [$phone], + ], + ]), + ['header' => ['Content-Type:application/json']]); + } + + +} \ No newline at end of file diff --git a/backup_db.sh b/backup_db.sh new file mode 100644 index 0000000..207ca71 --- /dev/null +++ b/backup_db.sh @@ -0,0 +1,5 @@ +#/bin/bash +cur_date="`date +%Y%m%d%H%M%S`" +`mysqldump -u root -pCk@@@@453455 yymg --ignore-table=yymg.sys_msg_queue --ignore-table=yymg.user_coupon_delete --ignore-table=yymg.order_history > /mnt/db_yymg/$cur_date.sql` +`tar czfP /mnt/db_yymg/$cur_date.tar.gz /mnt/db_yymg/$cur_date.sql` +`rm -f /mnt/db_yymg/$cur_date.sql` \ No newline at end of file diff --git a/backup_db_testwx.sh b/backup_db_testwx.sh new file mode 100644 index 0000000..9c9db34 --- /dev/null +++ b/backup_db_testwx.sh @@ -0,0 +1,8 @@ +#/bin/bash +cur_date="`date +%Y%m%d%H%M%S`" +`mysqldump -u root -p453455 yymg > /var/www/db_yymg/$cur_date.sql` +`tar czfP /var/www/db_yymg/$cur_date.tar.gz /var/www/db_yymg/$cur_date.sql` +`rm -f /var/www/db_yymg/$cur_date.sql` +bef_date="`date -d \"3 day ago\" +%Y%m%d%H%M%S`" +`rm -f /var/www/db_yymg/$bef_date.tar.gz` +curl -O http://testwx.yunyoumg.com/index.php/api/sys/sys_msg_queue_delete_unuse \ No newline at end of file diff --git a/chown.sh b/chown.sh new file mode 100644 index 0000000..fd48f81 --- /dev/null +++ b/chown.sh @@ -0,0 +1 @@ +chown -R www:www ./ diff --git a/common/updateManager.js b/common/updateManager.js deleted file mode 100644 index c45de6d..0000000 --- a/common/updateManager.js +++ /dev/null @@ -1,29 +0,0 @@ -export default () => { - if (!wx.canIUse('getUpdateManager')) { - return; - } - - const updateManager = wx.getUpdateManager(); - - updateManager.onCheckForUpdate(function (res) { - // 请求完新版本信息的回调 - console.log('版本信息', res); - }); - - updateManager.onUpdateReady(function () { - wx.showModal({ - title: '更新提示', - content: '新版本已经准备好,是否重启应用?', - success(res) { - if (res.confirm) { - // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 - updateManager.applyUpdate(); - } - }, - }); - }); - - updateManager.onUpdateFailed(function () { - // 新版本下载失败 - }); -}; diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..ae428bb --- /dev/null +++ b/composer.json @@ -0,0 +1,56 @@ +{ + "name": "topthink/think", + "description": "the new thinkphp framework", + "type": "project", + "keywords": [ + "framework", + "thinkphp", + "ORM" + ], + "homepage": "http://thinkphp.cn/", + "license": "Apache-2.0", + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + }, + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "require": { + "php": ">=7.1.0", + "topthink/framework": "^6.0.0", + "topthink/think-orm": "^2.0", + "topthink/think-multi-app": "^1.0", + "alibabacloud/client": "^1.5", + "topthink/think-view": "^1.0", + "alibabacloud/imageenhan-20190930": "^1.0" + }, + "require-dev": { + "symfony/var-dumper": "^4.2", + "topthink/think-trace":"^1.0", + "nikic/php-parser": "^4.3" + }, + "autoload": { + "psr-4": { + "app\\": "app" + }, + "psr-0": { + "": "extend/" + } + }, + "config": { + "preferred-install": "dist" + }, + "scripts": { + "post-autoload-dump": [ + "@php think service:discover", + "@php think vendor:publish" + ], + "parser":[ + "@php ast.php" + ] + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..f5b5b30 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2373 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "e272d8332ef4e55099f07aeb93c8927c", + "packages": [ + { + "name": "adbario/php-dot-notation", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/adbario/php-dot-notation.git", + "reference": "eee4fc81296531e6aafba4c2bbccfc5adab1676e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/adbario/php-dot-notation/zipball/eee4fc81296531e6aafba4c2bbccfc5adab1676e", + "reference": "eee4fc81296531e6aafba4c2bbccfc5adab1676e", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-json": "*", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.0|^5.0|^6.0", + "squizlabs/php_codesniffer": "^3.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Adbar\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Riku Särkinen", + "email": "riku@adbar.io" + } + ], + "description": "PHP dot notation access to arrays", + "homepage": "https://github.com/adbario/php-dot-notation", + "keywords": [ + "ArrayAccess", + "dotnotation" + ], + "time": "2019-01-01T23:59:15+00:00" + }, + { + "name": "alibabacloud/client", + "version": "1.5.20", + "source": { + "type": "git", + "url": "https://github.com/aliyun/openapi-sdk-php-client.git", + "reference": "e18c5d79072417250f6faf0c1c8ca8bd3fd73f2b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aliyun/openapi-sdk-php-client/zipball/e18c5d79072417250f6faf0c1c8ca8bd3fd73f2b", + "reference": "e18c5d79072417250f6faf0c1c8ca8bd3fd73f2b", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "adbario/php-dot-notation": "^2.2", + "clagiordano/weblibs-configmanager": "^1.0", + "danielstjules/stringy": "^3.1", + "ext-curl": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "ext-simplexml": "*", + "ext-xmlwriter": "*", + "guzzlehttp/guzzle": "^6.3", + "mtdowling/jmespath.php": "^2.4", + "php": ">=5.5" + }, + "require-dev": { + "composer/composer": "^1.8", + "drupal/coder": "^8.3", + "ext-dom": "*", + "ext-pcre": "*", + "ext-sockets": "*", + "ext-spl": "*", + "league/climate": "^3.2.4", + "mikey179/vfsstream": "^1.6", + "monolog/monolog": "^1.24", + "phpunit/phpunit": "^4.8.35|^5.4.3", + "psr/cache": "^1.0", + "symfony/dotenv": "^3.4", + "symfony/var-dumper": "^3.4" + }, + "suggest": { + "ext-sockets": "To use client-side monitoring" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\Client\\": "src" + }, + "files": [ + "src/Functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com", + "homepage": "http://www.alibabacloud.com" + } + ], + "description": "Alibaba Cloud Client for PHP - Use Alibaba Cloud in your PHP project", + "homepage": "https://www.alibabacloud.com/", + "keywords": [ + "alibaba", + "alibabacloud", + "aliyun", + "client", + "cloud", + "library", + "sdk", + "tool" + ], + "time": "2019-12-30T01:59:20+00:00" + }, + { + "name": "alibabacloud/credentials", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/aliyun/credentials-php.git", + "reference": "f6d1986e7b7be8da781d0b99f24c92d9860ba0c1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aliyun/credentials-php/zipball/f6d1986e7b7be8da781d0b99f24c92d9860ba0c1", + "reference": "f6d1986e7b7be8da781d0b99f24c92d9860ba0c1", + "shasum": "" + }, + "require": { + "adbario/php-dot-notation": "^2.2", + "alibabacloud/tea": "^3.0", + "ext-curl": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "ext-simplexml": "*", + "ext-xmlwriter": "*", + "guzzlehttp/guzzle": "^6.3|^7.0", + "php": ">=5.6" + }, + "require-dev": { + "composer/composer": "^1.8", + "drupal/coder": "^8.3", + "ext-dom": "*", + "ext-pcre": "*", + "ext-sockets": "*", + "ext-spl": "*", + "mikey179/vfsstream": "^1.6", + "monolog/monolog": "^1.24", + "phpunit/phpunit": "^5.7|^6.6|^9.3", + "psr/cache": "^1.0", + "symfony/dotenv": "^3.4", + "symfony/var-dumper": "^3.4" + }, + "suggest": { + "ext-sockets": "To use client-side monitoring" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\Credentials\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com", + "homepage": "http://www.alibabacloud.com" + } + ], + "description": "Alibaba Cloud Credentials for PHP", + "homepage": "https://www.alibabacloud.com/", + "keywords": [ + "alibaba", + "alibabacloud", + "aliyun", + "client", + "cloud", + "credentials", + "library", + "sdk", + "tool" + ], + "support": { + "issues": "https://github.com/aliyun/credentials-php/issues", + "source": "https://github.com/aliyun/credentials-php" + }, + "time": "2025-04-18T09:09:46+00:00" + }, + { + "name": "alibabacloud/darabonba-openapi", + "version": "0.2.16", + "source": { + "type": "git", + "url": "https://github.com/alibabacloud-sdk-php/darabonba-openapi.git", + "reference": "abd3921d3d6526b22e1298e3ab66a392a0996baa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alibabacloud-sdk-php/darabonba-openapi/zipball/abd3921d3d6526b22e1298e3ab66a392a0996baa", + "reference": "abd3921d3d6526b22e1298e3ab66a392a0996baa", + "shasum": "" + }, + "require": { + "alibabacloud/credentials": "^1.2.2", + "alibabacloud/gateway-spi": "^1", + "alibabacloud/openapi-util": "^0.1.10|^0.2.1", + "alibabacloud/tea-utils": "^0.2.21", + "alibabacloud/tea-xml": "^0.2", + "php": ">5.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Darabonba\\OpenApi\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com" + } + ], + "description": "Alibaba Cloud OpenApi Client", + "support": { + "issues": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/issues", + "source": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/tree/0.2.16" + }, + "time": "2025-04-23T01:47:53+00:00" + }, + { + "name": "alibabacloud/endpoint-util", + "version": "0.1.1", + "source": { + "type": "git", + "url": "https://github.com/alibabacloud-sdk-php/endpoint-util.git", + "reference": "f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alibabacloud-sdk-php/endpoint-util/zipball/f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5", + "reference": "f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5", + "shasum": "" + }, + "require": { + "php": ">5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|^5.4.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\Endpoint\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com" + } + ], + "description": "Alibaba Cloud Endpoint Library for PHP", + "support": { + "source": "https://github.com/alibabacloud-sdk-php/endpoint-util/tree/0.1.1" + }, + "time": "2020-06-04T10:57:15+00:00" + }, + { + "name": "alibabacloud/gateway-spi", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/alibabacloud-sdk-php/alibabacloud-gateway-spi.git", + "reference": "7440f77750c329d8ab252db1d1d967314ccd1fcb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alibabacloud-sdk-php/alibabacloud-gateway-spi/zipball/7440f77750c329d8ab252db1d1d967314ccd1fcb", + "reference": "7440f77750c329d8ab252db1d1d967314ccd1fcb", + "shasum": "" + }, + "require": { + "alibabacloud/credentials": "^1.1", + "php": ">5.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Darabonba\\GatewaySpi\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com" + } + ], + "description": "Alibaba Cloud Gateway SPI Client", + "support": { + "source": "https://github.com/alibabacloud-sdk-php/alibabacloud-gateway-spi/tree/1.0.0" + }, + "time": "2022-07-14T05:31:35+00:00" + }, + { + "name": "alibabacloud/imageenhan-20190930", + "version": "1.0.11", + "source": { + "type": "git", + "url": "https://github.com/alibabacloud-sdk-php/Imageenhan-20190930.git", + "reference": "7bf387f9ad939377256e84e5c68079683ba1558c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alibabacloud-sdk-php/Imageenhan-20190930/zipball/7bf387f9ad939377256e84e5c68079683ba1558c", + "reference": "7bf387f9ad939377256e84e5c68079683ba1558c", + "shasum": "" + }, + "require": { + "alibabacloud/darabonba-openapi": "^0.2.8", + "alibabacloud/endpoint-util": "^0.1.0", + "alibabacloud/openapi-util": "^0.1.10|^0.2.1", + "alibabacloud/openplatform-20191219": "^2.0.1", + "alibabacloud/tea-fileform": "^0.3.0", + "alibabacloud/tea-oss-sdk": "^0.3.0", + "alibabacloud/tea-oss-utils": "^0.3.1", + "alibabacloud/tea-utils": "^0.2.17", + "php": ">5.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\SDK\\Imageenhan\\V20190930\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com" + } + ], + "description": "Alibaba Cloud imageenhan (20190930) SDK Library for PHP", + "support": { + "source": "https://github.com/alibabacloud-sdk-php/Imageenhan-20190930/tree/1.0.11" + }, + "time": "2023-02-24T02:33:18+00:00" + }, + { + "name": "alibabacloud/openapi-util", + "version": "0.2.1", + "source": { + "type": "git", + "url": "https://github.com/alibabacloud-sdk-php/openapi-util.git", + "reference": "f31f7bcd835e08ca24b6b8ba33637eb4eceb093a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alibabacloud-sdk-php/openapi-util/zipball/f31f7bcd835e08ca24b6b8ba33637eb4eceb093a", + "reference": "f31f7bcd835e08ca24b6b8ba33637eb4eceb093a", + "shasum": "" + }, + "require": { + "alibabacloud/tea": "^3.1", + "alibabacloud/tea-utils": "^0.2", + "lizhichao/one-sm": "^1.5", + "php": ">5.5" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\OpenApiUtil\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com" + } + ], + "description": "Alibaba Cloud OpenApi Util", + "support": { + "issues": "https://github.com/alibabacloud-sdk-php/openapi-util/issues", + "source": "https://github.com/alibabacloud-sdk-php/openapi-util/tree/0.2.1" + }, + "time": "2023-01-10T09:10:10+00:00" + }, + { + "name": "alibabacloud/openplatform-20191219", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/alibabacloud-sdk-php/OpenPlatform-20191219.git", + "reference": "02ffa72369f8649214f1cfa336b52a544735f517" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alibabacloud-sdk-php/OpenPlatform-20191219/zipball/02ffa72369f8649214f1cfa336b52a544735f517", + "reference": "02ffa72369f8649214f1cfa336b52a544735f517", + "shasum": "" + }, + "require": { + "alibabacloud/darabonba-openapi": "^0.2.8", + "alibabacloud/endpoint-util": "^0.1.0", + "alibabacloud/openapi-util": "^0.1.10|^0.2.1", + "alibabacloud/tea-utils": "^0.2.17", + "php": ">5.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\SDK\\OpenPlatform\\V20191219\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com" + } + ], + "description": "Alibaba Cloud OpenPlatform (20191219) SDK Library for PHP", + "support": { + "source": "https://github.com/alibabacloud-sdk-php/OpenPlatform-20191219/tree/2.0.1" + }, + "time": "2023-02-07T06:39:39+00:00" + }, + { + "name": "alibabacloud/tea", + "version": "3.1.23", + "source": { + "type": "git", + "url": "https://github.com/aliyun/tea-php.git", + "reference": "61fce993274edf6e7131af07256ed7723d97a85f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aliyun/tea-php/zipball/61fce993274edf6e7131af07256ed7723d97a85f", + "reference": "61fce993274edf6e7131af07256ed7723d97a85f", + "shasum": "" + }, + "require": { + "adbario/php-dot-notation": "^2.2", + "ext-curl": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "ext-simplexml": "*", + "ext-xmlwriter": "*", + "guzzlehttp/guzzle": "^6.3|^7.0", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "*", + "symfony/dotenv": "^3.4", + "symfony/var-dumper": "^3.4" + }, + "suggest": { + "ext-sockets": "To use client-side monitoring" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\Tea\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com", + "homepage": "http://www.alibabacloud.com" + } + ], + "description": "Client of Tea for PHP", + "homepage": "https://www.alibabacloud.com/", + "keywords": [ + "alibabacloud", + "client", + "cloud", + "tea" + ], + "support": { + "issues": "https://github.com/aliyun/tea-php/issues", + "source": "https://github.com/aliyun/tea-php" + }, + "time": "2021-12-20T02:32:43+00:00" + }, + { + "name": "alibabacloud/tea-fileform", + "version": "0.3.4", + "source": { + "type": "git", + "url": "https://github.com/alibabacloud-sdk-php/tea-fileform.git", + "reference": "4bf0c75a045c8115aa8cb1a394bd08d8bb833181" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-fileform/zipball/4bf0c75a045c8115aa8cb1a394bd08d8bb833181", + "reference": "4bf0c75a045c8115aa8cb1a394bd08d8bb833181", + "shasum": "" + }, + "require": { + "alibabacloud/tea": "^3.0", + "php": ">5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|^5.4.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\Tea\\FileForm\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com" + } + ], + "description": "Alibaba Cloud Tea File Library for PHP", + "support": { + "issues": "https://github.com/alibabacloud-sdk-php/tea-fileform/issues", + "source": "https://github.com/alibabacloud-sdk-php/tea-fileform/tree/0.3.4" + }, + "time": "2020-12-01T07:24:35+00:00" + }, + { + "name": "alibabacloud/tea-oss-sdk", + "version": "0.3.7", + "source": { + "type": "git", + "url": "https://github.com/alibabacloud-sdk-php/tea-oss-sdk.git", + "reference": "ebc719343c4fd8e1e2752b6294cc4d45bacea273" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-oss-sdk/zipball/ebc719343c4fd8e1e2752b6294cc4d45bacea273", + "reference": "ebc719343c4fd8e1e2752b6294cc4d45bacea273", + "shasum": "" + }, + "require": { + "alibabacloud/credentials": "^1.2.3", + "alibabacloud/tea-fileform": "^0.3.0", + "alibabacloud/tea-oss-utils": "^0.3.0", + "alibabacloud/tea-utils": "^0.2.21", + "alibabacloud/tea-xml": "^0.2", + "php": ">5.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\SDK\\OSS\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com" + } + ], + "description": "Aliyun Tea OSS SDK Library for PHP", + "support": { + "source": "https://github.com/alibabacloud-sdk-php/tea-oss-sdk/tree/0.3.7" + }, + "time": "2025-04-22T12:32:05+00:00" + }, + { + "name": "alibabacloud/tea-oss-utils", + "version": "0.3.1", + "source": { + "type": "git", + "url": "https://github.com/alibabacloud-sdk-php/tea-oss-utils.git", + "reference": "19f58fc509347f075664e377742d4f9e18465372" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-oss-utils/zipball/19f58fc509347f075664e377742d4f9e18465372", + "reference": "19f58fc509347f075664e377742d4f9e18465372", + "shasum": "" + }, + "require": { + "alibabacloud/tea": "^3.0", + "guzzlehttp/psr7": "^1.0", + "php": ">5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|^5.4.3|^9.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\Tea\\OSSUtils\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com" + } + ], + "description": "Alibaba Cloud Tea OSS Utils Library for PHP", + "support": { + "source": "https://github.com/alibabacloud-sdk-php/tea-oss-utils/tree/0.3.1" + }, + "time": "2023-01-08T13:26:58+00:00" + }, + { + "name": "alibabacloud/tea-utils", + "version": "0.2.21", + "source": { + "type": "git", + "url": "https://github.com/alibabacloud-sdk-php/tea-utils.git", + "reference": "5039e45714c6456186d267f5d81a4b260a652495" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-utils/zipball/5039e45714c6456186d267f5d81a4b260a652495", + "reference": "5039e45714c6456186d267f5d81a4b260a652495", + "shasum": "" + }, + "require": { + "alibabacloud/tea": "^3.1", + "php": ">5.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\Tea\\Utils\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com" + } + ], + "description": "Alibaba Cloud Tea Utils for PHP", + "support": { + "issues": "https://github.com/aliyun/tea-util/issues", + "source": "https://github.com/aliyun/tea-util" + }, + "time": "2024-07-05T06:05:54+00:00" + }, + { + "name": "alibabacloud/tea-xml", + "version": "0.2.4", + "source": { + "type": "git", + "url": "https://github.com/alibabacloud-sdk-php/tea-xml.git", + "reference": "3e0c000bf536224eebbac913c371bef174c0a16a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-xml/zipball/3e0c000bf536224eebbac913c371bef174c0a16a", + "reference": "3e0c000bf536224eebbac913c371bef174c0a16a", + "shasum": "" + }, + "require": { + "php": ">5.5" + }, + "require-dev": { + "phpunit/phpunit": "*", + "symfony/var-dumper": "*" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\Tea\\XML\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com" + } + ], + "description": "Alibaba Cloud Tea XML Library for PHP", + "support": { + "source": "https://github.com/alibabacloud-sdk-php/tea-xml/tree/0.2.4" + }, + "time": "2022-08-02T04:12:58+00:00" + }, + { + "name": "clagiordano/weblibs-configmanager", + "version": "v1.0.7", + "source": { + "type": "git", + "url": "https://github.com/clagiordano/weblibs-configmanager.git", + "reference": "6ef4c27354368deb2f54b39bbe06601da8c873a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clagiordano/weblibs-configmanager/zipball/6ef4c27354368deb2f54b39bbe06601da8c873a0", + "reference": "6ef4c27354368deb2f54b39bbe06601da8c873a0", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.4" + }, + "require-dev": { + "clagiordano/phpunit-result-printer": "^1", + "phpunit/phpunit": "^4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "clagiordano\\weblibs\\configmanager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Claudio Giordano", + "email": "claudio.giordano@autistici.org", + "role": "Developer" + } + ], + "description": "weblibs-configmanager is a tool library for easily read and access to php config array file and direct read/write configuration file / object", + "keywords": [ + "clagiordano", + "configuration", + "manager", + "tool", + "weblibs" + ], + "time": "2019-09-25T22:10:10+00:00" + }, + { + "name": "danielstjules/stringy", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/danielstjules/Stringy.git", + "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", + "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.4.0", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Stringy\\": "src/" + }, + "files": [ + "src/Create.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel St. Jules", + "email": "danielst.jules@gmail.com", + "homepage": "http://www.danielstjules.com" + } + ], + "description": "A string manipulation library with multibyte support", + "homepage": "https://github.com/danielstjules/Stringy", + "keywords": [ + "UTF", + "helpers", + "manipulation", + "methods", + "multibyte", + "string", + "utf-8", + "utility", + "utils" + ], + "time": "2017-06-12T01:10:27+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.5.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.6.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.1" + }, + "suggest": { + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.5-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2019-12-23T11:57:10+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2019-07-01T23:21:34+00:00" + }, + { + "name": "league/flysystem", + "version": "1.0.63", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "8132daec326565036bc8e8d1876f77ec183a7bd6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/8132daec326565036bc8e8d1876f77ec183a7bd6", + "reference": "8132daec326565036bc8e8d1876f77ec183a7bd6", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-fileinfo": "*", + "php": ">=5.5.9" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "require-dev": { + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.10" + }, + "suggest": { + "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ], + "time": "2020-01-04T16:30:31+00:00" + }, + { + "name": "league/flysystem-cached-adapter", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-cached-adapter.git", + "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f", + "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "league/flysystem": "~1.0", + "psr/cache": "^1.0.0" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7", + "predis/predis": "~1.0", + "tedivm/stash": "~0.12" + }, + "suggest": { + "ext-phpredis": "Pure C implemented extension for PHP" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Flysystem\\Cached\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "frankdejonge", + "email": "info@frenky.net" + } + ], + "description": "An adapter decorator to enable meta-data caching.", + "time": "2018-07-09T20:51:04+00:00" + }, + { + "name": "lizhichao/one-sm", + "version": "1.10", + "source": { + "type": "git", + "url": "https://github.com/lizhichao/sm.git", + "reference": "687a012a44a5bfd4d9143a0234e1060543be455a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lizhichao/sm/zipball/687a012a44a5bfd4d9143a0234e1060543be455a", + "reference": "687a012a44a5bfd4d9143a0234e1060543be455a", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "OneSm\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "tanszhe", + "email": "1018595261@qq.com" + } + ], + "description": "国密sm3", + "keywords": [ + "php", + "sm3" + ], + "support": { + "issues": "https://github.com/lizhichao/sm/issues", + "source": "https://github.com/lizhichao/sm/tree/1.10" + }, + "funding": [ + { + "url": "https://www.vicsdf.com/img/w.jpg", + "type": "custom" + }, + { + "url": "https://www.vicsdf.com/img/z.jpg", + "type": "custom" + } + ], + "time": "2021-05-26T06:19:22+00:00" + }, + { + "name": "mtdowling/jmespath.php", + "version": "2.5.0", + "source": { + "type": "git", + "url": "https://github.com/jmespath/jmespath.php.git", + "reference": "52168cb9472de06979613d365c7f1ab8798be895" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/52168cb9472de06979613d365c7f1ab8798be895", + "reference": "52168cb9472de06979613d365c7f1ab8798be895", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.4.0", + "symfony/polyfill-mbstring": "^1.4" + }, + "require-dev": { + "composer/xdebug-handler": "^1.2", + "phpunit/phpunit": "^4.8.36|^7.5.15" + }, + "bin": [ + "bin/jp.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "JmesPath\\": "src/" + }, + "files": [ + "src/JmesPath.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Declaratively specify how to extract elements from a JSON document", + "keywords": [ + "json", + "jsonpath" + ], + "time": "2019-12-30T18:03:34+00:00" + }, + { + "name": "opis/closure", + "version": "3.5.1", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/93ebc5712cdad8d5f489b500c59d122df2e53969", + "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^5.4 || ^7.0" + }, + "require-dev": { + "jeremeamia/superclosure": "^2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.5.x-dev" + } + }, + "autoload": { + "psr-4": { + "Opis\\Closure\\": "src/" + }, + "files": [ + "functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", + "homepage": "https://opis.io/closure", + "keywords": [ + "anonymous functions", + "closure", + "function", + "serializable", + "serialization", + "serialize" + ], + "time": "2019-11-29T22:36:02+00:00" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06T20:24:11+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/log", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2019-11-01T11:05:21+00:00" + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-10-23T01:57:42+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T14:18:11+00:00" + }, + { + "name": "topthink/framework", + "version": "v6.0.2", + "source": { + "type": "git", + "url": "https://github.com/top-think/framework.git", + "reference": "1444cce94b40a836958380b160a5fb7bfc165daf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/framework/zipball/1444cce94b40a836958380b160a5fb7bfc165daf", + "reference": "1444cce94b40a836958380b160a5fb7bfc165daf", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "league/flysystem": "^1.0", + "league/flysystem-cached-adapter": "^1.0", + "opis/closure": "^3.1", + "php": ">=7.1.0", + "psr/container": "~1.0", + "psr/log": "~1.0", + "psr/simple-cache": "^1.0", + "topthink/think-helper": "^3.1.1", + "topthink/think-orm": "^2.0" + }, + "require-dev": { + "mikey179/vfsstream": "^1.6", + "mockery/mockery": "^1.2", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "autoload": { + "files": [], + "psr-4": { + "think\\": "src/think/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + }, + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "description": "The ThinkPHP Framework.", + "homepage": "http://thinkphp.cn/", + "keywords": [ + "framework", + "orm", + "thinkphp" + ], + "time": "2020-01-13T05:48:05+00:00" + }, + { + "name": "topthink/think-helper", + "version": "v3.1.3", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-helper.git", + "reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-helper/zipball/4d85dfd3778623bbb1de3648f1dcd0c82f4439f4", + "reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "think\\": "src" + }, + "files": [ + "src/helper.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "description": "The ThinkPHP6 Helper Package", + "time": "2019-09-30T02:36:48+00:00" + }, + { + "name": "topthink/think-multi-app", + "version": "v1.0.11", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-multi-app.git", + "reference": "215f4a6bb88e53ad41b448c61957336eb55ce6f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-multi-app/zipball/215f4a6bb88e53ad41b448c61957336eb55ce6f9", + "reference": "215f4a6bb88e53ad41b448c61957336eb55ce6f9", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0", + "topthink/framework": "^6.0.0" + }, + "type": "library", + "extra": { + "think": { + "services": [ + "think\\app\\Service" + ] + } + }, + "autoload": { + "psr-4": { + "think\\app\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "thinkphp6 multi app support", + "time": "2019-10-29T06:34:59+00:00" + }, + { + "name": "topthink/think-orm", + "version": "v2.0.31", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-orm.git", + "reference": "d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-orm/zipball/d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4", + "reference": "d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-json": "*", + "php": ">=7.1.0", + "psr/log": "~1.0", + "psr/simple-cache": "^1.0", + "topthink/think-helper": "^3.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "think\\": "src" + }, + "files": [] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "think orm", + "keywords": [ + "database", + "orm" + ], + "time": "2020-01-07T10:05:10+00:00" + }, + { + "name": "topthink/think-template", + "version": "v2.0.7", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-template.git", + "reference": "e98bdbb4a4c94b442f17dfceba81e0134d4fbd19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-template/zipball/e98bdbb4a4c94b442f17dfceba81e0134d4fbd19", + "reference": "e98bdbb4a4c94b442f17dfceba81e0134d4fbd19", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0", + "psr/simple-cache": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "think\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "the php template engine", + "time": "2019-09-20T15:31:04+00:00" + }, + { + "name": "topthink/think-view", + "version": "v1.0.14", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-view.git", + "reference": "edce0ae2c9551ab65f9e94a222604b0dead3576d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-view/zipball/edce0ae2c9551ab65f9e94a222604b0dead3576d", + "reference": "edce0ae2c9551ab65f9e94a222604b0dead3576d", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0", + "topthink/think-template": "^2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "think\\view\\driver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "thinkphp template driver", + "time": "2019-11-06T11:40:13+00:00" + } + ], + "packages-dev": [ + { + "name": "nikic/php-parser", + "version": "v4.3.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9a9981c347c5c49d6dfe5cf826bb882b824080dc", + "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "0.0.5", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2019-11-08T13:50:10+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T13:56:44+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v4.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "7cfa470bc3b1887a7b2a47c0a702a84ad614fa92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7cfa470bc3b1887a7b2a47c0a702a84ad614fa92", + "reference": "7cfa470bc3b1887a7b2a47c0a702a84ad614fa92", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/console": "<3.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "^3.4|^4.0|^5.0", + "symfony/process": "^4.4|^5.0", + "twig/twig": "^1.34|^2.4|^3.0" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.4-dev" + } + }, + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "time": "2020-01-04T13:00:46+00:00" + }, + { + "name": "topthink/think-trace", + "version": "v1.2", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-trace.git", + "reference": "4589d06a07945d57478cc2236f4b23d51ff919cc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-trace/zipball/4589d06a07945d57478cc2236f4b23d51ff919cc", + "reference": "4589d06a07945d57478cc2236f4b23d51ff919cc", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.1.0", + "topthink/framework": "^6.0.0" + }, + "type": "library", + "extra": { + "think": { + "services": [ + "think\\trace\\Service" + ], + "config": { + "trace": "src/config.php" + } + } + }, + "autoload": { + "psr-4": { + "think\\trace\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "thinkphp debug trace", + "time": "2019-10-17T02:14:09+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.1.0" + }, + "platform-dev": [], + "plugin-api-version": "2.1.0" +} diff --git a/config/app.php b/config/app.php new file mode 100644 index 0000000..dbb69ce --- /dev/null +++ b/config/app.php @@ -0,0 +1,47 @@ + env('APP_DEBUG', false), + // 应用地址 + 'app_host' => env('app.host', ''), + // 应用的命名空间 + 'app_namespace' => '', + // 是否启用路由 + 'with_route' => false, + // 是否启用事件 + 'with_event' => true, + // 默认应用 + 'default_app' => 'index', + // 默认时区 + 'default_timezone' => 'Asia/Shanghai', + + // 应用映射(自动多应用模式有效) + 'app_map' => [], + // 域名绑定(自动多应用模式有效) + 'domain_bind' => [], + // 禁止URL访问的应用列表(自动多应用模式有效) + 'deny_app_list' => [], + + // 异常页面的模板文件 + 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', + + // 错误显示信息,非调试模式有效 + 'error_message' => '页面错误!请稍后再试~', + // 显示错误信息 + 'show_error_msg' => true, + // + 'ENCODE_KEY' => env('app.ENCODE_KEY', 'QDVTGN48@@#11aa'), + 'APPID' => 'wx2a7607969ec65027', + 'SECERT_KEY' => '941a33ebe76bf4f84eb8a03834b4d831', + 'envName' => 'prod', + + // 微信支付 + 'MCH_ID' => '1717190820', + 'PAY_KEY' => 'Dollar01234567890abcdefghijklmno', + 'REFUND_CERT_FILE' => '/wx_ca/apiclient_cert.pem', + 'REFUND_KEY_FILE' => '/wx_ca/apiclient_key.pem', + 'CERT_SERIAL_NO' => '', // 暂时没用到 + 'PAY_NOTIFY_URL_SHOP' => 'https://civcar.zhonganonline.top/zhihuitb/index.php/api/v1/pay_notify', +]; diff --git a/config/cache.php b/config/cache.php new file mode 100644 index 0000000..a8d69d2 --- /dev/null +++ b/config/cache.php @@ -0,0 +1,29 @@ + env('cache.driver', 'file'), + + // 缓存连接方式配置 + 'stores' => [ + 'file' => [ + // 驱动方式 + 'type' => 'File', + // 缓存保存目录 + 'path' => '', + // 缓存前缀 + 'prefix' => '', + // 缓存有效期 0表示永久缓存 + 'expire' => 0, + // 缓存标签前缀 + 'tag_prefix' => 'tag:', + // 序列化机制 例如 ['serialize', 'unserialize'] + 'serialize' => [], + ], + // 更多的缓存连接 + ], +]; diff --git a/config/console.php b/config/console.php new file mode 100644 index 0000000..3368757 --- /dev/null +++ b/config/console.php @@ -0,0 +1,8 @@ + [], +]; diff --git a/config/cookie.php b/config/cookie.php new file mode 100644 index 0000000..f728024 --- /dev/null +++ b/config/cookie.php @@ -0,0 +1,18 @@ + 0, + // cookie 保存路径 + 'path' => '/', + // cookie 有效域名 + 'domain' => '', + // cookie 启用安全传输 + 'secure' => false, + // httponly设置 + 'httponly' => false, + // 是否使用 setcookie + 'setcookie' => true, +]; diff --git a/config/database.php b/config/database.php new file mode 100644 index 0000000..c4bee0a --- /dev/null +++ b/config/database.php @@ -0,0 +1,145 @@ + env('database.driver', 'mysql'), + + // 自定义时间查询规则 + 'time_query_rule' => [], + // 'resultset_type' => 'array', + + // 自动写入时间戳字段 + // true为自动识别类型 false关闭 + // 字符串则明确指定时间字段类型 支持 int timestamp datetime date + 'auto_timestamp' => true, + + // 时间字段取出后的默认时间格式 + 'datetime_format' => 'Y-m-d H:i:s', + + // 数据库连接配置信息 + 'connections' => [ + 'mysql' => [ + // 数据库类型 + 'type' => env('database.type', 'mysql'), + // 服务器地址 + 'hostname' => env('database.hostname', '127.0.0.1'), + // 数据库名 + 'database' => env('database.database', 'zhihuitubao'), + // 用户名 + 'username' => env('database.username', 'root'), + // 密码 + 'password' => env('database.password', 'Ck@@@@453455'), + // 'password' => '453455', + // 端口 + 'hostport' => env('database.hostport', '3306'), + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => env('database.charset', 'utf8mb4'), + // 数据库表前缀 + 'prefix' => env('database.prefix', ''), + + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + 'deploy' => 0, + // 数据库读写是否分离 主从式有效 + 'rw_separate' => false, + // 读写分离后 主服务器数量 + 'master_num' => 1, + // 指定从服务器序号 + 'slave_no' => '', + // 是否严格检查字段是否存在 + 'fields_strict' => true, + // 是否需要断线重连 + 'break_reconnect' => false, + // 监听SQL + 'trigger_sql' => false, + // 开启字段缓存 + 'fields_cache' => false, + // 字段缓存路径 + 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR, + ], + 'mysql2' => [ + // 数据库类型 + 'type' => env('database.type', 'mysql'), + // 服务器地址 + 'hostname' => env('database.hostname', '127.0.0.1'), + // 'hostname' => env('database.hostname', '39.100.154.10'), + // 'hostname' => '121.196.9.49', + // 数据库名 + 'database' => env('database.database', 'tonglu_shop'), + // 用户名 + 'username' => env('database.username', 'tonglu'), + // 密码 + 'password' => env('database.password', 'Tonglu@123!!'), + // 'password' => '453455', + // 端口 + 'hostport' => env('database.hostport', '3306'), + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => env('database.charset', 'utf8mb4'), + // 数据库表前缀 + 'prefix' => env('database.prefix', ''), + + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + 'deploy' => 0, + // 数据库读写是否分离 主从式有效 + 'rw_separate' => false, + // 读写分离后 主服务器数量 + 'master_num' => 1, + // 指定从服务器序号 + 'slave_no' => '', + // 是否严格检查字段是否存在 + 'fields_strict' => true, + // 是否需要断线重连 + 'break_reconnect' => false, + // 监听SQL + 'trigger_sql' => false, + // 开启字段缓存 + 'fields_cache' => false, + // 字段缓存路径 + 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR, + ], + // 'mssql' => [ + // // 数据库类型 + // 'type' => 'pdo', + // // 服务器地址 + // 'hostname' => 'dblib:host=rm-bp1o39373w01d73adfo.sqlserver.rds.aliyuncs.com:3433', + // // 数据库名 + // 'database' => 'yymgdb2', + // // 用户名 + // 'username' => 'yymguser', + // // 密码 + // 'password' => 'Mg20190829', + // // 端口 + // 'hostport' => '3433', + // // 数据库连接参数 + // 'params' => [], + // // 数据库编码默认采用utf8 + // 'charset' => env('database.charset', 'utf8'), + // // 数据库表前缀 + // 'prefix' => env('database.prefix', ''), + + // // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + // 'deploy' => 0, + // // 数据库读写是否分离 主从式有效 + // 'rw_separate' => false, + // // 读写分离后 主服务器数量 + // 'master_num' => 1, + // // 指定从服务器序号 + // 'slave_no' => '', + // // 是否严格检查字段是否存在 + // 'fields_strict' => true, + // // 是否需要断线重连 + // 'break_reconnect' => false, + // // 监听SQL + // 'trigger_sql' => env('app_debug', true), + // // 开启字段缓存 + // 'fields_cache' => false, + // // 字段缓存路径 + // 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR, + // ], + + // 更多的数据库配置信息 + ], +]; diff --git a/config/filesystem.php b/config/filesystem.php new file mode 100644 index 0000000..8ac3ea5 --- /dev/null +++ b/config/filesystem.php @@ -0,0 +1,24 @@ + env('filesystem.driver', 'local'), + // 磁盘列表 + 'disks' => [ + 'local' => [ + 'type' => 'local', + 'root' => app()->getRuntimePath() . 'storage', + ], + 'public' => [ + // 磁盘类型 + 'type' => 'local', + // 磁盘路径 + 'root' => app()->getRootPath() . 'public/uploads', + // 磁盘路径对应的外部URL路径 + 'url' => '/uploads', + // 可见性 + 'visibility' => 'public', + ], + // 更多的磁盘配置信息 + ], +]; diff --git a/config/index.js b/config/index.js deleted file mode 100644 index 64fed65..0000000 --- a/config/index.js +++ /dev/null @@ -1,4 +0,0 @@ -export const config = { - /** 是否使用mock代替api返回 */ - useMock: true, -}; diff --git a/config/lang.php b/config/lang.php new file mode 100644 index 0000000..e3b4986 --- /dev/null +++ b/config/lang.php @@ -0,0 +1,25 @@ + env('lang.default_lang', 'zh-cn'), + // 允许的语言列表 + 'allow_lang_list' => [], + // 多语言自动侦测变量名 + 'detect_var' => 'lang', + // 是否使用Cookie记录 + 'use_cookie' => true, + // 多语言cookie变量 + 'cookie_var' => 'think_lang', + // 扩展语言包 + 'extend_list' => [], + // Accept-Language转义为对应语言包名称 + 'accept_language' => [ + 'zh-hans-cn' => 'zh-cn', + ], + // 是否支持语言分组 + 'allow_group' => false, +]; diff --git a/config/log.php b/config/log.php new file mode 100644 index 0000000..ea24ff9 --- /dev/null +++ b/config/log.php @@ -0,0 +1,45 @@ + env('log.channel', 'file'), + // 日志记录级别 + 'level' => [], + // 日志类型记录的通道 ['error'=>'email',...] + 'type_channel' => [], + // 关闭全局日志写入 + 'close' => false, + // 全局日志处理 支持闭包 + 'processor' => null, + + // 日志通道列表 + 'channels' => [ + 'file' => [ + // 日志记录方式 + 'type' => 'File', + // 日志保存目录 + 'path' => '', + // 单文件日志写入 + 'single' => false, + // 独立日志级别 + 'apart_level' => [], + // 最大日志文件数量 + 'max_files' => 0, + // 使用JSON格式记录 + 'json' => false, + // 日志处理 + 'processor' => null, + // 关闭通道日志写入 + 'close' => false, + // 日志输出格式化 + 'format' => '[%s][%s] %s', + // 是否实时写入 + 'realtime_write' => false, + ], + // 其它日志通道配置 + ], + +]; diff --git a/config/middleware.php b/config/middleware.php new file mode 100644 index 0000000..7e1972f --- /dev/null +++ b/config/middleware.php @@ -0,0 +1,8 @@ + [], + // 优先级设置,此数组中的中间件会按照数组中的顺序优先执行 + 'priority' => [], +]; diff --git a/config/route.php b/config/route.php new file mode 100644 index 0000000..955eeec --- /dev/null +++ b/config/route.php @@ -0,0 +1,45 @@ + '/', + // URL伪静态后缀 + 'url_html_suffix' => 'html', + // URL普通方式参数 用于自动生成 + 'url_common_param' => true, + // 是否开启路由延迟解析 + 'url_lazy_route' => false, + // 是否强制使用路由 + 'url_route_must' => false, + // 合并路由规则 + 'route_rule_merge' => false, + // 路由是否完全匹配 + 'route_complete_match' => false, + // 访问控制器层名称 + 'controller_layer' => 'controller', + // 空控制器名 + 'empty_controller' => 'Error', + // 是否使用控制器后缀 + 'controller_suffix' => false, + // 默认的路由变量规则 + 'default_route_pattern' => '[\w\.]+', + // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 + 'request_cache' => false, + // 请求缓存有效期 + 'request_cache_expire' => null, + // 全局请求缓存排除规则 + 'request_cache_except' => [], + // 默认控制器名 + 'default_controller' => 'Index', + // 默认操作名 + 'default_action' => 'index', + // 操作方法后缀 + 'action_suffix' => '', + // 默认JSONP格式返回的处理方法 + 'default_jsonp_handler' => 'jsonpReturn', + // 默认JSONP处理方法 + 'var_jsonp_handler' => 'callback', +]; diff --git a/config/session.php b/config/session.php new file mode 100644 index 0000000..c1ef6e1 --- /dev/null +++ b/config/session.php @@ -0,0 +1,19 @@ + 'PHPSESSID', + // SESSION_ID的提交变量,解决flash上传跨域 + 'var_session_id' => '', + // 驱动方式 支持file cache + 'type' => 'file', + // 存储连接标识 当type使用cache的时候有效 + 'store' => null, + // 过期时间 + 'expire' => 1440, + // 前缀 + 'prefix' => '', +]; diff --git a/config/trace.php b/config/trace.php new file mode 100644 index 0000000..fad2392 --- /dev/null +++ b/config/trace.php @@ -0,0 +1,10 @@ + 'Html', + // 读取的日志通道名 + 'channel' => '', +]; diff --git a/config/view.php b/config/view.php new file mode 100644 index 0000000..01259a0 --- /dev/null +++ b/config/view.php @@ -0,0 +1,25 @@ + 'Think', + // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 + 'auto_rule' => 1, + // 模板目录名 + 'view_dir_name' => 'view', + // 模板后缀 + 'view_suffix' => 'html', + // 模板文件名分隔符 + 'view_depr' => DIRECTORY_SEPARATOR, + // 模板引擎普通标签开始标记 + 'tpl_begin' => '{', + // 模板引擎普通标签结束标记 + 'tpl_end' => '}', + // 标签库标签开始标记 + 'taglib_begin' => '{', + // 标签库标签结束标记 + 'taglib_end' => '}', +]; diff --git a/custom-tab-bar/data.js b/custom-tab-bar/data.js deleted file mode 100644 index 675c07f..0000000 --- a/custom-tab-bar/data.js +++ /dev/null @@ -1,16 +0,0 @@ -export default [{ - icon: 'home', - text: '动态', - url: 'pages/home/home', -}, -{ - icon: 'share', - text: '分销', - url: 'pages/faxianlist/faxianlist', -}, -{ - icon: 'person', - text: '我的', - url: 'pages/usercenter/index', -}, -]; \ No newline at end of file diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js deleted file mode 100644 index 024eb95..0000000 --- a/custom-tab-bar/index.js +++ /dev/null @@ -1,66 +0,0 @@ -import TabMenu from './data'; -import R from '../utils/request'; -import C from '../utils/constant'; -Component({ - data: { - active: 0, - list: [], - is_share: false, - cdnHost: C.cdnHost, - }, - - ready() { - R.get('/index.php/api/v1/my').then(({ model }) => { - this.setData({ - is_share: !!model.is_share, - list: TabMenu.filter((_, idx) => { - if (model.is_share) { - return true - } else { - return idx !== 1 - } - }) - }); - }); - }, - - methods: { - goTakePhoto() { - wx.navigateTo({ - url: '/pages/takephoto/takephoto', - }) - }, - onChange(event) { - this.setData({ active: event.detail.value }); - wx.switchTab({ - url: this.data.list[event.detail.value].url.startsWith('/') - ? this.data.list[event.detail.value].url - : `/${this.data.list[event.detail.value].url}`, - }); - }, - - init() { - const page = getCurrentPages().pop(); - const route = page ? page.route.split('?')[0] : ''; - const active = this.data.list.findIndex( - (item) => - (item.url.startsWith('/') ? item.url.substr(1) : item.url) === - `${route}`, - ); - this.setData({ active }); - }, - getPhoneNumber(e) { - console.log(e.detail.code) // 动态令牌 - console.log(e.detail.errMsg) // 回调信息(成功失败都会返回) - console.log(e.detail.errno) // 错误码(失败时返回) - if (!e.detail.errno) { - R.post('/index.php/api/v1/bind_auth_phone', { code: e.detail.code }).then(() => { - this.setData({ hasPhone: true }) - this.goTakePhoto(); - }) - } else { - // e.detail.errMsg - } - }, - }, -}); diff --git a/custom-tab-bar/index.json b/custom-tab-bar/index.json deleted file mode 100644 index eab5fb3..0000000 --- a/custom-tab-bar/index.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "component": true, - "usingComponents": { - "t-tab-bar": "tdesign-miniprogram/tab-bar/tab-bar", - "t-tab-bar-item": "tdesign-miniprogram/tab-bar-item/tab-bar-item", - "t-icon": "tdesign-miniprogram/icon/icon", - "t-image": "tdesign-miniprogram/image/image" - } -} \ No newline at end of file diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml deleted file mode 100644 index 9900622..0000000 --- a/custom-tab-bar/index.wxml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - {{ item.text }} - - - - - - \ No newline at end of file diff --git a/custom-tab-bar/index.wxss b/custom-tab-bar/index.wxss deleted file mode 100644 index e8b8bf4..0000000 --- a/custom-tab-bar/index.wxss +++ /dev/null @@ -1,40 +0,0 @@ -.tabline { - position: relative; -} - - -.custom-tab-bar-wrapper { - display: flex; - align-items: center; -} - -.text { - font-size: 28rpx; - padding-left: 10rpx; -} - -.camera { - position: absolute; - left: 50%; - top: 20rpx; - border-radius: 20rpx; - height: 78rpx; - width: 176rpx; - background: linear-gradient(180deg, rgb(74, 137, 254) 0%, rgb(47, 103, 254) 100%); - transform: translateX(-50%); - display: flex; - align-items: center; - justify-content: center; - z-index: 2; - font-size: 28rpx; - color: #fff; -} -.camera .txt{ - display: flex; - align-items: center; - padding-left:10rpx; - white-space: nowrap; -} -.custom-tab-bar-wrapper.cur { - color: #2966f5; -} \ No newline at end of file diff --git a/extend/.gitignore b/extend/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/extend/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/jsconfig.json b/jsconfig.json deleted file mode 100644 index 36aa1a4..0000000 --- a/jsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": "." - } -} diff --git a/package.json b/package.json deleted file mode 100644 index b65e1e5..0000000 --- a/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "@tencent/tdesign-miniprogram-starter-retail", - "version": "1.0.0", - "description": "", - "main": "app.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "dayjs": "^1.9.3", - "tdesign-miniprogram": "^1.4.0", - "tslib": "^1.11.1" - }, - "devDependencies": {} -} \ No newline at end of file diff --git a/pages/createpay/createpay.js b/pages/createpay/createpay.js deleted file mode 100644 index 3d417d0..0000000 --- a/pages/createpay/createpay.js +++ /dev/null @@ -1,109 +0,0 @@ -import C from '../../utils/constant'; -import * as F from '../../utils/func'; -import R from '../../utils/request'; -import ActionSheet, { ActionSheetTheme } from 'tdesign-miniprogram/action-sheet/index'; - -Page({ - data: { - price: '', - expireDate: F.parseDate(new Date()), - dateVisible: false, - start: F.parseDate(new Date()), - end: F.parseDate(new Date(new Date() * 1 + 24 * 3600 * 366 * 1000 + 1)), - filter(type, options) { - if (type === 'year') { - return options.sort((a, b) => b.value - a.value); - } - return options; - }, - popupProps: { - usingCustomNavbar: true, - }, - buy_type: '', - buy_types: [], - }, - onLoad() { - R.get('/index.php/api/v1/config_one', { k: 'buy_types' }).then(({ model }) => { - this.setData({ - buy_types: model || [], - buy_type: model[0], - }); - }); - }, - handleSelected(e) { - console.log(e.detail); - this.setData({ - buy_type: e.detail.selected.label, - }); - }, - handleAction() { - ActionSheet.show({ - theme: ActionSheetTheme.List, - selector: '#t-action-sheet', - context: this, - items: this.data.buy_types.map((item) => ({ - label: item, - })), - }); - }, - onConfirm(e) { - const { value } = e.detail; - this.setData({ - expireDate: value, - dateVisible: false, - }); - }, - showPicker() { - this.setData({ dateVisible: true }); - }, - onClose() { - this.setData({ dateVisible: false }); - }, - validate() { - const { price, expireDate } = this.data; - if (!price) { - wx.showToast({ title: '请输入分销金额', icon: 'none' }); - return false; - } - if (!/^\d+(\.\d+)?$/.test(price)) { - wx.showToast({ title: '请输入正确的金额', icon: 'none' }); - return false; - } - - if (!expireDate) { - wx.showToast({ title: '请选择付款有效期', icon: 'none' }); - return false; - } - return true; - }, - share() { - if (!this.validate()) return; - // TODO: 调用分享接口 - // console.log('share1', this.data); - // wx.showShareMenu({ - // withShareTicket: true, - // menus: ['shareAppMessage'] - // }); - }, - onShareAppMessage(e) { - if (!this.validate()) { - return { - title: '', - path: '', - imageUrl: '', - promise: Promise.reject(), - } - } - const { price, expireDate, buy_type } = this.data; - return R.get('/index.php/api/v1/create_share', { - price, expireDate, buy_type, - }).then(({ model }) => { - return { - title: model.title, - path: model.path || '/pages/sharebuy/sharebuy?id=' + model.id, - imageUrl: model.img, - promise: Promise.resolve(), - }; - }); - }, -}); \ No newline at end of file diff --git a/pages/createpay/createpay.json b/pages/createpay/createpay.json deleted file mode 100644 index 7d30697..0000000 --- a/pages/createpay/createpay.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "navigationBarTitleText": "分销", - "backgroundTextStyle": "light", - "usingComponents": { - "t-cell": "tdesign-miniprogram/cell/cell", - "t-button": "tdesign-miniprogram/button/button", - "t-input": "tdesign-miniprogram/input/input", - "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker", - "t-action-sheet": "tdesign-miniprogram/action-sheet/action-sheet" - } -} \ No newline at end of file diff --git a/pages/createpay/createpay.wxml b/pages/createpay/createpay.wxml deleted file mode 100644 index 84f1af1..0000000 --- a/pages/createpay/createpay.wxml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - 分享 - - - - \ No newline at end of file diff --git a/pages/createpay/createpay.wxss b/pages/createpay/createpay.wxss deleted file mode 100644 index 95faadd..0000000 --- a/pages/createpay/createpay.wxss +++ /dev/null @@ -1,14 +0,0 @@ -.container { - padding: 20rpx; -} - -.form { - background: #fff; - border-radius: 10rpx; - overflow: hidden; -} - -.footer { - margin-top: 40rpx; - padding: 0 20rpx; -} \ No newline at end of file diff --git a/pages/detail/detail.js b/pages/detail/detail.js deleted file mode 100644 index 6ea8d63..0000000 --- a/pages/detail/detail.js +++ /dev/null @@ -1,33 +0,0 @@ -import R from '../../utils/request'; -import C from '../../utils/constant'; -Page({ - - data: { - cdnHost: C.cdnHost, - detail: {}, - user: {}, - }, - onLoad(options) { - const { id } = options; - R.get('/index.php/api/v1/news_detail', { id }).then(({ model }) => { - this.setData({ - detail: { - ...model.detail, - content: (model.detail.content||'').replace(/src\="\/uploads/g, 'src="'+C.cdnHost + '/uploads'), - imgs: (model.detail.imgs || '').split(',').filter(o=>!!o), - video: model.detail.video ? model.detail.video : '', - }, - user: { - ...model.user, - } - }); - }); - }, - videoErrorCallback(e) { - console.log('视频错误信息:') - console.log(e.detail.errMsg) - }, - onShareAppMessage() { - - } -}) \ No newline at end of file diff --git a/pages/detail/detail.json b/pages/detail/detail.json deleted file mode 100644 index edea912..0000000 --- a/pages/detail/detail.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "navigationBarTitleText": "详情", - "backgroundTextStyle": "light", - "usingComponents": { - "t-icon": "tdesign-miniprogram/icon/icon", - "t-image": "tdesign-miniprogram/image/image" - } -} \ No newline at end of file diff --git a/pages/detail/detail.wxml b/pages/detail/detail.wxml deleted file mode 100644 index c45712d..0000000 --- a/pages/detail/detail.wxml +++ /dev/null @@ -1,14 +0,0 @@ - - {{detail.title}} - - {{detail.create_time}} - - - {{detail.view_cnt}} - - - - - - 来源: {{user.real_name || '三鲤'}} - \ No newline at end of file diff --git a/pages/detail/detail.wxss b/pages/detail/detail.wxss deleted file mode 100644 index c19bf5d..0000000 --- a/pages/detail/detail.wxss +++ /dev/null @@ -1,57 +0,0 @@ -page { - box-sizing: border-box; - background-color: #fff; - padding: 0 20rpx; - padding-top: 20rpx; - padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx); -} - -.title { - font-size: 34rpx; - list-style: square; - margin-bottom: 20rpx; - color: #363a44; -} - -.info { - display: flex; - font-size: 28rpx; - justify-content: space-between; - margin-bottom: 60rpx; - color: #b3b5b9; -} - -.info .viewcnt { - display: flex; - align-items: center; -} - -.info .viewcnt .t-icon { - margin-right: 12rpx; -} - - - -.content { - word-break: break-all; - line-height: 46rpx; - font-size: 26rpx; - color: #363a44; -} - -.img { - width: 100%; - margin: 20rpx auto; -} - -.video { - width: 100%; - margin: 20rpx auto; -} - -.source { - font-size: 24rpx; - color: #b3b5b9; - text-align: left; - margin-top: 40rpx; -} \ No newline at end of file diff --git a/pages/detail_admin/detail.js b/pages/detail_admin/detail.js deleted file mode 100644 index 0045231..0000000 --- a/pages/detail_admin/detail.js +++ /dev/null @@ -1,66 +0,0 @@ -// pages/detail_admin/detail.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } -}) \ No newline at end of file diff --git a/pages/detail_admin/detail.wxml b/pages/detail_admin/detail.wxml deleted file mode 100644 index 1667bb2..0000000 --- a/pages/detail_admin/detail.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -pages/detail_admin/detail.wxml \ No newline at end of file diff --git a/pages/faxianlist/faxianlist.js b/pages/faxianlist/faxianlist.js deleted file mode 100644 index dc4c32d..0000000 --- a/pages/faxianlist/faxianlist.js +++ /dev/null @@ -1,107 +0,0 @@ -import R from '../../utils/request'; -import C from '../../utils/constant'; -import * as F from '../../utils/func'; -Page({ - - data: { - cdnHost: C.cdnHost, - list: [], - page: 1, - status: '', - // money_flag: 'send', - listEndText: '', - }, - onShow() { - this.getTabBar().init(); - this.fetchList(1); - }, - onLoad(options) { - }, - goCreate(e) { - wx.navigateTo({ - url: `/pages/createpay/createpay` - }); - }, - fetchList(page) { - const { status } = this.data; - // money_flag - R.get('/index.php/api/v1/share_list', { page, status }).then(({ model }) => { - const list = []; - model.forEach(item => { - list.push({ - ...item, - price: F.formatePrice(item.price), - }); - }); - if (list.length == 0) { - this.setData({ listEndText: '没有更多了' }); - } else { - this.setData({ listEndText: '点击加载更多。。。' }); - } - if (page == 1) { - this.setData({ list,page }); - } else { - const list2 = this.data.list.concat(list); - this.setData({ list: list2,page }); - } - }); - // for (let i = 0; i < 20; i++) { - // list.push({ - // id: i, - // title: '自动热重载] 已开启代码文件保存后自动热重载自动热重载] 已开启代码文件保存后自动热重载', - // image: `${imageCdn}/swiper2.png`, - // createTime: '09-12 12:21', - // viewCnt: 1922 + i, - // }); - // } - // this.setData({ - // list - // }) - }, - loadMore() { - const { page, listEndText } = this.data; - if (listEndText == '点击加载更多。。。') { - this.fetchList(page + 1); - } - }, - onTabsChange(event) { - const v = event.detail.value; - this.data.status = v; - this.fetchList(1); - }, - // handleSwitchChange(e) { - // const { value } = e.detail; - // if (value) { - // this.data.money_flag = 'send'; - // } else { - // this.data.money_flag = ''; - // } - // this.fetchList(1); - // }, - onReachBottom() { - this.loadMore(); - }, - onPullDownRefresh() { - this.fetchList(1); - wx.stopPullDownRefresh(); - }, - editRemark(e) { - const { id, remark } = e.currentTarget.dataset.detail; - const that = this; - wx.showModal({ - title: '备注', - content: remark || '', - editable: true, - success(re) { - const remark2 = re.content || ''; - R.post('/index.php/api/v1/mark', { id, remark: remark2 }).then(() => { - that.data.list.find(o => o.id == id).remark = remark2; - that.setData({ - list: [...that.data.list], - }) - }) - } - }) - - } -}) \ No newline at end of file diff --git a/pages/faxianlist/faxianlist.json b/pages/faxianlist/faxianlist.json deleted file mode 100644 index 161bd58..0000000 --- a/pages/faxianlist/faxianlist.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "navigationBarTitleText": "我的分销", - "backgroundTextStyle": "light", - "usingComponents": { - "t-tabs": "tdesign-miniprogram/tabs/tabs", - "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel", - "t-image": "tdesign-miniprogram/image/image", - "t-sticky": "tdesign-miniprogram/sticky/sticky", - "t-divider": "tdesign-miniprogram/divider/divider", - "t-icon": "tdesign-miniprogram/icon/icon", - "t-footer": "tdesign-miniprogram/footer/footer" - } -} \ No newline at end of file diff --git a/pages/faxianlist/faxianlist.wxml b/pages/faxianlist/faxianlist.wxml deleted file mode 100644 index e9c36b2..0000000 --- a/pages/faxianlist/faxianlist.wxml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - 订单号: {{item.order_no || '-'}} 金额: {{item.price}} 元 - 购买信息: {{item.name}} {{item.phone}} - - - 备注: {{item.remark || '无'}} - - - - 支付时间: {{item.pay_time}} - 订单时间: {{item.create_time}} - {{item.buy_type}} - - - - - - - - - - - 创建 - 分销 - - \ No newline at end of file diff --git a/pages/faxianlist/faxianlist.wxss b/pages/faxianlist/faxianlist.wxss deleted file mode 100644 index 1715f76..0000000 --- a/pages/faxianlist/faxianlist.wxss +++ /dev/null @@ -1,113 +0,0 @@ -page { - padding: 0 20rpx; - background-color: rgb(245, 246, 247); -} - -.tabs { - display: flex; - justify-content: space-between; - background-color: rgb(245, 246, 247); -} - -.tabs .t-tabs { - width: 60%; - background: none !important; -} - -.tabs .t-tabs .t-tabs__wrapper { - background: none !important; -} - -.sw { - width: 240rpx; - display: flex; - align-items: center; - font-size: 32rpx; -} - -.sw .txt { - padding-left: 16rpx; -} - - -.list { - margin-top: 20rpx; - padding-bottom: 60rpx; -} - -.list .item { - border-radius: 16rpx; - background-color: #fff; - margin-bottom: 20rpx; - width: 710rpx; - padding-top: 20rpx; -} - -.list .item .item-main { - display: flex; - padding-left: 20rpx; -} - -.list .item .item-main .right { - flex: 1; - padding: 0 32rpx; - padding-bottom: 20rpx; -} - -.list .item .item-main .right .text { - padding-top: 16rpx; - font-size: 28rpx; - line-height: 46rpx; - margin-bottom: 20rpx; - color: #333; -} - -.list .item .item-main .right .info { - display: flex; - font-size: 24rpx; - justify-content: space-between; - color: #8f9197; -} - -.list .item .item-main .right .info .viewcnt { - display: flex; - align-items: center; - padding: 0 20rpx; -} - -.list .item .item-main .right .info .viewcnt.init { - color: blue; -} - -.list .item .item-main .right .info .viewcnt.resolve { - color: green; -} - -.list .item .item-main .right .info .viewcnt.reject { - color: gray; -} -.remark{ - display: flex; -} -.btn_cre { - position: fixed; - bottom: 220rpx; - right: 20rpx; - height: 120rpx; - width: 120rpx; - border-radius: 50%; - background-color: rgb(111, 172, 207); - color: #fff; - font-size: 26rpx; - z-index: 2; - padding-top: 26rpx; - box-sizing: border-box; -} - -.btn_cre view { - display: flex; - align-items: center; - justify-content: center; - flex-direction: row; - text-align: center; -} \ No newline at end of file diff --git a/pages/home/home.js b/pages/home/home.js deleted file mode 100644 index ac6e151..0000000 --- a/pages/home/home.js +++ /dev/null @@ -1,106 +0,0 @@ -import R from '../../utils/request'; -import C from '../../utils/constant'; -Page({ - data: { - cdnHost: C.cdnHost, - loadFlag: false, - swiperList: [], - list: [], - }, - - onShow() { - this.getTabBar().init(); - // this.init(); - this.fetchBanner(); - }, - - onLoad() { - R.login().then(() => { - this.init(); - }) - }, - fetchBanner() { - R.get('/index.php/api/v1/banner_list', {}).then(({ model }) => { - const swiperList = []; - model.forEach(item => { - swiperList.push({ - ...item, - value: C.cdnHost + item.img, - ariaLabel: item.title, - id: item.id, - }); - }); - if (JSON.stringify(swiperList) != JSON.stringify(this.data.swiperList)) { - this.setData({ swiperList }); - } - }); - }, - init() { - if (this.data.loadFlag) return; - this.data.loadFlag = false; - this.fetchList(1); - this.fetchBanner(); - }, - fetchList(page) { - R.get('/index.php/api/v1/news_list', { page, pageSize: 5 }).then(({ model }) => { - const list = []; - model.forEach(item => { - list.push({ - ...item, - }); - }); - this.setData({ list }); - }); - }, - goDetail(e) { - const { id } = e.currentTarget.dataset; - wx.navigateTo({ - url: `/pages/detail/detail?id=${id}` - }); - }, - onSwiperTap(e) { - const { index } = e.detail; - this.data.swiperList.forEach((o, i) => { - if (i == index) { - console.log(o) - if(o.action_type == 'newsId'){ - wx.navigateTo({ - url: '/pages/detail/detail?id=' + o.action_item, - }); - } - if(o.action_type == 'url'){ - wx.navigateTo({ - url: '/pages/webview/webview?url=' + encodeURIComponent(o.action_item), - }); - } - if(o.action_type == 'path'){ - wx.navigateTo({ - url: o.action_item, - }); - } - } - }) - }, - goUrl(e) { - const { url } = e.currentTarget.dataset; - wx.navigateTo({ - url - }); - }, - goMore() { - wx.navigateTo({ - url: '/pages/news_list/home' - }); - }, - refresh() { - this.fetchList(1); - this.fetchBanner(); - wx.showToast({ icon: 'none', title: '刷新成功' }); - }, - onPullDownRefresh() { - this.init(); - wx.stopPullDownRefresh(); - }, - onShareAppMessage() { }, - onShareTimeline() { }, -}); diff --git a/pages/home/home.json b/pages/home/home.json deleted file mode 100644 index edeed79..0000000 --- a/pages/home/home.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "navigationBarTitleText": "首页", - "backgroundTextStyle": "light", - "usingComponents": { - "t-swiper": "tdesign-miniprogram/swiper/swiper", - "t-swiper-nav": "tdesign-miniprogram/swiper-nav/swiper-nav", - "t-icon": "tdesign-miniprogram/icon/icon", - "t-image": "tdesign-miniprogram/image/image", - "t-divider": "tdesign-miniprogram/divider/divider" - }, - "enablePullDownRefresh": true -} \ No newline at end of file diff --git a/pages/home/home.less b/pages/home/home.less deleted file mode 100644 index f0ae0f8..0000000 --- a/pages/home/home.less +++ /dev/null @@ -1,101 +0,0 @@ -page { - box-sizing: border-box; - background-color: linear-gradient(180deg, #f0f4fc, #fff); - padding: 0 20rpx; - padding-top: 10rpx; - padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx); -} - -.title_bar { - display: flex; - align-items: center; - justify-content: space-between; - margin-top: 32rpx; -} - -.title_bar .title { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; - background-position: left center; - background-size: 100% 100%; - font-size: 32rpx; - color: rgb(53, 58, 71); - height: 34rpx; - display: flex; - align-items: center; - font-weight: bold; - - .t-icon { - margin-left: 10rpx; - } -} - - -.title_bar .btn { - color: #71737b; - font-size: 28rpx; - display: flex; - align-items: center; -} - -.title_bar .btn .t-icon { - margin-left: 10rpx; -} - -.list { - margin-top: 20rpx; -} - -.list .item .item-main { - display: flex; -} - -.list .item .item-main .right { - flex: 1; - padding-left: 32rpx; -} - -.list .item .item-main .right .text { - padding-top: 0rpx; - font-size: 28rpx; - line-height: 46rpx; - margin-bottom: 10rpx; - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; - overflow: hidden; - text-overflow: ellipsis; - color: #363a44; - -} - -.list .item .item-main .right .info { - display: flex; - font-size: 24rpx; - justify-content: space-between; - color: #71737b; -} - -.list .item .item-main .right .info .viewcnt { - display: flex; - align-items: center; -} - -.list .item .viewcnt .t-icon { - margin-right: 10rpx; -} - -.t-tab-bar { - border-top: 1px solid #eee; - position: relative; -} - -.activity { - display: flex; - justify-content: space-between; - padding: 20rpx 0; - border-bottom: 1px solid #eee; - - .t-image { - width: 100%; - } -} \ No newline at end of file diff --git a/pages/home/home.wxml b/pages/home/home.wxml deleted file mode 100644 index 52815cb..0000000 --- a/pages/home/home.wxml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - 公司动态 - - - - 查看全部 - - - - - - - - - {{item.title}} - - {{item.create_time}} - - - {{item.view_cnt}} - - - - - - - - \ No newline at end of file diff --git a/pages/home/home.wxss b/pages/home/home.wxss deleted file mode 100644 index ca12594..0000000 --- a/pages/home/home.wxss +++ /dev/null @@ -1,84 +0,0 @@ -page { - box-sizing: border-box; - background-color: linear-gradient(180deg, #f0f4fc, #fff); - padding: 0 20rpx; - padding-top: 10rpx; - padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx); -} -.title_bar { - display: flex; - align-items: center; - justify-content: space-between; - margin-top: 32rpx; -} -.title_bar .title { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; - background-position: left center; - background-size: 100% 100%; - font-size: 32rpx; - color: #353a47; - height: 34rpx; - display: flex; - align-items: center; - font-weight: bold; -} -.title_bar .title .t-icon { - margin-left: 10rpx; -} -.title_bar .btn { - color: #71737b; - font-size: 28rpx; - display: flex; - align-items: center; -} -.title_bar .btn .t-icon { - margin-left: 10rpx; -} -.list { - margin-top: 20rpx; -} -.list .item .item-main { - display: flex; -} -.list .item .item-main .right { - flex: 1; - padding-left: 32rpx; -} -.list .item .item-main .right .text { - padding-top: 0rpx; - font-size: 28rpx; - line-height: 46rpx; - margin-bottom: 10rpx; - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; - overflow: hidden; - text-overflow: ellipsis; - color: #363a44; -} -.list .item .item-main .right .info { - display: flex; - font-size: 24rpx; - justify-content: space-between; - color: #71737b; -} -.list .item .item-main .right .info .viewcnt { - display: flex; - align-items: center; -} -.list .item .viewcnt .t-icon { - margin-right: 10rpx; -} -.t-tab-bar { - border-top: 1px solid #eee; - position: relative; -} -.activity { - display: flex; - justify-content: space-between; - padding: 20rpx 0; - border-bottom: 1px solid #eee; -} -.activity .t-image { - width: 100%; -} diff --git a/pages/home/readme b/pages/home/readme deleted file mode 100644 index fcf75d5..0000000 --- a/pages/home/readme +++ /dev/null @@ -1,8 +0,0 @@ -首页功能设定 -1. loading入场 -2. 下拉刷新 -3. 搜索栏 -4. 分类切换 -5. 商品列表 -6. 规格弹层 -7. 加载更多 \ No newline at end of file diff --git a/pages/news_admin_list/home.js b/pages/news_admin_list/home.js deleted file mode 100644 index 38b1370..0000000 --- a/pages/news_admin_list/home.js +++ /dev/null @@ -1,66 +0,0 @@ -// pages/news_admin_list/home.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } -}) \ No newline at end of file diff --git a/pages/news_admin_list/home.wxml b/pages/news_admin_list/home.wxml deleted file mode 100644 index f6cd162..0000000 --- a/pages/news_admin_list/home.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -pages/news_admin_list/home.wxml \ No newline at end of file diff --git a/pages/news_list/home.js b/pages/news_list/home.js deleted file mode 100644 index d3848f8..0000000 --- a/pages/news_list/home.js +++ /dev/null @@ -1,63 +0,0 @@ -import R from '../../utils/request'; -import C from '../../utils/constant'; -Page({ - data: { - cdnHost: C.cdnHost, - list: [], - page: 1, - listEndText: '', - }, - - onShow() { - this.getTabBar().init(); - }, - - onLoad() { - this.init(); - }, - init() { - this.fetchList(1); - }, - fetchList(page) { - R.get('/index.php/api/v1/news_list', { page }).then(({ model }) => { - const list = []; - model.forEach(item => { - list.push({ - ...item, - }); - }); - if (list.length == 0) { - this.setData({ listEndText: '没有更多了' }); - } else { - this.setData({ listEndText: '点击加载更多。。。' }); - } - if (page == 1) { - this.setData({ list ,page}); - } else { - const list2 = this.data.list.concat(list); - this.setData({ list: list2,page }); - } - }); - }, - loadMore() { - const { page, listEndText } = this.data; - if (listEndText == '点击加载更多。。。') { - this.fetchList(page + 1); - } - }, - goDetail(e) { - const { id } = e.currentTarget.dataset; - wx.navigateTo({ - url: `/pages/detail/detail?id=${id}` - }); - }, - refresh() { - this.fetchList(1); - wx.showToast({ icon: 'none', title: '刷新成功' }); - }, - // 下拉刷新 - onPullDownRefresh() { - this.init(); - wx.stopPullDownRefresh(); - }, -}); diff --git a/pages/news_list/home.json b/pages/news_list/home.json deleted file mode 100644 index f42b6d5..0000000 --- a/pages/news_list/home.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "navigationBarTitleText": "发现", - "backgroundTextStyle": "light", - "usingComponents": { - "t-icon": "tdesign-miniprogram/icon/icon", - "t-image": "tdesign-miniprogram/image/image", - "t-divider": "tdesign-miniprogram/divider/divider", - "t-footer": "tdesign-miniprogram/footer/footer" - } -} \ No newline at end of file diff --git a/pages/news_list/home.less b/pages/news_list/home.less deleted file mode 100644 index 2f55659..0000000 --- a/pages/news_list/home.less +++ /dev/null @@ -1,95 +0,0 @@ -page { - box-sizing: border-box; - background-color: linear-gradient(180deg, #f0f4fc, #fff); - padding: 0 20rpx; - padding-top: 10rpx; - padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx); -} - -.title_bar { - display: flex; - align-items: center; - justify-content: space-between; - margin-top: 32rpx; -} - -.title_bar .title { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; - // background: url('http://cdn.zhonganonline.top/newslist/static/title.png') no-repeat; - background-position: left center; - background-size: 100% 100%; - font-size: 32rpx; - height: 34rpx; - width: 132rpx; -} - - -.title_bar .btn { - color: #71737b; - font-size: 28rpx; - display: flex; - align-items: center; -} - -.title_bar .btn .t-icon { - margin-right: 10rpx; -} - -.list { - margin-top: 20rpx; -} - -.list .item .item-main { - display: flex; -} - -.list .item .item-main .right { - flex: 1; - padding-left: 32rpx; -} - -.list .item .item-main .right .text { - padding-top: 0rpx; - font-size: 28rpx; - line-height: 46rpx; - margin-bottom: 10rpx; - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; - overflow: hidden; - text-overflow: ellipsis; - color: #363a44; - -} - -.list .item .item-main .right .info { - display: flex; - font-size: 24rpx; - justify-content: space-between; - color: #71737b; -} - -.list .item .item-main .right .info .viewcnt { - display: flex; - align-items: center; -} - -.list .item .viewcnt .t-icon { - margin-right: 10rpx; -} - -.t-tab-bar { - border-top: 1px solid #eee; - position: relative; -} - -.activity { - display: flex; - justify-content: space-between; - padding: 20rpx 0; - border-bottom: 1px solid #eee; - - .t-image { - width: 100%; - } -} \ No newline at end of file diff --git a/pages/news_list/home.wxml b/pages/news_list/home.wxml deleted file mode 100644 index 5d68466..0000000 --- a/pages/news_list/home.wxml +++ /dev/null @@ -1,28 +0,0 @@ - - - 最新动态 - - - 刷新 - - - - - - - - {{item.title}} - - {{item.create_time}} - - - {{item.view_cnt}} - - - - - - - - - \ No newline at end of file diff --git a/pages/news_list/home.wxss b/pages/news_list/home.wxss deleted file mode 100644 index 47510fc..0000000 --- a/pages/news_list/home.wxss +++ /dev/null @@ -1,78 +0,0 @@ -page { - box-sizing: border-box; - background-color: linear-gradient(180deg, #f0f4fc, #fff); - padding: 0 20rpx; - padding-top: 10rpx; - padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx); -} -.title_bar { - display: flex; - align-items: center; - justify-content: space-between; - margin-top: 32rpx; -} -.title_bar .title { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; - background-position: left center; - background-size: 100% 100%; - font-size: 32rpx; - height: 34rpx; - width: 132rpx; -} -.title_bar .btn { - color: #71737b; - font-size: 28rpx; - display: flex; - align-items: center; -} -.title_bar .btn .t-icon { - margin-right: 10rpx; -} -.list { - margin-top: 20rpx; -} -.list .item .item-main { - display: flex; -} -.list .item .item-main .right { - flex: 1; - padding-left: 32rpx; -} -.list .item .item-main .right .text { - padding-top: 0rpx; - font-size: 28rpx; - line-height: 46rpx; - margin-bottom: 10rpx; - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; - overflow: hidden; - text-overflow: ellipsis; - color: #363a44; -} -.list .item .item-main .right .info { - display: flex; - font-size: 24rpx; - justify-content: space-between; - color: #71737b; -} -.list .item .item-main .right .info .viewcnt { - display: flex; - align-items: center; -} -.list .item .viewcnt .t-icon { - margin-right: 10rpx; -} -.t-tab-bar { - border-top: 1px solid #eee; - position: relative; -} -.activity { - display: flex; - justify-content: space-between; - padding: 20rpx 0; - border-bottom: 1px solid #eee; -} -.activity .t-image { - width: 100%; -} diff --git a/pages/news_list/readme b/pages/news_list/readme deleted file mode 100644 index fcf75d5..0000000 --- a/pages/news_list/readme +++ /dev/null @@ -1,8 +0,0 @@ -首页功能设定 -1. loading入场 -2. 下拉刷新 -3. 搜索栏 -4. 分类切换 -5. 商品列表 -6. 规格弹层 -7. 加载更多 \ No newline at end of file diff --git a/pages/pay/pay.js b/pages/pay/pay.js deleted file mode 100644 index c79582f..0000000 --- a/pages/pay/pay.js +++ /dev/null @@ -1,39 +0,0 @@ -import R from '../../utils/request'; -import C from '../../utils/constant'; -import * as F from '../../utils/func'; -Page({ - data: { - - }, - onLoad(options) { - const { order_no, redirect_url } = options; - - R.post('/index.php/api/v1/pay_order_shop', { order_no }).then(({ model }) => { - wx.requestPayment({ - ...model, - success(res) { - wx.showToast({ - title: '支付成功', - icon: 'success', - duration: 2000, - success() { - wx.redirectTo({ - url: '/pages/shop/shop?path=user', - }); - } - }) - }, - fail(res) { - wx.showToast({ - title: '支付失败', - icon: 'none', - duration: 2000 - }) - wx.redirectTo({ - url: '/pages/shop/shop?path=user', - }); - } - }) - }) - }, -}) \ No newline at end of file diff --git a/pages/pay/pay.json b/pages/pay/pay.json deleted file mode 100644 index 37df5a9..0000000 --- a/pages/pay/pay.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "navigationBarTitleText": "支付", - "backgroundTextStyle": "light", - "usingComponents": {} -} \ No newline at end of file diff --git a/pages/pay/pay.wxml b/pages/pay/pay.wxml deleted file mode 100644 index fd8db04..0000000 --- a/pages/pay/pay.wxml +++ /dev/null @@ -1 +0,0 @@ -支付中... \ No newline at end of file diff --git a/pages/pay/pay.wxss b/pages/pay/pay.wxss deleted file mode 100644 index 8a92a43..0000000 --- a/pages/pay/pay.wxss +++ /dev/null @@ -1,4 +0,0 @@ -.tip { - text-align: center; - margin-top: 20px; -} \ No newline at end of file diff --git a/pages/paylist/paylist.js b/pages/paylist/paylist.js deleted file mode 100644 index 17849d3..0000000 --- a/pages/paylist/paylist.js +++ /dev/null @@ -1,105 +0,0 @@ -import R from '../../utils/request'; -import C from '../../utils/constant'; -import * as F from '../../utils/func'; -Page({ - - data: { - cdnHost: C.cdnHost, - list: [], - page: 1, - status: '', - // money_flag: 'send', - listEndText: '', - }, - onLoad(options) { - const {from} = options; - if(from == 'sharebuy') { - R.post('/index.php/api/v1/configs',{ks:['payed_tip','payed_vip_link']}).then(({model})=>{ - if(model.payed_tip && model.payed_vip_link) { - wx.showModal({ - title: '提示', - content: model.payed_tip, - complete: (res) => { - if (res.confirm) { - wx.navigateTo({ - url: '/pages/webview/webview?url=' + encodeURIComponent(model.payed_vip_link), - }) - } - } - }) - } - - }) - } - this.fetchList(1); - }, - goDetail(e) { - const { detail } = e.currentTarget.dataset; - if (!detail.phone && detail.status == 'payed') { - wx.navigateTo({ - url: `/pages/sharebuy/sharebuy?id=${detail.share_id}&orderNo=${detail.order_no}`, - }); - } - }, - fetchList(page) { - const { status } = this.data; - // money_flag - R.get('/index.php/api/v1/order_list', { page }).then(({ model }) => { - const list = []; - model.forEach(item => { - list.push({ - ...item, - price: F.formatePrice(item.price), - }); - }); - if (list.length == 0) { - this.setData({ listEndText: '没有更多了' }); - } else { - this.setData({ listEndText: '点击加载更多。。。' }); - } - if (page == 1) { - this.setData({ list,page }); - } else { - const list2 = this.data.list.concat(list); - this.setData({ list: list2,page }); - } - }); - // for (let i = 0; i < 20; i++) { - // list.push({ - // id: i, - // title: '自动热重载] 已开启代码文件保存后自动热重载自动热重载] 已开启代码文件保存后自动热重载', - // image: `${imageCdn}/swiper2.png`, - // createTime: '09-12 12:21', - // viewCnt: 1922 + i, - // }); - // } - // this.setData({ - // list - // }) - }, - loadMore() { - const { page, listEndText } = this.data; - if (listEndText == '点击加载更多。。。') { - this.fetchList(page + 1); - } - }, - onTabsChange(event) { - const v = event.detail.value; - this.data.status = v; - this.fetchList(1); - }, - // handleSwitchChange(e) { - // const { value } = e.detail; - // if (value) { - // this.data.money_flag = 'send'; - // } else { - // this.data.money_flag = ''; - // } - // this.fetchList(1); - // }, - onReachBottom() { - this.loadMore(); - }, - onShareAppMessage() { - } -}) \ No newline at end of file diff --git a/pages/paylist/paylist.json b/pages/paylist/paylist.json deleted file mode 100644 index 9d00d9d..0000000 --- a/pages/paylist/paylist.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "navigationBarTitleText": "我的订单", - "backgroundTextStyle": "light", - "usingComponents": { - "t-tabs": "tdesign-miniprogram/tabs/tabs", - "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel", - "t-image": "tdesign-miniprogram/image/image", - "t-sticky": "tdesign-miniprogram/sticky/sticky", - "t-divider": "tdesign-miniprogram/divider/divider", - "t-footer": "tdesign-miniprogram/footer/footer" - } -} \ No newline at end of file diff --git a/pages/paylist/paylist.wxml b/pages/paylist/paylist.wxml deleted file mode 100644 index df03ff2..0000000 --- a/pages/paylist/paylist.wxml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - 订单号: {{item.order_no || '-'}} - {{item.price}}元 - - - {{item.buy_type}} - 补充信息{{' >'}} - - - 信息: {{item.name || '暂无'}} {{item.phone}} - {{item.buy_type}} - - - 支付时间: {{item.pay_time}} - 订单时间: {{item.create_time}} - - - 已支付 - 待支付 - - - - - - - \ No newline at end of file diff --git a/pages/paylist/paylist.wxss b/pages/paylist/paylist.wxss deleted file mode 100644 index 1197a3b..0000000 --- a/pages/paylist/paylist.wxss +++ /dev/null @@ -1,76 +0,0 @@ -page { - padding: 0 20rpx; - background-color: rgb(245, 246, 247); -} -.sw { - width: 240rpx; - display: flex; - align-items: center; - font-size: 32rpx; -} - -.sw .txt { - padding-left: 16rpx; -} - - -.list { - margin-top: 20rpx; - padding-bottom: 60rpx; -} - -.list .item { - border-radius: 16rpx; - background-color: #fff; - margin-bottom: 20rpx; - width: 710rpx; - padding-top: 20rpx; -} - -.list .item .item-main { - display: flex; - padding-left: 20rpx; -} - -.list .item .item-main .right { - flex: 1; - padding: 0 32rpx; - padding-bottom: 20rpx; -} - -.list .item .item-main .right .text { - display: flex; - font-size: 28rpx; - justify-content: space-between; - color: #333; -} - -.list .item .item-main .right .info { - display: flex; - font-size: 24rpx; - justify-content: space-between; - color: #8f9197; - line-height: 36rpx; -} - -.list .item .item-main .right .info .viewcnt { - display: flex; - align-items: center; - padding: 0 20rpx; -} - -.list .item .item-main .right .info .viewcnt.init { - color: blue; -} - -.list .item .item-main .right .info .viewcnt.resolve { - color: green; -} - -.list .item .item-main .right .info .viewcnt.reject { - color: gray; -} - -.list .item .h20 { - height: 20rpx; -} diff --git a/pages/sharebuy/sharebuy.js b/pages/sharebuy/sharebuy.js deleted file mode 100644 index ad9d043..0000000 --- a/pages/sharebuy/sharebuy.js +++ /dev/null @@ -1,141 +0,0 @@ -import C from '../../utils/constant'; -import * as F from '../../utils/func'; -import R from '../../utils/request'; -Page({ - data: { - expireDate: '', - price: '', - shareId: '', - isPay: false, - orderNo: '', - phone: '', - username: '', - tip_before_pay: '', - tip_after_pay: '', - buy_type: '', - }, - onLoad(options) { - const { id, orderNo } = options; - if (orderNo) { - this.setData({ - isPay: true, - orderNo, - }) - this.fetchOrder(orderNo); - } else { - R.get('/index.php/api/v1/get_share', { id }).then(({ model }) => { - this.setData({ - shareId: id, - price: F.formatePrice(model.price), - expireDate: model.expire_time, - tip_before_pay: model.tip_before_pay || '', - tip_after_pay: model.tip_after_pay || '', - buy_type: model.buy_type, - }); - }).catch((e)=>{ - console.log('xxx',e); - }) - R.get('/index.php/api/v1/view_share', { id }); - } - }, - refresh() { - if (this.data.orderNo) { - this.fetchOrder(this.data.orderNo); - } - }, - fetchOrder(orderNo) { - const that = this; - return R.get('/index.php/api/v1/fetch_order_pay', { order_no: orderNo }).then(({ model }) => { - console.log('payed', model); - if (model.status === 'payed') { - clearInterval(that.data.timer); - wx.hideLoading(); - this.setData({ - isPay: true, - orderNo, - price: F.formatePrice(model.price), - buy_type: model.buy_type, - }); - } - }); - }, - checkOrderStatus(orderNo) { - wx.showLoading({ - title: '确认支付中...', - }) - this.data.timer = setInterval(() => { - this.fetchOrder(orderNo).catch(() => { - clearInterval(this.data.timer); - }); - }, 1000); - }, - goPay() { - const that = this; - if (this.data.shareId) { - R.post('/index.php/api/v1/make_order', { share_id: this.data.shareId }).then(({ model: { order_no } }) => { - that.data.orderNo = order_no; - R.post('/index.php/api/v1/pay_order', { order_no }).then(({ model }) => { - wx.requestPayment({ - ...model, - success(res) { - wx.showToast({ - title: '支付成功', - icon: 'success', - duration: 2000, - success() { - that.checkOrderStatus(order_no); - // this.setData({ - // isPay: true, - // }) - } - }) - }, - fail(res) { - wx.showToast({ - title: '您已取消支付', - icon: 'none', - duration: 2000 - }) - // wx.redirectTo({ - // url: '/pages/shop/shop?path=user', - // }); - } - }) - }) - }) - } - }, - onShareAppMessage() { - - }, - validate() { - const { username, phone, orderNo, } = this.data; - if (!username) { - wx.showToast({ title: '请输入姓名', icon: 'none' }); - return false; - } - if (!/^1\d{10}$/.test(phone)) { - wx.showToast({ title: '请输入正确的手机号', icon: 'none' }); - return false; - } - return true; - }, - submit() { - if (!this.validate()) return; - const { - username, phone, orderNo, - } = this.data - R.post('/index.php/api/v1/mark_order_info', { name: username, phone, order_no: orderNo, }).then(({ model }) => { - wx.showToast({ - title: '提交成功', - icon: 'success', - duration: 2000, - success() { - wx.redirectTo({ - url: '/pages/paylist/paylist?from=sharebuy', - }) - } - }); - }); - }, -}) \ No newline at end of file diff --git a/pages/sharebuy/sharebuy.json b/pages/sharebuy/sharebuy.json deleted file mode 100644 index dc8fabd..0000000 --- a/pages/sharebuy/sharebuy.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "navigationBarTitleText": "支付", - "backgroundTextStyle": "light", - "usingComponents": { - "t-cell": "tdesign-miniprogram/cell/cell", - "t-button": "tdesign-miniprogram/button/button", - "t-input": "tdesign-miniprogram/input/input" - } -} \ No newline at end of file diff --git a/pages/sharebuy/sharebuy.less b/pages/sharebuy/sharebuy.less deleted file mode 100644 index d180414..0000000 --- a/pages/sharebuy/sharebuy.less +++ /dev/null @@ -1,57 +0,0 @@ -page { - box-sizing: border-box; - background-color: linear-gradient(180deg, #f0f4fc, #fff); - padding: 0 20rpx; - padding-top: 10rpx; - padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx); -} - -.logo { - height: 180rpx; - width: 180rpx; - margin: 0 auto; - background-image: url('http://cdn.zhonganonline.top/liiistem/static/liii_icon.png'); - background-position: center; - background-repeat: no-repeat; - background-size: cover; -} - -.form { - background: #fff; - border-radius: 10rpx; - overflow: hidden; -} - -.footer { - margin-top: 40rpx; - padding: 0 20rpx; -} - -.card { - margin: 20rpx 0; - padding: 0 20rpx; - - .line { - font-size: 36rpx; - line-height: 60rpx; - } - - -} - -.ma { - height: 20rpx; -} - -.desc { - color: #666; - font-size: 28rpx; - margin-top: 20rpx; - line-height: 34rpx; -} - -.refresh{ - text-align: center; - margin-top: 20rpx; - color: #999; -} \ No newline at end of file diff --git a/pages/sharebuy/sharebuy.wxml b/pages/sharebuy/sharebuy.wxml deleted file mode 100644 index 4a7d0a4..0000000 --- a/pages/sharebuy/sharebuy.wxml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - 立即付款 - 已支付? 手动刷新 - - - - - - - - - - - - - - - - - - - - 提交 - - - - - - - \ No newline at end of file diff --git a/pages/sharebuy/sharebuy.wxss b/pages/sharebuy/sharebuy.wxss deleted file mode 100644 index d2e4ad3..0000000 --- a/pages/sharebuy/sharebuy.wxss +++ /dev/null @@ -1,48 +0,0 @@ -page { - box-sizing: border-box; - background-color: linear-gradient(180deg, #f0f4fc, #fff); - padding: 0 20rpx; - padding-top: 10rpx; - padding-bottom: calc(env(safe-area-inset-bottom) + 106rpx); -} -.logo { - height: 180rpx; - width: 180rpx; - margin: 0 auto; - background-image: url('http://cdn.zhonganonline.top/liiistem/static/liii_icon.png'); - background-position: center; - background-repeat: no-repeat; - background-size: cover; -} -.form { - background: #fff; - border-radius: 10rpx; - overflow: hidden; -} -.footer { - margin-top: 40rpx; - padding: 0 20rpx; -} -.card { - margin: 20rpx 0; - padding: 0 20rpx; -} -.card .line { - font-size: 36rpx; - line-height: 60rpx; -} -.ma { - height: 20rpx; -} -.desc { - color: #666; - font-size: 28rpx; - margin-top: 20rpx; - line-height: 34rpx; -} - -.refresh{ - text-align: center; - margin-top: 20rpx; - color: #999; -} \ No newline at end of file diff --git a/pages/sharelist/sharelist.js b/pages/sharelist/sharelist.js deleted file mode 100644 index 4267eb5..0000000 --- a/pages/sharelist/sharelist.js +++ /dev/null @@ -1,77 +0,0 @@ -import R from '../../utils/request'; -import C from '../../utils/constant'; -import * as F from '../../utils/func'; -Page({ - - data: { - cdnHost: C.cdnHost, - list: [], - page: 1, - status: '', - // money_flag: 'send', - listEndText: '', - }, - onLoad(options) { - this.fetchList(1); - }, - goDel(e) { - const {detail,index} =e.currentTarget.dataset; - if(detail.deleted == 1) return; - const {id}=detail; - wx.showModal({ - title: '提示', - content: '置为失效后无法恢复,确认继续吗?', - complete: (res) => { - if (res.cancel) { - - } - - if (res.confirm) { - R.post('/index.php/api/v1/del_share',{id}).then(()=>{ - const {list} = this.data; - this.setData({ - [`list[${index}]`] : { - ...list[index], - deleted:1, - }, - }); - }) - } - } - }) - }, - fetchList(page) { - const { status } = this.data; - // money_flag - R.get('/index.php/api/v1/share_link_list', { page }).then(({ model }) => { - const list = []; - model.forEach(item => { - list.push({ - ...item, - price: F.formatePrice(item.price), - expire_time: item.expire_time.split(' ')[0], - }); - }); - if (list.length == 0) { - this.setData({ listEndText: '没有更多了' }); - } else { - this.setData({ listEndText: '点击加载更多。。。' }); - } - if (page == 1) { - this.setData({ list,page }); - } else { - const list2 = this.data.list.concat(list); - this.setData({ list: list2 ,page}); - } - }); - }, - loadMore() { - const { page, listEndText } = this.data; - if (listEndText == '点击加载更多。。。') { - this.fetchList(page + 1); - } - }, - onReachBottom() { - this.loadMore(); - }, -}) \ No newline at end of file diff --git a/pages/sharelist/sharelist.json b/pages/sharelist/sharelist.json deleted file mode 100644 index 223d04a..0000000 --- a/pages/sharelist/sharelist.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "navigationBarTitleText": "进行中的分销", - "backgroundTextStyle": "light", - "usingComponents": { - "t-tabs": "tdesign-miniprogram/tabs/tabs", - "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel", - "t-image": "tdesign-miniprogram/image/image", - "t-sticky": "tdesign-miniprogram/sticky/sticky", - "t-divider": "tdesign-miniprogram/divider/divider", - "t-footer": "tdesign-miniprogram/footer/footer" - } -} \ No newline at end of file diff --git a/pages/sharelist/sharelist.wxml b/pages/sharelist/sharelist.wxml deleted file mode 100644 index 9f812c8..0000000 --- a/pages/sharelist/sharelist.wxml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - {{item.buy_type || '-'}} - {{item.price}}元 - - - - 置为失效 - - - 创建: {{item.create_time}} - 截止: {{item.expire_time}} - - - - - - - \ No newline at end of file diff --git a/pages/sharelist/sharelist.wxss b/pages/sharelist/sharelist.wxss deleted file mode 100644 index 1197a3b..0000000 --- a/pages/sharelist/sharelist.wxss +++ /dev/null @@ -1,76 +0,0 @@ -page { - padding: 0 20rpx; - background-color: rgb(245, 246, 247); -} -.sw { - width: 240rpx; - display: flex; - align-items: center; - font-size: 32rpx; -} - -.sw .txt { - padding-left: 16rpx; -} - - -.list { - margin-top: 20rpx; - padding-bottom: 60rpx; -} - -.list .item { - border-radius: 16rpx; - background-color: #fff; - margin-bottom: 20rpx; - width: 710rpx; - padding-top: 20rpx; -} - -.list .item .item-main { - display: flex; - padding-left: 20rpx; -} - -.list .item .item-main .right { - flex: 1; - padding: 0 32rpx; - padding-bottom: 20rpx; -} - -.list .item .item-main .right .text { - display: flex; - font-size: 28rpx; - justify-content: space-between; - color: #333; -} - -.list .item .item-main .right .info { - display: flex; - font-size: 24rpx; - justify-content: space-between; - color: #8f9197; - line-height: 36rpx; -} - -.list .item .item-main .right .info .viewcnt { - display: flex; - align-items: center; - padding: 0 20rpx; -} - -.list .item .item-main .right .info .viewcnt.init { - color: blue; -} - -.list .item .item-main .right .info .viewcnt.resolve { - color: green; -} - -.list .item .item-main .right .info .viewcnt.reject { - color: gray; -} - -.list .item .h20 { - height: 20rpx; -} diff --git a/pages/shop/shop.js b/pages/shop/shop.js deleted file mode 100644 index c85dc3e..0000000 --- a/pages/shop/shop.js +++ /dev/null @@ -1,66 +0,0 @@ -// pages/shop/shop.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } -}) \ No newline at end of file diff --git a/pages/shop/shop.wxml b/pages/shop/shop.wxml deleted file mode 100644 index c4246cb..0000000 --- a/pages/shop/shop.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -pages/shop/shop.wxml \ No newline at end of file diff --git a/pages/takephoto/takephoto.js b/pages/takephoto/takephoto.js deleted file mode 100644 index 40675e7..0000000 --- a/pages/takephoto/takephoto.js +++ /dev/null @@ -1,405 +0,0 @@ -import R from '../../utils/request'; -import C from '../../utils/constant'; -Page({ - data: { - cdnHost: C.cdnHost, - cdnHost: C.cdnHost, - title: '', - tel: '', - content: '', - shortAddress: '', - address: '', - video: '', - position: { - longitude: 0, - latitude: 0, - }, - ds: { - list: [], - refStatusNum: { finished: 0, failed: 0, process: 0 }, - }, - ts: { - refImgDescs: {}, - refImgKeywords: {}, - fileUploadList: [], - fileUploadList2: [], - isUploading: false, - timer: [], - }, - stop: false, - gridConfig: { - column: 4, - width: 160, - height: 160, - }, - config: { - count: 1, - }, - phoneError: false, - // - videoFileList: [], - }, - onLoad(options) { - const that = this; - R.get('/index.php/api/v1/my', {}).then(({ model }) => { - this.setData({ tel: model.phone }); - }); - wx.getFuzzyLocation({ - type: 'wgs84', - success(res) { - const longitude = res.longitude - const latitude = res.latitude - that.setData({ - position: { - longitude, - latitude, - }, - }); - R.get('/index.php/api/v1/gps', { lat: latitude, lon: longitude }).then(({ model }) => { - that.setData({ shortAddress: model.short_ad, address: model.full_ad }); - }); - } - }) - }, - onUnload() { - this.data.stop = true; - }, - onShareAppMessage() { - }, - choosePoi() { - const that = this; - wx.chooseLocation({ - success({ latitude, longitude, name, address }) { - that.setData({ - position: { - latitude, - longitude, - }, - shortAddress: name, - address, - }); - } - }) - }, - // - onPhoneInput(e) { - const { phoneError } = this.data; - const isPhoneNumber = /^[1][3,4,5,7,8,9][0-9]{9}$/.test(e.detail.value); - if (phoneError === isPhoneNumber) { - this.setData({ - phoneError: !isPhoneNumber, - }); - } - }, - onSubmit() { - console.log('this.stat', this.data); - const { title, tel, shortAddress, address, position, ds, content, videoFileList } = this.data; - if (ds.refStatusNum.failed > 0) { - wx.showToast({ - title: '请处理上传失败的图片', - icon: 'none', - }); - return; - } - if (ds.refStatusNum.process > 0) { - wx.showToast({ - title: '请等待图片上传完成', - icon: 'none', - }); - return; - } - // 每个属性都判空,并且给出toast提示 - if (!tel) { - wx.showToast({ - title: '请输入手机号', - icon: 'none', - }); - return; - } - if (!title) { - wx.showToast({ - title: '请输入标题', - icon: 'none', - }); - return; - } - if (!content) { - wx.showToast({ - title: '请输入您的发件信息', - icon: 'none', - }); - return; - } - if (!shortAddress) { - wx.showToast({ - title: '请选择位置', - icon: 'none', - }); - return; - } - if (ds.list.length === 0) { - wx.showToast({ - title: '请上传图片', - icon: 'none', - }); - return; - } - // 提交数据 - R.post('/index.php/api/v1/submit', { - title, - tel, - shortAddress, - address, - content, - longitude: position.longitude, - latitude: position.latitude, - imgs: ds.list.map((o) => o.path), - video: videoFileList && videoFileList.length > 0 ? videoFileList[0].path : undefined, - }).then(({ model }) => { - wx.showToast({ - title: '提交成功,感谢您的反馈', - icon: 'success', - }); - setTimeout(() => { - wx.navigateBack(); - }, 1000); - }); - }, - goBack() { - wx.navigateBack(); - }, - // - callStatusNum() { - const { ds } = this.data; - const s = { finished: 0, failed: 0, process: 0 }; - ds.list.forEach((o) => { - if (o.failed) s.failed++; - else if (o.finished) s.finished++; - else s.process++; - }); - this.setData({ - 'ds.refStatusNum': s, - }); - }, - imgHandleSuccess(e) { - console.log('imgHandleSuccess', e.detail); - // const { files } = e.detail; - // this.setData({ - // originFiles: files, - // }); - this.httpRequest(); - }, - imgHandleRemove(e) { - const { index } = e.detail; - console.log('imgHandleRemove', e.detail); - const { ds } = this.data; - ds.list.splice(index, 1); - this.setData({ - 'ds.list': ds.list, - }); - }, - imgHandleClick(e) { - console.log(e.detail.file); - }, - beforUpload(e) { - const { files } = e.detail; - console.log('beforUpload', files); - const { ts } = this.data; - const { fileUploadList, fileUploadList2 } = ts; - files.map((file) => { - fileUploadList.push(file); - fileUploadList2.push(file); - }) - this.setData({ - 'ts.fileUploadList': fileUploadList, - 'ts.fileUploadList2': fileUploadList2, - }); - }, - startPreview() { - console.log('startPreview'); - if (this.data.stop) return; - const { ts, ds } = this.data; - const { fileUploadList2 } = ts; - if (fileUploadList2.length > 0) { - const file = fileUploadList2.shift(); - ds.list.push({ - src: file.url, - url: file.url, - uid: file.name, - name: file.name, - percent: 0, - failed: false, - status: 'loading', - }) - this.setData({ - 'ts.fileUploadList2': fileUploadList2, - 'ds.list': ds.list, - }); - setTimeout(() => { - this.startPreview(); - }, 0); - } else { - setTimeout(() => { - this.startPreview(); - }, 2000); - } - }, - httpRequest(e) { - if (this.data.stop) return; - const { ts } = this.data; - if (ts.isUploading) return; - ts.isUploading = true; - console.log('httpRequest'); - // 循环检测 是否有文件可以上传 - setTimeout(() => { - this.uploadHandle(); - this.startPreview(); - }, 0); - }, - uploadHandle() { - console.log('uploadHandle'); - if (this.data.stop) return; - this.callStatusNum(); - const { ts, ds } = this.data; - const { fileUploadList } = ts; - if (fileUploadList.length > 0) { - console.log('fileUploadList', fileUploadList); - const file = fileUploadList.shift(); - // formData.append('imageData', file); - R.upload({ a: 1 }, 'img_file', file.url).catch((e) => e).then((response) => { - // console.log('response-response333', response); - ts.isUploading = false; - try { - response.data = JSON.parse(response.data); - } catch (error) { - response.data = null; - } - // console.log('asdfasd-response', response.data); - if (response.data && response.data.code == -1000) { - wx.showToast({ - title: '登录超时,请重新登录', - icon: 'none', - }); - setTimeout(() => { - wx.navigateTo({ url: '/pages/home/home' }); - }, 500) - return; - } - else if (response.data && response.data.success) { - console.log('asdfasd-response2222', response.data); - const { data: { model: { path } } } = response; - this.setData({ - 'ds.list': ds.list.map((o) => { - if (file.name == o.uid) { - return { ...o, path, finished: true, percent: 100, status: 'done' }; - } - return { ...o }; - }) - }); - // this.setData({ - // [`ds.list[${idx}].url`]: C.cdnHost + path, - // }); - // R.getImg(4, imageId).then((path) => { - // const tlist = this.data.ds.list; - // let idx = 0; - // // console.log('path', path); - // tlist.forEach((c, i) => { - // if (c.imageId == imageId) { - // idx = i; - // } - // }); - // if (idx) { - // this.setData({ - // [`ds.list[${idx}].url`]: path, - // }); - // } - // }) - // wx.showToast({ - // title: '图片:' + file.name + '已暂存', - // icon: 'success', - // }); - // this.saveTmpData(); - } else { - console.log(response, file.name); - let errorMsg = '上传失败,请移除后重试'; - // if (response.data && response.data.status == 529) { - // errorMsg = '其他图集中已存在,请移除'; - // } - this.setData({ - 'ds.list': ds.list.map((o) => { - if (file.name == o.uid) { - return { ...o, failed: errorMsg, status: 'failed' }; - } - return { ...o }; - }), - }); - wx.showToast({ - title: file.name + ',' + errorMsg, - icon: 'error', - }); - // this.saveTmpData(); - } - setTimeout(() => { - this.uploadHandle(); - }, 0); - }); - } else { - // setTimeout(() => { - // this.uploadHandle(); - // }, 2000); - } - }, - //video - handleVideoAdd(e) { - const { files } = e.detail; - files.forEach(file => this.uploadVideoFile(file)) - }, - uploadVideoFile(file) { - - wx.getVideoInfo({ src: file.url }).then((res) => { - if (res.duration > 180) { - wx.showToast({ - title: '视频时长不能超过3分钟', - icon: 'none', - }); - return; - } - - // - const { videoFileList } = this.data; - - this.setData({ - videoFileList: [...videoFileList, { ...file, path: '', status: 'loading' }], - }); - const { length } = videoFileList; - R.upload({ a: 2 }, 'video_file', file.url, (res) => { - this.setData({ - [`videoFileList[${length}].percent`]: res.progress, - }); - }).catch((e) => e).then((response) => { - try { - response.data = JSON.parse(response.data); - } catch (error) { - response.data = null; - } - if (response.data && response.data.success) { - const { data: { model: { path } } } = response; - console.log('asdfasd-response2222', response.data, this.data.videoFileList, length); - this.setData({ - [`videoFileList[${length}].status`]: 'done', - [`videoFileList[${length}].path`]: path, - }); - } - }); - }); - }, - handleVideoRemove(e) { - const { index } = e.detail; - const { videoFileList } = this.data; - - videoFileList.splice(index, 1); - this.setData({ - videoFileList, - }); - }, -}) \ No newline at end of file diff --git a/pages/takephoto/takephoto.json b/pages/takephoto/takephoto.json deleted file mode 100644 index 9163b8e..0000000 --- a/pages/takephoto/takephoto.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "navigationBarTitleText": "有发现", - "backgroundTextStyle": "light", - "usingComponents": { - "t-image": "tdesign-miniprogram/image/image", - "t-input": "tdesign-miniprogram/input/input", - "t-cell": "tdesign-miniprogram/cell/cell", - "t-icon": "tdesign-miniprogram/icon/icon", - "t-notice-bar": "tdesign-miniprogram/notice-bar/notice-bar", - "t-upload": "tdesign-miniprogram/upload/upload", - "t-button": "tdesign-miniprogram/button/button", - "t-textarea": "tdesign-miniprogram/textarea/textarea" - } -} \ No newline at end of file diff --git a/pages/takephoto/takephoto.wxml b/pages/takephoto/takephoto.wxml deleted file mode 100644 index e317174..0000000 --- a/pages/takephoto/takephoto.wxml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - {{shortAddress}} - - - 修正位置 - - - - - - - 确认发布 - 取消 - - \ No newline at end of file diff --git a/pages/takephoto/takephoto.wxss b/pages/takephoto/takephoto.wxss deleted file mode 100644 index 51785dc..0000000 --- a/pages/takephoto/takephoto.wxss +++ /dev/null @@ -1,93 +0,0 @@ -page { - background-color: rgb(245, 246, 247); -} - -.img { - font-size: 12rpx; - width: 750rpx; - margin: 0 auto; - height: 530rpx; - display: block; -} - -.form { - margin: 0 20rpx; - border-radius: 4px; - background-color: #fff; - margin-top: -100rpx; - border-radius: 4px; -} - -.form .t-input__label { - position: relative; -} - -.form .t-input__label::after { - display: block; - content: '*'; - color: #f00; - position: absolute; - font-size: 40rpx; - right: -30rpx; - top: 0; -} - -.form .photos .t-image { - margin-left: 20rpx; - margin-bottom: 20rpx; -} - -.t-textarea__wrapper { - background-color: rgb(245, 246, 247); - border: 16rpx; -} - -.t-textarea__wrapper .t-textarea__wrapper-inner { - padding: 16rpx; - border: 16rpx; -} - - - -.local_bar { - display: flex; - align-items: center; - justify-content: space-between; - padding: 0 40rpx; - border-bottom: 10px solid #fff; -} - -.local_bar .t-icon { - margin-right: 10rpx; -} - -.local_bar .local { - display: flex; - font-size: 24rpx; - align-items: center; - color: #333; -} - -.local_bar .btn { - display: flex; - font-size: 24rpx; - align-items: center; - color: blue; -} - -.t-notice-bar { - background: none !important; -} - -.btns { - padding: 0 40rpx; - padding-bottom: 90rpx; -} - -.btns .t-button { - margin-bottom: 20rpx; -} - -.t-upload .t-grid__content .t-grid-item { - width: auto !important; -} \ No newline at end of file diff --git a/pages/test/test.js b/pages/test/test.js deleted file mode 100644 index 7418ae9..0000000 --- a/pages/test/test.js +++ /dev/null @@ -1,66 +0,0 @@ -// pages/test/test.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } -}) \ No newline at end of file diff --git a/pages/test/test.wxml b/pages/test/test.wxml deleted file mode 100644 index 42a34de..0000000 --- a/pages/test/test.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -pages/test/test.wxml \ No newline at end of file diff --git a/pages/usercenter/components/user-center-card/index.js b/pages/usercenter/components/user-center-card/index.js deleted file mode 100644 index 47593c4..0000000 --- a/pages/usercenter/components/user-center-card/index.js +++ /dev/null @@ -1,35 +0,0 @@ -const AuthStepType = { - ONE: 1, - TWO: 2, - THREE: 3, -}; - -Component({ - options: { - multipleSlots: true, - }, - properties: { - currAuthStep: { - type: Number, - value: AuthStepType.ONE, - }, - userInfo: { - type: Object, - value: {}, - }, - isNeedGetUserInfo: { - type: Boolean, - value: false, - }, - }, - data: { - defaultAvatarUrl: - 'https://cdn-we-retail.ym.tencent.com/miniapp/usercenter/icon-user-center-avatar@2x.png', - AuthStepType, - }, - methods: { - gotoUserEditPage() { - this.triggerEvent('gotoUserEditPage'); - }, - }, -}); diff --git a/pages/usercenter/components/user-center-card/index.json b/pages/usercenter/components/user-center-card/index.json deleted file mode 100644 index e169f6f..0000000 --- a/pages/usercenter/components/user-center-card/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": { - "t-icon": "tdesign-miniprogram/icon/icon", - "t-avatar": "tdesign-miniprogram/avatar/avatar" - } -} \ No newline at end of file diff --git a/pages/usercenter/components/user-center-card/index.wxml b/pages/usercenter/components/user-center-card/index.wxml deleted file mode 100644 index 42dd0a5..0000000 --- a/pages/usercenter/components/user-center-card/index.wxml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - {{'请登录'}} - - - - - - - - {{userInfo.nickName || '微信用户'}} - - - - - - - - - - - - - - {{userInfo.nickName || '微信用户'}} - - - diff --git a/pages/usercenter/components/user-center-card/index.wxss b/pages/usercenter/components/user-center-card/index.wxss deleted file mode 100644 index f081f5f..0000000 --- a/pages/usercenter/components/user-center-card/index.wxss +++ /dev/null @@ -1,57 +0,0 @@ -.user-center-card { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 480rpx; - background-image: url('https://cdn-we-retail.ym.tencent.com/miniapp/template/user-center-bg-v1.png'); - background-size: cover; - background-repeat: no-repeat; - padding: 0 24rpx; -} -.user-center-card__header { - margin-top: 192rpx; - margin-bottom: 48rpx; - height: 96rpx; - line-height: 48rpx; - display: flex; - justify-content: flex-start; - align-items: center; - color: #333; - position: relative; -} -.user-center-card__header__avatar { - width: 96rpx; - height: 96rpx; - border-radius: 48rpx; - overflow: hidden; -} - -.user-center-card__header__name .name{ - font-size: 36rpx; - line-height: 48rpx; - color: #333; - font-weight: bold; - margin-left: 24rpx; - margin-right: 16rpx; -} -.user-center-card__header__name .score{ - font-size: 22rpx; - line-height: 38rpx; - color: #333; - margin-left: 24rpx; - margin-right: 16rpx; - display: flex; - align-items: center; -} -.user-center-card__header__transparent { - position: absolute; - right: 0; - top: 0; - background-color: transparent; - height: 100%; - width: 30%; -} -.user-center-card__icon { - line-height: 96rpx; -} diff --git a/pages/usercenter/index.js b/pages/usercenter/index.js deleted file mode 100644 index bcbfed9..0000000 --- a/pages/usercenter/index.js +++ /dev/null @@ -1,79 +0,0 @@ -import R from '../../utils/request'; -import C from '../../utils/constant'; -import * as F from '../../utils/func'; - -Page({ - data: { - cdnHost: C.cdnHost, - phone: '', - name: '', - price_sum: '', - share_cnt: '', - share_view_cnt: '', - is_share: false, - show_vip_link: false, - payed_vip_link: '', - }, - - onLoad() { - }, - - onShow() { - this.getTabBar().init(); - this.init(); - }, - onPullDownRefresh() { - this.init(); - }, - - init() { - this.fetUserInfoHandle(); - }, - - fetUserInfoHandle() { - R.get('/index.php/api/v1/my').then(({ model }) => { - this.setData({ - name: model.real_name || model.nick_name || '微信用户', - phone: model.phone || '-', - share_cnt: model.share_cnt, - share_view_cnt: model.share_view_cnt, - price_sum: F.formatePrice(model.price_sum || 0), - is_share: !!model.is_share, - show_vip_link: model.show_vip_link || false, - payed_vip_link: model.payed_vip_link || '', - }); - }) - }, - getPhoneNumber(e) { - console.log(e.detail.code) // 动态令牌 - console.log(e.detail.errMsg) // 回调信息(成功失败都会返回) - console.log(e.detail.errno) // 错误码(失败时返回) - if (!e.detail.errno) { - R.post('/index.php/api/v1/bind_auth_phone', { code: e.detail.code }).then(() => { - this.setData({ hasPhone: true }) - this.goH5Shop(); - }) - } else { - // e.detail.errMsg - } - }, - goShared() { - wx.switchTab({ - url: '/pages/faxianlist/faxianlist', - }) - }, - goOrder() { - wx.navigateTo({ url: '/pages/paylist/paylist' }) - }, - toVipLink() { - wx.navigateTo({ url: '/pages/webview/webview?url='+encodeURIComponent(this.data.payed_vip_link) }) - }, - goSharelist() { - wx.navigateTo({ url: '/pages/sharelist/sharelist' }) - }, - goInfo() { - wx.navigateTo({ - url: '/pages/usercenter/info', - }) - }, -}); \ No newline at end of file diff --git a/pages/usercenter/index.json b/pages/usercenter/index.json deleted file mode 100644 index 3dcbba7..0000000 --- a/pages/usercenter/index.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "navigationBarTitleText": "个人中心", - "usingComponents": { - "t-icon": "tdesign-miniprogram/icon/icon", - "t-link": "tdesign-miniprogram/link/link", - "t-cell": "tdesign-miniprogram/cell/cell" - }, - "enablePullDownRefresh": true -} \ No newline at end of file diff --git a/pages/usercenter/index.less b/pages/usercenter/index.less deleted file mode 100644 index 06345f1..0000000 --- a/pages/usercenter/index.less +++ /dev/null @@ -1,173 +0,0 @@ -page { - background-color: #f5f5f5; -} - -.header { - background-color: linear-gradient(180deg, #f0f4fc, #fff); - position: relative; - - background-color: rgba(255, 255, 255, 0.8); - box-sizing: border-box; - width: 90%; - margin: 0 auto; - margin-top: -300rpx; - border-radius: 10rpx; - margin-bottom: 20rpx; -} - -.header .info { - background-color: transparent; -} - -.header .info::after { - display: none; -} - -.header .avatar { - width: 96rpx; - height: 96rpx; - border-radius: 50%; - overflow: hidden; -} - -.cb { - top: 10rpx; - right: 100rpx; - height: 530rpx; - width: 750rpx; - background: url('http://cdn.zhonganonline.top/newslist/static/bg_take.jpeg?v=5') no-repeat; - background-position: center center; - background-size: 100% 100%; - z-index: 1; -} - -.vip { - background: linear-gradient(90deg, #f9e9bc, #f2d786); - border-radius: 20rpx; - height: 154rpx; - display: flex; - align-items: center; - justify-content: space-between; - padding: 0 40rpx; - width: 94%; - margin: 0 auto; - box-sizing: border-box; -} - -.vip .dest .a { - color: #775d2f; - font-size: 30rpx; -} - -.vip .dest .b { - color: #775d2f; - opacity: 0.8; - font-size: 22rpx; -} - -.vip .btn { - background-color: #fff; - color: #775d2f; - font-size: 24rpx; - height: 68rpx; - width: 164rpx; - border-radius: 34rpx; - display: flex; - align-items: center; - justify-content: center; -} - -.title_bar { - display: flex; - align-items: center; - justify-content: space-between; - margin-top: 32rpx; - width: 92%; - margin: 0 auto; -} - -.title_bar .title { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; - background-position: left center; - background-size: 100% 100%; - font-size: 32rpx; - color: rgb(53, 58, 71); - height: 34rpx; - width: 132rpx; -} - -.title_bar .btn { - color: #f09759; - font-size: 28rpx; - display: flex; - align-items: center; - background-color: #fff8e9; - padding: 10rpx 20rpx; - border-radius: 6rpx; -} - -.title_bar .btn .t-icon { - margin-right: 4rpx; -} - -.ma20 { - height: 20rpx; - background-color: #f5f5f5; - width: 100%; -} - -.cards_w { - background-color: #fff; - width: 94%; - border-radius: 6rpx; - margin: 0 auto; -} - -.cards_w .cards { - display: flex; - justify-content: space-between; - padding: 30rpx 0; -} - -.cards_w .cards .card { - width: 28%; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - background: none; - font-size: 0; - line-height: 24rpx; - - &::after { - display: none; - } -} - -.cards_w .cards .card .txt { - padding-top: 12rpx; - font-size: 24rpx; - color: #333; -} - -.cards_w .cards .card .txt2 { - padding-top: 12rpx; - font-size: 32rpx; - font-weight: bold; - color: #333; -} - -.cards_w .cards .card.hide { - opacity: 0; - pointer-events: none; -} - -.link { - display: flex; - justify-content: space-between; - padding: 30rpx 0; - width: 50%; - margin: 0 auto; - background-color: #fff; - border-radius: 6rpx; -} \ No newline at end of file diff --git a/pages/usercenter/index.wxml b/pages/usercenter/index.wxml deleted file mode 100644 index 8963305..0000000 --- a/pages/usercenter/index.wxml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - {{price_sum}}元 - 总收入 - - - - {{share_cnt}}次 - 总分享 - - - {{share_view_cnt}} - 分享浏览 - - - - - - - - - - - - \ No newline at end of file diff --git a/pages/usercenter/index.wxss b/pages/usercenter/index.wxss deleted file mode 100644 index 81b9885..0000000 --- a/pages/usercenter/index.wxss +++ /dev/null @@ -1,150 +0,0 @@ -page { - background-color: #f5f5f5; -} -.header { - background-color: linear-gradient(180deg, #f0f4fc, #fff); - position: relative; - background-color: rgba(255, 255, 255, 0.8); - box-sizing: border-box; - width: 90%; - margin: 0 auto; - margin-top: -300rpx; - border-radius: 10rpx; - margin-bottom: 20rpx; -} -.header .info { - background-color: transparent; -} -.header .info::after { - display: none; -} -.header .avatar { - width: 96rpx; - height: 96rpx; - border-radius: 50%; - overflow: hidden; -} -.cb { - top: 10rpx; - right: 100rpx; - height: 530rpx; - width: 750rpx; - background: url('http://cdn.zhonganonline.top/newslist/static/bg_take.jpeg?v=5') no-repeat; - background-position: center center; - background-size: 100% 100%; - z-index: 1; -} -.vip { - background: linear-gradient(90deg, #f9e9bc, #f2d786); - border-radius: 20rpx; - height: 154rpx; - display: flex; - align-items: center; - justify-content: space-between; - padding: 0 40rpx; - width: 94%; - margin: 0 auto; - box-sizing: border-box; -} -.vip .dest .a { - color: #775d2f; - font-size: 30rpx; -} -.vip .dest .b { - color: #775d2f; - opacity: 0.8; - font-size: 22rpx; -} -.vip .btn { - background-color: #fff; - color: #775d2f; - font-size: 24rpx; - height: 68rpx; - width: 164rpx; - border-radius: 34rpx; - display: flex; - align-items: center; - justify-content: center; -} -.title_bar { - display: flex; - align-items: center; - justify-content: space-between; - margin-top: 32rpx; - width: 92%; - margin: 0 auto; -} -.title_bar .title { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; - background-position: left center; - background-size: 100% 100%; - font-size: 32rpx; - color: #353a47; - height: 34rpx; - width: 132rpx; -} -.title_bar .btn { - color: #f09759; - font-size: 28rpx; - display: flex; - align-items: center; - background-color: #fff8e9; - padding: 10rpx 20rpx; - border-radius: 6rpx; -} -.title_bar .btn .t-icon { - margin-right: 4rpx; -} -.ma20 { - height: 20rpx; - background-color: #f5f5f5; - width: 100%; -} -.cards_w { - background-color: #fff; - width: 94%; - border-radius: 6rpx; - margin: 0 auto; -} -.cards_w .cards { - display: flex; - justify-content: space-between; - padding: 30rpx 0; -} -.cards_w .cards .card { - width: 28%; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - background: none; - font-size: 0; - line-height: 24rpx; -} -.cards_w .cards .card::after { - display: none; -} -.cards_w .cards .card .txt { - padding-top: 12rpx; - font-size: 24rpx; - color: #333; -} -.cards_w .cards .card .txt2 { - padding-top: 12rpx; - font-size: 32rpx; - font-weight: bold; - color: #333; -} -.cards_w .cards .card.hide { - opacity: 0; - pointer-events: none; -} -.link { - display: flex; - justify-content: space-between; - padding: 30rpx 0; - width: 50%; - margin: 0 auto; - background-color: #fff; - border-radius: 6rpx; -} diff --git a/pages/usercenter/info.js b/pages/usercenter/info.js deleted file mode 100644 index 02451ab..0000000 --- a/pages/usercenter/info.js +++ /dev/null @@ -1,31 +0,0 @@ -import R from '../../utils/request'; - - -Page({ - data: { - name: '', - }, - - onLoad() { - }, - - onShow() { - R.get('/index.php/api/v1/my').then(({ model }) => { - this.setData({ - name: model.real_name || model.nick_name || '微信用户', - }); - }) - }, - onSubmit(){ - if(!this.data.name.trim()){ - wx.showToast({ - title: '请填写姓名', - icon: 'none', - }); - return; - } - R.post('/index.php/api/v1/set_name',{name:this.data.name.trim()}).then(({ model }) => { - wx.navigateBack(); - }) - } -}); \ No newline at end of file diff --git a/pages/usercenter/info.json b/pages/usercenter/info.json deleted file mode 100644 index 8be5b4b..0000000 --- a/pages/usercenter/info.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "navigationBarTitleText": "个人信息", - "backgroundTextStyle": "light", - "usingComponents": { - "t-input": "tdesign-miniprogram/input/input", - "t-button": "tdesign-miniprogram/button/button" - } -} \ No newline at end of file diff --git a/pages/usercenter/info.wxml b/pages/usercenter/info.wxml deleted file mode 100644 index 7d57fc3..0000000 --- a/pages/usercenter/info.wxml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - 确认 - - \ No newline at end of file diff --git a/pages/usercenter/info.wxss b/pages/usercenter/info.wxss deleted file mode 100644 index 48e30df..0000000 --- a/pages/usercenter/info.wxss +++ /dev/null @@ -1,7 +0,0 @@ -page { - background-color: #f5f5f5; -} -.btns{ - padding: 20rpx 40rpx; - box-sizing: border-box; -} \ No newline at end of file diff --git a/pages/webview/webview.js b/pages/webview/webview.js deleted file mode 100644 index b3586b9..0000000 --- a/pages/webview/webview.js +++ /dev/null @@ -1,13 +0,0 @@ - -Page({ - data: { - url: '', - }, - onLoad(options) { - let { url } = options; - console.log('url',url); - const user_id = wx.getStorageSync('user_id'); - url = url.replace('${user_id}', user_id); - this.setData({ url: decodeURIComponent(url) }); - }, -}) \ No newline at end of file diff --git a/pages/webview/webview.json b/pages/webview/webview.json deleted file mode 100644 index 5acf6ef..0000000 --- a/pages/webview/webview.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "navigationBarTitleText": " ", - "backgroundTextStyle": "light", - "usingComponents": {} -} \ No newline at end of file diff --git a/pages/webview/webview.wxml b/pages/webview/webview.wxml deleted file mode 100644 index d3e700b..0000000 --- a/pages/webview/webview.wxml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pages/webview/webview.wxss b/pages/webview/webview.wxss deleted file mode 100644 index 229fba5..0000000 --- a/pages/webview/webview.wxss +++ /dev/null @@ -1 +0,0 @@ -/* pages/webview/webview.wxss */ \ No newline at end of file diff --git a/project.config.json b/project.config.json deleted file mode 100644 index fdae2cd..0000000 --- a/project.config.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", - "setting": { - "urlCheck": true, - "es6": true, - "enhance": true, - "postcss": true, - "preloadBackgroundData": false, - "minified": true, - "newFeature": false, - "coverView": true, - "nodeModules": true, - "autoAudits": false, - "showShadowRootInWxmlPanel": true, - "scopeDataCheck": false, - "uglifyFileName": false, - "checkInvalidKey": true, - "checkSiteMap": true, - "uploadWithSourceMap": true, - "compileHotReLoad": false, - "lazyloadPlaceholderEnable": false, - "useMultiFrameRuntime": true, - "ignoreDevUnusedFiles": false, - "babelSetting": { - "ignore": [], - "disablePlugins": [], - "outputPath": "" - }, - "enableEngineNative": false, - "useIsolateContext": true, - "userConfirmedBundleSwitch": false, - "packNpmManually": false, - "packNpmRelationList": [], - "minifyWXSS": true, - "disableUseStrict": false, - "minifyWXML": true, - "showES6CompileOption": false, - "useCompilerPlugins": false, - "ignoreUploadUnusedFiles": true, - "useStaticServer": true, - "compileWorklet": false, - "localPlugins": false, - "condition": false, - "swc": false, - "disableSWC": true - }, - "compileType": "miniprogram", - "simulatorType": "wechat", - "simulatorPluginLibVersion": {}, - "condition": { - "miniprogram": { - "list": [ - { - "name": "首页入口", - "pathName": "pages/home/home", - "query": "", - "scene": null - }, - { - "name": "示例页-个人中心", - "pathName": "pages/usercenter/index", - "query": "", - "scene": null - } - ] - } - }, - "editorSetting": { - "tabIndent": "insertSpaces", - "tabSize": 2 - }, - "packOptions": { - "ignore": [], - "include": [] - }, - "appid": "wx1a5ce23035f68f08", - "libVersion": "3.5.8" -} \ No newline at end of file diff --git a/pages/createpay/createpay.less b/public/.htaccess similarity index 100% rename from pages/createpay/createpay.less rename to public/.htaccess diff --git a/public/api.md b/public/api.md new file mode 100644 index 0000000..b033d60 --- /dev/null +++ b/public/api.md @@ -0,0 +1,97 @@ +## 获取现在的功能 +> POST /index.php/v1/goods_list + +|参数名|必须|类型|备注| +|:-|:-|:-|:-| +|无|-|-|-| + +返回值 +```json +[ + { + { + "id": 1, + "title": "照片上色", + "summary": "给照片上色", + "icon": "/upload/test.png", + "price": 1, // 价格,分,显示的时候要转成源 + "sort": 999, + "funct_name": "mark_order_zhaopianshangse", // 下单的时候调用的接口名 + }, + ... + } +] +``` + +## 下单照片上色 +> POST /index.php/v1/mark_order_zhaopianshangse + +|参数名|必须|类型|备注| +|:-|:-|:-|:-| +|goods_id|Y|int|goods_list接口返回的id| +|path|Y|string|wx_upload接口上传的图片返回的path| + +返回值 +```json +{ + "order_no":"Z1231231231231", // 订单号 +} +``` + +## 下单一寸照 +> POST /index.php/v1/mark_order_yiCunZhao + +|参数名|必须|类型|备注| +|:-|:-|:-|:-| +|goods_id|Y|int|goods_list接口返回的id| +|path|Y|string|wx_upload接口上传的图片返回的path| +|color|Y|enum|enum[blue,red,white],背景色| + +返回值 +```json +{ + "order_no":"Z1231231231231", // 订单号 +} +``` + +## 下单VIP +> POST /index.php/v1/mark_order_vip + +|参数名|必须|类型|备注| +|:-|:-|:-|:-| +|goods_id|Y|int|goods_list接口返回的id| +|num|Y|int|买几个月,默认是1| + +返回值 +```json +{ + "order_no":"Z1231231231231", // 订单号 +} +``` + + +## 查询订单状态 +> POST /index.php/v1/fetch_order + +|参数名|必须|类型|备注| +|:-|:-|:-|:-| +|order_no|Y|string|订单号| + +返回值 +```json +{ + "id": 2, + "user_id": 1, + "goods_id": 1, + "from_user_id": null, + "create_time": "2025-05-17 21:45:37", + "pay_time": null, + "status": "wait_pay", // 支付状态,wait_pay待付款,cancal取消,wait_refund,等待退款refund已退款 + "order_no": "Z5051721453701", + "price": 1, + "pay_wx_refund_data": null, + "deal_status": "init", // 任务处理状态,init待处理,ing处理中,done处理成功,fail处理失败 + "funct_name": "mark_order_zhaopianshangse", + "deal_result":"https://aluyun.com/a.jpg",// 处理结果,处理图片的,就返回图片下载路径,要及时获取,可能超时就获取不到图 +} +``` diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..e3c0fe9 --- /dev/null +++ b/public/index.php @@ -0,0 +1,24 @@ + +// +---------------------------------------------------------------------- + +// [ 应用入口文件 ] +namespace think; + +require __DIR__ . '/../vendor/autoload.php'; + +// 执行HTTP应用并响应 +$http = (new App())->http; + +$response = $http->run(); + +$response->send(); + +$http->end($response); diff --git a/public/nginx.htaccess b/public/nginx.htaccess new file mode 100644 index 0000000..e69de29 diff --git a/public/pma.php b/public/pma.php new file mode 100644 index 0000000..7475f6c --- /dev/null +++ b/public/pma.php @@ -0,0 +1,2044 @@ +$W){unset($vg[$y][$he]);if(is_array($W)){$vg[$y][stripslashes($he)]=$W;$vg[]=&$vg[$y][stripslashes($he)];}else$vg[$y][stripslashes($he)]=($Zc?$W:stripslashes($W));}}}}function +bracket_escape($u,$Pa=false){static$xi=array(':'=>':1',']'=>':2','['=>':3','"'=>':4');return +strtr($u,($Pa?array_flip($xi):$xi));}function +min_version($dj,$Ge="",$i=null){global$h;if(!$i)$i=$h;$qh=$i->server_info;if($Ge&&preg_match('~([\d.]+)-MariaDB~',$qh,$A)){$qh=$A[1];$dj=$Ge;}return(version_compare($qh,$dj)>=0);}function +charset($h){return(min_version("5.5.3",0,$h)?"utf8mb4":"utf8");}function +script($Ah,$wi="\n"){return"$Ah$wi";}function +script_src($Qi){return"\n";}function +nonce(){return' nonce="'.get_nonce().'"';}function +target_blank(){return' target="_blank" rel="noreferrer noopener"';}function +h($P){return +str_replace("\0","�",htmlspecialchars($P,ENT_QUOTES,'utf-8'));}function +nl_br($P){return +str_replace("\n","
",$P);}function +checkbox($B,$Y,$gb,$oe="",$xf="",$lb="",$pe=""){$H="".($xf?script("qsl('input').onclick = function () { $xf };",""):"");return($oe!=""||$lb?"$H".h($oe)."":$H);}function +optionlist($Cf,$kh=null,$Vi=false){$H="";foreach($Cf +as$he=>$W){$Df=array($he=>$W);if(is_array($W)){$H.='';$Df=$W;}foreach($Df +as$y=>$X)$H.=''.h($X);if(is_array($W))$H.='';}return$H;}function +html_select($B,$Cf,$Y="",$wf=true,$pe=""){if($wf)return"".(is_string($wf)?script("qsl('select').onchange = function () { $wf };",""):"");$H="";foreach($Cf +as$y=>$X)$H.="";return$H;}function +select_input($Ka,$Cf,$Y="",$wf="",$hg=""){$bi=($Cf?"select":"input");return"<$bi$Ka".($Cf?">