- GoodsOrder.ConsigneeMobile2 for real user mobile.
This commit is contained in:
@@ -308,10 +308,10 @@ func (c *OrderManager) GetOrders(ctx *jxcontext.Context, fromDateStr, toDateStr
|
|||||||
keywordLike := "%" + keyword + "%"
|
keywordLike := "%" + keyword + "%"
|
||||||
sqlWhere += `
|
sqlWhere += `
|
||||||
AND (t1.store_name LIKE ? OR t1.vendor_order_id LIKE ? OR t1.vendor_store_id LIKE ?
|
AND (t1.store_name LIKE ? OR t1.vendor_order_id LIKE ? OR t1.vendor_store_id LIKE ?
|
||||||
OR t1.consignee_name LIKE ? OR t1.consignee_mobile LIKE ? OR t1.consignee_address LIKE ?
|
OR t1.consignee_name LIKE ? OR t1.consignee_mobile LIKE ? OR t1.consignee_mobile2 LIKE ? OR t1.consignee_address LIKE ?
|
||||||
OR t2.vendor_waybill_id LIKE ? OR t2.courier_name LIKE ? OR t2.courier_mobile LIKE ?
|
OR t2.vendor_waybill_id LIKE ? OR t2.courier_name LIKE ? OR t2.courier_mobile LIKE ?
|
||||||
`
|
`
|
||||||
sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike)
|
sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike)
|
||||||
if keywordInt64, err2 := strconv.ParseInt(keyword, 10, 64); err2 == nil {
|
if keywordInt64, err2 := strconv.ParseInt(keyword, 10, 64); err2 == nil {
|
||||||
sqlWhere += " OR t1.store_id = ? OR t1.jx_store_id = ?"
|
sqlWhere += " OR t1.store_id = ? OR t1.jx_store_id = ?"
|
||||||
sqlParams = append(sqlParams, keywordInt64, keywordInt64)
|
sqlParams = append(sqlParams, keywordInt64, keywordInt64)
|
||||||
|
|||||||
@@ -199,7 +199,11 @@ func init() {
|
|||||||
Timeout: 1 * time.Second,
|
Timeout: 1 * time.Second,
|
||||||
TimeoutAction: func(savedOrderInfo *WatchOrderInfo) (err error) {
|
TimeoutAction: func(savedOrderInfo *WatchOrderInfo) (err error) {
|
||||||
order := savedOrderInfo.order
|
order := savedOrderInfo.order
|
||||||
_ = sch.handleAutoAcceptOrder(order.VendorOrderID, order.VendorID, order.ConsigneeMobile, jxutils.GetJxStoreIDFromOrder(order), nil, func(isAcceptIt bool) error {
|
mobile := order.ConsigneeMobile
|
||||||
|
if order.ConsigneeMobile2 != "" {
|
||||||
|
mobile = order.ConsigneeMobile2
|
||||||
|
}
|
||||||
|
_ = sch.handleAutoAcceptOrder(order.VendorOrderID, order.VendorID, mobile, jxutils.GetJxStoreIDFromOrder(order), nil, func(isAcceptIt bool) error {
|
||||||
if err = sch.AcceptOrRefuseOrder(order, isAcceptIt, ""); err != nil && err != scheduler.ErrOrderStatusAlreadySatisfyCurOperation {
|
if err = sch.AcceptOrRefuseOrder(order, isAcceptIt, ""); err != nil && err != scheduler.ErrOrderStatusAlreadySatisfyCurOperation {
|
||||||
// 为了解决京东新消息与接单消息乱序的问题
|
// 为了解决京东新消息与接单消息乱序的问题
|
||||||
if errWithCode, ok := err.(*utils.ErrorWithCode); ok && errWithCode.Level() == 1 && errWithCode.IntCode() == -1 {
|
if errWithCode, ok := err.(*utils.ErrorWithCode); ok && errWithCode.Level() == 1 && errWithCode.IntCode() == -1 {
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ func SendAdvertingByGoodsOrder(ctx *jxcontext.Context, advertising string, days
|
|||||||
}
|
}
|
||||||
sqlParams := []interface{}{}
|
sqlParams := []interface{}{}
|
||||||
sql1 := `
|
sql1 := `
|
||||||
SELECT consignee_mobile mobile
|
SELECT IF(t1.consignee_mobile2 <> '', t1.consignee_mobile2, t1.consignee_mobile) mobile
|
||||||
FROM goods_order t1
|
FROM goods_order t1
|
||||||
LEFT JOIN black_client t2 ON t1.consignee_mobile = t2.mobile
|
LEFT JOIN black_client t2 ON IF(t1.consignee_mobile2 <> '', t1.consignee_mobile2, t1.consignee_mobile) = t2.mobile
|
||||||
WHERE consignee_mobile IS NOT NULL AND consignee_mobile <> '' AND t2.id IS NULL AND LENGTH(consignee_mobile) = 11 AND LEFT(consignee_mobile, 1) = '1'
|
WHERE IF(t1.consignee_mobile2 <> '', t1.consignee_mobile2, t1.consignee_mobile) <> '' AND t2.id IS NULL AND LENGTH(IF(t1.consignee_mobile2 <> '', t1.consignee_mobile2, t1.consignee_mobile)) = 11 AND LEFT(IF(t1.consignee_mobile2 <> '', t1.consignee_mobile2, t1.consignee_mobile), 1) = '1'
|
||||||
`
|
`
|
||||||
sql2 := `
|
sql2 := `
|
||||||
SELECT buyer_mobile mobile
|
SELECT buyer_mobile mobile
|
||||||
|
|||||||
@@ -190,7 +190,11 @@ func Int2OneZero(value int) int {
|
|||||||
|
|
||||||
// 判断电话号码是否是假的,比如有****号
|
// 判断电话号码是否是假的,比如有****号
|
||||||
func IsMobileFake(mobile string) bool {
|
func IsMobileFake(mobile string) bool {
|
||||||
return utils.Str2Int64WithDefault(strings.Replace(strings.Replace(mobile, "-", "", -1), ",", "", -1), 0) == 0
|
return utils.Str2Int64WithDefault(FormalizeMobile(mobile), 0) == 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func FormalizeMobile(mobile string) string {
|
||||||
|
return strings.Replace(strings.Replace(mobile, "-", "", -1), ",", "", -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsLegalStoreID(id int) bool {
|
func IsLegalStoreID(id int) bool {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ type GoodsOrder struct {
|
|||||||
Weight int `json:"weight"` // 单位为克
|
Weight int `json:"weight"` // 单位为克
|
||||||
ConsigneeName string `orm:"size(32)" json:"consigneeName"`
|
ConsigneeName string `orm:"size(32)" json:"consigneeName"`
|
||||||
ConsigneeMobile string `orm:"size(32)" json:"consigneeMobile"`
|
ConsigneeMobile string `orm:"size(32)" json:"consigneeMobile"`
|
||||||
|
ConsigneeMobile2 string `orm:"size(32)" json:"consigneeMobile2"`
|
||||||
ConsigneeAddress string `orm:"size(255)" json:"consigneeAddress"`
|
ConsigneeAddress string `orm:"size(255)" json:"consigneeAddress"`
|
||||||
CoordinateType int `json:"-"`
|
CoordinateType int `json:"-"`
|
||||||
ConsigneeLng int `json:"-"` // 坐标 * (10的六次方)
|
ConsigneeLng int `json:"-"` // 坐标 * (10的六次方)
|
||||||
|
|||||||
@@ -84,8 +84,8 @@ func (p *PurchaseHandler) GetOrder(vendorOrderID string) (order *model.GoodsOrde
|
|||||||
}
|
}
|
||||||
|
|
||||||
deliveryGeo := userMap["coord"].(map[string]interface{})
|
deliveryGeo := userMap["coord"].(map[string]interface{})
|
||||||
originalLng := utils.MustInterface2Float64(deliveryGeo["longitude"])
|
originalLng := utils.Interface2FloatWithDefault(deliveryGeo["longitude"], 0.0) // 饿百的订单在过一段时间后,经纬度信息会变成字符串"**"
|
||||||
originalLat := utils.MustInterface2Float64(deliveryGeo["latitude"])
|
originalLat := utils.Interface2FloatWithDefault(deliveryGeo["latitude"], 0.0)
|
||||||
lng, lat, err2 := api.AutonaviAPI.CoordinateConvert(originalLng, originalLat, autonavi.CoordSysBaidu)
|
lng, lat, err2 := api.AutonaviAPI.CoordinateConvert(originalLng, originalLat, autonavi.CoordSysBaidu)
|
||||||
if err2 == nil {
|
if err2 == nil {
|
||||||
originalLng = lng
|
originalLng = lng
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/partner"
|
"git.rosy.net.cn/jx-callback/business/partner"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
@@ -60,7 +61,23 @@ func (c *PurchaseHandler) onOrderMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi
|
|||||||
|
|
||||||
func (c *PurchaseHandler) GetOrder(orderID string) (order *model.GoodsOrder, err error) {
|
func (c *PurchaseHandler) GetOrder(orderID string) (order *model.GoodsOrder, err error) {
|
||||||
globals.SugarLogger.Debugf("jd GetOrder orderID:%s", orderID)
|
globals.SugarLogger.Debugf("jd GetOrder orderID:%s", orderID)
|
||||||
result, err := api.JdAPI.QuerySingleOrder(orderID)
|
var (
|
||||||
|
result map[string]interface{}
|
||||||
|
result2 string
|
||||||
|
err2 error
|
||||||
|
)
|
||||||
|
task := tasksch.NewParallelTask("jd GetOrder", nil, "admin", func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
|
taskIndex := batchItemList[0].(int)
|
||||||
|
switch taskIndex {
|
||||||
|
case 0:
|
||||||
|
result, err = api.JdAPI.QuerySingleOrder(orderID)
|
||||||
|
case 1:
|
||||||
|
result2, err2 = api.JdAPI.GetRealMobile4Order(orderID)
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
}, []int{0, 1})
|
||||||
|
task.Run()
|
||||||
|
task.GetResult(0)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
order = &model.GoodsOrder{
|
order = &model.GoodsOrder{
|
||||||
VendorOrderID: orderID,
|
VendorOrderID: orderID,
|
||||||
@@ -81,6 +98,11 @@ func (c *PurchaseHandler) GetOrder(orderID string) (order *model.GoodsOrder, err
|
|||||||
ActualPayPrice: utils.MustInterface2Int64(result["orderBuyerPayableMoney"]),
|
ActualPayPrice: utils.MustInterface2Int64(result["orderBuyerPayableMoney"]),
|
||||||
Skus: []*model.OrderSku{},
|
Skus: []*model.OrderSku{},
|
||||||
}
|
}
|
||||||
|
if err2 == nil {
|
||||||
|
order.ConsigneeMobile2 = result2
|
||||||
|
} else {
|
||||||
|
// globals.SugarLogger.Warnf("jd GetOrder orderID:%s, GetRealMobile4Order failed with error:%v", orderID, err2)
|
||||||
|
}
|
||||||
order.Status = c.GetStatusFromVendorStatus(order.VendorStatus)
|
order.Status = c.GetStatusFromVendorStatus(order.VendorStatus)
|
||||||
businessTage := utils.Interface2String(result["businessTag"])
|
businessTage := utils.Interface2String(result["businessTag"])
|
||||||
if strings.Index(businessTage, "dj_aging_immediately") >= 0 {
|
if strings.Index(businessTage, "dj_aging_immediately") >= 0 {
|
||||||
|
|||||||
@@ -157,8 +157,10 @@ func (c *PurchaseHandler) replyOrderComment(intOrderID int64, jdStoreNo string,
|
|||||||
// }
|
// }
|
||||||
// return nil
|
// return nil
|
||||||
// }, "replyOrderComment %d", intOrderID)
|
// }, "replyOrderComment %d", intOrderID)
|
||||||
err2 := api.JdAPI.OrgReplyComment(intOrderID, jdStoreNo, content, utils.GetAPIOperator(""))
|
if globals.ReallySendWeixinMsg {
|
||||||
globals.SugarLogger.Debugf("replyOrderComment orderID:%d, error:%v", intOrderID, err2)
|
err2 := api.JdAPI.OrgReplyComment(intOrderID, jdStoreNo, content, utils.GetAPIOperator(""))
|
||||||
|
globals.SugarLogger.Debugf("replyOrderComment orderID:%d, error:%v", intOrderID, err2)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ showAppSecret = "384f911735334bf7a150f3bd3bdf0c1e"
|
|||||||
weixinMiniAppID = "wx4b5930c13f8b1170"
|
weixinMiniAppID = "wx4b5930c13f8b1170"
|
||||||
weixinMiniSecret = "2a57228a716ce991a52739f0ff41111d"
|
weixinMiniSecret = "2a57228a716ce991a52739f0ff41111d"
|
||||||
|
|
||||||
|
jdStorePageCookie = "AG37MCRDYAEOMUXKENJQ4QYZIYHYPVUX7CAXNBWPW777UQDYQ6N7HO7XXVQPYJISZMYRMOJXIM4Q35YTUFDGQMW3GQU6625AAJ7IQTUX23DKGA5NOYSENMJHDGM4HO4AHIAWZ7PTJGVBBT5OGAOFABPOHPZRYZ6MH6GL5QTVSIMCARP2IGG6DIB5ZUI5HQSTAJMJVRGRMUM5YT4TVA4NH65A6J6IFPRW7GAESIY"
|
||||||
|
|
||||||
[dev]
|
[dev]
|
||||||
jdToken = "c8854ef2-f80a-45ee-aceb-dc8014d646f8"
|
jdToken = "c8854ef2-f80a-45ee-aceb-dc8014d646f8"
|
||||||
jdAppKey = "06692746f7224695ad4788ce340bc854"
|
jdAppKey = "06692746f7224695ad4788ce340bc854"
|
||||||
@@ -134,7 +136,7 @@ enableStore = true
|
|||||||
enableStoreWrite = true
|
enableStoreWrite = true
|
||||||
|
|
||||||
[test]
|
[test]
|
||||||
jdToken = "91633f2a-c5f5-4982-a925-a220d19095c3"
|
jdToken = "ccb10daf-e6f5-4a58-ada5-b97f9073a137"
|
||||||
jdAppKey = "1dba76d40cac446ca500c0391a0b6c9d"
|
jdAppKey = "1dba76d40cac446ca500c0391a0b6c9d"
|
||||||
jdSecret = "a88d031a1e7b462cb1579f12e97fe7f4"
|
jdSecret = "a88d031a1e7b462cb1579f12e97fe7f4"
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ var (
|
|||||||
func Init() {
|
func Init() {
|
||||||
if !beego.AppConfig.DefaultBool("disableJd", false) {
|
if !beego.AppConfig.DefaultBool("disableJd", false) {
|
||||||
JdAPI = jdapi.New(beego.AppConfig.String("jdToken"), beego.AppConfig.String("jdAppKey"), beego.AppConfig.String("jdSecret"))
|
JdAPI = jdapi.New(beego.AppConfig.String("jdToken"), beego.AppConfig.String("jdAppKey"), beego.AppConfig.String("jdSecret"))
|
||||||
|
JdAPI.SetStoreCookie(beego.AppConfig.DefaultString("jdStorePageCookie", ""))
|
||||||
}
|
}
|
||||||
if !beego.AppConfig.DefaultBool("disableElm", false) {
|
if !beego.AppConfig.DefaultBool("disableElm", false) {
|
||||||
initElm()
|
initElm()
|
||||||
|
|||||||
Reference in New Issue
Block a user