wugg 2 years ago
commit
227d658d77
53 changed files with 5508 additions and 0 deletions
  1. 6 0
      .gitignore
  2. 42 0
      .travis.yml
  3. 32 0
      LICENSE.txt
  4. 56 0
      README.md
  5. 1 0
      app/.htaccess
  6. 22 0
      app/AppService.php
  7. 94 0
      app/BaseController.php
  8. 58 0
      app/ExceptionHandle.php
  9. 8 0
      app/Request.php
  10. 45 0
      app/admin/BaseController.php
  11. 50 0
      app/admin/controller/Action.php
  12. 278 0
      app/admin/controller/Company.php
  13. 178 0
      app/admin/controller/Customer.php
  14. 202 0
      app/admin/controller/Group.php
  15. 297 0
      app/admin/controller/Menu.php
  16. 1099 0
      app/admin/controller/Payment.php
  17. 256 0
      app/admin/controller/Role.php
  18. 258 0
      app/admin/controller/Share.php
  19. 166 0
      app/admin/controller/Supplier.php
  20. 261 0
      app/admin/controller/User.php
  21. 85 0
      app/admin/controller/index.php
  22. 75 0
      app/admin/route/app.php
  23. 226 0
      app/common.php
  24. 17 0
      app/event.php
  25. 10 0
      app/middleware.php
  26. 9 0
      app/provider.php
  27. 9 0
      app/service.php
  28. 49 0
      composer.json
  29. 1174 0
      composer.lock
  30. 34 0
      config/app.php
  31. 29 0
      config/cache.php
  32. 9 0
      config/console.php
  33. 20 0
      config/cookie.php
  34. 63 0
      config/database.php
  35. 24 0
      config/filesystem.php
  36. 27 0
      config/lang.php
  37. 45 0
      config/log.php
  38. 8 0
      config/middleware.php
  39. 45 0
      config/route.php
  40. 19 0
      config/session.php
  41. 10 0
      config/trace.php
  42. 25 0
      config/view.php
  43. 2 0
      extend/.gitignore
  44. 8 0
      public/.htaccess
  45. BIN
      public/favicon.ico
  46. 24 0
      public/index.php
  47. 2 0
      public/robots.txt
  48. 19 0
      public/router.php
  49. 2 0
      public/static/.gitignore
  50. 17 0
      route/app.php
  51. 2 0
      runtime/.gitignore
  52. 10 0
      think
  53. 1 0
      view/README.md

+ 6 - 0
.gitignore

@@ -0,0 +1,6 @@
+/.idea
+/.vscode
+/vendor
+*.log
+.env
+/runtime

+ 42 - 0
.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

+ 32 - 0
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.

+ 56 - 0
README.md

