This commit is contained in:
ziming 2025-07-02 15:12:56 +08:00
parent 0a79405533
commit f7247315cf
3 changed files with 12 additions and 8 deletions

View File

@ -15,9 +15,9 @@ import (
"voucher/internal/biz/vo" "voucher/internal/biz/vo"
) )
func (this *VoucherBiz) Warning(ctx context.Context, batchNo string) error { func (this *VoucherBiz) Warning(ctx context.Context, id int32) error {
product, err := this.ProductRepo.GetByBatchNo(ctx, batchNo) product, err := this.ProductRepo.GetById(ctx, id)
if err != nil { if err != nil {
return err return err
} }

View File

@ -43,7 +43,7 @@ func NewHTTPServer(
srv.Route("/voucher/").POST("pushWechatQuery", cmb.PushWechatQuery) srv.Route("/voucher/").POST("pushWechatQuery", cmb.PushWechatQuery)
srv.Route("/voucher/").POST("timeSliceQueryPush", cmb.TimeSliceQueryPush) srv.Route("/voucher/").POST("timeSliceQueryPush", cmb.TimeSliceQueryPush)
srv.Route("/voucher/").POST("pushWechatRetry/{batch_no}", cmb.PushWechatRetry) srv.Route("/voucher/").POST("pushWechatRetry/{batch_no}", cmb.PushWechatRetry)
srv.Route("/voucher/").POST("warningBudget/{batch_no}", cmb.WarningBudget) srv.Route("/voucher/").POST("warningBudget/{id}", cmb.WarningBudget)
v1.RegisterCmbHTTPServer(srv, cmb) v1.RegisterCmbHTTPServer(srv, cmb)

View File

@ -136,17 +136,21 @@ func (this *CmbService) PushWechatRetry(ctx http.Context) error {
func (this *CmbService) WarningBudget(ctx http.Context) error { func (this *CmbService) WarningBudget(ctx http.Context) error {
batchNo := ctx.Vars().Get("batch_no") id := ctx.Vars().Get("id")
if batchNo == "" { if id == "" {
return fmt.Errorf("batch_no is empty") return fmt.Errorf("id is empty")
} }
err := this.VoucherBiz.Warning(ctx, batchNo) int64Id, err := strconv.ParseInt(id, 10, 32)
if err != nil { if err != nil {
return err return err
} }
if err = this.VoucherBiz.Warning(ctx, int32(int64Id)); err != nil {
return err
}
return ctx.JSON(http2.StatusOK, map[string]interface{}{ return ctx.JSON(http2.StatusOK, map[string]interface{}{
"data": batchNo, "data": id,
}) })
} }