Merge remote-tracking branch 'origin/mark' into su
This commit is contained in:
@@ -4,27 +4,33 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/netprinter"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/jd"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
func (c *OrderManager) OnNewFakeJdOrder(vendorOrderID string) (err error) {
|
||||
orderInfo, err := api.FakeJdAPI.FakeQuerySingleOrder(vendorOrderID)
|
||||
if err == nil {
|
||||
err = c.notifyNewFakeJdOrder(orderInfo)
|
||||
}
|
||||
utils.CallFuncAsync(func() {
|
||||
orderInfo, err := api.FakeJdAPI.FakeQuerySingleOrderRaw(vendorOrderID)
|
||||
if err == nil {
|
||||
err = c.notifyNewFakeJdOrder(jd.Map2Order(orderInfo))
|
||||
}
|
||||
if err != nil {
|
||||
globals.SugarLogger.Warnf("OnNewFakeJdOrder failed with err:%v", err)
|
||||
}
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *OrderManager) notifyNewFakeJdOrder(orderInfo *jdapi.OrderInfo) (err error) {
|
||||
vendorStoreID := orderInfo.DeliveryStationNo
|
||||
func (c *OrderManager) notifyNewFakeJdOrder(order *model.GoodsOrder) (err error) {
|
||||
db := dao.GetDB()
|
||||
storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, vendorStoreID, model.VendorIDJD)
|
||||
storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, order.VendorStoreID, model.VendorIDJD)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -32,25 +38,34 @@ func (c *OrderManager) notifyNewFakeJdOrder(orderInfo *jdapi.OrderInfo) (err err
|
||||
if storeDetail.LinkStoreID != 0 {
|
||||
realStoreID = storeDetail.LinkStoreID
|
||||
}
|
||||
notifyWxNewFakeJdOrder(orderInfo, realStoreID)
|
||||
notifyWxNewFakeJdOrder(order, realStoreID)
|
||||
netprinter.PrintOrderByOrder4Store(jxcontext.AdminCtx, order, realStoreID)
|
||||
return err
|
||||
}
|
||||
|
||||
func notifyWxNewFakeJdOrder(order *jdapi.OrderInfo, storeID int) (err error) {
|
||||
globals.SugarLogger.Debugf("notifyWxNewFakeJdOrder orderID:%s", order.SrcOrderID)
|
||||
func notifyWxNewFakeJdOrder(order *model.GoodsOrder, storeID int) (err error) {
|
||||
globals.SugarLogger.Debugf("notifyWxNewFakeJdOrder orderID:%s", order.VendorOrderID)
|
||||
|
||||
sb := new(strings.Builder)
|
||||
sb.WriteString("老板,你有新订单了\n")
|
||||
sb.WriteString(fmt.Sprintf("订单号:%s\n", order.SrcOrderID))
|
||||
sb.WriteString(fmt.Sprintf("买家:%s\n", order.BuyerFullName))
|
||||
sb.WriteString(fmt.Sprintf("电话:%s\n", order.BuyerMobile))
|
||||
sb.WriteString(fmt.Sprintf("收货地址:%s\n", order.BuyerFullAddress))
|
||||
sb.WriteString("商品详情:\n")
|
||||
for _, product := range order.Product {
|
||||
sb.WriteString(fmt.Sprintf("\t%s*%d\n", product.SkuName, product.SkuCount))
|
||||
sb.WriteString(fmt.Sprintf("订单号:%s\n", order.VendorOrderID))
|
||||
sb.WriteString("送达时间:")
|
||||
if order.BusinessType == model.BusinessTypeDingshida {
|
||||
sb.WriteString(utils.Time2Str(order.ExpectedDeliveredTime))
|
||||
} else {
|
||||
sb.WriteString("立即达")
|
||||
}
|
||||
title := fmt.Sprintf("你有到家菜市新订单%d", order.OrderNum)
|
||||
context := sb.String()
|
||||
_, err = weixinmsg.SendStoreMessage(jxcontext.AdminCtx, title, context, []int{storeID}, true, true)
|
||||
sb.WriteString("\n")
|
||||
sb.WriteString(fmt.Sprintf("买家:%s\n", order.ConsigneeName))
|
||||
sb.WriteString(fmt.Sprintf("电话:%s\n", order.ConsigneeMobile))
|
||||
sb.WriteString(fmt.Sprintf("收货地址:%s\n", order.ConsigneeAddress))
|
||||
sb.WriteString("商品详情:\n")
|
||||
for _, sku := range order.Skus {
|
||||
sb.WriteString(fmt.Sprintf("\t%s*%d\n", sku.SkuName, sku.Count))
|
||||
}
|
||||
title := fmt.Sprintf("你有到家菜市新订单%d", order.OrderSeq)
|
||||
content := sb.String()
|
||||
// globals.SugarLogger.Debugf("notifyWxNewFakeJdOrder, orderID:%s, content:%s", order.VendorOrderID, content)
|
||||
_, err = weixinmsg.SendStoreMessage(jxcontext.AdminCtx, title, content, []int{storeID}, true, true)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -705,7 +705,11 @@ func (s *DefScheduler) createWaybillOn3rdProviders(savedOrderInfo *WatchOrderInf
|
||||
if (order.DeliveryFlag & model.OrderDeliveryFlagMaskScheduleDisabled) == 0 {
|
||||
if savedOrderInfo.retryCount <= maxWaybillRetryCount {
|
||||
savedOrderInfo.isNeedCreate3rdWaybill = true
|
||||
if _, err = s.CreateWaybillOnProviders4SavedOrder(jxcontext.AdminCtx, savedOrderInfo, nil, savedOrderInfo.GetWaybillVendorIDs(), false, maxDeliveryFee); err == nil {
|
||||
excludeVendorIDs := savedOrderInfo.GetWaybillVendorIDs()
|
||||
if order.VendorID == model.VendorIDJX {
|
||||
excludeVendorIDs = append(excludeVendorIDs, model.VendorIDMTPS)
|
||||
}
|
||||
if _, err = s.CreateWaybillOnProviders4SavedOrder(jxcontext.AdminCtx, savedOrderInfo, nil, excludeVendorIDs, false, maxDeliveryFee); err == nil {
|
||||
savedOrderInfo.retryCount++
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -50,12 +50,12 @@ var (
|
||||
receiveMsgUsersMap = map[string][]string{
|
||||
SendMsgTypeOpenStoreRequest: []string{
|
||||
"石锋",
|
||||
// "徐建华",
|
||||
// "x",
|
||||
// "周扬",
|
||||
},
|
||||
SendMsgTypeSuggestRequest: []string{
|
||||
"石锋",
|
||||
// "徐建华",
|
||||
// "x",
|
||||
// "周扬",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -59,13 +59,14 @@ type StoreExt struct {
|
||||
FloatLng float64 `json:"lng"`
|
||||
FloatLat float64 `json:"lat"`
|
||||
|
||||
ProvinceCode int `json:"provinceCode"`
|
||||
ProvinceName string `json:"provinceName"`
|
||||
CityName string `json:"cityName"`
|
||||
DistrictName string `json:"districtName"`
|
||||
StoreMapStr string `json:"-"`
|
||||
CourierMapStr string `json:"-"`
|
||||
PayeeBankName string `json:"payeeBankName"` // 开户行名称
|
||||
ProvinceCode int `json:"provinceCode"`
|
||||
ProvinceName string `json:"provinceName"`
|
||||
CityName string `json:"cityName"`
|
||||
DistrictName string `json:"districtName"`
|
||||
StoreMapStr string `json:"-"`
|
||||
CourierMapStr string `json:"-"`
|
||||
PayeeBankName string `json:"payeeBankName"` // 开户行名称
|
||||
LinkStoreCount int `json:"linkStoreCount"`
|
||||
// StoreMaps []map[string]interface{} `orm:"-"`
|
||||
// CourierMaps []map[string]interface{} `orm:"-"`
|
||||
StoreMaps []*model.StoreMap `json:"StoreMaps"`
|
||||
@@ -326,8 +327,8 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte
|
||||
prefix := autils.NewRole("", 0).GetFullName()
|
||||
sqlWhereParams = append(sqlWhereParams, keyword+"%", autils.NewStoreBossRole(-1).GetFullName(), prefix, prefix, prefix) // 必须要前缀,不然不能用过些会很慢
|
||||
}
|
||||
sqlWhere += " OR t1.id = ? OR t1.city_code = ? OR t1.district_code = ?"
|
||||
sqlWhereParams = append(sqlWhereParams, keywordInt64, keywordInt64, keywordInt64)
|
||||
sqlWhere += " OR t1.id = ? OR t1.city_code = ? OR t1.district_code = ? OR t1.link_store_id = ?"
|
||||
sqlWhereParams = append(sqlWhereParams, keywordInt64, keywordInt64, keywordInt64, keywordInt64)
|
||||
if jxutils.GuessVendorIDFromVendorStoreID(keywordInt64) != model.VendorIDUnknown {
|
||||
sqlWhere += `
|
||||
OR (SELECT COUNT(*) FROM store_map tsm WHERE t1.id = tsm.store_id AND tsm.deleted_at = ? AND tsm.vendor_store_id = ?) > 0
|
||||
@@ -453,7 +454,8 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
province.code province_code,
|
||||
province.name province_name,
|
||||
city.name city_name,
|
||||
district.name district_name
|
||||
district.name district_name,
|
||||
(SELECT COUNT(*) FROM store t11 WHERE t11.link_store_id = t1.id) link_store_count
|
||||
` + sql + `
|
||||
ORDER BY t1.id DESC
|
||||
`
|
||||
@@ -776,14 +778,20 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
handler.UnregisterPrinter(ctx, store.PrinterSN, store.PrinterKey)
|
||||
}
|
||||
}
|
||||
if linkStoreID, ok := valid["linkStoreID"].(int); ok {
|
||||
if valid["linkStoreID"] != nil {
|
||||
linkStoreID := int(utils.Interface2Int64WithDefault(valid["linkStoreID"], 0))
|
||||
linkStoreID, err = getRealLinkStoreID(linkStoreID)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if err = checkStoreHaveLinkedStore(storeID, linkStoreID); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
valid["linkStoreID"] = linkStoreID
|
||||
// globals.SugarLogger.Debug(linkStoreID)
|
||||
}
|
||||
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(valid, false))
|
||||
for _, v := range []string{
|
||||
"lng",
|
||||
"lat",
|
||||
@@ -1003,6 +1011,26 @@ func EnableHaveRestStores(ctx *jxcontext.Context, isAsync, isContinueWhenError b
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func checkStoreHaveLinkedStore(storeID, linkStoreID int) (err error) {
|
||||
if linkStoreID != 0 {
|
||||
if storeID == linkStoreID {
|
||||
err = fmt.Errorf("不能自我关联")
|
||||
} else {
|
||||
storeList, err2 := dao.GetStoreLinkStores(dao.GetDB(), storeID)
|
||||
if err = err2; err == nil {
|
||||
if len(storeList) > 0 {
|
||||
var storeInfo []string
|
||||
for _, v := range storeList {
|
||||
storeInfo = append(storeInfo, utils.Int2Str(v.ID))
|
||||
}
|
||||
err = fmt.Errorf("门店%d已经被其它门店(%s)关联,不能再关联至其它门店", storeID, strings.Join(storeInfo, ","))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (id int, err error) {
|
||||
globals.SugarLogger.Debugf("CreateStore storeExt:%s", utils.Format4Output(storeExt, false))
|
||||
if err = checkBankBranch(storeExt.PayeeBankBranchName); err != nil {
|
||||
@@ -1022,6 +1050,9 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if err = checkStoreHaveLinkedStore(storeExt.ID, realLinkStoreID); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
storeExt.LinkStoreID = realLinkStoreID
|
||||
|
||||
existingID := store.ID
|
||||
|
||||
@@ -18,7 +18,7 @@ func TestSyncStoreSku4FakeJD(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadFakeJdThingMap(t *testing.T) {
|
||||
file, err := os.Open("/Users/xujianhua/Downloads/到家菜市门店与商品映射信息(1).xlsx")
|
||||
file, err := os.Open("到家菜市门店与商品映射信息(1).xlsx")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ func init() {
|
||||
func RegisterUserWithMobile(ctx *jxcontext.Context, user *model.User, mobileVerifyCode string, inAuthInfo, manTokenInfo *auth2.AuthInfo) (outAuthInfo *auth2.AuthInfo, err error) {
|
||||
var mobileAuth *auth2.AuthInfo
|
||||
fakeMobile := false
|
||||
user.Type = model.UserTypeConsumer
|
||||
user.Type = model.UserTypeConsumer | model.UserTypeStoreBoss // 先不区分商户与消息者
|
||||
createName := ctx.GetRealRemoteIP()
|
||||
authType := auth2.AuthTypeMobile
|
||||
if manTokenInfo != nil && mobileVerifyCode == "" {
|
||||
|
||||
@@ -1232,7 +1232,7 @@ func FixMtwmCategory(ctx *jxcontext.Context, mtwmStoreIDs []int, isAsync, isCont
|
||||
}
|
||||
|
||||
func JdStoreInfo1125() (hint string, err error) {
|
||||
fileName := "/Users/xujianhua/Downloads/老格恢复拓店进度.xlsx"
|
||||
fileName := "老格恢复拓店进度.xlsx"
|
||||
db := dao.GetDB()
|
||||
storeList, err := dao.GetStoresMapList(db, []int{model.VendorIDJD}, nil, nil, model.StoreStatusAll, model.StoreIsSyncYes, "")
|
||||
if err == nil {
|
||||
|
||||
@@ -24,7 +24,7 @@ func TestScope(t *testing.T) {
|
||||
func TestIt(t *testing.T) {
|
||||
Init(myObjCreator, []*model.Store{})
|
||||
var err error
|
||||
// taskID, err := CurMan.AddTask("testtask", "xjh")
|
||||
// taskID, err := CurMan.AddTask("testtask", "xxx")
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
|
||||
@@ -46,11 +46,35 @@ func PrintOrder(ctx *jxcontext.Context, vendorOrderID string, vendorID int) (pri
|
||||
}
|
||||
|
||||
func PrintOrderByOrder(ctx *jxcontext.Context, order *model.GoodsOrder) (printResult *partner.PrinterStatus, err error) {
|
||||
globals.SugarLogger.Debugf("PrintOrderByOrder orderID:%s", order.VendorOrderID)
|
||||
store := &model.Store{}
|
||||
store.ID = jxutils.GetSaleStoreIDFromOrder(order)
|
||||
return PrintOrderByOrder4Store(ctx, order, jxutils.GetSaleStoreIDFromOrder(order))
|
||||
}
|
||||
|
||||
func getStore4Print(db *dao.DaoDB, storeID int) (store *model.Store, err error) {
|
||||
for i := 0; i < 3; i++ {
|
||||
store2 := &model.Store{}
|
||||
store2.ID = storeID
|
||||
if err = dao.GetEntity(db, store2); err == nil {
|
||||
store = store2
|
||||
if store.LinkStoreID != 0 {
|
||||
storeID = store.LinkStoreID
|
||||
} else {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
if store != nil {
|
||||
err = nil
|
||||
}
|
||||
return store, err
|
||||
}
|
||||
|
||||
func PrintOrderByOrder4Store(ctx *jxcontext.Context, order *model.GoodsOrder, storeID int) (printResult *partner.PrinterStatus, err error) {
|
||||
globals.SugarLogger.Debugf("PrintOrderByOrder4Store orderID:%s", order.VendorOrderID)
|
||||
db := dao.GetDB()
|
||||
if err = dao.GetEntity(db, store); err == nil {
|
||||
store, err := getStore4Print(db, storeID)
|
||||
if err == nil {
|
||||
handler, err := GetHandlerFromStore(store)
|
||||
if err != nil {
|
||||
return &partner.PrinterStatus{
|
||||
@@ -63,7 +87,7 @@ func PrintOrderByOrder(ctx *jxcontext.Context, order *model.GoodsOrder) (printRe
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
globals.SugarLogger.Infof("PrintOrderByOrder orderID:%s failed with error:%v", order.VendorOrderID, err)
|
||||
globals.SugarLogger.Infof("PrintOrderByOrder4Store orderID:%s failed with error:%v", order.VendorOrderID, err)
|
||||
}
|
||||
return printResult, err
|
||||
}
|
||||
|
||||
@@ -48,14 +48,14 @@ const (
|
||||
WX_MTPS_DELIVERY_DONE_TEMPLATE_ID = "YXdCrQAHZlcZX1htYUiarrLmtkmKAjp7rynjwObgODo" //微信美团配送员配送完成推送
|
||||
WX_MTPS_UNABLE_DELIVER_TEMPLATE_ID = "ZFph5Hp7oLlrzVRXbsKIC_StmaBeB9Dlp4tlHeAmUQ8" //微信美团配送配送能力不足推送
|
||||
WX_MTPS_DELIVERY_EXCEPTION_TEMPLATE_ID = "RkfOFHgR1N75L4-a6Gv0DljpCsVfOHhLm_vyXh8MR-w" //微信美团配送异常推送
|
||||
WX_BAD_COMMENT_PUSH_TEMPLATE_ID = "NaMEzjctvVPQ9ishTI1dKpp5QSYV2FWcWftSSjDrpN8" //"zMZH5Ek0k1OHlWnsDb98UaHEOlkJZYok2QOJUfwfJWs" //微信差评消息推送
|
||||
WX_BAD_COMMENT_PUSH_TEMPLATE_ID = "NaMEzjctvVPQ9ishTI1dKpp5QSYV2FWcWftSSjDrpN8" //微信中差评消息推送
|
||||
|
||||
WX_DADA_DELIVERY_GRABDONE_TEMPLATE_ID = "h4dkON6AgnHz1XmaksEUB_8Bcir4V8MSexUhC149pPE" //微信达达众包配送员接单推送
|
||||
WX_DADA_DELIVERY_DONE_TEMPLATE_ID = "YXdCrQAHZlcZX1htYUiarrLmtkmKAjp7rynjwObgODo" //微信达达众包配送员配送完成推送
|
||||
|
||||
WX_SALE_BILL_TEMPLATE_ID = "eTUuFZMWH7IsVBfcxNMpmaHYaxRkUaD6zG8wSGJDcic"
|
||||
|
||||
WX_NORMAL_STORE_MSG_TEMPLATE_ID = "UlLvTMXDPIX9Ztyu3MMb84Zu-cCFo7trvQI8YRrAFjc" //"7ngcTFYiUFw66BMzIYntM1tpy-xZkJwlcCT5pVtXwtw"
|
||||
WX_NORMAL_STORE_MSG_TEMPLATE_ID = "EUeIJEz2TLUAn4TU2EffOGYLd3dEaYndD_y6Sw9FcSU"
|
||||
// WX_CHANGE_APPROVED_TEMPLATE_ID = "gIG2olBZtQbjXmp6doNB_dESu60By5xuXYOGxksLv3Y"
|
||||
// WX_CHANGE_REJECTED_TEMPLATE_ID = "tn2QXWi4HtSIwaztmtN6Bb2uzNL-jBxWltCZTDNJuYE"
|
||||
WX_ORDER_APPLY_CANCEL_TEMPLATE_ID = "e6urTtcm4PL0rgDMG_1qWNOwrE3Qxqcm_dx0kWWCmEI"
|
||||
@@ -705,7 +705,7 @@ func SendStoreMessage(ctx *jxcontext.Context, title, content string, storeIDs []
|
||||
msgStatus.Status = model.MessageStatusSendAllFailed
|
||||
}
|
||||
dao.WrapUpdateULEntity(msgStatus, ctx.GetUserName())
|
||||
globals.SugarLogger.Debug(utils.Format4Output(msgStatus, false))
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(msgStatus, false))
|
||||
_, err = dao.UpdateEntity(db, msgStatus)
|
||||
return nil, err
|
||||
}, msgStatusList)
|
||||
|
||||
@@ -188,7 +188,7 @@ func GetStoreOrderAfterTime(db *DaoDB, storeID int, orderTime time.Time, lastOrd
|
||||
t2.actual_fee, t2.desired_fee, t2.waybill_created_at, t2.waybill_finished_at
|
||||
FROM goods_order t1
|
||||
LEFT JOIN waybill t2 ON t1.vendor_waybill_id = t2.vendor_waybill_id AND t1.waybill_vendor_id = t2.waybill_vendor_id
|
||||
WHERE IF(t1.jx_store_id <> 0, t1.jx_store_id, t1.store_id) = ? AND t1.order_created_at >= ? AND t1.id > ? AND t1.status < ?
|
||||
WHERE IF(t1.jx_store_id <> 0, t1.jx_store_id, t1.store_id) = ? AND t1.order_created_at >= ? AND t1.id > ? AND t1.status >= ? AND t1.status < ?
|
||||
AND (t1.flag & ?) = 0
|
||||
ORDER BY t1.order_created_at DESC, t1.id DESC;
|
||||
`
|
||||
@@ -196,6 +196,7 @@ func GetStoreOrderAfterTime(db *DaoDB, storeID int, orderTime time.Time, lastOrd
|
||||
storeID,
|
||||
orderTime,
|
||||
lastOrderSeqID,
|
||||
model.OrderStatusNew,
|
||||
model.OrderStatusEndBegin,
|
||||
model.OrderFlagMaskFake,
|
||||
}
|
||||
@@ -403,7 +404,7 @@ func GetStoreAfsOrderSkuList(db *DaoDB, storeIDs []int, finishedAtBegin, finishe
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM order_sku_financial t1
|
||||
JOIN afs_order t2 ON t2.vendor_order_id = t1.vendor_order_id AND t2.vendor_id = t1.vendor_id
|
||||
JOIN afs_order t2 ON t2.vendor_order_id = t1.vendor_order_id AND t2.vendor_id = t1.vendor_id AND t2.afs_order_id = t1.afs_order_id
|
||||
WHERE t1.is_afs_order = 1 AND t2.afs_finished_at >= ? AND t2.afs_finished_at <= ?`
|
||||
sqlParams := []interface{}{
|
||||
finishedAtBegin,
|
||||
@@ -1186,7 +1187,7 @@ func GetJxOrderCount(db *DaoDB, storeID int, orderID string, date time.Time) (co
|
||||
}
|
||||
|
||||
if orderID != "" {
|
||||
sql += " AND t1.vendor_order_id = ?"
|
||||
sql += " AND t1.vendor_order_id != ?"
|
||||
sqlParams = append(sqlParams, orderID)
|
||||
}
|
||||
err = GetRow(db, &count, sql, sqlParams...)
|
||||
|
||||
@@ -142,8 +142,8 @@ func GetStoreListByMobileOrStoreIDs(db *DaoDB, mobile string, shortRoleNameList
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if mobile != "" {
|
||||
sql += " OR t1.market_man_phone = ? OR t1.operator_phone = ? OR t1.operator_phone2 = ?"
|
||||
sqlParams = append(sqlParams, mobile, mobile, mobile)
|
||||
sql += " OR t1.tel1 = ? OR t1.tel2 = ? OR t1.market_man_phone = ? OR t1.operator_phone = ? OR t1.operator_phone2 = ?"
|
||||
sqlParams = append(sqlParams, mobile, mobile, mobile, mobile, mobile)
|
||||
}
|
||||
if len(shortRoleNameList) > 0 {
|
||||
questionMarks := GenQuestionMarks(len(shortRoleNameList))
|
||||
|
||||
@@ -32,6 +32,10 @@ type StatisticsReportForOrdersList struct {
|
||||
MarketManName string `json:"marketManName"` //市场负责人
|
||||
OperatorName string `json:"operatorName"` //运营负责人
|
||||
OperatorName2 string `json:"operatorName2"`
|
||||
|
||||
CityName string `json:"cityName"`
|
||||
Status int `json:"status"`
|
||||
Tel1 string `orm:"size(32);index" json:"tel1"`
|
||||
}
|
||||
|
||||
type PriceReferSnapshotExt struct {
|
||||
@@ -63,10 +67,13 @@ func GetStatisticsReportForOrders(db *DaoDB, storeIDs []int, fromDate time.Time,
|
||||
s.total_gross_profit,
|
||||
IF(c.jx_brand_fee_factor = 0 AND c.market_add_fee_factor = 0,total_gross_profit,(total_gross_profit*c.jx_brand_fee_factor)/(c.jx_brand_fee_factor+market_add_fee_factor)) com_gross_profit,
|
||||
IF(c.jx_brand_fee_factor = 0 AND c.market_add_fee_factor = 0,0,(total_gross_profit*c.market_add_fee_factor)/(c.jx_brand_fee_factor+market_add_fee_factor)) city_manager_gross_profit,
|
||||
c.status, c.tel1,
|
||||
IF(mm.name <> '', mm.name, mm.user_id2) market_man_name,
|
||||
IF(om.name <> '', om.name, om.user_id2) operator_name,
|
||||
IF(om2.name <> '', om2.name, om2.user_id2) operator_name2
|
||||
IF(om2.name <> '', om2.name, om2.user_id2) operator_name2,
|
||||
p.name city_name
|
||||
FROM store c
|
||||
LEFT JOIN place p ON p.code = c.city_code
|
||||
LEFT JOIN user mm ON mm.mobile <> '' AND mm.mobile = c.market_man_phone
|
||||
LEFT JOIN user om ON om.mobile <> '' AND om.mobile = c.operator_phone
|
||||
LEFT JOIN user om2 ON om2.mobile <> '' AND om2.mobile = c.operator_phone2
|
||||
@@ -136,10 +143,13 @@ func GetGetStatisticsReportForAfsOrders(db *DaoDB, storeIDs []int, fromDate time
|
||||
s.total_gross_profit,
|
||||
IF(c.jx_brand_fee_factor = 0 AND c.market_add_fee_factor = 0,total_gross_profit,(total_gross_profit*c.jx_brand_fee_factor)/(c.jx_brand_fee_factor+market_add_fee_factor)) com_gross_profit,
|
||||
IF(c.jx_brand_fee_factor = 0 AND c.market_add_fee_factor = 0,0,(total_gross_profit*c.market_add_fee_factor)/(c.jx_brand_fee_factor+market_add_fee_factor)) city_manager_gross_profit,
|
||||
c.status, c.tel1,
|
||||
IF(mm.name <> '', mm.name, mm.user_id2) market_man_name,
|
||||
IF(om.name <> '', om.name, om.user_id2) operator_name,
|
||||
IF(om2.name <> '', om2.name, om2.user_id2) operator_name2
|
||||
IF(om2.name <> '', om2.name, om2.user_id2) operator_name2,
|
||||
p.name city_name
|
||||
FROM store c
|
||||
LEFT JOIN place p ON p.code = c.city_code
|
||||
LEFT JOIN user mm ON mm.mobile <> '' AND mm.mobile = c.market_man_phone
|
||||
LEFT JOIN user om ON om.mobile <> '' AND om.mobile = c.operator_phone
|
||||
LEFT JOIN user om2 ON om2.mobile <> '' AND om2.mobile = c.operator_phone2
|
||||
|
||||
@@ -682,3 +682,17 @@ func GetOrderNotifyPhones(db *DaoDB, storeID int) (phoneList []string) {
|
||||
}
|
||||
return phoneList
|
||||
}
|
||||
|
||||
func GetStoreLinkStores(db *DaoDB, storeID int) (storeList []*model.Store, err error) {
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM store t1
|
||||
WHERE t1.link_store_id = ? AND t1.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
storeID,
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
err = GetRows(db, &storeList, sql, sqlParams...)
|
||||
return storeList, err
|
||||
}
|
||||
|
||||
@@ -272,11 +272,11 @@ type Store struct {
|
||||
DeliveryRangeType int8 `json:"deliveryRangeType"` // 参见相关常量定义
|
||||
DeliveryRange string `orm:"type(text)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon,则为逗号分隔坐标,分号分隔的坐标点(坐标与Lng和Lat一样,都是整数),比如 121361504,31189308;121420555,31150238。否则为半径,单位为米
|
||||
Status int `json:"status"`
|
||||
AutoEnableAt *time.Time `orm:"type(datetime);null" json:"autoEnableAt"` // 自动营业时间(临时休息用)
|
||||
ChangePriceType int8 `json:"changePriceType"` // 修改价格类型,即是否需要审核
|
||||
SMSNotify int8 `orm:"column(sms_notify);" json:"smsNotify"` // 是否通过短信接收订单消息
|
||||
AutoReplyType int8 `json:"autoReplyType"` // 订单评价自动回复类型
|
||||
LinkStoreID int `orm:"column(link_store_id);default(0)" json:"linkStoreID"` // 关联门店ID
|
||||
AutoEnableAt *time.Time `orm:"type(datetime);null" json:"autoEnableAt"` // 自动营业时间(临时休息用)
|
||||
ChangePriceType int8 `json:"changePriceType"` // 修改价格类型,即是否需要审核
|
||||
SMSNotify int8 `orm:"column(sms_notify);" json:"smsNotify"` // 是否通过短信接收订单消息
|
||||
AutoReplyType int8 `json:"autoReplyType"` // 订单评价自动回复类型
|
||||
LinkStoreID int `orm:"column(link_store_id);default(0);index" json:"linkStoreID"` // 关联门店ID
|
||||
|
||||
PrinterDisabled int8 `orm:"default(0)" json:"printerDisabled"` // 是否禁用网络打印机
|
||||
PrinterFontSize int8 `orm:"default(0)" json:"printerFontSize"` // 打印字体-1:小,0:正常,1:大
|
||||
@@ -436,6 +436,11 @@ type StoreCourierMap struct {
|
||||
func (*StoreCourierMap) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"StoreID", "VendorID", "DeletedAt"},
|
||||
}
|
||||
}
|
||||
|
||||
func (*StoreCourierMap) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"VendorStoreID", "VendorID", "DeletedAt"},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ func (c *DeliveryHandler) onWaybillMsg(msg *dadaapi.CallbackMsg) (retVal *dadaap
|
||||
order := c.callbackMsg2Waybill(msg)
|
||||
switch msg.OrderStatus {
|
||||
case dadaapi.OrderStatusWaitingForAccept:
|
||||
if dadaOrder, err := api.DadaAPI.QueryOrderInfo2(msg.OrderID); err == nil {
|
||||
if dadaOrder, err := api.DadaAPI.QueryOrderInfo(msg.OrderID); err == nil {
|
||||
order.ActualFee = jxutils.StandardPrice2Int(dadaOrder.ActualFee)
|
||||
order.DesiredFee = jxutils.StandardPrice2Int(dadaOrder.DeliveryFee)
|
||||
}
|
||||
@@ -200,12 +200,10 @@ func (c *DeliveryHandler) IsErrStoreExist(err error) bool {
|
||||
func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo *partner.WaybillFeeInfo, err error) {
|
||||
db := dao.GetDB()
|
||||
deliveryFeeInfo = &partner.WaybillFeeInfo{}
|
||||
// billParams, addParams, err := c.getBillParams(db, order)
|
||||
billParams, err := c.getBillParams2(db, order)
|
||||
billParams, err := c.getBillParams(db, order)
|
||||
if err == nil {
|
||||
var result *dadaapi.CreateOrderResponse
|
||||
// if result, err = api.DadaAPI.QueryDeliverFee(billParams, addParams); err != nil {
|
||||
if result, err = api.DadaAPI.QueryDeliverFee2(billParams); err != nil {
|
||||
if result, err = api.DadaAPI.QueryDeliverFee(billParams); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(result.Fee)
|
||||
@@ -214,33 +212,7 @@ func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInf
|
||||
return deliveryFeeInfo, err
|
||||
}
|
||||
|
||||
// func (c *DeliveryHandler) getBillParams(db *dao.DaoDB, order *model.GoodsOrder) (billParams *dadaapi.OperateOrderRequiredParams, addParams map[string]interface{}, err error) {
|
||||
// billParams = &dadaapi.OperateOrderRequiredParams{
|
||||
// // ShopNo: utils.Int2Str(order.StoreID), // 当前达达的门店号与京西是一样的
|
||||
// OriginID: jxutils.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID),
|
||||
// CargoPrice: jxutils.IntPrice2Standard(limitOrderPrice(order.ActualPayPrice)),
|
||||
// IsPrepay: 0,
|
||||
// ReceiverName: utils.FilterMb4(order.ConsigneeName),
|
||||
// ReceiverAddress: utils.FilterMb4(order.ConsigneeAddress),
|
||||
// ReceiverPhone: order.ConsigneeMobile,
|
||||
// }
|
||||
// if billParams.ShopNo, err = c.getDadaShopID(order, db); err == nil {
|
||||
// if billParams.CityCode, err = c.getDataCityCodeFromOrder(order, db); err == nil {
|
||||
// billParams.ReceiverLng, billParams.ReceiverLat, _ = jxutils.IntCoordinate2MarsStandard(order.ConsigneeLng, order.ConsigneeLat, order.CoordinateType)
|
||||
// addParams = map[string]interface{}{
|
||||
// "info": fmt.Sprintf("%s第%d号订单, %s", model.VendorChineseNames[order.VendorID], order.OrderSeq, utils.FilterMb4(order.BuyerComment)),
|
||||
// // "origin_mark": model.VendorNames[order.VendorID], // 订单来源标示(该字段可以显示在达达app订单详情页面,只支持字母,最大长度为10)
|
||||
// // "origin_mark_no": fmt.Sprintf("%d", order.OrderSeq), // 订单来源编号(该字段可以显示在达达app订单详情页面,支持字母和数字,最大长度为30)
|
||||
// "cargo_type": 13,
|
||||
// "cargo_weight": jxutils.IntWeight2Float(limitOrderWeight(order.Weight)),
|
||||
// "cargo_num": order.GoodsCount,
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return billParams, addParams, err
|
||||
// }
|
||||
|
||||
func (c *DeliveryHandler) getBillParams2(db *dao.DaoDB, order *model.GoodsOrder) (billParams *dadaapi.OperateOrderParams, err error) {
|
||||
func (c *DeliveryHandler) getBillParams(db *dao.DaoDB, order *model.GoodsOrder) (billParams *dadaapi.OperateOrderParams, err error) {
|
||||
billParams = &dadaapi.OperateOrderParams{
|
||||
OriginID: jxutils.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID),
|
||||
CargoPrice: jxutils.IntPrice2Standard(limitOrderPrice(order.ActualPayPrice)),
|
||||
@@ -264,8 +236,7 @@ func (c *DeliveryHandler) getBillParams2(db *dao.DaoDB, order *model.GoodsOrder)
|
||||
// IDeliveryPlatformHandler
|
||||
func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee int64) (bill *model.Waybill, err error) {
|
||||
db := dao.GetDB()
|
||||
// billParams, addParams, err := c.getBillParams(db, order)
|
||||
billParams, err := c.getBillParams2(db, order)
|
||||
billParams, err := c.getBillParams(db, order)
|
||||
if err == nil {
|
||||
if globals.EnableStoreWrite {
|
||||
// 达达要求第二次创建运单,调用函数不同。所以查找两天内有无相同订单号的运单
|
||||
@@ -286,18 +257,16 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee
|
||||
return nil, err
|
||||
}
|
||||
// result, err = api.DadaAPI.ReaddOrder(billParams, addParams)
|
||||
result, err = api.DadaAPI.ReaddOrder2(billParams)
|
||||
result, err = api.DadaAPI.ReaddOrder(billParams)
|
||||
} else {
|
||||
// 第一次创建
|
||||
if err != nil {
|
||||
globals.SugarLogger.Warnf("CreateWaybill orderID:%s error:%v", order.VendorOrderID, err)
|
||||
}
|
||||
if false {
|
||||
// result, err = api.DadaAPI.AddOrder(billParams, addParams)
|
||||
result, err = api.DadaAPI.AddOrder2(billParams)
|
||||
result, err = api.DadaAPI.AddOrder(billParams)
|
||||
} else {
|
||||
// if result, err = api.DadaAPI.QueryDeliverFee(billParams, addParams); err != nil {
|
||||
if result, err = api.DadaAPI.QueryDeliverFee2(billParams); err != nil {
|
||||
if result, err = api.DadaAPI.QueryDeliverFee(billParams); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = delivery.CallCreateWaybillPolicy(jxutils.StandardPrice2Int(result.Fee), maxDeliveryFee, order, model.VendorIDDada); err != nil {
|
||||
@@ -395,7 +364,7 @@ func (c *DeliveryHandler) ComplaintRider(bill *model.Waybill, resonID int, reson
|
||||
}
|
||||
|
||||
func (c *DeliveryHandler) GetWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID, vendorOrderID, vendorWaybillID, vendorWaybillID2 string) (tipFee int64, err error) {
|
||||
order, err := api.DadaAPI.QueryOrderInfo2(vendorOrderID)
|
||||
order, err := api.DadaAPI.QueryOrderInfo(vendorOrderID)
|
||||
if err == nil {
|
||||
tipFee = jxutils.StandardPrice2Int(order.Tips)
|
||||
}
|
||||
@@ -410,7 +379,7 @@ func (c *DeliveryHandler) UpdateWaybillTip(ctx *jxcontext.Context, vendorOrgCode
|
||||
}
|
||||
|
||||
func (c *DeliveryHandler) GetRidderPosition(ctx *jxcontext.Context, vendorOrgCode, vendorOrderID, vendorWaybillID, vendorWaybillID2 string) (lng, lat float64, err error) {
|
||||
order, err := api.DadaAPI.QueryOrderInfo2(vendorOrderID)
|
||||
order, err := api.DadaAPI.QueryOrderInfo(vendorOrderID)
|
||||
if err == nil {
|
||||
lng = utils.Str2Float64WithDefault(order.TransporterLng, 0)
|
||||
lat = utils.Str2Float64WithDefault(order.TransporterLat, 0)
|
||||
|
||||
@@ -209,7 +209,7 @@ func (c *PrinterHandler) GetPrinterStatus(ctx *jxcontext.Context, printerSN, pri
|
||||
}
|
||||
|
||||
func (c *PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store, order *model.GoodsOrder) (printerStatus *partner.PrinterStatus, err error) {
|
||||
globals.SugarLogger.Debugf("feie PrintOrderByOrder orderID:%s", order.VendorOrderID)
|
||||
globals.SugarLogger.Debugf("feie PrintOrderByOrder orderID:%s, storeID:%d", order.VendorOrderID, store.ID)
|
||||
content := ""
|
||||
if store.PrinterFontSize == partner.PrinterFontSizeBig {
|
||||
content = c.getOrderContentBig(order, store.Tel1)
|
||||
|
||||
@@ -290,7 +290,7 @@ func (c *PrinterHandler) GetPrinterStatus(ctx *jxcontext.Context, printerNumber,
|
||||
}
|
||||
|
||||
func (c *PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store, order *model.GoodsOrder) (printerStatus *partner.PrinterStatus, err error) {
|
||||
globals.SugarLogger.Debugf("xiaowm PrintOrderByOrder orderID:%s", order.VendorOrderID)
|
||||
globals.SugarLogger.Debugf("xiaowm PrintOrderByOrder orderID:%s, storeID:%d", order.VendorOrderID, store.ID)
|
||||
var content string
|
||||
if isV500(store.PrinterSN) {
|
||||
content = c.getOrderContent2(order, store.Tel1)
|
||||
|
||||
@@ -202,7 +202,7 @@ func (c *PrinterHandler) GetPrinterStatus(ctx *jxcontext.Context, machineCode, p
|
||||
}
|
||||
|
||||
func (c *PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store, order *model.GoodsOrder) (printerStatus *partner.PrinterStatus, err error) {
|
||||
globals.SugarLogger.Debugf("yilianyun PrintOrderByOrder orderID:%s", order.VendorOrderID)
|
||||
globals.SugarLogger.Debugf("yilianyun PrintOrderByOrder orderID:%s, storeID:%d", order.VendorOrderID, store.ID)
|
||||
content := ""
|
||||
if store.PrinterFontSize == partner.PrinterFontSizeBig {
|
||||
content = c.getOrderContentBig(order, store.Tel1)
|
||||
|
||||
@@ -195,7 +195,7 @@ func (c *PrinterHandler) GetPrinterStatus(ctx *jxcontext.Context, deviceID, devi
|
||||
}
|
||||
|
||||
func (c *PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store, order *model.GoodsOrder) (printerStatus *partner.PrinterStatus, err error) {
|
||||
globals.SugarLogger.Debugf("zhongwu PrintOrderByOrder orderID:%s", order.VendorOrderID)
|
||||
globals.SugarLogger.Debugf("zhongwu PrintOrderByOrder orderID:%s, storeID:%d", order.VendorOrderID, store.ID)
|
||||
content := ""
|
||||
if store.PrinterFontSize == partner.PrinterFontSizeBig {
|
||||
content = c.getOrderContentBig(order, store.Tel1)
|
||||
|
||||
@@ -160,12 +160,16 @@ func (c *PurchaseHandler) GetOrder(vendorOrgCode, orderID string) (order *model.
|
||||
func (p *PurchaseHandler) GetOrderStatus(vendorOrgCode, vendorOrderID string) (status int, err error) {
|
||||
order, err := getAPI(vendorOrgCode).QuerySingleOrder2(vendorOrderID)
|
||||
if err == nil {
|
||||
status = p.getStatusFromVendorStatus(utils.Int2Str(order.OrderStatus))
|
||||
status = getStatusFromVendorStatus(utils.Int2Str(order.OrderStatus))
|
||||
}
|
||||
return status, err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *model.GoodsOrder) {
|
||||
return Map2Order(orderData)
|
||||
}
|
||||
|
||||
func Map2Order(orderData map[string]interface{}) (order *model.GoodsOrder) {
|
||||
result := orderData
|
||||
orderID := utils.Int64ToStr(utils.MustInterface2Int64(result["orderId"]))
|
||||
globals.SugarLogger.Debugf("jd Map2Order orderID:%s", orderID)
|
||||
@@ -206,7 +210,7 @@ func (c *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
||||
order.InvoiceTaxerID = utils.Interface2String(orderInvoice["invoiceDutyNo"])
|
||||
order.InvoiceEmail = utils.Interface2String(orderInvoice["invoiceMail"])
|
||||
}
|
||||
order.Status = c.getStatusFromVendorStatus(order.VendorStatus)
|
||||
order.Status = getStatusFromVendorStatus(order.VendorStatus)
|
||||
businessTage := utils.Interface2String(result["businessTag"])
|
||||
if strings.Index(businessTage, "dj_aging_immediately") >= 0 {
|
||||
order.BusinessType = model.BusinessTypeImmediate
|
||||
@@ -303,7 +307,7 @@ func (c *PurchaseHandler) callbackMsg2Status(msg *jdapi.CallbackOrderMsg) *model
|
||||
if msg.MsgURL == jdapi.CallbackMsgOrderAddTips {
|
||||
orderStatus.VendorStatus = jdapi.CallbackMsgOrderAddTips
|
||||
}
|
||||
orderStatus.Status = c.getStatusFromVendorStatus(orderStatus.VendorStatus)
|
||||
orderStatus.Status = getStatusFromVendorStatus(orderStatus.VendorStatus)
|
||||
return orderStatus
|
||||
}
|
||||
|
||||
@@ -322,7 +326,7 @@ func (c *PurchaseHandler) postFakeMsg(vendorOrgCode, vendorOrderID, vendorStatus
|
||||
}
|
||||
|
||||
// IPurchasePlatformHandler
|
||||
func (c *PurchaseHandler) getStatusFromVendorStatus(vendorStatus string) int {
|
||||
func getStatusFromVendorStatus(vendorStatus string) int {
|
||||
if status, ok := VendorStatus2StatusMap[vendorStatus]; ok {
|
||||
return status
|
||||
}
|
||||
|
||||
@@ -81,14 +81,21 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendo
|
||||
db := dao.GetDB()
|
||||
cityCode := result.City
|
||||
if cityCode != 0 {
|
||||
if city, err2 := dao.GetPlaceByJdCode(db, cityCode); err2 == nil {
|
||||
retVal.CityCode = city.Code
|
||||
retVal.CityName = utils.Interface2String(result.CityName)
|
||||
districtName := result.CountyName // 京东的市区号码与通用数据完全无法关联,只有通过名字来关联
|
||||
if retVal.CityCode != 0 && districtName != "" {
|
||||
if district, err2 := dao.GetPlaceByName(db, districtName, 3, city.Code); err2 == nil {
|
||||
retVal.DistrictCode = district.Code
|
||||
if place, err2 := dao.GetPlaceByJdCode(db, cityCode); err2 == nil {
|
||||
if place.Level == model.PlaceLevelCity {
|
||||
retVal.CityCode = place.Code
|
||||
retVal.CityName = utils.Interface2String(result.CityName)
|
||||
districtName := result.CountyName // 京东的市区号码与通用数据完全无法关联,只有通过名字来关联
|
||||
if retVal.CityCode != 0 && districtName != "" {
|
||||
if district, err2 := dao.GetPlaceByName(db, districtName, 3, place.Code); err2 == nil {
|
||||
retVal.DistrictCode = district.Code
|
||||
}
|
||||
}
|
||||
} else if place.Level == model.PlaceLevelDistrict {
|
||||
retVal.CityCode = place.ParentCode
|
||||
retVal.DistrictCode = place.Code
|
||||
} else {
|
||||
globals.SugarLogger.Warnf("门店:%s的城市码:%d异常", vendorStoreID, cityCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ var (
|
||||
6: "六",
|
||||
7: "七",
|
||||
}
|
||||
dayList = []string{"今天", "明天"}
|
||||
dayList = []string{"今天", "明天", "后天"}
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -225,13 +225,13 @@ func GetAvailableDeliverTime(ctx *jxcontext.Context, storeID int) (deliverTimerL
|
||||
if storeID == specialStoreID {
|
||||
viewShippingFee = "免费配送"
|
||||
}
|
||||
for i := 0; i < 2; i++ {
|
||||
for i, dayStr := range dayList {
|
||||
openTime1 := jxutils.JxOperationTime2TimeByDate(storeDetail.OpenTime1, beginDate)
|
||||
closeTime1 := jxutils.JxOperationTime2TimeByDate(storeDetail.CloseTime1, beginDate)
|
||||
openTime2 := jxutils.JxOperationTime2TimeByDate(storeDetail.OpenTime2, beginDate)
|
||||
closeTime2 := jxutils.JxOperationTime2TimeByDate(storeDetail.CloseTime2, beginDate)
|
||||
timeInfo := &DeliveryDayTimeInfo{
|
||||
Date: fmt.Sprintf("%s(周%s)", dayList[i], weekdayMap[int(beginDate.Weekday())]),
|
||||
Date: fmt.Sprintf("%s(周%s)", dayStr, weekdayMap[int(beginDate.Weekday())]),
|
||||
}
|
||||
if i == 0 {
|
||||
timeInfo.TimeList = append(timeInfo.TimeList, &DeliveryTimeItem{
|
||||
|
||||
@@ -5,7 +5,9 @@ import (
|
||||
"net/http"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/wxpayapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/jx/localjx"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
@@ -17,7 +19,7 @@ type WXPayController struct {
|
||||
func (c *WXPayController) Msg() {
|
||||
if c.Ctx.Input.Method() == http.MethodPost {
|
||||
msg, callbackResponse := api.WxpayAPI.GetCallbackMsg(c.Ctx.Request)
|
||||
// globals.SugarLogger.Debugf("wxpayapi callback msg:%s, callbackResponse:%s, %t", utils.Format4Output(msg, true), utils.Format4Output(callbackResponse, true), callbackResponse == nil)
|
||||
globals.SugarLogger.Debugf("wxpayapi callback msg:%s, callbackResponse:%s, %t", utils.Format4Output(msg, true), utils.Format4Output(callbackResponse, true), callbackResponse == nil)
|
||||
var err error
|
||||
if callbackResponse == nil {
|
||||
if msg.MsgType == wxpayapi.MsgTypeUnkown {
|
||||
|
||||
Reference in New Issue
Block a user