@@ -0,0 +1,56 @@
+ThinkPHP 6.0
+===============
+
+> 运行环境要求PHP7.2+,兼容PHP8.1
+
+[官方应用服务市场](https://market.topthink.com) | [`ThinkAPI`——官方统一API服务](https://docs.topthink.com/think-api)
+
+ThinkPHPV6.0版本由[亿速云](https://www.yisu.com/)独家赞助发布。
+
+## 主要新特性
+
+* 采用`PHP7`强类型(严格模式)
+* 支持更多的`PSR`规范
+* 原生多应用支持
+* 更强大和易用的查询
+* 全新的事件系统
+* 模型事件和数据库事件统一纳入事件系统
+* 模板引擎分离出核心
+* 内部功能中间件化
+* SESSION/Cookie机制改进
+* 对Swoole以及协程支持改进
+* 对IDE更加友好
+* 统一和精简大量用法
+
+## 安装
+
+~~~
+composer create-project topthink/think tp 6.0.*
+~~~
+
+如果需要更新框架使用
+~~~
+composer update topthink/framework
+~~~
+
+## 文档
+
+[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content)
+
+## 参与开发
+
+请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)。
+
+## 版权信息
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+
+本项目包含的第三方源码和二进制文件之版权信息另行标注。
+
+版权所有Copyright © 2006-2021 by ThinkPHP (http://thinkphp.cn)
+
+All rights reserved。
+
+ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
+
+更多细节参阅 [LICENSE.txt](LICENSE.txt)

+ 1 - 0
app/.htaccess

@@ -0,0 +1 @@
+deny from all

+ 22 - 0
app/AppService.php

@@ -0,0 +1,22 @@
+<?php
+declare (strict_types = 1);
+
+namespace app;
+
+use think\Service;
+
+/**
+ * 应用服务类
+ */
+class AppService extends Service
+{
+    public function register()
+    {
+        // 服务注册
+    }
+
+    public function boot()
+    {
+        // 服务启动
+    }
+}

+ 94 - 0
app/BaseController.php

@@ -0,0 +1,94 @@
+<?php
+declare (strict_types = 1);
+
+namespace app;
+
+use think\App;
+use think\exception\ValidateException;
+use think\Validate;
+
+/**
+ * 控制器基础类
+ */
+abstract class BaseController
+{
+    /**
+     * Request实例
+     * @var \think\Request
+     */
+    protected $request;
+
+    /**
+     * 应用实例
+     * @var \think\App
+     */
+    protected $app;
+
+    /**
+     * 是否批量验证
+     * @var bool
+     */
+    protected $batchValidate = false;
+
+    /**
+     * 控制器中间件
+     * @var array
+     */
+    protected $middleware = [];
+
+    /**
+     * 构造方法
+     * @access public
+     * @param  App  $app  应用对象
+     */
+    public function __construct(App $app)
+    {
+        $this->app     = $app;
+        $this->request = $this->app->request;
+
+        // 控制器初始化
+        $this->initialize();
+    }
+
+    // 初始化
+    protected function initialize()
+    {}
+
+    /**
+     * 验证数据
+     * @access protected
+     * @param  array        $data     数据
+     * @param  string|array $validate 验证器名或者验证规则数组
+     * @param  array        $message  提示信息
+     * @param  bool         $batch    是否批量验证
+     * @return array|string|true
+     * @throws ValidateException
+     */
+    protected function validate(array $data, $validate, array $message = [], bool $batch = false)
+    {
+        if (is_array($validate)) {
+            $v = new Validate();
+            $v->rule($validate);
+        } else {
+            if (strpos($validate, '.')) {
+                // 支持场景
+                [$validate, $scene] = explode('.', $validate);
+            }
+            $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
+            $v     = new $class();
+            if (!empty($scene)) {
+                $v->scene($scene);
+            }
+        }
+
+        $v->message($message);
+
+        // 是否批量验证
+        if ($batch || $this->batchValidate) {
+            $v->batch(true);
+        }
+
+        return $v->failException(true)->check($data);
+    }
+
+}

+ 58 - 0
app/ExceptionHandle.php

@@ -0,0 +1,58 @@
+<?php
+namespace app;
+
+use think\db\exception\DataNotFoundException;
+use think\db\exception\ModelNotFoundException;
+use think\exception\Handle;
+use think\exception\HttpException;
+use think\exception\HttpResponseException;
+use think\exception\ValidateException;
+use think\Response;
+use Throwable;
+
+/**
+ * 应用异常处理类
+ */
+class ExceptionHandle extends Handle
+{
+    /**
+     * 不需要记录信息(日志)的异常类列表
+     * @var array
+     */
+    protected $ignoreReport = [
+        HttpException::class,
+        HttpResponseException::class,
+        ModelNotFoundException::class,
+        DataNotFoundException::class,
+        ValidateException::class,
+    ];
+
+    /**
+     * 记录异常信息(包括日志或者其它方式记录)
+     *
+     * @access public
+     * @param  Throwable $exception
+     * @return void
+     */
+    public function report(Throwable $exception): void
+    {
+        // 使用内置的方式记录异常日志
+        parent::report($exception);
+    }
+
+    /**
+     * Render an exception into an HTTP response.
+     *
+     * @access public
+     * @param \think\Request   $request
+     * @param Throwable $e
+     * @return Response
+     */
+    public function render($request, Throwable $e): Response
+    {
+        // 添加自定义异常处理机制
+
+        // 其他错误交给系统处理
+        return parent::render($request, $e);
+    }
+}

+ 8 - 0
app/Request.php

@@ -0,0 +1,8 @@
+<?php
+namespace app;
+
+// 应用请求对象类
+class Request extends \think\Request
+{
+
+}

+ 45 - 0
app/admin/BaseController.php

@@ -0,0 +1,45 @@
+<?php
+namespace  app\admin;
+use think\App;
+use app\BaseController as base;
+use think\facade\Db;
+/**
+* Class BaseController
+ * @package app\admin
+ * 基础控制器
+ */
+class BaseController extends base{
+    public  $post=[];
+    public  $uid='';
+    public  $uname='';
+    public  $roleid='';
+     public function __construct(App $app) {
+         parent::__construct($app);
+         $this->post =$this->request->post();
+         $this->validateToken();
+     }
+     /**
+    * @return \think\response\Json|void
+    * @throws \think\db\exception\DataNotFoundException
+    * @throws \think\db\exception\DbException
+    * @throws \think\db\exception\ModelNotFoundException
+    * @throws \think\exception\DbException
+     */
+     public function validateToken(){
+            $token = isset($this->post['token']) ? trim($this->post['token']) : "";
+            if($token==""){
+                return error_show(101,'token不能为空');
+            }
+            $effetc = VerifyTokens($token);
+            if(!empty($effetc) && $effetc['code']!=0) {
+                return error_show($effetc['code'], $effetc['message']);
+            }
+            $this->uid=isset($effetc['data']['user']['id']) ?$effetc['data']['user']['id']:"";
+            $this->uname=isset($effetc['data']['user']['nickname']) ?$effetc['data']['user']['nickname']:"";
+            $role = Db::name("user_role")->where(["uid"=>$this->uid,"is_del"=>0])->find();
+            if($role['status']==0){
+              return error_show(101,'账户已禁用');
+            }
+            $this->roleid=$role['roleid'];
+     }
+}

+ 50 - 0
app/admin/controller/Action.php

@@ -0,0 +1,50 @@
+<?php
+declare (strict_types = 1);
+namespace app\admin\controller;
+use app\admin\BaseController;
+use think\App;
+use think\facade\Db;
+
+class Action extends BaseController{
+    public function __construct(App $app) {parent::__construct($app);}
+
+    //获取素有菜单列表数据
+ public function index(){
+
+        $data = Db::name("admin_menu")->where(["pid"=>0,"status"=>1])->select();
+        $result = [];
+        if(empty($data)){
+            return app_show(0,"获取成功",$result);
+        }
+        foreach ($data as $key=>$val){
+            $val["child"]=[];
+            $result[$val['id']] =$val;
+        }
+
+        $child =Db::name("admin_menu")->where("pid","<>",0)->where('status',"=",1)->select();
+        foreach ($child as $k=>$value){
+            $act =Db::name("action")->alias("a")->leftJoin("cfp_action_list l","a.action_code=l.action_code")->field
+            ("a.*,action_name")->where(['a.menuid'=>$value['id'],"a.status"=>1])->select();
+            $act_data = Db::name("action_field")->where(['menuid'=>$value['id'],"status"=>1])->select();
+            $value['action'] = $act;
+            $value['action_data'] = $act_data;
+            if(array_key_exists($value['pid'],$result)){
+                $result[$value['pid']]["child"][]=$value;
+            }
+        }
+
+        return app_show(0,"获取成功",array_values($result));
+    }
+
+    public function ActionList(){
+        $page = isset($post['page']) ? intval($post['page']) : 1;
+        $size = isset($post['size']) ? intval($post['size']) : 10;
+
+        $count = Db::name("action_list")->count();
+        $total = ceil($count/$size)>1 ? ceil($count/$size) : 1;
+        $page = $page>=$total?intval($total):$page;
+        $list = Db::name("action_list")->page($page,$size)->select();
+        $data =['list'=>$list,"count"=>$count];
+        return app_show(0,'获取成功',$data);
+    }
+}

+ 278 - 0
app/admin/controller/Company.php

@@ -0,0 +1,278 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller;
+use app\admin\BaseController;
+use think\App;
+use think\facade\Db;
+
+
+class Company extends BaseController
+{
+    public function __construct(App $app) {parent::__construct($app);}
+    /**
+     * 显示资源列表
+     *
+     * @return \think\Response
+     */
+    public function Info()
+    {
+        $post  =$this->post;
+        $companyNo = isset($post['companyNo'])&& $post['companyNo']!="" ? trim($post['companyNo']) :"";
+        if($companyNo==""){
+            return error_show(1004,"参数companyNo 不能为空");
+        }
+        $company = Db::name("company_info")->where("companyNo","=",$companyNo)->find();
+        if(empty($company)){
+            return error_show(1004,"未找到对应的数据");
+        }
+        return app_show(0,"获取成功",$company);
+    }
+
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function create()
+    {
+        $post  =$this->post;
+        $companyNo = makeNo("GS");
+        $name = isset($post['company_name'])&&$post['company_name']!="" ? trim($post['company_name']) :"";
+        if($name==""){
+            return error_show(1004,"参数company_name 不能为空");
+        }
+        $title = isset($post['company_license'])&&$post['company_license']!="" ? trim($post['company_license']) :"";
+        if($title==""){
+            return error_show(1004,"参数company_license 不能为空");
+        }
+        $bank = isset($post['bank_name'])&&$post['bank_name']!="" ? trim($post['bank_name']) :"";
+        if($bank==""){
+            return error_show(1004,"参数bank_name 不能为空");
+        }
+        $bankNo = isset($post['bankNo'])&&$post['bankNo']!="" ? trim($post['bankNo']) :"";
+        if($bankNo==""){
+            return error_show(1004,"参数bankNo 不能为空");
+        }
+        $is_bank = Db::name("company_info")->where([["bankNo","=",$bankNo],["status","=",1]])->find();
+        if(!empty($is_bank)){
+            return error_show(1004,"银行卡号已存在!");
+        }
+        $address = isset($post['company_address'])&&$post['company_address']!="" ? trim($post['company_address']) :"";
+        if($address==""){
+            return error_show(1004,"参数company_address 不能为空");
+        }
+        $contector = isset($post['contector'])&&$post['contector']!="" ? trim($post['contector']) :"";
+        $mobile = isset($post['mobile'])&&$post['mobile']!="" ? trim($post['mobile']) :"";
+        $img = isset($post['company_img'])&&$post['company_img']!="" ? trim($post['company_img']) :"";
+        if($mobile!=""){
+            if(!checkTel($mobile)&&!checkMobile($mobile)){
+                return error_show(1004,"手机号/电话格式不正确");
+            }
+        }
+
+        $inputTicket = isset($post['input_ticket'])&&$post['input_ticket']!="" ? intval($post['input_ticket']) :"0";
+        if($inputTicket==""){
+             return error_show(1004,"进项票未设置验票方式");
+        }
+        $outTicket = isset($post['out_ticket'])&&$post['out_ticket']!="" ? intval($post['out_ticket']) :"0";
+        if($outTicket==""){
+             return error_show(1004,"销项票未设置验票方式");
+        }
+            $voider = isset($post['voider'])&&$post['voider']!="" ? trim($post['voider']) :"";
+            $payee = isset($post['payee'])&&$post['payee']!="" ? trim($post['payee']) :"";
+            $drawer = isset($post['drawer'])&&$post['drawer']!="" ? trim($post['drawer']) :"";
+            $reviewer = isset($post['reviewer'])&&$post['reviewer']!="" ? trim($post['reviewer']) :"";
+            $ownerPlace = isset($post['ownerPlace'])&&$post['ownerPlace']!="" ? trim($post['ownerPlace']) :"";
+            $denomination = isset($post['denomination'])&&$post['denomination']!="" ? trim($post['denomination']) :"";
+            $invoiceType = isset($post['invoiceType'])&&!empty($post['invoiceType']) ? implode(",", $post['invoiceType']):"";
+       $data = [
+           "companyNo"=>$companyNo,
+           "company_name"=>$name,
+           "company_address"=>$address,
+           "company_license"=>$title,
+           "bank_name"=>$bank,
+           "bankNo"=>$bankNo,
+           "contector"=>$contector,
+           "mobile"=>$mobile,
+           "company_img"=>$img,
+           "input_ticket"=>$inputTicket,
+           "out_ticket"=>$outTicket,
+           "voider"=>$voider,
+           "payee"=>$payee,
+           "drawer"=>$drawer,
+           "reviewer"=>$reviewer,
+           "ownerPlace"=>$ownerPlace,
+           "denomination"=>$denomination,
+           "invoiceType"=>$invoiceType,
+           "status"=>1,
+           "addtime"=>date("Y-m-d H:i:s"),
+           "updatetime"=>date("Y-m-d H:i:s")
+       ];
+       $result = Db::name("company_info")->insert($data);
+       return $result? app_show(0,"新建成功",["companyNo"=>$companyNo]):error_show(1005,"新建失败");
+    }
+
+    /**
+     * 保存新建的资源
+     *
+     * @param  \think\Request  $request
+     * @return \think\Response
+     */
+    public function save()
+    {
+          $post  =$this->post;
+        $companyNo = isset($post['companyNo'])&&$post['companyNo']!="" ? trim($post['companyNo']) :"";
+        if($companyNo==""){
+            return error_show(1004,"参数companyNo 不能为空");
+        }
+        $name = isset($post['company_name'])&&$post['company_name']!="" ? trim($post['company_name']) :"";
+        if($name==""){
+            return error_show(1004,"参数company_name 不能为空");
+        }
+        $title = isset($post['company_license'])&&$post['company_license']!="" ? trim($post['company_license']) :"";
+        if($title==""){
+            return error_show(1004,"参数company_license 不能为空");
+        }
+        $bank = isset($post['bank_name'])&&$post['bank_name']!="" ? trim($post['bank_name']) :"";
+        if($bank==""){
+            return error_show(1004,"参数bank_name 不能为空");
+        }
+        $bankNo = isset($post['bankNo'])&&$post['bankNo']!="" ? trim($post['bankNo']) :"";
+        if($bankNo==""){
+            return error_show(1004,"参数bankNo 不能为空");
+        }
+        $address = isset($post['company_address'])&&$post['company_address']!="" ? trim($post['company_address']) :"";
+        $contector = isset($post['contector'])&&$post['contector']!="" ? trim($post['contector']) :"";
+        $mobile = isset($post['mobile'])&&$post['mobile']!="" ? trim($post['mobile']) :"";
+        $img = isset($post['company_img'])&&$post['company_img']!="" ? trim($post['company_img']) :"";
+        if($mobile!=""){
+            if(!checkTel($mobile)&&!checkMobile($mobile)){
+                return error_show(1004,"手机号/电话格式不正确");
+            }
+        }
+           $inputTicket = isset($post['input_ticket'])&&$post['input_ticket']!="" ? intval($post['input_ticket']) :"0";
+        if($inputTicket==""){
+             return error_show(1004,"进项票未设置验票方式");
+        }
+        $outTicket = isset($post['out_ticket'])&&$post['out_ticket']!="" ? intval($post['out_ticket']) :"0";
+        if($outTicket==""){
+             return error_show(1004,"销项票未设置验票方式");
+        }
+            $voider = isset($post['voider'])&&$post['voider']!="" ? trim($post['voider']) :"";
+            $payee = isset($post['payee'])&&$post['payee']!="" ? trim($post['payee']) :"";
+            $drawer = isset($post['drawer'])&&$post['drawer']!="" ? trim($post['drawer']) :"";
+            $reviewer = isset($post['reviewer'])&&$post['reviewer']!="" ? trim($post['reviewer']) :"";
+            $ownerPlace = isset($post['ownerPlace'])&&$post['ownerPlace']!="" ? trim($post['ownerPlace']) :"";
+            $denomination = isset($post['denomination'])&&$post['denomination']!="" ? trim($post['denomination']) :"";
+            $invoiceType = isset($post['invoiceType'])&&!empty($post['invoiceType']) ? implode(",", $post['invoiceType']):"";
+        $data = [
+            "company_name"=>$name,
+            "company_address"=>$address,
+            "company_license"=>$title,
+            "bank_name"=>$bank,
+            "bankNo"=>$bankNo,
+            "contector"=>$contector,
+            "mobile"=>$mobile,
+            "company_img"=>$img,
+           "input_ticket"=>$inputTicket,
+           "out_ticket"=>$outTicket,
+           "voider"=>$voider,
+           "payee"=>$payee,
+           "drawer"=>$drawer,
+           "reviewer"=>$reviewer,
+           "ownerPlace"=>$ownerPlace,
+           "denomination"=>$denomination,
+           "invoiceType"=>$invoiceType,
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $result = Db::name("company_info")->where("companyNo","=",$companyNo)->update($data);
+        return $result? app_show(0,"更新成功"):error_show(1005,"更新失败");
+    }
+
+    /**
+     * 显示指定的资源
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function status()
+    {
+        $post  =$this->post;
+        $companyNo = isset($post['companyNo'])&&$post['companyNo']!="" ? trim($post['companyNo']) :"";
+        if($companyNo==""){
+            return error_show(1004,"参数companyNo 不能为空");
+        }
+        $status = isset($post['status'])&&$post['status']!="" ? trim($post['status']) :"";
+        if($status==""){
+            return error_show(1004,"参数status 不能为空");
+        }
+        if(!in_array($status,[0,1])){
+            return error_show(1004,"参数status 无效");
+        }
+        $message = $status==1 ?"启用" :"禁用";
+        $data = [
+            "status"=>$status,
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $result = Db::name("company_info")->where("companyNo","=",$companyNo)->update($data);
+        return $result? app_show(0,"{$message}成功"):error_show(1005,"{$message}失败");
+    }
+
+    /**
+     * 显示编辑资源表单页.
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function list()
+    {
+        $post  =$this->post;
+        $condition = [["is_del","=",0]];
+         $companyNo = isset($post['companyNo'])&&$post['companyNo']!="" ? trim($post['companyNo']) :"";
+        if($companyNo!=""){
+            $condition[]=['companyNo',"like","%$companyNo"];
+        }
+          $companyName = isset($post['companyName'])&&$post['companyName']!="" ? trim($post['companyName']) :"";
+        if($companyName!=""){
+            $condition[]=['companyName',"like","%$companyName"];
+        }
+        $status = isset($post['status'])&&$post['status']!=="" ? intval($post['status']) :"";
+        if($status!==""){
+             $condition[]=['status',"=",$status];
+        }
+        $page = isset($post['page'])&& $post['page']!="" ? intval($post['page']) :1;
+        $size = isset($post['size'])&& $post['size']!="" ? intval($post['size']) :10;
+        $count = Db::name("company_info")->where($condition)->count();
+        $total = ceil($count/$size)>1 ? ceil($count/$size) : 1;
+        $page = $page>=$total?intval($total):$page;
+        $list = Db::name("company_info")->where($condition)->page($page,$size)->select();
+        return app_show(0,"获取成功",['list'=>$list,"count"=>$count]);
+    }
+
+    /**
+     * 保存更新的资源
+     *
+     * @param  \think\Request  $request
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function all()
+    {
+
+        $condition = [];
+        $list = Db::name("company_info")->where($condition)->field("companyNo,company_name,status,bank_name,bankNo,company_license")->select();
+        return app_show(0,"获取成功",$list);
+    }
+
+    /** 获取利率设置
+    * @return \think\response\Json|void
+    * @throws \think\db\exception\DataNotFoundException
+    * @throws \think\db\exception\DbException
+    * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function RateList(){
+        $list=Db::name("order_rate")->where("status","=",1)->select();
+        return app_show(0,"获取成功",$list);
+    }
+}

+ 178 - 0
app/admin/controller/Customer.php

@@ -0,0 +1,178 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller;
+use app\admin\BaseController;
+use think\facade\Db;
+
+class Customer extends BaseController
+{
+    /**
+     * 获取企业客户列表
+     * @return \think\Response
+     */
+    public function list()
+    {
+        $post = $this->post;
+        $condition=[];
+        isset($post['company'])&&$post['company']!=""? $condition[]=['companyName|contactor',"like","%{$post['company']}%"] : "";
+        isset($post['contactor'])&&$post['contactor']!=""? $condition[]=['contactor',"like","%{$post['contactor']}%"] :
+            "";
+        $page = isset($post['page'])&& $post['page']!="" ? intval($post['page']) :1;
+        $size = isset($post['size'])&& $post['size']!="" ? intval($post['size']) :10;
+        $count = Db::name("customer_info")->where($condition)->count();
+        $total = ceil($count/$size)>1 ? ceil($count/$size) : 1;
+        $page = $page>=$total?intval($total):$page;
+        if( isset($post['company'])&&$post['company']!=""){
+            $list = Db::name("customer_info")->where($condition)->page($page,$size)->field("companyNo,companyName,parent,area,contactor,depart,mobile,addtime,updatetime,LENGTH(companyName) as weight")
+                ->order('weight asc')->select();
+        }else{
+            $list = Db::name("customer_info")->where($condition)->page($page,$size)->field("companyNo,companyName,parent,area,contactor,depart,mobile,addtime,updatetime")
+                ->select();
+        }
+
+        $data =[];
+        foreach ($list as $key=>$value){
+            $total_fee = Db::name("invoice_pool")->where([["status","=",5],["is_del","=",0],["type_check","=",2],
+                ["trade_status","in",[1,2]],["wtrade_fee",">",0],["inv_in","=",$value['companyNo']]])->sum("wtrade_fee");
+            $value["trade_inv"]=$total_fee;
+            $value["trade_inv_status"]=$total_fee>0 ? 1 :0;
+            $data[]=$value;
+        }
+        return app_show(0,"获取成功",['list'=>$data,"count"=>$count]);
+    }
+
+    /**
+     * 获取客户信息回款开票数据统计信息
+     *
+     * @return \think\Response
+     */
+    public function info()
+    {
+        $post = $this->post;
+        $companyNo= isset($post['companyNo'])&&$post['companyNo']!='' ? $post['companyNo'] : "";
+        if($companyNo==""){
+            return error_show(1003,"参数companyNo 不能为空");
+        }
+        $info = Db::name("customer_info")->where("companyNo","=",$companyNo)->find();
+        if(empty($info)){
+            return error_show(1004,"未找到客户数据");
+        }
+
+        $trade = Db::name("trade_pool")->where([["companyNo","=",$companyNo],["is_del","=",0]])->field("sum(order_fee) as aorder_fee,sum(worder_fee) as worder_fee,sum(inv_fee) as inv_fee,sum(winv_fee) as winv_fee")
+         ->find();
+        $inv = Db::name("invoice_pool")->where([["inv_in","=",$companyNo],["is_del","=",0]])->field("sum(aorder_fee) as aorder_fee,sum(worder_fee) as worder_fee,sum(atrade_fee) as atrade_fee,sum(wtrade_fee) as wtrade_fee")
+            ->find();
+        $order = Db::name("qrd_info")->where([["customerNo","=",$companyNo]])->field("sum(apay_fee) as apay_fee,sum(wpay_fee) as wpay_fee,sum(ainv_fee) as ainv_fee,sum(winv_fee) as winv_fee")
+            ->find();
+        array_walk($order,function (&$value){
+           if(is_null($value)){
+                $value=0;
+           }
+        });
+        array_walk($inv,function (&$value){
+            if(is_null($value)){
+                $value=0;
+            }
+        });
+        array_walk($trade,function (&$value){
+            if(is_null($value)){
+                $value=0;
+            }
+        });
+        $balance = $order["apay_fee"] - $order["ainv_fee"];
+        $order["trade_inv"]=$balance >0 ?$balance :0 ;
+        $order["inv_trade"]= $balance <0 ? $order["ainv_fee"]-$order["apay_fee"] :0;
+        $data=["trade"=>$trade,"inv"=>$inv,"order"=>$order];
+        return app_show(0,"获取成功",$data);
+    }
+
+    /**
+     * 保存新建的资源
+     *
+     * @param  \think\Request  $request
+     * @return \think\Response
+     */
+    public function save(Request $request)
+    {
+        //
+    }
+
+    /**
+     * 获取客户企业信息
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function read()
+    {
+        $post = $this->post;
+        $companyNo= isset($post['companyNo'])&&$post['companyNo']!='' ? $post['companyNo'] : "";
+        if($companyNo==""){
+            return error_show(1003,"参数companyNo 不能为空");
+        }
+        $info = Db::name("customer_info")->where("companyNo","=",$companyNo)->find();
+        if(empty($info)){
+            return error_show(1004,"未找到客户数据");
+        }
+        if($info['invoice_code']!=""){
+            $list = Db::name("customer_invoice")->where("invoice_code","=",$info['invoice_code'])->field("id,invoice_title,invoice_people,invoice_addr,invoice_mobile,invoice_code,invoice_bank,invoice_bankNo")
+                ->find();
+            if(!empty($list)){
+                $info['invoice_title'] = $list['invoice_title'];
+                $info['invoice_people'] = $list['invoice_people'];
+                $info['invoice_addr'] = $list['invoice_addr'];
+                $info['invoice_mobile'] = $list['invoice_mobile'];
+                $info['invoice_code'] = $list['invoice_code'];
+                $info['invoice_bank'] = $list['invoice_bank'];
+                $info['invoice_bankNo'] = $list['invoice_bankNo'];
+            }
+        }
+        return app_show(0,"获取成功",$info);
+    }
+
+    /**
+     * 获取客户企业发票抬头.
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function invoice()
+    {
+        $post = $this->post;
+        $companyNo= isset($post['name'])&&$post['name']!='' ? $post['name'] : "";
+        if($companyNo==""){
+            return error_show(1003,"参数name 不能为空");
+        }
+        $condition = [['invoice_title','like',"%{$companyNo}%"],['is_del',"=",0]];
+        $list = Db::name("customer_invoice")->where($condition)->page(1,100)->field("id,invoice_title,invoice_people,invoice_addr,invoice_mobile,invoice_code,invoice_bank,invoice_bankNo,LENGTH(invoice_title) as weight")
+            ->order('weight asc')->select();
+        if(empty($list)){
+            return error_show(1004,"未找到企业财务信息数据");
+        }
+        return app_show(0,"获取成功",$list);
+    }
+
+    /**
+     * 保存更新的资源
+     *
+     * @param  \think\Request  $request
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function update(Request $request, $id)
+    {
+        //
+    }
+
+    /**
+     * 删除指定资源
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function delete($id)
+    {
+        //
+    }
+}

+ 202 - 0
app/admin/controller/Group.php

@@ -0,0 +1,202 @@
+<?php
+namespace app\admin\controller;
+use app\admin\BaseController;
+use think\App;
+use think\facade\Db;
+
+class Group extends BaseController
+{
+    public function __construct(App $app) {parent::__construct($app);}
+    /**分组列表分页
+     * @return \think\response\Json
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function GroupList(){
+        $post=$this->post;
+        $token=$post['token'];
+        $page = isset($post['page']) ? intval($post['page']): 1;
+        $size = isset($post['size']) ? intval($post['size']):10;
+        $condition=[];
+        $count = Db::name("role_group")->where($condition)->count();
+        $page>=ceil($count/$size) ? $page=ceil($count/$size) :"";
+        $list =  Db::name("role_group")->where($condition)->page($page,$size)->select();
+        $data =[];
+        foreach ($list as $key=>$val) {
+            $userlist = [];
+            if ($val['group_user'] != "") {
+                $cond = ['id' => explode(",",$val['group_user'])];
+                $user = GetUserlist($token, $cond);
+                if ($user['code'] == 0 && !empty($user['data'])) {
+                    foreach ($user['data'] as $v) {
+
+                        $userlist[] = isset($v['nickname']) ?$v['nickname']:"";
+                    }
+                }
+            }
+            $val['userlist']= $userlist;
+            $data[] = $val;
+        }
+
+        return  app_show(0,"获取成功",['list'=>$data,"count"=>$count]);
+    }
+
+    /**获取所有分组数据
+     * @return \think\response\Json
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function GroupAll(){
+        $post=$this->post;
+        $token=$post['token'];
+        $condition=[];
+        isset($post['name']) && $post['name']!=="" ? $condition[]= ['group_name',"like","%{$post['name']}%"] : "";
+        isset($post['status']) && $post['status']!=="" ? $condition[] = ['status',"=",$post['status']] : "";
+
+        $list = Db::name("role_group")->where($condition)->select();
+        $data =[];
+        foreach ($list as $key=>$val) {
+            $userlist = [];
+            if ($val['group_user'] != "") {
+                $cond = ['id' => explode(",",$val['group_user'])];
+                $user = GetUserlist($token, $cond);
+                if ($user['code'] == 0 && !empty($user['data'])) {
+                    foreach ($user['data'] as $v) {
+
+                        $userlist[] = isset($v['nickname']) ?$v['nickname']:"";
+                    }
+                }
+            }
+            $val['userlist']= $userlist;
+            $data[] = $val;
+        }
+        return  app_show(0,"获取成功",$data);
+    }
+
+    /**@param  id
+     * @return \think\response\Json
+     * @throws \think\exception\DbException
+     */
+    public function GroupInfo(){
+        $post=$this->post;
+        $token=$post['token'];
+        $id = isset($post['id']) ? intval($post['id']) : "";
+        if($id==""){
+            return error_show(1002,"用户组id不能为空");
+        }
+        $group = Db::name("role_group")->where("id","=",$id)->find();
+        if(!$group){
+            return error_show(1003,"未找到对应的数据");
+        }
+        $userlist=[];
+        if($group['group_user']!=""){
+            $cond = ['id' => explode(",",$group['group_user'])];
+            $user = GetUserlist($token, $cond);
+            if ($user['code'] == 0&& !empty($user['data'])) {
+                foreach ($user['data'] as $v) {
+                    $userlist[] = isset($v['nickname']) ?$v['nickname']:"";
+                }
+            }
+        }
+        $group['userlist'] = $userlist;
+        return app_show(0,"获取成功",$group);
+    }
+
+    /**分组新建
+     * @return \think\response\Json
+     * @throws \think\exception\DbException
+     */
+    public function GroupAdd(){
+        $post=$this->post;
+        $groupname = isset($post['name']) ? trim($post['name']):"";
+        if($groupname==""){
+            return error_show(1002,"用户组名不能为空");
+        }
+        $groupuser = isset($post['group_user']) ? trim($post['group_user']):"";
+        if($groupuser==""){
+            return error_show(1002,"组成员不能为空");
+        }
+        $marke = isset($post['group_remark']) ? trim($post['group_remark']):"";
+        $list = ['group_name'=>$groupname];
+        $select = Db::name("role_group")->where($list)->find();
+        if($select){
+            return error_show(1003,"用户组名称已存在");
+        }
+        $data= [
+            'group_name'=>$groupname,
+            'group_user'=>$groupuser,
+            'status'=>1,
+            'group_remark'=>$marke,
+            "addtime"=>date("Y-m-d H:i:s"),
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $in =  Db::name("role_group")->save($data);
+        return $in ? app_show(0,"新建成功"): error_show(1005,"新建失败");
+    }
+
+    /**分组编辑
+     * @return \think\response\Json
+     * @throws \think\exception\DbException
+     */
+    public function GroupSave(){
+        $post=$this->post;
+        $groupid = isset($post['id']) ? intval($post['id']):"";
+        if($groupid==""){
+            return error_show(1002,"用户组id不能为空");
+        }
+        $groupname = isset($post['name']) ? trim($post['name']):"";
+        if($groupname==""){
+            return error_show(1002,"用户组名不能为空");
+        }
+        $groupuser = isset($post['group_user']) ? trim($post['group_user']):"";
+        if($groupuser==""){
+            return error_show(1002,"组成员不能为空");
+        }
+        $marke = isset($post['group_remark']) ? trim($post['group_remark']):"";
+        $list = ['group_name'=>$groupname];
+        $select =Db::name("role_group")->where($list)->find();
+        if($select && $select['id']!=$groupid){
+            return error_show(1003,"用户组名称已存在");
+        }
+        $data= [
+            "id"=>$groupid,
+            'group_name'=>$groupname,
+            'group_user'=>$groupuser,
+            'group_remark'=>$marke,
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $in = Db::name("role_group")->save($data);
+        return $in ? app_show(0,"更新成功"): error_show(1005,"更新失败");
+    }
+
+    /**分组状态
+     * @return \think\response\Json
+     * @throws \think\exception\DbException
+     */
+    public function GroupStatus(){
+        $post=$this->post;
+        $groupid = isset($post['id']) ? intval($post['id']):"";
+        if($groupid==""){
+            return error_show(1002,"用户组id不能为空");
+        }
+        $status = isset($post['status']) ? intval($post['status']) : "";
+        if($status===""){
+            return error_show(1001,'status不能为空');
+        }
+        if(!in_array($status,[0,1])){
+            return error_show(1001,'status参数非法');
+        }
+
+        $data= [
+            "id"=>$groupid,
+            "status"=>$status,
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $in = Db::name("role_group")->save($data);
+        return $in ? app_show(0,"更新成功"): error_show(1005,"更新失败");
+    }
+}

+ 297 - 0
app/admin/controller/Menu.php

@@ -0,0 +1,297 @@
+<?php
+declare (strict_types = 1);
+namespace app\admin\controller;
+use app\admin\BaseController;
+use think\App;
+use think\facade\Db;
+
+class Menu extends BaseController{
+    public function __construct(App $app) {parent::__construct($app);}
+/** 进入页面获取权限列表
+* @return \think\response\Json|void
+* @throws \think\db\exception\DataNotFoundException
+* @throws \think\db\exception\DbException
+* @throws \think\db\exception\ModelNotFoundException
+ */
+ public function MenuList(){
+
+        $role = Db::name("role_action")->where("role_id","=",$this->roleid)->find();
+
+        if($role==false){
+            return app_show(0,"获取成功",[]);
+        }
+
+        $data= Db::name("view_menu")->where('aid',"in",explode(",",$role['action_conllect']))->where(['status'=>1,"cstatus"=>1])
+            ->order("weight desc,id asc,cweight desc,cid asc")->select();
+
+        $list=[];
+        $act=[];
+        foreach ($data as $value){
+            $list[$value["id"]]['menu_name']=$value['menu_name'];
+            $list[$value["id"]]['menu_img']=$value['menu_img'];
+            $list[$value["id"]]['menu_route']=$value['menu_route'];
+            $list[$value["id"]]['status']=$value['status'];
+            $temp = [];
+            $temp['menu_name']=$value['cname'];
+            $temp['menu_img']=$value['cmenu_img'];
+            $temp['menu_route']=$value['cmenu_route'];
+            $temp['menu_url']=$value['cmenu_url'];
+            $temp['menu_url']=$value['cmenu_url'];
+            $temp['status']=$value['cstatus'];
+            $temp['is_private']=$value['cprivate'];
+            $list[$value["id"]]['child'][$value['cid']]=$temp;
+            $act[$value['id']][$value['cid']][]=$value['acode'];
+            $list[$value["id"]]['child'][$value['cid']]['action']= $act[$value['id']][$value['cid']];
+
+        }
+        array_walk($list,function (&$value){
+            $value['child']= array_values($value['child']);
+        });
+        return app_show(0,"获取成功",array_values($list));
+    }
+    /**菜单设置列表
+    * @return \think\response\Json|void
+    * @throws \think\db\exception\DataNotFoundException
+    * @throws \think\db\exception\DbException
+    * @throws \think\db\exception\ModelNotFoundException
+    * @throws \think\exception\DbException
+    */
+     public function   MenuAllList(){
+       $data = Db::name("admin_menu")->where(['pid'=>0])->order("weight desc,id asc")->select();
+        $l=[];
+        foreach ($data as $key=>$value){
+            $temp =  Db::name("admin_menu")->where(['pid'=>$value['id']])->order("weight desc,id asc")->select();
+            $value['child']=$temp;
+            $l[]=$value;
+        }
+        return app_show(0,"获取成功",$l);
+    }
+
+     /**
+     * 菜单新建
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function MenuAdd(){
+        $post  =$this->post;
+        $name = isset($post['menu_name']) ?trim($post['menu_name']) :"";
+        if($name==""){
+            return error_show(1002,"菜单名称不能为空");
+        }
+        $url = isset($post['menu_url']) ?trim($post['menu_url']) :"";
+        $route = isset($post['menu_route']) ?trim($post['menu_route']) :"";
+        $code = isset($post['menu_code']) ?trim($post['menu_code']) :"";
+        $img = isset($post['menu_img']) ?trim($post['menu_img']) :"";
+        $pid = isset($post['pid']) ?intval($post['pid']) :0;
+        $private = isset($post['private']) ?intval($post['private']) :0;
+        $weight = isset($post['weight']) ?floatval($post['weight']) :1;
+        if($pid!=0 && $route==""){
+            return error_show(1002,"子级菜单路由不能为空");
+        }
+        $data=[
+            "menu_name"=>$name,
+            "menu_url"=>$url,
+            "menu_route"=>$route,
+            "menu_code"=>$code,
+            "menu_img"=>$img,
+            "pid"=>$pid,
+            "weight"=>$weight,
+            "is_show"=>1,
+            "is_private"=>$private,
+            "status"=>1,
+            "addtime"=>date("Y-m-d H:i:s"),
+            "updatetime"=>date("Y-m-d H:i:s"),
+        ];
+
+        $result = Db::name("admin_menu")->insert($data);
+        return $result ? app_show(0,"添加成功"): error_show(1003,"添加失败");
+    }
+        /**菜单编辑或新建
+    * @return \think\response\Json|void
+    * @throws \think\db\exception\DataNotFoundException
+    * @throws \think\db\exception\DbException
+    * @throws \think\db\exception\ModelNotFoundException
+     */
+        public function MenuEdit(){
+        $post  =$this->post;
+        $id = isset($post['id']) ?intval($post['id']) :"";
+        if($id!=""){
+            $menu = Db::name("admin_menu")->where("id","=",$id)->find();
+            if($menu==false){
+                return error_show(1003,"菜单不信息不存在");
+            }
+        }
+        $name = isset($post['name']) ?trim($post['name']) :"";
+        if($name==""){
+            return error_show(1002,"菜单名称不能为空");
+        }
+        $url = isset($post['url']) ?trim($post['url']) :"";
+        $route = isset($post['route']) ?trim($post['route']) :"";
+        $code = isset($post['menu_code']) ?trim($post['menu_code']) :"";
+        $img = isset($post['img']) ?trim($post['img']) :"";
+        $pid = isset($post['pid']) ?intval($post['pid']) :0;
+        $weight = isset($post['weight']) ?floatval($post['weight']) :1;
+        $status = isset($post['is_show']) ? intval($post['is_show']) : 0;
+        $private = isset($post['private']) ?intval($post['private']) :(isset($menu['is_private']) ?
+            $menu['is_private'] : 0);
+        if($pid!=0 && $route==""){
+            return error_show(1002,"子级菜单路由不能为空");
+        }
+        $data=[
+            "menu_name"=>$name,
+            "menu_url"=>$url,
+            "menu_route"=>$route,
+            "menu_code"=>$code,
+            "menu_img"=>$img,
+            "pid"=>$pid,
+            'is_show'=>$status,
+            "is_private"=>$private,
+            'status'=>1,
+            "weight"=>$weight,
+            "updatetime"=>date("Y-m-d H:i:s"),
+        ];
+        $message="新建";
+        if($id!=""){
+            $message="编辑";
+            $data['id']=$id;
+        }
+        $result = Db::name("admin_menu")->save($data);
+        return $result ? app_show(0,"{$message}成功"): error_show(1003,"{$message}失败");
+    }
+    /**菜单状态更新
+* @return \think\response\Json|void
+* @throws \think\db\exception\DataNotFoundException
+* @throws \think\db\exception\DbException
+* @throws \think\db\exception\ModelNotFoundException
+ */
+      public function MenuStatus(){
+        $post  =$this->post;
+        $id = isset($post['id']) ?intval($post['id']) :"";
+        $menu = Db::name("admin_menu")->where("id","=",$id)->find();
+        if($menu==false){
+            return error_show(1003,"菜单信息不存在");
+        }
+        $statu = isset($post['status'])&&$post['status']!="" ? intval($post['status']) :"";
+        if($statu===""){
+            return error_show(1003,"菜单状态不能为空");
+        }
+        $menu['status']=$statu;
+        $menu['updatetime']=date("Y-m-d H:i:s");
+        $result = Db::name("admin_menu")->save($menu);
+        return $result ? app_show(0,"状态更新成功"): error_show(1003,"状态更新失败");
+    }
+      /**
+     * 获取菜单下的所有功能列表
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function ActionList(){
+        $post  =$this->post;
+        $pageid = isset($post['id']) ? intval($post['id']) : "";
+        if($pageid==""){
+            return error_show(1001,'页面id不能为空');
+        }
+        $condition = ['menuid'=>$pageid];
+        $data=Db::name('action')->alias("a")->leftJoin("cfp_action_list l","a.action_code=l.action_code")->field
+        ("a.*,action_name")->where($condition)->select();
+        return app_show(0,"获取成功",$data);
+    }
+        /** 菜单下功能信息修改*/
+        public function ActionSave(){
+        $post  =$this->post;
+        $actid = isset($post['id']) ? intval($post['id']) : "";
+        if($actid==""){
+            return error_show(1001,'功能id不能为空');
+        }
+        $menuid = isset($post['menuid']) ? intval($post['menuid']) : "";
+        if($menuid==""){
+            return error_show(1001,'页面menuid不能为空');
+        }
+
+        $code = isset($post['action_code']) ? trim($post['action_code']) : "";
+        $status = isset($post['status']) ? intval($post['status']) : 1;
+        if($code==""){
+            return error_show(1002,'功能code不能为空');
+        }
+        $istrue =Db::name("action")->where(['menuid'=>$menuid,"action_code"=>$code])->find();
+        if($istrue && $istrue['id']!=$actid){
+            return error_show(1005,'此功能已存在');
+        }
+        try{
+            $data = ['action_code'=>$code,'status'=>$status,"updatetime"=>date("Y-m-d H:i:s")];
+            $result=Db::name("action")->where("id","=",$actid)->save($data);
+            if($result){
+                return app_show(0,"更新成功");
+            }else{
+                return error_show(1004,"更新失败");
+            }
+
+        }catch (\Exception $e){
+            return error_show(1003,$e->getMessage());
+        }
+    }
+
+    /**   菜单下功能信息状态修改
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function ActionStatus(){
+        $post  =$this->post;
+        $actid = isset($post['id']) ? intval($post['id']) : "";
+        if($actid==""){
+            return error_show(1001,'功能id不能为空');
+        }
+        $status = isset($post['status']) ? intval($post['status']) : 1;
+        try{
+            $data = ['status'=>$status,"updatetime"=>date("Y-m-d H:i:s")];
+            $result=Db::name("action")->where("id","=",$actid)->save($data);
+            if($result){
+                return app_show(0,"更新成功");
+            }else{
+                return error_show(1004,"更新失败");
+            }
+        }catch (\Exception $e){
+            return error_show(1003,$e->getMessage());
+        }
+    }
+
+    /** 菜单下功能信息状态修改
+     * @return \think\response\Json|void
+     * @throws \think\exception\DbException
+     */
+    public function ActionAdd(){
+        $post  =$this->post;
+        $pageid = isset($post['menuid']) ? intval($post['menuid']) : "";
+        if($pageid==""){
+            return error_show(1001,'页面id不能为空');
+        }
+        $code = isset($post['action_code']) ? trim($post['action_code']) : "";
+
+        $status = isset($post['status']) ? intval($post['status']) : 1;
+        if($code==""){
+            return error_show(1002,'功能code不能为空');
+        }
+        try{
+            $where = ['menuid'=>$pageid,'action_code'=>$code];
+            $true =Db::name("action")->where($where)->find();
+            $data = ['menuid'=>$pageid,'action_code'=>$code,'status'=>$status,"updatetime"=>date("Y-m-d H:i:s"),"addtime"=>date("Y-m-d H:i:s")];
+            if($true){
+                return error_show(1003,'此功能已存在');
+            }else{
+                Db::name("action")->insert($data);
+                return app_show(0,"添加成功");
+            }
+        }catch (\Exception $e){
+            return error_show(1005,$e->getMessage());
+        }
+    }
+}

+ 1099 - 0
app/admin/controller/Payment.php

@@ -0,0 +1,1099 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller;
+
+use app\admin\BaseController;
+use app\command\datacopy;use think\facade\Db;
+
+class Payment extends BaseController
+{
+    /**
+     *付款详细列表
+     * @return \think\Response
+     */
+    public function paymentList()
+    {
+        $post = $this->post;
+        $condition = "a.is_del!=0 ";
+        $check = checkRole($this->roleid,49);
+        if($check){
+            $condition .=" and `a`.`apply_id` = {$this->uid}";
+        }
+        $startTime= isset($post['startTime'])&&$post['startTime']!="" ? trim($post['startTime']) :"";
+        $endTime= isset($post['endTime'])&&$post['endTime']!="" ? trim($post['endTime']) :"";
+        $supplierNo= isset($post['supplierNo'])&&$post['supplierNo']!="" ? trim($post['supplierNo']) :"";
+        $payNo= isset($post['payNo'])&&$post['payNo']!="" ? trim($post['payNo']) :"";
+        $apply= isset($post['apply_name'])&&$post['apply_name']!="" ? trim($post['apply_name']) :"";
+        $paystatus= isset($post['status'])&&$post['status']!="" ? $post['status'] :"";
+//        $inv_status= isset($post['inv_status'])&&$post['inv_status']!="" ? $post['inv_status'] :"";
+        if($startTime!=""){
+            $condition.=" and `b`.`addtime` >= '{$startTime}'";
+        }
+        if($endTime!=""){
+            $condition.=" and `b`.`addtime` <= '{$endTime}'";
+        }
+
+        if($supplierNo!=""){
+            $condition.=" and `a`.`supplierNo` like '%{$supplierNo}%'";
+        }
+
+        if($payNo!=""){
+            $condition.=" and `a`.`payNo` like '%{$payNo}%'";
+        }
+        if($apply!=""){
+            $condition .=" and b.apply_name like '%{$apply}%'";
+        }
+        if($paystatus!=""){
+            $condition .=" and `b`.`status` = {$paystatus}";
+        }
+//        if($inv_status!=""){
+//            $condition .=" and `a`.`inv_status`  = {$inv_status}";
+//        }
+        $page =  isset($post['page'])&&$post['page']!="" ? intval($post['page']) :1;
+        $size =  isset($post['size'])&&$post['size']!="" ? intval($post['size']) :10;
+        $count = Db::name("pay")->alias('a')
+            ->join("cfp_pay_payment b",'`a`.`payNo` = `b`.`payNo` AND ( `b.`is_del` = 0 ) ','left')
+            ->where($condition)->count();
+        $total = ceil($count/$size)>1 ? ceil($count/$size) : 1;
+        $page = $page>=$total?intval($total):$page;
+        $list =  Db::name("pay")->alias('a')
+             ->join("cfp_pay_payment b",'`a`.`payNo` = `b`.`payNo` AND ( `b.`is_del` = 0 ) ','left')
+            ->where($condition)->page(intval($page),$size)->order("b.addtime desc")
+            ->field("	`b`.`id` AS `id`,
+                    `a`.`payNo` AS `payNo`,
+                    `a`.`supplierNo`,
+                    `a`.`apay_fee` ,
+                    `a`.`total_fee` AS `total_fee`,
+                    `b`.`apply_name`,
+                    `b`.`apply_id`,
+                    `a`.`winv_fee` ,
+                    `a`.`ainv_fee` ,
+                    `a`.`wpay_fee` ,
+                    `a`.`pay_status` ,
+                    `a`.`inv_status` ,
+                    `b`.`pay_fee` AS `dpay_fee`,
+                    `b`.`return_img`,
+                    `b`.`return_time`,
+                    `b`.`status` AS `dstatus`,
+                    `a`.`status`,
+                    `a`.`remark` AS `remark`,
+                    `b`.`addtime` ,
+                    `a`.`companyNo` ,
+                    `a`.`companyName` ,
+                    `b`.`dzNo` AS `dzNo`
+                 ")->select();
+       $data=[];
+        foreach ($list as $key=>$value){
+            $value['ordeNum'] = Db::name("pay_info")->where([["payNo","=",$value["payNo"]],["is_del","=",0]])->count();
+            $data[]=$value;
+        }
+        return app_show(0,"获取成功",["list"=>$data,"count"=>$count]);
+    }
+/**
+     *对账单列表
+     * @return \think\Response
+     */
+    public function payList()
+    {
+        $post = $this->post;
+        $condition = [["is_del","=",0]];
+        $check = checkRole($this->roleid,49);
+        if($check){
+            $condition[]=["apply_id","=",$this->uid];
+        }
+        $startTime= isset($post['startTime'])&&$post['startTime']!="" ? trim($post['startTime']) :"";
+        $endTime= isset($post['endTime'])&&$post['endTime']!="" ? trim($post['endTime']) :"";
+        $supplierNo= isset($post['supplierNo'])&&$post['supplierNo']!="" ? trim($post['supplierNo']) :"";
+        $payNo= isset($post['payNo'])&&$post['payNo']!="" ? trim($post['payNo']) :"";
+        $paystatus= isset($post['pay_status'])&&$post['pay_status']!="" ? $post['pay_status'] :"";
+        $inv_status= isset($post['inv_status'])&&$post['inv_status']!="" ? $post['inv_status'] :"";
+        if($startTime!=""){
+            $condition[]=["addtime",">=",$startTime];
+        }
+        if($endTime!=""){
+            $condition[]=["addtime","<=",$endTime];
+        }
+
+        if($supplierNo!=""){
+             $condition[]=["supplierNo","like","%$supplierNo%"];
+        }
+
+        if($payNo!=""){
+             $condition[]=["payNo","like","%$payNo%"];
+        }
+        if($paystatus!=""){
+             $condition[]=["pay_status","=",$paystatus];
+        }
+        if($inv_status!=""){
+            $condition[]=["inv_status","=",$inv_status];
+        }
+        $page =  isset($post['page'])&&$post['page']!="" ? intval($post['page']) :1;
+        $size =  isset($post['size'])&&$post['size']!="" ? intval($post['size']) :10;
+        $count = Db::name("pay")->where($condition)->count();
+        $total = ceil($count/$size)>1 ? ceil($count/$size) : 1;
+        $page = $page>=$total?intval($total):$page;
+        $list =  Db::name("pay")->where($condition)->page(intval($page),$size)->order("addtime desc")->select();
+       $data=[];
+        foreach ($list as $key=>$value){
+            $value['ordeNum'] = Db::name("pay_info")->where([["payNo","=",$value["payNo"]],["is_del","=",0]])->count();
+            $data[]=$value;
+        }
+        return app_show(0,"获取成功",["list"=>$data,"count"=>$count]);
+    }
+
+    /**
+     * 新建对账付款数据
+     * @return \think\Response
+     */
+    public function PayAdd()
+    {
+        $post = $this->post;
+        $cids = isset($post['cids'])&&$post['cids']!="" ? trim($post['cids']) :"";
+        if($cids==""){
+            return error_show(1003,"参数cids不能为空");
+        }
+        $cgdall =Db::name("cgd_info")->where(["id"=>explode(",",$cids),"status"=>0])->select()->toArray();
+        if(empty($cgdall)){
+            return error_show(1003,"采购单数据不能为空");
+        }
+        $supplierNo= array_column($cgdall,"supplierNo");
+        $supplierName= array_column($cgdall,"supplierName");
+        if(count(array_unique($supplierNo))>1){
+             return error_show(1003,"采购单数据供应商不一致");
+        }
+        $companyNo= array_column($cgdall,"companyNo");
+        $companyName= array_column($cgdall,"companyName");
+        if(count(array_unique($companyNo))>1){
+            return error_show(1003,"采购单数据业务公司不一致");
+        }
+
+       $payNo = makeNo("PAY");
+        Db::startTrans();
+        try {
+            $data=[];
+            $paydata=[
+                "payNo"=>$payNo,
+                "apply_id"=>$this->uid,
+                "apply_name"=>$this->uname,
+                "total_fee"=>0,
+                "supplierNo"=>$supplierNo[0],
+                "supplierName"=>$supplierName[0],
+                "companyNo"=>$companyNo[0],
+                "companyName"=>$companyName[0],
+                "wpay_fee"=>0,
+                "apay_fee"=>0,
+                "ainv_fee"=>0,
+                "winv_fee"=>0,
+                "remark"=>"",
+                "status"=>1,
+                "addtime"=>date("Y-m-d H:i:s"),
+                "updatetime"=>date("Y-m-d H:i:s"),
+            ];
+           foreach ($cgdall as $key=>$value){
+               $temp=[];
+               $temp['cgdNo']=$value['sequenceNo'];
+               $temp['total_fee']=$value['totalPrice'];
+               $temp['apay_fee']=round($value['apay_fee'],2);
+               $temp['wpay_fee']=round($value['wpay_fee'],2);
+               $temp['winv_fee']=round($value['winv_fee'],2);
+               $temp['ainv_fee']=round($value['ainv_fee'],2);
+               $temp['payNo']=$payNo;
+               $temp['addtime']=date("Y-m-d H:i:s");
+               $temp['updatetime']=date("Y-m-d H:i:s");
+               $data[]=$temp;
+                $paydata['total_fee']+= $temp['total_fee'];
+                $paydata['apay_fee']+= $temp['apay_fee'];
+                $paydata['wpay_fee']+= $temp['wpay_fee'];
+                $paydata['ainv_fee']+= $temp['ainv_fee'];
+                $paydata['winv_fee']+= $temp['winv_fee'];
+           }
+            $paydata['total_fee']= round($paydata['total_fee'],2);
+            $paydata['apay_fee']= round($paydata['apay_fee'],2);
+            $paydata['wpay_fee']= round($paydata['wpay_fee'],2);
+            $paydata['ainv_fee']= round($paydata['ainv_fee'],2);
+            $paydata['winv_fee']= round($paydata['winv_fee'],2);
+            $info = Db::name("pay_info")->insertAll($data);
+           if($info!=0){
+                $payDA=Db::name("pay")->insert($paydata);
+                if($payDA){
+                      $cgddup=  Db::name("cgd_info")->where("id","in",$cids)->save(['status'=>1,"updatetime"=>date("Y-m-d 
+                        H:i:s")]);
+                      if($cgddup){
+                            Db::commit();
+                             return app_show(0,"添加成功",["payNo"=>$payNo]);
+                      }
+
+                    }
+           }
+           Db::rollback();
+           return error_show(1003,"添加失败");
+        }catch(\Exception $e){
+            Db::rollback();
+            return error_show(1003,$e->getMessage());
+        }
+    }
+        /**对账单未审核前可需改编辑
+* @return \think\response\Json|void
+* @throws \think\db\exception\DataNotFoundException
+* @throws \think\db\exception\DbException
+* @throws \think\db\exception\ModelNotFoundException
+* @throws \think\exception\DbException
+ */
+      public function PaySave()
+    {
+        $post = $this->post;
+        $cids = isset($post['cids'])&&$post['cids']!="" ? trim($post['cids']) :"";
+        if($cids==""){
+            return error_show(1003,"参数cids不能为空");
+        }
+        $payNo = isset($post['payNo'])&&$post['payNo']!="" ? trim($post['payNo']) :"";
+        if($payNo==""){
+            return error_show(1003,"参数 payNo 不能为空");
+        }
+        $payinfo = Db::name("pay")->where(["payNo"=>$payNo,"is_del"=>0])->find();
+        if($payinfo==false){
+           return error_show(1003,"未找到对账单数据");
+        }
+        if($payinfo['status']!=1){
+          return error_show(1003,"对账单已提交审核");
+        }
+
+        $cgdall =Db::name("cgd_info")->where(["id"=>explode(",",$cids)])->select()->toArray();
+        if(empty($cgdall)){
+            return error_show(1003,"采购单数据不能为空");
+        }
+        $supplierNo= array_column($cgdall,"supplierNo");
+        $supplierName= array_column($cgdall,"supplierName");
+
+        if(count(array_unique($supplierNo))>1){
+             return error_show(1003,"采购单数据供应商不一致");
+        }
+        $companyNo= array_column($cgdall,"companyNo");
+        $companyName= array_column($cgdall,"companyName");
+        if(count(array_unique($companyNo))>1){
+            return error_show(1003,"采购单数据业务公司不一致");
+        }
+        $cgdArr=array_column($cgdall,"sequenceNo");
+        $cgdNo = Db::name("pay_info")->where([["payNo","=",$payNo],["is_del","=",0]])->column("cgdNo");
+        $add=[];
+        $remove=[];
+        if(!empty($cgdNo)){
+            $remove = array_diff($cgdNo,$cgdArr);
+            $add = array_diff($cgdArr,$cgdNo);
+        }
+
+        Db::startTrans();
+        try {
+            $data=[];
+            $paydata=[
+                "supplierNo"=>$supplierNo[0],
+                "supplierName"=>$supplierName[0],
+                "companyNo"=>$companyNo[0],
+                "companyName"=>$companyName[0],
+                "wpay_fee"=>0,
+                "apay_fee"=>0,
+                "ainv_fee"=>0,
+                "winv_fee"=>0,
+                "total_fee"=>0,
+                "updatetime"=>date("Y-m-d H:i:s")
+            ];
+           foreach ($cgdall as $key=>$value){
+               if(!empty($add)&& in_array($value['sequenceNo'],$add)){
+                   $temp=[];
+                   $temp['cgdNo']=$value['sequenceNo'];
+                   $temp['total_fee']=$value['totalPrice'];
+                   $temp['apay_fee']=round($value['apay_fee'],2);
+                   $temp['wpay_fee']=round($value['wpay_fee'],2);
+                   $temp['winv_fee']=round($value['winv_fee'],2);
+                   $temp['ainv_fee']=round($value['ainv_fee'],2);
+                   $temp['payNo']=$payNo;
+                   $temp['addtime']=date("Y-m-d H:i:s");
+                   $temp['updatetime']=date("Y-m-d H:i:s");
+                   $data[]=$temp;
+               }
+                $paydata['total_fee']+= $value['totalPrice'];
+                $paydata['apay_fee']+= $value['apay_fee'];
+                $paydata['wpay_fee']+= $value['wpay_fee'];
+                $paydata['ainv_fee']+= $value['ainv_fee'];
+                $paydata['winv_fee']+= $value['winv_fee'];
+           }
+            $paydata['total_fee']= round($paydata['total_fee'],2);
+            $paydata['apay_fee']= round($paydata['apay_fee'],2);
+            $paydata['wpay_fee']= round($paydata['wpay_fee'],2);
+            $paydata['ainv_fee']= round($paydata['ainv_fee'],2);
+            $paydata['winv_fee']= round($paydata['winv_fee'],2);
+            $payDA=Db::name("pay")->where($payinfo)->update($paydata);
+             if($payDA){
+                    if(!empty($remove)){
+                      $payrm = Db::name("pay_info")->where(["cgdNo"=>$remove,"is_del"=>0])->update(["is_del"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
+                        if($payrm==false){
+                                Db::rollback();
+                                return error_show(1004,"修改失败");
+                        }
+                        $cgdrm=  Db::name("cgd_info")->where([["sequenceNo","in",$remove],["status","=",1]])->save(['status'=>0, "updatetime"=>date("Y-m-d H:i:s")]);
+                          if($cgdrm==false){
+                                Db::rollback();
+                                return error_show(1005,"修改失败");
+                          }
+                        }
+                    if(!empty($add)){
+                         $cgddup=  Db::name("cgd_info")->where([["sequenceNo","in",$add],["status","=",0]])->save(['status'=>1, "updatetime"=>date("Y-m-d H:i:s")]);
+                         if($cgddup==false){
+                                    Db::rollback();
+                                    return error_show(1006,"修改失败");
+                          }
+                    }
+                     if(!empty($data)){
+                            $info = Db::name("pay_info")->insertAll($data);
+                            if($info==false){
+                                  Db::rollback();
+                                  return error_show(1003,"修改失败");
+                            }
+                        }
+                        Db::commit();
+                     return app_show(0,"修改成功",["payNo"=>$payNo]);
+
+          }
+
+           Db::rollback();
+           return error_show(1007,"添加失败");
+        }catch(\Exception $e){
+            Db::rollback();
+            return error_show(1003,$e->getMessage());
+        }
+    }
+
+    /**
+     * 对账付款状态审核 status 0 待提交 1 待采购审核 2 待财务审核 3 审核成功 4 采购驳回 5 财务驳回
+     * @param  \think\Request  $request
+     * @return \think\Response
+     */
+    public function PayStatus()
+    {
+        $post = $this->post;
+        $payNo = isset($post['payNo']) && $post['payNo']!="" ? trim($post['payNo']):"";
+        if($payNo==""){
+            return error_show(1004,"参数payNo不能为空");
+        }
+        $status= isset($post['status']) && $post['status']!=="" ? trim($post['status']):"";
+        if($status===""){
+            return error_show(1004,"参数status不能为空");
+        }
+        $data = Db::name("pay")->where([["payNo","=",$payNo],["is_del","=",0]])->find();
+        if($data==false){
+            return error_show(1004,"未能找到对应数据");
+        }
+        $remark = isset($post['remark']) && $post['remark']!=""? trim($post['remark']):"";
+
+        Db::startTrans();
+        try{
+            $update=[
+                "status"=>$status,
+                "remark"=>$remark,
+                "updatetime"=>date("Y-m-d H:i:s")
+            ];
+            $result = Db::name("pay")->where("payNo","=",$payNo)->update($update);
+            if($result){
+               Db::commit();
+               return app_show(0,"状态更新成功");
+            }
+            Db::rollback();
+            return error_show(1004,"状态更新失败");
+        }catch (\Exception $e){
+            Db::rollback();
+            return error_show(1004,$e->getMessage());
+        }
+    }
+    /**删除未审核完成的对账单
+    * @return \think\response\Json|void
+    * @throws \think\db\exception\DataNotFoundException
+    * @throws \think\db\exception\DbException
+    * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function payDel(){
+        $post = $this->post;
+        $payNo = isset($post['payNo']) && $post['payNo']!="" ? trim($post['payNo']):"";
+        if($payNo==""){
+            return error_show(1004,"参数payNo不能为空");
+        }
+        $data = Db::name("pay")->where([["payNo","=",$payNo],["is_del","=",0]])->find();
+        if($data==false){
+            return error_show(1004,"未能找到对应数据");
+        }
+       if($data['status']==4){
+          return error_show(1004,"对账单已审核通过");
+       }
+       $cgdNo = Db::name("pay_info")->where(["payNo"=>$payNo,"is_del"=>0])->column("cgdNo");
+       if(empty($cgdNo)){
+           return error_show(1004,"未能找到对应采购单数据");
+       }
+       Db::startTrans();
+       try{
+           $payDel = ["is_del"=>1,"updatetime"=>date("Y-m-d H:i:s")];
+           $pay =Db::name("pay")->where($data)->update($payDel);
+           if($pay){
+               $infoup =Db::name("pay_info")->where(["cgdNo"=>$cgdNo,"is_del"=>0])->update($payDel);
+               if($infoup==false){
+                   Db::rollback();
+                   return error_show(1004,"对账删除失败");
+               }
+               $cgdup =Db::name("cgd_info")->where(["sequenceNo"=>$cgdNo,"status"=>1])->update(['status'=>0,"updatetime"=>date("Y-m-d H:i:s")]);
+               if($cgdup==false){
+                    Db::rollback();
+                   return error_show(1004,"对账删除失败");
+               }
+            Db::commit();
+            return error_show(0,"对账删除成功");
+           }
+           Db::rollback();
+           return error_show(1004,"对账删除失败");
+       }catch (\Exception $e){}
+    }
+    /**
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function stageAdd()
+    {
+        $post = $this->post;
+        $payNo = isset($post['payNo'])&& $post['payNo']!="" ? trim($post['payNo']) :"";
+        if($payNo==""){
+            return error_show(1004,"参数payNo 不能为空");
+        }
+        $payinfo =Db::name("pay")->where(["payNo"=>$payNo,"is_del"=>0])->find();
+        if($payinfo==false){
+           return error_show(1004,"未找到对账信息");
+        }
+        if($payinfo['status']!=3){
+              return error_show(1004,"对账未审核完成");
+        }
+         $pay_fee = isset($post['pay_fee'])&& $post['pay_fee']!="" ? floatval($post['pay_fee']) :"";
+        if($pay_fee==""){
+            return error_show(1004,"参数 pay_fee 不能为空或零");
+        }
+        if($payinfo['wpay_fee']< $pay_fee){
+             return error_show(1004,"对账单未付金额不足");
+        }
+        $dzno=makeNo("DZ");
+        Db::startTrans();
+        try {
+            $ment =[
+                "payNo"=>$payNo,
+                "dzNo"=>$dzno,
+                "apply_id"=>$this->uid,
+                "apply_name"=>$this->uname,
+                "pay_fee"=>$pay_fee,
+                "return_img"=>'',
+                "status"=>1,
+                "addtime"=>date("Y-m-d H:i:s"),
+                "updatetime"=>date("Y-m-d H:i:s")
+            ];
+            $payment =Db::name("pay_payment")->insert($ment);
+            if($payment){
+                $update=[
+                    "pay_fee"=> round($payinfo['pay_fee']+$pay_fee,2),
+                    "wpay_fee"=> round($payinfo['wpay_fee']-$pay_fee,2),
+                    "updatetime"=>date("Y-m-d H:i:s")
+                ];
+                $payup = Db::name("pay")->where($payinfo)->update($update);
+                if($payup){
+                    Db::commit();
+                    return app_show(0,"付款申请添加成功",["dzNo"=>$dzno]);
+                }
+            }
+              Db::rollback();
+              return error_show(1004,"付款申请添加失败");
+
+        }catch (\Exception $e){
+            Db::rollback();
+            return error_show(1005,$e->getMessage());
+        }
+
+    }
+
+    /**
+     * 付款申请审核状态
+     * 付款审核状态 0待发起 1待业务审核 2 待财务审核 3待付款回执 4 付款回执  5 业务驳回 6 财务驳回
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function stageStatus()
+    {
+        $post = $this->post;
+        $dzNo = isset($post['dzNo'])&& $post['dzNo']!="" ? trim($post['dzNo']) :"";
+        if($dzNo==""){
+            return error_show(1004,"参数 dzNo 不能为空");
+        }
+        $status = isset($post['status'])&& $post['status']!="" ? intval($post['status']) :"";
+        if($status==""){
+            return error_show(1004,"参数status 不能为空");
+        }
+        if(!in_array($status,[0,1,2,3,4,5,6])){
+            return error_show(1004,"参数status 无效值");
+        }
+
+        $payment= Db::name("pay_payment")->where([['dzNo',"=",$dzNo],['is_del',"=",0]])->find();
+
+        if($payment==false){
+            return error_show(1005,"未找到付款申请信息");
+        }
+        $payinfo= Db::name("pay")->where([['payNo',"=",$payment['payNo']],['is_del',"=",0]])->find();
+
+       if($payinfo==false){
+            return error_show(1005,"未找到对账信息");
+        }
+        if($payinfo['status']!=3){
+            return error_show(1005,"对账信息未完成审核");
+        }
+        $remark = isset($post['remark'])? trim($post['remark']) :"";
+        $image = isset($post['return_image'])? trim($post['return_image']) :"";
+        $return_time = isset($post['return_time'])? trim($post['return_time']) :"";
+        if($status==4){
+            if($image=="")return error_show(1005,"付款回单图片不能为空");
+            if($return_time=="")return error_show(1005,"付款回单时间不能为空");
+            if($payinfo['pay_fee']< $payment['pay_fee'])return error_show(1005,"对账付款申请金额有误,请确认对账申请金额");
+        }
+        Db::startTrans();
+        try{
+            $mentupdate =["status"=>$status,"remark"=>$remark,"return_img"=>$image,"updatetime"=>date("Y-m-d H:i:s")];
+            if($status==4) $mentupdate['return_time'] = $return_time;
+            $payup=Db::name("pay_payment")->where($payment)->update($mentupdate);
+            if($payup){
+                if (in_array($status,[4,5,6])){
+                    if($status==4){ //审核通过 扣减对账付款中的金额 添加到已付金额
+                        $payupdate =[
+                            "apay_fee"=>$payinfo['apay_fee']+$payment['pay_fee'],
+                            "pay_fee"=>$payinfo['pay_fee']-$payment['pay_fee'],
+                             "pay_status" => ($payinfo['pay_fee']-$payment['pay_fee'])==0 && $payinfo['wpay_fee']==0 ?3:2,
+                             "updatetime" => date("Y-m-d H:i:s")
+                        ];
+                }
+                if($status==5||$status==6){//审核驳回 扣减对账付款中的金额 返回到待付金额中
+                    $payupdate =[
+                        "wpay_fee"=>$payinfo['wpay_fee']+$payment['pay_fee'],
+                        "pay_fee"=>$payinfo['pay_fee']-$payment['pay_fee'],
+                         "pay_status" => $payinfo['apay_fee']==0 ?1:2,
+                        "updatetime" => date("Y-m-d H:i:s")
+                    ];
+                }
+                    $pay = Db::name("pay")->where($payinfo)->update($payupdate);
+                    if($pay==false){
+                        Db::rollback();
+                        return error_show(1003,"对账状态修改失败");
+                    }
+                }
+
+                Db::commit();
+                return app_show(0,"状态修改成功");
+            }else{
+                Db::rollback();
+                return error_show(1003,"状态修改失败");
+            }
+
+        }catch (\Exception $e){
+            Db::rollback();
+            return error_show(1008,$e->getMessage());
+        }
+    }
+    /**对账申请删除
+* @return \think\response\Json|void
+* @throws \think\db\exception\DataNotFoundException
+* @throws \think\db\exception\DbException
+* @throws \think\db\exception\ModelNotFoundException
+ */
+    public function stageDel(){
+        $post = $this->post;
+        $dzNo = isset($post['dzNo'])&& $post['dzNo']!="" ? trim($post['dzNo']) :"";
+        if($dzNo==""){
+            return error_show(1004,"参数 dzNo 不能为空");
+        }
+        $payment= Db::name("pay_payment")->where([['dzNo',"=",$dzNo],['is_del',"=",0]])->find();
+
+        if($payment==false){
+            return error_show(1005,"未找到付款申请信息");
+        }
+        $payinfo= Db::name("pay")->where([['payNo',"=",$payment['payNo']],['is_del',"=",0]])->find();
+
+       if($payinfo==false){
+            return error_show(1005,"未找到付款信息");
+        }
+       Db::startTrans();
+       try{
+           $paym = Db::name("pay_payment")->where($payment)->update(["is_del"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
+           if($paym){
+               if(in_array($payment['status'],[1,2,3,4])){
+                   if(in_array($payment['status'],[1,2,3])){
+                       $payinfo['wpay_fee']+=$payment['pay_fee'];
+                       $payinfo['pay_fee']-=$payment['pay_fee'];
+                       $payinfo['updatetime']=date("Y-m-d H:i:s");
+                   }
+                   if($payment['status']==4){
+                      $payinfo['wpay_fee']+=$payment['pay_fee'];
+                       $payinfo['apay_fee']-=$payment['pay_fee'];
+                       $payinfo['pay_status']=$payinfo['apay_fee']==0? 1 : 2 ;
+                       $payinfo['updatetime']=date("Y-m-d H:i:s");
+                   }
+                    $pay = Db::name("pay")->save($payinfo);
+                     if($pay==false){
+                            Db::rollback();
+                            return error_show(1003,"对账状态修改失败");
+                     }
+             }
+               Db::commit();
+               return app_show(0,"对账申请删除成功");
+           }
+       }catch (\Exception $e){
+            Db::rollback();
+            return error_show(1003,$e->getMessage());
+       }
+    }
+
+    /**
+     * 采购单列表
+     * @param  \think\Request  $request
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function CgdList()
+    {
+        $post = $this->post;
+        $condition = [];
+
+        $check = checkRole($this->roleid,46);
+//        if($check){
+//            $condition []=["ownerid","=",$this->uid];
+//        }
+        $sequenceNo = isset($post['sequenceNo']) && $post['sequenceNo']!='' ? trim($post['sequenceNo']) :"";
+        if($sequenceNo!=""){
+          $condition []=["sequenceNo","like","%$sequenceNo%"];
+        }
+        $status = isset($post['status']) && $post['status']!=='' ? intval($post['status']) :"";
+        if($status!==""){
+          $condition []=["status","=",$status];
+        }
+        $companyNo = isset($post['companyNo']) && $post['companyNo']!='' ? trim($post['companyNo']) :"";
+        if($companyNo!=""){
+          $condition []=["companyNo","like","%$companyNo%"];
+        }
+        $companyName = isset($post['companyName']) && $post['companyName']!='' ? trim($post['companyName']) :"";
+        if($companyName!=""){
+          $condition []=["companyName","like","%$companyName%"];
+        }
+        $bkCode = isset($post['bkCode']) && $post['bkCode']!='' ? trim($post['bkCode']) :"";
+        if($bkCode!=""){
+          $condition []=["bkCode","like","%$bkCode%"];
+        }
+
+         $goodNo = isset($post['goodNo']) && $post['goodNo']!='' ? trim($post['goodNo']) :"";
+        if($goodNo!=""){
+          $condition []=["goodNo","like","%$goodNo%"];
+        }
+         $goodName = isset($post['goodName']) && $post['goodName']!='' ? trim($post['goodName']) :"";
+        if($goodName!=""){
+          $condition []=["goodName","like","%$goodName%"];
+        }
+         $supplierName = isset($post['supplierName']) && $post['supplierName']!='' ? trim($post['supplierName']) :"";
+        if($supplierName!=""){
+          $condition []=["supplierName","like","%$supplierName%"];
+        }
+         $supplierNo = isset($post['supplierNo']) && $post['supplierNo']!='' ? trim($post['supplierNo']) :"";
+        if($supplierNo!=""){
+          $condition []=["supplierNo","like","%$supplierNo%"];
+        }
+        $page =  isset($post['page'])&&$post['page']!="" ? intval($post['page']) :0;
+        $size =  isset($post['size'])&&$post['size']!="" ? intval($post['size']) :10;
+        $count =  Db::name("cgd_info")->where($condition)->count();
+        $total = ceil($count/$size);
+        $page = $page>=$total?intval($total):$page;
+        $list =  Db::name("cgd_info")->where($condition)->page($page,$size)->order('createdTime desc')->select();
+        return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
+    }
+
+
+    //todo
+    public function PayInfo()
+    {
+        $post = $this->post;
+        $token = isset($post['token']) ? trim($post['token']) : "";
+        if($token==""){
+            return error_show(101,'token不能为空');
+        }
+        $effetc = VerifyTokens($token);
+        if(!empty($effetc) && $effetc['code']!=0){
+            return error_show($effetc['code'],$effetc['message']);
+        }
+        $sid = isset($post['sid'])&& $post['sid']!="" ? intval($post['sid']) :"";
+        if($sid==""){
+            return error_show(1004,"参数sid 不能为空");
+        }
+        $payinfo = Db::name("pay_ment")->where("sid","=",$sid)->field("id,payNo,contector,supplierNo,name,pay_method,pay_rate,dpay_fee,inv_rate,rate,dpay_rate,pay_stages,return_img,remark,pay_status,dstatus,pay_remark")->find();
+        if(empty($payinfo)){
+            return error_show(1004,"付款申请信息未找到");
+        }
+        $payinfo['return_img'] = isset($payinfo['return_img']) && $payinfo['return_img']!="" ? explode(",",$payinfo['return_img']):"";
+
+        $paylist = Db::name("pay_info")->where([["payNo","=",$payinfo['payNo']],["status","=",1]])->column("sequenceNo");
+        $payinfo['list']=[];
+        if($paylist){
+            $list = Db::name("cgd_info")->alias('a')->join('cfp_supplier_info b','a.ShortText1617861287265=b.code','left')
+                ->join("cfp_cgd_inv c",'c.cgdNo=a.sequenceNo','left')
+                ->where([["a.sequenceNo","in",$paylist],["a.status","=",1]])->field("a.id,
+        `a`.`sequenceNo` AS `sequenceNo`,
+        `a`.`ownerName` AS `ownerName`,
+        `a`.`department` AS `department`,
+        b.code as supplierNo,
+        `a`.`ShortText1618315935182` AS `cgdNO`,
+        `b`.`name` AS `name`,
+        `b`.`contector` AS `contector`,
+        `b`.`mobile` AS `mobile`,
+        `a`.`ShortText1617861001482` AS `goodNo`,
+        `a`.`ShortText1617861966146` AS `goodName`,
+        `a`.`ShortText1617865626160` AS `goodType`,
+        `a`.`ShortText1617865633070` AS `goodBank`,
+        `a`.`ShortText1617865675342` AS `goodModel`,
+        `a`.`ShortText1617865678025` AS `goodMaterial`,
+	    `a`.`ShortText1617865680605` AS `goodColor`,
+        `a`.`text1618268357055` AS `goodDesc`,
+	    `a`.`ShortText1617865685744` AS `goodUnit`,
+	    `a`.`ShortText1618240134229` AS `goodCat`,
+	   	ifnull( `a`.`Number1618240480148`, '0' ) AS `weight`,
+	    ifnull( `a`.`Number1618240458074`, '0' ) AS `price`,
+	    `a`.`ShortText1617866158120` AS `isDiff`,
+	   `a`.`number1618240356104` AS `workDay`,
+	   `a`.`ShortText1617865688485` AS `taxPoint`,
+	   	`a`.`Number1617865804813` AS `nakedPrice`,
+	`a`.`Number1617865807879` AS `markPrice`,
+	`a`.`Number1617865810822` AS `packPrice`,
+	`a`.`Number1617865813284` AS `certPrice`,
+	`a`.`Number1617865816181` AS `openPrice`,
+	`a`.`number1618240204358` AS `craftPrice`,
+	`a`.`number1618240287778` AS `postPrice`,
+	`a`.`Number1617865818517` AS `totalPrice`,
+	 `a`.`Number1618240685904` AS `purchasePrice`,
+	   `a`.`Number1618240600907` AS `orderNum`,
+       `a`.`Number1618330470625` AS `pay_fee`,
+	`a`.`Number1618330472961` AS `wait_fee`,
+	`a`.`Number1618330541286` AS `inv_open_fee`,
+	`a`.`Number1618330543270` AS `inv_wait_fee`,
+      `a`.`ShortText1619463188366` AS `payinfo`,
+	`a`.`ShortText1619463208482` AS `invinfo`,
+       a.th_status as th_info,
+       a.ShortText1618859321070 as   send_info,
+       `a`.`Number1619632826654` AS `diff_fee`,
+	`a`.`Number1619632830397` AS `diff_info`,
+        createdTime,
+        a.Date1618315953443 as DownTime,
+      IF
+	(( `a`.`sequenceStatus` = 'COMPLETED' ), 2, 1 ) AS `order_status`,
+       ifnull( `c`.`companyNo`, '' ) AS `inv_company`,
+	ifnull( `c`.`status`, '0' ) AS `inv_status`,
+	ifnull( `c`.`id`, '0' ) AS `invid`")
+                ->select();
+            $data=[];
+            foreach ($list as $key=>$value){
+                $value['pay_price'] =sprintf( "%.2f",$value['totalPrice']*$value['orderNum']);
+                if($value['inv_company']!=""){
+                    $invcom = Db::name("company_info")->where([['companyNo',"=",$value['inv_company']],['status',"=",1]])
+                        ->find();
+                    $value['inv_company_name'] =isset($invcom['company_name']) ? $invcom['company_name']:"";
+                }else{
+                    $value['inv_company_name'] ="";
+                }
+                $data[]=$value;
+            }
+            $payinfo['list']=$data;
+            }
+
+        return app_show(0,"获取成功",$payinfo);
+    }
+
+    /**发票新建添加
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+
+    public  function invAdd(){
+        $post = $this->post;
+        $payNo = isset($post['payNo'])&&$post['payNo']!='' ? $post['payNo']:"";
+        if($payNo==""){
+            return error_show(1004,"参数 payNo 不能为空");
+        }
+        $payinfo =Db::name("pay")->where(["payNo"=>$payNo,"is_del"=>0])->find();
+        if($payinfo==false){
+              return error_show(1004,"对账单数据未找到");
+        }
+        if($payinfo['status']!=3){
+            return error_show(1004,"对账单数据未完成审核");
+        }
+        $type = isset($post['invType']) && $post['invType']!="" ? intval($post['invType']):"";
+        if($type==''){
+           return error_show(1004,"参数 invType 不能为空");
+        }
+         $invNumber =isset($post['invNumber'])&& $post['invNumber']!='' ? trim($post['invNumber']):"";
+            $invCode =isset($post['invCode'])&& $post['invCode']!='' ? trim($post['invCode']):"";
+            $checkNumber =isset($post['checkNumber'])&& $post['checkNumber']!='' ? trim($post['checkNumber']):"";
+            $openTime =isset($post['open_time'])&& $post['open_time']!='' ? trim($post['open_time']):"";
+        if($type==1){
+            if($invNumber=="") return error_show(1004,"参数 invNumber 不能为空");
+            if($invCode=="") return error_show(1004,"参数 invCode 不能为空");
+//            if($checkNumber=="") return error_show(1004,"参数 checkNumber 不能为空");
+            if($openTime=="") return error_show(1004,"参数 open_time 不能为空");
+        }
+         $invimg = isset($post['inv_img'])&& $post['inv_img']!='' ? trim($post['inv_img']):"";
+         $invName = isset($post['invName'])&& $post['invName']!='' ? trim($post['invName']):"";
+        if($type==2){
+           if($invimg=="")return error_show(1004,"参数 inv_img 不能为空");
+           if($invName=="")return error_show(1004,"参数 invName 不能为空");
+         }
+         if ($type==3){
+
+        }
+        Db::startTrans();
+        try{
+            $hpNo=makeNo("hp");
+            $data=[
+                "payNo"=>$payNo,
+                "hpNo"=>$hpNo,
+                "apply_id"=>$this->uid,
+                "apply_name"=>$this->uname,
+                "inv_fee"=> '',
+                "invType"=> $type,
+                "invoiceType"=>0,
+                "inv_img"=>$invimg,
+                "invName"=>$invName,
+                "invoiceNumber"=>$invNumber,
+                "invoiceCode"=>$invCode,
+                "checkNumber"=>$checkNumber,
+                "open_time"=>$openTime,
+                "addtime"=>date("Y-m-d H:i:s"),
+                "updatetime"=>date("Y-m-d H:i:s")
+            ];
+            $inadd =Db::name("pay_invoice")->insert($data);
+            if ($inadd){
+             Db::commit();
+             return app_show(0,"回票新建成功",['hpNo'=>$hpNo]);
+            }
+            Db::rollback();
+            return error_show(1004,"回票申请新建失败");
+        }catch (\Exception $e){
+            Db::rollback();
+            return error_show(1004,$e->getMessage());
+        }
+    }
+
+    /**
+ * 发票审核状态
+ *  0 上传发票,1待识别验证 2 待校验识别 3 待财务审核 6 待认证 7认证成功待确认完成 8回票完成 9识别失败 10 验证失败 11 财务驳回 12 认证失败
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function invStatus(){
+        $post = $this->post;
+        $hpNo = isset($post['hpNo'])&& $post['hpNo']!="" ? $post['hpNo'] :"";
+        if($hpNo==""){
+            return error_show(1004,"参数 hpNo 不能为空");
+        }
+         $status = isset($post['status'])&& $post['status']!="" ? intval($post['status']) :"";
+        if($status==""){
+            return error_show(1004,"参数status 不能为空");
+        }
+        if(!in_array($status,[0,1,2,3,4,5,6,7,8,9,10,11,12])){
+            return error_show(1004,"参数status 无效值");
+        }
+
+        $payment= Db::name("pay_invoice")->where([['hpNo',"=",$hpNo],['is_del',"=",0]])->find();
+
+        if($payment==false){
+            return error_show(1005,"未找到回票申请信息");
+        }
+        $payinfo= Db::name("pay")->where([['payNo',"=",$payment['payNo']],['is_del',"=",0]])->find();
+
+       if($payinfo==false){
+            return error_show(1005,"未找到对账信息");
+        }
+        if($payinfo['status']!=3){
+            return error_show(1005,"对账信息未完成审核");
+        }
+        if($payinfo['inv_fee']< $payment['inv_fee'])return error_show(1005,"对账回票申请金额有误,请确认回票申请金额");
+        Db::startTrans();
+        try {
+            $invup =["status"=>$status,"updatetime"=>date("Y-m-d H:i:s")];
+            $inv =Db::name("pay_invoice")->where($payment)->update($invup);
+            if($inv){
+                if($status==8){
+                      $payupdate =[
+                            "ainv_fee"=>$payinfo['ainv_fee']+$payment['inv_fee'],
+                            "inv_fee"=>$payinfo['inv_fee']-$payment['inv_fee'],
+                             "inv_status" => ($payinfo['inv_fee']-$payment['inv_fee'])==0 && $payinfo['winv_fee']==0?3:2,
+                             "updatetime" => date("Y-m-d H:i:s")
+                        ];
+                        $pay =Db::name("pay")->where($payinfo)->update($payupdate);
+                        if($pay==false){
+                            Db::rollback();
+                            return error_show(1003,"回票申请状态更新成功");
+                        }
+                }
+
+                Db::commit();
+                return app_show(0,"回票申请更新成功");
+            }
+                     Db::rollback();
+                    return error_show(1003,"回票申请状态更新成功");
+        }catch (\Exception $e){
+            Db::rollback();
+            return error_show(1004,$e->getMessage());
+        }
+
+    }
+
+    /**发票列表识别
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function InvList()
+    {
+        $post = $this->post;
+        $condition = [["is_del","=",0 ]];
+        $invtype = isset($post['invType'])&&$post['invType']!='' ? intval($post['invType']):"";
+        if ($invtype!=''){
+            $condition[]=["invType","=",$invtype];
+        }
+        $hpNo = isset($post['hpNo'])&&$post['hpNo']!='' ? trim($post['hpNo']):"";
+        if ($hpNo!=''){
+            $condition[]=["hpNo","like","%$hpNo%"];
+        }
+         $invoiceType = isset($post['invoiceType'])&&$post['invoiceType']!='' ? intval($post['invoiceType']):"";
+        if ($invoiceType!=''){
+            $condition[]=["invoiceType","=",$invoiceType];
+        }
+        $status = isset($post['status'])&&$post['status']!="" ? intval($post['status']):"";
+        if($status!=""){
+           $condition[]=["status","=",$status];
+        }
+        $invNumber = isset($post['invNumber'])&&$post['invNumber']!="" ? trim($post['invNumber']):"";
+        if($invNumber!=''){
+            $condition[]=["invoiceNumber","=",$invNumber];
+        }
+
+        $invCode = isset($post['invCode'])&&$post['invCode']!="" ? trim($post['invCode']):"";
+        if($invCode!=''){
+            $condition[]=["invoiceCode","=",$invCode];
+        }
+        $start = isset($post['start']) && $post['start']!="" ? $post['start'] :"";
+        if($start!=""){
+            $condition[]=["addtime",">=",$start." 00:00:00"];
+        }
+        $end = isset($post['end']) && $post['end']!="" ? $post['end'] :"";
+        if($end!=""){
+            $condition[]=["addtime","<=",$end." 23:59:59"];
+        }
+         $open_start = isset($post['open_start']) && $post['open_start']!="" ? $post['open_start'] :"";
+        if($open_start!=""){
+            $condition[]=["open_time",">=",$open_start." 00:00:00"];
+        }
+        $open_end = isset($post['open_end']) && $post['open_end']!="" ? $post['open_end'] :"";
+        if($open_end!=""){
+            $condition[]=["open_time","<=",$open_end." 23:59:59"];
+        }
+        $apply_id = isset($post['apply_id']) && $post['apply_id']!="" ? $post['apply_id'] :"";
+        if($apply_id!=""){
+            $condition[]=["apply_id","=",$apply_id];
+        }
+        $apply_name = isset($post['apply_name']) && $post['apply_name']!="" ? trim($post['apply_name']):"";
+        if($apply_name!=""){
+            $condition[]=["apply_name","like","%$apply_name%"];
+        }
+        $page = isset($post['page'])&&$post['page']!="" ? intval($post['page']):1;
+        $size = isset($post['size'])&&$post['size']!="" ? intval($post['size']):10;
+        $count =Db::name("pay_invoice")->where($condition)->count();
+        $total = ceil($count/$size);
+        $page = $page>$total? intval($total):$page;
+        $list = Db::name("pay_invoice")->where($condition)->page($page,$size)->select();
+        return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
+    }
+
+        /**发票删除
+        * @return \think\response\Json|void
+        * @throws \think\db\exception\DataNotFoundException
+        * @throws \think\db\exception\DbException
+        * @throws \think\db\exception\ModelNotFoundException
+         */
+    public function invDel(){
+        $post = $this->post;
+        $hpNo = isset($post['hpNo'])&&$post['hpNo']!="" ? trim($post['hpNo']) :"";
+        if ($hpNo==""){
+            return error_show(1004,"参数 hpNo 不能为空");
+        }
+        $payinv =Db::name("pay_invoice")->where(["hpNo"=>$hpNo,"is_del"=>0])->find();
+        if($payinv==false){
+            return error_show(1004,"对账单回票申请未找到数据");
+        }
+        $payinfo= Db::name("pay")->where([['payNo',"=",$payinv['payNo']],['is_del',"=",0]])->find();
+       if($payinfo==false){
+            return error_show(1005,"未找到对账信息");
+        }
+        if($payinfo['status']!=3){
+            return error_show(1005,"对账信息未完成审核");
+        }
+        Db::startTrans();
+        try{
+            $update=["is_del"=>1,"updatetime"=>date("Y-m-d H:i:s")];
+            $invup =Db::name("pay_invoice")->where($payinv)->update($update);
+            if($invup){
+                if($payinv['status']==8){
+                    if($payinfo['ainv_fee']< $payinv['inv_fee']){
+                        Db::rollback();
+                        return error_show(1005,"对账回票申请金额有误,请确认回票申请金额");
+                    }
+                     $payupdate =[
+                            "ainv_fee"=>$payinfo['ainv_fee']-$payinv['inv_fee'],
+                            "winv_fee"=>$payinfo['winv_fee']+$payinv['inv_fee'],
+                             "inv_status" => ($payinfo['ainv_fee']-$payinv['inv_fee'])==0?1:2,
+                             "updatetime" => date("Y-m-d H:i:s")
+                        ];
+                        $pay =Db::name("pay")->where($payinfo)->update($payupdate);
+                        if($pay==false){
+                            Db::rollback();
+                            return error_show(1003,"删除失败");
+                     }
+                }
+                Db::commit();
+                return app_show(0,"删除成功");
+            }
+        }catch (\Exception $e){
+                        Db::rollback();
+                        return error_show(1003,$e->getMessage());
+        }
+    }
+
+    public  function UnPay(){
+        $post = $this->post;
+        $token = isset($post['token']) ? trim($post['token']) : "";
+        if($token==""){
+            return error_show(101,'token不能为空');
+        }
+        $effetc = VerifyTokens($token);
+        if(!empty($effetc) && $effetc['code']!=0){
+            return error_show($effetc['code'],$effetc['message']);
+        }
+        $codeNo = isset($post['id'])&&$post['id']!=="" ? trim($post['id']) :'';
+        if($codeNo===""){
+            return error_show(1004,'参数id 不能为空');
+        }
+        $update = Db::name('cgd_info')->where("id","in",$codeNo)->update(['status'=>2]);
+       // echo Db::name('cgd_info')->getLastSql();
+        if($update){
+            return app_show(0,'更新成功');
+        }else{
+            return error_show(1004,'更新失败');
+        }
+    }
+}

+ 256 - 0
app/admin/controller/Role.php

@@ -0,0 +1,256 @@
+<?php
+
+declare (strict_types = 1);
+namespace app\admin\controller;
+use app\admin\BaseController;
+use think\App;
+use think\facade\Db;
+
+class Role extends BaseController{
+
+    public function __construct(App $app) {parent::__construct($app);}
+    /**角色权限列表分页  page size
+        * @return \think\response\Json|void
+        * @throws \think\db\exception\DataNotFoundException
+        * @throws \think\db\exception\DbException
+        * @throws \think\db\exception\ModelNotFoundException
+        */
+    public function roleList(){
+        $post=$this->post;
+        $condition=[];
+        isset($post['status'])&&$post['status']!=="" ? $condition[]=['a.status',"=",$post['status']]:"";
+        isset($post['role_name'])&&$post['role_name']!=="" ? $condition[]=['a.role_name',"like","%".$post['role_name']."%"]:"";
+        isset($post['level'])&&$post['level']!=="" ? $condition[]=["a.level","=",$post['level']]:"";
+        $roleList = Db::name("role");
+        $count =$roleList->alias("a")->where($condition)->count();
+        $page = isset($post['page']) ? intval($post['page']) : 1;
+        $size = isset($post['size']) ? intval($post['size']) : 10;
+        $page >=ceil($count/$size) ? $page= (int)ceil($count/$size) :"";
+        $list=$roleList->alias("a")->leftJoin("cfp_role_action t","a.id=t.role_id")->field("a.*,t.action_conllect as action,t.action_data")->where($condition)->page($page,$size)->select();
+
+        return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
+    }
+    /** 角色新建
+ * @role_name 角色名称
+        * @level 角色等级
+     * @action 功能权限
+     * @action_data 操作权限
+     * @private_data 私有权限
+    * @return \think\response\Json|void
+    * @throws \think\db\exception\DataNotFoundException
+    * @throws \think\db\exception\DbException
+    * @throws \think\db\exception\ModelNotFoundException
+     */
+
+    public function roleAdd(){
+        $post=$this->post;
+        $rolename = isset($post['role_name']) ? trim($post['role_name']) : "";
+        if($rolename==""){
+            return error_show(1002,"角色名称不能为空");
+        }
+        $isT=Db::name("role")->where(['role_name'=>$rolename])->find();
+        if($isT){
+            return error_show(1002,"角色名称已存在");
+        }
+        $level = isset($post['level']) ? intval($post['level']) : "";
+        if($level==""){
+            return error_show(1003,"角色等级不能为空");
+        }
+        $action = isset($post['action'])&&is_array($post['action']) ? implode(",",$post['action']) : "";
+        if($action==""){
+            return error_show(1004,"功能权限不能为空");
+        }
+        $data = isset($post['action_data']) &&is_array($post['action_data'])?implode(",",$post['action_data']): "";
+        $private_data = isset($post['private_data']) &&is_array($post['private_data'])?implode(",",$post['private_data']): "";
+        Db::startTrans();
+        try {
+            $list = [
+                "role_name"=>$rolename,
+                "status"=>1,
+                "addtime"=>date("Y-m-d H:i:s"),
+                "updatetime"=>date("Y-m-d H:i:s"),
+                "level"=>$level,
+            ];
+            $role= Db::name("role")->insert($list,true);
+
+            if($role>0){
+                $role_action = [
+                    "role_id"=>$role,
+                    "action_conllect"=>$action,
+                    "action_data"=>$data,
+                    "private_data"=>$private_data,
+                    "status"=>1,
+                    "addtime"=>date("Y-m-d H:i:s"),
+                    "updatetime"=>date("Y-m-d H:i:s"),
+                ];
+                $roleaction= Db::name("role_action")->insert($role_action,true);
+                if($roleaction){
+                    Db::commit();
+                    return app_show(0,"新建成功");
+                }else{
+                    Db::rollback();
+                    return app_show(1005,"权限录入失败");
+                }
+            }else{
+                Db::rollback();
+                return app_show(1006,"角色新建失败");
+            }
+
+        }catch (\Exception $e){
+            Db::rollback();
+            return error_show(1008,$e->getMessage());
+        }
+    }
+    /**查询角色信息
+     * @roleid 角色id
+    * @return \think\response\Json|void
+    * @throws \think\db\exception\DataNotFoundException
+    * @throws \think\db\exception\DbException
+    * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function roleInfo(){
+        $post=$this->post;
+        $roleid= isset($post['roleid']) ? trim($post['roleid']) : "";
+        if($roleid==""){
+            return error_show(1001,'roleid不能为空');
+        }
+        $info =Db::name("role")->alias("a")->leftJoin("cfp_role_action t","a.id=t.role_id")->field("a.*,t.action_conllect,t.action_data,t.private_data")->where("a.id","=",$roleid)->find();
+        if(!$info){
+            return error_show(1002,"未找到对应的数据");
+        }
+        $info['action'] =explode(",",$info['action_conllect']);
+        $info['action_data'] =$info['action_data']!=""?explode(",",$info['action_data']):"";
+        $info['private_data'] =$info['private_data']!=""?explode(",",$info['private_data']) :"";
+        return app_show(0,"获取成功",$info);
+    }
+    /** 角色信息编辑
+         * @param role_name 角色名称
+         * @param level 等级
+         * @param action 功能权限
+         * @param action_data 操作权限
+         * @param roleid 角色id
+         * @param private_data 私有权限
+        * @return \think\response\Json|void
+        * @throws \think\db\exception\DataNotFoundException
+        * @throws \think\db\exception\DbException
+        * @throws \think\db\exception\ModelNotFoundException
+         */
+    public function roleSave(){
+        $post=$this->post;
+        $roleid= isset($post['roleid']) ? intval($post['roleid']) : "";
+        if($roleid==""){
+            return error_show(1001,'roleid不能为空');
+        }
+        $info =Db::name("role")->where("id","=",$roleid)->find();
+        if(!$info){
+            return error_show(1002,"未找到对应的数据");
+        }
+        $rolename = isset($post['role_name']) ? trim($post['role_name']) : "";
+        if($rolename==""){
+            return error_show(1002,"角色名称不能为空");
+        }
+        $vers= Db::name("role")->where("id",'<>',$roleid)->where("role_name","=",$rolename)->find();
+
+        if($vers){
+            return error_show(1002,"角色名已存在");
+        }
+        $level = isset($post['level']) ? intval($post['level']) : "";
+        if($level==""){
+            return error_show(1003,"角色等级不能为空");
+        }
+        $action = isset($post['action'])&&is_array($post['action']) ? implode(",",$post['action']) : "";
+        if($action==""){
+            return error_show(1004,"功能权限不能为空");
+        }
+        $data = isset($post['action_data']) &&is_array($post['action_data'])?implode(",",$post['action_data']): "";
+        $private_data = isset($post['private_data']) &&is_array($post['private_data'])?implode(",",$post['private_data']): "";
+        Db::startTrans();
+        try {
+            $list = [
+                "role_name"=>$rolename,
+                "level"=>$level,
+                "updatetime"=>date("Y-m-d H:i:s"),
+                'id'=>$roleid
+            ];
+            $role= Db::name("role")->save($list);
+            if($role){
+                $role_action = [
+                    "role_id"=>$roleid,
+                    "action_conllect"=>$action,
+                    "action_data"=>$data,
+                    "private_data"=>$private_data,
+                    "updatetime"=>date("Y-m-d H:i:s")
+                ];
+                $roleaction= Db::name("role_action")->where("role_id","=",$roleid)->update($role_action);
+                if($roleaction){
+                    Db::commit();
+                    return app_show(0,"更新成功");
+                }else{
+                    Db::rollback();
+                    return app_show(1005,"权限更新失败");
+                }
+            }else{
+                Db::rollback();
+                return app_show(1006,"角色更新失败");
+            }
+
+        }catch (\Exception $e){
+            Db::rollback();
+            return error_show(1008,$e->getMessage());
+        }
+    }
+
+        /**
+        * 角色状态更新
+ * @roleid  角色id
+ * @status  角色状态 0 /1
+     * @return \think\response\Json
+     * @throws \think\exception\DbException
+     */
+    public function roleStatus(){
+        $post=$this->post;
+        $roleid= isset($post['roleid']) ? intval($post['roleid']) : "";
+        if($roleid==""){
+            return error_show(1001,'roleid不能为空');
+        }
+        $status = isset($post['status']) ? intval($post['status']) : "";
+        if($status===""){
+            return error_show(1001,'status不能为空');
+        }
+        if(!in_array($status,[0,1])){
+            return error_show(1001,'status参数非法');
+        }
+        Db::startTrans();
+        try {
+            $dat=[
+                'status'=>$status,'updatetime'=>date("Y-m-d H:i:s"),  'id'=>$roleid
+            ];
+            $re = Db::name("role")->save($dat);
+            if($re){
+                $dat2=[
+                    'status'=>$status,'updatetime'=>date("Y-m-d H:i:s")
+                ];
+                $action =  Db::name("role_action")->where("role_id","=",$roleid)->update($dat2);
+                if($action){
+                    Db::commit();
+                    return app_show(0,"状态更新成功");
+                }
+            }
+            Db::rollback();
+            return error_show(1003,"状态更新失败");
+        }catch (\Exception $e){
+            Db::rollback();
+            return error_show(1002,$e->getMessage());
+        }
+    }
+
+     /**
+        * 获取所有角色
+     * @return \think\response\Json
+     * @throws \think\exception\DbException
+     */
+    public function RoleAll(){
+        $list =Db::name("role")->select();
+        return app_show(0,"获取成功",$list);
+    }
+}

+ 258 - 0
app/admin/controller/Share.php

@@ -0,0 +1,258 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller;
+
+use app\admin\BaseController;
+use think\App;use think\facade\Db;
+class Share extends BaseController
+{
+    public function __construct(App $app) {parent::__construct($app);}
+    /**
+     * 权限分享数据列表
+     *
+     * @return \think\Response
+     */
+    public function index()
+    {
+        $post = $this->post;
+        $page = isset($post['page']) ? intval($post['page']): 1;
+        $size = isset($post['size']) ? intval($post['size']):10;
+        $condition=[];
+        $condition[]=["is_del","=",0];
+        $count =Db::name("role_share")->where($condition)->count();
+        $total = ceil($count/$size)>1 ? ceil($count/$size) : 1;
+        $page = $page>=$total?intval($total):$page;
+        $list = Db::name("role_share")->where($condition)->page($page,$size)->select();
+        $result = [];
+        foreach ($list as $key=>$val){
+            $temp = [];
+            $temp['id']=$val['id'];
+
+            $menu = Db::name("admin_menu")->where("id in ({$val['action_collect']})")->column("menu_name");
+            $temp['actionlist']=implode(",",$menu);
+            $userid = [];
+            $val['share_user']!=""&&$val['share_user']!=0  ?$userid[]=$val['share_user']:"";
+            $val['to_user']!=""&&$val['to_user']!=0  ?$userid[]=$val['to_user']:"";
+            $cond = ['id' => $userid];
+            $user = GetUserlist($post['token'], $cond);
+           $share_name = "";
+           $to_name = "";
+
+            if ($user['code'] == 0 && !empty($user['data'])) {
+                foreach ($user['data'] as $v) {
+
+                    if($val['share_user']==$v['id']){
+                        $share_name= isset($v['nickname']) ?$v['nickname']:"";
+                    }
+                    if($val['to_user']==$v['id']){
+                        $to_name= isset($v['nickname']) ?$v['nickname']:"";
+                    }
+                }
+            }
+
+            $temp['share_user']=$share_name;
+            $togroup = $val['to_group']!=""&&$val['to_group']!=0?Db::name("role_group")->where("id","=",
+                $val["to_group"])->find()
+                :['group_name'=>""];
+
+            $temp['to_user']=$to_name;
+            $temp['to_group']=$togroup['group_name'];
+            $temp['status']=$val['status'];
+            $temp['action']=$val['action'];
+            $temp['addtime']=$val['addtime'];
+            array_push($result,$temp);
+        }
+        return  app_show(0,"获取成功",['list'=>$result,"count"=>$count]);
+    }
+
+    /**
+     * 权限分享数据新建
+     *
+     * @return \think\Response
+     */
+    public function create()
+    {
+        $post = $this->post;
+        $collect = isset($post['collect']) ? trim($post['collect']):"";
+        $user = isset($post['userid']) ? intval($post['userid']):"";
+        $touser = isset($post['touserid']) ? intval($post['touserid']):"";
+        $togroup = isset($post['togroupid']) ? intval($post['togroupid']):"";
+        $action = isset($post['action']) ? intval($post['action']):"";
+        if($collect==""){
+            return error_show(1002,"菜单数据不能为空");
+        }
+        if($user==""){
+            return error_show(1003,"数据源用户不能为空");
+        }
+        if($touser=="" && $togroup==""){
+            return error_show(1004,"共享用户或用户组不能为空");
+        }
+        if($action===""){
+            return error_show(1005,"共享数据权限不能为空");
+        }
+        $data=[
+            "action_collect"=>$collect,
+            "share_user"=>$user,
+            "to_user"=>$touser,
+            "to_group"=>$togroup,
+            "action"=>$action,
+            "status"=>1,
+            "addtime"=>date("Y-m-d H:i:s"),
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $result= Db::name("role_share")->save($data);
+        return $result ? app_show(0,"新建成功"):error_show(1006,"新建失败");
+    }
+
+    /**
+     * 权限分享数据编辑
+     *
+     * @param  \think\Request  $request
+     * @return \think\Response
+     */
+    public function save()
+    {
+        $post = $this->post;
+        $id = isset($post['id'])&&$post['id']!="" ? intval($post['id']):"";
+        $collect = isset($post['collect'])&&$post['collect']!="" ? trim($post['collect']):"";
+        $user = isset($post['userid'])&&$post['userid']!="" ? intval($post['userid']):"";
+        $touser = isset($post['touserid'])&&$post['touserid']!="" ? intval($post['touserid']):"";
+        $togroup = isset($post['togroupid'])&&$post['togroupid']!="" ? intval($post['togroupid']):"";
+        $action = isset($post['action'])&&$post['action']!="" ? trim($post['action']):"";
+        $info = Db::name("role_share")->where("id","=",$id)->find();
+        if(!$info){
+            return error_show(1002,"未找到对应数据");
+        }
+        if($collect==""){
+            return error_show(1002,"菜单数据不能为空");
+        }
+        if($user==""){
+            return error_show(1003,"数据源用户不能为空");
+        }
+        if($touser=="" && $togroup==""){
+            return error_show(1004,"共享用户或用户组不能为空");
+        }
+        $data=[
+            "action_collect"=>$collect,
+            "share_user"=>$user,
+            "to_user"=>$touser,
+            "to_group"=>$togroup,
+            "action"=>$action,
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $result= Db::name("role_share")->where("id","=",$id)->update($data);
+        return $result ? app_show(0,"更新成功"):error_show(1006,"更新失败");
+    }
+
+    /**
+     * 权限数据分享信息
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function read()
+    {
+         $post = $this->post;
+        $id = isset($post['id'])&&$post['id']!=""  ? intval($post['id']):"";
+        $info =  Db::name("role_share")->where([["id","=",$id],["is_del","=",0]])->find();
+        if(!$info){
+            return error_show(1002,"未找到对应数据");
+        }
+
+        $menu =Db::name("admin_menu")->where("id in ({$info['action_collect']})")->column("menu_name");
+
+        $info['actionlist']=implode(",",$menu);
+
+        $userid = [];
+        $info['share_user']!=""&&$info['share_user']!=0  ?$userid[]=$info['share_user']:"";
+        $info['to_user']!=""&&$info['to_user']!=0  ?$userid[]=$info['to_user']:"";
+        $cond = ['id' => $userid];
+        $user = GetUserlist($post['token'], $cond);
+        $share_name = "";
+        $to_name = "";
+        if ($user['code'] == 0 && !empty($user['data'])) {
+            foreach ($user['data'] as $v) {
+                if($info['share_user']==$v['id']){
+                    $share_name= isset($v['nickname']) ?$v['nickname']:"";
+                }
+                if($info['to_user']==$v['id']){
+                    $to_name= isset($v['nickname']) ?$v['nickname']:"";
+                }
+            }
+        }
+        $info['to_group']==0 ? $info['to_group']='':"";
+        $togroup= $info['to_group']!="" ?Db::name("role_group")->where("id","=",$info["to_group"])->find()
+            :['group_name'=>""];
+        $info['share_user_name']=$share_name;
+        $info['to_user_name'] = $to_name;
+        $info['to_group_name'] = $togroup['group_name'];
+        return   app_show(0,"获取成功",$info);
+    }
+
+    /**
+     * 权限数据状态设置
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function status()
+    {
+        $post = $this->post;
+        $id = isset($post['id']) ? intval($post['id']):"";
+        if($id==""){
+            return error_show(1002,"参数id 不能为空");
+        }
+        $info =  Db::name("role_share")->where([["id","=",$id],["is_del","=",0]])->find();
+        if(!$info){
+            return error_show(1002,"未找到对应数据");
+        }
+        $status =  isset($post['status']) && $post['status']!=""? intval($post['status']):"";
+        if($status===""){
+            return error_show(1002,"参数status 不能为空");
+        }
+        if(!in_array($status,[0,1])){
+            return error_show(1002,"参数status 无效");
+        }
+        $info['status']=$status;
+        $info['updatetime']=date("Y-m-d H:i:s");
+        $msg = $status==1?"启用":"禁用";
+        $update = Db::name("role_share")->save($info);
+        return  $update? app_show(0,"{$msg}成功"):error_show(1004,"{$msg}失败");
+    }
+
+    /**
+     * 保存更新的资源
+     *
+     * @param  \think\Request  $request
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function update(Request $request, $id)
+    {
+        //
+    }
+
+    /**
+     * 删除指定资源
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function delete()
+    {
+        $post = $this->post;
+        $id = isset($post['id']) ? intval($post['id']):"";
+        if($id==""){
+            return error_show(1002,"参数id 不能为空");
+        }
+        $info =  Db::name("role_share")->where([["id","=",$id],["is_del","=",0]])->find();
+        if(!$info){
+            return error_show(1002,"未找到对应数据");
+        }
+        $info["status"]=0;
+        $info["is_del"]=1;
+        $info["updatetime"]=date("Y-m-d H:i:s");
+        $update = Db::name("role_share")->save($info);
+        return  $update? app_show(0,"删除成功"):error_show(1004,"删除失败");
+    }
+}

+ 166 - 0
app/admin/controller/Supplier.php

@@ -0,0 +1,166 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller;
+use app\admin\BaseController;
+use think\App;
+use think\facade\Db;
+
+class Supplier extends BaseController
+{
+    public function __construct(App $app) {parent::__construct($app);}
+    /**
+     * 显示资源列表
+     *
+     * @return \think\Response
+     */
+    public function SupplierList()
+    {
+        $post = $this->post;
+        $condition = "1=1 ";
+       $name= isset($post['name'])&&$post['name']!="" ? trim($post['name']) :"";
+       if($name!=""){
+           $condition .=" and (name like '%{$name}%' or contector like '%{$name}%')";
+       }
+        $page =  isset($post['page'])&&$post['page']!="" ? intval($post['page']) :0;
+        $size =  isset($post['size'])&&$post['size']!="" ? intval($post['size']) :10;
+        $count = Db::name("supplier_info")->where($condition)->count();
+        $total = ceil($count/$size)>1 ? ceil($count/$size) : 1;
+        $page = $page>=$total?intval($total):$page;
+        $list =  Db::name("supplier_info")->where($condition)->page($page,$size)->field("id,code,name,contector,nature,mobile,address,post,addtime")->select();
+        return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
+    }
+
+    /**
+     * 获取供应商信息
+     *
+     * @return \think\Response
+     */
+    public function SupplierInfo()
+    {
+        $post = $this->post;
+        $sid = isset($post['id'])&& $post['id']!="" ? intval($post['id']) :"";
+        if($sid==""){
+            return error_show(1002,"参数d不能为空");
+        }
+        $supplier = Db::name("supplier_info")->where("id","=",$sid)->find();
+        if($supplier==false){
+            return error_show(1003,"供应商信息不存在");
+        }
+        $cgd = Db::name("pay")->where([["supplierNo","=",$supplier['code']],["status","<>",0]])
+            ->field("id,payNo,pay_fee,wait_fee,status")->select();
+
+        $list=["payment"=>["wait"=>["total"=>0,"num"=>0],"already"=>["total"=>0,"num"=>0]],"invoice"=>["wait"=>["total"=>0,"num"=>0],"already"=>["total"=>0,"num"=>0]]];
+
+        foreach ($cgd as $key=>$value){
+
+            $list['payment']['wait']['total']+= $value['wait_fee']*100;
+            $list['payment']['already']['total']+= $value['pay_fee']*100;
+
+            $paystage = Db::name("pay_stages")->where([["payNo","=",$value['payNo']],["is_del","=",0],['status',">","4"],['status',"<>","9"]])
+                ->sum('pay_fee');
+
+            $paywait = Db::name("pay_stages")->where([["payNo","=",$value['payNo']],["is_del","=",0],['status',"<","4"],
+                ['status',"<>","9"]])
+                ->sum('pay_fee');
+
+            $list['invoice']['wait']['total']+= $paywait*100;
+            $list['invoice']['already']['total']+= $paystage*100;
+            if($value['status']==2){
+                $list['payment']['already']["num"]++;
+            }else{
+                $list['payment']['wait']["num"]++;
+            }
+        }
+        array_walk($list,function (&$v){
+            $v['wait']['total'] = $v['wait']['total']/100;
+            $v['already']['total'] = $v['already']['total']/100;
+        });
+        return app_show(0,"获取成功",$list);
+    }
+
+    /**
+     * 修改供应商信息
+     *
+     * @param  \think\Request  $request
+     * @return \think\Response
+     */
+    public function SupplierSave()
+    {
+        $post = $this->post;
+        $sid = isset($post['id'])&& $post['id']!="" ? intval($post['id']) :"";
+        if($sid==""){
+            return error_show(1002,"参数d不能为空");
+        }
+        $supplier = Db::name("supplier_info")->where("id","=",$sid)->find();
+        if($supplier==false){
+            return error_show(1003,"供应商信息不存在");
+        }
+        $name= isset($post['name'])&& $post['name']!="" ? trim($post['name']) :"";
+        if($name==""){
+            return error_show(1002,"供货商名称不能为空");
+        }
+        $contector= isset($post['contector'])&& $post['contector']!="" ? trim($post['contector']) :"";
+        if($contector==""){
+            return error_show(1002,"联系人名称不能为空");
+        }
+
+        $mobile= isset($post['mobile'])&& $post['mobile']!="" ? trim($post['mobile']) :"";
+        if($mobile==""){
+            return error_show(1002,"联系人手机号不能为空");
+        }
+        if(!checkMobile($mobile)){
+            return error_show(1002,"联系人手机号格式错误");
+        }
+        $pay_method= isset($post['pay_method'])&& $post['pay_method']!="" ? trim($post['pay_method']) :"";
+        if($pay_method==""){
+            return error_show(1002,"结账方式不能为空");
+        }
+        $paydays= isset($post['paydays'])&& $post['paydays']!="" ? trim($post['paydays']) :"";
+        $return_ticket= isset($post['return_ticket'])&& $post['return_ticket']!="" ? trim($post['return_ticket']) :"";
+        $data=[
+            "id"=>$supplier['id'],
+            "name"=>$name,
+            "contector"=>$contector,
+            "mobile"=>$mobile,
+            "pay_method"=>$pay_method,
+            "paydays"=>$paydays,
+            "return_ticket"=>$return_ticket,
+            "updatetime"=>date("Y-m-d H:i:s"),
+        ];
+        $save = Db::name("supplier_info")->save($data);
+        return $save ? app_show(0,"修改成功") :error_show(1003,"修改失败");
+    }
+
+    /**
+     * 供应商状态修改
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function SupplierStatus()
+    {
+        $post = $this->post;
+        $sid = isset($post['id'])&& $post['id']!="" ? intval($post['id']) :"";
+        if($sid==""){
+            return error_show(1002,"参数d不能为空");
+        }
+        $supplier = Db::name("supplier_info")->where("id","=",$sid)->find();
+        if($supplier==false){
+            return error_show(1003,"供应商信息不存在");
+        }
+        $status= isset($post['status'])&& $post['status']!="" ? intval($post['status']) :"";
+        if($status==""){
+            return error_show(1002,"参数status不能为空");
+        }
+        $data=[
+            "id"=>$sid,
+            "status"=>$status,
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $udap = DB::name("supplier_ifno")->save($data);
+        return $udap ? app_show(0,"修改成功") :error_show(1003,"修改失败");
+    }
+
+
+}

+ 261 - 0
app/admin/controller/User.php

@@ -0,0 +1,261 @@
+<?php
+
+declare (strict_types = 1);
+namespace app\admin\controller;
+use app\admin\BaseController;use think\App;use think\facade\Db;
+
+class User extends BaseController{
+ public function __construct(App $app) {parent::__construct($app);}
+ //获取用户列表分页
+ public  function  userList(){
+     if(isset($this->post['status'])&&$this->post['status']!==''){
+            $uid =Db::name("user_role")->where(["status"=>1,"is_del"=>0])->column("uid");
+            if($this->post['status']==1){
+                $this->post['uid']= isset($uids)?array_unique(array_merge($uids,$uid)):$uid;
+            }else{
+                $this->post['nouid']=$uid;
+            }
+            unset($this->post['status']);
+        }
+        $userinfo=GetList($this->post['token'],$this->post);
+        if(empty($userinfo)||$userinfo['code']!=0){
+            return app_show($userinfo['code'],$userinfo['msg']);
+        }
+        $data = $userinfo['data']['list'];
+        $role = Db::name("role")->column("role_name","id");
+        $roleArr = Db::name("user_role")->where(["status"=>1,"is_del"=>0])->column("roleid,status","uid");
+        $role[0]="";
+        $list=[];
+        foreach ($data as $value){
+            $value['roleid']=isset($roleArr[$value['id']]['roleid'])?$roleArr[$value['id']]['roleid'] :"";
+            $value['status']=isset($roleArr[$value['id']]['status'])?$roleArr[$value['id']]['status']:"";
+            $value["role_name"] = isset($role[$value["roleid"]]) ? $role[$value["roleid"]]:"";
+            $list[]=$value;
+        }
+        return app_show(0,"获取成功",["list"=>$list,"count"=>$userinfo['data']["count"]]);
+    }
+
+    /**获取当前访问用户的信息
+     * @param token
+     * @return \think\response\Json
+     * @throws \think\exception\DbException
+     */
+    public function userInfo(){
+        $userinfo=GetUserInfo($this->post['token']);
+        if(empty($userinfo)||$userinfo['code']!=0){
+            return app_show(1002,"员工信息不存在");
+        }
+        $data = $userinfo['data'];
+        $data['roleid']= $this->roleid;
+        $role = Db::name("role")->where("id","=",$data['roleid'])->find();
+        $data['role_name']=isset($role['role_name']) ? $role['role_name'] :"";
+        return app_show(0,"获取成功",$data);
+    }
+    //修改用户状态 status 0 禁用1启用
+    /**
+     * @return \think\response\Json|void
+    * @throws \think\db\exception\DataNotFoundException
+    * @throws \think\db\exception\DbException
+    * @throws \think\db\exception\ModelNotFoundException
+    */
+    public function setStatus(){
+        $post =$this->post;
+       $userid = isset($post['id'])&&$post['id']!==""?intval($post['id']):"";
+        if($userid==""){
+            return error_show(1004,"参数id 不能为空");
+        }
+        $status = isset($post['status'])&&$post['status']!=""?intval($post['status']):"";
+
+        if($status===""){
+            return error_show(1004,"参数status 不能为空");
+        }
+        if(!in_array($status,[0,1])){
+            return error_show(1004,"参数status无效");
+        }
+        $message = $status==1?"启用":"禁用";
+        $userinfo =Db::name("user_role")->where(["uid"=>$userid,"is_del"=>0])->find();
+        if($userinfo==false){
+            $data=[
+                "uid"=>$userid,
+                "roleid"=>0,
+                "status"=>$status,
+                "is_del"=>0,
+                "addtime"=>date("Y-m-d H:i:s"),
+                "updatetime"=>date("Y-m-d H:i:s"),
+            ];
+            $sa=Db::name("user_role")->save($data);
+        }else{
+            $userinfo['status']=$status;
+            $userinfo['updatetime']=date("Y-m-d H:i:s");
+            $sa=Db::name("user_role")->save($userinfo);
+        }
+       if($sa==false){
+            return error_show(1005,"{$message}失败");
+        }else{
+
+            return app_show(0,"{$message}成功");
+        }
+    }
+    //获取所有用户的信息
+     public  function  userAll(){
+     if(isset($this->post['status'])&&$this->post['status']!==''){
+                $uid =Db::name("user_role")->where(["status"=>1,"is_del"=>0])->column("uid");
+                if($this->post['status']==1){
+                    $this->post['uid']= isset($uids)?array_unique(array_merge($uids,$uid)):$uid;
+                }else{
+                    $this->post['nouid']=$uid;
+                }
+                unset($this->post['status']);
+            }
+        $userinfo=GetAccountall($this->post['token'],$this->post);
+        if(empty($userinfo)||$userinfo['code']!=0){
+            return app_show(1002,"员工信息不存在");
+        }
+        $data = $userinfo['data'];
+        $role = Db::name("role")->column("role_name","id");
+        $roleArr = Db::name("user_role")->where(["status"=>1,"is_del"=>0])->column("roleid,status","uid");
+        $role[0]="";
+        $list=[];
+        foreach ($data as $value){
+                    $value['roleid']=isset($roleArr[$value['id']]['roleid'])?$roleArr[$value['id']]['roleid'] :"";
+            $value['status']=isset($roleArr[$value['id']]['status'])?$roleArr[$value['id']]['status']:"";
+            $value["role_name"] = isset($role[$value["roleid"]]) ? $role[$value["roleid"]]:"";
+            $list[]=$value;
+        }
+        return app_show(0,"获取成功",$list);
+    }
+    /**
+    * 修改用户基础信息
+    */
+    public  function  userSave(){
+        $post=$this->post;
+        $userid = isset($post['id'])&&$post['id']!==""?intval($post['id']):"";
+        if($userid==""){
+            return error_show(1004,"参数id 不能为空");
+        }
+
+        $nickname= isset($post['nickname'])? trim($post['nickname']):"";
+        if ($nickname==""){
+            return app_show(1001,"昵称不能为空");
+        }
+        $mobile= isset($post['mobile'])? trim($post['mobile']):"";
+        if ($mobile==""){
+            return app_show(1002,"手机号不能为空");
+        }
+        if (checkMobile($mobile)==false){
+            return app_show(1002,"手机号格式不正确");
+        }
+        $email= isset($post['email'])? trim($post['email']):"";
+        $role =isset($post['role'])? intval($post['role']):0;
+        if($role!=0){
+            $roleinfo =Db::name("role")->where("id","=",$role)->find();
+            if(empty($roleinfo)){
+                return error_show(1002,"角色不存在");
+            }
+            if($roleinfo['status']==0){
+                return error_show(1002,"角色已禁用");
+            }
+        }
+        $userrole = Db::name("user_role")->where(["uid"=>$userid,"is_del"=>0])->find();
+
+        Db::startTrans();
+        try{
+             if(empty($userrole)){
+                $roledata =[
+                    "uid"=>$userid,
+                    "roleid"=>$role,
+                    "nickname"=>$nickname,
+                    "status"=>1,
+                    "addtime"=>date("Y-m-d H:i:s"),
+                    "updatetime"=>date("Y-m-d H:i:s")
+                ];
+               $up= Db::name("user_role")->insert($roledata);
+            }else{
+                $userrole['roleid'] = $role;
+                $userrole['updatetime'] = date("Y-m-d H:i:s");
+                $up=Db::name("user_role")->save($userrole);
+            }
+              if($up==false){
+                   Db::rollback();
+                return error_show(1004,'用户信息更新失败');
+              }
+             $data=[
+                "id"=>$userid,
+                "nickname"=>$nickname,
+                "mobile"=>$mobile,
+                "email"=>$email
+            ];
+            $save =resetinfo($post['token'],$data);
+            if(!empty($save) && $save['code']!=0){
+                Db::rollback();
+                return error_show($save['code'],$save['message']);
+            }
+            Db::commit();
+            return app_show(0,'用户信息更新成功');
+        }catch (\Exception $e){
+             Db::rollback();
+             return error_show(1004,$e->getMessage());
+        }
+    }
+        //角色设置
+        /** id roleid
+        * @return \think\response\Json|void
+        * @throws \think\db\exception\DataNotFoundException
+        * @throws \think\db\exception\DbException
+        * @throws \think\db\exception\ModelNotFoundException
+         */
+        public function setRole(){
+        $post  =$this->post;
+        $uid = isset($post['id'])&&$post['id']!=='' ? intval($post['id']) :"";
+        if($uid===''){
+            return error_show(1004,"参数id 不能为空");
+        }
+        $roleinfo = Db::name("user_role")->where(["uid"=>$uid])->find();
+        $role =isset($post['roleid']) && $post['roleid']!=="" ? intval($post['roleid']) :"";
+        if($role===''){
+            return error_show(1004,"参数roleid 不能为空");
+        }
+        $isRole = Db::name('role')->where([['id',"=",$role],['status',"=",1]])->find();
+        if(empty($isRole)){
+            return error_show(1004,"所选角色不存在");
+        }
+        if($roleinfo==false){
+        $data = [
+            'uid'=>$uid,
+            'roleid'=>$role,
+            'status'=>1,
+            'addtime'=>date('Y-m-d H:i:s'),
+            'updatetime'=>date('Y-m-d H:i:s'),
+        ];
+        $insert = Db::name('user_role')->insert($data);
+        }else{
+            $roleinfo['roleid']=$role;
+            $roleinfo['status']=1;
+            $roleinfo['is_del']=0;
+            $roleinfo['updatetime']=date('Y-m-d H:i:s');
+        $insert = Db::name('user_role')->save($roleinfo);
+        }
+        return $insert? app_show(0,'数据新建成功'):error_show(1004,'数据新建失败');
+    }
+        //密码设置
+        public  function setPwd(){
+        $post  =$this->post;
+
+        $userid = isset($post['id'])&&$post['id']!==""?intval($post['id']):"";
+        if($userid==""){
+            return error_show(1004,"参数id 不能为空");
+        }
+        $newPwd= isset($post['password']) ? trim($post['password']) : "";
+        if($newPwd==""){
+            return error_show(1001,'密码不能为空');
+        }
+
+        $data = resetpwd($post['token'],["id"=>$userid,'password'=>$newPwd]);
+        if(empty($data)||$data['code']!=0){
+            return error_show($data['code'],$data['message']);
+        }else{
+            return app_show(0,"密码修改成功");
+        }
+    }
+
+}

+ 85 - 0
app/admin/controller/index.php

@@ -0,0 +1,85 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller;
+
+use think\Request;
+
+class index
+{
+    /**
+     * 显示资源列表
+     *
+     * @return \think\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    /**
+     * 保存新建的资源
+     *
+     * @param  \think\Request  $request
+     * @return \think\Response
+     */
+    public function save(Request $request)
+    {
+        //
+    }
+
+    /**
+     * 显示指定的资源
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function read($id)
+    {
+        //
+    }
+
+    /**
+     * 显示编辑资源表单页.
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function edit($id)
+    {
+        //
+    }
+
+    /**
+     * 保存更新的资源
+     *
+     * @param  \think\Request  $request
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function update(Request $request, $id)
+    {
+        //
+    }
+
+    /**
+     * 删除指定资源
+     *
+     * @param  int  $id
+     * @return \think\Response
+     */
+    public function delete($id)
+    {
+        //
+    }
+}

+ 75 - 0
app/admin/route/app.php

@@ -0,0 +1,75 @@
+<?php
+
+use think\facade\Route;
+Route::rule('menu', 'admin/Menu/MenuList');
+Route::rule('menuadd', 'admin/Menu/MenuAdd');
+Route::rule('menusave', 'admin/Menu/MenuEdit');
+Route::rule("menuactionlist","admin/Action/index");
+Route::rule('menustatus', 'admin/Menu/MenuStatus');
+Route::rule('menuaction', 'admin/Menu/ActionList');
+Route::rule('menuactionsave', 'admin/Menu/ActionSave');
+Route::rule('menuactionstatus', 'admin/Menu/ActionStatus');
+Route::rule('menuactionadd', 'admin/Menu/ActionAdd');
+Route::rule("menulist","admin/Menu/MenuAllList");
+
+Route::rule('userlist', 'admin/User/userList');
+Route::rule('userall', 'admin/User/userAll');
+Route::rule('userinfo', 'admin/User/userInfo');
+Route::rule('usersave', 'admin/User/userSave');
+Route::rule('setrole', 'admin/User/setRole');
+Route::rule('setpwd', 'admin/User/setPwd');
+Route::rule('setstatus', 'admin/User/setStatus');
+
+Route::rule('rolelist', 'admin/Role/roleList');
+Route::rule('roleall', 'admin/Role/roleAll');
+Route::rule('roleinfo', 'admin/Role/roleInfo');
+Route::rule('roleadd', 'admin/Role/roleAdd');
+Route::rule('rolesave', 'admin/Role/roleSave');
+Route::rule('rolestatus', 'admin/Role/roleStatus');
+
+Route::rule('grouplist', 'admin/Group/GroupList');
+Route::rule('groupall', 'admin/Group/GroupAll');
+Route::rule('groupinfo', 'admin/Group/GroupInfo');
+Route::rule('groupadd', 'admin/Group/GroupAdd');
+Route::rule('groupsave', 'admin/Group/GroupSave');
+Route::rule('groupstatus', 'admin/Group/GroupStatus');
+
+Route::rule("supplierlist","admin/Supplier/SupplierList");
+//Route::rule("supplierinfo","admin/Supplier/SupplierInfo");
+//Route::rule("suppliersave","admin/Supplier/SupplierSave");
+//Route::rule("supplierstatus","admin/Supplier/SupplierStatus");
+
+Route::rule("customerlist","admin/Customer/list");
+Route::rule("customerinfo","admin/Customer/read");
+Route::rule("customer","admin/Customer/info");
+Route::rule("invoicelist","admin/Customer/invoice");
+
+Route::rule("shareadd","admin/Share/create");
+Route::rule("sharesave","admin/Share/save");
+Route::rule("sharestatus","admin/Share/status");
+Route::rule("sharedel","admin/Share/delete");
+Route::rule("shareinfo","admin/Share/read");
+
+Route::rule("companyinfo","admin/Company/Info");
+Route::rule("companyadd","admin/Company/create");
+Route::rule("companysave","admin/Company/save");
+Route::rule("companystatus","admin/Company/status");
+Route::rule("companylist","admin/Company/list");
+Route::rule("companyall","admin/Company/all");
+Route::rule("ratelist","admin/Company/RateList");
+
+Route::rule("paylist","admin/Payment/payList");
+Route::rule("paymentlist","admin/Payment/paymentList");
+Route::rule("payadd","admin/Payment/PayAdd");
+Route::rule("paysave","admin/Payment/PaySave");
+Route::rule("paystatus","admin/Payment/PayStatus");
+Route::rule("paydel","admin/Payment/payDel");
+Route::rule("stageadd","admin/Payment/stageAdd");
+Route::rule("stagestatus","admin/Payment/stageStatus");
+Route::rule("stagedel","admin/Payment/stageDel");
+Route::rule("cgdlist","admin/Payment/CgdList");
+Route::rule("invadd","admin/Payment/invAdd");
+Route::rule("invstatus","admin/Payment/invStatus");
+Route::rule("invlist","admin/Payment/InvList");
+Route::rule("invdel","admin/Payment/invDel");
+

+ 226 - 0
app/common.php

@@ -0,0 +1,226 @@
+<?php
+// 应用公共文件
+use think\facade\Config;
+use think\facade\Db;
+use think\facade\Filesystem;
+// 应用公共文件
+function app_show($code=0,$message="",$data=[]){
+    $result = ['code'=>$code,"message"=>$message,"data"=>$data];
+    echo json_encode($result,JSON_UNESCAPED_UNICODE);
+    die();
+}
+
+// 应用公共文件
+function error_show($code=0,$message=""){
+    $result = ['code'=>$code,"message"=>$message];
+    echo json_encode($result,JSON_UNESCAPED_UNICODE);
+    die();
+}
+
+function GetUserInfo($token){
+    $host = Config::get("app");
+    $url = $host["api_host"]."/Api/userinfo";
+    $data=[
+        "token"=>$token
+    ];
+    $response=curl_request($url,$data);
+
+    return json_decode($response,true);
+}
+
+/**手机号验证
+ * @param $mobile
+ * @return bool
+ */
+function checkMobile($mobile){
+    if (!is_numeric($mobile)) {
+        return false;
+    }
+    return preg_match('#^1[3,4,5,6,7,8,9]{1}[\d]{9}$#', $mobile) ? true : false;
+}
+
+function checkTel($tel){
+    if (!$tel) {
+        return false;
+    }
+    return preg_match('/^(0[0-9]{2,3}\-)([0-9]{7,8})+(\-[0-9]{1,4})?$/', $tel) ? true : false;
+}
+/**邮箱验证
+ * @param $email
+ * @return bool
+ */
+function checkEmail($email){
+    if (!$email) {
+        return false;
+    }
+    return preg_match('#[a-z0-9&\-_.]+@[\w\-_]+([\w\-.]+)?\.[\w\-]+#is', $email) ? true : false;
+
+}
+
+/**
+ * @param
+ * @return int
+ */
+function makeSalt(){
+    $salt = rand(10000000,99999999);
+    return $salt;
+}
+
+/**
+ * @param $token
+ * @return array
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ */
+function VerifyTokens($token){
+    $host = Config::get("app");
+    $url = $host["api_host"]."/Api/verify_token";
+    $data=[
+        "token"=>$token
+    ];
+    $response=curl_request($url,$data);
+
+    return json_decode($response,true);
+}
+
+
+/**
+ * @param $token
+ * @param $condition
+ * @return mixed
+ */
+function GetUserlist($token,$condition){
+    $host = Config::get("app");
+
+    $url = $host["api_host"]."/Api/getuserlist";
+    $condition['token']=$token;
+    $response=curl_request($url,$condition);
+
+    return json_decode($response,true);
+}
+
+/**
+ * @param $token
+ * @param $condition
+ * @return mixed
+ */
+function GetAccountall($token, $condition){
+    $host = Config::get("app");
+
+    $url = $host["api_host"]."/Api/userall";
+    $condition['token']=$token;
+    $response=curl_request($url,$condition);
+
+    return json_decode($response,true);
+}
+
+function GetList($token,$condition){
+    $host = Config::get("app");
+
+    $url = $host["api_host"]."/Api/userlist";
+    $condition['token']=$token;
+    $response=curl_request($url,$condition);
+
+    return json_decode($response,true);
+}
+
+/**
+ * @param $token
+ * @param $condition ['id'=>1]
+ * @return mixed
+ */
+function GetInfoById($token,$condition){
+    $host = Config::get("app");
+    $url = $host["api_host"]."/Api/userinfobyid";
+    $condition['token']=$token;
+    $response=curl_request($url,$condition);
+    return json_decode($response,true);
+}
+/**
+* @param $str
+ * @return string
+ */
+function makeNo($str){
+
+    $date=date("mdHis");
+    $year = date("Y")-2000;
+    $msec=rand(1000,9999);
+    return $str.$year.$date.$msec;
+}
+
+/**
+ * @param $token
+ * @param $condition
+ * @return mixed
+ */
+ function resetpwd($token,$condition){
+     $host = Config::get("app");
+
+     $url = $host["api_host"]."/Api/passset";
+     $condition['token']=$token;
+     $response=curl_request($url,$condition);
+
+     return json_decode($response,true);
+ }
+
+function resetpasswd($token,$condition){
+    $host = Config::get("app");
+
+    $url = $host["api_host"]."/Api/passsave";
+    $condition['token']=$token;
+    $response=curl_request($url,$condition);
+
+    return json_decode($response,true);
+}
+
+/**
+ * @param $token
+ * @param $condition
+ * @return mixed
+ */
+function resetinfo($token,$condition){
+    $host = Config::get("app");
+
+    $url = $host["api_host"]."/Api/usersave";
+    $condition['token']=$token;
+    $response=curl_request($url,$condition);
+
+    return json_decode($response,true);
+}
+
+//参数1:访问的URL,参数2:post数据(不填则为GET),参数3:提交的$cookies,参数4:是否返回$cookies
+function curl_request($url,$post=''){
+    $curl = curl_init();
+    curl_setopt($curl, CURLOPT_URL, $url);
+    curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)');
+    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
+    curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
+    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
+    if($post) {
+        curl_setopt($curl, CURLOPT_POST, 1);
+        curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
+    }
+    curl_setopt($curl, CURLOPT_TIMEOUT, 10);
+    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+    $data = curl_exec($curl);
+    if (curl_errno($curl)) {
+        return curl_error($curl);
+    }
+    curl_close($curl);
+    return $data;
+
+}
+
+function checkRole($roleid,$menu){
+    $roleinfo = \think\facade\Db::name("role_action")->where([['role_id',"=",$roleid],["status","=",1]])->find();
+    if($roleinfo['private_data']!=""){
+
+        $private = explode(",",$roleinfo['private_data']);
+        if(in_array($menu,$private)){
+            return true;
+        }
+    }
+    return false;
+}

+ 17 - 0
app/event.php

@@ -0,0 +1,17 @@
+<?php
+// 事件定义文件
+return [
+    'bind'      => [
+    ],
+
+    'listen'    => [
+        'AppInit'  => [],
+        'HttpRun'  => [],
+        'HttpEnd'  => [],
+        'LogLevel' => [],
+        'LogWrite' => [],
+    ],
+
+    'subscribe' => [
+    ],
+];

+ 10 - 0
app/middleware.php

@@ -0,0 +1,10 @@
+<?php
+// 全局中间件定义文件
+return [
+    // 全局请求缓存
+    // \think\middleware\CheckRequestCache::class,
+    // 多语言加载
+    // \think\middleware\LoadLangPack::class,
+    // Session初始化
+    // \think\middleware\SessionInit::class
+];

+ 9 - 0
app/provider.php

@@ -0,0 +1,9 @@
+<?php
+use app\ExceptionHandle;
+use app\Request;
+
+// 容器Provider定义文件
+return [
+    'think\Request'          => Request::class,
+    'think\exception\Handle' => ExceptionHandle::class,
+];

+ 9 - 0
app/service.php

@@ -0,0 +1,9 @@
+<?php
+
+use app\AppService;
+
+// 系统服务定义文件
+// 服务在完成全局初始化之后执行
+return [
+    AppService::class,
+];

+ 49 - 0
composer.json

@@ -0,0 +1,49 @@
+{
+    "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.2.5",
+        "topthink/framework": "^6.0.0",
+        "topthink/think-orm": "^2.0",
+        "topthink/think-multi-app": "^1.0"
+    },
+    "require-dev": {
+        "symfony/var-dumper": "^4.2",
+        "topthink/think-trace":"^1.0"
+    },
+    "autoload": {
+        "psr-4": {
+            "app\\": "app"
+        },
+        "psr-0": {
+            "": "extend/"
+        }
+    },
+    "config": {
+        "preferred-install": "dist"
+    },
+    "scripts": {
+        "post-autoload-dump": [
+            "@php think service:discover",
+            "@php think vendor:publish"
+        ]
+    }
+}

+ 1174 - 0
composer.lock

@@ -0,0 +1,1174 @@
+{
+    "_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": "604f2c27afda19f9faea016a74813af0",
+    "packages": [
+        {
+            "name": "league/flysystem",
+            "version": "1.1.9",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/thephpleague/flysystem.git",
+                "reference": "094defdb4a7001845300334e7c1ee2335925ef99"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/094defdb4a7001845300334e7c1ee2335925ef99",
+                "reference": "094defdb4a7001845300334e7c1ee2335925ef99",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "ext-fileinfo": "*",
+                "league/mime-type-detection": "^1.3",
+                "php": "^7.2.5 || ^8.0"
+            },
+            "conflict": {
+                "league/flysystem-sftp": "<1.0.6"
+            },
+            "require-dev": {
+                "phpspec/prophecy": "^1.11.1",
+                "phpunit/phpunit": "^8.5.8"
+            },
+            "suggest": {
+                "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"
+            ],
+            "support": {
+                "issues": "https://github.com/thephpleague/flysystem/issues",
+                "source": "https://github.com/thephpleague/flysystem/tree/1.1.9"
+            },
+            "funding": [
+                {
+                    "url": "https://offset.earth/frankdejonge",
+                    "type": "other"
+                }
+            ],
+            "time": "2021-12-09T09:40:50+00:00"
+        },
+        {
+            "name": "league/flysystem-cached-adapter",
+            "version": "1.1.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/thephpleague/flysystem-cached-adapter.git",
+                "reference": "d1925efb2207ac4be3ad0c40b8277175f99ffaff"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/d1925efb2207ac4be3ad0c40b8277175f99ffaff",
+                "reference": "d1925efb2207ac4be3ad0c40b8277175f99ffaff",
+                "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.",
+            "support": {
+                "issues": "https://github.com/thephpleague/flysystem-cached-adapter/issues",
+                "source": "https://github.com/thephpleague/flysystem-cached-adapter/tree/master"
+            },
+            "time": "2020-07-25T15:56:04+00:00"
+        },
+        {
+            "name": "league/mime-type-detection",
+            "version": "1.11.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/thephpleague/mime-type-detection.git",
+                "reference": "ff6248ea87a9f116e78edd6002e39e5128a0d4dd"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ff6248ea87a9f116e78edd6002e39e5128a0d4dd",
+                "reference": "ff6248ea87a9f116e78edd6002e39e5128a0d4dd",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "ext-fileinfo": "*",
+                "php": "^7.2 || ^8.0"
+            },
+            "require-dev": {
+                "friendsofphp/php-cs-fixer": "^3.2",
+                "phpstan/phpstan": "^0.12.68",
+                "phpunit/phpunit": "^8.5.8 || ^9.3"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "League\\MimeTypeDetection\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Frank de Jonge",
+                    "email": "info@frankdejonge.nl"
+                }
+            ],
+            "description": "Mime-type detection for Flysystem",
+            "support": {
+                "issues": "https://github.com/thephpleague/mime-type-detection/issues",
+                "source": "https://github.com/thephpleague/mime-type-detection/tree/1.11.0"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/frankdejonge",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/league/flysystem",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2022-04-17T13:12: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"
+            ],
+            "support": {
+                "source": "https://github.com/php-fig/cache/tree/master"
+            },
+            "time": "2016-08-06T20:24:11+00:00"
+        },
+        {
+            "name": "psr/container",
+            "version": "1.1.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/php-fig/container.git",
+                "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf",
+                "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=7.2.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Psr\\Container\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "PHP-FIG",
+                    "homepage": "https://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"
+            ],
+            "support": {
+                "issues": "https://github.com/php-fig/container/issues",
+                "source": "https://github.com/php-fig/container/tree/1.1.1"
+            },
+            "time": "2021-03-05T17:36:06+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"
+            ],
+            "support": {
+                "source": "https://github.com/php-fig/http-message/tree/master"
+            },
+            "time": "2016-08-06T14:39:51+00:00"
+        },
+        {
+            "name": "psr/log",
+            "version": "1.1.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/php-fig/log.git",
+                "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
+                "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
+                "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": "https://www.php-fig.org/"
+                }
+            ],
+            "description": "Common interface for logging libraries",
+            "homepage": "https://github.com/php-fig/log",
+            "keywords": [
+                "log",
+                "psr",
+                "psr-3"
+            ],
+            "support": {
+                "source": "https://github.com/php-fig/log/tree/1.1.4"
+            },
+            "time": "2021-05-03T11:20:27+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"
+            ],
+            "support": {
+                "source": "https://github.com/php-fig/simple-cache/tree/master"
+            },
+            "time": "2017-10-23T01:57:42+00:00"
+        },
+        {
+            "name": "topthink/framework",
+            "version": "v6.0.12",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/top-think/framework.git",
+                "reference": "e478316ac843c1a884a3b3a7a94db17c4001ff5c"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/top-think/framework/zipball/e478316ac843c1a884a3b3a7a94db17c4001ff5c",
+                "reference": "e478316ac843c1a884a3b3a7a94db17c4001ff5c",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "ext-json": "*",
+                "ext-mbstring": "*",
+                "league/flysystem": "^1.1.4",
+                "league/flysystem-cached-adapter": "^1.0",
+                "php": ">=7.2.5",
+                "psr/container": "~1.0",
+                "psr/http-message": "^1.0",
+                "psr/log": "~1.0",
+                "psr/simple-cache": "^1.0",
+                "topthink/think-helper": "^3.1.1",
+                "topthink/think-orm": "^2.0"
+            },
+            "require-dev": {
+                "guzzlehttp/psr7": "^2.1.0",
+                "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"
+            ],
+            "support": {
+                "issues": "https://github.com/top-think/framework/issues",
+                "source": "https://github.com/top-think/framework/tree/v6.0.12"
+            },
+            "time": "2022-01-21T06:31:07+00:00"
+        },
+        {
+            "name": "topthink/think-helper",
+            "version": "v3.1.6",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/top-think/think-helper.git",
+                "reference": "769acbe50a4274327162f9c68ec2e89a38eb2aff"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/top-think/think-helper/zipball/769acbe50a4274327162f9c68ec2e89a38eb2aff",
+                "reference": "769acbe50a4274327162f9c68ec2e89a38eb2aff",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=7.1.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^9.5"
+            },
+            "type": "library",
+            "autoload": {
+                "files": [
+                    "src/helper.php"
+                ],
+                "psr-4": {
+                    "think\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "yunwuxin",
+                    "email": "448901948@qq.com"
+                }
+            ],
+            "description": "The ThinkPHP6 Helper Package",
+            "support": {
+                "issues": "https://github.com/top-think/think-helper/issues",
+                "source": "https://github.com/top-think/think-helper/tree/v3.1.6"
+            },
+            "time": "2021-12-15T04:27:55+00:00"
+        },
+        {
+            "name": "topthink/think-multi-app",
+            "version": "v1.0.14",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/top-think/think-multi-app.git",
+                "reference": "ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/top-think/think-multi-app/zipball/ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3",
+                "reference": "ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3",
+                "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",
+            "support": {
+                "issues": "https://github.com/top-think/think-multi-app/issues",
+                "source": "https://github.com/top-think/think-multi-app/tree/master"
+            },
+            "time": "2020-07-12T13:50:37+00:00"
+        },
+        {
+            "name": "topthink/think-orm",
+            "version": "v2.0.53",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/top-think/think-orm.git",
+                "reference": "06783eda65547a70ea686360a897759e1f873fff"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/top-think/think-orm/zipball/06783eda65547a70ea686360a897759e1f873fff",
+                "reference": "06783eda65547a70ea686360a897759e1f873fff",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "ext-json": "*",
+                "ext-pdo": "*",
+                "php": ">=7.1.0",
+                "psr/log": "~1.0",
+                "psr/simple-cache": "^1.0",
+                "topthink/think-helper": "^3.1"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^7|^8|^9.5"
+            },
+            "type": "library",
+            "autoload": {
+                "files": [
+                    "stubs/load_stubs.php"
+                ],
+                "psr-4": {
+                    "think\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "liu21st",
+                    "email": "liu21st@gmail.com"
+                }
+            ],
+            "description": "think orm",
+            "keywords": [
+                "database",
+                "orm"
+            ],
+            "support": {
+                "issues": "https://github.com/top-think/think-orm/issues",
+                "source": "https://github.com/top-think/think-orm/tree/v2.0.53"
+            },
+            "time": "2022-02-28T14:54:22+00:00"
+        }
+    ],
+    "packages-dev": [
+        {
+            "name": "symfony/polyfill-mbstring",
+            "version": "v1.26.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/polyfill-mbstring.git",
+                "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e",
+                "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=7.1"
+            },
+            "provide": {
+                "ext-mbstring": "*"
+            },
+            "suggest": {
+                "ext-mbstring": "For best performance"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-main": "1.26-dev"
+                },
+                "thanks": {
+                    "name": "symfony/polyfill",
+                    "url": "https://github.com/symfony/polyfill"
+                }
+            },
+            "autoload": {
+                "files": [
+                    "bootstrap.php"
+                ],
+                "psr-4": {
+                    "Symfony\\Polyfill\\Mbstring\\": ""
+                }
+            },
+            "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"
+            ],
+            "support": {
+                "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0"
+            },
+            "funding": [
+                {
+                    "url": "https://symfony.com/sponsor",
+                    "type": "custom"
+                },
+                {
+                    "url": "https://github.com/fabpot",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2022-05-24T11:49:31+00:00"
+        },
+        {
+            "name": "symfony/polyfill-php72",
+            "version": "v1.26.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/polyfill-php72.git",
+                "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/bf44a9fd41feaac72b074de600314a93e2ae78e2",
+                "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=7.1"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-main": "1.26-dev"
+                },
+                "thanks": {
+                    "name": "symfony/polyfill",
+                    "url": "https://github.com/symfony/polyfill"
+                }
+            },
+            "autoload": {
+                "files": [
+                    "bootstrap.php"
+                ],
+                "psr-4": {
+                    "Symfony\\Polyfill\\Php72\\": ""
+                }
+            },
+            "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"
+            ],
+            "support": {
+                "source": "https://github.com/symfony/polyfill-php72/tree/v1.26.0"
+            },
+            "funding": [
+                {
+                    "url": "https://symfony.com/sponsor",
+                    "type": "custom"
+                },
+                {
+                    "url": "https://github.com/fabpot",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2022-05-24T11:49:31+00:00"
+        },
+        {
+            "name": "symfony/polyfill-php80",
+            "version": "v1.26.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/polyfill-php80.git",
+                "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace",
+                "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=7.1"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-main": "1.26-dev"
+                },
+                "thanks": {
+                    "name": "symfony/polyfill",
+                    "url": "https://github.com/symfony/polyfill"
+                }
+            },
+            "autoload": {
+                "files": [
+                    "bootstrap.php"
+                ],
+                "psr-4": {
+                    "Symfony\\Polyfill\\Php80\\": ""
+                },
+                "classmap": [
+                    "Resources/stubs"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Ion Bazan",
+                    "email": "ion.bazan@gmail.com"
+                },
+                {
+                    "name": "Nicolas Grekas",
+                    "email": "p@tchwork.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
+            "homepage": "https://symfony.com",
+            "keywords": [
+                "compatibility",
+                "polyfill",
+                "portable",
+                "shim"
+            ],
+            "support": {
+                "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0"
+            },
+            "funding": [
+                {
+                    "url": "https://symfony.com/sponsor",
+                    "type": "custom"
+                },
+                {
+                    "url": "https://github.com/fabpot",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2022-05-10T07:21:04+00:00"
+        },
+        {
+            "name": "symfony/var-dumper",
+            "version": "v4.4.42",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/var-dumper.git",
+                "reference": "742aab50ad097bcb62d91fccb613f66b8047d2ca"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/var-dumper/zipball/742aab50ad097bcb62d91fccb613f66b8047d2ca",
+                "reference": "742aab50ad097bcb62d91fccb613f66b8047d2ca",
+                "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",
+                "symfony/polyfill-php80": "^1.16"
+            },
+            "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.43|^2.13|^3.0.4"
+            },
+            "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",
+            "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": "Provides mechanisms for walking through any arbitrary PHP variable",
+            "homepage": "https://symfony.com",
+            "keywords": [
+                "debug",
+                "dump"
+            ],
+            "support": {
+                "source": "https://github.com/symfony/var-dumper/tree/v4.4.42"
+            },
+            "funding": [
+                {
+                    "url": "https://symfony.com/sponsor",
+                    "type": "custom"
+                },
+                {
+                    "url": "https://github.com/fabpot",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2022-05-21T10:00:54+00:00"
+        },
+        {
+            "name": "topthink/think-trace",
+            "version": "v1.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/top-think/think-trace.git",
+                "reference": "9a9fa8f767b6c66c5a133ad21ca1bc96ad329444"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/top-think/think-trace/zipball/9a9fa8f767b6c66c5a133ad21ca1bc96ad329444",
+                "reference": "9a9fa8f767b6c66c5a133ad21ca1bc96ad329444",
+                "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",
+            "support": {
+                "issues": "https://github.com/top-think/think-trace/issues",
+                "source": "https://github.com/top-think/think-trace/tree/v1.4"
+            },
+            "time": "2020-06-29T05:27:28+00:00"
+        }
+    ],
+    "aliases": [],
+    "minimum-stability": "stable",
+    "stability-flags": [],
+    "prefer-stable": false,
+    "prefer-lowest": false,
+    "platform": {
+        "php": ">=7.2.5"
+    },
+    "platform-dev": [],
+    "plugin-api-version": "2.2.0"
+}

+ 34 - 0
config/app.php

@@ -0,0 +1,34 @@
+<?php
+// +----------------------------------------------------------------------
+// | 应用设置
+// +----------------------------------------------------------------------
+
+return [
+    // 应用地址
+    'app_host'         => env('app.host', ''),
+    // 应用的命名空间
+    'app_namespace'    => '',
+    // 是否启用路由
+    'with_route'       => true,
+    'auto_multi_app' => 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'   => false,
+     "api_host"=>"http://inv.test241.wanyuhengtong.com"
+];

+ 29 - 0
config/cache.php

@@ -0,0 +1,29 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | 缓存设置
+// +----------------------------------------------------------------------
+
+return [
+    // 默认缓存驱动
+    'default' => env('cache.driver', 'file'),
+
+    // 缓存连接方式配置
+    'stores'  => [
+        'file' => [
+            // 驱动方式
+            'type'       => 'File',
+            // 缓存保存目录
+            'path'       => '',
+            // 缓存前缀
+            'prefix'     => '',
+            // 缓存有效期 0表示永久缓存
+            'expire'     => 0,
+            // 缓存标签前缀
+            'tag_prefix' => 'tag:',
+            // 序列化机制 例如 ['serialize', 'unserialize']
+            'serialize'  => [],
+        ],
+        // 更多的缓存连接
+    ],
+];

+ 9 - 0
config/console.php

@@ -0,0 +1,9 @@
+<?php
+// +----------------------------------------------------------------------
+// | 控制台配置
+// +----------------------------------------------------------------------
+return [
+    // 指令定义
+    'commands' => [
+    ],
+];

+ 20 - 0
config/cookie.php

@@ -0,0 +1,20 @@
+<?php
+// +----------------------------------------------------------------------
+// | Cookie设置
+// +----------------------------------------------------------------------
+return [
+    // cookie 保存时间
+    'expire'    => 0,
+    // cookie 保存路径
+    'path'      => '/',
+    // cookie 有效域名
+    'domain'    => '',
+    //  cookie 启用安全传输
+    'secure'    => false,
+    // httponly设置
+    'httponly'  => false,
+    // 是否使用 setcookie
+    'setcookie' => true,
+    // samesite 设置,支持 'strict' 'lax'
+    'samesite'  => '',
+];

+ 63 - 0
config/database.php

@@ -0,0 +1,63 @@
+<?php
+
+return [
+    // 默认使用的数据库连接配置
+    'default'         => env('database.driver', 'mysql'),
+
+    // 自定义时间查询规则
+    'time_query_rule' => [],
+
+    // 自动写入时间戳字段
+    // true为自动识别类型 false关闭
+    // 字符串则明确指定时间字段类型 支持 int timestamp datetime date
+    'auto_timestamp'  => true,
+
+    // 时间字段取出后的默认时间格式
+    'datetime_format' => 'Y-m-d H:i:s',
+
+    // 时间字段配置 配置格式:create_time,update_time
+    'datetime_field'  => '',
+
+    // 数据库连接配置信息
+    'connections'     => [
+        'mysql' => [
+            // 数据库类型
+            'type'            => env('database.type', 'mysql'),
+            // 服务器地址
+            'hostname'        => env('database.hostname', '127.0.0.1'),
+            // 数据库名
+            'database'        => env('database.database', 'cfp_invoice'),
+            // 用户名
+            'username'        => env('database.username', 'root'),
+            // 密码
+            'password'        => env('database.password', 'root'),
+            // 端口
+            'hostport'        => env('database.hostport', '3306'),
+            // 数据库连接参数
+            'params'          => [],
+            // 数据库编码默认采用utf8
+            'charset'         => env('database.charset', 'utf8'),
+            // 数据库表前缀
+            'prefix'          => env('database.prefix', 'cfp_'),
+
+            // 数据库部署方式: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,
+        ],
+
+        // 更多的数据库配置信息
+    ],
+];

+ 24 - 0
config/filesystem.php

@@ -0,0 +1,24 @@
+<?php
+
+return [
+    // 默认磁盘
+    'default' => env('filesystem.driver', 'local'),
+    // 磁盘列表
+    'disks'   => [
+        'local'  => [
+            'type' => 'local',
+            'root' => app()->getRuntimePath() . 'storage',
+        ],
+        'public' => [
+            // 磁盘类型
+            'type'       => 'local',
+            // 磁盘路径
+            'root'       => app()->getRootPath() . 'public/storage',
+            // 磁盘路径对应的外部URL路径
+            'url'        => '/storage',
+            // 可见性
+            'visibility' => 'public',
+        ],
+        // 更多的磁盘配置信息
+    ],
+];

+ 27 - 0
config/lang.php

@@ -0,0 +1,27 @@
+<?php
+// +----------------------------------------------------------------------
+// | 多语言设置
+// +----------------------------------------------------------------------
+
+return [
+    // 默认语言
+    'default_lang'    => env('lang.default_lang', 'zh-cn'),
+    // 允许的语言列表
+    'allow_lang_list' => [],
+    // 多语言自动侦测变量名
+    'detect_var'      => 'lang',
+    // 是否使用Cookie记录
+    'use_cookie'      => true,
+    // 多语言cookie变量
+    'cookie_var'      => 'think_lang',
+    // 多语言header变量
+    'header_var'      => 'think-lang',
+    // 扩展语言包
+    'extend_list'     => [],
+    // Accept-Language转义为对应语言包名称
+    'accept_language' => [
+        'zh-hans-cn' => 'zh-cn',
+    ],
+    // 是否支持语言分组
+    'allow_group'     => false,
+];

+ 45 - 0
config/log.php

@@ -0,0 +1,45 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | 日志设置
+// +----------------------------------------------------------------------
+return [
+    // 默认日志记录通道
+    'default'      => 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,
+        ],
+        // 其它日志通道配置
+    ],
+
+];

+ 8 - 0
config/middleware.php

@@ -0,0 +1,8 @@
+<?php
+// 中间件配置
+return [
+    // 别名或分组
+    'alias'    => [],
+    // 优先级设置,此数组中的中间件会按照数组中的顺序优先执行
+    'priority' => [],
+];

+ 45 - 0
config/route.php

@@ -0,0 +1,45 @@
+<?php
+// +----------------------------------------------------------------------
+// | 路由设置
+// +----------------------------------------------------------------------
+
+return [
+    // pathinfo分隔符
+    'pathinfo_depr'         => '/',
+    // 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_key'     => 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',
+];

+ 19 - 0
config/session.php

@@ -0,0 +1,19 @@
+<?php
+// +----------------------------------------------------------------------
+// | 会话设置
+// +----------------------------------------------------------------------
+
+return [
+    // session name
+    'name'           => 'PHPSESSID',
+    // SESSION_ID的提交变量,解决flash上传跨域
+    'var_session_id' => '',
+    // 驱动方式 支持file cache
+    'type'           => 'file',
+    // 存储连接标识 当type使用cache的时候有效
+    'store'          => null,
+    // 过期时间
+    'expire'         => 1440,
+    // 前缀
+    'prefix'         => '',
+];

+ 10 - 0
config/trace.php

@@ -0,0 +1,10 @@
+<?php
+// +----------------------------------------------------------------------
+// | Trace设置 开启调试模式后有效
+// +----------------------------------------------------------------------
+return [
+    // 内置Html和Console两种方式 支持扩展
+    'type'    => 'Html',
+    // 读取的日志通道名
+    'channel' => '',
+];

+ 25 - 0
config/view.php

@@ -0,0 +1,25 @@
+<?php
+// +----------------------------------------------------------------------
+// | 模板设置
+// +----------------------------------------------------------------------
+
+return [
+    // 模板引擎类型使用Think
+    'type'          => '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'    => '}',
+];

+ 2 - 0
extend/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 8 - 0
public/.htaccess

@@ -0,0 +1,8 @@
+<IfModule mod_rewrite.c>
+  Options +FollowSymlinks -Multiviews
+  RewriteEngine On
+
+  RewriteCond %{REQUEST_FILENAME} !-d
+  RewriteCond %{REQUEST_FILENAME} !-f
+  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
+</IfModule>

BIN
public/favicon.ico


+ 24 - 0
public/index.php

@@ -0,0 +1,24 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// [ 应用入口文件 ]
+namespace think;
+
+require __DIR__ . '/../vendor/autoload.php';
+
+// 执行HTTP应用并响应
+$http = (new App())->http;
+
+$response = $http->run();
+
+$response->send();
+
+$http->end($response);

+ 2 - 0
public/robots.txt

@@ -0,0 +1,2 @@
+User-agent: *
+Disallow:

+ 19 - 0
public/router.php

@@ -0,0 +1,19 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+// $Id$
+
+if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) {
+    return false;
+} else {
+    $_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php';
+
+    require __DIR__ . "/index.php";
+}

+ 2 - 0
public/static/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 17 - 0
route/app.php

@@ -0,0 +1,17 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+use think\facade\Route;
+
+Route::get('think', function () {
+    return 'hello,ThinkPHP6!';
+});
+
+Route::get('hello/:name', 'index/hello');

+ 2 - 0
runtime/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 10 - 0
think

@@ -0,0 +1,10 @@
+#!/usr/bin/env php
+<?php
+namespace think;
+
+// 命令行入口文件
+// 加载基础文件
+require __DIR__ . '/vendor/autoload.php';
+
+// 应用初始化
+(new App())->console->run();

+ 1 - 0
view/README.md

@@ -0,0 +1 @@
+如果不使用模板,可以删除该目录