_valid([ "order.require" => trans("empty.require"), ],$request->method()); if (!is_array($param)) return error($param); $data = (new PlanLive)->config([ "appid" => sConf("wechat.mini_appid"), "secret" => sConf("wechat.mini_secret"), ])->token()->planOrder($param['order']); return success('success',$data); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } #[PostMapping("spi")] public function getLifeSpi(Request $request): Response { try { $param = $request->all(); echo getDateFull()."===自研应用回调===\n"; print_r($param); return error("ddd"); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } #[PostMapping("hook")] public function getLifeHook(Request $request): Response { try { $data = $request->all(); echo getDateFull()."===自研应用回调WebHook===\n"; print_r($data); if (isset($data['event']) && $data['event'] == "verify_webhook") { return json(['challenge' => $data['content']['challenge']]); } $content = json_decode($data['content'],true); switch ($data['event']) { case "life_product_status_change": // 商品状态变化 if (in_array($content['status'],['GOODS_OFFLINE','GOODS_BAN','GOODS_DELETE'])) { // 商品下架 (new SaasGoods)->where("goods_id",$content['product_id'])->update(['status' => 3]); } break; default: break; } return error("ddd"); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } #[PostMapping("mini")] public function getMiniHook(Request $request): Response { try { $data = $request->all(); echo getDateFull()."===小程序WebHook===\n"; print_r($data); if (isset($data['event']) && $data['event'] == "verify_webhook") { return json(['challenge' => $data['content']['challenge']]); } return error("ddd"); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } }