zory 2 ay önce
ebeveyn
işleme
1daf0ae9cf

+ 0 - 129
app/controller/admin/Combo.php

@@ -1,129 +0,0 @@
-<?php
-
-namespace app\controller\admin;
-
-use app\extra\basic\Base;
-use app\extra\service\saas\ComboService;
-use app\extra\tools\CodeExtend;
-use app\middleware\AuthMiddleware;
-use app\model\saas\SaasCombo;
-use app\model\system\SystemUser;
-use app\validate\saas\ComboValidate;
-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/combo"),Middleware(AuthMiddleware::class)]
-class Combo extends Base
-{
-
-    #[Inject]
-    protected ComboValidate $validate;
-
-    #[Inject]
-    protected SaasCombo $model;
-
-    #[Inject]
-    protected ComboService $service;
-
-
-    #[Route(path: "list",methods: "get")]
-    public function getStoreList(Request $request): Response
-    {
-        try {
-            $param = $request->get();
-            $param['type'] = 1;
-            $list = $this->service->getList($param);
-            return successTrans("success.data",pageFormat($list),200);
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-    /**
-     * 新增/编辑代理
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "save",methods: "post")]
-    public function save(Request $request): Response
-    {
-        try {
-            $param = $request->post();
-            if (!empty($param['money'])) $param['money'] = $param['money'] * 100;
-            if (!empty($param['old_money'])) $param['old_money'] = $param['old_money'] * 100;
-            if (!$this->validate->check($param)) return error($this->validate->getError());
-            $state = $this->model->setAutoData($param);
-            if (!$state) return errorTrans("error.data");
-            return successTrans("success.data");
-        } 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: "batch",methods: "post")]
-    public function setBatchData(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "id.require"        => trans("empty.require"),
-                "value.require"     => trans("empty.require"),
-                "field.require"     => trans("empty.require"),
-                "type.require"      => trans("empty.require"),
-            ],"post");
-            if (!is_array($param)) return error($param);
-            if ($param['type'] == "batch") {
-                $state = $this->model->where("id","in",$param['id'])->save([$param['field'] => $param['value']]);
-            } else {
-                $state = $this->model->where("id",$param['id'])->save([$param['field'] => $param['value']]);
-            }
-            if (!$state) return errorTrans("error.data");
-            return successTrans("success.data");
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-    /**
-     * 删除
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "del",methods: "post")]
-    public function delUser(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "id.require"    => trans("empty.require"),
-                "type.default"  => "one",
-            ],"post");
-            if (!is_array($param)) return error($param);
-            if ($param['type'] == "batch") {
-                $state = $this->model->where("id","in",$param['id'])->delete();
-            } else {
-                $data = $this->model->where("id",$param['id'])->findOrEmpty();
-                if ($data->isEmpty()) return errorTrans("empty.data");
-                // 删除其他相关数据
-                $state = $data->delete();
-            }
-            if (!$state) return errorTrans("error.data");
-            return successTrans("success.data");
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-}

+ 141 - 0
app/controller/admin/Dic.php

@@ -0,0 +1,141 @@
+<?php
+
+namespace app\controller\admin;
+
+use app\extra\basic\Base;
+use app\extra\service\system\DicService;
+use app\middleware\AuthMiddleware;
+use app\model\system\SystemData;
+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: "/api/dic"),Middleware(AuthMiddleware::class)]
+class Dic extends Base
+{
+
+
+    #[Inject]
+    protected DicService $service;
+
+    #[Inject]
+    protected SystemData $model;
+
+
+    /**
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "list",methods: "get")]
+    public function getDicList(Request $request): Response
+    {
+        try {
+            $param = $this->_valid([
+                "dicId.default"  => 0,
+            ]);
+            $data = $this->service->getMenuList($param);
+            return success("ok",$data);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    /**
+     * 更新
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "save",methods: "post")]
+    public function saveMenuData(Request $request): Response
+    {
+        try {
+            $param = $request->post();
+            $param['content'] = json_encode([]);
+            $state = $this->model->setAutoData($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: "sub",methods: "post")]
+    public function saveSubData(Request $request): Response
+    {
+        try {
+            $param = $this->_valid([
+                "id.require"    => trans("empty.require"),
+                "name.require"  => trans("empty.require"),
+                "code.require"  => trans("empty.require"),
+            ],'post');
+            if (!is_array($param)) return error($param);
+            $data = $this->model->where("id",$param['id'])->findOrEmpty();
+            if ($data->isEmpty()) return errorTrans("empty.data");
+            $content = !empty($data['content']) ? $data['content'] : [];
+            $dataId = $param['id'];
+            foreach ($content as $val) {
+                if ($val['code'] == $param['code']) {
+                    return error("数据字段重复");
+                }
+            }
+            unset($param['id']);
+            $content[] = $param;
+            $state = $this->model->setAutoData(['id' => $dataId,'content' => json_encode($content)]);
+            if(!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+
+    #[Route(path: "sub_del",methods: "post")]
+    public function subDataDel(Request $request): Response
+    {
+        try {
+            $param = $this->_valid([
+                "id.require"    => trans("empty.require"),
+                "key.require"   => trans("empty.require"),
+            ],'post');
+            if (!is_array($param)) return error($param);
+            $data = $this->model->where("id",$param['id'])->findOrEmpty();
+            if ($data->isEmpty()) return errorTrans("empty.data");
+            $content = !empty($data['content']) ? $data['content'] : [];
+            if (empty($content)) return errorTrans("empty.data");
+            unset($content[$param['key']]);
+            $state = $this->model->setAutoData(['id' => $param['id'],'content' => json_encode($content)]);
+            if(!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+    #[Route(path: "del",methods: "post")]
+    public function DataDel(Request $request): Response
+    {
+        try {
+            $param = $this->_valid([
+                "id.require"    => trans("empty.require"),
+            ],'post');
+            if (!is_array($param)) return error($param);
+            $data = $this->model->where("id",$param['id'])->findOrEmpty();
+            if ($data->isEmpty()) return errorTrans("empty.data");
+            $state = $this->model->where("id",$param['id'])->delete();
+            if(!$state) return errorTrans("error.data");
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 0 - 192
app/controller/admin/Shop.php

@@ -1,192 +0,0 @@
-<?php
-
-namespace app\controller\admin;
-
-use app\extra\basic\Base;
-use app\extra\service\saas\ShopService;
-use app\extra\tools\CodeExtend;
-use app\middleware\AuthMiddleware;
-use app\model\saas\SaasCombo;
-use app\model\saas\SaasShop;
-use app\model\saas\SaasStore;
-use app\model\saas\SaasStoreShop;
-use app\model\system\SystemUser;
-use app\validate\saas\ShopValidate;
-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/shop"),Middleware(AuthMiddleware::class)]
-class Shop extends Base
-{
-
-    #[Inject]
-    protected ShopValidate $validate;
-
-    #[Inject]
-    protected ShopService $service;
-
-    #[Inject]
-    protected SaasShop $model;
-
-    #[Route(path: "list",methods: "get")]
-    public function getStoreList(Request $request): Response
-    {
-        try {
-            $param = $request->get();
-            $list = $this->service->getList($param);
-            return successTrans("success.data",pageFormat($list),200);
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-    /**
-     * 新增/编辑代理
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "save",methods: "post")]
-    public function save(Request $request): Response
-    {
-        try {
-            $param = $request->post();
-            if (!isset($param['id'])) {
-                $param['shop_id'] = CodeExtend::random(16,1,date("md"));
-                if (!empty($param['username'])) {
-                    $userName = (new SystemUser)->where("username",$param['username'])->findOrEmpty();
-                    if (!$userName->isEmpty()) return errorTrans("error.user-exist");
-                }
-            }
-            if (!$this->validate->check($param)) return error($this->validate->getError());
-            $state = $this->model->setAutoData($param);
-            if (!$state) return errorTrans("error.data");
-            $param['truename'] = $param['shop_name'];
-//            $this->sceneUser($param,2,"id");
-            return successTrans("success.data");
-        } 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: "combo",methods: "post")]
-    public function comboData(Request $request): Response
-    {
-        try {
-            $param = $request->post();
-            if (empty($param['combo'])) return errorTrans("empty.require");
-            if (empty($param['shop_id'])) return errorTrans("empty.require");
-            $combo = (new SaasCombo)->where("id",$param['combo'])->findOrEmpty();
-            if ($combo->isEmpty()) return errorTrans("empty.data");
-            $shop = (new SaasShop)->where("shop_id",$param['shop_id'])->findOrEmpty();
-            if ($shop->isEmpty()) return errorTrans("empty.data");
-            if ($combo['unit'] == 1) { // 天
-                $shop->vip_end = date('Y-m-d H:i:s',strtotime("+{$combo['time']} day"));
-            } else {
-                $shop->vip_end = date('Y-m-d H:i:s',strtotime("+{$combo['time']} year"));
-            }
-            $state = $shop->save();
-            if (!$state) return errorTrans("error.data");
-            return successTrans("success.data");
-        } 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: "edit",methods: "post")]
-    public function edit(Request $request): Response
-    {
-        try {
-            $param = $request->post();
-            if (!$this->validate->check($request->post())) return error($this->validate->getError());
-            $state = $this->model->setAutoData($param);
-            if (!$state) return errorTrans("error.data");
-            return successTrans("success.data");
-        } 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: "batch",methods: "post")]
-    public function setBatchData(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "id.require"        => trans("empty.require"),
-                "value.require"     => trans("empty.require"),
-                "field.require"     => trans("empty.require"),
-                "type.require"      => trans("empty.require"),
-            ],"post");
-            if (!is_array($param)) return error($param);
-            if ($param['type'] == "batch") {
-                $state = $this->model->where("id","in",$param['id'])->save([$param['field'] => $param['value']]);
-            } else {
-                $state = $this->model->where("id",$param['id'])->save([$param['field'] => $param['value']]);
-            }
-            if (!$state) return errorTrans("error.data");
-            return successTrans("success.data");
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-    /**
-     * 删除
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "del",methods: "post")]
-    public function delUser(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "id.require"    => trans("empty.require"),
-                "type.default"  => "one",
-            ],"post");
-            if (!is_array($param)) return error($param);
-            if ($param['type'] == "batch") {
-                $state = $this->model->where("id","in",$param['id'])->delete();
-            } else {
-                $data = $this->model->where("id",$param['id'])->findOrEmpty();
-                if ($data->isEmpty()) return errorTrans("empty.data");
-                // 删除其他相关数据
-                $state = $data->delete();
-            }
-            if (!$state) return errorTrans("error.data");
-            return successTrans("success.data");
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-}

+ 58 - 0
app/controller/api/Auth.php

@@ -0,0 +1,58 @@
+<?php
+
+namespace app\controller\api;
+
+use app\extra\basic\Base;
+use app\extra\weMini\Crypt;
+use app\middleware\WxMiddleware;
+use app\model\blue\BlueUserOpen;
+use DI\Attribute\Inject;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Middleware;
+use LinFly\Annotation\Route\Route;
+use Shopwwi\WebmanAuth\Facade\Auth as AuthMode;
+use support\Request;
+use support\Response;
+
+#[Controller(prefix: "/wx_api/auth"),Middleware(WxMiddleware::class)]
+class Auth extends Base
+{
+
+    protected array $noNeedLogin = ["loginCodeData"];
+
+    #[Inject]
+    protected BlueUserOpen $model;
+
+
+    /**
+     * 微信code登录
+     * @param Request $request
+     * @return Response
+     */
+    #[Route(path: "loginCode",methods: "post")]
+    public function loginCodeData(Request $request): Response
+    {
+        try {
+            $param = $this->_valid([
+                "code.require"  => trans("empty.require")
+            ],$request->method());
+            if (!is_array($param)) return error($param);
+            $userinfo = (new Crypt([
+                "appid"     => sConf("wechat.mini_appid"),
+                "appsecret" => sConf("wechat.mini_secret")
+            ]))->session($param['code']);
+            if (!isset($userinfo['openid'])) return error("获取数据失败");
+            $map = ['openid' => $userinfo['openid']];
+            $userOpen = $this->model->where($map)->findOrEmpty();
+            if ($userOpen->isEmpty()) {
+                $userOpen->insertGetId(['openid' => $userinfo['openid'],"create_ip" => $request->getRealIp(),"nickname" => "wx_微信用户","headimg" => "https://blue-data.oss-cn-guangzhou.aliyuncs.com/logo.png"]);
+                $userOpen = $this->model->where($map)->findOrEmpty();
+            }
+            $userAuth = get_object_vars(AuthMode::guard("member")->login($userOpen->toArray()));
+            return success("ok",['token' => $userAuth]);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 0 - 215
app/controller/api/Card.php

@@ -1,215 +0,0 @@
-<?php
-
-namespace app\controller\api;
-
-use app\extra\basic\Base;
-use app\extra\jhfPay\Pay;
-use app\extra\tools\CodeExtend;
-use app\middleware\WxMiddleware;
-use app\model\saas\SaasCombo;
-use app\model\saas\SaasUser;
-use app\model\saas\SaasUserBuy;
-use app\model\saas\SaasUserLog;
-use LinFly\Annotation\Route\Controller;
-use LinFly\Annotation\Route\Middleware;
-use LinFly\Annotation\Route\Route;
-use support\Request;
-use support\Response;
-
-
-#[Controller(prefix: "/wx_api/card"),Middleware(WxMiddleware::class)]
-class Card extends Base
-{
-
-    #[Route(path: "data",methods: "get")]
-    public function getCardData(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "shop.require"  => "参数错误"
-            ]);
-            if (!is_array($param)) return error($param);
-            $memberCard = (new SaasUser)->where("shop_id",$param['shop'])->where("openid",$request->user['openid'])->with(["shop" => function($query){
-                $query->field("shop_id,shop_name,user_card_price,user_card");
-            }])->findOrEmpty();
-            if ($memberCard->isEmpty()) return success("",[],2);
-            $memberCard['balance'] = format_money($memberCard['balance']/100,2);
-            $memberCard['end_at'] = date("Y-m-d",strtotime($memberCard['create_at']));
-            $isRecharge = (new SaasUserBuy)->where("shop_id",$param['shop'])->where("openid",$request->user['openid'])->where("status",1)->sum("money");
-            $cardPrice = [];
-            if ($memberCard['shop']['user_card'] < 3) {
-                if ($memberCard['shop']['user_card'] == 2) { // 自定义套餐
-                    $cardPrice = array_values($memberCard['shop']['user_card_price']);
-                } else {
-                    $cardPrice = (new SaasCombo)->where("type",2)->select();
-                }
-                $cardPrice = array_filter($cardPrice, function($item) use ($isRecharge) {
-                    if ($isRecharge > 0) {
-                        return $item['is_first'] != '1'; // 注意:这里使用松散比较,因为数据中有字符串'1'
-                    } else {
-                        return $item;
-                    }
-                });
-                foreach ($cardPrice as $key=>$val) {
-                    $cardPrice[$key] = $val;
-                    $cardPrice[$key]['money'] = $val['money'];
-                    $cardPrice[$key]['old_money'] = $val['old_money'];
-                }
-                $cardPrice = array_values($cardPrice);
-            }
-            $memberCard['card'] = array_values($cardPrice);
-            return success("ok",$memberCard->toArray());
-        } catch (\Throwable $throwable) {
-            echo getDateFull()."==会员卡报错\n";
-            echo $throwable->getLine()."\n";
-            echo $throwable->getFile()."\n";
-            return error($throwable->getMessage());
-        }
-    }
-
-
-    /**
-     * 会员卡消费明细
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "log",methods: "get")]
-    public function getOrderList(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "page.require"  => "参数错误",
-                "size.require"  => "参数错误",
-                "shop.require"  => "参数错误",
-                "card.require"  => "参数错误"
-            ]);
-            if (!is_array($param)) return error($param);
-            $map = ["openid" => $request->user['openid'],"shop_id" => $param['shop']];
-            $resp = (new SaasUserLog)->where($map)->order("create_at desc")->paginate([
-                "list_rows" => $param['size'],
-                "page"      => $param['page']
-            ]);
-            return success("ok",$resp->toArray());
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-    /**
-     * 下单
-     * @param Request $request
-     * @return Response|void|null
-     */
-    #[Route(path: "create",methods: "post")]
-    public function createOrder(Request $request)
-    {
-        try {
-            $param = $this->_valid([
-                "card.require"  => "参数错误",
-                "shop.require"  => "参数错误"
-            ],"post");
-            if (!is_array($param)) return error($param);
-            $map = ["openid" => $request->user['openid'],"shop_id" => $param['shop']];
-            $card = (new SaasUser)->where($map)->with(['shop' => function($query){
-                $query->field("shop_id,shop_name");
-            }])->findOrEmpty();
-            if ($card->isEmpty()) return error("尚未开通会员卡");
-            return error("充值通道暂时关闭");
-            $orderSn = strtoupper(CodeExtend::random(12,3));
-            $buyCard = json_decode($param['card'],true);
-            $state = (new SaasUserBuy)->insertGetId([
-                "openid"        => $request->user['openid'],
-                "order_sn"      => $orderSn,
-                "shop_id"       => $param['shop'],
-                "card_no"       => $card['card_no'],
-                "money"         => $buyCard['money'] * 100,
-                "total_money"   => $buyCard['money'] * 100 + $buyCard['old_money'] * 100,
-                "remark"        => "赠送金额".$buyCard['old_money']
-            ]);
-            if ($state) {
-                $param_data = [];
-                $param_data["order_no"] = $orderSn;
-                $param_data["app_id"] = sConf("wechat.jhf_appid");
-                $param_data["pay_channel"] = "wx_lite";
-                $param_data["pay_amt"] = format_money($buyCard['money'],2);
-                $param_data["goods_title"] = $card['shop']['shop_name']."-会员卡充值";
-                $param_data["device_info"] = array("device_ip" => $request->getRealIp());
-                $param_data['notify_url'] = "https://panel.huiyinduo.cn/notify/recharge";
-                $param_data["expend"] = [
-                    "wx_app_id" => sConf("wechat.mini_appid"),
-                    "open_id" => $request->user['openid']
-                ];
-                $respJhf = (new Pay)->config([
-                    "appid"  => sConf("wechat.jhf_appid"),
-                    "mch_id" => sConf("wechat.jhf_mch_id"),
-                    "aeskey" => sConf("wechat.jhf_aeskey"),
-                    "pubkey" => sConf("wechat.jhf_pubkey"),
-                    "prikey" => sConf("wechat.jhf_prikey"),
-                ])->createPay($param_data);
-                if (isset($respJhf['code'])) {
-                    return error("发起支付失败");
-                }
-                // 创建JSAPI参数签名
-                $resp = json_decode($respJhf['expend']['pay_info'],true);
-                $resp['timestamp'] = $resp['timeStamp'];
-//                $wechat = new \WeChat\Pay($this->getWxConfig());
-//                $options = [
-//                    'body'             => $card['shop']['shop_name']."-会员卡充值",
-//                    'out_trade_no'     => $orderSn."-".CodeExtend::random(8),
-//                    "attach"            => $orderSn,
-//                    'total_fee'        => $buyCard['money'] * 100,
-//                    'openid'           => $request->user['openid'],
-//                    'trade_type'       => 'JSAPI',
-//                    'notify_url'       => 'https://panel.huiyinduo.cn/notify/recharge',
-//                    'spbill_create_ip' => $request->getRealIp(),
-//                ];
-//                // 生成预支付码
-//                $result = $wechat->createOrder($options);
-//                // 创建JSAPI参数签名
-//                $resp = $wechat->createParamsForJsApi($result['prepay_id']);
-                return success("ok",$resp);
-            }
-            return error("发起充值失败");
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-    #[Route(path: "del",methods: "post")]
-    public function delCard(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "shop.require"  => "参数错误"
-            ],"post");
-            if (!is_array($param)) return error($param);
-            $map = ["openid" => $request->user['openid'],"shop_id" => $param['shop']];
-            $card = (new SaasUser)->where($map)->findOrEmpty();
-            if ($card->isEmpty()) return error("会员卡不存在");
-            $state = $card->delete();
-            if ($state) return success("注销成功");
-            return error("注销失败");
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-    /**
-     * 小程序配置
-     * @return array
-     */
-    protected function getWxConfig(): array
-    {
-        return [
-            'token'          => 'test',
-            'appid'          => sConf("wechat.mini_appid"),
-            'appsecret'      => sConf("wechat.mini_secret"),
-            'encodingaeskey' => 'BJIUzE0gqlWy0GxfPp4J1oPTBmOrNDIGPNav1YFH5Z5',
-            // 配置商户支付参数(可选,在使用支付功能时需要)
-            'mch_id'         => sConf("wechat.mch_id"),
-            'mch_key'        => sConf("wechat.mch_key")
-        ];
-    }
-
-}

+ 0 - 505
app/controller/api/Cart.php

@@ -1,505 +0,0 @@
-<?php
-
-namespace app\controller\api;
-
-use app\extra\basic\Base;
-use app\extra\tools\CodeExtend;
-use app\middleware\WxMiddleware;
-use app\model\saas\SaasCart;
-use app\model\saas\SaasCombo;
-use app\model\saas\SaasDiscount;
-use app\model\saas\SaasPrice;
-use app\model\saas\SaasPrintClient;
-use app\model\saas\SaasShop;
-use app\model\saas\SaasUser;
-use app\model\saas\SaasUserBuy;
-use app\model\saas\SaasWordChange;
-use LinFly\Annotation\Route\Controller;
-use LinFly\Annotation\Route\Middleware;
-use LinFly\Annotation\Route\Route;
-use Qcloud\Cos\Client;
-use support\Request;
-use support\Response;
-use Webman\RedisQueue\Redis;
-use yzh52521\EasyHttp\Http;
-
-
-#[Controller(prefix: "/wx_api/cart"),Middleware(WxMiddleware::class)]
-class Cart extends Base
-{
-    protected array $noNeedLogin = [];
-    /**
-     * 颜色
-     * @var array|string[]
-     */
-    protected array $color = ["1" => "彩色", "2" => "黑白"];
-    /**
-     * 单双面
-     * @var array|string[]
-     */
-    protected array $duplex = ["1" => "单面", "2" => "双面"];
-    /**
-     * 打印方向
-     * @var array|string[]
-     */
-    protected array $direction = ["1" => "长边翻转","2" => "短边翻转"];
-//    protected array $direction = ["1" => "自适应","2" => "横向", "3" => "竖向"];
-    /**
-     * 配送方式
-     * @var array|string[]
-     */
-    protected array $package = ["1" => "店内打印", "2" => '远程自取' , "3" => "商家配送"];
-
-    protected array $types = [
-        '1_1_1' => ['name' => '彩色-单面', 'amount' => 0, 'quantity' => 0,'discount' => 0],
-        '1_1_2' => ['name' => '彩色-单面', 'amount' => 0, 'quantity' => 0,'discount' => 0],
-        '1_2_1' => ['name' => '彩色-双面', 'amount' => 0, 'quantity' => 0,'discount' => 0],
-        '2_1_1' => ['name' => '黑白-单面', 'amount' => 0, 'quantity' => 0,'discount' => 0],
-        '2_2_1' => ['name' => '黑白-双面', 'amount' => 0, 'quantity' => 0,'discount' => 0],
-        '2_1_2' => ['name' => '黑白-双面', 'amount' => 0, 'quantity' => 0,'discount' => 0],
-    ];
-
-    /**
-     * 获取打印购物车列表
-     * @return Response
-     */
-    #[Route(path: "list",methods: "get")]
-    public function getCartList(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "shop.require"  => trans("empty.require"),
-                "print.require" => trans("empty.require"),
-                "type.default"  => 1
-            ]);
-            if (!is_array($param)) return error($param);
-            $cart = (new SaasCart)->where("shop_id",$param['shop'])->where("print_id",$param['print'])->where("openid",$request->user['openid'])->order("create_at desc")->select();
-            if ($cart->isEmpty()) return success('ok',['cart' => []]);
-            $totalAmount = $totalDiscount = 0;
-            foreach ($cart as $k=>$v){
-                $key = $v['color'] . '_' . $v['duplex'] . '_' . $v['source'];
-                if (isset($this->types[$key])) {
-                    $this->types[$key]['quantity'] += $v['page'];
-                    $this->types[$key]['amount'] += $v['money'];
-                }
-                $cart[$k] = $v;
-                $cart[$k]['money'] = format_money($v['money'] / 100,2);
-                $cart[$k]['name'] = msubstr($v['name'],0,12);
-                $cart[$k]['jobStatus'] = 'success';
-            }
-            $printData = (new SaasPrintClient)->where("shop_id",$param['shop'])->where("code",$param['print'])->select();
-            if ($printData->isEmpty()) return error('无可用打印机');
-            $rule = [];
-            foreach ($printData as $key=>$value) {
-                $rule[$key]['check'] = 0;
-                $nameColor = "";
-                if (empty($value['rule'])) return error("尚未配置打印机~");
-                foreach ($value['rule']['color'] as $key2=>$val) {
-                    $rule[$key]['color'][$key2][$val] = $this->color[$val];
-                    $nameColor .= $this->color[$val];
-                }
-                foreach ($value['rule']['direction'] as $key2=>$val) {
-                    $rule[$key]['direction'][$key2][$val] = $this->direction[$val];
-                }
-                foreach ($value['rule']['duplex'] as $key2=>$val) {
-                    $rule[$key]['duplex'][$key2][$val] = $this->duplex[$val];
-                }
-                foreach ($value['rule']['package'] as $key2=>$val) {
-                    $rule[$key]['package'][$key2][$val] = $this->package[$val];
-                }
-                foreach ($value['rule']['paper_size'] as $key2=>$val) {
-                    $rule[$key]['paper_size'][$key2][$val] = $val;
-                }
-                if ($param['print'] == $value['code']) {
-                    $rule[$key]['check'] = 1;
-                }
-                $rule[$key]['name'] = $nameColor."-".$value['name'];
-                $rule[$key]['code'] = $value['code'];
-            }
-            // 计算折扣
-            foreach ($this->types as $k=>$v) {
-                $discount = (new SaasDiscount)->where("shop_id",$param['shop'])->where("keys",$k)->where("number",'<',$v['quantity'])->findOrEmpty();
-                if (!$discount->isEmpty()) {
-                    $v['discount'] = round($v['amount'] * $discount['rate']);
-                    $this->types[$k]['discount'] = $v['discount'];
-                }
-                $totalAmount += $v['amount'];
-                $totalDiscount += $v['discount'];
-            }
-            $totalAmount = format_money($totalAmount / 100,2);
-            $totalDiscount = format_money($totalDiscount / 100,2);
-            if ($param['type'] <> 1) {
-                $shop = (new SaasShop)->where("shop_id",$param['shop'])->field("shop_name,shop_address,user_card,user_card_price")->find();
-                $isRecharge = (new SaasUserBuy)->where("shop_id",$param['shop'])->where("openid",$request->user['openid'])->where("status",1)->sum("money");;
-                $cardPrice = [];
-                if ($shop['user_card'] < 3) {
-                    if ($shop['user_card'] == 2) { // 自定义套餐
-                        $cardPrice = array_values($shop['user_card_price']);
-                    } else {
-                        $cardPrice = (new SaasCombo)->where("type",2)->field("id,name,ROUND(money/100,2) as money,ROUND(old_money/100,2) as old_money,is_first")->where("status",1)->select()->toArray();
-                    }
-                    $cardPrice = array_filter($cardPrice, function($item) use ($isRecharge) {
-                        if ($isRecharge > 0) {
-                            return $item['is_first'] != '1'; // 注意:这里使用松散比较,因为数据中有字符串'1'
-                        } else {
-                            return $item;
-                        }
-                    });
-                    foreach ($cardPrice as $key=>$val) {
-                        $cardPrice[$key] = $val;
-                        $cardPrice[$key]['money'] = $val['money'];
-                        $cardPrice[$key]['old_money'] = $val['old_money'];
-                    }
-                    $cardPrice = array_values($cardPrice);
-                }
-                $card = (new SaasUser)->where("openid",$request->user['openid'])->where("shop_id",$param['shop'])->field("ROUND(balance/100,2) as money")->findOrEmpty();
-                if ($card->isEmpty()) {
-                    $card = null;
-                }
-                $package = $this->package;
-                return success("",compact('rule','totalAmount','totalDiscount','shop','cardPrice','package','card'));
-            }
-            return success("",compact('cart','rule','totalAmount','totalDiscount'));
-        } catch (\Throwable $th) {
-            return error($th->getMessage());
-        }
-    }
-
-    /**
-     * 删除购物
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "del",methods: "post")]
-    public function delCart(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "shop.require"  => trans("empty.require"),
-                "id.require"    => trans("empty.require"),
-                "print.require" => trans("empty.require"),
-            ],"post");
-            if (!is_array($param)) return error($param);
-            $cart = (new SaasCart)->where("id",$param['id'])->findOrEmpty();
-            if ($cart->isEmpty()) return error("操作失败");
-            if ($cart['openid'] <> $request->user['openid']) return error("操作失败");
-            $state = $cart->delete();
-            if (!$state) return error("操作失败");
-            return success("操作成功");
-        } catch (\Throwable $exception) {
-            return error($exception->getMessage());
-        }
-    }
-
-    /**
-     * 更新购物
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "update",methods: "post")]
-    public function updateCart(Request $request): Response
-    {
-        try {
-            $param = $request->post();
-            $cart = (new SaasCart)->where("id",$param['id'])->where("openid",$request->user['openid'])->findOrEmpty();
-            if ($cart->isEmpty()) return error('数据格式错误');
-            if ($param['end_page'] > $cart['total_page']) return error('打印范围不能大于总页数');
-            // 查询默认打印机是否有额外收费规则
-            $printData = (new SaasPrintClient)->where("shop_id",$param['shop_id'])->where("code",$param['print'])->findOrEmpty();
-            $extraMoney = 0;
-            $moneyMode = (new SaasPrice)->where([
-                "shop_id"   => $param['shop_id'],
-                "paper_size" => $param['paper_size'],
-                "type"      => $param['source'],
-                "color"     => $param['color'],
-                "duplex"    => $param['duplex'],
-            ])->findOrEmpty();
-            if ($moneyMode->isEmpty()) return error("尚未设置收费规则");
-            if (!empty($printData['price']) && $printData['is_price'] == 1) {
-                $priceRule = isset($printData['price'][$moneyMode['id']]['price']) ? $printData['price'][$moneyMode['id']]['price'] : 0;
-                $extraMoney = $priceRule * 100;
-            }
-            if ($param['duplex'] == 2) {
-                $updateData['page'] = ceil(($param['end_page'] - $param['start_page'] + 1) / 2); // 双面
-            } else {
-                $updateData['page'] = $param['end_page'] - $param['start_page'] + 1;
-            }
-            $updateData['extra_money'] = $extraMoney;
-            $updateData['money'] = ($moneyMode['price']*100 + $extraMoney) * $updateData['page'] * $param['number'];
-            $updateData['single_money'] = $moneyMode['price']*100;
-            $updateData['single_id'] = $moneyMode['id'];
-            $updateData['paper_size'] = $param['paper_size'];
-            $updateData['number'] = $param['number'];
-            $updateData['duplex'] = $param['duplex'];
-            $updateData['direction'] = $param['direction']??1;
-            $updateData['color'] = $param['color'];
-            $updateData['start_page'] = $param['start_page'];
-            $updateData['end_page'] = $param['end_page'];
-            $state = $cart->save($updateData);
-            if (!$state) return error("数据操作失败");
-            return success("更新成功");
-        } catch (\Throwable $exception) {
-            return error($exception->getMessage());
-        }
-    }
-
-
-    /**
-     * 预览
-     * @return Response
-     */
-    #[Route(path: "preview",methods: "post")]
-    public function wordPreview(): Response
-    {
-        try {
-            return success("",[
-                "host"  => "https://".sConf("storage.cos_http_domain")."/",
-                "query" => "?ci-process=doc-preview&dstType=jpg&imageDpi=120&page="
-            ]);
-        } catch (\Throwable $th) {
-            return error($th->getMessage());
-        }
-    }
-
-
-    /**
-     * 图片打印
-     * @return Response
-     */
-    #[Route(path: "image",methods: "post")]
-    public function uploadMultiImage(): Response
-    {
-        try {
-            return success("");
-        } catch (\Throwable $th) {
-            return error($th->getMessage());
-        }
-    }
-
-    /**
-     * 文档打印
-     * @return Response
-     */
-    #[Route(path: "word",methods: "post")]
-    public function uploadWord(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "shop.require"      => trans("empty.require"),
-                "word.require"      => trans("empty.require"),
-                "print.require"     => trans("empty.require"),
-                "type.default"      => 1, // 1打印 2复印
-                "size.default"      => "", // 纸张类型
-            ],$request->method());
-            if (!is_array($param)) return error($param);
-            $wordData = json_decode($param["word"], true);
-            $printData = (new SaasPrintClient)->where(['shop_id' => $param['shop'],'code' => $param['print']])->findOrEmpty();
-            if ($printData->isEmpty()) return error('无可用打印机');
-            if ($printData['status'] <> 1) return error('当前打印机不可用');
-            $paperRule = is_string($printData['rule'])?json_decode($printData['rule'],true):$printData['rule'];
-            $paperSize = count($paperRule['paper_size'])==1?$paperRule['paper_size'][0]:'A4';
-            $colorSize = count($paperRule['color'])==1?$paperRule['color'][0]:2;
-
-            $paperSize = empty($param['size'])?$paperSize:$param['size'];
-            $moneyMode = (new SaasPrice)->where(['shop_id' => $param['shop'],'paper_size' => $paperSize,'color' => $colorSize,'type' => $param['type']])->findOrEmpty();
-            if ($moneyMode->isEmpty()) return error("店铺未设置收费规则");
-            $extraMoney = 0;
-            // 计算额外收费
-            if (!empty($printData['price']) && $printData['is_price'] == 1) {
-                $priceRule = isset($printData['price'][$moneyMode['id']]['price']) ? $printData['price'][$moneyMode['id']]['price'] : 0;
-                $extraMoney = $priceRule * 100 ;
-            }
-            $cartData = [];
-            foreach ($wordData as $key=>$val) {
-                if ($val['total'] <= 0) {
-                    return error("请检查上传文档是否有显示页数");
-                }
-                $cartData[$key] = [
-                    "money"         => ($val['total'] * $moneyMode['price'] * 100) + ($extraMoney * $val['total']),
-                    "extra_money"   => $extraMoney,
-                    "number"        => 1,
-                    "duplex"        => 1,
-                    "color"         => $colorSize,
-                    "page"          => $val['total'],
-                    "total_page"    => $val['total'],
-                    "end_page"      => $val['total'],
-                    "name"          => $val['name'],
-                    "openid"        => $request->user['openid'],
-                    "shop_id"       => $param['shop'],
-                    "paper_size"    => $paperSize,
-                    "extension"     => $val['ext'],
-                    "source"        => $param['type'],
-                    "icon"          => "https://inmei-print.oss-cn-guangzhou.aliyuncs.com/extension/{$val['ext']}.png", // 图标
-                    "single_money"  => $moneyMode['price'] * 100,
-                    "single_id"     => $moneyMode['id'],
-                    "path"          => $val['cosKey'],
-                    "print_id"      => $param['print'],
-                    "print_name"    => $printData['name'],
-                ];
-            }
-            if (empty($cartData)) return error('上传失败');
-            $state = (new SaasCart)->insertAll($cartData);
-            if (!$state) return error("解析文档失败,请重试");
-            return success("ok");
-        } catch (\Throwable $th) {
-            return error($th->getMessage());
-        }
-    }
-
-    /**
-     * 读取页码
-     * ?ci-process=doc-preview&page=1&dstType=jpg&imageDpi=120
-     * ?ci-process=doc-preview&page=2&sheet=1&excelPaperDirection=0
-     */
-    #[Route(path: "total",methods: ['post','get'])]
-    public function checkTotal(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "cosKey.require"  => trans("empty.require"),
-                "type.default"  => "",
-                "ext.default"  => ""
-            ],$request->method());
-            if (!is_array($param)) return error($param);
-            $suffix = pathinfo($param['cosKey'], PATHINFO_EXTENSION);
-            if (empty($suffix)) return error("empty.data.suffix");
-            return error("请重启小程序");
-            $cosClient = new Client([
-                'region' => sConf("storage.cos_region"),
-                'schema' => 'https', // 协议头部,默认为 http
-                'credentials' => array(
-                    'secretId' => sConf("storage.cos_access_key"),
-                    'secretKey' => sConf("storage.cos_secret_key"),
-                ),
-                "verify"    => false
-            ]);
-            $url = $cosClient->getObjectUrl(sConf("storage.cos_bucket"), $param['cosKey']);
-            $params = array(
-                'ci-process' => 'doc-preview',
-                'page' => 1,
-                'dstType' => 'jpg',
-                'imageDpi' => '120',
-            );
-            $query = http_build_query($params);
-            $path = $url.$query;
-            $resp = Http::get($path)->headers();
-            if (!isset($resp['X-Total-Page'])) return error("文档可能需要密码,请先删除后再确认");
-            $page = $resp['X-Total-Page']?$resp['X-Total-Page'][0]:1;
-            $path = $param['cosKey'];
-            return success("ok",compact('page','path'));
-        } catch (\Throwable $th) {
-            return error($th->getMessage());
-        }
-    }
-
-
-    #[Route(path: "change_total",methods: ['post','get'])]
-    public function checkChangeStep(Request $request)
-    {
-        try {
-            $param = $this->_valid([
-                "cosKey.require"  => trans("empty.require"),
-                "type.default"  => "",
-                "ext.default"  => ""
-            ],$request->method());
-            if (!is_array($param)) return error($param);
-            $suffix = pathinfo($param['cosKey'], PATHINFO_EXTENSION);
-            if (empty($suffix)) return error("empty.data.suffix");
-            $change = (new SaasWordChange)->where("key",md5($param['cosKey']))->findOrEmpty();
-            $cosClient = new Client([
-                'region' => sConf("storage.cos_region"),
-                'schema' => 'https', // 协议头部,默认为 http
-                'credentials' => array(
-                    'secretId' => sConf("storage.cos_access_key"),
-                    'secretKey' => sConf("storage.cos_secret_key"),
-                ),
-                "verify"    => false
-            ]);
-            if ($change->isEmpty())
-            {
-                $url = $cosClient->getObjectUrl(sConf("storage.cos_bucket"), $param['cosKey']);
-                $params = array(
-                    'ci-process' => 'doc-preview',
-                    'page' => 1,
-                    'dstType' => 'jpg',
-                    'imageDpi' => '120',
-                );
-                $query = http_build_query($params);
-                $path = $url.$query;
-                $resp = Http::get($path)->headers();
-                if (!isset($resp['X-Total-Page'])) return error("文档可能需要密码,请先删除后再确认");
-                $page = $resp['X-Total-Page']?$resp['X-Total-Page'][0]:1;
-
-                $result = $cosClient->CreateDocProcessJobs([
-                    'Bucket' => sConf("storage.cos_bucket"), // 存储桶名称,由 BucketName-Appid 组成,可以在 COS 控制台查看 https://console.cloud.tencent.com/cos5/bucket
-                    'Tag' => 'DocProcess', //任务的 Tag:DocProcess 固定值
-                    'Input' => array(
-                        'Object' => $param['cosKey'] //待操作的文件对象
-                    ),
-                    'Operation' => array(
-                        'DocProcess' => array(
-                            'SheetId' => 0, //表格文件参数,转换第 X 个表,默认为1
-                            'StartPage' => 1, //从第 X 页开始转换,默认为1
-                            'Quality' => 100, //生成预览图的图片质量,取值范围 [1-100],默认值100
-                            'Zoom' => 100, //预览图片的缩放参数,取值范围[10-200], 默认值100
-                            "ImageDpi" => 300
-                        ),
-                        'Output' => array(
-                            'Region' => sConf("storage.cos_region"), //存储桶的地域
-                            'Bucket' => sConf("storage.cos_bucket"), // 存储结果的存储桶
-                            'Object' => 'out/'.date('Ymd').'/'.time().md5($param['cosKey']).'-${Number}.pdf', //输出文件路径
-                        ),
-                    ),
-                ])->toArray();
-                $change->insertGetId([
-                    "key"       => md5($param['cosKey']),
-                    "task_id"   => $result['JobsDetail']['JobId']??'',
-                    "total"     => $page
-                ]);
-                return error("error");
-            }
-            $result = $cosClient->describeDocProcessJob(array(
-                'Bucket' => sConf("storage.cos_bucket"), // 存储桶名称,由 BucketName-Appid 组成,可以在 COS 控制台查看 https://console.cloud.tencent.com/cos5/bucket
-                'Key' => $change['task_id'], // JobId
-            ))->toArray();
-            if ($result['JobsDetail']['State'] == 'Success') {
-                $change->status = 1;
-                $change->path = $result['JobsDetail']['Operation']['DocProcessResult']['PageInfo'][0]['TgtUri']??'';
-                $change->end_at = getDateFull();
-                $change->save();
-                $page = $change['total'];
-                $path = $change['path'];
-                return success("ok",compact("path","page"));
-            }
-            return error("Error");
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-
-    /**
-     * 获取打印机支持的纸张
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "size",methods: ['post','get'])]
-    public function getPageSize(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "shop.require"      => trans("empty.require"),
-                "print.require"     => trans("empty.require")
-            ],$request->method());
-            if (!is_array($param)) return error($param);
-            $printData = (new SaasPrintClient)->where(['shop_id' => $param['shop'],'code' => $param['print']])->findOrEmpty();
-            if ($printData->isEmpty()) return error('无可用打印机');
-            $paperRule = is_string($printData['rule'])?json_decode($printData['rule'],true):$printData['rule'];
-            return success("ok",['size' => $paperRule['paper_size']]);
-        } catch (\Throwable $th) {
-            return error($th->getMessage());
-        }
-    }
-
-}

+ 0 - 391
app/controller/api/Notify.php

@@ -1,391 +0,0 @@
-<?php
-
-namespace app\controller\api;
-
-use app\extra\basic\Base;
-use app\extra\jhfPay\Utils;
-use app\model\saas\SaasCart;
-use app\model\saas\SaasOrder;
-use app\model\saas\SaasOrderDetail;
-use app\model\saas\SaasShop;
-use app\model\saas\SaasShopLog;
-use app\model\saas\SaasUser;
-use app\model\saas\SaasUserBuy;
-use app\model\saas\SaasUserLog;
-use app\model\system\SystemUserMoney;
-use LinFly\Annotation\Route\Controller;
-use LinFly\Annotation\Route\Route;
-use support\Request;
-use support\Response;
-use think\facade\Db;
-use WeChat\Contracts\Tools;
-
-
-#[Controller(prefix: "/notify")]
-class Notify extends Base
-{
-
-
-    /**
-     * 提现银行卡回调
-     */
-    #[Route(path: "withdraw",methods: "post")]
-    public function notifyWithdraw(Request $request): Response
-    {
-        try {
-            echo getDateFull() . "===>提现银行卡异步返回\n";
-            $data = $this->jhfReturn($request->all(),"withdraw.succeeded");
-            if (empty($data)) return error("提现失败");
-            if ($data['status'] == "succeeded") // 成功了
-            {
-                $day = date("Y-m-d",strtotime("-1 day"));
-                $todayMoney = (new SystemUserMoney)->where("member_id",$data['member_id'])->where("day",$day)->select();
-                if ($todayMoney->count() > 0) {
-                    $state = (new SystemUserMoney)->where("member_id",$data['member_id'])->where("day",$day)->update(['status' => 1,"withdraw_id" => $data['withdraw_id']]);
-                }
-            }
-            return success("ok");
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-    /**
-     * 退款回调
-     * @param Request $request
-     */
-    #[Route(path: "refund",methods: "post")]
-    public function notifyRefund(Request $request)
-    {
-        try {
-            echo getDateFull() . "===>退款申请返回\n";
-            $data = $this->jhfReturn($request->all(),"refund.succeeded");
-            if (empty($data)) return error("支付失败");
-//            $payResp = $request->rawBody();
-//            $wechat = new \WePay\Refund($this->getWxConfig());
-//            if (empty($payResp)) return $wechat->getNotifySuccessReply();
-//            $data = $wechat->getNotify($payResp);
-//            if (empty($data)) return $wechat->getNotifySuccessReply();
-//            $orderSn = explode("-",$data['attach']);
-            $order = (new SaasOrder)->where("order_sn",$data['attach'])->with(['shop' => function($query){
-                $query->field('shop_id,shop_name,shop_address');
-            }])->findOrEmpty();
-            if ($order->isEmpty()) return $this->getNotifySuccessReply();
-            if ($order['status'] <> 4) return $this->getNotifySuccessReply();
-            $order->status = 6;
-            $order->refund_at = getDateFull();
-            $order->save();
-            (new SaasOrderDetail)->where("order_sn",$order['order_sn'])->update(['status' => 6]);
-            $orderMoney = (($order['money'] > $order['discount']) ? $order['discount'] : $order['money']);
-            // 商家账户额度退款
-            $shop = (new SaasShop)->where("shop_id",$order['shop_id'])->with(['wx' => function($query){
-                $query->field("shop_id,openid,is_msg");
-            }])->findOrEmpty();
-            if ($shop->isEmpty()) return $this->getNotifySuccessReply();
-            $shop->balance = $shop['balance'] - $orderMoney;
-            $shop->total_balance = $shop['total_balance'] - $orderMoney;
-            $shop->save();
-            (new SaasShopLog)->insertGetId([
-                "shop_id"   => $order['shop_id'],
-                "money"     => $orderMoney,
-                "balance"   => $shop->balance,
-                "remark"    => "订单退款【{$order['order_sn']}】",
-                "type"      => 2
-            ]);// 推送消息-公众号
-            if (!empty($shop['wx'])) {
-                $obj = \We::WeChatTemplate([
-                    "appid" => sConf("wechat.appid"),
-                    "appsecret" => sConf("wechat.secret"),
-                    "token" => sConf("wechat.token"),
-                    "encodingaeskey" => sConf("wechat.aeskey")
-                ]);
-                foreach ($shop['wx'] as $val) {
-                    if ($val['is_msg'] == 1) {
-                        $obj->send([
-                            "touser" => $val['openid'],
-                            "template_id" => "WboxN-32rdHORBQHzaVvQb9kPN7rLaXAPS_BL2yfb5w",
-                            "data" => [
-                                "amount3" => ["value" => format_money($order['money']/100)],
-                                "character_string1" => ["value" => $order['old_order']],
-                                "time4" => ["value" => date('Y-m-d H:i')]
-                            ]
-                        ]);
-                    }
-                }
-            }
-
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-    /**
-     * 订单支付
-     */
-    #[Route(path: "wx",methods: "post")]
-    public function notifyWx(Request $request)
-    {
-        try {
-            echo getDateFull()."===>支付返回\n";
-            $data = $this->jhfReturn($request->all());
-            if (empty($data)) return error("支付失败");
-//            $payResp = $request->rawBody();
-//            $data = $this->payReturn($payResp);
-            $order = (new SaasOrder)->where("order_sn",$data['attach'])->with(['shop' => function($query){
-                $query->field('shop_id,shop_name,shop_address');
-            }])->findOrEmpty();
-            if ($order->isEmpty()) return "success";
-            if ($order['status'] <> 0) return "success"; // 已支付或者是其他状态
-            $order->status = 1;
-            $order->pay_at = getDateFull();
-            $order->transaction_id = $data['transaction_id']??'';
-            $order->payment_id = $data['payment_id']??'';
-            $order->notify_status = 1;
-            $order->pay_type = 1;
-            $order->save();
-            $shop = (new SaasShop)->where("shop_id",$order['shop_id'])->with(['wx' => function($query){
-                $query->field("shop_id,openid,is_msg");
-            }])->findOrEmpty();
-            if ($shop->isEmpty()) return "success";
-            $shop->balance = Db::raw("balance+".$order['money']);
-            $shop->total_balance = Db::raw("total_balance+".$order['money']);
-            $shop->save();
-            (new SaasShopLog)->insertGetId([
-                "shop_id"   => $order['shop_id'],
-                "money"     => $order['money'],
-                "balance"   => $shop->balance,
-                "remark"    => "新订单【{$order['order_sn']}】"
-            ]);
-            events("create-order",['shop' => $order['shop_id'],'print' => $order['print_id'],'openid' => $order['openid'],"order" => $order['order_sn']]);
-            // 推送消息-公众号
-            if (!empty($shop['wx'])) {
-                $obj = \We::WeChatTemplate([
-                    "appid" => sConf("wechat.appid"),
-                    "appsecret" => sConf("wechat.secret"),
-                    "token" => sConf("wechat.token"),
-                    "encodingaeskey" => sConf("wechat.aeskey")
-                ]);
-                foreach ($shop['wx'] as $val) {
-                    if ($val['is_msg'] == 1) {
-                        $obj->send([
-                            "touser" => $val['openid'],
-                            "template_id" => "D20ZEWmUNmXMHLwiTOzaEateX5NvM9zoCbp2YwbIHsI",
-                            "data" => [
-                                "thing20" => ["value" => $val['shop_name']],
-                                "character_string1" => ["value" => $order['order_sn']],
-                                "amount16" => ["value" => format_money($order['money'] / 100)],
-                                "time2" => ["value" => date('Y-m-d H:i')]
-                            ],
-                            "url" => "https://inmei.yunenv.cn/weixin/order/detail?id=" . $order['id']
-                        ]);
-                    }
-                }
-            }
-
-            return "success";
-        } catch (\Throwable $throwable) {
-            return "success";
-        }
-    }
-
-
-    /**
-     * 充值并支付
-     */
-    #[Route(path: "recharge",methods: "post")]
-    public function notifyPayRecharge(Request $request)
-    {
-        try {
-            echo getDateFull()."===>充值并支付支付返回\n";
-            $data = $this->jhfReturn($request->all());
-            if (empty($data)) return error("支付失败");
-            $orderBuy = (new SaasUserBuy)->where("order_sn",$data['attach'])->with(['orders'])->findOrEmpty();
-            if ($orderBuy->isEmpty()) return "success";
-            if ($orderBuy['status'] <> 0) return "success"; // 已支付或者是其他状态
-            $orderMoney = 0;
-            $logData[0] = [
-                "openid"    => $orderBuy['openid'],
-                "card_no"   => $orderBuy['card_no'],
-                "shop_id"   => $orderBuy['shop_id'],
-                "money"     => $orderBuy['total_money'],
-                "order_sn"  => $orderBuy['order_sn'],
-                "type"      => 2,
-                "remark"    => "充值",
-                "balance"   => $orderBuy['total_money']
-            ];
-            if (!empty($orderBuy['orders']))
-            {
-                $orderMoney = $orderBuy['orders']['money'];
-                $logData[1] = [
-                    "openid"    => $orderBuy['openid'],
-                    "card_no"   => $orderBuy['card_no'],
-                    "shop_id"   => $orderBuy['shop_id'],
-                    "order_sn"  => $orderBuy['order_sn'],
-                    "money"     => $orderMoney,
-                    "type"      => 1,
-                    "remark"    => "订单付款",
-                    "balance"   => $orderBuy['total_money'] - $orderMoney
-                ];
-            };
-            $orderBuy->status = 1;
-            $orderBuy->pay_at = getDateFull();
-            $orderBuy->payment_id = $data['payment_id']??'';
-            $orderBuy->transaction_id = $data['transaction_id']??'';
-            $orderBuy->save();
-            $shop = (new SaasShop)->where("shop_id",$orderBuy['shop_id'])->with(['wx' => function($query){
-                $query->field("shop_id,openid,is_msg");
-            }])->findOrEmpty();
-            if ($shop->isEmpty()) return "success";
-            // 开通vip账户
-            $card = (new SaasUser)->where("card_no",$orderBuy['card_no'])->findOrEmpty();
-            $balanceMoney = $orderBuy['total_money'] - $orderMoney;
-            if ($card->isEmpty()) {
-                $card->insertGetId([
-                    "openid"    => $orderBuy['openid'],
-                    "shop_id"   => $orderBuy['shop_id'],
-                    "card_no"   => $orderBuy['card_no'],
-                    "balance"   => $balanceMoney, // 余额
-                    "total_balance"   => $orderBuy['money'], // 累计充值
-                    "total_consume"   => $orderMoney // 累计消费
-                ]);
-            } else {
-                $card->total_consume = Db::raw("total_consume+{$orderMoney}");
-                $card->total_balance = Db::raw("total_balance+{$orderBuy['money']}");
-                $card->balance = Db::raw("balance+{$balanceMoney}");
-                $card->save();
-            }
-            if (!empty($orderBuy['orders']))
-            {
-                $order = (new SaasOrder)->where("order_sn",$orderBuy['order_sn'])->findOrEmpty();
-                if ($order->isEmpty()) return "success";
-                if ($order['status'] <> 0) return "success"; // 已支付或者是其他状态
-                $order->status = 1;
-                $order->pay_at = getDateFull();
-                $order->transaction_id = $data['transaction_id']??'';
-                $order->notify_status = 1;
-                $order->pay_type = 2;
-                $order->save();
-                events("create-order",['shop' => $order['shop_id'],'print' => $order['print_id'],'openid' => $order['openid'],"order" => $order['order_sn']]);
-            }
-            $shop->balance = Db::raw("balance+".$orderBuy['money']);
-            $shop->total_balance = Db::raw("total_balance+".$orderBuy['money']);
-            $shop->save();
-            (new SaasShopLog)->insertGetId([
-                "shop_id"   => $orderBuy['shop_id'],
-                "money"     => $orderBuy['money'],
-                "balance"   => $shop->balance,
-                "type"      => 1,
-                "remark"    => "会员卡充值",
-                "status"    => 1
-            ]);
-            // 推送消息-公众号
-            if (!empty($shop['wx'])) {
-                $obj = \We::WeChatTemplate([
-                    "appid" => sConf("wechat.appid"),
-                    "appsecret" => sConf("wechat.secret"),
-                    "token" => sConf("wechat.token"),
-                    "encodingaeskey" => sConf("wechat.aeskey")
-                ]);
-                foreach ($shop['wx'] as $val) {
-                    if ($val['is_msg'] == 1) {
-                        $obj->send([
-                            "touser" => $val['openid'],
-                            "template_id" => "v1TVHflG9h5BPRLb2hH10r8oOV5OFMKD2cmqIw1nH-w",
-                            "data" => [
-                                "thing1" => ["value" => '微信用户'.$orderBuy['openid']],
-                                "thing6" => ["value" => $val['shop_name']],
-                                "amount3" => ["value" => format_money($orderBuy['money'] / 100)],
-                                "character_string9" => ["value" => $orderBuy['order_sn']],
-                                "time4" => ["time5" => date('Y-m-d H:i')]
-                            ]
-                        ]);
-                    }
-                }
-            }
-            (new SaasUserLog)->insertAll($logData);
-            return "success";
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-    /**
-     * 会员卡充值
-     */
-    #[Route(path: "recharges",methods: "post")]
-    public function notifyDataRecharge(Request $request)
-    {
-        try {
-            echo getDateFull()."===>会员卡支付返回\n";
-            $data = $this->jhfReturn($request->all());
-            if (empty($data)) return error("支付失败");
-
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-    /**
-     * 第三方支付返回
-     * @param array $respData
-     * @return array
-     */
-    protected function jhfReturn(array $respData = [],string $return = "payment.succeeded"): array
-    {
-        if ($respData['type'] <> $return) return [];
-        $resCipher = Utils::aes_decrypt($respData['resCipher'], sConf("wechat.jhf_aeskey"));
-        $data = json_decode($resCipher,true);
-        if ($return == "withdraw.succeeded") {
-            print_r($data);
-        }
-        $data['attach'] = $data['order_no'];
-        $data['transaction_id'] = $data['out_trans_id']??'';
-        $data['payment_id'] = $data['payment_id']??'';
-        $data['withdraw_id'] = $data['withdraw_id']??'';
-        $data['member_id'] = $data['member_id']??'';
-        $data['status'] = $data['status']??'';
-        return $data;
-    }
-
-    protected function payReturn($payResp)
-    {
-        $wechat = new \WeChat\Pay($this->getWxConfig());
-        if (empty($payResp)) return $this->getNotifySuccessReply();
-        $data = Tools::xml2arr($payResp);
-        if (empty($data)) return $this->getNotifySuccessReply();
-        return $data;
-    }
-
-
-    /**
-     * 获取微信支付通知成功回复 XML
-     * @return string
-     */
-    protected function getNotifySuccessReply(): string
-    {
-//        return Tools::arr2xml(['return_code' => 'SUCCESS', 'return_msg' => 'OK']);
-        return json(['return_code' => 'SUCCESS', 'return_msg' => 'OK']);
-    }
-
-
-    /**
-     * 小程序配置
-     * @return array
-     */
-    protected function getWxConfig(): array
-    {
-        return [
-            'token'          => 'test',
-            'appid'          => sConf("wechat.mini_appid"),
-            'appsecret'      => sConf("wechat.mini_secret"),
-            'encodingaeskey' => 'BJIUzE0gqlWy0GxfPp4J1oPTBmOrNDIGPNav1YFH5Z5',
-            // 配置商户支付参数(可选,在使用支付功能时需要)
-            'mch_id'         => sConf("wechat.mch_id"),
-            'mch_key'        => sConf("wechat.mch_key")
-        ];
-    }
-
-
-}

+ 0 - 277
app/controller/api/Order.php

@@ -1,277 +0,0 @@
-<?php
-
-namespace app\controller\api;
-
-use app\extra\basic\Base;
-use app\extra\jhfPay\Pay;
-use app\extra\tools\CodeExtend;
-use app\middleware\WxMiddleware;
-use app\model\saas\SaasCart;
-use app\model\saas\SaasDiscount;
-use app\model\saas\SaasOrder;
-use app\model\saas\SaasOrderDetail;
-use app\model\saas\SaasPrintClient;
-use app\model\saas\SaasShop;
-use app\model\saas\SaasUser;
-use app\model\saas\SaasUserBuy;
-use app\model\saas\SaasUserLog;
-use LinFly\Annotation\Route\Controller;
-use LinFly\Annotation\Route\Middleware;
-use LinFly\Annotation\Route\Route;
-use support\Request;
-use support\Response;
-use think\facade\Db;
-
-
-#[Controller(prefix: "/wx_api/order"),Middleware(WxMiddleware::class)]
-class Order extends Base
-{
-    protected array $noNeedLogin = [];
-
-    protected array $types = [
-        '1_1_1' => ['name' => '彩色-单面', 'amount' => 0, 'quantity' => 0,'discount' => 0],
-        '1_2_1' => ['name' => '彩色-双面', 'amount' => 0, 'quantity' => 0,'discount' => 0],
-        '2_1_1' => ['name' => '黑白-单面', 'amount' => 0, 'quantity' => 0,'discount' => 0],
-        '2_2_1' => ['name' => '黑白-双面', 'amount' => 0, 'quantity' => 0,'discount' => 0],
-    ];
-
-    protected array $color = ["1" => "彩色", "2" => "黑白"];
-
-    protected array $duplex = ["1" => "单面", "2" => "双面"];
-
-    protected array $package = ["1" => "店内打印", "2" => '远程自取' , "3" => "商家配送"];
-
-    #[Route(path: "list",methods: "get")]
-    public function getOrderList(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "page.require"  => "参数错误",
-                "size.require"  => "参数错误",
-                "type.require"  => "参数错误",
-                "shop.require"  => "请选择店铺"
-            ]);
-            if (!is_array($param)) return error($param);
-            $map = ["openid" => $request->user['openid'],"shop_id" => $param['shop']];
-            $model = (new SaasOrder);
-            if ($param['type'] > 0) {
-                $map['status'] = $param['type'] - 1;
-            } else {
-                $model = $model->where("status",">",0);
-            }
-            $resp = $model->where($map)->append(["total"])->with(['shop' => function($query){
-                $query->field('shop_id,shop_name');
-            }])->withAttr(["total" => function($val,$resp){
-                return (new SaasOrderDetail)->where("order_sn",$resp['order_sn'])->sum("number");
-            }])->order("create_at desc")->paginate([
-                "list_rows" => $param['size'],
-                "page"      => $param['page']
-            ]);
-            return success("ok",$resp->toArray());
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-    /**
-     * 订单详情
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "detail",methods: "get")]
-    public function getOrderDetail(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "order.require"  => "参数错误"
-            ]);
-            if (!is_array($param)) return error($param);
-            $resp = (new SaasOrder)->where("openid",$request->user['openid'])->where("order_sn",$param['order'])->append(["total","subscribe"])->with(['shop' => function($query){
-                $query->field('shop_id,shop_name,shop_address');
-            },"detail" => function($query){
-                $query->field('order_sn,name,color,paper_size,duplex,number,page,extension,path,icon');
-            }])->withAttr(["total" => function($val,$resp){
-                return (new SaasOrderDetail)->where("order_sn",$resp['order_sn'])->sum("number");
-            },"subscribe" => function(){
-                return ["495E40hqOKoz5j_mWcf-UcmF6wkj_yIwCrTXicicH5w","UXJjDQ7NGstSwOxrKf_laGDmpID8Mm5MpXwFAd45d8U"];
-            }])->findOrEmpty();
-            if ($resp->isEmpty()) return error("订单数据错误");
-            $resp['package_name'] = $this->package[$resp['package']];
-            $resp['money'] = format_money($resp['money'] / 100);
-            return success("ok",$resp->toArray());
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-    /**
-     * @param Request $request
-     * @return Response
-     */
-    #[Route(path: "create",methods: "post")]
-    public function createOrder(Request $request): Response
-    {
-        try {
-            $param = $this->_valid([
-                "shop.require"  => trans("empty.require"),
-                "print.require" => trans("empty.require"),
-                "pay.require"   => trans("empty.require"), // 1微信支付 2会员卡支付 3会员卡充值并支付
-                "printName.default" => "",
-                "express.require" => trans("empty.require"),
-                "card.default"      => "",
-                "gift.default"      => 0
-            ],$request->method());
-            if (!is_array($param)) return error($param);
-            $cart = (new SaasCart)->where("shop_id",$param['shop'])->where("print_id",$param['print'])->where("openid",$request->user['openid'])->order("create_at desc")->select();
-            if ($cart->isEmpty()) return error('请重新下单进行支付');
-            $totalAmount = $totalDiscount = 0;
-            foreach ($cart as $k=>$v){
-                $key = $v['color'] . '_' . $v['duplex'] . '_' . $v['source'];
-                if (isset($this->types[$key])) {
-                    $this->types[$key]['quantity'] += $v['page'];
-                    $this->types[$key]['amount'] += $v['money'];
-                }
-                $cart[$k] = $v;
-                $cart[$k]['money'] = format_money($v['money'] / 100,2);
-                $cart[$k]['name'] = msubstr($v['name'],0,12);
-            }
-            $printData = (new SaasPrintClient)->where("shop_id",$param['shop'])->where("code",$param['print'])->select();
-            if ($printData->isEmpty()) return error('无可用打印机');
-            // 计算折扣
-            foreach ($this->types as $k=>$v) {
-                $discount = (new SaasDiscount)->where("shop_id",$param['shop'])->where("keys",$k)->where("number",'<',$v['quantity'])->findOrEmpty();
-                if (!$discount->isEmpty()) {
-                    $v['discount'] = round($v['amount'] * $discount['rate']);
-                    $this->types[$k]['discount'] = $v['discount'];
-                }
-                $totalAmount += $v['amount']; // 实际金额
-                $totalDiscount += $v['discount']; // 折扣后金额
-            }
-            $orderSn = CodeExtend::uniqidDate(16).date("is").rand(1,9);
-            $totalDay = (new SaasOrder)->where("shop_id",$param['shop'])->whereDay("create_at")->count();
-            $orderData = [
-                "shop_id"       => $param['shop'], // 所属店铺
-                "parent_id"     => $param['shop'], // 消费店铺
-                "openid"        => $request->user['openid'],
-                "order_sn"      => $orderSn,
-                "money"         => $totalAmount,
-                "discount"      => $totalDiscount==0?$totalAmount:$totalDiscount, // 跟原价相等无折扣
-                "print_name"    => $param['printName'],
-                "print_id"      => $param['print'],
-                "package"       => $param['express'],
-                "package_sn"    => date('md')."-".sprintf("%02d",($totalDay+1)),
-                "extra_money"   => 0,
-                "remark"        => $param['remark']??''
-            ];
-            $shop = (new SaasShop)->where("shop_id",$param['shop'])->findOrEmpty();
-            if ($param['pay'] == 2) { // 会员卡支付
-                $card = (new SaasUser)->where("openid",$request->user['openid'])->where("shop_id",$param['shop'])->findOrEmpty();
-                $payMoney = $totalDiscount > 0 ? $totalDiscount : $totalAmount;
-                if ($payMoney >= $card['balance']) {
-                    return error("卡内余额不足~");
-                }
-                // 直接支付
-                $card->balance = ($card['balance'] - $payMoney);
-                $card->total_consume = ($card['total_consume'] + $payMoney);
-                $card->save();
-                $orderData['pay_type'] = 2;
-                $orderData['status'] = 1;
-                $orderData['pay_at'] = getDateFull();
-                (new SaasOrder)->insertGetId($orderData);
-                (new SaasUserLog)->insertGetId([
-                    "openid"    => $request->user['openid'],
-                    "shop_id"   => $param['shop'],
-                    "order_sn"  => $orderSn,
-                    "money"     => $payMoney,
-                    "card_no"   => strtoupper(md5($request->user['openid'].$param['shop'])),
-                    "type"      => 1,
-                    "balance"   => $card['balance'] - $payMoney,
-                ]);
-                events("create-order",['shop' => $param['shop'],'print' => $param['print'],'openid' => $request->user['openid'],"order" => $orderSn]);
-                return success("支付成功",['type' => 2,'data' => []]);
-            }
-            $options = [
-                'body'              => "{$shop['shop_name']}-{$param['printName']}",
-                'out_trade_no'      => $orderSn."-".$orderData['package_sn'],
-                "attach"            => $orderSn,
-                'total_fee'         => $orderData['money'],
-                'openid'            => $request->user['openid'],
-                'trade_type'        => 'JSAPI',
-                'spbill_create_ip'  => $request->getRealIp(),
-                "notify_url"        => "https://panel.huiyinduo.cn/notify/wx"
-            ];
-            if ($orderData['money'] <= 0) {
-                return error("数据变动请重新上传再下单");
-            }
-            if ($param['pay'] == 3 && !empty($param['card'])) { // 开通会员卡并充值
-                $buyCard = json_decode($param['card'],true);
-                (new SaasUserBuy)->insertGetId([
-                    "shop_id"       => $param['shop'],
-                    "money"         => $buyCard['money'] * 100,
-                    "total_money"   => ($buyCard['money'] * 100) + ($buyCard['old_money'] * 100),
-                    "order_sn"      => $orderSn,
-                    "openid"        => $request->user['openid'],
-                    "card_no"       => strtoupper(md5($request->user['openid'].$param['shop']))
-                ]);
-                $options['body'] = $shop['shop_name']."-充值支付";
-                $options['total_fee'] = $buyCard['money'] * 100;
-                $options['notify_url'] = "https://panel.huiyinduo.cn/notify/recharge";
-            }
-            (new SaasOrder)->insertGetId($orderData);
-            $param_data["order_no"] = $orderSn;
-            $param_data["app_id"] = sConf("wechat.jhf_appid");
-            $param_data["pay_channel"] = "wx_lite";
-            $param_data["pay_amt"] = format_money($options['total_fee'] / 100 , 2);
-            $param_data["goods_title"] = $options['body'];
-            $param_data["device_info"] = array("device_ip" => $request->getRealIp());
-            $param_data['notify_url'] = $options['notify_url'];
-            $param_data["expend"] = [
-                "wx_app_id" => sConf("wechat.mini_appid"),
-                "open_id" => $request->user['openid']
-            ];
-            $respJhf = (new Pay)->config([
-                "appid"  => sConf("wechat.jhf_appid"),
-                "mch_id" => sConf("wechat.jhf_mch_id"),
-                "aeskey" => sConf("wechat.jhf_aeskey"),
-                "pubkey" => sConf("wechat.jhf_pubkey"),
-                "prikey" => sConf("wechat.jhf_prikey"),
-            ])->createPay($param_data);
-
-//            $wechat = new \WeChat\Pay($this->getWxConfig());
-//            // 生成预支付码
-//            echo getDateFull()."生成支付二维码\n";
-//            print_r($options);
-//            $result = $wechat->createOrder($options);
-            if (isset($respJhf['code'])) {
-                return error("发起支付失败");
-            }
-            // 创建JSAPI参数签名
-            $resp = json_decode($respJhf['expend']['pay_info'],true);
-            $resp['timestamp'] = $resp['timeStamp'];
-            return success("ok",['type' => 1,"data" => $resp]);
-        } catch (\Throwable $throwable) {
-            echo $throwable->getLine()."\n";
-            echo $throwable->getFile()."\n";
-            return error($throwable->getMessage());
-        }
-    }
-
-    /**
-     * 小程序配置
-     * @return array
-     */
-    protected function getWxConfig(): array
-    {
-        return [
-            'token'          => 'test',
-            'appid'          => sConf("wechat.mini_appid"),
-            'appsecret'      => sConf("wechat.mini_secret"),
-            'encodingaeskey' => 'BJIUzE0gqlWy0GxfPp4J1oPTBmOrNDIGPNav1YFH5Z5',
-            // 配置商户支付参数(可选,在使用支付功能时需要)
-            'mch_id'         => sConf("wechat.mch_id"),
-            'mch_key'        => sConf("wechat.mch_key")
-        ];
-    }
-
-
-}

+ 52 - 0
app/controller/api/Page.php

@@ -0,0 +1,52 @@
+<?php
+
+namespace app\controller\api;
+
+use app\extra\basic\Base;
+use LinFly\Annotation\Route\Controller;
+use LinFly\Annotation\Route\Route;
+use support\Request;
+use support\Response;
+
+
+#[Controller(prefix: "/wx_api/page")]
+class Page extends Base
+{
+
+
+    #[Route(path: "about",methods: "get")]
+    public function getAbout(Request $request)
+    {
+        try {
+
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+
+
+    #[Route(path: "privacy",methods: "get")]
+    public function getPrivacy(Request $request)
+    {
+        try {
+            $data = sConf("service.privacy");
+            return json_encode(['code' => 1,'data' => $data],JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+
+    #[Route(path: "agreements",methods: "get")]
+    public function getAgreements(Request $request)
+    {
+        try {
+            $data = sConf("service.agreements");
+            return json_encode(['code' => 1,'data' => $data],JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
+}

+ 0 - 263
app/controller/api/Test.php

@@ -1,263 +0,0 @@
-<?php
-
-namespace app\controller\api;
-
-
-use app\extra\basic\Base;
-use app\extra\jhfPay\Pay;
-use app\extra\tools\CodeExtend;
-use app\model\saas\SaasCart;
-use app\model\saas\SaasOrderDetail;
-use app\model\saas\SaasUser;
-use app\model\saas\SaasUserOpen;
-use LinFly\Annotation\Route\Controller;
-use LinFly\Annotation\Route\Route;
-use support\Request;
-use support\think\Db;
-use Webman\Push\Api;
-use Webman\RedisQueue\Redis;
-
-#[Controller(prefix: "/api/test")]
-class Test extends Base
-{
-
-
-    protected array $whiteShop = [
-        "10888572278827"    => "10888572278827", // 惠印多马村店
-        "10888566286841"    => "327545130062964", // 中站小学店
-        "10888590458813"    => "326945519114632", // 幸小印美店
-        "10888645729727"    => "326844775971796", // 焦作和平街店
-    ];
-
-
-    #[Route(path: "pay",methods: "get")]
-    public function testPay(Request $request)
-    {
-        try {
-            $respJhf = (new Pay)->config([
-                "appid"  => sConf("wechat.jhf_appid"),
-                "mch_id" => sConf("wechat.jhf_mch_id"),
-                "aeskey" => sConf("wechat.jhf_aeskey"),
-                "pubkey" => sConf("wechat.jhf_pubkey"),
-                "prikey" => sConf("wechat.jhf_prikey"),
-            ]);
-            $jsResp = $respJhf->createBalancePay([
-                "app_id" => sConf("wechat.jhf_appid"),
-                "order_no"  => CodeExtend::uniqidDate(18),
-                "member_id" => "300919564646719394",
-                "pay_amt"   => "77.73",
-                "description"   => "补发"
-            ]);
-//            $jsResp = $respJhf->createBalanceWithdraw([
-//                "app_id" => sConf("wechat.jhf_appid"),
-//                "order_no"  => "9D18B0EEB5E70548308CB77274755601",
-//                "member_id" => "974707386910290082",
-//                "remark"    => "2026-05-01-结算",
-//                "notify_url"    => "https://panel.huiyinduo.cn/notify/withdraw",
-//            ]);
-            print_r($jsResp);
-
-//            $param_data = array();
-//            $param_data["order_no"] = date("YmdHis").CodeExtend::random(8);
-//            $param_data["app_id"] = "app_6666000195741955";
-//            $param_data["pay_channel"] = "wx_lite";
-//            $param_data["pay_amt"] = "0.10";
-//            $param_data["goods_title"] = "智惠印打印";
-//            $param_data["device_info"] = array("device_ip" => '192.168.0.1');
-//            $param_data["expend"] = [
-//                "wx_app_id" => "wxbeeb0dcd7336612f",
-//                "open_id" => "omf322AlD9wFjm5Ucix9uKmRXd4I"
-//            ]; //expend参数根据支付渠道变化
-//            $param_data["notify_url"] = "https://panel.huiyinduo.cn/notify/wx"; //接收支付结果异步通知地址
-//            $resp = (new Pay)->config([
-//                "appid" => "app_6666000195741955",
-//                "mch_id" => "1120260422467651",
-//                "aeskey" => "54784acef7d89b50edff9d42832f124c",
-//                "pubkey" => "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOKBBFXirWIJth+SNJCY4mhbATbL60sKV66bRixHMVz8vpBqONio9X6A+Pm9LNutBe+hLpI1BMmFJk3Mb1/QEcklWptRGgHqIrBxR4b19qc/2/pSxyqlpaifYJFZhOg2+OcQ/fqpAmhNXN5uc1pcYvbvWTam0j+6+nBNQeAAku5QIDAQAB",
-//                "prikey" => "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOK1bos5glGB/tq/iyDaCLwAgVUwTLRFltG7j5QjS+CEBu/0t6wW3z2UfacMxWGRgkPQBWCDNSOlYV9gVOoxtfj3TS0zWK1t9OCO+7PaSI9BqkYumlylpRq09gplul6C7HXgrWx3WxuzbLXSaJ6wAeFr0ZY1KqPdhZ5OB7m0zNeXAgMBAAECgYAr1COg6udU1qrso2dEXKKfpgFa9NF/cIyt03L4krJSn3Ov5EG2FV3nS9PW/dMS/8yNS6Qeen9Feu2OQNNpy16AfDiy5cFn5MvLm/PHb7syBMaakuKogEDYKnoo/CPbI8kTYymZA0tDnad1BkeY3lb0Bx6ou4oRZ+TYc0QOJCqwUQJBAPE7QRhpR4VygkIcPORyIR7PhBKkxmMz+ZHt+E/ep7o5KpdDfBP95gUs7591BZDnyh1EBrkBh9G8WQVBCeV9Qk0CQQDwlpEsLyw9DdtgKTneoRfw+bnLhIfvkshoxfhWf3i4iCcIqAvZZbfInY2W37vBJrtpfirHOhpuLjV7R2fqSctzAkBCuuJx70WSm69+vDL3+r5AuKTPR3d9n7YM8Sg8Z9o8AG5Qs6FSIm0Lx3dtw8BLamMVn2jAqrS4hwKVGn2zVugNAkEAyjFgFEgY377TjX9YOTgdzNGzSc06CSfM8fDfAqLirAMQ+v9v5ebMi/eNVSz2uB97Be+YuBKmv85p+A9Mz+Pw7QJAb4fn1d5Tw3B7gku3XANH3RTfvNWBeXBpxpAlnaxJU39pVh4lh9UGoaWGoEKEdufHSJhJMUtaSpI2morVAfo0Ow==",
-//            ])->createPay($param_data);
-            return success("ok");
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-    #[Route(path: "s2",methods: "get")]
-    public function sendWs2()
-    {
-        try {
-            Redis::send("push-print",['type' => 'order' , 'order' => '202604205907640644072']);
-            return success("ok");
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-
-    #[Route(path: "s",methods: "get")]
-    public function sendWs()
-    {
-        try {
-            // return error('err');
-            $api = new Api('http://127.0.0.1:3232',
-                config('plugin.webman.push.app.app_key'),
-                config('plugin.webman.push.app.app_secret'));
-            $param = $this->_valid([
-                "color.default" => "color",
-                "size.default" => "A4",
-                "key.default" => "004356708646",
-                "shop.default" => "10888543912042",
-                "name.default" => "qiantai",
-                "id.default" => "29131",
-                "number.default" => 1,
-                "range.default" => "1",
-                "duplex.default"    => "simplex"
-            ]);
-            $printJobData = (new SaasOrderDetail)->where("paper_size",'A4')->where("extension",'docx')->limit(1)->order("create_at",'desc')->select();
-//            $printJobData = (new SaasOrderDetail)->where("id",$param['id'])->select();
-//            $printJobData = (new SaasOrderDetail)->whereDay("create_at","yesterday")->limit(1)->select();
-            if ($printJobData->isEmpty()) return error('err');
-            $printData = [];
-            foreach ($printJobData as $key=>$printJob) {
-                $range = "1";
-                // if ($printJob['end_page'] > $printJob['start_page']) {
-                //     $range = $printJob['start_page']."-".$printJob['end_page'];
-                // }
-                // if ($printJob['end_page'] == $printJob['start_page']) {
-                //     $range = (string) $printJob['end_page'];
-                // }
-                $color_mode = ($printJob['color']==1?'color':'monochrome');
-                $duplex = "simplex";
-                if ($printJob['paper_size'] == 'A4' && $printJob['duplex'] == 2) {
-                    $duplex = 'duplexlong'; // duplexlong
-                }
-                if ($printJob['paper_size'] == 'A3' && $printJob['duplex'] == 2) {
-                    $duplex = 'duplexlong'; // duplexshort
-                }
-                $printData[$key] = [
-                    "printerName"   => $param['name'],
-                    "copies"        => $param['number'],
-                    "landscape"     => false,
-                    "paperSize"     => $param['size'],
-                    "pageRange"     => $param['range'],
-                    "duplex"        => $param['duplex'],
-                    "colorMode"     => $param['color'],
-                    "jobId"         => $printJob['id'],
-                    "dpi"           => 300,
-                    "action"        => 'create',
-                    "scaleMode"     => 'fit',
-                    "remoteUrl"     => "https://zhy-1355132020.cos.ap-guangzhou.myqcloud.com/".$printJob['path'],
-//                    "remoteUrl"     => "https://zhy-1355132020.cos.ap-guangzhou.myqcloud.com/pdfs/20260501/12456-001_ac02a21c-3ad6-436f-9c13-ec415d26b21d.pdf", //竖版
-//                    "remoteUrl"     => "https://zhy-1355132020.cos.ap-guangzhou.myqcloud.com/ossmini/20260502/1777694521564_sopo6f.pdf", // 横版
-//                    "remoteUrl"     => "https://yunenv.oss-cn-shenzhen.aliyuncs.com/a3shu.pdf", // 横版
-//                    "remoteUrl"     => "https://inmei-print.oss-cn-guangzhou.aliyuncs.com/wxjiaoyi.pdf",
-//                    "remoteUrl"  => "https://zhy-1355132020.cos.ap-guangzhou.myqcloud.com/ossmini/20260504/1777898266812_rcyph1.docx",
-//                    "customFileName" => $printJob['order_sn']."_".$printJob['id'],
-                    "customFileName" => time()."_".$printJob['id'],
-                ];
-            }
-            $api->trigger("client-{$param['key']}-{$param['shop']}",'message',[
-                "type"  => "print",
-                "data"  => $printData
-            ]);
-//             if (!$printJob->isEmpty()) {
-//                 $range = "1";
-//                 // if ($printJob['end_page'] > $printJob['start_page']) {
-//                 //     $range = $printJob['start_page']."-".$printJob['end_page'];
-//                 // }
-//                 // if ($printJob['end_page'] == $printJob['start_page']) {
-//                 //     $range = (string) $printJob['end_page'];
-//                 // }
-//                 $color_mode = ($printJob['color']==1?'color':'monochrome');
-//                 $duplex = "simplex";
-//                 if ($printJob['paper_size'] == 'A4' && $printJob['duplex'] == 2) {
-//                     $duplex = 'duplexlong'; // duplexlong
-//                 }
-//                 if ($printJob['paper_size'] == 'A3' && $printJob['duplex'] == 2) {
-//                     $duplex = 'duplexshort'; // duplexshort
-//                 }
-//                 $api->trigger("client-005571234125-10888543912042",'message',[
-//                     "type"  => "print",
-//                     "data"  => [
-//                         [
-//                             "printerName"   => "750",
-//                             "copies"        => "1",
-//                             // "copies"        => (string)$printJob['number'],
-//                             "landscape"     => false,
-//                             "paperSize"     => "A4",
-//                             // "paperSize"     => $printJob['paper_size'],
-//                             "pageRange"     => $range,
-//                             "duplex"        => "duplexlong",
-//                             // "duplex"        => $duplex,
-//                             "monochrome"    => $color_mode,
-//                             "colorMode"     => "monochrome",// monochrome color
-//                             "jobId"         => $printJob['id']."-".time().rand(1,99),
-//                             "action"        => 'create',
-//                             "scaleMode"     => 'fit',
-//                             "remoteUrl"     => "https://cdn-zhy.huiyinduo.cn/".$printJob['path'],
-//                             "customFileName" => $printJob['order_sn']."_".$printJob['id'],    
-//                         ]
-// //                    "exe"       => ['-print-to',$printJob['print_name'],'-print-settings',"{$range},{$printJob['number']}x,{$color_mode},$duplex,fit,paper={$printJob['paper_size']}",'-silent'],
-//                     ]
-//                 ]);
-//             }
-            return success("ok",compact('printData'));
-        } catch (\Throwable $throwable) {
-            return error($throwable->getMessage());
-        }
-    }
-
-    #[Route(path: "t",methods: "get")]
-    public function testData(Request $request): \support\Response
-    {
-        try {
-//            $data = (new SaasUserOpen)->whereNotNull("oid")->whereDay("update_at",'yesterday')->select();
-            $data = (new SaasUserOpen)->whereNotNull("oid")->whereDay("update_at")->select();
-            if ($data->isEmpty()) return error("ok");
-            $userData = [];
-            foreach ($data as $key=>$val) {
-                if (!empty($val['oid'])) {
-                    $old = Db::connect("old")->table("inmei_member_card")->where("openid",$val['oid'])->find();
-                    if (!empty($old)) {
-                        $shopId = $old['shop_id'];
-                        if (isset($this->whiteShop[$old['shop_id']])) {
-                            $shopId = $this->whiteShop[$old['shop_id']];
-                        }
-                        $card = (new SaasUser)->where("openid",$val['openid'])->findOrEmpty();
-                        if ($card->isEmpty()) {
-                            $userData[$key] = [
-                                "openid"        => $val['openid'],
-                                "shop_id"       => $shopId,
-                                "card_no"       => strtoupper(md5($val['openid'].$shopId)),
-                                "balance"       => $old['balance'],
-                                "total_balance" => $old['total_balance'],
-                                "remark"        => "迁移,原ID:{$old['openid']}",
-                            ];
-                        }
-                    }
-                }
-            }
-            if (!empty($userData)) {
-                (new SaasUser)->insertAll($userData);
-            }
-            return success("ok",array_values($userData));
-        } catch (\Throwable $throwable) {
-            echo $throwable->getLine()."\n";
-            return error($throwable->getMessage());
-        }
-    }
-    
-    #[Route(path: "tid",methods: "get")]
-    public function testDataId(Request $request): \support\Response
-    {
-        try {
-            $id = $request->get("id",16992);
-            Redis::send("push-print",['type' => 'id' , 'order' => $id]);
-            return success("ok");
-        } catch (\Throwable $throwable) {
-            echo $throwable->getLine()."\n";
-            return error($throwable->getMessage());
-        }
-    }
-
-}

+ 25 - 21
app/controller/api/User.php

@@ -4,9 +4,8 @@ namespace app\controller\api;
 
 use app\extra\basic\Base;
 use app\middleware\WxMiddleware;
-use app\model\saas\SaasPrice;
-use app\model\saas\SaasUser;
-use app\model\saas\SaasUserOpen;
+use app\model\blue\BlueUserOpen;
+use DI\Attribute\Inject;
 use LinFly\Annotation\Route\Controller;
 use LinFly\Annotation\Route\Route;
 use LinFly\Annotation\Route\Middleware;
@@ -18,31 +17,36 @@ use support\Response;
 class User extends Base
 {
 
-    protected array $color = ["1" => "彩色", "2" => "黑白"];
-
-    protected array $duplex = ["1" => "单面", "2" => "双面"];
-
-    protected array $type = ["1" => "文档", "2" => "复印"];
+    #[Inject]
+    protected BlueUserOpen $model;
 
     #[Route(path: "data",methods: "get")]
     public function getUserData(Request $request): Response
     {
         try {
-            $param = $this->_valid([
-                "shop.require"  => trans("empty.require"),
-            ],$request->method());
-            if (!is_array($param)) return error($param);
             $user = $request->user;
             if (empty($user)) return errorTrans("empty.data");
-
-            $member = (new SaasUserOpen)->where("openid",$user['openid'])->field("openid,headimg,nickname")->append(["coupon"])->withAttr(['coupon' => function(){
-                return 0;
-            }])->findOrEmpty();
-            $memberUser = (new SaasUser)->where(['shop_id' => $param['shop'],'openid' => $user['openid']])->field("openid,ROUND(balance/100,2) as f_balance,ROUND(total_balance/100,2) as f_total_balance,ROUND(total_consume/100,2) as f_total_consume,card_no")->findOrEmpty();
-            $member['vip'] = [
-                "f_balance"         => $memberUser['f_balance']??'0.00',
-                "f_total_consume"   => $memberUser['f_total_balance']??'0.00',
-            ];
+            $member = $this->model->where("openid",$user['openid'])->field("openid,headimg,nickname")
+                ->append(["withdraw",'day','mon','bonus','task','sign','level','dy_level'])
+                ->withAttr(['withdraw' => function(){
+                        return 0; // 可提现金额
+                    },'day' => function(){
+                        return 0; // 今日佣金
+                    },'mon' => function(){
+                        return 0; // 本月佣金
+                    },'bonus' => function(){
+                        return 0; // 已获得奖金
+                    },'task' => function(){
+                        return 0; // 已接任务
+                    },'sign' => function(){
+                        return 0; // 0未签约,1已签约
+                    },'level' => function(){
+                        return 0; // 平台等级
+                    },'dy_level' => function(){
+                        return 0; // 抖音等级
+                    }
+                ])
+                ->findOrEmpty();
             return success("ok",$member->toArray());
         } catch (\Throwable $th) {
             return error($th->getMessage());

+ 0 - 158
app/extra/jhfPay/Pay.php

@@ -1,158 +0,0 @@
-<?php
-
-namespace app\extra\jhfPay;
-
-use yzh52521\EasyHttp\Http;
-
-class Pay
-{
-
-    protected string $gateway = "https://payapi.juhefu.com/";
-
-    protected array $config = [];
-
-    public function config(array $config = [])
-    {
-        $this->config = $config;
-        return $this;
-    }
-
-    /**
-     * 分账完之后立马提现
-     * @param array $param
-     * @return array
-     */
-    public function createBalanceWithdraw(array $param = []): array
-    {
-        return $this->paramData($param,"api/member/balance_withdraw_a");
-    }
-
-    /**
-     * 基于余额分账
-     * @param array $param
-     * @return array
-     */
-    public function createBalancePay(array $param = []): array
-    {
-        return $this->paramData($param,"api/account/balance_pay");
-    }
-
-    /**
-     * 绑定用户结算卡
-     * @param array $param
-     * @return array
-     */
-    public function createMember(array $param = []): array
-    {
-        return $this->paramData($param,"api/member/create_user_a");
-    }
-
-    /**
-     * 更新结算卡信息
-     * @param array $param
-     * @return array
-     */
-    public function updateMember(array $param = []): array
-    {
-        return $this->paramData($param,"api/member/update_account_a");
-    }
-
-    /**
-     * 账户可用余额查询
-     * @param array $param
-     * @return array [balance,freeze_balance,divide_balance,total]
-     */
-    public function getBalance(array $param = []): array
-    {
-        return $this->paramData($param,"api/member/balance_query_a");
-    }
-
-    /**
-     * 创建支付
-     * @param array $param
-     * @return array
-     */
-    public function createPay(array $param = []): array
-    {
-        return $this->paramData($param,"api/payment/create_payment");
-    }
-
-
-    /**
-     * 创建退款
-     * @param array $param
-     * @return array
-     */
-    public function createRefund(array $param = []): array
-    {
-        return $this->paramData($param,"api/payment/payment_refund");
-    }
-
-    protected function paramData(array $param = [],string $url = ""): array
-    {
-        //转为json格式业务报文
-        $encryptData = json_encode($param, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
-        //对业务报文进行aes加密
-        $reqCipher = Utils::aes_encrypt($encryptData, $this->config['aeskey']);
-        //报文拼接签名字符串并进行SHA256withRSA签名
-        $param = $this->nestedSort($param);
-        $signData = Json_encode($param,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
-        $signData = Utils::rsa_sign($signData, $this->config['prikey']);
-        $time = microtime(true);
-        $timestamp = (int)$time; // 整数部分为时间戳
-        $microseconds = ($time - $timestamp) * 1000; // 小数部分转换为毫秒
-        $formattedTime = date("YmdHis", $timestamp) . sprintf('%03d', $microseconds);
-        $post_data = [
-            "merId"     => $this->config['mch_id'],
-            "sign"      => $signData,
-            "reqCipher" => $reqCipher,
-            "reqTime"   => $formattedTime
-        ];
-        $resp = Http::asJson()->post($this->gateway.$url,$post_data)->array();
-        if (array_key_exists("error_msg", $resp)) //失败
-        {
-            return ['code' => 0,"error_code"=>$resp["error_code"], "error_msg"=>$resp["error_msg"]];
-        }
-        $resCipher = Utils::aes_decrypt($resp['resCipher'], $this->config['aeskey']);
-        // 返回 [expend][pay_info]
-        return json_decode($resCipher,true);
-    }
-
-    /**
-     * @param $array
-     * @return array
-     */
-    protected function ksort_recursive(&$array): array
-    {
-        // 先对当前层数组按键名排序
-        ksort($array);
-        // 遍历数组中的每个元素
-        foreach ($array as &$value) {
-            // 如果元素是数组,递归调用排序函数
-            if (is_array($value)) {
-                $this->ksort_recursive($value);
-            }
-        }
-        unset($value); // 解除引用
-    }
-
-    /**
-     * 对多维数组进行递归字母顺序排序(每层按键名排序)
-     *
-     * @param array $array 待排序的数组
-     * @return array 排序后的数组
-     */
-    protected function nestedSort(array $array): array
-    {
-        // 对当前层的键进行排序
-        ksort($array);
-        // 递归处理子数组
-        foreach ($array as $key => &$value) {
-            if (is_array($value)) {
-                $value = $this->nestedSort($value);
-            }
-        }
-        return $array;
-    }
-
-}

+ 0 - 134
app/extra/jhfPay/Utils.php

@@ -1,134 +0,0 @@
-<?php
-
-namespace app\extra\jhfPay;
-
-use InvalidArgumentException;
-use RuntimeException;
-
-class Utils
-{
-    /**
-     * AES加密函数(ECB模式,32位密钥)
-     *
-     * @param string $plaintext 待加密的明文
-     * @param string $key 32字节(256位)密钥
-     * @return string 加密后的Base64编码字符串
-     */
-    public static function aes_encrypt($plaintext, $key) {
-        // 验证密钥长度(32字节 = 256位)
-        if (strlen($key) !== 32) {
-            throw new InvalidArgumentException('密钥长度必须为32字节');
-        }
-
-        // 执行加密(ECB模式,PKCS#7填充)
-        $ciphertext = openssl_encrypt(
-            $plaintext,
-            'AES-256-ECB',
-            $key,
-            OPENSSL_RAW_DATA
-        );
-
-        // 返回Base64编码结果
-        return base64_encode($ciphertext);
-    }
-
-    /**
-     * AES解密函数(ECB模式,32位密钥)
-     *
-     * @param string $ciphertext 待解密的Base64编码密文
-     * @param string $key 32字节(256位)密钥
-     * @return string 解密后的明文
-     */
-    public static function aes_decrypt($ciphertext, $key) {
-        // 验证密钥长度(32字节 = 256位)
-        if (strlen($key) !== 32) {
-            throw new InvalidArgumentException('密钥长度必须为32字节');
-        }
-
-        // 解码Base64密文
-        $ciphertext = base64_decode($ciphertext);
-
-        // 执行解密(ECB模式,PKCS#7填充)
-        return openssl_decrypt(
-            $ciphertext,
-            'AES-256-ECB',
-            $key,
-            OPENSSL_RAW_DATA
-        );
-    }
-
-    /**
-     * RSA签名函数(SHA256withRSA,1024位密钥)
-     *
-     * @param string $data 待签名的数据
-     * @param string $privateKeyText 私钥纯文本内容(不带PEM头和尾)
-     * @return string 签名后的Base64编码字符串
-     */
-    public static function rsa_sign(string $data, string $privateKeyText): string
-    {
-
-        // 将纯文本私钥转换为PEM格式
-        $privateKeyPem = "-----BEGIN PRIVATE KEY-----\n" .
-            chunk_split($privateKeyText, 64, "\n") .
-            "-----END PRIVATE KEY-----";
-        // 创建私钥资源
-        $privateKeyResource = openssl_pkey_get_private($privateKeyPem);
-        if (!$privateKeyResource) {
-            throw new InvalidArgumentException('私钥格式错误: ' . openssl_error_string());
-        }
-        // 生成签名(SHA256withRSA)
-        $success = openssl_sign($data, $signature, $privateKeyResource, OPENSSL_ALGO_SHA256);
-        // 释放资源
-        unset($privateKey);
-//        openssl_free_key($privateKeyResource);
-
-        if (!$success) {
-            throw new RuntimeException('签名失败: ' . openssl_error_string());
-        }
-
-        // 返回Base64编码的签名
-        return base64_encode($signature);
-    }
-
-    /**
-     * RSA验签函数(SHA256withRSA,1024位密钥)
-     *
-     * @param string $data 原始数据
-     * @param string $signature 签名的Base64编码字符串
-     * @param string $publicKeyText 公钥纯文本内容(不带PEM头和尾)
-     * @return bool 验签结果
-     */
-    public static function rsa_verify(string $data, string $signature, string $publicKeyText): bool
-    {
-        // 将纯文本公钥转换为PEM格式
-        $publicKeyPem = "-----BEGIN PUBLIC KEY-----\n" .
-            chunk_split($publicKeyText, 64, "\n") .
-            "-----END PUBLIC KEY-----";
-
-        // 创建公钥资源
-        $publicKeyResource = openssl_pkey_get_public($publicKeyPem);
-
-        if (!$publicKeyResource) {
-            throw new InvalidArgumentException('公钥格式错误: ' . openssl_error_string());
-        }
-
-        // 解码Base64签名
-        $signature = base64_decode($signature);
-
-        // 验证签名(SHA256withRSA)
-        $result = openssl_verify($data, $signature, $publicKeyResource, OPENSSL_ALGO_SHA256);
-
-        // 释放资源
-        openssl_free_key($publicKeyResource);
-
-        // 返回验证结果(1=成功,0=失败,-1=错误)
-        if ($result === 1) {
-            return true;
-        } elseif ($result === 0) {
-            return false;
-        } else {
-            throw new RuntimeException('验签过程发生错误: ' . openssl_error_string());
-        }
-    }
-
-}

+ 0 - 36
app/extra/service/saas/ComboLogService.php

@@ -1,36 +0,0 @@
-<?php
-
-namespace app\extra\service\saas;
-
-use app\extra\basic\Service;
-use app\model\saas\SaasComboLog;
-
-class ComboLogService extends Service
-{
-
-
-    /**
-     * 列表
-     * @param array $param
-     */
-    public function getList(array $param = [])
-    {
-        $this->mode = new SaasComboLog();
-        return $this->searchVal($param,$this->searchFilter($param))->paginate([
-            "list_rows" => $param['pageSize'],
-            "page"      => $param['page']
-        ]);
-    }
-
-
-
-    protected function searchFilter(array $param = []): array
-    {
-        $filter = [];
-        !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
-        !empty($param['shop']) && $filter[] = ["shop_id", '=', $param['shop']];
-        !empty($param['name']) && $filter[] = ["name", 'like', "%{$param['name']}%"];
-        return $filter;
-    }
-
-}

+ 0 - 35
app/extra/service/saas/ComboService.php

@@ -1,35 +0,0 @@
-<?php
-
-namespace app\extra\service\saas;
-
-use app\extra\basic\Service;
-use app\model\saas\SaasCombo;
-
-class ComboService extends Service
-{
-
-    /**
-     * 列表
-     * @param array $param
-     */
-    public function getList(array $param = [])
-    {
-        $this->mode = new SaasCombo();
-        return $this->searchVal($param,$this->searchFilter($param))->paginate([
-            "list_rows" => $param['pageSize'],
-            "page"      => $param['page']
-        ]);
-    }
-
-
-
-    protected function searchFilter(array $param = []): array
-    {
-        $filter = [];
-        !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
-        !empty($param['name']) && $filter[] = ["name", 'like', "%{$param['name']}%"];
-        !empty($param['type']) && $filter[] = ["type", '=', $param['type']];
-        return $filter;
-    }
-
-}

+ 0 - 34
app/extra/service/saas/DisCountService.php

@@ -1,34 +0,0 @@
-<?php
-
-namespace app\extra\service\saas;
-
-use app\extra\basic\Service;
-use app\model\saas\SaasDiscount;
-
-class DisCountService extends Service
-{
-
-    /**
-     * 列表
-     * @param array $param
-     */
-    public function getList(array $param = [])
-    {
-        $this->mode = new SaasDiscount();
-        return $this->searchVal($param,$this->searchFilter($param))->paginate([
-            "list_rows" => $param['pageSize'],
-            "page"      => $param['page']
-        ]);
-    }
-
-    protected function searchFilter(array $param = []): array
-    {
-        $filter = [];
-        !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
-        !empty($param['name']) && $filter[] = ["name", 'like', "%{$param['name']}%"];
-        !empty($param['shop']) && $filter[] = ["shop_id", '=', $param['shop']];
-        return $filter;
-    }
-
-
-}

+ 0 - 36
app/extra/service/saas/MemberLogService.php

@@ -1,36 +0,0 @@
-<?php
-
-namespace app\extra\service\saas;
-
-use app\extra\basic\Service;
-use app\model\saas\SaasUserLog;
-
-class MemberLogService extends Service
-{
-
-    /**
-     * 列表
-     * @param array $param
-     */
-    public function getList(array $param = [])
-    {
-        $this->mode = new SaasUserLog();
-        return $this->searchVal($param,$this->searchFilter($param))->paginate([
-            "list_rows" => $param['pageSize'],
-            "page"      => $param['page']
-        ]);
-    }
-
-
-    protected function searchFilter(array $param = []): array
-    {
-        $filter = [];
-        !empty($param['type']) && $filter[] = ["type", '=', $param['type']];
-        !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
-        !empty($param['statusGt']) && $filter[] = ["status", '>', ($param['statusGt']-1)];
-        !empty($param['orderid']) && $filter[] = ["card_no", 'like', "%{$param['orderid']}%"];
-        !empty($param['shop']) && $filter[] = ["shop_id", '=', $param['shop']];
-        return $filter;
-    }
-
-}

+ 0 - 68
app/extra/service/saas/MemberService.php

@@ -1,68 +0,0 @@
-<?php
-
-namespace app\extra\service\saas;
-
-use app\extra\basic\Service;
-use app\model\saas\SaasUser;
-use app\model\saas\SaasUserBuy;
-
-class MemberService extends Service
-{
-
-
-    /**
-     * 列表
-     * @param array $param
-     */
-    public function getList(array $param = [])
-    {
-        $this->mode = new SaasUser();
-        return $this->searchVal($param,$this->searchFilter($param))->with(['shop'])->paginate([
-            "list_rows" => $param['pageSize'],
-            "page"      => $param['page']
-        ]);
-    }
-
-
-    /**
-     * @param array $param
-     * @return array
-     */
-    public function getMpTotal(array $param = []): array
-    {
-        $this->mode = new SaasUser();
-        $commonFilter = [];
-        $filter = $this->searchFilter($param);
-        // 起止时间
-        if (!empty($param['create'])) {
-            $times = between_time($param['create']);
-            $start = date('Y-m-d',$times['start_time']);
-            $end = date('Y-m-d',($times['end_time'] + 86400));
-            $commonFilter[] = ['create_at', '>=', $start ];
-            $commonFilter[] = ['create_at', '<', $end ];
-        }
-        $filter = array_merge($filter,$commonFilter);
-        $userTotal = $this->mode->field("count(1) as number,sum(balance) as total")->where($filter)->findOrEmpty();
-        $filter[] = ['status','=',1];
-        $buyTotal = (new SaasUserBuy)->field("count(1) as number,sum(money) as total")->where($filter)->findOrEmpty();
-        return [
-            "user"          => $userTotal['number'],
-            "userMoney"     => $userTotal['total'],
-            "recharge"      => $buyTotal['number'],
-            "rechargeMoney" => $buyTotal['total'],
-        ];
-    }
-
-
-    protected function searchFilter(array $param = []): array
-    {
-        $filter = [];
-        !empty($param['type']) && $filter[] = ["type", '=', $param['type']];
-        !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
-        !empty($param['statusGt']) && $filter[] = ["status", '>', ($param['statusGt']-1)];
-        !empty($param['orderid']) && $filter[] = ["card_no", 'like', "%{$param['orderid']}%"];
-        !empty($param['shop']) && $filter[] = ["shop_id", '=', $param['shop']];
-        return $filter;
-    }
-
-}

+ 0 - 121
app/extra/service/saas/OrderService.php

@@ -1,121 +0,0 @@
-<?php
-
-namespace app\extra\service\saas;
-
-use app\extra\basic\Service;
-use app\model\saas\SaasOrder;
-use app\model\saas\SaasOrderQrcode;
-use app\model\saas\SaasUserBuy;
-
-class OrderService extends Service
-{
-
-
-    /**
-     * 列表
-     * @param array $param
-     */
-    public function getList(array $param = [])
-    {
-        $this->mode = new SaasOrder();
-        return $this->searchVal($param,$this->searchFilter($param))->field("*")->with(['detail','shop' => function($query){
-            $query->field("shop_id,shop_name");
-        }])->paginate([
-            "list_rows" => $param['pageSize'],
-            "page"      => $param['page']
-        ]);
-    }
-
-    public function getTotal(array $param = []): array
-    {
-        $this->mode = new SaasOrder();
-        $total = ['t0' => 0, 't1' => 0, 't2' => 0, 't3' => 0, 't4' => 0, 't5' => 0, 't6' => 0, 'ta' => 0];
-        $where = [];
-        if (!empty($param['shop'])) {
-            $where[] = ['shop_id','=',$param['shop']];
-        }
-        $where[] = ['status',">",0];
-        foreach ($this->searchVal($param,$where)->field('create_at,status,count(1) total')->group('status,create_at')->cursor() as $vo)
-        {
-            [$total["t{$vo['status']}"] += $vo['total'], $total['ta'] += $vo['total']];
-        }
-        return $total;
-    }
-
-    /**
-     * 手机端
-     * @param array $param
-     * @return int[]
-     */
-    public function getTotalDate(array $param = []): array
-    {
-        $this->mode = new SaasOrder();
-        $commonFilter = [];
-        $filter = $this->searchFilter($param);
-        // 起止时间
-        if (!empty($param['create'])) {
-            $times = between_time($param['create']);
-            $start = date('Y-m-d',$times['start_time']);
-            $end = date('Y-m-d',($times['end_time'] + 86400));
-            $commonFilter[] = ['create_at', '>=', $start ];
-            $commonFilter[] = ['create_at', '<', $end ];
-        }
-        $filter = array_merge($filter,$commonFilter);
-        $total = ['ta' => 0,'t0' => 0, 't1' => 0, 't2' => 0, 't3' => 0, 't4' => 0, 't5' => 0, 't6' => 0, 'tm' => 0, 'p1' => 0, 'p2' => 0, 'p1m' => 0, 'p2m' => 0];
-        foreach ($this->mode->where($filter)->whereIn("status",[1,2,3])->field('create_at,pay_type,status,sum(discount) as money,count(1) as total')->group('status,create_at,pay_type')->cursor() as $vo)
-        {
-            $total["t{$vo['status']}"] += $vo['total'];
-            $total['ta'] += $vo['total'];
-            $total['tm'] += $vo['money'];
-            if ($vo['pay_type'] == 1) {
-                $total["p1"] += $vo['total'];
-                $total["p1m"] += $vo['money'];
-            }
-            if ($vo['pay_type'] == 2) {
-                $total["p2"] += $vo['total'];
-                $total["p2m"] += $vo['money'];
-            }
-        }
-        $filter[] = ['status','=',1];
-        $qrcode = (new SaasOrderQrcode)->where($filter)->field("sum(money) as money,count(1) as total")->find();
-        $card = (new SaasUserBuy)->where($filter)->field("sum(money) as money,count(1) as total")->find();
-        return compact("total",'qrcode','card');
-    }
-
-
-    public function getTotalToday(array $param = []): array
-    {
-        $this->mode = new SaasOrder();
-        $total = ['ta' => 0,'t0' => 0, 't1' => 0, 't2' => 0, 't3' => 0, 't4' => 0, 't5' => 0, 't6' => 0, 'tm' => 0, 'p1' => 0, 'p2' => 0, 'p1m' => 0, 'p2m' => 0];
-        $where = [];
-        if (!empty($param['shop'])) {
-            $where[] = ['shop_id','=',$param['shop']];
-        }
-        foreach ($this->mode->whereDay("create_at")->where($where)->whereIn("status",[1,2,3])->field('create_at,pay_type,status,sum(discount) as money,count(1) as total')->group('status,create_at,pay_type')->cursor() as $vo)
-        {
-            $total["t{$vo['status']}"] += $vo['total'];
-            $total['ta'] += $vo['total'];
-            $total['tm'] += $vo['money'];
-            if ($vo['pay_type'] == 1) {
-                $total["p1"] += $vo['total'];
-                $total["p1m"] += $vo['money'];
-            }
-            if ($vo['pay_type'] == 2) {
-                $total["p2"] += $vo['total'];
-                $total["p2m"] += $vo['money'];
-            }
-        }
-        return $total;
-    }
-
-    protected function searchFilter(array $param = []): array
-    {
-        $filter = [];
-        !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
-        !empty($param['statusGt']) && $filter[] = ["status", '>', ($param['statusGt']-1)];
-        !empty($param['orderid']) && $filter[] = ["order_sn", 'like', "%{$param['orderid']}%"];
-        !empty($param['shop']) && $filter[] = ["shop_id", '=', $param['shop']];
-        return $filter;
-    }
-
-}

+ 0 - 34
app/extra/service/saas/PriceService.php

@@ -1,34 +0,0 @@
-<?php
-
-namespace app\extra\service\saas;
-
-use app\extra\basic\Service;
-use app\model\saas\SaasPrice;
-
-class PriceService extends Service
-{
-
-    /**
-     * 列表
-     * @param array $param
-     */
-    public function getList(array $param = [])
-    {
-        $this->mode = new SaasPrice();
-        return $this->searchVal($param,$this->searchFilter($param))->paginate([
-            "list_rows" => $param['pageSize'],
-            "page"      => $param['page']
-        ]);
-    }
-
-    protected function searchFilter(array $param = []): array
-    {
-        $filter = [];
-        !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
-        !empty($param['name']) && $filter[] = ["name", 'like', "%{$param['name']}%"];
-        !empty($param['type']) && $filter[] = ["type", '=', $param['type']];
-        !empty($param['shop']) && $filter[] = ["shop_id", '=', $param['shop']];
-        return $filter;
-    }
-
-}

+ 0 - 35
app/extra/service/saas/PrintService.php

@@ -1,35 +0,0 @@
-<?php
-
-namespace app\extra\service\saas;
-
-use app\extra\basic\Service;
-use app\model\saas\SaasPrintClient;
-
-class PrintService extends Service
-{
-
-    /**
-     * 列表
-     * @param array $param
-     */
-    public function getList(array $param = [])
-    {
-        $this->mode = new SaasPrintClient();
-        return $this->searchVal($param,$this->searchFilter($param))->paginate([
-            "list_rows" => $param['pageSize'],
-            "page"      => $param['page']
-        ]);
-    }
-
-
-
-    protected function searchFilter(array $param = []): array
-    {
-        $filter = [];
-        !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
-        !empty($param['name']) && $filter[] = ["name", 'like', "%{$param['name']}%"];
-        !empty($param['shop']) && $filter[] = ["shop_id", '=', $param['shop']];
-        return $filter;
-    }
-
-}

+ 0 - 50
app/extra/service/saas/QrcodeService.php

@@ -1,50 +0,0 @@
-<?php
-
-namespace app\extra\service\saas;
-
-use app\extra\basic\Service;
-use app\model\saas\SaasOrderQrcode;
-
-class QrcodeService extends Service
-{
-
-
-    /**
-     * 列表
-     * @param array $param
-     */
-    public function getList(array $param = [])
-    {
-        $this->mode = new SaasOrderQrcode();
-        return $this->searchVal($param,$this->searchFilter($param))->with(['shop' => function($query){
-            $query->field("shop_id,shop_name");
-        }])->paginate([
-            "list_rows" => $param['pageSize'],
-            "page"      => $param['page']
-        ]);
-    }
-    public function getTotal(array $param = []): array
-    {
-        $this->mode = new SaasOrderQrcode();
-        $total = ['t0' => 0, 't1' => 0, 'ta' => 0];
-        foreach ($this->searchVal($param,[['status',">",0]])->field('create_at,status,count(1) total')->group('status,create_at')->cursor() as $vo)
-        {
-            [$total["t{$vo['status']}"] += $vo['total'], $total['ta'] += $vo['total']];
-        }
-        return $total;
-    }
-
-
-    protected function searchFilter(array $param = []): array
-    {
-        $filter = [];
-        !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
-        !empty($param['statusGt']) && $filter[] = ["status", '>', ($param['statusGt']-1)];
-        !empty($param['orderid']) && $filter[] = ["order_sn", 'like', "%{$param['orderid']}%"];
-        !empty($param['shop']) && $filter[] = ["shop_id", '=', $param['shop']];
-        return $filter;
-    }
-
-
-
-}

+ 0 - 36
app/extra/service/saas/ShopLogService.php

@@ -1,36 +0,0 @@
-<?php
-
-namespace app\extra\service\saas;
-
-use app\extra\basic\Service;
-use app\model\saas\SaasShopLog;
-
-class ShopLogService extends Service
-{
-
-
-    /**
-     * 列表
-     * @param array $param
-     */
-    public function getList(array $param = [])
-    {
-        $this->mode = new SaasShopLog();
-        return $this->searchVal($param,$this->searchFilter($param))->paginate([
-            "list_rows" => $param['pageSize'],
-            "page"      => $param['page']
-        ]);
-    }
-
-
-
-    protected function searchFilter(array $param = []): array
-    {
-        $filter = [];
-        !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
-        !empty($param['shop']) && $filter[] = ["shop_id", '=', $param['shop']];
-        !empty($param['type']) && $filter[] = ["type", '=', $param['type']];
-        return $filter;
-    }
-
-}

+ 0 - 38
app/extra/service/saas/ShopService.php

@@ -1,38 +0,0 @@
-<?php
-
-namespace app\extra\service\saas;
-
-use app\extra\basic\Service;
-use app\model\saas\SaasAgent;
-use app\model\saas\SaasShop;
-
-class ShopService extends Service
-{
-
-    /**
-     * 列表
-     * @param array $param
-     */
-    public function getList(array $param = [])
-    {
-        $this->mode = new SaasShop();
-        return $this->searchVal($param,$this->searchFilter($param))->where("is_deleted",0)->paginate([
-            "list_rows" => $param['pageSize'],
-            "page"      => $param['page']
-        ]);
-    }
-
-
-
-    protected function searchFilter(array $param = []): array
-    {
-        $filter = [];
-        !empty($param['agent']) && $filter[] = ["agent_id", '=', $param['agent']];
-        !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
-        !empty($param['type']) && $filter[] = ["store_type", '=', $param['type']];
-        !empty($param['name']) && $filter[] = ["shop_name", 'like', "%{$param['name']}%"];
-        !empty($param['poi']) && $filter[] = ["poi_id", 'like', "%{$param['poi']}%"];
-        return $filter;
-    }
-
-}

+ 31 - 0
app/extra/service/system/DicService.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace app\extra\service\system;
+
+use app\extra\basic\Service;
+use app\model\system\SystemData;
+
+class DicService extends Service
+{
+
+
+    /**
+     * @param array $param
+     * @return array
+     */
+    public function getMenuList(array $param = []): array
+    {
+        $model = new SystemData();
+        try {
+            if (!empty($param['dicId'])) {
+                $data = $model->where("id",$param['dicId'])->findOrEmpty();
+            } else {
+                $data = $model->select();
+            }
+        } catch (\Throwable $throwable) {
+            return [];
+        }
+        return $data->isEmpty()?[]:$data->toArray();
+    }
+
+}

+ 0 - 1
app/extra/service/system/MenuService.php

@@ -3,7 +3,6 @@
 namespace app\extra\service\system;
 
 use app\extra\basic\Service;
-use app\model\inmei\InmeiMenu;
 use app\model\system\SystemMenu;
 
 class MenuService extends Service

+ 0 - 35
app/extra/service/system/MoneyLogService.php

@@ -1,35 +0,0 @@
-<?php
-
-namespace app\extra\service\system;
-
-use app\extra\basic\Service;
-use app\model\system\SystemUserMoney;
-
-class MoneyLogService extends Service
-{
-
-    /**
-     * 列表
-     * @param array $param
-     */
-    public function getList(array $param = [])
-    {
-        $this->mode = new SystemUserMoney();
-        return $this->searchVal($param,$this->searchFilter($param))->paginate([
-            "list_rows" => $param['pageSize'],
-            "page"      => $param['page']
-        ]);
-    }
-
-
-
-    protected function searchFilter(array $param = []): array
-    {
-        $filter = [];
-        !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
-        !empty($param['shop']) && $filter[] = ["agent_id", '=', $param['shop']];
-        !empty($param['name']) && $filter[] = ["name", 'like', "%{$param['name']}%"];
-        return $filter;
-    }
-
-}

+ 42 - 0
app/model/blue/BlueArticle.php

@@ -0,0 +1,42 @@
+<?php
+
+namespace app\model\blue;
+
+use app\extra\basic\Model;
+
+
+/**
+ * @property integer $id (主键)
+ */
+class BlueArticle 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 = "blue_article";
+    
+    /**
+     * 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;
+
+
+}

+ 48 - 0
app/model/blue/BlueCategory.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace app\model\blue;
+
+use app\extra\basic\Model;
+
+
+/**
+ * @property integer $id (主键)
+ * @property string $name 名称
+ * @property string $icon 普通图标
+ * @property string $small_icon 小图标
+ * @property integer $sort 排序
+ * @property integer $type 1任务2文章
+ * @property mixed $create_at 创建时间
+ */
+class BlueCategory 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 = "blue_category";
+    
+    /**
+     * 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;
+
+
+}

+ 50 - 0
app/model/blue/BlueTask.php

@@ -0,0 +1,50 @@
+<?php
+
+namespace app\model\blue;
+
+use app\extra\basic\Model;
+
+
+/**
+ * @property integer $id (主键)
+ * @property integer $category_id 
+ * @property string $title 
+ * @property mixed $banner 
+ * @property integer $need_num 招募名额
+ * @property integer $user_num 报名人数
+ * @property integer $sale_price 产品售价
+ * @property integer $req_user_level 
+ * @property integer $req_dy_level
+ */
+class BlueTask 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 = "blue_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;
+
+
+}

+ 45 - 0
app/model/blue/BlueUserOpen.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace app\model\blue;
+
+use app\extra\basic\Model;
+
+
+/**
+ * @property integer $id (主键)
+ * @property mixed $openid 
+ * @property string $nickname 
+ * @property mixed $create_at 创建时间
+ */
+class BlueUserOpen 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 = "blue_user_open";
+    
+    /**
+     * 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;
+
+
+}

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

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