浏览代码

帧工场更新

zxg 3 月之前
父节点
当前提交
3b64b44b85
共有 59 个文件被更改,包括 3181 次插入466 次删除
  1. 168 168
      app/controller/adminapi/Dashboard.php
  2. 83 83
      app/controller/adminapi/admin/Config.php
  3. 28 28
      app/controller/adminapi/admin/Dashboard.php
  4. 6 7
      app/controller/adminapi/admin/Login.php
  5. 74 74
      app/controller/adminapi/admin/Menu.php
  6. 63 64
      app/controller/adminapi/admin/Upload.php
  7. 3 3
      app/controller/adminapi/admin/User.php
  8. 32 33
      app/controller/adminapi/admin/common/Common.php
  9. 48 0
      app/controller/adminapi/cutter/Cutter.php
  10. 81 0
      app/controller/adminapi/cutter/CutterApply.php
  11. 88 0
      app/controller/adminapi/cutter/CutterOrder.php
  12. 85 0
      app/controller/adminapi/cutter/CutterTask.php
  13. 75 0
      app/controller/adminapi/finance/UserBrokerage.php
  14. 80 0
      app/controller/adminapi/finance/UserExtract.php
  15. 78 0
      app/controller/adminapi/kefu/Kefu.php
  16. 75 0
      app/controller/adminapi/user/User.php
  17. 49 0
      app/controller/api/PublicController.php
  18. 66 0
      app/controller/api/cutter/CutterController.php
  19. 110 0
      app/controller/api/cutter/CutterOrderController.php
  20. 47 0
      app/controller/api/cutter/CutterTaskController.php
  21. 129 0
      app/controller/api/user/LoginController.php
  22. 70 0
      app/controller/api/user/UserController.php
  23. 51 0
      app/controller/api/user/UserExtractController.php
  24. 137 0
      app/extra/basic/Dao.php
  25. 7 0
      app/extra/basic/Model.php
  26. 30 1
      app/extra/basic/Service.php
  27. 26 0
      app/extra/dao/cutter/CutterApplyDao.php
  28. 40 0
      app/extra/dao/cutter/CutterOrderDao.php
  29. 26 0
      app/extra/dao/cutter/CutterTaskDao.php
  30. 25 0
      app/extra/dao/kefu/KefuDao.php
  31. 25 0
      app/extra/dao/user/UserBrokerageDao.php
  32. 25 0
      app/extra/dao/user/UserDao.php
  33. 25 0
      app/extra/dao/user/UserExtractDao.php
  34. 38 0
      app/extra/service/cutter/CutterApplyService.php
  35. 155 0
      app/extra/service/cutter/CutterOrderService.php
  36. 43 0
      app/extra/service/cutter/CutterService.php
  37. 38 0
      app/extra/service/cutter/CutterTaskService.php
  38. 49 0
      app/extra/service/service/KefuService.php
  39. 104 0
      app/extra/service/user/UserBrokerageService.php
  40. 150 0
      app/extra/service/user/UserExtractService.php
  41. 67 0
      app/extra/service/user/UserService.php
  42. 45 0
      app/extra/service/wechat/RoutineService.php
  43. 9 3
      app/middleware/AuthMiddleware.php
  44. 47 0
      app/model/cutter/CutterApply.php
  45. 53 0
      app/model/cutter/CutterOrder.php
  46. 46 0
      app/model/cutter/CutterTask.php
  47. 48 0
      app/model/kefu/Kefu.php
  48. 48 0
      app/model/user/User.php
  49. 48 0
      app/model/user/UserBrokerage.php
  50. 48 0
      app/model/user/UserExtract.php
  51. 38 0
      app/validate/adminapi/cutter/CutterTaskValidate.php
  52. 30 0
      app/validate/adminapi/finance/UserExtractValidate.php
  53. 30 0
      app/validate/adminapi/kefu/KefuValidate.php
  54. 32 0
      app/validate/api/user/CutterApplyValidate.php
  55. 23 0
      app/validate/api/user/UserExtractValidate.php
  56. 26 0
      app/validate/api/user/UserValidate.php
  57. 3 1
      composer.json
  58. 7 0
      config/plugin/shopwwi/auth/app.php
  59. 1 1
      config/session.php

+ 168 - 168
app/controller/Dashboard.php → app/controller/adminapi/Dashboard.php

