...
|
...
|
@@ -5,6 +5,7 @@ import ( |
|
|
"fmt"
|
|
|
"regexp"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
|
"unicode/utf8"
|
|
|
|
...
|
...
|
@@ -181,7 +182,10 @@ type postPurposeOrderDetail struct { |
|
|
Product []postOrderGood `json:"product"`
|
|
|
}
|
|
|
|
|
|
func (postData postPurposeOrderDetail) Valid() error {
|
|
|
func (postData *postPurposeOrderDetail) Valid() error {
|
|
|
postData.OrderId = strings.TrimSpace(postData.OrderId)
|
|
|
postData.BuyerName = strings.TrimSpace(postData.BuyerName)
|
|
|
postData.OrderDist = strings.TrimSpace(postData.OrderDist)
|
|
|
if len(postData.OrderId) == 0 {
|
|
|
return lib.ThrowError(lib.ARG_ERROR, "订单编号必填")
|
|
|
}
|
...
|
...
|
@@ -217,7 +221,8 @@ type postOrderGood struct { |
|
|
PartnerRatio float64 `json:"partnerRatio"`
|
|
|
}
|
|
|
|
|
|
func (postData postOrderGood) Valid() error {
|
|
|
func (postData *postOrderGood) Valid() error {
|
|
|
postData.ProductName = strings.TrimSpace(postData.ProductName)
|
|
|
lenProductName := utf8.RuneCountInString(postData.ProductName)
|
|
|
if lenProductName == 0 {
|
|
|
return lib.ThrowError(lib.ARG_ERROR, "商品名称必填")
|
...
|
...
|
@@ -256,6 +261,7 @@ func (c *OrderInfoController) UpdateOrderPurpose() { |
|
|
c.ResponseError(errors.New("json数据解析失败"))
|
|
|
return
|
|
|
}
|
|
|
|
|
|
if err := param.Valid(); err != nil {
|
|
|
c.ResponseError(err)
|
|
|
return
|
...
|
...
|
@@ -332,7 +338,8 @@ type postOrderPurposeDelivery struct { |
|
|
ProductDetail []postOrderGood `json:"productDetail"`
|
|
|
}
|
|
|
|
|
|
func (postData postOrderPurposeDelivery) Valid() error {
|
|
|
func (postData *postOrderPurposeDelivery) Valid() error {
|
|
|
postData.ShipmentsId = strings.TrimSpace(postData.ShipmentsId)
|
|
|
lenShipmentsId := utf8.RuneCountInString(postData.ShipmentsId)
|
|
|
if lenShipmentsId == 0 {
|
|
|
return lib.ThrowError(lib.ARG_ERROR, "发货单号必填")
|
...
|
...
|
@@ -543,7 +550,8 @@ type postRealOrderDetail struct { |
|
|
ShipmentsId string `json:"shipmentsId"` //发货单号
|
|
|
}
|
|
|
|
|
|
func (postData postRealOrderDetail) Valid() error {
|
|
|
func (postData *postRealOrderDetail) Valid() error {
|
|
|
postData.ShipmentsId = strings.TrimSpace(postData.ShipmentsId)
|
|
|
if len(postData.ShipmentsId) == 0 {
|
|
|
return lib.ThrowError(lib.ARG_ERROR, "订单的发货单号必填")
|
|
|
}
|
...
|
...
|
|