!!!门店相关的API全部添加vendorOrgCode依赖
This commit is contained in:
@@ -562,9 +562,9 @@ func getMapCenter(storeList []*StoreExt) (lng, lat float64) {
|
|||||||
return getMapCenter(newStoreList)
|
return getMapCenter(newStoreList)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetVendorStore(ctx *jxcontext.Context, vendorStoreID string, vendorID int) (retVal *StoreExt, err error) {
|
func GetVendorStore(ctx *jxcontext.Context, vendorID int, vendorOrgCode, vendorStoreID string) (retVal *StoreExt, err error) {
|
||||||
if handler := CurVendorSync.GetStoreHandler(vendorID); handler != nil {
|
if handler := CurVendorSync.GetStoreHandler(vendorID); handler != nil {
|
||||||
result, err2 := handler.ReadStore(ctx, vendorStoreID)
|
result, err2 := handler.ReadStore(ctx, vendorOrgCode, vendorStoreID)
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
retVal = &StoreExt{
|
retVal = &StoreExt{
|
||||||
Store: result.Store,
|
Store: result.Store,
|
||||||
@@ -961,7 +961,7 @@ func GetStoreVendorMaps(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, vend
|
|||||||
}
|
}
|
||||||
|
|
||||||
// todo 需要对字段做有效性检查
|
// todo 需要对字段做有效性检查
|
||||||
func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, storeMap *model.StoreMap) (outStoreMap *model.StoreMap, err error) {
|
func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vendorOrgCode string, storeID int, storeMap *model.StoreMap) (outStoreMap *model.StoreMap, err error) {
|
||||||
if storeID == 0 {
|
if storeID == 0 {
|
||||||
return nil, fmt.Errorf("storeID不能为0")
|
return nil, fmt.Errorf("storeID不能为0")
|
||||||
}
|
}
|
||||||
@@ -970,7 +970,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID
|
|||||||
}
|
}
|
||||||
userName := ctx.GetUserName()
|
userName := ctx.GetUserName()
|
||||||
if handler := CurVendorSync.GetStoreHandler(vendorID); handler != nil {
|
if handler := CurVendorSync.GetStoreHandler(vendorID); handler != nil {
|
||||||
store, err2 := handler.ReadStore(ctx, storeMap.VendorStoreID)
|
store, err2 := handler.ReadStore(ctx, vendorOrgCode, storeMap.VendorStoreID)
|
||||||
if err = err2; err == nil || storeMap.IsSync == 0 {
|
if err = err2; err == nil || storeMap.IsSync == 0 {
|
||||||
dao.WrapAddIDCULDEntity(storeMap, userName)
|
dao.WrapAddIDCULDEntity(storeMap, userName)
|
||||||
storeMap.StoreID = storeID
|
storeMap.StoreID = storeID
|
||||||
@@ -1020,7 +1020,7 @@ func DeleteStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
|||||||
storeMap.DeletedAt = utils.DefaultTimeValue
|
storeMap.DeletedAt = utils.DefaultTimeValue
|
||||||
if err = dao.GetEntity(db, storeMap, model.FieldStoreID, model.FieldVendorID, model.FieldDeletedAt); err == nil {
|
if err = dao.GetEntity(db, storeMap, model.FieldStoreID, model.FieldVendorID, model.FieldDeletedAt); err == nil {
|
||||||
if handler := partner.GetPurchasePlatformFromVendorID(vendorID); handler != nil {
|
if handler := partner.GetPurchasePlatformFromVendorID(vendorID); handler != nil {
|
||||||
handler.UpdateStoreCustomID(ctx, storeMap.VendorStoreID, utils.Str2Int64WithDefault(storeMap.VendorStoreID, 0))
|
handler.UpdateStoreCustomID(ctx, storeMap.VendorOrgCode, storeMap.VendorStoreID, utils.Str2Int64WithDefault(storeMap.VendorStoreID, 0))
|
||||||
}
|
}
|
||||||
num, err = dao.DeleteEntityLogically(db, storeMap, map[string]interface{}{
|
num, err = dao.DeleteEntityLogically(db, storeMap, map[string]interface{}{
|
||||||
model.FieldStatus: model.StoreStatusDisabled,
|
model.FieldStatus: model.StoreStatusDisabled,
|
||||||
@@ -1076,7 +1076,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if vendorStoreID := utils.Interface2String(valid["vendorStoreID"]); vendorStoreID != "" {
|
if vendorStoreID := utils.Interface2String(valid["vendorStoreID"]); vendorStoreID != "" {
|
||||||
vendorStoreInfo, err2 := storeHandler.ReadStore(ctx, vendorStoreID)
|
vendorStoreInfo, err2 := storeHandler.ReadStore(ctx, storeMap.VendorOrgCode, vendorStoreID)
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
valid["deliveryType"] = vendorStoreInfo.DeliveryType
|
valid["deliveryType"] = vendorStoreInfo.DeliveryType
|
||||||
}
|
}
|
||||||
@@ -1591,7 +1591,7 @@ func GetStoresVendorSnapshot(ctx *jxcontext.Context, parentTask tasksch.ITask, v
|
|||||||
storeMap := batchItemList[0].(*model.StoreMap)
|
storeMap := batchItemList[0].(*model.StoreMap)
|
||||||
if model.IsVendorRemote(storeMap.VendorID) {
|
if model.IsVendorRemote(storeMap.VendorID) {
|
||||||
if handler := partner.GetPurchasePlatformFromVendorID(storeMap.VendorID); handler != nil {
|
if handler := partner.GetPurchasePlatformFromVendorID(storeMap.VendorID); handler != nil {
|
||||||
store, err2 := handler.ReadStore(ctx, storeMap.VendorStoreID)
|
store, err2 := handler.ReadStore(ctx, storeMap.VendorOrgCode, storeMap.VendorStoreID)
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
retVal = []interface{}{&model.VendorStoreSnapshot{
|
retVal = []interface{}{&model.VendorStoreSnapshot{
|
||||||
StoreID: storeMap.StoreID,
|
StoreID: storeMap.StoreID,
|
||||||
@@ -1664,7 +1664,7 @@ func updateVendorStoreStatusBySnapshot(db *dao.DaoDB, curSnapshotList []*model.V
|
|||||||
if snapshot := snapshotMap[jxutils.Combine2Int(v.StoreID, v.VendorID)]; snapshot != nil {
|
if snapshot := snapshotMap[jxutils.Combine2Int(v.StoreID, v.VendorID)]; snapshot != nil {
|
||||||
if snapshot.IsAutoOrder == 1 {
|
if snapshot.IsAutoOrder == 1 {
|
||||||
if handler, ok := partner.GetPurchasePlatformFromVendorID(snapshot.VendorID).(partner.IStoreHandler); ok {
|
if handler, ok := partner.GetPurchasePlatformFromVendorID(snapshot.VendorID).(partner.IStoreHandler); ok {
|
||||||
handler.EnableAutoAcceptOrder(jxcontext.AdminCtx, v.StoreID, v.VendorStoreID, false)
|
handler.EnableAutoAcceptOrder(jxcontext.AdminCtx, v.VendorOrgCode, v.StoreID, v.VendorStoreID, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2296,7 +2296,7 @@ func GetVendorStoreInfo(ctx *jxcontext.Context, vendorIDList []int, isAsync, isC
|
|||||||
case 0:
|
case 0:
|
||||||
for _, vendorID := range vendorIDList {
|
for _, vendorID := range vendorIDList {
|
||||||
iStoreHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IStoreHandler)
|
iStoreHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IStoreHandler)
|
||||||
storeIDs, err := iStoreHandler.GetAllStoresVendorID(ctx)
|
storeIDs, err := iStoreHandler.GetAllStoresVendorID(ctx, "") // TODO
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -2305,13 +2305,13 @@ func GetVendorStoreInfo(ctx *jxcontext.Context, vendorIDList []int, isAsync, isC
|
|||||||
storeID := batchItemList[0].(string)
|
storeID := batchItemList[0].(string)
|
||||||
if partner.IsMultiStore(vendorID) {
|
if partner.IsMultiStore(vendorID) {
|
||||||
multiHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IMultipleStoresHandler)
|
multiHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IMultipleStoresHandler)
|
||||||
storeDetail, err = multiHandler.ReadStore(ctx, storeID)
|
storeDetail, err = multiHandler.ReadStore(ctx, "", storeID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return retVal, err
|
return retVal, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
singleHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreHandler)
|
singleHandler, _ := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreHandler)
|
||||||
storeDetail, err = singleHandler.ReadStore(ctx, storeID)
|
storeDetail, err = singleHandler.ReadStore(ctx, "", storeID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return retVal, err
|
return retVal, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func OpenRemoteStoreByJxStatus(ctx *jxcontext.Context, vendorIDs, storeIDs []int
|
|||||||
if handler, _ := partner.GetPurchasePlatformFromVendorID(storeMap.VendorID).(partner.IStoreHandler); handler != nil {
|
if handler, _ := partner.GetPurchasePlatformFromVendorID(storeMap.VendorID).(partner.IStoreHandler); handler != nil {
|
||||||
storeDetail, err := dao.GetStoreDetail(db, storeMap.StoreID, storeMap.VendorID)
|
storeDetail, err := dao.GetStoreDetail(db, storeMap.StoreID, storeMap.VendorID)
|
||||||
if err == nil && storeDetail.Status == model.StoreStatusOpened {
|
if err == nil && storeDetail.Status == model.StoreStatusOpened {
|
||||||
if err = handler.UpdateStoreStatus(ctx, storeMap.StoreID, storeMap.VendorStoreID, model.StoreStatusOpened); err == nil {
|
if err = handler.UpdateStoreStatus(ctx, storeMap.VendorOrgCode, storeMap.StoreID, storeMap.VendorStoreID, model.StoreStatusOpened); err == nil {
|
||||||
storeMap.Status = model.StoreStatusOpened
|
storeMap.Status = model.StoreStatusOpened
|
||||||
dao.UpdateEntity(db, storeMap, model.FieldStatus)
|
dao.UpdateEntity(db, storeMap, model.FieldStatus)
|
||||||
retVal = []int{1}
|
retVal = []int{1}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ func AddOrDelExtraStoreOptime(ctx *jxcontext.Context, vendorID, storeID int, ven
|
|||||||
opTimeList = []int16{startOpStoreTime, endOpStoreTime}
|
opTimeList = []int16{startOpStoreTime, endOpStoreTime}
|
||||||
}
|
}
|
||||||
handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IStoreHandler)
|
handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IStoreHandler)
|
||||||
return handler.UpdateStoreOpTime(ctx, storeID, vendorStoreID, opTimeList) == nil
|
return handler.UpdateStoreOpTime(ctx, "", storeID, vendorStoreID, opTimeList) == nil // TODO vendorOrgCode应该用传入的值
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetStockValue(isStart bool) int {
|
func GetStockValue(isStart bool) int {
|
||||||
|
|||||||
@@ -1202,7 +1202,7 @@ func FixMtwmCategory(ctx *jxcontext.Context, mtwmStoreIDs []int, isAsync, isCont
|
|||||||
name2CatMap[v.Name] = v
|
name2CatMap[v.Name] = v
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
storeIDs, err := mtwm.CurPurchaseHandler.GetAllStoresVendorID(ctx)
|
storeIDs, err := mtwm.CurPurchaseHandler.GetAllStoresVendorID(ctx, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import (
|
|||||||
type StoreDetail struct {
|
type StoreDetail struct {
|
||||||
model.Store
|
model.Store
|
||||||
|
|
||||||
|
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||||
|
|
||||||
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
||||||
VendorStatus int `json:"vendor_status"` // 取值同Store.Status
|
VendorStatus int `json:"vendor_status"` // 取值同Store.Status
|
||||||
DeliveryFee int `json:"deliveryFee"`
|
DeliveryFee int `json:"deliveryFee"`
|
||||||
|
|||||||
@@ -373,6 +373,8 @@ type StoreMap struct {
|
|||||||
|
|
||||||
StoreID int `orm:"column(store_id)" json:"storeID"`
|
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||||
|
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||||
|
|
||||||
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
||||||
Status int `json:"status"` // 取值同Store.Status
|
Status int `json:"status"` // 取值同Store.Status
|
||||||
StoreName string `orm:"size(255)" json:"storeName"` // 平台门店的名字
|
StoreName string `orm:"size(255)" json:"storeName"` // 平台门店的名字
|
||||||
@@ -466,6 +468,7 @@ func (*PriceReferSnapshot) TableIndex() [][]string {
|
|||||||
type VendorStoreSnapshot struct {
|
type VendorStoreSnapshot struct {
|
||||||
ModelIDCULD
|
ModelIDCULD
|
||||||
|
|
||||||
|
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||||
StoreID int `orm:"column(store_id)" json:"storeID"`
|
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||||
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
|
||||||
|
|||||||
@@ -141,13 +141,14 @@ type IPurchasePlatformHandler interface {
|
|||||||
|
|
||||||
////////
|
////////
|
||||||
// Store
|
// Store
|
||||||
ReadStore(ctx *jxcontext.Context, vendorStoreID string) (store *dao.StoreDetail, err error)
|
ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string) (store *dao.StoreDetail, err error)
|
||||||
UpdateStore(db *dao.DaoDB, storeID int, userName string) (err error)
|
UpdateStore(db *dao.DaoDB, storeID int, userName string) (err error)
|
||||||
GetStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeStatus int, err error)
|
GetStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string) (storeStatus int, err error)
|
||||||
UpdateStoreCustomID(ctx *jxcontext.Context, vendorStoreID string, storeID int64) (err error)
|
UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string, storeID int64) (err error)
|
||||||
|
|
||||||
RefreshAllStoresID(ctx *jxcontext.Context, parentTask tasksch.ITask, isAsync bool) (hint string, err error)
|
RefreshAllStoresID(ctx *jxcontext.Context, parentTask tasksch.ITask, isAsync bool) (hint string, err error)
|
||||||
|
|
||||||
|
// TODO 此函数也需要加vendorOrgCode
|
||||||
UploadImg(ctx *jxcontext.Context, imgURL string, imgData []byte, imgName string, imgType int) (imgHint string, err error)
|
UploadImg(ctx *jxcontext.Context, imgURL string, imgData []byte, imgName string, imgType int) (imgHint string, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type IStoreHandler interface {
|
type IStoreHandler interface {
|
||||||
GetAllStoresVendorID(ctx *jxcontext.Context) (vendorStoreIDs []string, err error)
|
GetAllStoresVendorID(ctx *jxcontext.Context, vendorOrgCode string) (vendorStoreIDs []string, err error)
|
||||||
|
|
||||||
EnableAutoAcceptOrder(ctx *jxcontext.Context, storeID int, vendorStoreID string, isSetEnable bool) (err error)
|
EnableAutoAcceptOrder(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, isSetEnable bool) (err error)
|
||||||
UpdateStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string, status int) (err error)
|
UpdateStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, status int) (err error)
|
||||||
// opTime格式为整数1130代表11:30
|
// opTime格式为整数1130代表11:30
|
||||||
UpdateStoreOpTime(ctx *jxcontext.Context, storeID int, vendorStoreID string, opTimeList []int16) (err error)
|
UpdateStoreOpTime(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, opTimeList []int16) (err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同步资质信息至平台
|
// 同步资质信息至平台
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, parentTask tasksch.
|
|||||||
toDate := fromDate.Add(24*time.Hour - 1)
|
toDate := fromDate.Add(24*time.Hour - 1)
|
||||||
var vendorStoreIDs []string
|
var vendorStoreIDs []string
|
||||||
if vendorStoreID == "" {
|
if vendorStoreID == "" {
|
||||||
vendorStoreIDs, err = c.GetAllStoresVendorID(ctx)
|
vendorStoreIDs, err = c.GetAllStoresVendorID(ctx, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const (
|
|||||||
|
|
||||||
type tEbaiStoreInfo struct {
|
type tEbaiStoreInfo struct {
|
||||||
model.Store
|
model.Store
|
||||||
|
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||||
VendorStoreID string `orm:"column(vendor_store_id)"`
|
VendorStoreID string `orm:"column(vendor_store_id)"`
|
||||||
RealLastOperator string
|
RealLastOperator string
|
||||||
EbaiStoreStatus int
|
EbaiStoreStatus int
|
||||||
@@ -79,7 +80,7 @@ func getCoordintate(data interface{}) float64 {
|
|||||||
return utils.MustInterface2Float64(data)
|
return utils.MustInterface2Float64(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string) (*dao.StoreDetail, error) {
|
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string) (*dao.StoreDetail, error) {
|
||||||
baiduShopID := utils.Str2Int64WithDefault(vendorStoreID, 0)
|
baiduShopID := utils.Str2Int64WithDefault(vendorStoreID, 0)
|
||||||
if baiduShopID == 0 {
|
if baiduShopID == 0 {
|
||||||
return nil, fmt.Errorf("饿百门店ID:%s非法,应该是一个整数", vendorStoreID)
|
return nil, fmt.Errorf("饿百门店ID:%s非法,应该是一个整数", vendorStoreID)
|
||||||
@@ -150,7 +151,9 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
|
|
||||||
var stores []*tEbaiStoreInfo
|
var stores []*tEbaiStoreInfo
|
||||||
sql := `
|
sql := `
|
||||||
SELECT t1.*, t2.status ebai_store_status, t2.vendor_store_id,
|
SELECT
|
||||||
|
t1.*,
|
||||||
|
t2.status ebai_store_status, t2.vendor_store_id, t2.vendor_org_code,
|
||||||
IF(t1.updated_at > t2.updated_at, t1.last_operator, t2.last_operator) real_last_operator, t2.sync_status
|
IF(t1.updated_at > t2.updated_at, t1.last_operator, t2.last_operator) real_last_operator, t2.sync_status
|
||||||
FROM store t1
|
FROM store t1
|
||||||
JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ? AND (t2.deleted_at = ?)
|
JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ? AND (t2.deleted_at = ?)
|
||||||
@@ -165,7 +168,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
if store.SyncStatus&model.SyncFlagDeletedMask == 0 {
|
if store.SyncStatus&model.SyncFlagDeletedMask == 0 {
|
||||||
shopID = store.ID
|
shopID = store.ID
|
||||||
}
|
}
|
||||||
store2, err2 := p.ReadStore(jxcontext.AdminCtx, store.VendorStoreID)
|
store2, err2 := p.ReadStore(jxcontext.AdminCtx, store.VendorOrgCode, store.VendorStoreID)
|
||||||
// globals.SugarLogger.Debugf("ebai UpdateStore2 store2:%s, err2:%v", utils.Format4Output(store2, true), err2)
|
// globals.SugarLogger.Debugf("ebai UpdateStore2 store2:%s, err2:%v", utils.Format4Output(store2, true), err2)
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
if store2.ID == store.ID {
|
if store2.ID == store.ID {
|
||||||
@@ -174,7 +177,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if shopID > 0 {
|
if shopID > 0 {
|
||||||
err = p.UpdateStoreCustomID(jxcontext.AdminCtx, store.VendorStoreID, int64(shopID))
|
err = p.UpdateStoreCustomID(jxcontext.AdminCtx, "", store.VendorStoreID, int64(shopID))
|
||||||
} else if shopID == 0 {
|
} else if shopID == 0 {
|
||||||
// todo remove out shop id
|
// todo remove out shop id
|
||||||
}
|
}
|
||||||
@@ -410,7 +413,7 @@ func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} {
|
|||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
||||||
ebaiStatus, err := api.EbaiAPI.ShopBusStatusGet("", utils.Str2Int64(vendorStoreID), ebaiapi.PlatformFlagElm)
|
ebaiStatus, err := api.EbaiAPI.ShopBusStatusGet("", utils.Str2Int64(vendorStoreID), ebaiapi.PlatformFlagElm)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
storeStatus = EbaiBusStatus2JxStatus(ebaiStatus)
|
storeStatus = EbaiBusStatus2JxStatus(ebaiStatus)
|
||||||
@@ -425,7 +428,7 @@ func (c *PurchaseHandler) onShopMsgPush(msg *ebaiapi.CallbackMsg) (response *eba
|
|||||||
storeStatus := model.StoreStatusOpened
|
storeStatus := model.StoreStatusOpened
|
||||||
switch utils.Interface2String(msg.Body["msg_type"]) {
|
switch utils.Interface2String(msg.Body["msg_type"]) {
|
||||||
case "online", "offline":
|
case "online", "offline":
|
||||||
storeStatus, err = c.GetStoreStatus(jxcontext.AdminCtx, storeID, vendorStoreID)
|
storeStatus, err = c.GetStoreStatus(jxcontext.AdminCtx, "", storeID, vendorStoreID)
|
||||||
case "shop_open", "shop_pause", "shop_close":
|
case "shop_open", "shop_pause", "shop_close":
|
||||||
if int(utils.ForceInterface2Int64(msg.Body["business_ele"])) == 1 {
|
if int(utils.ForceInterface2Int64(msg.Body["business_ele"])) == 1 {
|
||||||
storeStatus = model.StoreStatusOpened
|
storeStatus = model.StoreStatusOpened
|
||||||
@@ -447,12 +450,12 @@ func (c *PurchaseHandler) GetShopHealthInfo(vendorShopID string) (shopHealthInfo
|
|||||||
return shopHealthInfo, err
|
return shopHealthInfo, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) EnableAutoAcceptOrder(ctx *jxcontext.Context, storeID int, vendorStoreID string, isSetEnable bool) (err error) {
|
func (p *PurchaseHandler) EnableAutoAcceptOrder(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, isSetEnable bool) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string, status int) (err error) {
|
func (c *PurchaseHandler) UpdateStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, status int) (err error) {
|
||||||
store, err := c.ReadStore(ctx, vendorStoreID)
|
store, err := c.ReadStore(ctx, vendorOrgCode, vendorStoreID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -478,7 +481,7 @@ func (c *PurchaseHandler) updateStoreStatus(userName string, storeID int, vendor
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, storeID int, vendorStoreID string, opTimeList []int16) (err error) {
|
func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, opTimeList []int16) (err error) {
|
||||||
params := map[string]interface{}{
|
params := map[string]interface{}{
|
||||||
ebaiapi.KeyBaiduShopID: vendorStoreID,
|
ebaiapi.KeyBaiduShopID: vendorStoreID,
|
||||||
}
|
}
|
||||||
@@ -489,7 +492,7 @@ func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, storeID int,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context) (vendorStoreIDs []string, err error) {
|
func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context, vendorOrgCode string) (vendorStoreIDs []string, err error) {
|
||||||
shopList, err := api.EbaiAPI.ShopList(ebaiapi.SysStatusAll)
|
shopList, err := api.EbaiAPI.ShopList(ebaiapi.SysStatusAll)
|
||||||
if err == nil && len(shopList) > 0 {
|
if err == nil && len(shopList) > 0 {
|
||||||
vendorStoreIDs = make([]string, len(shopList))
|
vendorStoreIDs = make([]string, len(shopList))
|
||||||
@@ -500,7 +503,7 @@ func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context) (vendorSt
|
|||||||
return vendorStoreIDs, err
|
return vendorStoreIDs, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorStoreID string, storeID int64) (err error) {
|
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgCode string, vendorStoreID string, storeID int64) (err error) {
|
||||||
if globals.EnableJdStoreWrite {
|
if globals.EnableJdStoreWrite {
|
||||||
err = api.EbaiAPI.ShopIDBatchUpdate([]string{vendorStoreID}, []string{utils.Int64ToStr(storeID)})
|
err = api.EbaiAPI.ShopIDBatchUpdate([]string{vendorStoreID}, []string{utils.Int64ToStr(storeID)})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestReadStore(t *testing.T) {
|
func TestReadStore(t *testing.T) {
|
||||||
result, err := CurPurchaseHandler.ReadStore(jxcontext.AdminCtx, testShopBaiduID)
|
result, err := CurPurchaseHandler.ReadStore(jxcontext.AdminCtx, "", testShopBaiduID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err.Error())
|
t.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string) (*dao.StoreDetail, error) {
|
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode string, vendorStoreID string) (*dao.StoreDetail, error) {
|
||||||
return nil, errors.New("饿了么还没实现")
|
return nil, errors.New("饿了么还没实现")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,6 +20,6 @@ func (p *PurchaseHandler) RefreshAllStoresID(ctx *jxcontext.Context, parentTask
|
|||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
||||||
return storeStatus, err
|
return storeStatus, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,57 +291,57 @@ func (p *PurchaseHandler) DeleteSku(db *dao.DaoDB, sku *model.Sku, userName stri
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) RefreshAllSkusID(ctx *jxcontext.Context, parentTask tasksch.ITask, isAsync bool) (hint string, err error) {
|
// func (p *PurchaseHandler) RefreshAllSkusID(ctx *jxcontext.Context, parentTask tasksch.ITask, isAsync bool) (hint string, err error) {
|
||||||
globals.SugarLogger.Debugf("jd RefreshAllSkusID")
|
// globals.SugarLogger.Debugf("jd RefreshAllSkusID")
|
||||||
|
|
||||||
db := dao.GetDB()
|
// db := dao.GetDB()
|
||||||
var skuPairs []*jdapi.SkuIDPair
|
// var skuPairs []*jdapi.SkuIDPair
|
||||||
const stepCount = 2
|
// const stepCount = 2
|
||||||
|
|
||||||
rootTask := tasksch.NewSeqTask("jd RefreshAllSkusID", ctx,
|
// rootTask := tasksch.NewSeqTask("jd RefreshAllSkusID", ctx,
|
||||||
func(rootTask *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
// func(rootTask *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||||
switch step {
|
// switch step {
|
||||||
case 0:
|
// case 0:
|
||||||
err = dao.GetRows(db, &skuPairs, `
|
// err = dao.GetRows(db, &skuPairs, `
|
||||||
SELECT t1.id out_sku_id, t1.jd_id sku_id
|
// SELECT t1.id out_sku_id, t1.jd_id sku_id
|
||||||
FROM sku t1
|
// FROM sku t1
|
||||||
WHERE t1.deleted_at = ?
|
// WHERE t1.deleted_at = ?
|
||||||
`, utils.DefaultTimeValue)
|
// `, utils.DefaultTimeValue)
|
||||||
default:
|
// default:
|
||||||
taskName := "RefreshAllSkusID update id"
|
// taskName := "RefreshAllSkusID update id"
|
||||||
if step != stepCount-1 {
|
// if step != stepCount-1 {
|
||||||
taskName = "RefreshAllSkusID update uuid"
|
// taskName = "RefreshAllSkusID update uuid"
|
||||||
}
|
// }
|
||||||
task1 := tasksch.NewParallelTask(taskName, tasksch.NewParallelConfig().SetIsContinueWhenError(true).SetBatchSize(jdapi.MaxBatchSize4BatchUpdateOutSkuId), ctx,
|
// task1 := tasksch.NewParallelTask(taskName, tasksch.NewParallelConfig().SetIsContinueWhenError(true).SetBatchSize(jdapi.MaxBatchSize4BatchUpdateOutSkuId), ctx,
|
||||||
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
// func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
skuPairs := make([]*jdapi.SkuIDPair, len(batchItemList))
|
// skuPairs := make([]*jdapi.SkuIDPair, len(batchItemList))
|
||||||
for k, v := range batchItemList {
|
// for k, v := range batchItemList {
|
||||||
pair := v.(*jdapi.SkuIDPair)
|
// pair := v.(*jdapi.SkuIDPair)
|
||||||
skuPairs[k] = &jdapi.SkuIDPair{
|
// skuPairs[k] = &jdapi.SkuIDPair{
|
||||||
SkuId: pair.SkuId,
|
// SkuId: pair.SkuId,
|
||||||
OutSkuId: pair.OutSkuId,
|
// OutSkuId: pair.OutSkuId,
|
||||||
}
|
// }
|
||||||
if step != stepCount-1 {
|
// if step != stepCount-1 {
|
||||||
skuPairs[k].OutSkuId = utils.GetUUID()
|
// skuPairs[k].OutSkuId = utils.GetUUID()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
globals.SugarLogger.Debug(utils.Format4Output(skuPairs, false))
|
// globals.SugarLogger.Debug(utils.Format4Output(skuPairs, false))
|
||||||
if globals.EnableJdStoreWrite {
|
// if globals.EnableJdStoreWrite {
|
||||||
_, err = getAPI("").BatchUpdateOutSkuId(skuPairs)
|
// _, err = getAPI("").BatchUpdateOutSkuId(skuPairs)
|
||||||
}
|
// }
|
||||||
return nil, err
|
// return nil, err
|
||||||
}, skuPairs)
|
// }, skuPairs)
|
||||||
rootTask.AddChild(task1).Run()
|
// rootTask.AddChild(task1).Run()
|
||||||
_, err = task1.GetResult(0)
|
// _, err = task1.GetResult(0)
|
||||||
}
|
// }
|
||||||
return nil, err
|
// return nil, err
|
||||||
}, stepCount)
|
// }, stepCount)
|
||||||
tasksch.HandleTask(rootTask, parentTask, false).Run()
|
// tasksch.HandleTask(rootTask, parentTask, false).Run()
|
||||||
if !isAsync {
|
// if !isAsync {
|
||||||
_, err = rootTask.GetResult(0)
|
// _, err = rootTask.GetResult(0)
|
||||||
}
|
// }
|
||||||
return rootTask.ID, err
|
// return rootTask.ID, err
|
||||||
}
|
// }
|
||||||
|
|
||||||
func splitAddParams(addParams map[string]interface{}) (spuAddParams, skuAddParams map[string]interface{}) {
|
func splitAddParams(addParams map[string]interface{}) (spuAddParams, skuAddParams map[string]interface{}) {
|
||||||
if addParams != nil {
|
if addParams != nil {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ const (
|
|||||||
|
|
||||||
type tJdStoreInfo struct {
|
type tJdStoreInfo struct {
|
||||||
model.Store
|
model.Store
|
||||||
|
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||||
|
|
||||||
FreightDeductionPack string `orm:"size(32)" json:"freightDeductionPack"` //
|
FreightDeductionPack string `orm:"size(32)" json:"freightDeductionPack"` //
|
||||||
|
|
||||||
@@ -37,8 +38,9 @@ type tJdStoreInfo struct {
|
|||||||
SyncStatus int
|
SyncStatus int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string) (*dao.StoreDetail, error) {
|
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string) (*dao.StoreDetail, error) {
|
||||||
result, err := getAPI("").GetStoreInfoByStationNo2(vendorStoreID)
|
a := getAPI(vendorOrgCode)
|
||||||
|
result, err := a.GetStoreInfoByStationNo2(vendorStoreID)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
retVal := &dao.StoreDetail{
|
retVal := &dao.StoreDetail{
|
||||||
Store: model.Store{
|
Store: model.Store{
|
||||||
@@ -92,7 +94,7 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string
|
|||||||
}
|
}
|
||||||
|
|
||||||
retVal.ID = int(utils.Str2Int64WithDefault(result.OutSystemID, 0))
|
retVal.ID = int(utils.Str2Int64WithDefault(result.OutSystemID, 0))
|
||||||
deliveryRange, err2 := getAPI("").GetDeliveryRangeByStationNo2(vendorStoreID)
|
deliveryRange, err2 := a.GetDeliveryRangeByStationNo2(vendorStoreID)
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
retVal.DeliveryRangeType = int8(deliveryRange.DeliveryRangeType)
|
retVal.DeliveryRangeType = int8(deliveryRange.DeliveryRangeType)
|
||||||
if retVal.DeliveryRangeType == model.DeliveryRangeTypePolygon {
|
if retVal.DeliveryRangeType == model.DeliveryRangeTypePolygon {
|
||||||
@@ -110,9 +112,11 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string
|
|||||||
func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName string) (err error) {
|
func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName string) (err error) {
|
||||||
var stores []*tJdStoreInfo
|
var stores []*tJdStoreInfo
|
||||||
sql := `
|
sql := `
|
||||||
SELECT t1.*, city.jd_code jd_city_code, district.jd_code jd_district_code,
|
SELECT
|
||||||
t2.status jd_store_status, t2.vendor_store_id, IF(t1.updated_at > t2.updated_at, t1.last_operator, t2.last_operator) real_last_operator,
|
t1.*, city.jd_code jd_city_code, district.jd_code jd_district_code,
|
||||||
t2.sync_status, t2.freight_deduction_pack
|
t2.status jd_store_status, t2.vendor_store_id, IF(t1.updated_at > t2.updated_at, t1.last_operator,
|
||||||
|
t2.last_operator) real_last_operator,
|
||||||
|
t2.sync_status, t2.freight_deduction_pack, t2.vendor_org_code
|
||||||
FROM store t1
|
FROM store t1
|
||||||
JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ? AND (t2.deleted_at = ?)
|
JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ? AND (t2.deleted_at = ?)
|
||||||
LEFT JOIN place city ON t1.city_code = city.code
|
LEFT JOIN place city ON t1.city_code = city.code
|
||||||
@@ -122,6 +126,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
`
|
`
|
||||||
if err = dao.GetRows(db, &stores, sql, model.VendorIDJD, utils.DefaultTimeValue, storeID); err == nil {
|
if err = dao.GetRows(db, &stores, sql, model.VendorIDJD, utils.DefaultTimeValue, storeID); err == nil {
|
||||||
for _, store := range stores {
|
for _, store := range stores {
|
||||||
|
a := getAPI(store.VendorOrgCode)
|
||||||
storeParams := &jdapi.OpStoreParams{
|
storeParams := &jdapi.OpStoreParams{
|
||||||
StationNo: store.VendorStoreID,
|
StationNo: store.VendorStoreID,
|
||||||
Operator: userName,
|
Operator: userName,
|
||||||
@@ -163,7 +168,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
globals.SugarLogger.Debug(utils.Format4Output(storeParams, false))
|
globals.SugarLogger.Debug(utils.Format4Output(storeParams, false))
|
||||||
errList := errlist.New()
|
errList := errlist.New()
|
||||||
if globals.EnableJdStoreWrite {
|
if globals.EnableJdStoreWrite {
|
||||||
errList.AddErr(getAPI("").UpdateStoreInfo4Open2(storeParams, modifyCloseStatus))
|
errList.AddErr(a.UpdateStoreInfo4Open2(storeParams, modifyCloseStatus))
|
||||||
}
|
}
|
||||||
if store.FreightDeductionPack != "" {
|
if store.FreightDeductionPack != "" {
|
||||||
storeDetail, err2 := dao.GetStoreDetail(db, store.ID, model.VendorIDJD)
|
storeDetail, err2 := dao.GetStoreDetail(db, store.ID, model.VendorIDJD)
|
||||||
@@ -196,7 +201,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
freightParams.IsFullFree = len(freightParams.FreeFreightInfoList) > 0
|
freightParams.IsFullFree = len(freightParams.FreeFreightInfoList) > 0
|
||||||
globals.SugarLogger.Debug(utils.Format4Output(freightParams, false))
|
globals.SugarLogger.Debug(utils.Format4Output(freightParams, false))
|
||||||
if globals.EnableJdStoreWrite {
|
if globals.EnableJdStoreWrite {
|
||||||
errList.AddErr(getAPI("").UpdateStoreFreightConfigNew(freightParams))
|
errList.AddErr(a.UpdateStoreFreightConfigNew(freightParams))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,7 +244,7 @@ func (p *PurchaseHandler) RefreshAllStoresID(ctx *jxcontext.Context, parentTask
|
|||||||
storeParams.OutSystemID = store.VendorStoreID
|
storeParams.OutSystemID = store.VendorStoreID
|
||||||
}
|
}
|
||||||
if globals.EnableJdStoreWrite {
|
if globals.EnableJdStoreWrite {
|
||||||
err = getAPI("").UpdateStoreInfo4Open2(storeParams, false)
|
err = getAPI(store.VendorOrgCode).UpdateStoreInfo4Open2(storeParams, false)
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}, stores)
|
}, stores)
|
||||||
@@ -265,8 +270,8 @@ func JdDeliveryType2Jx(deliveryType int) int8 {
|
|||||||
return scheduler.StoreDeliveryTypeByPlatform
|
return scheduler.StoreDeliveryTypeByPlatform
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
||||||
result, err := getAPI("").GetStoreInfoByStationNo2(vendorStoreID)
|
result, err := getAPI(vendorOrgCode).GetStoreInfoByStationNo2(vendorStoreID)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
storeStatus = JdStoreStatus2JxStatus(int(result.Yn), result.CloseStatus)
|
storeStatus = JdStoreStatus2JxStatus(int(result.Yn), result.CloseStatus)
|
||||||
}
|
}
|
||||||
@@ -291,15 +296,15 @@ func (c *PurchaseHandler) OnStoreMsg(msg *jdapi.CallbackOrderMsg) (response *jda
|
|||||||
return jdapi.Err2CallbackResponse(err, "")
|
return jdapi.Err2CallbackResponse(err, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) EnableAutoAcceptOrder(ctx *jxcontext.Context, storeID int, vendorStoreID string, isSetEnable bool) (err error) {
|
func (p *PurchaseHandler) EnableAutoAcceptOrder(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, isSetEnable bool) (err error) {
|
||||||
_, err = getAPI("").UpdateStoreConfig4Open(vendorStoreID, isSetEnable)
|
_, err = getAPI(vendorOrgCode).UpdateStoreConfig4Open(vendorStoreID, isSetEnable)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string, status int) (err error) {
|
func (c *PurchaseHandler) UpdateStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, status int) (err error) {
|
||||||
_, closeStatus := JxStoreStatus2JdStatus(status)
|
_, closeStatus := JxStoreStatus2JdStatus(status)
|
||||||
if globals.EnableJdStoreWrite {
|
if globals.EnableJdStoreWrite {
|
||||||
err = getAPI("").UpdateStoreInfo4Open2(&jdapi.OpStoreParams{
|
err = getAPI(vendorOrgCode).UpdateStoreInfo4Open2(&jdapi.OpStoreParams{
|
||||||
StationNo: vendorStoreID,
|
StationNo: vendorStoreID,
|
||||||
Operator: ctx.GetUserName(),
|
Operator: ctx.GetUserName(),
|
||||||
CloseStatus: closeStatus,
|
CloseStatus: closeStatus,
|
||||||
@@ -331,20 +336,20 @@ func fillOpTimeParams(params *jdapi.OpStoreParams, opTimeList []int16) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, storeID int, vendorStoreID string, opTimeList []int16) (err error) {
|
func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, opTimeList []int16) (err error) {
|
||||||
params := &jdapi.OpStoreParams{
|
params := &jdapi.OpStoreParams{
|
||||||
StationNo: vendorStoreID,
|
StationNo: vendorStoreID,
|
||||||
Operator: ctx.GetUserName(),
|
Operator: ctx.GetUserName(),
|
||||||
}
|
}
|
||||||
fillOpTimeParams(params, opTimeList)
|
fillOpTimeParams(params, opTimeList)
|
||||||
if globals.EnableJdStoreWrite {
|
if globals.EnableJdStoreWrite {
|
||||||
err = getAPI("").UpdateStoreInfo4Open2(params, false)
|
err = getAPI(vendorOrgCode).UpdateStoreInfo4Open2(params, false)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context) (vendorStoreIDs []string, err error) {
|
func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context, vendorOrgCode string) (vendorStoreIDs []string, err error) {
|
||||||
vendorStoreIDs, err = getAPI("").GetStationsByVenderId()
|
vendorStoreIDs, err = getAPI(vendorOrgCode).GetStationsByVenderId()
|
||||||
return vendorStoreIDs, err
|
return vendorStoreIDs, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,9 +458,9 @@ func (c *PurchaseHandler) SyncQualify(ctx *jxcontext.Context, storeDetail *dao.S
|
|||||||
return addStoreInfo2Err(err, storeDetail.ID)
|
return addStoreInfo2Err(err, storeDetail.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorStoreID string, storeID int64) (err error) {
|
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string, storeID int64) (err error) {
|
||||||
if globals.EnableJdStoreWrite {
|
if globals.EnableJdStoreWrite {
|
||||||
err = getAPI("").UpdateStoreInfo4Open2(
|
err = getAPI(vendorOrgCode).UpdateStoreInfo4Open2(
|
||||||
&jdapi.OpStoreParams{
|
&jdapi.OpStoreParams{
|
||||||
StationNo: vendorStoreID,
|
StationNo: vendorStoreID,
|
||||||
Operator: ctx.GetUserName(),
|
Operator: ctx.GetUserName(),
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestReadStore(t *testing.T) {
|
func TestReadStore(t *testing.T) {
|
||||||
result, err := new(PurchaseHandler).ReadStore(jxcontext.AdminCtx, TestJdStoreNo)
|
result, err := new(PurchaseHandler).ReadStore(jxcontext.AdminCtx, "", TestJdStoreNo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err.Error())
|
t.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ func TestReadStore(t *testing.T) {
|
|||||||
|
|
||||||
func TestUpdateStore(t *testing.T) {
|
func TestUpdateStore(t *testing.T) {
|
||||||
handler := new(PurchaseHandler)
|
handler := new(PurchaseHandler)
|
||||||
result, err := handler.ReadStore(jxcontext.AdminCtx, TestJdStoreNo)
|
result, err := handler.ReadStore(jxcontext.AdminCtx, "", TestJdStoreNo)
|
||||||
|
|
||||||
// result := &model.Store{}
|
// result := &model.Store{}
|
||||||
// result.ID = 100164
|
// result.ID = 100164
|
||||||
@@ -43,7 +43,7 @@ func TestUpdateStore(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// same
|
// same
|
||||||
result, err = handler.ReadStore(jxcontext.AdminCtx, TestJdStoreNo)
|
result, err = handler.ReadStore(jxcontext.AdminCtx, "", TestJdStoreNo)
|
||||||
if result.Name != newName {
|
if result.Name != newName {
|
||||||
t.Fatalf("result is not same, desired newName:%s, newName:%s", newName, result.Name)
|
t.Fatalf("result is not same, desired newName:%s, newName:%s", newName, result.Name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ package jx
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||||
"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/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"git.rosy.net.cn/jx-callback/business/partner"
|
"git.rosy.net.cn/jx-callback/business/partner"
|
||||||
@@ -74,10 +73,6 @@ func (p *PurchaseHandler) DeleteSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSy
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) RefreshAllSkusID(ctx *jxcontext.Context, parentTask tasksch.ITask, isAsync bool) (hint string, err error) {
|
|
||||||
return hint, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetVendorCategories(ctx *jxcontext.Context) (vendorCats []*model.SkuVendorCategory, err error) {
|
func (p *PurchaseHandler) GetVendorCategories(ctx *jxcontext.Context) (vendorCats []*model.SkuVendorCategory, err error) {
|
||||||
return vendorCats, err
|
return vendorCats, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string) (storeDetail *dao.StoreDetail, err error) {
|
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string) (storeDetail *dao.StoreDetail, err error) {
|
||||||
return storeDetail, err
|
return storeDetail, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,26 +19,26 @@ func (p *PurchaseHandler) RefreshAllStoresID(ctx *jxcontext.Context, parentTask
|
|||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
||||||
return storeStatus, err
|
return storeStatus, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) EnableAutoAcceptOrder(ctx *jxcontext.Context, storeID int, vendorStoreID string, isSetEnable bool) (err error) {
|
func (p *PurchaseHandler) EnableAutoAcceptOrder(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, isSetEnable bool) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string, status int) (err error) {
|
func (c *PurchaseHandler) UpdateStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, status int) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, storeID int, vendorStoreID string, opTimeList []int16) (err error) {
|
func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, opTimeList []int16) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context) (vendorStoreIDs []string, err error) {
|
func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context, vendorOrgCode string) (vendorStoreIDs []string, err error) {
|
||||||
return vendorStoreIDs, err
|
return vendorStoreIDs, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorStoreID string, storeID int64) (err error) {
|
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string, storeID int64) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -576,7 +576,7 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, parentTask tasksch.
|
|||||||
|
|
||||||
var vendorStoreIDs []string
|
var vendorStoreIDs []string
|
||||||
if vendorStoreID == "" {
|
if vendorStoreID == "" {
|
||||||
vendorStoreIDs, err = c.GetAllStoresVendorID(ctx)
|
vendorStoreIDs, err = c.GetAllStoresVendorID(ctx, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ type tEbaiStoreInfo struct {
|
|||||||
DistrictID int `orm:"column(district_id)"`
|
DistrictID int `orm:"column(district_id)"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string) (retVal *dao.StoreDetail, err error) {
|
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string) (retVal *dao.StoreDetail, err error) {
|
||||||
result, err := api.MtwmAPI.PoiGet(vendorStoreID)
|
result, err := api.MtwmAPI.PoiGet(vendorStoreID)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// globals.SugarLogger.Debug(utils.Format4Output(result, false))
|
// globals.SugarLogger.Debug(utils.Format4Output(result, false))
|
||||||
@@ -135,7 +135,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
// if utils.IsErrMatch(err, utils.Int2Str(mtwmapi.ErrCodeCanNotModifyStoreDeliveryInfo), nil) {
|
// if utils.IsErrMatch(err, utils.Int2Str(mtwmapi.ErrCodeCanNotModifyStoreDeliveryInfo), nil) {
|
||||||
// globals.SugarLogger.Infof("mtwm UpdateStore vendorStoreID:%s, params:%s failed with err:%v", storeDetail.VendorStoreID, utils.Format4Output(params, true), err)
|
// globals.SugarLogger.Infof("mtwm UpdateStore vendorStoreID:%s, params:%s failed with err:%v", storeDetail.VendorStoreID, utils.Format4Output(params, true), err)
|
||||||
// if storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
|
// if storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
|
||||||
// err = p.UpdateStoreStatus(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, mergedStoreStatus)
|
// err = p.UpdateStoreStatus(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, mergedStoreStatus)
|
||||||
// } else {
|
// } else {
|
||||||
// err = nil
|
// err = nil
|
||||||
// }
|
// }
|
||||||
@@ -143,9 +143,9 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
// errList.AddErr(err)
|
// errList.AddErr(err)
|
||||||
// }
|
// }
|
||||||
if storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
|
if storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
|
||||||
errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, mergedStoreStatus))
|
errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, mergedStoreStatus))
|
||||||
}
|
}
|
||||||
errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
|
errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
|
||||||
return errList.GetErrListAsOne()
|
return errList.GetErrListAsOne()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ func (p *PurchaseHandler) onStoreStatusChanged(msg *mtwmapi.CallbackMsg) (respon
|
|||||||
} else if poiStatus == mtwmapi.MsgPoiStatusOffline {
|
} else if poiStatus == mtwmapi.MsgPoiStatusOffline {
|
||||||
storeStatus = model.StoreStatusDisabled
|
storeStatus = model.StoreStatusDisabled
|
||||||
} else {
|
} else {
|
||||||
storeStatus, err = p.GetStoreStatus(jxcontext.AdminCtx, 0, vendorStoreID)
|
storeStatus, err = p.GetStoreStatus(jxcontext.AdminCtx, "", 0, vendorStoreID)
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = partner.CurStoreManager.OnStoreStatusChanged(vendorStoreID, model.VendorIDMTWM, storeStatus)
|
err = partner.CurStoreManager.OnStoreStatusChanged(vendorStoreID, model.VendorIDMTWM, storeStatus)
|
||||||
@@ -174,7 +174,7 @@ func (p *PurchaseHandler) onStoreStatusChanged(msg *mtwmapi.CallbackMsg) (respon
|
|||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
||||||
result, err := api.MtwmAPI.PoiGet(vendorStoreID)
|
result, err := api.MtwmAPI.PoiGet(vendorStoreID)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return bizStatusMtwm2JX(result.OpenLevel, result.IsOnline), nil
|
return bizStatusMtwm2JX(result.OpenLevel, result.IsOnline), nil
|
||||||
@@ -182,11 +182,11 @@ func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, storeID int, ve
|
|||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) EnableAutoAcceptOrder(ctx *jxcontext.Context, storeID int, vendorStoreID string, isSetEnable bool) (err error) {
|
func (p *PurchaseHandler) EnableAutoAcceptOrder(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, isSetEnable bool) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string, status int) (err error) {
|
func (c *PurchaseHandler) UpdateStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, status int) (err error) {
|
||||||
openLevel, isOnline := bizStatusJX2Mtwm(status)
|
openLevel, isOnline := bizStatusJX2Mtwm(status)
|
||||||
if globals.EnableMtwmStoreWrite {
|
if globals.EnableMtwmStoreWrite {
|
||||||
if isOnline != mtwmapi.PoiStatusOnline {
|
if isOnline != mtwmapi.PoiStatusOnline {
|
||||||
@@ -255,7 +255,7 @@ func constrainOpTimeList(opTimeList, validOpTimeList []int16) (newOpTimeList []i
|
|||||||
return newOpTimeList
|
return newOpTimeList
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, storeID int, vendorStoreID string, opTimeList []int16) (err error) {
|
func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, opTimeList []int16) (err error) {
|
||||||
shippingTime := openTimeJX2Mtwm(opTimeList)
|
shippingTime := openTimeJX2Mtwm(opTimeList)
|
||||||
if globals.EnableMtwmStoreWrite {
|
if globals.EnableMtwmStoreWrite {
|
||||||
err = api.MtwmAPI.PoiShipTimeUpdate(vendorStoreID, shippingTime)
|
err = api.MtwmAPI.PoiShipTimeUpdate(vendorStoreID, shippingTime)
|
||||||
@@ -272,11 +272,11 @@ func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, storeID int,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context) (vendorStoreIDs []string, err error) {
|
func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context, vendorOrgCode string) (vendorStoreIDs []string, err error) {
|
||||||
vendorStoreIDs, err = api.MtwmAPI.PoiGetIDs()
|
vendorStoreIDs, err = api.MtwmAPI.PoiGetIDs()
|
||||||
return vendorStoreIDs, err
|
return vendorStoreIDs, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorStoreID string, storeID int64) (err error) {
|
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string, storeID int64) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestReadStore(t *testing.T) {
|
func TestReadStore(t *testing.T) {
|
||||||
store, err := CurPurchaseHandler.ReadStore(jxcontext.AdminCtx, "4351018")
|
store, err := CurPurchaseHandler.ReadStore(jxcontext.AdminCtx, "", "4351018")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string) (*dao.StoreDetail, error) {
|
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string) (*dao.StoreDetail, error) {
|
||||||
return nil, errors.New("微盟微商城还没实现")
|
return nil, errors.New("微盟微商城还没实现")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,6 +20,6 @@ func (p *PurchaseHandler) RefreshAllStoresID(ctx *jxcontext.Context, parentTask
|
|||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,17 +98,17 @@ getWeixinTokenKey = "c928ed0d-87a3-441a-8517-f92f0167296f"
|
|||||||
storeName = "京西菜市"
|
storeName = "京西菜市"
|
||||||
|
|
||||||
[dev]
|
[dev]
|
||||||
jdToken = "df97f334-f7d8-4b36-9664-5784d8ae0baf"
|
jdToken = "77e703b7-7997-441b-a12a-2e522efb117a"
|
||||||
jdAppKey = "06692746f7224695ad4788ce340bc854"
|
jdAppKey = "1dba76d40cac446ca500c0391a0b6c9d"
|
||||||
jdSecret = "d6b42a35a7414a5490d811654d745c84"
|
jdSecret = "a88d031a1e7b462cb1579f12e97fe7f4"
|
||||||
|
|
||||||
elmIsProd = false
|
elmIsProd = false
|
||||||
elmToken = "2d2b583447b04b6bba5a6f3faed3559b"
|
elmToken = "2d2b583447b04b6bba5a6f3faed3559b"
|
||||||
elmAppKey = "RwT214gAsS"
|
elmAppKey = "RwT214gAsS"
|
||||||
elmSecret = "56afff4b9ebd8a7eb532d18fa33f17be57f9b9db"
|
elmSecret = "56afff4b9ebd8a7eb532d18fa33f17be57f9b9db"
|
||||||
|
|
||||||
ebaiSource = "62923"
|
ebaiSource = "34665"
|
||||||
ebaiSecret = "aa4cdc6c1108486b"
|
ebaiSecret = "c3db75b754ea2d89"
|
||||||
|
|
||||||
mtpsAppKey = "25e816550bc9484480642f19a95f13fd"
|
mtpsAppKey = "25e816550bc9484480642f19a95f13fd"
|
||||||
mtpsSecret = "r4$HqrKx9~=7?2Jfo,$Z~a7%~k!Au&pEdI2)oPJvSbH2ao@2N0[8wSIvtuumh_J^"
|
mtpsSecret = "r4$HqrKx9~=7?2Jfo,$Z~a7%~k!Au&pEdI2)oPJvSbH2ao@2N0[8wSIvtuumh_J^"
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ func (c *SkuController) DeleteSkuNamePlace() {
|
|||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param vendorSkuID query string true "sku ID"
|
// @Param vendorSkuID query string true "sku ID"
|
||||||
// @Param vendorID query int true "门店所属的厂商ID"
|
// @Param vendorID query int true "门店所属的厂商ID"
|
||||||
// @Param vendorOrgCode query string true "厂商内组织代码"
|
// @Param vendorOrgCode query string false "厂商内组织代码"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /GetVendorSku [get]
|
// @router /GetVendorSku [get]
|
||||||
|
|||||||
@@ -60,12 +60,13 @@ func (c *StoreController) GetStores() {
|
|||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param vendorStoreID query string true "门店ID"
|
// @Param vendorStoreID query string true "门店ID"
|
||||||
// @Param vendorID query int true "门店所属的厂商ID"
|
// @Param vendorID query int true "门店所属的厂商ID"
|
||||||
|
// @Param vendorOrgCode query string false "厂商内组织代码"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /GetVendorStore [get]
|
// @router /GetVendorStore [get]
|
||||||
func (c *StoreController) GetVendorStore() {
|
func (c *StoreController) GetVendorStore() {
|
||||||
c.callGetVendorStore(func(params *tStoreGetVendorStoreParams) (retVal interface{}, errCode string, err error) {
|
c.callGetVendorStore(func(params *tStoreGetVendorStoreParams) (retVal interface{}, errCode string, err error) {
|
||||||
retVal, err = cms.GetVendorStore(params.Ctx, params.VendorStoreID, params.VendorID)
|
retVal, err = cms.GetVendorStore(params.Ctx, params.VendorID, params.VendorOrgCode, params.VendorStoreID)
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -176,6 +177,7 @@ func (c *StoreController) UpdateStoreVendorMap() {
|
|||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param storeID formData int true "门店ID,payload中的相应字段会被忽略"
|
// @Param storeID formData int true "门店ID,payload中的相应字段会被忽略"
|
||||||
// @Param vendorID formData int true "厂商ID,payload中的相应字段会被忽略"
|
// @Param vendorID formData int true "厂商ID,payload中的相应字段会被忽略"
|
||||||
|
// @Param vendorOrgCode formData string false "厂商内组织代码"
|
||||||
// @Param payload formData string true "json数据,storeMap对象({'vendorStoreID':'11732425','autoPickup':1,'deliveryCompetition':1, 'pricePercentage':100})"
|
// @Param payload formData string true "json数据,storeMap对象({'vendorStoreID':'11732425','autoPickup':1,'deliveryCompetition':1, 'pricePercentage':100})"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
@@ -184,7 +186,7 @@ func (c *StoreController) AddStoreVendorMap() {
|
|||||||
c.callAddStoreVendorMap(func(params *tStoreAddStoreVendorMapParams) (retVal interface{}, errCode string, err error) {
|
c.callAddStoreVendorMap(func(params *tStoreAddStoreVendorMapParams) (retVal interface{}, errCode string, err error) {
|
||||||
storeMap := &model.StoreMap{}
|
storeMap := &model.StoreMap{}
|
||||||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), storeMap); err == nil {
|
if err = utils.UnmarshalUseNumber([]byte(params.Payload), storeMap); err == nil {
|
||||||
retVal, err = cms.AddStoreVendorMap(params.Ctx, nil, params.StoreID, params.VendorID, storeMap)
|
retVal, err = cms.AddStoreVendorMap(params.Ctx, nil, params.VendorID, params.VendorOrgCode, params.StoreID, storeMap)
|
||||||
}
|
}
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -87,16 +87,16 @@ func (c *SyncController) RefreshAllStoresID() {
|
|||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /RefreshAllSkusID [put]
|
// @router /RefreshAllSkusID [put]
|
||||||
func (c *SyncController) RefreshAllSkusID() {
|
// func (c *SyncController) RefreshAllSkusID() {
|
||||||
// c.callRefreshAllSkusID(func(params *tSyncRefreshAllSkusIDParams) (retVal interface{}, errCode string, err error) {
|
// c.callRefreshAllSkusID(func(params *tSyncRefreshAllSkusIDParams) (retVal interface{}, errCode string, err error) {
|
||||||
// var vendorIDs, storeIDs []int
|
// var vendorIDs, storeIDs []int
|
||||||
// if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.VendorIDs, &vendorIDs); err != nil {
|
// if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.VendorIDs, &vendorIDs); err != nil {
|
||||||
// return retVal, "", err
|
// return retVal, "", err
|
||||||
// }
|
// }
|
||||||
// retVal, err = cms.CurVendorSync.RefreshAllSkusID(params.Ctx, params.IsAsync, vendorIDs, storeIDs)
|
// retVal, err = cms.CurVendorSync.RefreshAllSkusID(params.Ctx, params.IsAsync, vendorIDs, storeIDs)
|
||||||
// return retVal, "", err
|
// return retVal, "", err
|
||||||
// })
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
// @Title 全新初始化商家商品信息
|
// @Title 全新初始化商家商品信息
|
||||||
// @Description 全新初始化商家商品信息(!!!此操作会先清除平台上已有的商品及分类信息),此操作只适用于单门店模式平台
|
// @Description 全新初始化商家商品信息(!!!此操作会先清除平台上已有的商品及分类信息),此操作只适用于单门店模式平台
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ func (a *APIManager) GetAPI(vendorID int, appOrgCode string) (pfAPI interface{})
|
|||||||
return pfAPI
|
return pfAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
func (a *APIManager) GetAppOrgCodeList(vendorID int) (appOrgCodeList []string) {
|
func (a *APIManager) GetAppOrgCodeList(vendorID int) (appOrgCodeList []string) {
|
||||||
switch vendorID {
|
switch vendorID {
|
||||||
case model.VendorIDJD:
|
case model.VendorIDJD:
|
||||||
|
|||||||
@@ -1728,15 +1728,6 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SyncController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SyncController"],
|
|
||||||
beego.ControllerComments{
|
|
||||||
Method: "RefreshAllSkusID",
|
|
||||||
Router: `/RefreshAllSkusID`,
|
|
||||||
AllowHTTPMethods: []string{"put"},
|
|
||||||
MethodParams: param.Make(),
|
|
||||||
Filters: nil,
|
|
||||||
Params: nil})
|
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SyncController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SyncController"],
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SyncController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SyncController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "RefreshAllStoresID",
|
Method: "RefreshAllStoresID",
|
||||||
|
|||||||
Reference in New Issue
Block a user