|
@@ -5,6 +5,7 @@ import ( |
|
@@ -5,6 +5,7 @@ import ( |
|
5
|
"fmt"
|
5
|
"fmt"
|
|
6
|
"regexp"
|
6
|
"regexp"
|
|
7
|
"strconv"
|
7
|
"strconv"
|
|
|
|
8
|
+ "strings"
|
|
8
|
"time"
|
9
|
"time"
|
|
9
|
"unicode/utf8"
|
10
|
"unicode/utf8"
|
|
10
|
|
11
|
|
|
@@ -181,7 +182,10 @@ type postPurposeOrderDetail struct { |
|
@@ -181,7 +182,10 @@ type postPurposeOrderDetail struct { |
|
181
|
Product []postOrderGood `json:"product"`
|
182
|
Product []postOrderGood `json:"product"`
|
|
182
|
}
|
183
|
}
|
|
183
|
|
184
|
|
|
184
|
-func (postData postPurposeOrderDetail) Valid() error {
|
185
|
+func (postData *postPurposeOrderDetail) Valid() error {
|
|
|
|
186
|
+ postData.OrderId = strings.TrimSpace(postData.OrderId)
|
|
|
|
187
|
+ postData.BuyerName = strings.TrimSpace(postData.BuyerName)
|
|
|
|
188
|
+ postData.OrderDist = strings.TrimSpace(postData.OrderDist)
|
|
185
|
if len(postData.OrderId) == 0 {
|
189
|
if len(postData.OrderId) == 0 {
|
|
186
|
return lib.ThrowError(lib.ARG_ERROR, "订单编号必填")
|
190
|
return lib.ThrowError(lib.ARG_ERROR, "订单编号必填")
|
|
187
|
}
|
191
|
}
|
|
@@ -217,7 +221,8 @@ type postOrderGood struct { |
|
@@ -217,7 +221,8 @@ type postOrderGood struct { |
|
217
|
PartnerRatio float64 `json:"partnerRatio"`
|
221
|
PartnerRatio float64 `json:"partnerRatio"`
|
|
218
|
}
|
222
|
}
|
|
219
|
|
223
|
|
|
220
|
-func (postData postOrderGood) Valid() error {
|
224
|
+func (postData *postOrderGood) Valid() error {
|
|
|
|
225
|
+ postData.ProductName = strings.TrimSpace(postData.ProductName)
|
|
221
|
lenProductName := utf8.RuneCountInString(postData.ProductName)
|
226
|
lenProductName := utf8.RuneCountInString(postData.ProductName)
|
|
222
|
if lenProductName == 0 {
|
227
|
if lenProductName == 0 {
|
|
223
|
return lib.ThrowError(lib.ARG_ERROR, "商品名称必填")
|
228
|
return lib.ThrowError(lib.ARG_ERROR, "商品名称必填")
|
|
@@ -256,6 +261,7 @@ func (c *OrderInfoController) UpdateOrderPurpose() { |
|
@@ -256,6 +261,7 @@ func (c *OrderInfoController) UpdateOrderPurpose() { |
|
256
|
c.ResponseError(errors.New("json数据解析失败"))
|
261
|
c.ResponseError(errors.New("json数据解析失败"))
|
|
257
|
return
|
262
|
return
|
|
258
|
}
|
263
|
}
|
|
|
|
264
|
+
|
|
259
|
if err := param.Valid(); err != nil {
|
265
|
if err := param.Valid(); err != nil {
|
|
260
|
c.ResponseError(err)
|
266
|
c.ResponseError(err)
|
|
261
|
return
|
267
|
return
|
|
@@ -332,7 +338,8 @@ type postOrderPurposeDelivery struct { |
|
@@ -332,7 +338,8 @@ type postOrderPurposeDelivery struct { |
|
332
|
ProductDetail []postOrderGood `json:"productDetail"`
|
338
|
ProductDetail []postOrderGood `json:"productDetail"`
|
|
333
|
}
|
339
|
}
|
|
334
|
|
340
|
|
|
335
|
-func (postData postOrderPurposeDelivery) Valid() error {
|
341
|
+func (postData *postOrderPurposeDelivery) Valid() error {
|
|
|
|
342
|
+ postData.ShipmentsId = strings.TrimSpace(postData.ShipmentsId)
|
|
336
|
lenShipmentsId := utf8.RuneCountInString(postData.ShipmentsId)
|
343
|
lenShipmentsId := utf8.RuneCountInString(postData.ShipmentsId)
|
|
337
|
if lenShipmentsId == 0 {
|
344
|
if lenShipmentsId == 0 {
|
|
338
|
return lib.ThrowError(lib.ARG_ERROR, "发货单号必填")
|
345
|
return lib.ThrowError(lib.ARG_ERROR, "发货单号必填")
|
|
@@ -544,6 +551,7 @@ type postRealOrderDetail struct { |
|
@@ -544,6 +551,7 @@ type postRealOrderDetail struct { |
|
544
|
}
|
551
|
}
|
|
545
|
|
552
|
|
|
546
|
func (postData postRealOrderDetail) Valid() error {
|
553
|
func (postData postRealOrderDetail) Valid() error {
|
|
|
|
554
|
+ postData.ShipmentsId = strings.TrimSpace(postData.ShipmentsId)
|
|
547
|
if len(postData.ShipmentsId) == 0 {
|
555
|
if len(postData.ShipmentsId) == 0 {
|
|
548
|
return lib.ThrowError(lib.ARG_ERROR, "订单的发货单号必填")
|
556
|
return lib.ThrowError(lib.ARG_ERROR, "订单的发货单号必填")
|
|
549
|
}
|
557
|
}
|