enhance(model):调整自定义的日期类型,以及相关的查询。

This commit is contained in:
徐涛
2022-09-19 11:06:10 +08:00
parent d885538500
commit a9f93d5239
7 changed files with 47 additions and 25 deletions

View File

@@ -46,7 +46,7 @@ type _NewChargeFormData struct {
Fee decimal.NullDecimal `json:"fee" form:"fee"`
Discount decimal.NullDecimal `json:"discount" form:"discount"`
Amount decimal.NullDecimal `json:"amount" form:"amount"`
ChargeTo time.Time `json:"chargeTo" form:"chargeTo" time_format:"simple_date" time_location:"shanghai"`
ChargeTo model.Date `json:"chargeTo" form:"chargeTo"`
}
func recordNewCharge(c *gin.Context) {

View File

@@ -12,7 +12,6 @@ import (
"fmt"
"net/http"
"strconv"
"time"
"github.com/gin-gonic/gin"
"github.com/shopspring/decimal"
@@ -225,7 +224,7 @@ func createOPSAndManagementAccount(c *gin.Context) {
newUserDetail.Contact = creationForm.Contact
newUserDetail.Phone = creationForm.Phone
newUserDetail.UnitServiceFee = decimal.Zero
newUserDetail.ServiceExpiration, _ = time.Parse("2006-01-02 15:04:05", "2099-12-31 23:59:59")
newUserDetail.ServiceExpiration, _ = model.ParseDate("2099-12-31")
verifyCode, err := service.UserService.CreateUser(newUser, newUserDetail)
if err != nil {
result.Error(http.StatusInternalServerError, err.Error())
@@ -290,7 +289,7 @@ func createEnterpriseAccount(c *gin.Context) {
result.BadRequest("用户月服务费无法解析。")
return
}
newUserDetail.ServiceExpiration = time.Now()
newUserDetail.ServiceExpiration = model.NewEmptyDate()
verifyCode, err := service.UserService.CreateUser(newUser, newUserDetail)
if err != nil {