This commit is contained in:
李子铭 2025-03-20 19:50:41 +08:00
parent a1750d6959
commit aa2d5a5069
3 changed files with 8 additions and 10 deletions

View File

@ -144,11 +144,13 @@ func (v *VoucherBiz) CmbProductQuery(ctx context.Context, productNo string) (rep
}
if wechatResp.StartTime != nil {
// 批次激活开启时间
s, _ := time.Parse(inputFormat, *wechatResp.StartTime)
reps.SaleStartTime = s.Format(time.DateTime)
}
if wechatResp.StopTime != nil {
// 批次永久停止时间
e, _ := time.Parse(inputFormat, *wechatResp.StopTime)
reps.SaleEndTime = e.Format(time.DateTime)
}

View File

@ -6,19 +6,15 @@ import (
"github.com/bwmarrin/snowflake"
"os"
"voucher/internal/biz/mixrepos"
"voucher/internal/data"
"voucher/internal/pkg/helper"
)
type GenerateRepoImpl struct {
rdb *data.Rdb
node *snowflake.Node
}
func NewGenerateMixRepoImpl(rdb *data.Rdb) (mixrepos.GenerateMixRepo, error) {
g := &GenerateRepoImpl{rdb: rdb}
func NewGenerateMixRepoImpl() (mixrepos.GenerateMixRepo, error) {
g := &GenerateRepoImpl{}
name, err := os.Hostname()
if err != nil {

View File

@ -12,7 +12,7 @@ import (
"voucher/internal/biz/vo"
)
func (s *VoucherService) readBody(bodyBytes []byte) (*v1.CmbRequest, error) {
func (s *VoucherService) buildCmbRequest(bodyBytes []byte) (*v1.CmbRequest, error) {
var req *v1.CmbRequest
if err := json.Unmarshal(bodyBytes, &req); err != nil {
@ -82,7 +82,7 @@ func (v *VoucherService) cmbOrder(ctx http.Context) (string, error) {
return "", err2.ErrorCmbParamFail(err.Error())
}
req, err := v.readBody(bodyBytes)
req, err := v.buildCmbRequest(bodyBytes)
if err != nil {
return "", err
}
@ -160,7 +160,7 @@ func (v *VoucherService) cmbProductQuery(ctx http.Context) (*v1.CmbQueryProductR
return nil, err2.ErrorCmbParamFail(err.Error())
}
req, err := v.readBody(bodyBytes)
req, err := v.buildCmbRequest(bodyBytes)
if err != nil {
return nil, err
}
@ -219,7 +219,7 @@ func (v *VoucherService) cmbQuery(ctx http.Context) (*v1.CmbQueryReply, error) {
return nil, err2.ErrorCmbParamFail(err.Error())
}
req, err := v.readBody(bodyBytes)
req, err := v.buildCmbRequest(bodyBytes)
if err != nil {
return nil, err
}