aa
This commit is contained in:
@@ -2154,12 +2154,15 @@ func RefreshJdAfsOrderTotalShopMoney() {
|
||||
sqlParams := []interface{}{time.Now().AddDate(0, 0, -3), model.VendorIDJD, model.AfsOrderStatusFinished}
|
||||
dao.GetRows(db, &afsOrders, sql, sqlParams)
|
||||
for _, v := range afsOrders {
|
||||
if handler := partner.GetPurchaseOrderHandlerFromVendorID(v.VendorID); handler != nil {
|
||||
if orderAfsInfo, err := handler.GetOrderAfsInfo(nil, v.VendorOrderID, v.AfsOrderID); err == nil && orderAfsInfo.AfsTotalShopMoney != 0 {
|
||||
v.AfsTotalShopMoney = orderAfsInfo.AfsTotalShopMoney
|
||||
//排除物竞天择的
|
||||
if order, _ := partner.CurOrderManager.LoadOrder(v.VendorOrderID, v.VendorID); !strings.Contains(order.BuyerComment, "JD") {
|
||||
if handler := partner.GetPurchaseOrderHandlerFromVendorID(v.VendorID); handler != nil {
|
||||
if orderAfsInfo, err := handler.GetOrderAfsInfo(nil, v.VendorOrderID, v.AfsOrderID); err == nil && orderAfsInfo.AfsTotalShopMoney != 0 {
|
||||
v.AfsTotalShopMoney = orderAfsInfo.AfsTotalShopMoney
|
||||
}
|
||||
}
|
||||
dao.UpdateEntity(db, v, "AfsTotalShopMoney")
|
||||
}
|
||||
dao.UpdateEntity(db, v, "AfsTotalShopMoney")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1563,12 +1563,20 @@ func RefreshJdShopOrdersEarningPrice(ctx *jxcontext.Context, orderStartTime, ord
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var afsOrderList []map[*model.AfsOrder]float64
|
||||
if results != nil {
|
||||
for _, v := range results.BillList.Result {
|
||||
if v.DueAmount != 0 {
|
||||
order, err := partner.CurOrderManager.LoadOrder(utils.Int64ToStr(v.OrderID), model.VendorIDJD)
|
||||
if order == nil || err != nil {
|
||||
continue
|
||||
order, _ := partner.CurOrderManager.LoadOrder(utils.Int64ToStr(v.OrderID), model.VendorIDJD)
|
||||
//可能是物竞天择的售后单
|
||||
if order == nil {
|
||||
if afsOrder, _ := partner.CurOrderManager.LoadAfsOrder(utils.Int64ToStr(v.OrderID), model.VendorIDJD); afsOrder != nil {
|
||||
var afsOrderMap = make(map[*model.AfsOrder]float64)
|
||||
afsOrderMap[afsOrder] = v.DueAmount
|
||||
afsOrderList = append(afsOrderList, afsOrderMap)
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
store, _ := dao.GetStoreDetail(db, jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, order.VendorOrgCode)
|
||||
// stores, _ := dao.GetStoreList(db, []int{jxutils.GetSaleStoreIDFromOrder(order)}, nil, nil, nil, nil, "")
|
||||
@@ -1584,6 +1592,19 @@ func RefreshJdShopOrdersEarningPrice(ctx *jxcontext.Context, orderStartTime, ord
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(afsOrderList) > 0 {
|
||||
for i := len(afsOrderList) - 1; i < 0; i-- {
|
||||
afsOrderMap := afsOrderList[i]
|
||||
for k, v := range afsOrderMap {
|
||||
if order2, _ := partner.CurOrderManager.LoadOrder(k.VendorOrderID, model.VendorIDJD); order2 != nil {
|
||||
if k.AfsTotalShopMoney == 0 && order2.TotalShopMoney != 0 {
|
||||
k.AfsTotalShopMoney = order2.TotalShopMoney - utils.Float64TwoInt64(v*100)
|
||||
dao.UpdateEntity(db, k, "AfsTotalShopMoney")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -107,16 +107,16 @@ func GetCategories(ctx *jxcontext.Context, parentID int, isExd bool) (catList []
|
||||
for _, v := range cats {
|
||||
ids = append(ids, v.ID)
|
||||
}
|
||||
thingMapMap, err2 := dao.GetThingMapMap(db, model.ThingTypeCategory, nil, ids)
|
||||
//thingMapMap, err2 := dao.GetThingMapMap(db, model.ThingTypeCategory, nil, ids)
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(thingMapMap, false))
|
||||
if err = err2; err == nil {
|
||||
for _, v := range cats {
|
||||
catList = append(catList, &dao.SkuCategoryWithVendor{
|
||||
SkuCategory: v,
|
||||
MapList: thingMapMap[int64(v.ID)],
|
||||
})
|
||||
}
|
||||
//if err = err2; err == nil {
|
||||
for _, v := range cats {
|
||||
catList = append(catList, &dao.SkuCategoryWithVendor{
|
||||
SkuCategory: v,
|
||||
//MapList: thingMapMap[int64(v.ID)],
|
||||
})
|
||||
}
|
||||
//}
|
||||
}
|
||||
return catList, err
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte
|
||||
if params["earningType"] != nil {
|
||||
if params["earningType"].(int) != 0 {
|
||||
if params["earningType"].(int) == 1 {
|
||||
sqlWhere += " AND t1.pay_percentage = 100"
|
||||
sqlWhere += " AND t1.pay_percentage >= 50"
|
||||
} else {
|
||||
sqlWhere += " AND t1.pay_percentage < 50"
|
||||
}
|
||||
@@ -438,6 +438,14 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte
|
||||
}
|
||||
}
|
||||
|
||||
if params["mapLongitude"] != nil && params["mapLatitude"] != nil && params["mapRadius"] != nil {
|
||||
mapLongitude := utils.Str2Float64(params["mapLongitude"].(string))
|
||||
mapLatitude := utils.Str2Float64(params["mapLatitude"].(string))
|
||||
mapRadius := params["mapRadius"].(int)
|
||||
sqlWhere += " AND getDistance(?, ?, CAST(t1.lng AS DECIMAL(15,6))/1000000, CAST(t1.lat AS DECIMAL(15,6))/1000000) * 1000 <= ?"
|
||||
sqlWhereParams = append(sqlWhereParams, mapLongitude, mapLatitude, mapRadius)
|
||||
}
|
||||
|
||||
sql = sqlFrom + sqlWhere
|
||||
sqlParams = append(sqlParams, sqlFromParams...)
|
||||
sqlParams = append(sqlParams, sqlWhereParams...)
|
||||
@@ -453,12 +461,12 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
isStoreVendorStatus := false
|
||||
if isBussinessStatus != nil {
|
||||
if isBussinessStatus.(bool) {
|
||||
isStoreVendorStatus = true
|
||||
}
|
||||
}
|
||||
//isStoreVendorStatus := false
|
||||
//if isBussinessStatus != nil {
|
||||
// if isBussinessStatus.(bool) {
|
||||
// isStoreVendorStatus = true
|
||||
// }
|
||||
//}
|
||||
storeMapMap := dao.StoreMapList2Map(storeMapList)
|
||||
storeCourierMap := dao.StoreCourierList2Map(storeCourierList)
|
||||
|
||||
@@ -478,39 +486,75 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn
|
||||
v.CourierMaps = append(v.CourierMaps, v2)
|
||||
}
|
||||
}
|
||||
task := tasksch.NewParallelTask("上下线状态", tasksch.NewParallelConfig().SetParallelCount(4), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
store := batchItemList[0].(*StoreExt)
|
||||
for _, v2 := range store.StoreMaps {
|
||||
if isStoreVendorStatus {
|
||||
if handler := CurVendorSync.GetStoreHandler(v2.VendorID); handler != nil {
|
||||
if store, err := handler.ReadStore(ctx, v2.VendorOrgCode, v2.VendorStoreID); err == nil && store != nil {
|
||||
if store.Status != model.StoreStatusDisabled {
|
||||
v2.BussinessStatus = 1
|
||||
} else {
|
||||
v2.BussinessStatus = -1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return retVal, err
|
||||
}, storesInfo.Stores)
|
||||
task.Run()
|
||||
task.GetResult(0)
|
||||
//task := tasksch.NewParallelTask("上下线状态", tasksch.NewParallelConfig().SetParallelCount(4), ctx,
|
||||
// func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
// store := batchItemList[0].(*StoreExt)
|
||||
// for _, v2 := range store.StoreMaps {
|
||||
// if isStoreVendorStatus {
|
||||
// if handler := CurVendorSync.GetStoreHandler(v2.VendorID); handler != nil {
|
||||
// if store, err := handler.ReadStore(ctx, v2.VendorOrgCode, v2.VendorStoreID); err == nil && store != nil {
|
||||
// if store.Status != model.StoreStatusDisabled {
|
||||
// v2.BussinessStatus = 1
|
||||
// } else {
|
||||
// v2.BussinessStatus = -1
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return retVal, err
|
||||
// }, storesInfo.Stores)
|
||||
//task.Run()
|
||||
//task.GetResult(0)
|
||||
return nil
|
||||
}
|
||||
|
||||
// todo 门店绑定信息可以考虑以数组形式返回,而不是现在这样
|
||||
func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interface{}, offset, pageSize int, orderTimeFrom, orderTimeTo time.Time, orderCountFrom, orderCountTo int) (retVal *StoresInfo, err error) {
|
||||
briefLevel := int(utils.ForceInterface2Int64(params["briefLevel"]))
|
||||
//权限
|
||||
if permission.IsRoled(ctx) {
|
||||
if storeIDsMap, err := permission.GetUserStoresResultMap(ctx.GetUserID()); err == nil {
|
||||
var storeIDs2 []int
|
||||
if params["storeIDs"] != nil {
|
||||
var storeIDs []int
|
||||
if err = utils.UnmarshalUseNumber([]byte(params["storeIDs"].(string)), &storeIDs); err == nil {
|
||||
for _, v := range storeIDs {
|
||||
if storeIDsMap[v] != 0 {
|
||||
storeIDs2 = append(storeIDs2, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(storeIDs2) == 0 {
|
||||
storeIDs2 = append(storeIDs2, -1)
|
||||
}
|
||||
} else {
|
||||
if params["storeID"] != nil {
|
||||
if storeIDsMap[int(utils.Interface2Int64WithDefault(params["storeID"], 0))] == 0 {
|
||||
params["storeID"] = nil
|
||||
}
|
||||
} else {
|
||||
if len(storeIDsMap) > 0 {
|
||||
for k, _ := range storeIDsMap {
|
||||
storeIDs2 = append(storeIDs2, k)
|
||||
}
|
||||
} else {
|
||||
storeIDs2 = append(storeIDs2, -1)
|
||||
}
|
||||
}
|
||||
}
|
||||
if data, err := json.Marshal(storeIDs2); err == nil {
|
||||
params["storeIDs"] = string(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
sql, sqlParams, _, _, err := getStoresSql(ctx, keyword, params, orderTimeFrom, orderTimeTo)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sql = `
|
||||
SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
DISTINCT t1.*,
|
||||
CAST(t1.lng AS DECIMAL(15,6))/1000000 float_lng,
|
||||
CAST(t1.lat AS DECIMAL(15,6))/1000000 float_lat,
|
||||
@@ -528,6 +572,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
(SELECT COUNT(*) FROM store t11 WHERE t11.link_store_id = t1.id) link_store_count
|
||||
` + sql + `
|
||||
ORDER BY t1.id DESC
|
||||
LIMIT ? OFFSET ?
|
||||
`
|
||||
db := dao.GetDB()
|
||||
retVal = &StoresInfo{}
|
||||
@@ -536,62 +581,52 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
var storeList []*StoreExt
|
||||
offset = jxutils.FormalizePageOffset(offset)
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
mapLimit := false
|
||||
// globals.SugarLogger.Debug(sql)
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(sqlParams, false))
|
||||
|
||||
if err = dao.GetRows(db, &storeList, sql, sqlParams...); err == nil {
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
//mapLimit := false
|
||||
//globals.SugarLogger.Debug(sql)
|
||||
//globals.SugarLogger.Debug(utils.Format4Output(sqlParams, false))
|
||||
txDB, _ := dao.Begin(db)
|
||||
if err = dao.GetRowsTx(txDB, &storeList, sql, sqlParams...); err == nil {
|
||||
retVal.Stores = storeList
|
||||
retVal.TotalCount = dao.GetLastTotalRowCount2(db, txDB)
|
||||
// 地图区域限制过滤
|
||||
if mapLongitude2, ok := params["mapLongitude"].(string); ok {
|
||||
var (
|
||||
mapLatitude, mapLongitude float64
|
||||
mapRadius int
|
||||
)
|
||||
mapLimit = true
|
||||
mapLongitude = utils.Str2Float64(mapLongitude2)
|
||||
mapLatitude = utils.Str2Float64(params["mapLatitude"].(string))
|
||||
mapRadius = params["mapRadius"].(int)
|
||||
for _, v := range storeList {
|
||||
valid := !mapLimit
|
||||
if mapLimit {
|
||||
valid = jxutils.EarthDistance(mapLongitude, mapLatitude, v.FloatLng, v.FloatLat)*1000 <= float64(mapRadius)
|
||||
}
|
||||
if valid {
|
||||
retVal.Stores = append(retVal.Stores, v)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
retVal.Stores = storeList
|
||||
}
|
||||
//权限
|
||||
if permission.IsRoled(ctx) {
|
||||
if storeIDsMap, err := permission.GetUserStoresResultMap(ctx.GetUserID()); err == nil {
|
||||
var storeList2 []*StoreExt
|
||||
for _, v := range retVal.Stores {
|
||||
if storeIDsMap[v.ID] != 0 {
|
||||
storeList2 = append(storeList2, v)
|
||||
}
|
||||
}
|
||||
retVal.Stores = nil
|
||||
retVal.Stores = storeList2
|
||||
}
|
||||
}
|
||||
//if mapLongitude2, ok := params["mapLongitude"].(string); ok {
|
||||
// var (
|
||||
// mapLatitude, mapLongitude float64
|
||||
// mapRadius int
|
||||
// )
|
||||
// mapLimit = true
|
||||
// mapLongitude = utils.Str2Float64(mapLongitude2)
|
||||
// mapLatitude = utils.Str2Float64(params["mapLatitude"].(string))
|
||||
// mapRadius = params["mapRadius"].(int)
|
||||
// for _, v := range storeList {
|
||||
// valid := !mapLimit
|
||||
// if mapLimit {
|
||||
// valid = jxutils.EarthDistance(mapLongitude, mapLatitude, v.FloatLng, v.FloatLat)*1000 <= float64(mapRadius)
|
||||
// }
|
||||
// if valid {
|
||||
// retVal.Stores = append(retVal.Stores, v)
|
||||
// }
|
||||
// }
|
||||
//} else {
|
||||
// retVal.Stores = storeList
|
||||
//}
|
||||
// 订单情况过滤
|
||||
storeList, err = filterStoreByOrderInfo(db, retVal.Stores, orderTimeFrom, orderTimeTo, orderCountFrom, orderCountTo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
//storeList, err = filterStoreByOrderInfo(db, retVal.Stores, orderTimeFrom, orderTimeTo, orderCountFrom, orderCountTo)
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
|
||||
// 分页
|
||||
retVal.TotalCount = len(storeList)
|
||||
retVal.Stores = nil
|
||||
for i := offset; i < offset+pageSize && i < len(storeList); i++ {
|
||||
storeIDs = append(storeIDs, storeList[i].ID)
|
||||
retVal.Stores = append(retVal.Stores, storeList[i])
|
||||
}
|
||||
if len(storeIDs) == 0 {
|
||||
return retVal, nil
|
||||
}
|
||||
//retVal.TotalCount = len(storeList)
|
||||
//retVal.Stores = nil
|
||||
//for i := offset; i < offset+pageSize && i < len(storeList); i++ {
|
||||
// storeIDs = append(storeIDs, storeList[i].ID)
|
||||
// retVal.Stores = append(retVal.Stores, storeList[i])
|
||||
//}
|
||||
//if len(storeIDs) == 0 {
|
||||
// return retVal, nil
|
||||
//}
|
||||
|
||||
// 导出门店地图标信息时,可能会需要转换门店坐标
|
||||
needConver2Baidu := int(utils.Interface2Int64WithDefault(params["coordinateType"], 0)) == model.CoordinateTypeBaiDu
|
||||
@@ -620,10 +655,8 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
task.Run()
|
||||
task.GetResult(0)
|
||||
}
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dao.Commit(db, txDB)
|
||||
if len(retVal.Stores) > 0 {
|
||||
setStoreMapInfo(ctx, db, retVal, storeIDs, briefLevel, params["isBussinessStatus"])
|
||||
retVal.MapCenterLng, retVal.MapCenterLat = getMapCenter(retVal.Stores)
|
||||
@@ -4260,7 +4293,7 @@ func RefreshStoreBind(ctx *jxcontext.Context) (err error) {
|
||||
if store.OperatorPhone3 != "" {
|
||||
mobileList = append(mobileList, store.OperatorPhone3)
|
||||
}
|
||||
mobileList = append(mobileList, "18160030913", "15520595380", "18980410281", "18048531223", "18080188338", "13012345678")
|
||||
mobileList = append(mobileList, "18160030913", "15520595380", "18048531223", "18080188338", "13012345678")
|
||||
for _, v := range mobileList {
|
||||
if user, err := dao.GetUserByID(db, "mobile", v); err == nil && user != nil {
|
||||
userIDmap1[user.UserID] = user.UserID
|
||||
@@ -4296,7 +4329,13 @@ func UpdateVendorStoreBussinessStatus(ctx *jxcontext.Context, storeID, vendorID,
|
||||
return err
|
||||
}
|
||||
handler := partner.GetPurchasePlatformFromVendorID(vendorID)
|
||||
err = handler.UpdateStoreLineStatus(ctx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, status)
|
||||
if err = handler.UpdateStoreLineStatus(ctx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, status); err == nil {
|
||||
if storeMaps, _ := dao.GetStoresMapList(db, []int{vendorID}, []int{storeID}, nil, model.StoreStatusAll,
|
||||
model.StoreIsSyncAll, "", "", ""); len(storeMaps) > 0 {
|
||||
storeMaps[0].IsOnline = status
|
||||
dao.UpdateEntity(db, storeMaps[0], "IsOnline")
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -5164,3 +5203,28 @@ func UpdateOrCreateCourierStoresByBrand(ctx *jxcontext.Context, brandID, vendorI
|
||||
hint = task.ID
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func RefreshStoreIsOnline(ctx *jxcontext.Context) (err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
stores, _ := dao.GetStoresMapList(db, []int{model.VendorIDMTWM, model.VendorIDJD, model.VendorIDEBAI}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "")
|
||||
task := tasksch.NewParallelTask("RefreshStoreBind", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
storeMap := batchItemList[0].(*model.StoreMap)
|
||||
if handler := CurVendorSync.GetStoreHandler(storeMap.VendorID); handler != nil {
|
||||
if store, err := handler.ReadStore(ctx, storeMap.VendorOrgCode, storeMap.VendorStoreID); err == nil && store != nil {
|
||||
if store.Status != model.StoreStatusDisabled {
|
||||
storeMap.IsOnline = 1
|
||||
} else {
|
||||
storeMap.IsOnline = -1
|
||||
}
|
||||
dao.UpdateEntity(db, storeMap, "IsOnline")
|
||||
}
|
||||
}
|
||||
return retVal, err
|
||||
}, stores)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
task.GetID()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -186,12 +186,19 @@ func Init() {
|
||||
orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-30*time.Minute), time.Now())
|
||||
}, 5*time.Second, 10*time.Minute)
|
||||
|
||||
//刷新京东物竞天择订单结算价
|
||||
ScheduleTimerFunc("RefreshJdShopOrdersEarningPrice", func() {
|
||||
orderman.RefreshJdShopOrdersEarningPrice(jxcontext.AdminCtx, utils.Time2Str(time.Now().AddDate(0, 0, -2)), utils.Time2Str(time.Now().AddDate(0, 0, -2)))
|
||||
orderman.RefreshJdShopOrdersEarningPrice(jxcontext.AdminCtx, utils.Time2Str(time.Now().AddDate(0, 0, -1)), utils.Time2Str(time.Now().AddDate(0, 0, -1)))
|
||||
}, []string{
|
||||
"05:00:00",
|
||||
})
|
||||
//刷新京东售后单结算价
|
||||
ScheduleTimerFunc("RefreshJdAfsOrderTotalShopMoney", func() {
|
||||
orderman.RefreshJdAfsOrderTotalShopMoney()
|
||||
}, []string{
|
||||
"05:30:00",
|
||||
})
|
||||
|
||||
ScheduleTimerFunc("auto enable remote store", func() {
|
||||
cms.EnableHaveRestStores(jxcontext.AdminCtx, false, true)
|
||||
@@ -276,10 +283,6 @@ func Init() {
|
||||
ScheduleTimerFunc("SendQywxPeopleCount", func() {
|
||||
cms.SendQywxPeopleCount(jxcontext.AdminCtx)
|
||||
}, dailyHeartbeat)
|
||||
//刷新京东售后单结算价
|
||||
ScheduleTimerFunc("RefreshJdAfsOrderTotalShopMoney", func() {
|
||||
orderman.RefreshJdAfsOrderTotalShopMoney()
|
||||
}, openRemoteStoreTimeList)
|
||||
ScheduleTimerFunc("doDailyWork1", func() {
|
||||
//同步商品额外前缀和水印图(打标记)
|
||||
cms.SyncSkuExperfixAndWatermark(jxcontext.AdminCtx)
|
||||
@@ -324,6 +327,8 @@ func Init() {
|
||||
RefreshAfsOrderStatusAccess(jxcontext.AdminCtx)
|
||||
//刷新门店分组管理
|
||||
cms.RefreshStoreBind(jxcontext.AdminCtx)
|
||||
//更新所有门店的上下线状态
|
||||
cms.RefreshStoreIsOnline(jxcontext.AdminCtx)
|
||||
}, dailyWorkTimeList)
|
||||
ScheduleTimerFunc("RrefreshMtwmVendorAct", func() {
|
||||
//刷新美团平台活动
|
||||
|
||||
@@ -796,11 +796,9 @@ func OrderNotifyReport(ctx *jxcontext.Context, storeIDs, brandIDs []int, vendorI
|
||||
LEFT JOIN store b ON IF(a.store_id = 0 ,a.jx_store_id, a.store_id) = b.id
|
||||
LEFT JOIN user c ON c.mobile = b.market_man_phone
|
||||
LEFT JOIN user d ON d.mobile = b.operator_phone
|
||||
WHERE a.status = ? AND a.notify_type <> ?
|
||||
WHERE a.notify_type <> ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
model.OrderStatusFinished, 0,
|
||||
}
|
||||
sqlParams := []interface{}{0}
|
||||
if len(storeIDs) > 0 {
|
||||
sql += ` AND IF(a.jx_store_id != 0, a.jx_store_id, a.store_id) IN(` + dao.GenQuestionMarks(len(storeIDs)) + `)`
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
|
||||
@@ -4,8 +4,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
dyvmsapiclient "github.com/alibabacloud-go/dyvmsapi-20170525-2.0.2/client"
|
||||
"github.com/alibabacloud-go/tea/tea"
|
||||
"net"
|
||||
"regexp"
|
||||
"strconv"
|
||||
@@ -1987,17 +1985,8 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
// }
|
||||
// go connHandler(conn, "1e000f02000151323032313036313530303030313"+utils.Int2Str(i)+"00000033")
|
||||
//}
|
||||
mobileNum := "18160030913"
|
||||
templateParam := map[string]interface{}{
|
||||
"tel": "111111",
|
||||
}
|
||||
request := &dyvmsapiclient.SingleCallByTtsRequest{
|
||||
CalledNumber: tea.String(mobileNum),
|
||||
TtsCode: tea.String(globals.SMSVoicePickOrderTemplate),
|
||||
TtsParam: tea.String(string(utils.MustMarshal(templateParam))),
|
||||
}
|
||||
_, _err := api.VoiceClient.SingleCallByTts(request)
|
||||
return _err
|
||||
cms.RefreshStoreIsOnline(jxcontext.AdminCtx)
|
||||
return err
|
||||
}
|
||||
|
||||
func Hextob(str string) []byte {
|
||||
|
||||
@@ -451,13 +451,13 @@ type StoreMap struct {
|
||||
|
||||
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
||||
Status int `json:"status"` // 取值同Store.Status
|
||||
IsOnline int `json:"isOnline"` //上下线状态, -1是下线,1是上线
|
||||
StoreName string `orm:"size(255)" json:"storeName"` // 平台门店的名字,由平台到京西
|
||||
VendorStoreName string `orm:"size(255)" json:"vendorStoreName"` //平台门店名,由京西到平台
|
||||
VendorPayPercentage int `json:"vendorPayPercentage"` //平台结算比例
|
||||
|
||||
PricePercentage int16 `orm:"default(100)" json:"pricePercentage"` // todo 厂商价格相对于本地价格的百分比,这个字段的修改会比较特殊,因为可能需要刷新厂商价格
|
||||
PricePercentagePack string `orm:"size(32)" json:"pricePercentagePack"` //
|
||||
|
||||
PricePercentage int16 `orm:"default(100)" json:"pricePercentage"` // todo 厂商价格相对于本地价格的百分比,这个字段的修改会比较特殊,因为可能需要刷新厂商价格
|
||||
PricePercentagePack string `orm:"size(32)" json:"pricePercentagePack"` //
|
||||
FreightDeductionPack string `orm:"size(32)" json:"freightDeductionPack"` //
|
||||
|
||||
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
|
||||
|
||||
@@ -362,32 +362,38 @@ func (p *PurchaseHandler) RefreshAllStoresID(ctx *jxcontext.Context, parentTask
|
||||
// todo 此函数只考虑了在饿了么侧开店的情况
|
||||
func EbaiDeliveryType2Jx(deliveryType string) int8 {
|
||||
spIndex := strings.Index(deliveryType, "|")
|
||||
elmDeliveryType := utils.Str2Int64(deliveryType[:spIndex])
|
||||
switch elmDeliveryType {
|
||||
case ebaiapi.DeliveryTypeElmFengNiaoZS,
|
||||
ebaiapi.DeliveryTypeElmFengNiaoZSKA,
|
||||
ebaiapi.DeliveryTypeElmFengNiaoKS,
|
||||
ebaiapi.DeliveryTypeElmNewRetail,
|
||||
ebaiapi.DeliveryTypeElmEPeiSong,
|
||||
ebaiapi.DeliveryTypeElmFengNiaoHybrid,
|
||||
ebaiapi.DeliveryTypeElmFengNiaoNiubee:
|
||||
return scheduler.StoreDeliveryTypeByPlatform
|
||||
case ebaiapi.DeliveryTypeElmXingHuoZBTrial,
|
||||
ebaiapi.DeliveryTypeElmXingHuoZB,
|
||||
ebaiapi.DeliveryTypeElmXingHuoZBKA:
|
||||
return scheduler.StoreDeliveryTypeCrowdSourcing
|
||||
case ebaiapi.DeliveryTypeElmNone,
|
||||
ebaiapi.DeliveryTypeElmXingHuoTrial,
|
||||
ebaiapi.DeliveryTypeElmXingHuo,
|
||||
ebaiapi.DeliveryTypeElmEBase,
|
||||
ebaiapi.DeliveryTypeElmXingHuoKA:
|
||||
return scheduler.StoreDeliveryTypeByStore
|
||||
default:
|
||||
return scheduler.StoreDeliveryTypeCrowdSourcing
|
||||
if deliveryType != "" {
|
||||
elmDeliveryType := utils.Str2Int64(deliveryType[:spIndex])
|
||||
switch elmDeliveryType {
|
||||
case ebaiapi.DeliveryTypeElmFengNiaoZS,
|
||||
ebaiapi.DeliveryTypeElmFengNiaoZSKA,
|
||||
ebaiapi.DeliveryTypeElmFengNiaoKS,
|
||||
ebaiapi.DeliveryTypeElmNewRetail,
|
||||
ebaiapi.DeliveryTypeElmEPeiSong,
|
||||
ebaiapi.DeliveryTypeElmFengNiaoHybrid,
|
||||
ebaiapi.DeliveryTypeElmFengNiaoNiubee:
|
||||
return scheduler.StoreDeliveryTypeByPlatform
|
||||
case ebaiapi.DeliveryTypeElmXingHuoZBTrial,
|
||||
ebaiapi.DeliveryTypeElmXingHuoZB,
|
||||
ebaiapi.DeliveryTypeElmXingHuoZBKA:
|
||||
return scheduler.StoreDeliveryTypeCrowdSourcing
|
||||
case ebaiapi.DeliveryTypeElmNone,
|
||||
ebaiapi.DeliveryTypeElmXingHuoTrial,
|
||||
ebaiapi.DeliveryTypeElmXingHuo,
|
||||
ebaiapi.DeliveryTypeElmEBase,
|
||||
ebaiapi.DeliveryTypeElmXingHuoKA:
|
||||
return scheduler.StoreDeliveryTypeByStore
|
||||
default:
|
||||
return scheduler.StoreDeliveryTypeCrowdSourcing
|
||||
}
|
||||
}
|
||||
return scheduler.StoreDeliveryTypeCrowdSourcing
|
||||
}
|
||||
|
||||
func EbaiDeliveryRegion2Jx(deliveryRegion interface{}) string {
|
||||
if deliveryRegion == nil {
|
||||
return ""
|
||||
}
|
||||
realDeliveryRegion := deliveryRegion.([]interface{})
|
||||
if len(realDeliveryRegion) > 0 {
|
||||
region := deliveryRegion.([]interface{})[0].(map[string]interface{})["region"].([]interface{})[0].([]interface{})
|
||||
|
||||
@@ -22,19 +22,21 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendo
|
||||
// result, err := api.JdShopAPI.NewInfoList(utils.Str2Int64(vendorStoreID))
|
||||
// storeDetail.VendorStoreID = vendorStoreID
|
||||
// storeDetail.Status = JdsStatus2jxStatus(result.StoreStatus)
|
||||
result2, err := api.JdShopAPI.QueryEntityStore(utils.Str2Int64(vendorStoreID))
|
||||
if result2 == nil {
|
||||
return storeDetail, fmt.Errorf("未查询到该平台门店,平台门店ID:[%v]", vendorStoreID)
|
||||
if vendorStoreID != "" {
|
||||
result2, _ := api.JdShopAPI.QueryEntityStore(utils.Str2Int64(vendorStoreID))
|
||||
if result2 == nil {
|
||||
return storeDetail, fmt.Errorf("未查询到该平台门店,平台门店ID:[%v]", vendorStoreID)
|
||||
}
|
||||
storeDetail = &dao.StoreDetail{}
|
||||
storeDetail.ID = utils.Str2Int(result2.ExStoreID)
|
||||
storeDetail.Name = result2.StoreName
|
||||
storeDetail.Address = result2.Address
|
||||
storeDetail.Tel1 = result2.Phone
|
||||
storeDetail.DistrictCode = result2.AddrCode
|
||||
zbs := strings.Split(result2.Coordinate, ",")
|
||||
storeDetail.Lat = jxutils.StandardCoordinate2Int(utils.Str2Float64(zbs[0]))
|
||||
storeDetail.Lng = jxutils.StandardCoordinate2Int(utils.Str2Float64(zbs[1]))
|
||||
}
|
||||
storeDetail = &dao.StoreDetail{}
|
||||
storeDetail.ID = utils.Str2Int(result2.ExStoreID)
|
||||
storeDetail.Name = result2.StoreName
|
||||
storeDetail.Address = result2.Address
|
||||
storeDetail.Tel1 = result2.Phone
|
||||
storeDetail.DistrictCode = result2.AddrCode
|
||||
zbs := strings.Split(result2.Coordinate, ",")
|
||||
storeDetail.Lat = jxutils.StandardCoordinate2Int(utils.Str2Float64(zbs[0]))
|
||||
storeDetail.Lng = jxutils.StandardCoordinate2Int(utils.Str2Float64(zbs[1]))
|
||||
return storeDetail, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user