package controller import ( "ElectronicInvoice/internal/service" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "strings" ) // CallBack 回调 func CallBack(r *ghttp.Request) { err := func() error { callType := r.Get("calltype").String() if g.Cfg().MustGet(r.Context(), "reqDebug", false).Bool() { g.Log().Infof(r.Context(), "%s\ncallType: %s\ncallBack: %s", strings.Repeat("=", 50), callType, string(r.GetBody())) } switch callType { case "userQuit": //用户退出登录 g.Log().Info(r.Context(), "长在线退出登录") case "Invoicing": //开发票回调 return service.InvoicingCallBackLogic(r) case "InvoicingAll": //批量开票 g.Log().Info(r.Context(), "用户退出登录") case "Offset": g.Log().Info(r.Context(), "开红票:%s") case "livenessDetection": g.Log().Info(r.Context(), "活体认证:%s") default: g.Log().Infof(r.Context(), "未设置消息回调:%s", callType) } return nil }() if err != nil { g.Log().Errorf(r.Context(), "回调异常:%v", err) return } r.Response.WriteJson(g.MapStrStr{"code": "200"}) } //callbak = logging