get(); $param['shop'] = $request->user['shop_id']; $data = $this->service->getMpTotal($param); return success("ok",$data); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } #[Route(path: "list",methods: "get")] public function getMemberList(Request $request): Response { try { $param = $request->get(); if (empty($param['shop'])) { $param['shop'] = $request->user['shop_id']; } $list = $this->service->getList($param); return successTrans("success.data",pageFormat($list),200); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } #[Route(path: "combo",methods: "get")] public function getComboDetail(Request $request): Response { try { $shop = (new SaasShop)->where("shop_id",$request->user['shop_id'])->findOrEmpty(); $combo = (new SaasCombo)->where("type",2)->where("status",1)->field("id,name,ROUND(money/100,2) as money,ROUND(old_money/100,2) as old_money,is_first")->select(); $param = [ "state" => $shop['user_card'], // 1 默认 2 自定义 3关闭 "system" => $combo, "shop" => empty($shop['user_card_price']) ? $combo :$shop['user_card_price'] ]; return success("ok",$param); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } #[Route(path: "combo",methods: "post")] public function setCombo(Request $request): Response { try { $param = $request->post(); $shop = (new SaasShop)->where("shop_id",$request->user['shop_id'])->findOrEmpty(); $shop->user_card = $param['state']; if (isset($param['shop'])) { $shop->user_card_price = json_encode($param['shop']); } $state = $shop->save(); if (!$state) return errorTrans("error.data"); return successTrans("success.data"); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } /** * 钱包余额 * @param Request $request * @return Response */ #[Route(path: "wallet",methods: "get")] public function getWalletData(Request $request): Response { try { $detail = (new SaasShop)->where("shop_id",$request->user['shop_id'])->column("balance,total_balance"); if (!isset($detail[0])) return errorTrans("empty.data"); return success("ok",$detail[0]); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } }