Skip to content

Commit

Permalink
Merge branch 'feat/coupon' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sjatsh committed Nov 14, 2023
2 parents 83d64f4 + 238ac0b commit e80ef43
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions http_server/handle/auto_order_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,15 @@ func (h *HttpHandle) doAutoOrderCreate(req *ReqAutoOrderCreate, apiResp *api_cod
apiResp.ApiRespErr(api_code.ApiCodeError500, "this coupon code can not use, because it not open")
return nil
}
if time.Now().After(time.UnixMilli(setInfo.ExpiredAt)) {
if now.After(time.UnixMilli(setInfo.ExpiredAt)) {
apiResp.ApiRespErr(api_code.ApiCodeError500, "this coupon code can not use, because it expired")
return nil
}
couponAccId := common.Bytes2Hex(common.GetAccountIdByAccount(setInfo.Account))
if couponAccId != parentAccountId {
apiResp.ApiRespErr(api_code.ApiCodeParamsInvalid, "this coupon code can not use, because it not belong to this account")
return nil
}

if setInfo.Price.LessThan(usdAmount) {
actualUsdPrice = usdAmount.Sub(setInfo.Price)
Expand Down Expand Up @@ -295,7 +300,7 @@ func (h *HttpHandle) doAutoOrderCreate(req *ReqAutoOrderCreate, apiResp *api_cod
CouponCode: req.CouponCode,
PayStatus: tables.PayStatusUnpaid,
OrderStatus: tables.OrderStatusDefault,
Timestamp: time.Now().UnixMilli(),
Timestamp: now.UnixMilli(),
SvrName: config.Cfg.Slb.SvrName,
PremiumPercentage: premiumPercentage,
PremiumBase: premiumBase,
Expand Down

0 comments on commit e80ef43

Please sign in to comment.