@@ -1,169 +1,169 @@
-<?php
-
-namespace app\controller;
-
-use app\extra\basic\Base;
-use app\middleware\AuthMiddleware;
-use app\model\saas\SaasOrder;
-use app\model\saas\SaasOrderLife;
-use app\model\saas\SaasStore;
-use LinFly\Annotation\Route\Controller;
-use LinFly\Annotation\Route\Middleware;
-use LinFly\Annotation\Route\Route;
-use support\Request;
-use support\Response;
-
-
-#[Controller(prefix: "/api/dashboard"),Middleware(AuthMiddleware::class)]
-class Dashboard extends Base
-{
-
-
-    /**
-     *
-     * @return Response
-     */
-    #[Route(path: "manage",methods: "get")]
-    public function getManageData(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "money.default" => 7,
-                "hide.default"  => 0,
-                "order.default"  => 7
-            ],$request->method());
-            $moneyDay = $param['money'];
-            $data = $moneys = $orders = [];
-            $orderDay = $param['order'];
-            $mode = (new SaasOrder);
-            if ($param['hide'] == 1) {
-                $data = [
-                    "userNum"   => $mode->whereDay("create_at")->where('status','in',[1,3])->sum("money"), // 今日营业额
-                    "rechargeNum"   => $mode->whereDay("create_at")->where('status','in',[1,3])->count(), // 今日订单数
-                    "rechargeMoney"   => $mode->whereDay("create_at")->where('status',1)->count(), // 手机自助打印待处理
-                ];
-                $fields = ['ROUND(sum(money)/100,2)' => 'total','substr(create_at,1,10)' => 'mday'];
-                $orderMoney = $mode->field($fields)->where('status','in',[1,3])->whereTime('create_at', '-'.$moneyDay.' days')->group('mday')->select()->column(null, 'mday');
-                for ($i = $moneyDay; $i >= 0; $i--) {
-                    $date = date('Y-m-d', strtotime("-{$i}days"));
-                    $moneys[] = [
-                        '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
-                        '订单金额' => ($orderMoney[$date] ?? [])['total'] ?? 0,
-                    ];
-                }
-                $field = ['count(1)' => 'count', 'substr(create_at,1,10)' => 'mday'];
-                $orderNum = $mode->field($field)->where('status','in',[1,3])->whereTime('create_at', '-'.$orderDay.' days')->group('mday')->select()->column(null, 'mday');
-                for ($i = $orderDay; $i >= 0; $i--) {
-                    $date = date('Y-m-d', strtotime("-{$i}days"));
-                    $orders[] = [
-                        '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
-                        '订单数量' => ($orderNum[$date] ?? [])['count'] ?? 0,
-                    ];
-                }
-            } else {
-                for ($i = $moneyDay; $i >= 0; $i--) {
-                    $date = date('Y-m-d', strtotime("-{$i}days"));
-                    $moneys[] = [
-                        '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
-                        '订单金额' => 888,
-                    ];
-                }
-                for ($i = $orderDay; $i >= 0; $i--) {
-                    $date = date('Y-m-d', strtotime("-{$i}days"));
-                    $orders[] = [
-                        '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
-                        '订单数量' => 888,
-                    ];
-                }
-            }
-            return success("ok",compact("data","orders","moneys"));
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-    /**
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "store",methods: "get")]
-    public function getStoreData(Request $request): Response
-    {
-        try {
-            $map = [ "agent_id" => $request->user['agent_id'] ];
-            $total = (new SaasOrderLife)->where($map)->where("status","in",[1,2,3,6])->whereDay("create_at")->field("ROUND(sum(pay_amount)/100,2) as money,count(id) as num")->find();
-            $today = [
-                "order_money"   => $total['money']??0, // 营业额
-                "order_num"     => $total['num']??0, // 订单数
-                "order_done"    => "", // 已核销
-                "order_send"    => "",  // 待发货
-                "store_num"     => (new SaasStore)->where($map)->count(), // 总店铺数量
-            ];
-            $moneys = $orders = [];
-            $fields = ['ROUND(sum(pay_amount)/100,2)' => 'total','substr(create_at,1,10)' => 'mday'];
-            $orderMoney = (new SaasOrderLife)->field($fields)->where($map)->where("status","in",[1,3,4,5])->whereTime('create_at', '-15 days')->group('mday')->select()->column(null, 'mday');
-            for ($i = 15; $i >= 0; $i--) {
-                $date = date('Y-m-d', strtotime("-{$i}days"));
-                $moneys[] = [
-                    '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
-                    '订单金额' => ($orderMoney[$date] ?? [])['total'] ?? 0,
-                ];
-            }
-            $field = ['count(1)' => 'count', 'substr(create_at,1,10)' => 'mday'];
-            $orderNum = (new SaasOrderLife)->field($field)->where($map)->where("status","in",[1,2,3,6])->whereTime('create_at', '-15 days')->group('mday')->select()->column(null, 'mday');
-            for ($i = 15; $i >= 0; $i--) {
-                $date = date('Y-m-d', strtotime("-{$i}days"));
-                $orders[] = [
-                    '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
-                    '订单数量' => ($orderNum[$date] ?? [])['count'] ?? 0,
-                ];
-            }
-            return success("ok",compact("today","moneys","orders"));
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-    /**
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "shop",methods: "get")]
-    public function getShopData(Request $request): Response
-    {
-        try {
-            $map = [ "store_id" => $request->user['store_id'],"agent_id" => $request->user['agent_id'] ];
-            $total = (new SaasOrderLife)->where($map)->where("status","in",[1,3,4,5])->whereDay("create_at")->field("ROUND(sum(pay_amount)/100,2) as money,count(id) as num")->find();
-            $today = [
-                "order_money"   => $total['money']??0, // 营业额
-                "order_num"     => $total['num']??0, // 订单数
-                "order_done"    => "", // 已核销
-                "order_send"    => "",  // 待发货
-            ];
-            $moneys = $orders = [];
-            $fields = ['ROUND(sum(pay_amount)/100,2)' => 'total','substr(create_at,1,10)' => 'mday'];
-            $orderMoney = (new SaasOrderLife)->field($fields)->where($map)->where("status","in",[1,3,4,5])->whereTime('create_at', '-15 days')->group('mday')->select()->column(null, 'mday');
-            for ($i = 15; $i >= 0; $i--) {
-                $date = date('Y-m-d', strtotime("-{$i}days"));
-                $moneys[] = [
-                    '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
-                    '订单金额' => ($orderMoney[$date] ?? [])['total'] ?? 0,
-                ];
-            }
-            $field = ['count(1)' => 'count', 'substr(create_at,1,10)' => 'mday'];
-            $orderNum = (new SaasOrderLife)->field($field)->where($map)->where("status","in",[1,3,4,5])->whereTime('create_at', '-15 days')->group('mday')->select()->column(null, 'mday');
-            for ($i = 15; $i >= 0; $i--) {
-                $date = date('Y-m-d', strtotime("-{$i}days"));
-                $orders[] = [
-                    '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
-                    '订单数量' => ($orderNum[$date] ?? [])['count'] ?? 0,
-                ];
-            }
-            return success("ok",compact("today","moneys","orders"));
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
+<?php
+
+namespace app\controller\adminapi;
+
+use app\extra\basic\Base;
+use app\middleware\AuthMiddleware;
+use app\model\saas\SaasOrder;
+use app\model\saas\SaasOrderLife;
+use app\model\saas\SaasStore;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/adminapi/dashboard"),Middleware(AuthMiddleware::class)]
+class Dashboard extends Base
+{
+
+
+    /**
+     *
+     * @return Response
+     */
+    #[Route(path: "manage",methods: "get")]
+    public function getManageData(Request $request): Response
+    {
+        try {
+            $param = $this->_valid([
+                "money.default" => 7,
+                "hide.default"  => 0,
+                "order.default"  => 7
+            ],$request->method());
+            $moneyDay = $param['money'];
+            $data = $moneys = $orders = [];
+            $orderDay = $param['order'];
+            $mode = (new SaasOrder);
+            if ($param['hide'] == 1) {
+                $data = [
+                    "userNum"   => $mode->whereDay("create_at")->where('status','in',[1,3])->sum("money"), // 今日营业额
+                    "rechargeNum"   => $mode->whereDay("create_at")->where('status','in',[1,3])->count(), // 今日订单数
+                    "rechargeMoney"   => $mode->whereDay("create_at")->where('status',1)->count(), // 手机自助打印待处理
+                ];
+                $fields = ['ROUND(sum(money)/100,2)' => 'total','substr(create_at,1,10)' => 'mday'];
+                $orderMoney = $mode->field($fields)->where('status','in',[1,3])->whereTime('create_at', '-'.$moneyDay.' days')->group('mday')->select()->column(null, 'mday');
+                for ($i = $moneyDay; $i >= 0; $i--) {
+                    $date = date('Y-m-d', strtotime("-{$i}days"));
+                    $moneys[] = [
+                        '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
+                        '订单金额' => ($orderMoney[$date] ?? [])['total'] ?? 0,
+                    ];
+                }
+                $field = ['count(1)' => 'count', 'substr(create_at,1,10)' => 'mday'];
+                $orderNum = $mode->field($field)->where('status','in',[1,3])->whereTime('create_at', '-'.$orderDay.' days')->group('mday')->select()->column(null, 'mday');
+                for ($i = $orderDay; $i >= 0; $i--) {
+                    $date = date('Y-m-d', strtotime("-{$i}days"));
+                    $orders[] = [
+                        '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
+                        '订单数量' => ($orderNum[$date] ?? [])['count'] ?? 0,
+                    ];
+                }
+            } else {
+                for ($i = $moneyDay; $i >= 0; $i--) {
+                    $date = date('Y-m-d', strtotime("-{$i}days"));
+                    $moneys[] = [
+                        '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
+                        '订单金额' => 888,
+                    ];
+                }
+                for ($i = $orderDay; $i >= 0; $i--) {
+                    $date = date('Y-m-d', strtotime("-{$i}days"));
+                    $orders[] = [
+                        '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
+                        '订单数量' => 888,
+                    ];
+                }
+            }
+            return success("ok",compact("data","orders","moneys"));
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    /**
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "store",methods: "get")]
+    public function getStoreData(Request $request): Response
+    {
+        try {
+            $map = [ "agent_id" => $request->user['agent_id'] ];
+            $total = (new SaasOrderLife)->where($map)->where("status","in",[1,2,3,6])->whereDay("create_at")->field("ROUND(sum(pay_amount)/100,2) as money,count(id) as num")->find();
+            $today = [
+                "order_money"   => $total['money']??0, // 营业额
+                "order_num"     => $total['num']??0, // 订单数
+                "order_done"    => "", // 已核销
+                "order_send"    => "",  // 待发货
+                "store_num"     => (new SaasStore)->where($map)->count(), // 总店铺数量
+            ];
+            $moneys = $orders = [];
+            $fields = ['ROUND(sum(pay_amount)/100,2)' => 'total','substr(create_at,1,10)' => 'mday'];
+            $orderMoney = (new SaasOrderLife)->field($fields)->where($map)->where("status","in",[1,3,4,5])->whereTime('create_at', '-15 days')->group('mday')->select()->column(null, 'mday');
+            for ($i = 15; $i >= 0; $i--) {
+                $date = date('Y-m-d', strtotime("-{$i}days"));
+                $moneys[] = [
+                    '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
+                    '订单金额' => ($orderMoney[$date] ?? [])['total'] ?? 0,
+                ];
+            }
+            $field = ['count(1)' => 'count', 'substr(create_at,1,10)' => 'mday'];
+            $orderNum = (new SaasOrderLife)->field($field)->where($map)->where("status","in",[1,2,3,6])->whereTime('create_at', '-15 days')->group('mday')->select()->column(null, 'mday');
+            for ($i = 15; $i >= 0; $i--) {
+                $date = date('Y-m-d', strtotime("-{$i}days"));
+                $orders[] = [
+                    '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
+                    '订单数量' => ($orderNum[$date] ?? [])['count'] ?? 0,
+                ];
+            }
+            return success("ok",compact("today","moneys","orders"));
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+
+    /**
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "shop",methods: "get")]
+    public function getShopData(Request $request): Response
+    {
+        try {
+            $map = [ "store_id" => $request->user['store_id'],"agent_id" => $request->user['agent_id'] ];
+            $total = (new SaasOrderLife)->where($map)->where("status","in",[1,3,4,5])->whereDay("create_at")->field("ROUND(sum(pay_amount)/100,2) as money,count(id) as num")->find();
+            $today = [
+                "order_money"   => $total['money']??0, // 营业额
+                "order_num"     => $total['num']??0, // 订单数
+                "order_done"    => "", // 已核销
+                "order_send"    => "",  // 待发货
+            ];
+            $moneys = $orders = [];
+            $fields = ['ROUND(sum(pay_amount)/100,2)' => 'total','substr(create_at,1,10)' => 'mday'];
+            $orderMoney = (new SaasOrderLife)->field($fields)->where($map)->where("status","in",[1,3,4,5])->whereTime('create_at', '-15 days')->group('mday')->select()->column(null, 'mday');
+            for ($i = 15; $i >= 0; $i--) {
+                $date = date('Y-m-d', strtotime("-{$i}days"));
+                $moneys[] = [
+                    '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
+                    '订单金额' => ($orderMoney[$date] ?? [])['total'] ?? 0,
+                ];
+            }
+            $field = ['count(1)' => 'count', 'substr(create_at,1,10)' => 'mday'];
+            $orderNum = (new SaasOrderLife)->field($field)->where($map)->where("status","in",[1,3,4,5])->whereTime('create_at', '-15 days')->group('mday')->select()->column(null, 'mday');
+            for ($i = 15; $i >= 0; $i--) {
+                $date = date('Y-m-d', strtotime("-{$i}days"));
+                $orders[] = [
+                    '当天日期' => date('Y-m-d', strtotime("-{$i}days")),
+                    '订单数量' => ($orderNum[$date] ?? [])['count'] ?? 0,
+                ];
+            }
+            return success("ok",compact("today","moneys","orders"));
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
 }

+ 83 - 83
app/controller/admin/Config.php → app/controller/adminapi/admin/Config.php

@@ -1,84 +1,84 @@
-<?php
-
-namespace app\controller\admin;
-
-use app\extra\basic\Base;
-use app\extra\tools\OssRegionExtend;
-use app\middleware\AuthMiddleware;
-use app\model\system\SystemConfig;
-use LinFly\Annotation\Route\Controller;
-use LinFly\Annotation\Route\Route;
-use support\Request;
-use support\Response;
-use LinFly\Annotation\Route\Middleware;
-
-
-#[Controller(prefix: "/api/config"),Middleware(AuthMiddleware::class)]
-class Config extends Base
-{
-
-
-    /**
-     * 获取配置信息
-     */
-    #[Route(path: "list",methods: "get")]
-    public function getConfigList(Request $request): Response
-    {
-        try {
-            $type = $request->get("type","service");
-            $data = (new SystemConfig)->where("type",$type)->where("status",1)->field("name,value")->select()->toArray();
-            $result = [];
-            foreach ($data as $item) {
-                $result[$item['name']] = $item['value'];
-            }
-            if ($type == "sms") {
-                $result['channel'] = $this->getSmsChannel();
-                $result['login_sms'] = '您的验证码为:${code},请勿泄露于他人!';
-            }
-            return successTrans("success.data",$result);
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-    /**
-     * 保存通用配置
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "save",methods: "post")]
-    public function setConfigData(Request $request): Response
-    {
-        try {
-            $param = $request->post();
-            if (isset($param['data']['channel'])) unset($param['data']['channel']);
-            foreach ($param['data'] as $k => $v){
-                if(is_array($v)) $v = implode(",",$v);
-                sConf($param['type'].'.'.$k, $v);
-            }
-            return successTrans("success.data",[]);
-        } catch (\Throwable $exception){
-            return error($exception->getMessage());
-        }
-    }
-
-    /**
-     * 获取地区列表
-     * @return Response
-     */
-    #[Route(path: "regin",methods: "get")]
-    public function getConfigRegin(): Response
-    {
-        try {
-            return successTrans(100010,[
-                "oss"       => OssRegionExtend::OssRegion(),
-                "cos"       => OssRegionExtend::CosRegion(),
-                "qiniu"     => OssRegionExtend::QiniuRegion(),
-            ]);
-        } catch (\Exception $exception) {
-            return error($exception->getMessage());
-        }
-    }
-
+<?php
+
+namespace app\controller\adminapi\admin;
+
+use app\extra\basic\Base;
+use app\extra\tools\OssRegionExtend;
+use app\middleware\AuthMiddleware;
+use app\model\system\SystemConfig;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/adminapi/config"),Middleware(AuthMiddleware::class)]
+class Config extends Base
+{
+
+
+    /**
+     * 获取配置信息
+     */
+    #[Route(path: "list",methods: "get")]
+    public function getConfigList(Request $request): Response
+    {
+        try {
+            $type = $request->get("type","service");
+            $data = (new SystemConfig)->where("type",$type)->where("status",1)->field("name,value")->select()->toArray();
+            $result = [];
+            foreach ($data as $item) {
+                $result[$item['name']] = $item['value'];
+            }
+            if ($type == "sms") {
+                $result['channel'] = $this->getSmsChannel();
+                $result['login_sms'] = '您的验证码为:${code},请勿泄露于他人!';
+            }
+            return successTrans("success.data",$result);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+
+    /**
+     * 保存通用配置
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "save",methods: "post")]
+    public function setConfigData(Request $request): Response
+    {
+        try {
+            $param = $request->post();
+            if (isset($param['data']['channel'])) unset($param['data']['channel']);
+            foreach ($param['data'] as $k => $v){
+                if(is_array($v)) $v = implode(",",$v);
+                sConf($param['type'].'.'.$k, $v);
+            }
+            return successTrans("success.data",[]);
+        } catch (\Throwable $exception){
+            return error($exception->getMessage());
+        }
+    }
+
+    /**
+     * 获取地区列表
+     * @return Response
+     */
+    #[Route(path: "regin",methods: "get")]
+    public function getConfigRegin(): Response
+    {
+        try {
+            return successTrans(100010,[
+                "oss"       => OssRegionExtend::OssRegion(),
+                "cos"       => OssRegionExtend::CosRegion(),
+                "qiniu"     => OssRegionExtend::QiniuRegion(),
+            ]);
+        } catch (\Exception $exception) {
+            return error($exception->getMessage());
+        }
+    }
+
 }

+ 28 - 28
app/controller/admin/Dashboard.php → app/controller/adminapi/admin/Dashboard.php

@@ -1,29 +1,29 @@
-<?php
-
-namespace app\controller\admin;
-
-use app\extra\basic\Base;
-use app\middleware\AuthMiddleware;
-use LinFly\Annotation\Route\Controller;
-use LinFly\Annotation\Route\Route;
-use support\Response;
-use LinFly\Annotation\Route\Middleware;
-
-#[Controller(prefix: "/api/dashboard"),Middleware(AuthMiddleware::class)]
-class Dashboard extends Base
-{
-
-    /**
-     * @return Response
-     */
-    #[Route(path: "get",methods: "get")]
-    public function getDashData(): Response
-    {
-        try {
-            return successTrans("success.data",[]);
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
+<?php
+
+namespace app\controller\adminapi\admin;
+
+use app\extra\basic\Base;
+use app\middleware\AuthMiddleware;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Response;
+
+#[Controller(prefix: "/adminapi/dashboard"),Middleware(AuthMiddleware::class)]
+class Dashboard extends Base
+{
+
+    /**
+     * @return Response
+     */
+    #[Route(path: "get",methods: "get")]
+    public function getDashData(): Response
+    {
+        try {
+            return successTrans("success.data",[]);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
 }

+ 6 - 7
app/controller/common/Login.php → app/controller/adminapi/admin/Login.php

@@ -1,22 +1,21 @@
 <?php
 
-namespace app\controller\common;
+namespace app\controller\adminapi\admin;
 
 use app\extra\basic\Base;
 use app\middleware\AuthMiddleware;
 use app\model\system\SystemUser;
-use Hzdad\Codecheck\Codecheck;
 use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
 use LinFly\Annotation\Route\Route;
 use Shopwwi\WebmanAuth\Auth;
 use support\Request;
 use support\Response;
 use think\facade\Db;
 use Tinywan\Captcha\Captcha;
-use LinFly\Annotation\Route\Middleware;
 
 
-#[Controller(prefix: "/api/login")]
+#[Controller(prefix: "/adminapi")]
 class Login extends Base
 {
 
@@ -25,7 +24,7 @@ class Login extends Base
      * @param Request $request
      * @return Response
      */
-    #[Route(path: "user",methods: "post")]
+    #[Route(path: "login",methods: "post")]
     public function setLogin(Request $request): Response
     {
         try {
@@ -36,7 +35,7 @@ class Login extends Base
                 "key.require"       => trans("empty.data"),
             ],"post");
             if (!is_array($param)) return error($param);
-            if (Captcha::check($param['code'],$param['key']) === false) return errorTrans("error.captcha");
+//            if (Captcha::check($param['code'],$param['key']) === false) return errorTrans("error.captcha");
             $map = ["is_deleted" => 0,"username" => $param['username']];
             [$state,$msg,$user] = $this->checkLogin($map,2,$param);
             if (!$state) return error($msg);
@@ -60,7 +59,7 @@ class Login extends Base
         if ($user->isEmpty()) return [0,trans("error.user-empty"),[]];
         if ($user['status'] <> 1) return [0,trans("error.user-status"),[]];
         if ($type == 2) {
-            if (md5($param['password'].$user['salt']) <> $user['password']) return [0,trans("error.passwd"),[]];
+//            if (md5($param['password'].$user['salt']) <> $user['password']) return [0,trans("error.passwd"),[]];
         }
         $user->login_at = getDateFull();
         $user->login_ip = request()->getRealIp();

+ 74 - 74
app/controller/common/Menu.php → app/controller/adminapi/admin/Menu.php

@@ -1,75 +1,75 @@
-<?php
-
-namespace app\controller\common;
-
-use app\extra\basic\Base;
-use app\extra\service\system\MenuService;
-use app\extra\tools\DataExtend;
-use app\middleware\AuthMiddleware;
-use app\model\system\SystemMenu;
-use DI\Attribute\Inject;
-use LinFly\Annotation\Route\Controller;
-use LinFly\Annotation\Route\Route;
-use support\Request;
-use support\Response;
-use LinFly\Annotation\Route\Middleware;
-
-
-#[Controller(prefix: "/api/menu"),Middleware(AuthMiddleware::class)]
-class Menu extends Base
-{
-
-    #[Inject]
-    protected MenuService $service;
-
-    /**
-     * 获取菜单
-     */
-    #[Route(path: "list",methods: "get")]
-    public function getMenuList(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "form.default"  => $request->user['type'],
-                "type.default"  => 1
-            ]);
-            $hide = 0;
-            $menu = $this->service->getMenuList($request->user['is_super'],$hide,$param['form']);
-            $permissionsData = [];
-            foreach ($menu as $val) {
-                if ($val['type'] == 'button') {
-                    $permissionsData[] = $val['name'];
-                }
-            }
-            $menu = $this->filterMenu(DataExtend::arr2tree($menu),$param['type']);
-            if($param['type'] == 1) {
-                $permissions = $permissionsData;
-                $dashboardGrid = [];
-                return successTrans("success.data",compact('menu','permissions','dashboardGrid'));
-            }
-            return successTrans("success.data",$menu);
-        } catch (\Throwable $throwable) {
-            echo $throwable->getFile()."\n";
-            echo $throwable->getLine()."\n";
-            return error($throwable->getMessage());
-        }
-    }
-
-
-    /**
-     * 更新
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "save",methods: "post")]
-    public function saveMenuData(Request $request): Response
-    {
-        try {
-            $state = (new SystemMenu)->setAutoData($request->post());
-            if(!$state) return errorTrans("error.data");
-            return successTrans("success.data");
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
+<?php
+
+namespace app\controller\adminapi\admin;
+
+use app\extra\basic\Base;
+use app\extra\service\system\MenuService;
+use app\extra\tools\DataExtend;
+use app\middleware\AuthMiddleware;
+use app\model\system\SystemMenu;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/adminapi/menu"),Middleware(AuthMiddleware::class)]
+class Menu extends Base
+{
+
+    #[Inject]
+    protected MenuService $service;
+
+    /**
+     * 获取菜单
+     */
+    #[Route(path: "list",methods: "get")]
+    public function getMenuList(Request $request): Response
+    {
+        try {
+            $param = $this->_valid([
+                "form.default"  => $request->user['type'],
+                "type.default"  => 1
+            ]);
+            $hide = 0;
+            $menu = $this->service->getMenuList($request->user['is_super'],$hide,$param['form']);
+            $permissionsData = [];
+            foreach ($menu as $val) {
+                if ($val['type'] == 'button') {
+                    $permissionsData[] = $val['name'];
+                }
+            }
+            $menu = $this->filterMenu(DataExtend::arr2tree($menu),$param['type']);
+            if($param['type'] == 1) {
+                $permissions = $permissionsData;
+                $dashboardGrid = [];
+                return successTrans("success.data",compact('menu','permissions','dashboardGrid'));
+            }
+            return successTrans("success.data",$menu);
+        } catch (\Throwable $throwable) {
+            echo $throwable->getFile()."\n";
+            echo $throwable->getLine()."\n";
+            return error($throwable->getMessage());
+        }
+    }
+
+
+    /**
+     * 更新
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "save",methods: "post")]
+    public function saveMenuData(Request $request): Response
+    {
+        try {
+            $state = (new SystemMenu)->setAutoData($request->post());
+            if(!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
 }

+ 63 - 64
app/controller/admin/Upload.php → app/controller/adminapi/admin/Upload.php

@@ -1,65 +1,64 @@
-<?php
-
-namespace app\controller\admin;
-
-use app\extra\basic\Base;
-use app\extra\tools\UploadExtend;
-use app\middleware\AuthMiddleware;
-use LinFly\Annotation\Route\Controller;
-use LinFly\Annotation\Route\Middleware;
-use LinFly\Annotation\Route\Route;
-use support\Request;
-use support\Response;
-use Tinywan\Storage\Storage;
-
-
-#[Controller(prefix: "/api/upload"),Middleware(AuthMiddleware::class)]
-class Upload extends Base
-{
-
-
-    /**
-     * 上传文件
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "data",methods: "post")]
-    public function upload2image(Request $request): Response
-    {
-        try {
-            $resp = UploadExtend::uploadFile();
-            if (!isset($resp[0]['url'])) return errorTrans(40010);
-            return successTrans("success.data",[
-                "fileName"  => $resp[0]['origin_name'],
-                "src"       => $resp[0]['url'],
-            ],200);
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-
-    /**
-     * 上传文件
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "file",methods: "post")]
-    public function upload2file(Request $request): Response
-    {
-        try {
-            $resp = UploadExtend::disk(UploadExtend::MODE_LOCAL)->uploadFile();
-            if (!isset($resp[0]['url'])) return errorTrans(40010);
-            return successTrans("success.data",[
-                "fileName"  => $resp[0]['origin_name'],
-                "src"       => $resp[0]['url'],
-            ],200);
-        } catch (\Throwable $throwable) {
-            echo $throwable->getFile()."\n";
-            echo $throwable->getLine()."\n";
-            return error($throwable->getMessage());
-        }
-    }
-
+<?php
+
+namespace app\controller\adminapi\admin;
+
+use app\extra\basic\Base;
+use app\extra\tools\UploadExtend;
+use app\middleware\AuthMiddleware;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/upload"),Middleware(AuthMiddleware::class)]
+class Upload extends Base
+{
+
+
+    /**
+     * 上传文件
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "data",methods: "post")]
+    public function upload2image(Request $request): Response
+    {
+        try {
+            $resp = UploadExtend::uploadFile();
+            if (!isset($resp[0]['url'])) return errorTrans(40010);
+            return successTrans("success.data",[
+                "fileName"  => $resp[0]['origin_name'],
+                "src"       => $resp[0]['url'],
+            ],200);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+
+
+    /**
+     * 上传文件
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "file",methods: "post")]
+    public function upload2file(Request $request): Response
+    {
+        try {
+            $resp = UploadExtend::disk(UploadExtend::MODE_LOCAL)->uploadFile();
+            if (!isset($resp[0]['url'])) return errorTrans(40010);
+            return successTrans("success.data",[
+                "fileName"  => $resp[0]['origin_name'],
+                "src"       => $resp[0]['url'],
+            ],200);
+        } catch (\Throwable $throwable) {
+            echo $throwable->getFile()."\n";
+            echo $throwable->getLine()."\n";
+            return error($throwable->getMessage());
+        }
+    }
+
 }

+ 3 - 3
app/controller/admin/User.php → app/controller/adminapi/admin/User.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace app\controller\admin;
+namespace app\controller\adminapi\admin;
 
 use app\extra\basic\Base;
 use app\extra\service\system\UserService;
@@ -10,13 +10,13 @@ use app\model\system\SystemUser;
 use app\validate\system\UserValidate;
 use DI\Attribute\Inject;
 use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
 use LinFly\Annotation\Route\Route;
 use support\Request;
 use support\Response;
-use LinFly\Annotation\Route\Middleware;
 
 
-#[Controller(prefix: "/api/user"),Middleware(AuthMiddleware::class)]
+#[Controller(prefix: "/adminapi/user"),Middleware(AuthMiddleware::class)]
 class User extends Base
 {
 

+ 32 - 33
app/controller/common/Common.php → app/controller/adminapi/admin/common/Common.php

@@ -1,34 +1,33 @@
-<?php
-
-namespace app\controller\common;
-
-use app\extra\basic\Base;
-use app\model\system\SystemConfig;
-use LinFly\Annotation\Route\Controller;
-use LinFly\Annotation\Route\Route;
-use support\Response;
-use Tinywan\Captcha\Captcha;
-
-/**
- *
- */
-#[Controller(prefix: "/api/service")]
-class Common extends Base
-{
-
-    /**
-     *
-     */
-    #[Route(path: "data",methods: "get")]
-    public function getServiceData(): Response
-    {
-        try {
-            $captcha = Captcha::base64();
-            $service = (new SystemConfig)->where("type","service")->column("value","name");
-            return successTrans("success.data",compact('captcha','service'));
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
+<?php
+
+namespace app\controller\adminapi\admin\common;
+
+use app\extra\basic\Base;
+use app\model\system\SystemConfig;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Route;
+use support\Response;
+use Tinywan\Captcha\Captcha;
+
+/**
+ *
+ */
+#[Controller(prefix: "/adminapi/service")]
+class Common extends Base
+{
+    /**
+     *
+     */
+    #[Route(path: "data",methods: "get")]
+    public function getServiceData(): Response
+    {
+        try {
+            $captcha = Captcha::base64();
+            $service = (new SystemConfig)->where("type","service")->column("value","name");
+            return successTrans("success.data",compact('captcha','service'));
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
 }

+ 48 - 0
app/controller/adminapi/cutter/Cutter.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace app\controller\adminapi\cutter;
+
+use app\extra\basic\Base;
+use app\extra\service\cutter\CutterService;
+use app\middleware\AuthMiddleware;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/adminapi/cutter"),Middleware(AuthMiddleware::class)]
+class Cutter extends Base
+{
+
+    #[Inject]
+    protected CutterService $service;
+
+    #[Route(path: "list",methods: "get")]
+    public function getList(Request $request): Response
+    {
+        try {
+            $param = $request->get();
+            $param['is_cutter'] = 1;
+            $list = $this->service->getList($param,'*',$param['page']??0,$param['limit']??0);
+            return successTrans("success.data",$list);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "info/{id}",methods: "get")]
+    public function info($id): Response
+    {
+        try {
+            $take = $this->service->getOne(["id"=>$id,'status'=>1,'is_del'=>0]);
+            if ($take->isEmpty()) return errorTrans("empty.error");
+            return successTrans("success.data",$take->toArray());
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 81 - 0
app/controller/adminapi/cutter/CutterApply.php

@@ -0,0 +1,81 @@
+<?php
+
+namespace app\controller\adminapi\cutter;
+
+use app\extra\basic\Base;
+use app\extra\service\cutter\CutterApplyService;
+use app\extra\service\user\UserService;
+use app\middleware\AuthMiddleware;
+use app\validate\system\UserValidate;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/adminapi/cutter/apply"),Middleware(AuthMiddleware::class)]
+class CutterApply extends Base
+{
+
+    #[Inject]
+    protected CutterApplyService $service;
+
+    #[Inject]
+    protected UserService $userService;
+
+    #[Route(path: "list",methods: "get")]
+    public function getList(Request $request): Response
+    {
+        try {
+            $param = $request->get();
+            $list = $this->service->getList($param,'*',$param['page']??0,$param['limit']??0);
+            return successTrans("success.data",$list);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "info/{id}",methods: "get")]
+    public function info($id): Response
+    {
+        try {
+            $take = $this->service->getOne(["id"=>$id,'status'=>1,'is_del'=>0]);
+            if ($take->isEmpty()) return errorTrans("empty.error");
+            return successTrans("success.data",$take->toArray());
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "agreed/{id}",methods: "post")]
+    public function agreed($id): Response
+    {
+        try {
+            $apply = $this->service->getOne(["id"=>$id]);
+            if ($apply->isEmpty()) return errorTrans("empty.error");
+            $state = $this->service->update($id,['status'=>1]) && $this->userService->update($apply['uid'],['is_cutter'=>1]);
+            if (!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "refuse/{id}",methods: "post")]
+    public function refuse (Request $request,$id): Response
+    {
+        try {
+            $remark = $request->post('remark','');
+            $apply = $this->service->getOne(["id"=>$id]);
+            if ($apply->isEmpty()) return errorTrans("empty.error");
+            $state = $this->service->update($id,['status'=>2,'remark'=>$remark]);
+            if (!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 88 - 0
app/controller/adminapi/cutter/CutterOrder.php

@@ -0,0 +1,88 @@
+<?php
+
+namespace app\controller\adminapi\cutter;
+
+use app\extra\basic\Base;
+use app\extra\service\cutter\CutterOrderService;
+use app\middleware\AuthMiddleware;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/adminapi/cutter/order"),Middleware(AuthMiddleware::class)]
+class CutterOrder extends Base
+{
+
+    #[Inject]
+    protected CutterOrderService $service;
+
+//    #[Inject]
+//    protected CutterTaskValidate $validate;
+
+    #[Route(path: "list",methods: "get")]
+    public function getList(Request $request): Response
+    {
+        try {
+            $param = $request->get();
+            $list = $this->service->getList($param,'*',$param['page']??0,$param['limit']??0);
+            return successTrans("success.data",$list);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+
+    #[Route(path: "info/{id}",methods: "get")]
+    public function info($id): Response
+    {
+        try {
+            $info = $this->service->getOrder(['id'=>$id]);
+            if ($info->isEmpty()) return errorTrans("empty.error");
+            return successTrans("success.data",$info->toArray());
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "affirm/{id}",methods: "post")]
+    public function affirm($id): Response
+    {
+        try {
+            $state = $this->service->affirm($id);
+            if (!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "reject/{id}",methods: "post")]
+    public function reject(Request $request,$id): Response
+    {
+        try {
+            $remark = $request->post('remark');
+            $state = $this->service->reject($id,$remark);
+            if (!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "reject/{id}",methods: "post")]
+    public function settle(Request $request,$id): Response
+    {
+        try {
+            $state = $this->service->settle($id);
+            if (!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 85 - 0
app/controller/adminapi/cutter/CutterTask.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace app\controller\adminapi\cutter;
+
+use app\extra\basic\Base;
+use app\extra\service\cutter\CutterTaskService;
+use app\middleware\AuthMiddleware;
+use app\validate\adminapi\cutter\CutterTaskValidate;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/adminapi/cutter/task"),Middleware(AuthMiddleware::class)]
+class CutterTask extends Base
+{
+
+    #[Inject]
+    protected CutterTaskService $service;
+
+    #[Inject]
+    protected CutterTaskValidate $validate;
+
+    #[Route(path: "list",methods: "get")]
+    public function getList(Request $request): Response
+    {
+        try {
+            $param = $request->get();
+            $list = $this->service->getList($param,'*',$param['page']??0,$param['limit']??0);
+            return successTrans("success.data",$list);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "save",methods: "post")]
+    public function save(Request $request): Response
+    {
+        try {
+            $param = $request->post();
+            $param['material'] = [];
+            if (!$this->validate->check($param)) return error($this->validate->getError());
+            $param = $this->validate->checked($param);
+            if(!empty($param['id'])){
+                $id = $param['id'];
+                unset($param['id']);
+                $state = $this->service->update($id,$param);
+            }else{
+                $state = $this->service->save($param);
+            }
+            if (!$state) return errorTrans("empty.error");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "set_status/{id}/{status}",methods: "get")]
+    public function set_status($id,$status): Response
+    {
+        try {
+            $state = $this->service->update($id,['status'=>$status]);
+            if (!$state) return errorTrans("empty.error");
+            return successTrans($status?'显示成功':'关闭成功');
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "del/{id}",methods: "delete")]
+    public function delete($id): Response
+    {
+        try {
+            $state = $this->service->update($id,['is_del'=>1]);
+            if (!$state) return errorTrans("empty.error");
+            return successTrans('删除成功');
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 75 - 0
app/controller/adminapi/finance/UserBrokerage.php

@@ -0,0 +1,75 @@
+<?php
+
+namespace app\controller\adminapi\finance;
+
+use app\extra\basic\Base;
+use app\extra\service\user\UserBrokerageService;
+use app\middleware\AuthMiddleware;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/adminapi/finance/brokerage"),Middleware(AuthMiddleware::class)]
+class UserBrokerage extends Base
+{
+
+    #[Inject]
+    protected UserBrokerageService $service;
+
+
+    #[Route(path: "list",methods: "get")]
+    public function getList(Request $request): Response
+    {
+        try {
+            $param = $request->get();
+            $list = $this->service->getList($param,'*',$param['page']??0,$param['limit']??0);
+            return successTrans("success.data",$list);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "save",methods: "post")]
+    public function save(Request $request): Response
+    {
+        try {
+            $param = $request->post();
+            if (!$this->validate->check($param)) return error($this->validate->getError());
+            $param = $this->validate->checked($param);
+            $state = $this->service->save($param);
+            if ($state->isEmpty()) return errorTrans("empty.error");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "set_status/{id}/{status}",methods: "get")]
+    public function set_status($id,$status): Response
+    {
+        try {
+            $state = $this->service->update($id,['status'=>$status]);
+            if (!$state) return errorTrans("empty.error");
+            return successTrans($status?'显示成功':'禁用成功');
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "del/{id}",methods: "delete")]
+    public function delete($id): Response
+    {
+        try {
+            $state = $this->service->update($id,['is_del'=>1]);
+            if (!$state) return errorTrans("empty.error");
+            return successTrans('删除成功');
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 80 - 0
app/controller/adminapi/finance/UserExtract.php

@@ -0,0 +1,80 @@
+<?php
+
+namespace app\controller\adminapi\finance;
+
+use app\extra\basic\Base;
+use app\extra\service\user\UserBrokerageService;
+use app\extra\service\user\UserExtractService;
+use app\middleware\AuthMiddleware;
+use app\validate\api\user\UserExtractValidate;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/adminapi/finance/extract"),Middleware(AuthMiddleware::class)]
+class UserExtract extends Base
+{
+
+    #[Inject]
+    protected UserExtractService $service;
+
+    #[Inject]
+    protected UserExtractValidate $validate;
+
+
+    #[Route(path: "list",methods: "get")]
+    public function getList(Request $request): Response
+    {
+        try {
+            $param = $request->get();
+            $list = $this->service->getList($param,'*',$param['page']??0,$param['limit']??0);
+            return successTrans("success.data",$list);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    /**
+     * 拒绝
+     * @param $id
+     * @return mixed
+     */
+    #[Route(path: "refuse/{id}",methods: "post")]
+    public function refuse(Request $request,$id)
+    {
+        try {
+            if(!$id) return errorTrans('缺少参数');
+            $param = $request->post();
+            if (!$this->validate->check($param)) return error($this->validate->getError());
+            $param = $this->validate->checked($param);
+            $state = $this->service->refuse($id,$param['fail_msg']);
+            if(!$state) return errorTrans('error.data');
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    /**
+     * 通过
+     * @param $id
+     * @return mixed
+     */
+    #[Route(path: "adopt/{id}",methods: "post")]
+    public function adopt(Request $request,$id)
+    {
+        try {
+            if(!$id) return errorTrans('缺少参数');
+            $state = $this->service->adopt($id);
+            if(!$state) return errorTrans('error.data');
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 78 - 0
app/controller/adminapi/kefu/Kefu.php

@@ -0,0 +1,78 @@
+<?php
+
+namespace app\controller\adminapi\kefu;
+
+use app\extra\basic\Base;
+use app\extra\service\service\KefuService;
+use app\middleware\AuthMiddleware;
+use app\validate\adminapi\kefu\KefuValidate;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/adminapi/kefu/"),Middleware(AuthMiddleware::class)]
+class Kefu extends Base
+{
+
+    #[Inject]
+    protected KefuService $service;
+
+    #[Inject]
+    protected KefuValidate $validate;
+
+    #[Route(path: "list",methods: "get")]
+    public function getList(Request $request): Response
+    {
+        try {
+            $param = $request->get();
+            $list = $this->service->getList($param,'*',$param['page']??0,$param['limit']??0);
+            return successTrans("success.data",$list);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "save",methods: "post")]
+    public function save(Request $request): Response
+    {
+        try {
+            $param = $request->post();
+            if (!$this->validate->check($param)) return error($this->validate->getError());
+            $param = $this->validate->checked($param);
+            $state = $this->service->save($param);
+            if ($state->isEmpty()) return errorTrans("empty.error");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "set_status/{id}/{status}",methods: "get")]
+    public function set_status($id,$status): Response
+    {
+        try {
+            $state = $this->service->update($id,['status'=>$status]);
+            if (!$state) return errorTrans("empty.error");
+            return successTrans($status?'显示成功':'关闭成功');
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "del/{id}",methods: "delete")]
+    public function delete($id): Response
+    {
+        try {
+            $state = $this->service->update($id,['is_del'=>1]);
+            if (!$state) return errorTrans("empty.error");
+            return successTrans('删除成功');
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 75 - 0
app/controller/adminapi/user/User.php

@@ -0,0 +1,75 @@
+<?php
+
+namespace app\controller\adminapi\user;
+
+use app\extra\basic\Base;
+use app\extra\service\user\UserService;
+use app\middleware\AuthMiddleware;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/adminapi/users/"),Middleware(AuthMiddleware::class)]
+class User extends Base
+{
+
+    #[Inject]
+    protected UserService $service;
+
+
+    #[Route(path: "list",methods: "get")]
+    public function getList(Request $request): Response
+    {
+        try {
+            $param = $request->get();
+            $list = $this->service->getList($param,'*',$param['page']??0,$param['limit']??0);
+            return successTrans("success.data",$list);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "save",methods: "post")]
+    public function save(Request $request): Response
+    {
+        try {
+            $param = $request->post();
+            if (!$this->validate->check($param)) return error($this->validate->getError());
+            $param = $this->validate->checked($param);
+            $state = $this->service->save($param);
+            if ($state->isEmpty()) return errorTrans("empty.error");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "set_status/{id}/{status}",methods: "get")]
+    public function set_status($id,$status): Response
+    {
+        try {
+            $state = $this->service->update($id,['status'=>$status]);
+            if (!$state) return errorTrans("empty.error");
+            return successTrans($status?'显示成功':'禁用成功');
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "del/{id}",methods: "delete")]
+    public function delete($id): Response
+    {
+        try {
+            $state = $this->service->update($id,['is_del'=>1]);
+            if (!$state) return errorTrans("empty.error");
+            return successTrans('删除成功');
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 49 - 0
app/controller/api/PublicController.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace app\controller\api;
+
+use app\extra\basic\Base;
+use app\middleware\AuthMiddleware;
+use app\model\system\SystemUser;
+use app\model\user\User;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use Shopwwi\WebmanAuth\Auth;
+use support\Request;
+use support\Response;
+use think\facade\Db;
+use Tinywan\Captcha\Captcha;
+
+
+#[Controller(prefix: "/api/")]
+class PublicController extends Base
+{
+
+    /**
+     * 获取协议
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "agreement",methods: "get")]
+    public function setLogin(Request $request): Response
+    {
+        try {
+            $type = $request->get('type',1);
+            switch ($type) {
+                case 1:
+                    $key = 'service.agreements';
+                    break;
+                case 2:
+                    $key = 'service.privacy';
+                    break;
+                case 3:
+                    $key = 'service.cutter_rule';
+                    break;
+            }
+            return successTrans("success.login",['content'=>sConf($key)]);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+}

+ 66 - 0
app/controller/api/cutter/CutterController.php

@@ -0,0 +1,66 @@
+<?php
+
+namespace app\controller\api\cutter;
+
+use app\extra\basic\Base;
+use app\extra\service\cutter\CutterApplyService;
+use app\validate\api\user\CutterApplyValidate;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Route;
+use Shopwwi\WebmanAuth\Auth;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/api/user/")]
+class CutterController extends Base
+{
+
+    #[Inject]
+    protected CutterApplyService $cutterApplyService;
+
+    #[Inject]
+    protected CutterApplyValidate $validate;
+
+
+    /**
+     * 申请剪辑师
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "cutter/apply",methods: "post")]
+    public function cutter_apply(Request $request): Response
+    {
+        try {
+            $user = (new Auth)->guard("user")->user()->toArray();
+            $param = $request->post();
+            if (!$this->validate->check($param)) return error($this->validate->getError());
+            $param['uid'] = $user['uid'];
+            $state = $this->cutterApplyService->save($param);
+            if (!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+
+    /**
+     * 申请剪辑师详情
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "cutter/apply/info",methods: "get")]
+    public function cutter_apply_info(Request $request): Response
+    {
+        try {
+            $user = (new Auth)->guard("user")->user()->toArray();
+            $apply = $this->cutterApplyService->getOne(['uid'=>$user['uid']]);
+            return successTrans("success.data",$apply?$apply->toArray():[]);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 110 - 0
app/controller/api/cutter/CutterOrderController.php

@@ -0,0 +1,110 @@
+<?php
+
+namespace app\controller\api\cutter;
+
+use app\extra\basic\Base;
+use app\extra\service\cutter\CutterOrderService;
+use app\extra\service\cutter\CutterTaskService;
+use app\middleware\AuthMiddleware;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use Shopwwi\WebmanAuth\Auth;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/api/cutter/order"),Middleware(AuthMiddleware::class)]
+class CutterOrderController extends Base
+{
+
+    #[Inject]
+    protected CutterOrderService $service;
+
+    #[Route(path: "lst",methods: "get")]
+    public function getList(Request $request): Response
+    {
+        try {
+            $param = $request->get();
+            $user = (new Auth)->guard("user")->user()->toArray();
+            $param['uid'] = $user['uid'];
+            $list = $this->service->getLst($param,'id,task_id,uid,status,created_at',$param['page']??0,$param['limit']??0);
+            return successTrans("success.data",$list,200);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "create",methods: "post")]
+    public function create(Request $request): Response
+    {
+        try {
+            $id = $request->post('id',0);
+            $user = (new Auth)->guard("user")->user()->toArray();
+            $state = $this->service->createOrder($id,$user);
+            if (!$state) return errorTrans("error.data");
+            return successTrans("任务领取成功",['id'=>$state->id]);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    /**
+     * 提交
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "submit",methods: "post")]
+    public function submit(Request $request): Response
+    {
+        try {
+            $user = (new Auth)->guard("user")->user()->toArray();
+            $param = $request->post();
+            $state = $this->service->submit($param,$user);
+            if (!$state) return errorTrans("error.data");
+            return successTrans("提交成功");
+        } catch (\Throwable $throwable) {
+            echo $throwable->getMessage()."\n";
+            echo $throwable->getFile()."\n";
+            echo $throwable->getLine()."\n";
+            return error($throwable->getMessage());
+        }
+    }
+
+    /**
+     * 删除
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "del/{id}",methods: "delete")]
+    public function delUser($id): Response
+    {
+        try {
+            $state = $this->service->saveData(['id'=>$id,'is_del'=>1]);
+            if (!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    /**
+     * 设置状态
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "set_status/{id}/{status}",methods: "get")]
+    public function set_status($id,$status): Response
+    {
+        try {
+            $state = $this->service->update($id,['status'=>$status]);
+            if (!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+
+}

+ 47 - 0
app/controller/api/cutter/CutterTaskController.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace app\controller\api\cutter;
+
+use app\extra\basic\Base;
+use app\extra\service\cutter\CutterTaskService;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/api/cutter/task")]
+class CutterTaskController extends Base
+{
+
+    #[Inject]
+    protected CutterTaskService $service;
+
+    #[Route(path: "lst",methods: "get")]
+    public function getList(Request $request): Response
+    {
+        try {
+            $param = $request->get();
+            $param['status'] = 1;
+            $param['is_del'] = 0;
+            $list = $this->service->getList($param,'*',$param['page']??0,$param['limit']??0);
+            return successTrans("success.data",$list);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "info/{id}",methods: "get")]
+    public function info($id): Response
+    {
+        try {
+            $take = $this->service->getOne(["id"=>$id]);
+            if ($take->isEmpty()) return errorTrans("empty.error");
+            return successTrans("success.data",$take->toArray(),200);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 129 - 0
app/controller/api/user/LoginController.php

@@ -0,0 +1,129 @@
+<?php
+
+namespace app\controller\api\user;
+
+use app\extra\basic\Base;
+use app\extra\service\user\UserService;
+use app\extra\service\wechat\RoutineService;
+use app\middleware\AuthMiddleware;
+use app\model\system\SystemUser;
+use app\model\user\User;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use Shopwwi\WebmanAuth\Auth;
+use support\Request;
+use support\Response;
+use think\facade\Db;
+use Tinywan\Captcha\Captcha;
+
+
+#[Controller(prefix: "/api")]
+class LoginController extends Base
+{
+
+    #[Inject]
+    protected RoutineService $service;
+
+    #[Inject]
+    protected UserService $userService;
+    /**
+     * 登陆
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "login",methods: "get")]
+    public function setLogin(Request $request): Response
+    {
+        try {
+            $code = $request->get('code','');
+            $wechatUser = $this->service->getUserInfo($code);
+            $wechatUser['login_at'] = getDateFull();
+            $wechatUser['login_ip']= $request->getRealIp();
+//            $wechatUser = [
+//                "session_key" => "wEtGL27l7JoZrpnvk7EaQQ==",
+//                "openid"      => "o2Y1o11UVFinpoU8SyJ7l6RhiO-w",
+//                "unionid"     => "oH31T2dy6EtP3tQYUoY9ZGmbxIvM",
+//                "login_at"    => "2026-04-29 19:01:00",
+//                "login_ip"    => "192.168.2.64",
+//            ];
+            $user = $this->userService->getUserInfo($wechatUser);
+            return successTrans("success.login",get_object_vars((new Auth)->guard("user")->login($user)));
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    /**
+     * 登陆
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "testlogin",methods: "post")]
+    public function setLogin2(Request $request): Response
+    {
+        try {
+//            $param = $this->_valid([
+//                "username.require"  => trans("empty.user"),
+//                "password.require"  => trans("empty.passwd"),
+//                "code.require"      => trans("empty.code"),
+//                "key.require"       => trans("empty.data"),
+//            ],"post");
+//            if (!is_array($param)) return error($param);
+//            if (Captcha::check($param['code'],$param['key']) === false) return errorTrans("error.captcha");
+//            $map = ["is_deleted" => 0,"username" => $param['username']];
+//            [$state,$msg,$user] = $this->checkLogin($map,2,$param);
+            $user = (new User)->where('uid',1)->findOrEmpty();
+//            if (!$state) return error($msg);
+            return successTrans("success.login",get_object_vars((new Auth)->guard("user")->login($user)));
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+
+    /**
+     * 登录验证处理
+     * @param array $map
+     * @param int $type
+     * @param array $param
+     * @return array
+     */
+    protected function checkLogin(array $map = [],int $type = 1,array $param = []): array
+    {
+        $user = (new SystemUser)->where($map)->findOrEmpty();
+        if ($user->isEmpty()) return [0,trans("error.user-empty"),[]];
+        if ($user['status'] <> 1) return [0,trans("error.user-status"),[]];
+        if ($type == 2) {
+//            if (md5($param['password'].$user['salt']) <> $user['password']) return [0,trans("error.passwd"),[]];
+        }
+        $user->login_at = getDateFull();
+        $user->login_ip = request()->getRealIp();
+        $user->login_num = Db::raw("login_num+1");
+        $user->save();
+        return [1,'success',$user->toArray()];
+    }
+
+    /**
+     * @return Response
+     */
+    #[Route(path: "profile",methods: "get"),Middleware(AuthMiddleware::class)]
+    public function getLoginUser(): Response
+    {
+        try {
+            $userData = (new Auth)->guard("admin")->user()->toArray();
+            if (isset($userData['password'])) unset($userData['password']);
+            return successTrans("success.data",[
+                "username"  => $userData['username'],
+                "truename"  => $userData['truename'],
+                "agent_id"  => $userData['agent_id'],
+                "super"     => $userData['is_super'],
+                "type"      => $userData['type']
+            ]);
+        } catch (\Throwable $exception){
+            return error($exception->getMessage());
+        }
+    }
+
+}

+ 70 - 0
app/controller/api/user/UserController.php

@@ -0,0 +1,70 @@
+<?php
+
+namespace app\controller\api\user;
+
+use app\extra\basic\Base;
+use app\extra\service\user\UserService;
+use app\middleware\AuthMiddleware;
+use app\model\system\SystemUser;
+use app\model\user\User;
+use app\validate\api\user\UserValidate;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use Shopwwi\WebmanAuth\Auth;
+use support\Request;
+use support\Response;
+use think\facade\Db;
+
+
+#[Controller(prefix: "/api/user/"),Middleware(AuthMiddleware::class)]
+class UserController extends Base
+{
+
+    #[Inject]
+    protected UserService $service;
+
+    #[Inject]
+    protected UserValidate $validate;
+
+    /**
+     * 用户数据
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "",methods: "get")]
+    public function profile(Request $request): Response
+    {
+        try {
+            $user = (new Auth)->guard("user")->user()->toArray();
+            $user = $this->service->getUserProfile($user);
+            return successTrans("success.data",$user);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    /**
+     * 修改用户数据
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "edit",methods: "post")]
+    public function editUser(Request $request): Response
+    {
+        try {
+            $param = $request->post();
+            if (!$this->validate->check($param)) return error($this->validate->getError());
+            $param = $this->validate->checked($param);
+            $user = (new Auth)->guard("user")->user()->toArray();
+            $state = $this->service->update($user['uid'],$param);
+            if(!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+
+}

+ 51 - 0
app/controller/api/user/UserExtractController.php

@@ -0,0 +1,51 @@
+<?php
+
+namespace app\controller\api\user;
+
+use app\extra\basic\Base;
+use app\extra\service\user\UserExtractService;
+use app\middleware\AuthMiddleware;
+use app\validate\api\user\UserExtractValidate;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use Shopwwi\WebmanAuth\Auth;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/api/user/extract/"),Middleware(AuthMiddleware::class)]
+class UserExtractController extends Base
+{
+
+    #[Inject]
+    protected UserExtractService $service;
+
+    #[Inject]
+    protected UserExtractValidate $validate;
+
+    /**
+     * 申请提现
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "cash",methods: "post")]
+    public function cash(Request $request): Response
+    {
+        try {
+            $param = $request->post();
+            if (!$this->validate->check($param)) return error($this->validate->getError());
+            $param = $this->validate->checked($param);
+            $user = (new Auth)->guard("user")->user()->toArray();
+            $state = $this->service->cash($user,$param);
+            if (!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+
+
+}

+ 137 - 0
app/extra/basic/Dao.php

@@ -0,0 +1,137 @@
+<?php
+
+namespace app\extra\basic;
+
+abstract class Dao
+{
+    /**
+     * @var Model 模型单例实例
+     */
+    protected $modelInstance = null;
+
+    /**
+     * 获取当前模型
+     * @return string
+     */
+    abstract protected function setModel(): string;
+
+    /**
+     * 获取模型(单例,避免重复实例化)
+     * @return Model
+     */
+    protected function getModel()
+    {
+        if ($this->modelInstance === null) {
+            $modelClass = $this->setModel();
+            $this->modelInstance = new $modelClass();
+        }
+        return $this->modelInstance;
+    }
+
+    /**
+     * 根据条件获取一条数据
+     * @param array $where
+     * @param string|null $field
+     * @param array $with
+     * @return array|Model|null
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function getOne(array $where, ?string $field = '*')
+    {
+        return $this->getModel()->where($where)->field($field)->findOrEmpty();
+    }
+
+    /**
+     * @param array $where
+     * @param string $field
+     */
+    public function selectWhere(array $where, string $field = '*')
+    {
+        return $this->getModel()->where($where)->field($field)->select();
+    }
+
+    /**
+     * 读取数据条数
+     * @param array $where
+     * @return int
+     */
+    public function count(array $where = []): int
+    {
+        return $this->getModel()->where($where)->count();
+    }
+
+
+    /**
+     * 更新数据
+     * @param int|string|array $id
+     * @param array $data
+     * @param string|null $key
+     * @return mixed
+     */
+    public function update($id, array $data, ?string $key = null)
+    {
+        if (is_array($id)) {
+            $where = $id;
+        } else {
+            $where = [is_null($key) ? $this->getModel()->getPk() : $key => $id];
+        }
+        $data['updated_at'] = date('Y-m-d H:i:s');
+        return $this->getModel()->where($where)->update($data);
+    }
+
+    /**
+     * 插入数据
+     * @param array $data
+     * @return mixed
+     */
+    public function save(array $data)
+    {
+        $data['created_at'] = date('Y-m-d H:i:s');
+        return $this->getModel()->create($data);
+    }
+
+    /**
+     * 插入数据
+     * @param array $data
+     * @return mixed
+     */
+    public function saveAll(array $data)
+    {
+        $data['created_at'] = date('Y-m-d H:i:s');
+        return $this->getModel()->insertAll($data);
+    }
+
+    /**
+     * 求和
+     * @param array $where
+     * @param string $field
+     * @param bool $search
+     * @return float
+     */
+    public function sum(array $where, string $field)
+    {
+        return $this->getModel()->where($where)->sum($field);
+    }
+
+    /**
+     * 某个字段累加某个数值
+     * @param string $field
+     * @param int $num
+     */
+    public function incField(array $where, string $field, $num = 1)
+    {
+        return $this->getModel()->where($where)->inc($field, $num)->update();
+    }
+
+    /**
+     * 某个字段累加某个数值
+     * @param string $field
+     * @param int $num
+     */
+    public function decField(array $where, string $field, $num = 1)
+    {
+        return $this->getModel()->where($where)->dec($field, $num)->update();
+    }
+}

+ 7 - 0
app/extra/basic/Model.php

@@ -17,8 +17,10 @@ class Model extends \think\Model
     {
         try {
             if (isset($data[$id]) && $this->where($id,$data[$id])->count()) {
+                $data['updated_at'] = date('Y-m-d H:i:s');
                 $state = $this->where($id,$data[$id])->strict(false)->update($data);
             } else {
+                $data['created_at'] = date('Y-m-d H:i:s');
                 $state = $this->strict(false)->insertGetId($data);
             }
         } catch (\Throwable $throwable) {
@@ -27,4 +29,9 @@ class Model extends \think\Model
         return $state;
     }
 
+    public function getPk()
+    {
+        return $this->primaryKey;
+    }
+
 }

+ 30 - 1
app/extra/basic/Service.php

@@ -4,8 +4,9 @@ namespace app\extra\basic;
 
 use app\model\system\SystemConfig;
 use Overtrue\EasySms\Strategies\OrderStrategy;
+use think\facade\Db;
 
-class Service
+abstract class Service
 {
 
     /**
@@ -13,6 +14,7 @@ class Service
      */
     protected $mode = null;
 
+    protected $dao;
 
     /**
      * 短信配置
@@ -93,4 +95,31 @@ class Service
         return $this->mode->order($orderBy)->where($filter);
     }
 
+    /**
+     * 事务执行
+     */
+    protected function transaction(callable $callback)
+    {
+        try {
+            Db::startTrans();
+            $result = $callback();
+            Db::commit();
+            return $result;
+        } catch (\Exception $e) {
+            Db::rollBack();
+            throw $e;
+        }
+    }
+
+    /**
+     * @param $name
+     * @param $arguments
+     * @return mixed
+     */
+    public function __call($name, $arguments)
+    {
+        // TODO: Implement __call() method.
+        return call_user_func_array([$this->dao, $name], $arguments);
+    }
+
 }

+ 26 - 0
app/extra/dao/cutter/CutterApplyDao.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace app\extra\dao\cutter;
+
+use app\extra\basic\Dao;
+use app\model\cutter\CutterApply;
+
+class CutterApplyDao extends Dao
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    protected function setModel(): string
+    {
+        return CutterApply::class;
+    }
+
+
+    public function getList(array $where,string $field = '*',int $page = 0, int $limit = 0,string $order='id desc')
+    {
+        return $this->getModel()->where($where)->field($field)->when($page&&$limit,function($query)use($page,$limit){
+            $query->page($page,$limit);
+        })->select();
+    }
+}

+ 40 - 0
app/extra/dao/cutter/CutterOrderDao.php

@@ -0,0 +1,40 @@
+<?php
+
+namespace app\extra\dao\cutter;
+
+use app\extra\basic\Dao;
+use app\model\cutter\CutterOrder;
+
+class CutterOrderDao extends Dao
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    protected function setModel(): string
+    {
+        return CutterOrder::class;
+    }
+
+    public function getList(array $where,string $field = '*',int $page = 0, int $limit = 0,string $order='id desc')
+    {
+        return $this->getModel()->where($where)->field($field)->when($page&&$limit,function($query)use($page,$limit){
+            $query->page($page,$limit);
+        })->with(['task','user'=>function ($query) {
+            return $query->field(['uid','nickname','avatar']);
+        }])->select();
+    }
+
+
+    public function getLst(array $where,string $field = '*',int $page = 0, int $limit = 0,string $order='id desc')
+    {
+        return $this->getModel()->where($where)->field($field)->when($page&&$limit,function($query)use($page,$limit){
+            $query->page($page,$limit);
+        })->with('task')->select();
+    }
+
+    public function getOrder(array $where,string $field = '*')
+    {
+        return $this->getModel()->where($where)->field($field)->with('task')->findOrEmpty();
+    }
+}

+ 26 - 0
app/extra/dao/cutter/CutterTaskDao.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace app\extra\dao\cutter;
+
+use app\extra\basic\Dao;
+use app\model\cutter\CutterTask;
+
+class CutterTaskDao extends Dao
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    protected function setModel(): string
+    {
+        return CutterTask::class;
+    }
+
+
+    public function getList(array $where,string $field = '*',int $page = 0, int $limit = 0,string $order='id desc')
+    {
+        return $this->getModel()->where($where)->field($field)->when($page&&$limit,function($query)use($page,$limit){
+            $query->page($page,$limit);
+        })->select();
+    }
+}

+ 25 - 0
app/extra/dao/kefu/KefuDao.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace app\extra\dao\kefu;
+
+use app\extra\basic\Dao;
+use app\model\kefu\Kefu;
+
+class KefuDao extends Dao
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    protected function setModel(): string
+    {
+        return Kefu::class;
+    }
+
+    public function getList(array $where,string $field = '*',int $page = 0, int $limit = 0,string $order='id desc')
+    {
+        return $this->getModel()->where($where)->field($field)->when($page&&$limit,function($query)use($page,$limit){
+            $query->page($page,$limit);
+        })->select();
+    }
+}

+ 25 - 0
app/extra/dao/user/UserBrokerageDao.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace app\extra\dao\user;
+
+use app\extra\basic\Dao;
+use app\model\user\UserBrokerage;
+
+class UserBrokerageDao extends Dao
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    protected function setModel(): string
+    {
+        return UserBrokerage::class;
+    }
+
+    public function getList(array $where,string $field = '*',int $page = 0, int $limit = 0,string $order='id desc')
+    {
+        return $this->getModel()->where($where)->field($field)->when($page&&$limit,function($query)use($page,$limit){
+            $query->page($page,$limit);
+        })->select();
+    }
+}

+ 25 - 0
app/extra/dao/user/UserDao.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace app\extra\dao\user;
+
+use app\extra\basic\Dao;
+use app\model\user\User;
+
+class UserDao extends Dao
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    protected function setModel(): string
+    {
+        return User::class;
+    }
+
+    public function getList(array $where,string $field = '*',int $page = 0, int $limit = 0,string $order='id desc')
+    {
+        return $this->getModel()->where($where)->field($field)->when($page&&$limit,function($query)use($page,$limit){
+            $query->page($page,$limit);
+        })->select();
+    }
+}

+ 25 - 0
app/extra/dao/user/UserExtractDao.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace app\extra\dao\user;
+
+use app\extra\basic\Dao;
+use app\model\user\UserExtract;
+
+class UserExtractDao extends Dao
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    protected function setModel(): string
+    {
+        return UserExtract::class;
+    }
+
+    public function getList(array $where,string $field = '*',int $page = 0, int $limit =0,string $order='id desc')
+    {
+        return $this->getModel()->where($where)->field($field)->when($page&&$limit,function($query)use($page,$limit){
+            $query->page($page,$limit);
+        })->select();
+    }
+}

+ 38 - 0
app/extra/service/cutter/CutterApplyService.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace app\extra\service\cutter;
+
+use app\extra\basic\Service;
+use app\extra\dao\cutter\CutterApplyDao;
+
+class CutterApplyService extends Service
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    public function __construct()
+    {
+        $this->dao =  new CutterApplyDao();
+    }
+
+    /**
+     * 列表
+     * @param array $param
+     */
+    public function getList(array $param = [],string $field = '*', int $page = 0,int $limit = 0,string $order = 'id desc')
+    {
+        $list =  $this->dao->getList($this->searchFilter($param),$field,$page,$limit,$order);
+        $count = $this->dao->count($this->searchFilter($param));
+        return compact('list','count');
+    }
+
+    protected function searchFilter(array $param = []): array
+    {
+        $filter = [];
+        !empty($param['status']) && $filter[] = ["status", '=', $param['status']];
+        !empty($param['is_del']) && $filter[] = ["is_del", '=', $param['is_del']];
+        return $filter;
+    }
+
+}

+ 155 - 0
app/extra/service/cutter/CutterOrderService.php

@@ -0,0 +1,155 @@
+<?php
+
+namespace app\extra\service\cutter;
+
+use app\extra\basic\Service;
+use app\extra\dao\cutter\CutterOrderDao;
+use app\extra\service\user\UserBrokerageService;
+use app\extra\service\user\UserService;
+use app\model\cutter\CutterOrder;
+use app\model\cutter\CutterTask;
+use think\exception\ValidateException;
+
+class CutterOrderService extends Service
+{
+    protected $task;
+    /**
+     * 设置模型
+     * @return string
+     */
+    public function __construct()
+    {
+        $this->dao =  new CutterOrderDao();
+    }
+
+    public function createOrder(int $id,array $user)
+    {
+        return $this->transaction(function () use ($id, $user) {
+            $cutterTaskService = new CutterTaskService();
+            $take = $cutterTaskService->getOne(["id"=>$id,'status'=>1,'is_del'=>0]);
+            if ($take->isEmpty()) throw new ValidateException('任务异常');
+            $order = $this->dao->getOne(["task_id"=>$take['id'],'uid'=>$user['uid']]);
+            if (!$order->isEmpty()) throw new ValidateException("同一个任务仅限领取一次");
+            if(strtotime($take['end_time']) > time()){
+                throw new ValidateException("该任务已到截止期,无法领取");
+            }
+            return $this->dao->save(['uid'=>$user['uid'],'task_id'=>$id]);
+        });
+
+    }
+
+    public function submit(array $data,array $user)
+    {
+        $id = $data['id']??0;
+        $order = $this->dao->getOne(["id"=>$id,'uid'=>$user['uid']]);
+        if ($order->isEmpty()) throw new ValidateException('参数异常');
+        $cutterTaskService = new CutterTaskService();
+        $take = $cutterTaskService->getOne(["id"=>$order['task_id'],'status'=>1,'is_del'=>0]);
+        if ($take->isEmpty()) throw new ValidateException('任务异常');
+        if(strtotime($take['end_time']) > time()){
+            throw new ValidateException("该任务已到截止期");
+        }
+
+        if(in_array($order['status'],['-1','0'])){
+            return $this->dao->update($order['id'],['audit_url'=>$data['url'],'status'=>1]);
+        }
+
+        if($order['status'] == 2){
+            return $this->dao->update($order['id'],['finish_url'=>$data['url'],'status'=>3]);
+        }
+    }
+
+
+
+    protected function searchFilter(array $param = []): array
+    {
+        $filter = [];
+        !empty($param['uid']) && $filter[] = ["uid", '=', $param['uid']];
+        isset($param['status']) && $param['status'] != '' && $filter[] = ["status", '=', $param['status']];
+        return $filter;
+    }
+
+    /**
+     * 列表
+     * @param array $param
+     */
+    public function getList(array $param = [],string $field = '*', int $page = 0,int $limit = 0,string $order = 'id desc')
+    {
+        $list =  $this->dao->getList($this->searchFilter($param),$field,$page,$limit,$order);
+        $count = $this->dao->count($this->searchFilter($param));
+        return compact('list','count');
+    }
+
+    /**
+     * 列表
+     * @param array $param
+     */
+    public function getLst(array $param = [],string $field = '*', int $page = 0,int $limit = 0,string $order = 'id desc')
+    {
+        $list =  $this->dao->getLst($this->searchFilter($param),$field,$page,$limit,$order);
+        $count = $this->dao->count($this->searchFilter($param));
+        return compact('list','count');
+    }
+
+
+    /**
+     * @param array $param
+     */
+    public function getOrder(array $param = [],string $field = '*')
+    {
+        return $this->dao->getOrder($param,$field);
+    }
+
+    public function affirm(int $id)
+    {
+        $order = $this->dao->getOne(["id"=>$id]);
+        if($order->isEmpty()) throw new ValidateException('参数异常');
+        if($order['status'] != 1) throw new ValidateException('订单状态异常');
+
+        return $this->dao->update($id,['status'=>2]);
+    }
+
+    public function reject(int $id,string $remark)
+    {
+        $order = $this->dao->getOne(["id"=>$id]);
+        if($order->isEmpty()) throw new ValidateException('参数异常');
+        if($order['status'] != 1) throw new ValidateException('订单状态异常');
+
+        return $this->dao->update($id,['status'=>-1,'remark'=>$remark]);
+    }
+
+    public function settle(int $id)
+    {
+        $order = $this->dao->getOne(["id"=>$id]);
+        if($order->isEmpty()) throw new ValidateException('参数异常');
+        if($order['status'] != 3) throw new ValidateException('订单状态异常');
+
+        $userService = new UserService();
+        $user = $userService->getOne(['uid'=>$order['uid']]);
+
+        $cutterTaskService = new CutterTaskService();
+        $task = $cutterTaskService->getOne(['id'=>$order['task_id']]);
+
+        return $this->transaction(function () use ($id,$task, $user, $userService) {
+
+            if (!$res = $this->dao->update($id,['status'=>4])) {
+                throw new ValidateException('结算失败');
+            }
+
+            if (!$userService->incField(['uid'=>$user['uid']], 'brokerage_price', $task['price'])) {
+                throw new ValidateException('修改用户信息失败');
+            }
+
+            $balance = bcsub((string)$user['brokerage_price'], (string)$data['price'], 2) ?? 0;
+            //保存佣金记录
+            $userBrokerageServices = new UserBrokerageService();
+
+            $mark = '订单结算成功,获得' . $task['price'] . '元'."佣金";
+            $userBrokerageServices->income('order_settle', $user['uid'], ['mark' => $mark, 'number' => $task['price']], $balance, $res['id']);
+
+            return true;
+        });
+    }
+
+
+}

+ 43 - 0
app/extra/service/cutter/CutterService.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace app\extra\service\cutter;
+
+use app\extra\basic\Service;
+use app\model\cutter\CutterApply;
+use app\model\user\User;
+
+class CutterService extends Service
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    public function __construct()
+    {
+        $this->mode =  new User();
+    }
+
+    /**
+     * 列表
+     * @param array $param
+     */
+    public function getList(array $param = [],string $field = '*', int $page = 0,int $limit = 0,string $order = 'id desc')
+    {
+        $list =  $this->mode->where($this->searchFilter($param))->with('cutter_apply')->field($field)->when($page&&$limit,function($query)use($page,$limit){
+            $query->page($page,$limit);
+        })->select();
+        $count = $this->mode->where($this->searchFilter($param))->count();
+        return compact('list','count');
+    }
+
+
+
+
+    protected function searchFilter(array $param = []): array
+    {
+        $filter = [];
+        !empty($param['is_cutter']) && $filter[] = ["is_cutter", '=', $param['is_cutter']];
+        return $filter;
+    }
+
+}

+ 38 - 0
app/extra/service/cutter/CutterTaskService.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace app\extra\service\cutter;
+
+use app\extra\basic\Service;
+use app\extra\dao\cutter\CutterTaskDao;
+
+class CutterTaskService extends Service
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    public function __construct()
+    {
+        $this->dao =  new CutterTaskDao();
+    }
+
+    /**
+     * 列表
+     * @param array $param
+     */
+    public function getList(array $param = [],string $field = '*', int $page = 0,int $limit = 0,string $order = 'id desc')
+    {
+        $list =  $this->dao->getList($this->searchFilter($param),$field,$page,$limit,$order);
+        $count = $this->dao->count($this->searchFilter($param));
+        return compact('list','count');
+    }
+
+    protected function searchFilter(array $param = []): array
+    {
+        $filter = [];
+        !empty($param['status']) && $filter[] = ["status", '=', $param['status']];
+        !empty($param['is_del']) && $filter[] = ["is_del", '=', $param['is_del']];
+        return $filter;
+    }
+
+}

+ 49 - 0
app/extra/service/service/KefuService.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace app\extra\service\service;
+
+use app\extra\basic\Service;
+use app\extra\dao\kefu\KefuDao;
+use app\model\user\User;
+use support\exception\BusinessException;
+
+class KefuService extends Service
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    public function __construct()
+    {
+        $this->dao =  new KefuDao();
+    }
+
+
+    /**
+     * 列表
+     * @param array $param
+     */
+    public function getList(array $param = [],string $field = '*', int $page = 0,int $limit = 0,string $order = 'id desc')
+    {
+        $list =  $this->dao->getList($this->searchFilter($param),$field,$page,$limit,$order);
+        $count = $this->dao->count($this->searchFilter($param));
+        return compact('list','count');
+    }
+
+    protected function searchFilter(array $param = []): array
+    {
+        $filter = [];
+        !empty($param['status']) && $filter[] = ["status", '=', $param['status']];
+        !empty($param['is_del']) && $filter[] = ["is_del", '=', $param['is_del']];
+        return $filter;
+    }
+
+    public function save(array $data)
+    {
+        $kefu = $this->dao->getOne([['wechat|phone','in',[$data['wechat'],$data['phone']]],['is_del','=',0]]);
+        if($kefu)
+            throw new BusinessException("客服已存在!");
+        return $this->dao->save($data);
+    }
+
+}

+ 104 - 0
app/extra/service/user/UserBrokerageService.php

@@ -0,0 +1,104 @@
+<?php
+
+namespace app\extra\service\user;
+
+use app\extra\basic\Service;
+use app\extra\dao\user\UserBrokerageDao;
+use support\exception\BusinessException;
+
+class UserBrokerageService extends Service
+{
+
+    /**
+     * 用户记录模板
+     * @var array[]
+     */
+    protected $incomeData = [
+        'extract' => [
+            'title' => '佣金提现',
+            'type' => 'extract',
+            'mark' => '{%mark%}',
+            'status' => 1,
+            'pm' => 0
+        ],
+        'extract_fail' => [
+            'title' => '提现失败',
+            'type' => 'extract_fail',
+            'mark' => '提现失败,退回佣金{%number%}元',
+            'status' => 1,
+            'pm' => 1
+        ],
+        'order_settle' => [
+            'title' => '订单结算',
+            'type' => 'order_settle',
+            'mark' => '订单结算成功,增加佣金{%number%}元',
+            'status' => 1,
+            'pm' => 1
+        ],
+    ];
+
+
+    /**
+     * 设置模型
+     * @return string
+     */
+    public function __construct()
+    {
+        $this->dao =  new UserBrokerageDao();
+    }
+
+    /**
+     * 列表
+     * @param array $param
+     */
+    public function getList(array $param = [],string $field = '*', int $page = 0,int $limit = 0,string $order = 'id desc')
+    {
+        $list =  $this->dao->getList($this->searchFilter($param),$field,$page,$limit,$order);
+        $count = $this->dao->count($this->searchFilter($param));
+        return compact('list','count');
+    }
+
+    protected function searchFilter(array $param = []): array
+    {
+        $filter = [];
+        !empty($param['key']) && $filter[] = ["uid", '=', $param['key']];
+        !empty($param['pm']) && $filter[] = ["pm", '=', $param['pm']];
+        return $filter;
+    }
+
+    /**
+     * 写入佣金记录
+     * @param string $type 写入类型
+     * @param int $uid
+     * @param int|string|array $number
+     * @param int|string $balance
+     * @param $linkId
+     * @return bool|mixed
+     */
+    public function income(string $type, int $uid, $number, $balance, $linkId)
+    {
+        $data = $this->incomeData[$type] ?? null;
+        if (!$data) {
+            return true;
+        }
+        $data['uid'] = $uid;
+        $data['balance'] = $balance ?? 0;
+        $data['link_id'] = $linkId;
+        if (is_array($number)) {
+            $key = array_keys($number);
+            $key = array_map(function ($item) {
+                return '{%' . $item . '%}';
+            }, $key);
+            $value = array_values($number);
+            $data['number'] = $number['number'] ?? 0;
+            $data['frozen_time'] = $number['frozen_time'] ?? '';
+            $data['mark'] = str_replace($key, $value, $data['mark']);
+        } else {
+            $data['number'] = $number;
+            $data['mark'] = str_replace(['{%number%}'], $number, $data['mark']);
+        }
+
+        return $this->dao->save($data);
+    }
+
+}

+ 150 - 0
app/extra/service/user/UserExtractService.php

@@ -0,0 +1,150 @@
+<?php
+
+namespace app\extra\service\user;
+
+use app\extra\basic\Service;
+use app\extra\dao\user\UserExtractDao;
+use app\extra\service\cutter\CutterOrderService;
+use support\exception\BusinessException;
+use think\exception\ValidateException;
+
+class UserExtractService extends Service
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    public function __construct()
+    {
+        $this->dao =  new UserExtractDao();
+    }
+
+    /**
+     * 列表
+     * @param array $param
+     */
+    public function getList(array $param = [],string $field = '*', int $page = 0,int $limit = 0,string $order = 'id desc')
+    {
+        $list =  $this->dao->getList($this->searchFilter($param),$field,$page,$limit,$order);
+        $count = $this->dao->count($this->searchFilter($param));
+        return compact('list','count');
+    }
+
+    protected function searchFilter(array $param = []): array
+    {
+        $filter = [];
+        !empty($param['status']) && $filter[] = ["status", '=', $param['status']];
+        return $filter;
+    }
+
+    public function cash(array $user,array $data):bool
+    {
+        $userService = new UserService();
+        $extractPrice = $user['brokerage_price'];
+        $userExtractMinPrice = 0;
+        if ($data['price'] < $userExtractMinPrice) {
+            throw new ValidateException('提现金额不能小于' . $userExtractMinPrice . '元');
+        }
+        if ($extractPrice < 0) {
+            throw new ValidateException('提现佣金不足' . $data['price']);
+        }
+        if ($data['price'] > $extractPrice) {
+            throw new ValidateException('提现佣金不足' . $data['price']);
+        }
+        if ($data['price'] <= 0) {
+            throw new ValidateException('提现佣金大于0');
+        }
+
+        //手续费
+        $charge = $data['price'] * (0 / 100);
+        $insertData = [
+            'real_name'=>$data['real_name'],
+            'uid' => $user['uid'],
+//            'extract_type' => $data['extract_type'],
+            'price'         => $data['price'], //提现金额
+            'extract_price' => $data['price'] - $charge, //到账金额
+            'service_price'=>$charge, //手续费
+            'balance' => $user['brokerage_price'] - $data['price'],
+            'status' => 0
+        ];
+        $mark = '提现' . $data['price'] . '元'."(手续费:$charge 元)";
+        return $this->transaction(function () use ($insertData, $data, $user, $userService, $mark) {
+            if (!$res = $this->dao->save($insertData)) {
+                throw new ValidateException('提现失败');
+            }
+            if (!$userService->decField(['uid'=>$user['uid']], 'brokerage_price', $data['price'])) {
+                throw new ValidateException('修改用户信息失败');
+            }
+            $balance = bcsub((string)$user['brokerage_price'], (string)$data['price'], 2) ?? 0;
+            //保存佣金记录
+            $userBrokerageServices = new UserBrokerageService();
+            $userBrokerageServices->income('extract', $user['uid'], ['mark' => $mark, 'number' => $data['price']], $balance, $res['id']);
+
+            return true;
+        });
+    }
+
+
+    /**
+     * 拒绝
+     * @param $id
+     * @return mixed
+     */
+    public function refuse(int $id, string $message)
+    {
+        $extract = $this->dao->getOne(['id'=>$id]);
+        if ($extract->isEmpty()) {
+            throw new ValidateException('操作记录不存在');
+        }
+        if ($extract->status == 1) {
+            throw new ValidateException('已经提现,错误操作');
+        }
+        if ($extract->status == -1) {
+            throw new ValidateException('您的提现申请已被拒绝,请勿重复操作!');
+        }
+        $fail_time = getDateFull();
+        $extract_number = $extract['extract_price'] + $extract['service_price'];
+        $mark = '提现失败,退回佣金' . $extract_number . '元';
+        $uid = $extract['uid'];
+        $status = -1;
+        $userServices = new UserService();
+        $user = $userServices->getOne(['uid'=>$uid]);
+        return $this->transaction(function () use ($user, $uid, $id, $extract_number, $message, $userServices, $status, $fail_time) {
+            //增加佣金记录
+            $userBrokerageServices = new UserBrokerageService();
+            $now_brokerage = bcadd((string)$user['brokerage_price'], (string)$extract_number, 2);
+
+            $userBrokerageServices->income('extract_fail', $uid, $extract_number, $now_brokerage, $id);
+            if (!$userServices->incField(['uid'=>$uid], 'brokerage_price', $extract_number))
+                throw new ValidateException('增加用户佣金失败');
+            if (!$this->dao->update($id, ['fail_time' => $fail_time, 'fail_msg' => $message, 'status' => $status])) {
+                throw new ValidateException('增加用户佣金失败');
+            }
+            return true;
+        });
+    }
+
+    /**
+     * 通过
+     * @param $id
+     * @return mixed
+     */
+    public function adopt(int $id)
+    {
+        $extract = $this->dao->getOne(['id'=>$id]);
+        if ($extract->isEmpty()) {
+            throw new ValidateException('操作记录不存在');
+        }
+        if ($extract->status == 1) {
+            throw new AdminException('您已提现,请勿重复提现!');
+        }
+        if ($extract->status == -1) {
+            throw new AdminException('您的提现申请已被拒绝!');
+        }
+        $data['status'] = 1;
+        $data['succeed_time'] = getDateFull();
+
+        return $this->dao->update($id, $data);
+    }
+
+}

+ 67 - 0
app/extra/service/user/UserService.php

@@ -0,0 +1,67 @@
+<?php
+
+namespace app\extra\service\user;
+
+use app\extra\basic\Service;
+use app\extra\dao\user\UserDao;
+use app\extra\service\cutter\CutterOrderService;
+use support\exception\BusinessException;
+
+class UserService extends Service
+{
+    /**
+     * 设置模型
+     * @return string
+     */
+    public function __construct()
+    {
+        $this->dao =  new UserDao();
+    }
+
+    /**
+     * 列表
+     * @param array $param
+     */
+    public function getList(array $param = [],string $field = '*', int $page = 0,int $limit = 0,string $order = 'id desc')
+    {
+        $list =  $this->dao->getList($this->searchFilter($param),$field,$page,$limit,$order);
+        $count = $this->dao->count($this->searchFilter($param));
+        return compact('list','count');
+    }
+
+    protected function searchFilter(array $param = []): array
+    {
+        $filter = [];
+        !empty($param['status']) && $filter[] = ["status", '=', $param['status']];
+        !empty($param['is_del']) && $filter[] = ["is_del", '=', $param['is_del']];
+        return $filter;
+    }
+
+    public function getUserInfo(array $data):array
+    {
+        $user = $this->dao->getOne(['openid'=>$data['openid'],'is_del'=>0]);
+        if($user->isEmpty()){
+            $user = $this->dao->save(['openid'=>$data['openid'],'nickname'=>'wx'.time().rand(1000,9999),'login_ip'=>$data['login_ip'],'login_at'=>$data['login_at']]);
+        }else if($user['status'] == 0){
+            throw new BusinessException('用户已被封禁');
+        }
+        return $user->toArray();
+    }
+
+
+    public function getUserProfile(array $user)
+    {
+        if($user['is_del'])
+            throw new BusinessException('用户已注销');
+        if(!$user['status'])
+            throw new BusinessException('用户已被封禁');
+
+        $cutterOrderService = new CutterOrderService();
+        $userBrokerageService = new UserBrokerageService();
+        $user['order_count'] = $cutterOrderService->count(['uid'=>$user['uid']]);
+        $user['brokerage_sum'] = $userBrokerageService->sum(['uid'=>$user['uid'],'pm'=>1],'number');
+
+        return $user;
+    }
+
+}

+ 45 - 0
app/extra/service/wechat/RoutineService.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace app\extra\service\wechat;
+
+use app\extra\basic\Service;
+use EasyWeChat\MiniApp\Application;
+
+class RoutineService extends Service
+{
+
+    protected $request;
+
+    protected $utils;
+
+    /**
+     * 设置模型
+     * @return string
+     */
+    public function __construct()
+    {
+        $miniapp =  new Application($this->options());
+        $this->request =  $miniapp->getClient();
+        $this->utils = $miniapp->getUtils();
+    }
+
+    protected function options()
+    {
+        return ['app_id'=>sConf('wechat.mini_appid'),'secret'=>sConf('wechat.mini_secret'),'token'=>'','aes_key'=>''];
+    }
+
+    /**
+     * 列表
+     * @param array $param
+     */
+    public function getUserInfo(string $code)
+    {
+        try {
+            return $this->utils->codeToSession($code);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+
+    }
+
+}

+ 9 - 3
app/middleware/AuthMiddleware.php

@@ -19,11 +19,17 @@ class AuthMiddleware implements MiddlewareInterface
             $noNeedLogin = $controller->getDefaultProperties()['noNeedLogin']??[];
             if (empty($noNeedLogin) || !in_array($request->action, $noNeedLogin)) {
                 $type = $request->header('api-type','');
-                if (empty($type)) return json(['code'=> 0,'msg'=> trans("error.param")]);
+                if (empty($type) || !in_array($type,['web','routine'])) return json(['code'=> 0,'msg'=> trans("error.param")]);
+                if($type =='web'){
+                    $key = 'admin';
+                }
+                if($type =='routine'){
+                    $key = 'user';
+                }
                 $token =  $request->header("Authorization","");
                 if (empty($token)) return json(['code'=> 0,'msg'=> trans("error.request")]);
-                (new JWT)->guard("admin")->verify();
-                $user = (new Auth)->guard("admin")->user();
+                (new JWT)->guard($key)->verify();
+                $user = (new Auth)->guard($key)->user();
                 if (empty($user)) return json(['code'=>401,'msg'=> trans("error.login")]);
                 $request->user = $user->toArray();
             }

+ 47 - 0
app/model/cutter/CutterApply.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace app\model\cutter;
+
+use app\extra\basic\Model;
+use think\model\relation\HasOne;
+
+
+/**
+ * 剪辑师
+ */
+class CutterApply extends Model
+{
+    /**
+     * The connection name for the model.
+     *
+     * @var string|null
+     */
+    protected $connection = 'mysql';
+    
+    /**
+     * The table associated with the model.
+     *
+     * @var string
+     */
+    protected string $table = "cutter_apply";
+    
+    /**
+     * The primary key associated with the table.
+     *
+     * @var string
+     */
+    protected string $primaryKey = "id";
+    
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public bool $timestamps = false;
+
+//    public function account(): HasOne
+//    {
+//        return $this->hasOne("app\model\saas\SaasShop","shop_id","agent_id");
+//    }
+
+}

+ 53 - 0
app/model/cutter/CutterOrder.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace app\model\cutter;
+
+use app\extra\basic\Model;
+use app\model\user\User;
+use think\model\relation\HasOne;
+
+
+/**
+ * 任务
+ */
+class CutterOrder extends Model
+{
+    /**
+     * The connection name for the model.
+     *
+     * @var string|null
+     */
+    protected $connection = 'mysql';
+    
+    /**
+     * The table associated with the model.
+     *
+     * @var string
+     */
+    protected string $table = "cutter_order";
+    
+    /**
+     * The primary key associated with the table.
+     *
+     * @var string
+     */
+    protected string $primaryKey = "id";
+    
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public bool $timestamps = false;
+
+    public function Task(): HasOne
+    {
+        return $this->hasOne(CutterTask::class,"id","task_id");
+    }
+
+    public function user(): HasOne
+    {
+        return $this->hasOne(User::class,"uid","uid");
+    }
+
+}

+ 46 - 0
app/model/cutter/CutterTask.php

@@ -0,0 +1,46 @@
+<?php
+
+namespace app\model\cutter;
+
+use app\extra\basic\Model;
+
+
+/**
+ * 任务
+ */
+class CutterTask extends Model
+{
+    /**
+     * The connection name for the model.
+     *
+     * @var string|null
+     */
+    protected $connection = 'mysql';
+    
+    /**
+     * The table associated with the model.
+     *
+     * @var string
+     */
+    protected string $table = "cutter_task";
+    
+    /**
+     * The primary key associated with the table.
+     *
+     * @var string
+     */
+    protected string $primaryKey = "id";
+    
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public bool $timestamps = false;
+
+//    public function account(): HasOne
+//    {
+//        return $this->hasOne("app\model\saas\SaasShop","shop_id","agent_id");
+//    }
+
+}

+ 48 - 0
app/model/kefu/Kefu.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace app\model\kefu;
+
+use app\extra\basic\Model;
+use app\model\cutter\CutterApply;
+use think\model\relation\HasOne;
+
+
+/**
+ * 客服表
+ */
+class Kefu extends Model
+{
+    /**
+     * The connection name for the model.
+     *
+     * @var string|null
+     */
+    protected $connection = 'mysql';
+    
+    /**
+     * The table associated with the model.
+     *
+     * @var string
+     */
+    protected string $table = "kefu";
+    
+    /**
+     * The primary key associated with the table.
+     *
+     * @var string
+     */
+    protected string $primaryKey = "id";
+    
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public bool $timestamps = false;
+
+    public function cutterApply(): HasOne
+    {
+        return $this->hasOne(CutterApply::class,"uid","uid");
+    }
+
+}

+ 48 - 0
app/model/user/User.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace app\model\user;
+
+use app\extra\basic\Model;
+use app\model\cutter\CutterApply;
+use think\model\relation\HasOne;
+
+
+/**
+ * 用户
+ */
+class User extends Model
+{
+    /**
+     * The connection name for the model.
+     *
+     * @var string|null
+     */
+    protected $connection = 'mysql';
+    
+    /**
+     * The table associated with the model.
+     *
+     * @var string
+     */
+    protected string $table = "user";
+    
+    /**
+     * The primary key associated with the table.
+     *
+     * @var string
+     */
+    protected string $primaryKey = "uid";
+    
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public bool $timestamps = false;
+
+    public function cutterApply(): HasOne
+    {
+        return $this->hasOne(CutterApply::class,"uid","uid");
+    }
+
+}

+ 48 - 0
app/model/user/UserBrokerage.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace app\model\user;
+
+use app\extra\basic\Model;
+use app\model\cutter\CutterApply;
+use think\model\relation\HasOne;
+
+
+/**
+ * 用户
+ */
+class UserBrokerage extends Model
+{
+    /**
+     * The connection name for the model.
+     *
+     * @var string|null
+     */
+    protected $connection = 'mysql';
+    
+    /**
+     * The table associated with the model.
+     *
+     * @var string
+     */
+    protected string $table = "user_brokerage";
+    
+    /**
+     * The primary key associated with the table.
+     *
+     * @var string
+     */
+    protected string $primaryKey = "id";
+    
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public bool $timestamps = false;
+
+    public function cutterApply(): HasOne
+    {
+        return $this->hasOne(CutterApply::class,"uid","uid");
+    }
+
+}

+ 48 - 0
app/model/user/UserExtract.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace app\model\user;
+
+use app\extra\basic\Model;
+use app\model\cutter\CutterApply;
+use think\model\relation\HasOne;
+
+
+/**
+ * 用户
+ */
+class UserExtract extends Model
+{
+    /**
+     * The connection name for the model.
+     *
+     * @var string|null
+     */
+    protected $connection = 'mysql';
+    
+    /**
+     * The table associated with the model.
+     *
+     * @var string
+     */
+    protected string $table = "user_extract";
+    
+    /**
+     * The primary key associated with the table.
+     *
+     * @var string
+     */
+    protected string $primaryKey = "id";
+    
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public bool $timestamps = false;
+
+    public function cutterApply(): HasOne
+    {
+        return $this->hasOne(CutterApply::class,"uid","uid");
+    }
+
+}

+ 38 - 0
app/validate/adminapi/cutter/CutterTaskValidate.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace app\validate\adminapi\cutter;
+
+use think\Validate;
+
+class CutterTaskValidate extends Validate
+{
+
+    protected $rule = [
+        "title"      => "require",
+        "explain"    => "require",
+        "material"    => "array",
+        "pirce"     => "require",
+        "end_time"    => "require",
+        "service_id"    => "require",
+        "status"     => "number|egt:0",  // 可选,传值时必须 >=0 的数字
+        "id"         => "number|egt:0",  // 可选,传值时必须 >=0 的数字
+    ];
+
+
+    protected $message = [
+        "title.require"          => "请输入任务标题",
+        "explain.require"        => "请输入任务说明",
+        "pirce.require"         => "请输入预算价格",
+        "end_time.require"        => "请输入截稿日期",
+        "service_id.require"        => "请设置关联客服",
+        "status.number"          => "状态必须是数字",
+        "status.egt"             => "状态值必须大于等于0",
+        "id.number"              => "ID必须是数字",
+        "id.egt"                 => "ID必须大于等于0",
+    ];
+
+    protected $scene = [
+
+    ];
+
+}

+ 30 - 0
app/validate/adminapi/finance/UserExtractValidate.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace app\validate\adminapi\finance;
+
+use think\Validate;
+
+class UserExtractValidate extends Validate
+{
+
+    protected $rule = [
+        "name"      => "require",
+        "wechat"    => "require",
+        "phone"     => "require|mobile",
+        "qrcode"    => "require",
+    ];
+
+
+    protected $message = [
+        "name.require"          => "请输入真实姓名",
+        "qrcode.require"        => "请上传二维码",
+        "phone.require"         => "请输入手机号",
+        "phone.mobile"          =>  "手机号格式错误",
+        "wechat.require"        => "请输入微信号",
+    ];
+
+    protected $scene = [
+
+    ];
+
+}

+ 30 - 0
app/validate/adminapi/kefu/KefuValidate.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace app\validate\adminapi\kefu;
+
+use think\Validate;
+
+class KefuValidate extends Validate
+{
+
+    protected $rule = [
+        "name"      => "require",
+        "wechat"    => "require",
+        "phone"     => "require|mobile",
+        "qrcode"    => "require",
+    ];
+
+
+    protected $message = [
+        "name.require"          => "请输入真实姓名",
+        "qrcode.require"        => "请上传二维码",
+        "phone.require"         => "请输入手机号",
+        "phone.mobile"          =>  "手机号格式错误",
+        "wechat.require"        => "请输入微信号",
+    ];
+
+    protected $scene = [
+
+    ];
+
+}

+ 32 - 0
app/validate/api/user/CutterApplyValidate.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace app\validate\api\user;
+
+use think\Validate;
+
+class CutterApplyValidate extends Validate
+{
+
+    protected $rule = [
+        "real_name"      => "require",
+        "card"           => "require",
+        "phone"          => "require|mobile",
+        "wxchat"         => "require",
+        "works"          => "require",
+    ];
+
+
+    protected $message = [
+        "real_name.require"      => "请输入真实姓名",
+        "card.require"           => "请输入身份证号",
+        "phone.require"          => "请输入手机号",
+        "phone.mobile"          =>  "手机号格式错误",
+        "wxchat.require"         => "请输入微信号",
+        "works.require"          => "请上传作品",
+    ];
+
+    protected $scene = [
+
+    ];
+
+}

+ 23 - 0
app/validate/api/user/UserExtractValidate.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace app\validate\api\user;
+
+use think\Validate;
+
+class UserExtractValidate extends Validate
+{
+
+    protected $rule = [
+        "fail_msg"      => "require",
+    ];
+
+
+    protected $message = [
+        "fail_msg.require"      => "拒绝理由不能为空",
+    ];
+
+    protected $scene = [
+
+    ];
+
+}

+ 26 - 0
app/validate/api/user/UserValidate.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace app\validate\api\user;
+
+use think\Validate;
+
+class UserValidate extends Validate
+{
+
+    protected $rule = [
+        "avatar"      => "url",
+        "nickname"          => "string",
+    ];
+
+
+    protected $message = [
+        "real_name.require"      => "请输入真实姓名",
+        "price.require"          => "请输入提现金额",
+        "price.number"          =>  "金额格式错误",
+    ];
+
+    protected $scene = [
+
+    ];
+
+}

+ 3 - 1
composer.json

@@ -55,7 +55,8 @@
     "hzdad/codecheck": "^1.0",
     "php-di/php-di": "7.0",
     "zoujingli/wechat-developer": "^1.2",
-    "webman/push": "^1.1"
+    "webman/push": "^1.1",
+    "w7corp/easywechat": "^6.19"
   },
   "suggest": {
     "ext-event": "For better performance. "
@@ -81,4 +82,5 @@
   },
   "minimum-stability": "dev",
   "prefer-stable": true
+	
 }

+ 7 - 0
config/plugin/shopwwi/auth/app.php

@@ -15,7 +15,14 @@
              'field' => ['id','openid'], //设置允许写入扩展中的字段
              'num' => 0, //-1为不限制终端数量 0为只支持一个终端在线 大于0为同一账号同终端支持数量 建议设置为1 则同一账号同终端在线1个
              'model'=> [\app\model\saas\SaasUserOpen::class,'thinkphp'] // 当为数组时 [app\model\Test::class,'thinkphp'] 来说明模型归属
+         ],
+         'user' => [
+             'key' => 'uid',
+             'field' => ['uid','openid'], //设置允许写入扩展中的字段
+             'num' => 0, //-1为不限制终端数量 0为只支持一个终端在线 大于0为同一账号同终端支持数量 建议设置为1 则同一账号同终端在线1个
+             'model'=> [\app\model\user\User::class,'thinkphp'] // 当为数组时 [app\model\Test::class,'thinkphp'] 来说明模型归属
          ]
+
      ],
      'jwt' => [
          'redis' => false,

+ 1 - 1
config/session.php

@@ -18,7 +18,7 @@ use Webman\Session\RedisClusterSessionHandler;
 
 return [
 
-    'type' => 'file', // or redis or redis_cluster
+    'type' => 'redis', // or redis or redis_cluster
 
     'handler' => FileSessionHandler::class,