作者 唐旭辉

Merge branch 'dev' into test

@@ -57,11 +57,11 @@ spec: @@ -57,11 +57,11 @@ spec:
57 - name: POSTGRESQL_USER 57 - name: POSTGRESQL_USER
58 value: "postgres" 58 value: "postgres"
59 - name: POSTGRESQL_PASSWORD 59 - name: POSTGRESQL_PASSWORD
60 - value: "postgres_15432" 60 + value: "eagle1010"
61 - name: POSTGRESQL_HOST 61 - name: POSTGRESQL_HOST
62 - value: "101.37.68.23" 62 + value: "114.55.200.59"
63 - name: POSTGRESQL_PORT 63 - name: POSTGRESQL_PORT
64 - value: "15432" 64 + value: "31543"
65 - name: LOG_LEVEL 65 - name: LOG_LEVEL
66 value: "debug" 66 value: "debug"
67 - name: ERROR_BASE_CODE 67 - name: ERROR_BASE_CODE
@@ -181,11 +181,11 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( @@ -181,11 +181,11 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) (
181 return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error()) 181 return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
182 } 182 }
183 //检查order_code是否重复 183 //检查order_code是否重复
184 - if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode); err != nil {  
185 - return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())  
186 - } else if ok {  
187 - return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")  
188 - } 184 + // if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode); err != nil {
  185 + // return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
  186 + // } else if ok {
  187 + // return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
  188 + // }
189 //检查delivery_code是否重复 189 //检查delivery_code是否重复
190 if len(cmd.DeliveryCode) > 0 { 190 if len(cmd.DeliveryCode) > 0 {
191 if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode); err != nil { 191 if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode); err != nil {
@@ -352,11 +352,11 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) @@ -352,11 +352,11 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand)
352 return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error()) 352 return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
353 } 353 }
354 //检查order_code是否重复 354 //检查order_code是否重复
355 - if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode, cmd.Id); err != nil {  
356 - return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())  
357 - } else if ok {  
358 - return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")  
359 - } 355 + // if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode, cmd.Id); err != nil {
  356 + // return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
  357 + // } else if ok {
  358 + // return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
  359 + // }
360 //检查delivery_code是否重复 360 //检查delivery_code是否重复
361 if len(cmd.DeliveryCode) > 0 { 361 if len(cmd.DeliveryCode) > 0 {
362 if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.Id); err != nil { 362 if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.Id); err != nil {
@@ -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 }
@@ -23,6 +23,7 @@ require ( @@ -23,6 +23,7 @@ require (
23 github.com/mattn/go-sqlite3 v1.10.0 23 github.com/mattn/go-sqlite3 v1.10.0
24 github.com/pelletier/go-toml v1.2.0 // indirect 24 github.com/pelletier/go-toml v1.2.0 // indirect
25 github.com/pkg/errors v0.8.0 // indirect 25 github.com/pkg/errors v0.8.0 // indirect
  26 + github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644
26 github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726 // indirect 27 github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726 // indirect
27 github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373 28 github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373
28 github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d // indirect 29 github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d // indirect