预警39
This commit is contained in:
parent
0a79405533
commit
f7247315cf
|
|
@ -15,9 +15,9 @@ import (
|
|||
"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 {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ func NewHTTPServer(
|
|||
srv.Route("/voucher/").POST("pushWechatQuery", cmb.PushWechatQuery)
|
||||
srv.Route("/voucher/").POST("timeSliceQueryPush", cmb.TimeSliceQueryPush)
|
||||
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)
|
||||
|
||||
|
|
|
|||
|
|
@ -136,17 +136,21 @@ func (this *CmbService) PushWechatRetry(ctx http.Context) error {
|
|||
|
||||
func (this *CmbService) WarningBudget(ctx http.Context) error {
|
||||
|
||||
batchNo := ctx.Vars().Get("batch_no")
|
||||
if batchNo == "" {
|
||||
return fmt.Errorf("batch_no is empty")
|
||||
id := ctx.Vars().Get("id")
|
||||
if id == "" {
|
||||
return fmt.Errorf("id is empty")
|
||||
}
|
||||
|
||||
err := this.VoucherBiz.Warning(ctx, batchNo)
|
||||
int64Id, err := strconv.ParseInt(id, 10, 32)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = this.VoucherBiz.Warning(ctx, int32(int64Id)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return ctx.JSON(http2.StatusOK, map[string]interface{}{
|
||||
"data": batchNo,
|
||||
"data": id,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue