request.WithTimeout
This commit is contained in:
parent
c209c645f7
commit
fb8330888b
|
|
@ -138,8 +138,6 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
//var templateFS embed.FS
|
||||
|
||||
func temp() *template.Template {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
|
|
|
|||
1
go.sum
1
go.sum
|
|
@ -133,6 +133,7 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
|
|||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE=
|
||||
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
|
|
|
|||
|
|
@ -2,12 +2,8 @@ package service
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/go-kratos/kratos/v2/transport/http"
|
||||
"github.com/robfig/cron"
|
||||
http2 "net/http"
|
||||
"strconv"
|
||||
v1 "voucher/api/v1"
|
||||
"voucher/internal/biz"
|
||||
"voucher/internal/biz/bo"
|
||||
|
|
@ -59,34 +55,3 @@ func (c *CmbService) GetResponse(ctx context.Context, replyBizContent []byte) (*
|
|||
|
||||
return reply, nil
|
||||
}
|
||||
|
||||
func (this *CmbService) NotifyRetry(ctx http.Context) error {
|
||||
id := ctx.Vars().Get("id")
|
||||
if id == "" {
|
||||
return fmt.Errorf("id is empty")
|
||||
}
|
||||
|
||||
orderNotifyId, err := strconv.ParseUint(id, 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return this.VoucherBiz.PushNotifyRetryDelayMQ(ctx, 1, orderNotifyId)
|
||||
}
|
||||
|
||||
func (this *CmbService) QueryOrder(ctx http.Context) error {
|
||||
|
||||
orderNo := ctx.Vars().Get("order_no")
|
||||
if orderNo == "" {
|
||||
return fmt.Errorf("orderNo is empty")
|
||||
}
|
||||
|
||||
str, err := this.VoucherBiz.QueryOrder(ctx, orderNo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return ctx.JSON(http2.StatusOK, map[string]interface{}{
|
||||
"data": str,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,31 +108,6 @@ func (this *CmbService) QueryOrder(ctx http.Context) error {
|
|||
return ctx.JSON(http2.StatusOK, map[string]string{"data": str})
|
||||
}
|
||||
|
||||
func (this *CmbService) QueryByOrderNo(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
data := struct {
|
||||
Title string
|
||||
ErrMsg string
|
||||
Order *bo.OrderBo
|
||||
}{
|
||||
Title: "招行立减金订单查询",
|
||||
ErrMsg: "暂无数据",
|
||||
Order: nil,
|
||||
}
|
||||
|
||||
order, err := this.queryOrder(r)
|
||||
if err != nil {
|
||||
data.ErrMsg = err.Error()
|
||||
} else {
|
||||
data.Order = order
|
||||
}
|
||||
|
||||
if err = this.tmpl.Execute(w, data); err != nil {
|
||||
http2.Error(w, err.Error(), http2.StatusInternalServerError)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *CmbService) queryOrder(r *http.Request) (*bo.OrderBo, error) {
|
||||
|
||||
orderNo, err := this.queryByOrderNo(r)
|
||||
|
|
|
|||
Loading…
Reference in New Issue