// Code scaffolded by goctl. Safe to edit. // goctl 1.10.1 package callback import ( "net/http" "sundynix-micro-go/app/plant/api/internal/logic/callback" "sundynix-micro-go/app/plant/api/internal/svc" ) // 微信支付回调 // 注意:微信要求必须返回 200 OK,否则会持续重试,此处不走统一 response 包装 func WechatPayCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := callback.NewWechatPayCallbackLogic(r.Context(), svcCtx) if err := l.WechatPayCallback(r); err != nil { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusBadRequest) _, _ = w.Write([]byte(`{"code":"FAIL","message":"处理失败"}`)) return } w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) _, _ = w.Write([]byte(`{"code":"SUCCESS","message":"成功"}`)) } }