From f65d22c4648dba4591c352d2530282dcf2e789d6 Mon Sep 17 00:00:00 2001 From: gazebo Date: Wed, 27 Jun 2018 11:19:49 +0800 Subject: [PATCH] - handle Jdorder code is only 2 characters. --- business/jd/controller/order.go | 8 ++++---- business/jd/models/order.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/business/jd/controller/order.go b/business/jd/controller/order.go index 1d62b954e..e5184ae46 100644 --- a/business/jd/controller/order.go +++ b/business/jd/controller/order.go @@ -13,7 +13,7 @@ import ( ) const ( - MsgNotHandledCode = "9527" + MsgNotHandledCode = "NH" ) var ( @@ -98,15 +98,15 @@ func (c *OrderController) OrderStatus(order *jdapi.CallbackOrderMsg) *jdapi.Call OrderStatusTime: order.Timestamp, } - if created, _, err := db.ReadOrCreate(rec, "Jdorderid"); err == nil { + if created, _, err := db.ReadOrCreate(rec, "JdOrderID"); err == nil { order.ID = rec.ID if created { if order.StatusID != jdapi.OrderStatusNew && order.StatusID != jdapi.OrderStatusAdjust { globals.SugarLogger.Warnf("order:%v get before create", order) - oldStatusId := order.StatusID + oldStatusID := order.StatusID order.StatusID = jdapi.OrderStatusNew addOrderMsg(order) - order.StatusID = oldStatusId + order.StatusID = oldStatusID } addOrderMsg(order) } else { diff --git a/business/jd/models/order.go b/business/jd/models/order.go index 6cd6f180e..e5d20db4f 100644 --- a/business/jd/models/order.go +++ b/business/jd/models/order.go @@ -2,11 +2,11 @@ package models type Jdorder struct { ID int `orm:"column(id)"` - Code string `orm:"size(8)"` + Code string `orm:"size(2)"` Msg string `orm:"size(100)"` Data string `orm:"type(text)"` Success int8 - JdOrderID int64 `orm:"unique;column(jdorderid)"` + JdOrderID int64 `orm:"unique;size(19);column(jdorderid)"` CityName string `orm:"size(20);column(cityname)"` OrderStatus int `orm:"column(orderstatus)"` OrderStatusTime string `orm:"size(50);column(orderstatustime)"`