|
@@ -11,7 +11,10 @@ import (
|
|
|
// CallBack 回调
|
|
|
func CallBack(r *ghttp.Request) {
|
|
|
err := func() error {
|
|
|
- callType := r.Get("calltype").String()
|
|
|
+ var (
|
|
|
+ callType = r.Get("calltype").String()
|
|
|
+ ctx = r.Context()
|
|
|
+ )
|
|
|
if g.Cfg().MustGet(r.Context(), "reqDebug", false).Bool() {
|
|
|
g.Log().Infof(r.Context(), "%s\n接口回调 信息调试\ncallType: %s\ncallBack form: %+v", strings.Repeat("=", 50), callType, printFilter(r.Request.Form))
|
|
|
}
|
|
@@ -19,15 +22,15 @@ func CallBack(r *ghttp.Request) {
|
|
|
switch callType {
|
|
|
case "userQuit": //用户退出登录
|
|
|
service.JyInvoiceManager.Login = false
|
|
|
- g.Log().Info(r.Context(), "长在线退出登录")
|
|
|
+ g.Log().Info(ctx, "长在线退出登录")
|
|
|
case "Invoicing": //开发票回调
|
|
|
return service.InvoicingCallBackLogic(r)
|
|
|
case "InvoicingAll": //批量开票
|
|
|
- g.Log().Info(r.Context(), "用户退出登录")
|
|
|
+ g.Log().Info(ctx, "用户退出登录")
|
|
|
case "offset":
|
|
|
return service.InvoicingMakeRedCallBackLogic(r)
|
|
|
case "livenessDetection":
|
|
|
- g.Log().Info(r.Context(), "活体认证:%s")
|
|
|
+ g.Log().Info(ctx, "活体认证:%s")
|
|
|
case "login": //扫码登录回调
|
|
|
var flag bool
|
|
|
if r.Get("code").String() == "200" {
|
|
@@ -35,17 +38,21 @@ func CallBack(r *ghttp.Request) {
|
|
|
}
|
|
|
service.JyInvoiceManager.ScanLogin <- flag
|
|
|
case "quit":
|
|
|
- switch r.Get("taskType").String() {
|
|
|
+ t := r.Get("taskType").String()
|
|
|
+ switch t {
|
|
|
case "2": //电子发票开具
|
|
|
service.JyInvoiceManager.ReleasePool() //可进行下次开票请求
|
|
|
+ g.Log().Infof(ctx, "开具发票结束")
|
|
|
case "4": //活体认证
|
|
|
case "5": //验证电子税局登录授权
|
|
|
case "9": //红冲
|
|
|
service.JyInvoiceManager.ReleasePool() //可进行下次开票请求
|
|
|
+ g.Log().Infof(ctx, "发票冲红结束")
|
|
|
+ default:
|
|
|
+ g.Log().Infof(ctx, "未知回调任务退出 %d", t)
|
|
|
}
|
|
|
-
|
|
|
default:
|
|
|
- g.Log().Infof(r.Context(), "未设置消息回调:%s", callType)
|
|
|
+ g.Log().Infof(ctx, "未设置消息回调:%s", callType)
|
|
|
}
|
|
|
return nil
|
|
|
}()
|