作者 唐旭辉

Merge branch 'test'

... ... @@ -57,11 +57,11 @@ spec:
- name: POSTGRESQL_USER
value: "postgres"
- name: POSTGRESQL_PASSWORD
value: "postgres_15432"
value: "eagle1010"
- name: POSTGRESQL_HOST
value: "101.37.68.23"
value: "114.55.200.59"
- name: POSTGRESQL_PORT
value: "15432"
value: "31543"
- name: LOG_LEVEL
value: "debug"
- name: ERROR_BASE_CODE
... ...
... ... @@ -38,9 +38,6 @@ spec:
- key: kubernetes.io/hostname
operator: In
values:
- cn-hangzhou.i-bp1djh1xn7taumbue1ze
- cn-hangzhou.i-bp1djh1xn7taumbue1zd
- cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
- cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
containers:
- name: mmm-partnermg
... ... @@ -57,11 +54,11 @@ spec:
- name: POSTGRESQL_USER
value: "postgres"
- name: POSTGRESQL_PASSWORD
value: "postgres_15432"
value: "eagle1010"
- name: POSTGRESQL_HOST
value: "101.37.68.23"
value: "114.55.200.59"
- name: POSTGRESQL_PORT
value: "15432"
value: "31543"
- name: LOG_LEVEL
value: "debug"
- name: ERROR_BASE_CODE
... ...
... ... @@ -181,11 +181,11 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) (
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
}
//检查order_code是否重复
if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode); err != nil {
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
} else if ok {
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
}
// if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode); err != nil {
// return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
// } else if ok {
// return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
// }
//检查delivery_code是否重复
if len(cmd.DeliveryCode) > 0 {
if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode); err != nil {
... ... @@ -352,11 +352,11 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand)
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
}
//检查order_code是否重复
if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode, cmd.Id); err != nil {
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
} else if ok {
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
}
// if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode, cmd.Id); err != nil {
// return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
// } else if ok {
// return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
// }
//检查delivery_code是否重复
if len(cmd.DeliveryCode) > 0 {
if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.Id); err != nil {
... ...
... ... @@ -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, "订单的发货单号必填")
}
... ...
... ... @@ -23,6 +23,7 @@ require (
github.com/mattn/go-sqlite3 v1.10.0
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pkg/errors v0.8.0 // indirect
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726 // indirect
github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d // indirect
... ...