修改了log
This commit is contained in:
parent
032730ba3e
commit
f5694cb227
@ -257,12 +257,13 @@ func (r *CouponService) ReceiveCoupon(req requestsV1.ReceiveCoupon) (g *dtoV1.Re
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 发送通知
|
||||
res, _ := service.PatientDistributeCoupon(coupon.CouponName, user.UserId)
|
||||
if !res {
|
||||
utils.LogJsonInfo("优惠卷通知发送失败")
|
||||
}
|
||||
|
||||
go func() {
|
||||
// 发送通知
|
||||
res, _ := service.PatientDistributeCoupon(coupon.CouponName, user.UserId)
|
||||
if !res {
|
||||
utils.LogJsonError("优惠卷通知发送失败")
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,9 +15,22 @@ func LogJsonInfo(v interface{}) {
|
||||
}
|
||||
|
||||
jsonString := string(jsonData)
|
||||
fmt.Println(jsonString)
|
||||
|
||||
global.Logger.WithFields(logrus.Fields{
|
||||
"data": jsonString,
|
||||
}).Info("info")
|
||||
}
|
||||
|
||||
func LogJsonError(v interface{}) {
|
||||
jsonData, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
fmt.Println("Error marshaling struct to JSON:", err)
|
||||
return
|
||||
}
|
||||
|
||||
jsonString := string(jsonData)
|
||||
|
||||
global.Logger.WithFields(logrus.Fields{
|
||||
"data": jsonString,
|
||||
}).Info("error")
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user