Merge remote-tracking branch 'origin/mark' into jdshop
This commit is contained in:
@@ -23,6 +23,9 @@ type IPurchasePlatformActHandler interface {
|
||||
// CancelAct(ctx *jxcontext.Context, parentTask tasksch.ITask, act *model.Act2, actStoreSku []*model.ActStoreSku2) (err error)
|
||||
|
||||
SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITask, act *model.Act2, actOrderRules []*model.ActOrderRule, actStoreSkuList []*model.ActStoreSku2) (err error)
|
||||
|
||||
//活动丰富度
|
||||
GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error)
|
||||
}
|
||||
|
||||
type IPurchasePlatformPageActHandler interface {
|
||||
|
||||
@@ -87,6 +87,7 @@ type SkuNameInfo struct {
|
||||
Unit string
|
||||
VendorCatIDList []string
|
||||
PictureList []string
|
||||
UPC string
|
||||
Status int `json:"status,omitempty"`
|
||||
YbBarCode string
|
||||
SkuList []*SkuInfo
|
||||
|
||||
@@ -338,3 +338,12 @@ func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITa
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error) {
|
||||
for _, v := range ebaiapi.ActivityTypeList {
|
||||
if actIDs, err := api.EbaiAPI.ActMultiChannelQueryIDs("", utils.Str2Int64(vendorStoreID), v); err == nil && len(actIDs) > 0 {
|
||||
ample++
|
||||
}
|
||||
}
|
||||
return ample, err
|
||||
}
|
||||
|
||||
@@ -231,7 +231,11 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendo
|
||||
retVal.ID = int(utils.Str2Int64WithDefault(utils.Interface2String(result["shop_id"]), 0))
|
||||
retVal.DeliveryRangeType = model.DeliveryRangeTypePolygon
|
||||
retVal.DeliveryRange = EbaiDeliveryRegion2Jx(result["delivery_region"])
|
||||
|
||||
if retVal.DeliveryRange == "" {
|
||||
if list, err := api.EbaiAPI.ShopDeliveryinfoGet("", utils.Str2Int64(vendorStoreID)); err == nil {
|
||||
retVal.DeliveryRange = EbaiDeliveryRegion2Jx2(list[0])
|
||||
}
|
||||
}
|
||||
return retVal, nil
|
||||
}
|
||||
return nil, err
|
||||
@@ -397,6 +401,22 @@ func EbaiDeliveryRegion2Jx(deliveryRegion interface{}) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func EbaiDeliveryRegion2Jx2(deliveryRegion map[string]interface{}) string {
|
||||
if len(deliveryRegion) > 0 {
|
||||
if deliveryRegion["delivery_areas"] == nil {
|
||||
return ""
|
||||
}
|
||||
region := deliveryRegion["delivery_areas"].([]interface{})[0].(map[string]interface{})["coordinates"].([]interface{})
|
||||
coords := make([]string, len(region))
|
||||
for k, v := range region {
|
||||
mapV := v.(map[string]interface{})
|
||||
coords[k] = fmt.Sprintf("%.6f,%.6f", utils.MustInterface2Float64(mapV["longitude"]), utils.MustInterface2Float64(mapV["latitude"]))
|
||||
}
|
||||
return strings.Join(coords, ";")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func JxDeliveryRegion2Ebai(store *model.Store) (deliveryRegion interface{}) {
|
||||
rangeStr := strings.Trim(store.DeliveryRange, ";")
|
||||
if store.DeliveryRangeType == model.DeliveryRangeTypeRadius {
|
||||
|
||||
@@ -420,6 +420,18 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE
|
||||
"url": storeSku.Img3,
|
||||
})
|
||||
}
|
||||
if storeSku.Img4 != "" {
|
||||
photos = append(photos, map[string]interface{}{
|
||||
"is_master": false,
|
||||
"url": storeSku.Img4,
|
||||
})
|
||||
}
|
||||
if storeSku.Img5 != "" {
|
||||
photos = append(photos, map[string]interface{}{
|
||||
"is_master": false,
|
||||
"url": storeSku.Img5,
|
||||
})
|
||||
}
|
||||
params = map[string]interface{}{
|
||||
// "name": utils.LimitMixedStringLen(storeSku.SkuName, ebaiapi.MaxSkuNameByteCount),
|
||||
"left_num": model.MaxStoreSkuStockQty,
|
||||
@@ -598,6 +610,7 @@ func vendorSku2Jx(vendorSku *ebaiapi.SkuInfo) (skuName *partner.SkuNameInfo) {
|
||||
Prefix: prefix,
|
||||
Name: name,
|
||||
Unit: unit,
|
||||
UPC: vendorSku.Upc,
|
||||
SkuList: []*partner.SkuInfo{
|
||||
&partner.SkuInfo{
|
||||
StoreSkuInfo: partner.StoreSkuInfo{
|
||||
|
||||
@@ -420,3 +420,7 @@ func getActFromJD(vendorOrgCode, promotionID string) (act *model.Act2, actStoreS
|
||||
}
|
||||
return act, actStoreSkuList, err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error) {
|
||||
return ample, err
|
||||
}
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
package jd
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/url"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
@@ -84,3 +91,71 @@ func JxStoreStatus2JdStatus(status int) (yn, closeStatus int) {
|
||||
func (p *PurchaseHandler) UploadImg(ctx *jxcontext.Context, vendorOrgCode, imgURL string, imgData []byte, imgName string, imgType int) (imgHint string, err error) {
|
||||
return imgHint, err
|
||||
}
|
||||
|
||||
type JdCode struct {
|
||||
Code string `json:"code"`
|
||||
VenderID string `json:"venderId"`
|
||||
}
|
||||
|
||||
type JdToken struct {
|
||||
Token string `json:"token"`
|
||||
VenderID string `json:"venderId"`
|
||||
}
|
||||
|
||||
func OnTokenChange(values url.Values) {
|
||||
db := dao.GetDB()
|
||||
codeInfo := &JdCode{}
|
||||
if dataStr := values.Get("code"); dataStr != "" {
|
||||
json.Unmarshal([]byte(dataStr), &codeInfo)
|
||||
}
|
||||
if codeInfo.Code != "" {
|
||||
voc := &model.VendorOrgCode{}
|
||||
sql := `
|
||||
SELECT * FROM tmp_jd WHERE vendor_org_code = ?
|
||||
`
|
||||
sqlParams := []interface{}{codeInfo.VenderID}
|
||||
if err := dao.GetRow(db, &voc, sql, sqlParams); err == nil && voc != nil {
|
||||
if result, _ := dao.GetVendorOrgCode(db, model.VendorIDJD, codeInfo.VenderID, model.VendorOrgTypePlatform); len(result) == 0 {
|
||||
voc2 := &model.VendorOrgCode{
|
||||
Comment: voc.Comment,
|
||||
VendorOrgCode: codeInfo.VenderID,
|
||||
VendorType: model.VendorOrgTypePlatform,
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(voc2, "jxadmin")
|
||||
if err := dao.CreateEntity(db, voc2); err == nil {
|
||||
//添加成功后去开发者后台填验证码
|
||||
if configs, err := dao.QueryConfigs(dao.GetDB(), "jdConfigCookie", model.ConfigTypeCookie, ""); err == nil {
|
||||
api.JdAPI.SetCookieWithStr(configs[0].Value)
|
||||
if appID, err := api.JdAPI.GetJdNoAuthAppID(codeInfo.VenderID); err == nil {
|
||||
api.JdAPI.SetCode(codeInfo.Code, appID)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Debugf("OnTokenChange, 发验证码,但是库里有这个账号了")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tokenInfo := &JdToken{}
|
||||
if dataStr := values.Get("token"); dataStr != "" {
|
||||
json.Unmarshal([]byte(dataStr), &tokenInfo)
|
||||
}
|
||||
if tokenInfo == nil {
|
||||
return
|
||||
}
|
||||
voc := &model.VendorOrgCode{}
|
||||
sql := `
|
||||
SELECT * FROM tmp_jd WHERE vendor_org_code = ?
|
||||
`
|
||||
sqlParams := []interface{}{tokenInfo.VenderID}
|
||||
if err := dao.GetRow(db, &voc, sql, sqlParams); err == nil && voc != nil {
|
||||
if result, _ := dao.GetVendorOrgCode(db, model.VendorIDJD, voc.VendorOrgCode, model.VendorOrgTypePlatform); len(result) > 0 {
|
||||
result[0].Token = tokenInfo.Token
|
||||
dao.UpdateEntity(db, result[0], "Token")
|
||||
} else {
|
||||
globals.SugarLogger.Debugf("OnTokenChange, 发token,但是库里没这个账号")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -172,9 +172,9 @@ func skuInfo2Param(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (param *jd
|
||||
param.ShopCategories = append(param.ShopCategories, utils.Str2Int64(sku.VendorCatID))
|
||||
}
|
||||
if sku.ImgMix != "" {
|
||||
param.Images = jxutils.BatchString2Slice(sku.ImgMix, sku.Img2, sku.Img3)
|
||||
param.Images = jxutils.BatchString2Slice(sku.ImgMix, sku.Img2, sku.Img3, sku.Img4, sku.Img5)
|
||||
} else {
|
||||
param.Images = jxutils.BatchString2Slice(sku.Img, sku.Img2, sku.Img3)
|
||||
param.Images = jxutils.BatchString2Slice(sku.Img, sku.Img2, sku.Img3, sku.Img4, sku.Img5)
|
||||
}
|
||||
|
||||
if param.CategoryID == 0 {
|
||||
|
||||
@@ -9,3 +9,7 @@ import (
|
||||
func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITask, act *model.Act2, actOrderRules []*model.ActOrderRule, actStoreSkuList []*model.ActStoreSku2) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error) {
|
||||
return ample, err
|
||||
}
|
||||
|
||||
@@ -262,6 +262,9 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err
|
||||
} else {
|
||||
order.ExpectedDeliveredTime = utils.Str2Time(time2)
|
||||
}
|
||||
} else {
|
||||
order.ExpectedDeliveredTime = order.OrderCreatedAt.Add(time.Hour)
|
||||
err = nil
|
||||
}
|
||||
order.PickDeadline = order.ExpectedDeliveredTime.Add(-time.Hour)
|
||||
} else if msg.OrderState == jdshopapi.OrderStatusWait || msg.OrderState == "WAIT_GOODS_RECEIVE_CONFIRM" || msg.OrderState == "FINISHED_L" {
|
||||
|
||||
@@ -44,7 +44,7 @@ func getAPI(appOrgCode string) (apiObj *jdshopapi.API) {
|
||||
apiObj.SetCookieWithStr(configs[0].Value)
|
||||
}
|
||||
}
|
||||
return
|
||||
return apiObj
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetVendorID() int {
|
||||
|
||||
@@ -74,7 +74,7 @@ func (p *PurchaseHandler) PickupGoods(order *model.GoodsOrder, isSelfDelivery bo
|
||||
if status == model.OrderStatusCanceled {
|
||||
err = ChangeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, "订单在京东商城已被取消!")
|
||||
} else {
|
||||
if jxutils.GetSaleStoreIDFromOrder(order) != model.JdShopMainStoreID {
|
||||
if jxutils.GetSaleStoreIDFromOrder(order) != model.JdShopMainStoreID && jxutils.GetSaleStoreIDFromOrder(order) != model.JdShopMainStoreID2 {
|
||||
err = ChangeOrderStatus(order.VendorOrderID, model.OrderStatusFinishedPickup, "自动拣货完成")
|
||||
if status == model.OrderStatusAccepted {
|
||||
err = p.OrderExport(jxcontext.AdminCtx, order.VendorOrderID, order.VendorOrderID, true)
|
||||
|
||||
@@ -103,7 +103,7 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
||||
url, _ := getAPI("2").UploadImageNew(data, "2659335b16e3880e367759b8fc675933.tem.png")
|
||||
ex := store.LicenceExpire
|
||||
if ex == "" {
|
||||
ex = utils.Time2Str(utils.Str2Time(store.LicenceValid).AddDate(0, 6, 0))
|
||||
ex = utils.Time2Str(utils.Str2Time(store.LicenceValid).AddDate(20, 0, 0))
|
||||
}
|
||||
if !strings.Contains(ex, "00:00:00") {
|
||||
ex += " 00:00:00"
|
||||
@@ -146,6 +146,37 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
||||
AddCode3: store.JdsCode,
|
||||
CategoryID1: 3,
|
||||
}
|
||||
var (
|
||||
url3 string
|
||||
idCode string
|
||||
startTime string
|
||||
)
|
||||
if storeDetail.IDCardFront != "" {
|
||||
data2, _, _ := jxutils.DownloadFileByURL(storeDetail.IDCardFront)
|
||||
fileName := storeDetail.IDCardFront[strings.LastIndex(storeDetail.IDCardFront, "/")+1 : len(storeDetail.IDCardFront)]
|
||||
url3, _ = api.JdShop2API.UploadImageNew(data2, fileName)
|
||||
} else {
|
||||
data2, _, _ := jxutils.DownloadFileByURL("http://image.jxc4.com/image/a9bfc170a950ab9a4c76bd10b48b222b.tem.jpg")
|
||||
fileName := "a9bfc170a950ab9a4c76bd10b48b222b.tem.jpg"
|
||||
url3, _ = api.JdShop2API.UploadImageNew(data2, fileName)
|
||||
}
|
||||
if storeDetail.IDCode == "" {
|
||||
idCode = "610126198012230014"
|
||||
} else {
|
||||
idCode = storeDetail.IDCode
|
||||
}
|
||||
if storeDetail.IDValid == "" {
|
||||
startTime = "2013-01-25 00:00:00"
|
||||
} else {
|
||||
startTime = utils.Time2Str(utils.Str2Time(storeDetail.IDValid))
|
||||
}
|
||||
ex2 := storeDetail.IDExpire
|
||||
if ex2 == "" {
|
||||
ex2 = utils.Time2Str(utils.Str2Time(storeDetail.IDValid).AddDate(20, 0, 0))
|
||||
}
|
||||
if !strings.Contains(ex2, "00:00:00") {
|
||||
ex2 += " 00:00:00"
|
||||
}
|
||||
if url2 != "" {
|
||||
param.CategoryID1 = 34
|
||||
param.CategoryID2 = 62
|
||||
@@ -159,6 +190,15 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
||||
EndingTime: ex,
|
||||
Time: []string{utils.Time2Str(utils.Str2Time(store.LicenceValid)), ex},
|
||||
},
|
||||
&jdshopapi.QualificationRequests{
|
||||
QualificationID: 42,
|
||||
QualificationName: "身份证件",
|
||||
QualificationNo: idCode,
|
||||
QualificationURL: url3,
|
||||
StartTime: startTime,
|
||||
EndingTime: ex2,
|
||||
Time: []string{startTime, ex2},
|
||||
},
|
||||
}
|
||||
}
|
||||
if store.JdsStreetCode != 0 {
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/yinbaoapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
@@ -123,6 +122,9 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v
|
||||
}
|
||||
if v.VendorOrgCode == "1" {
|
||||
vendorSkuID, err := getAPI(v.VendorOrgCode).UpdateSkus(updateSkusParam)
|
||||
if strings.Contains(err.Error(), "cookie可能过期了") {
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDJDShop], "创建商品")
|
||||
return failedList, err
|
||||
@@ -157,6 +159,9 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v
|
||||
if v.VendorOrgCode == "1" {
|
||||
createSkuResult, err2 := getAPI(v.VendorOrgCode).CreateWare(createSkuParamWare, createSkuParamSkus)
|
||||
err = err2
|
||||
if strings.Contains(err.Error(), "cookie可能过期了") {
|
||||
err = nil
|
||||
}
|
||||
wareID = createSkuResult.WareID
|
||||
|
||||
var paramAttrs = make(map[string]*jdshopapi.CreateSkuParamSkus)
|
||||
@@ -478,17 +483,29 @@ func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTas
|
||||
pageNo = 1
|
||||
pageSize = 20
|
||||
)
|
||||
_, totalCount, err := api.JdShopAPI.SearchSkuList(pageNo, pageSize)
|
||||
for ; pageNo <= totalCount/pageSize+1; pageNo++ {
|
||||
result, _, err := api.JdShopAPI.SearchSkuList(pageNo, pageSize)
|
||||
if err == nil {
|
||||
for _, v := range result {
|
||||
if skuName := vendorSku2Jx(v); skuName != nil {
|
||||
skuNameList = append(skuNameList, skuName)
|
||||
if result, totalCount, err := api.JdShop2API.StoreProductSearch(pageNo, pageSize, []string{vendorStoreID}); err == nil && result != nil {
|
||||
for ; pageNo <= totalCount/pageSize+1; pageNo++ {
|
||||
result2, _, err := api.JdShop2API.StoreProductSearch(pageNo, pageSize, []string{vendorStoreID})
|
||||
if err == nil {
|
||||
for _, v := range result2 {
|
||||
if skuName := vendorSku2Jx2(v); skuName != nil {
|
||||
skuNameList = append(skuNameList, skuName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// _, totalCount, err := api.JdShopAPI.SearchSkuList(pageNo, pageSize)
|
||||
// for ; pageNo <= totalCount/pageSize+1; pageNo++ {
|
||||
// result, _, err := api.JdShopAPI.SearchSkuList(pageNo, pageSize)
|
||||
// if err == nil {
|
||||
// for _, v := range result {
|
||||
// if skuName := vendorSku2Jx(v); skuName != nil {
|
||||
// skuNameList = append(skuNameList, skuName)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return skuNameList, err
|
||||
}
|
||||
|
||||
@@ -688,17 +705,6 @@ func (p *PurchaseHandler) IsErrSkuNotExist(err error) (isNotExist bool) {
|
||||
return false
|
||||
}
|
||||
|
||||
func ybSkuStatus2Jx(ybStatus int) (jxSkuStatus int) {
|
||||
if ybStatus == yinbaoapi.SkuStatusEnable {
|
||||
jxSkuStatus = model.SkuStatusNormal
|
||||
} else if ybStatus == yinbaoapi.SkuStatusDisabled {
|
||||
jxSkuStatus = model.SkuStatusDontSale
|
||||
} else if ybStatus == yinbaoapi.SkuStatusDeleted {
|
||||
jxSkuStatus = model.SkuStatusDeleted
|
||||
}
|
||||
return jxSkuStatus
|
||||
}
|
||||
|
||||
func vendorSku2Jx(result *jdshopapi.SearchSkuListResult) (skuName *partner.SkuNameInfo) {
|
||||
if result == nil {
|
||||
globals.SugarLogger.Warnf("vendorSku2Jx, strange result:%s", utils.Format4Output(result, true))
|
||||
@@ -722,6 +728,27 @@ func vendorSku2Jx(result *jdshopapi.SearchSkuListResult) (skuName *partner.SkuNa
|
||||
return skuName
|
||||
}
|
||||
|
||||
func vendorSku2Jx2(result *jdshopapi.StoreProductSearchResult) (skuName *partner.SkuNameInfo) {
|
||||
if result == nil {
|
||||
globals.SugarLogger.Warnf("vendorSku2Jx, strange result:%s", utils.Format4Output(result, true))
|
||||
return nil
|
||||
}
|
||||
skuName = &partner.SkuNameInfo{
|
||||
Name: result.SkuName,
|
||||
SkuList: []*partner.SkuInfo{
|
||||
&partner.SkuInfo{
|
||||
StoreSkuInfo: partner.StoreSkuInfo{
|
||||
VendorSkuID: utils.Int64ToStr(result.SkuID),
|
||||
Stock: result.StockNum,
|
||||
VendorPrice: jxutils.StandardPrice2Int(result.StorePrice),
|
||||
},
|
||||
},
|
||||
},
|
||||
Status: result.Status,
|
||||
}
|
||||
return skuName
|
||||
}
|
||||
|
||||
func updateOrCreateCategories(storeCat *dao.SkuStoreCatInfo, isCreate bool) (status int64, err error) {
|
||||
var createShopCategoryParams []*jdshopapi.CreateShopCategoryParam
|
||||
result, err := getAPI(storeCat.VendorOrgCode).FindShopCategories()
|
||||
|
||||
@@ -258,3 +258,13 @@ func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITa
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error) {
|
||||
for _, v := range mtwmapi.ActTypeList {
|
||||
//1表示进行中
|
||||
if actList, err := getAPI(vendorOrgCode, 0, vendorStoreID).GetByAppPoiCodeAndType(vendorOrgCode, 1, v); err == nil {
|
||||
ample += len(actList)
|
||||
}
|
||||
}
|
||||
return ample, err
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ var (
|
||||
"589": map[string]string{
|
||||
"firstTag": mtwmapi.MtwmC4Tag, //经营品类
|
||||
"settlementID": "7030017", //结算ID
|
||||
"poiCert": "1,5", //资质列表
|
||||
"poiCert": "1,2,5", //资质列表
|
||||
},
|
||||
"5873": map[string]string{
|
||||
"firstTag": mtwmapi.MtwmSCTag,
|
||||
@@ -62,7 +62,7 @@ type tEbaiStoreInfo struct {
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string) (retVal *dao.StoreDetail, err error) {
|
||||
result, err := getAPI(vendorOrgCode, 0, vendorStoreID).PoiGet(vendorStoreID)
|
||||
result, err := getAPIWithoutToken(vendorOrgCode).PoiGet(vendorStoreID)
|
||||
if err == nil {
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(result, false))
|
||||
retVal = &dao.StoreDetail{
|
||||
@@ -98,9 +98,9 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendo
|
||||
retVal.ID = int(utils.Str2Int64WithDefault(poiCode, 0))
|
||||
retVal.DeliveryRangeType = model.DeliveryRangeTypePolygon
|
||||
var deliveryRangeInfo []map[string]interface{}
|
||||
deliveryRangeInfo, err = getAPI(vendorOrgCode, 0, vendorStoreID).ShippingFetch(poiCode)
|
||||
deliveryRangeInfo, err = getAPIWithoutToken(vendorOrgCode).ShippingFetch(poiCode)
|
||||
if err != nil {
|
||||
deliveryRangeInfo, err = getAPI(vendorOrgCode, 0, vendorStoreID).ShippingList(poiCode)
|
||||
deliveryRangeInfo, err = getAPIWithoutToken(vendorOrgCode).ShippingList(poiCode)
|
||||
}
|
||||
if err == nil {
|
||||
if len(deliveryRangeInfo) > 0 {
|
||||
@@ -144,7 +144,7 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
||||
}
|
||||
vendorInfoMap := storeVendorOrgCodeMap[vendorOrgCode]
|
||||
poiSettleSaveParam := &mtwmapi.PoiSettleSaveParam{
|
||||
Type: 0, //创建
|
||||
Type: 1, //创建
|
||||
ApplyInfos: []*mtwmapi.ApplyInfo{
|
||||
&mtwmapi.ApplyInfo{
|
||||
AppPoiCode: utils.Int2Str(storeDetail.ID),
|
||||
|
||||
@@ -286,13 +286,25 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
foodData["is_sold_out"] = skuStatusJX2Mtwm(storeSku.MergedStatus)
|
||||
if true { // vendorStoreID == specialStoreID {
|
||||
img2 := storeSku.Img2
|
||||
img3 := storeSku.Img3
|
||||
img4 := storeSku.Img4
|
||||
img5 := storeSku.Img5
|
||||
if img2 == "" {
|
||||
img2 = storeSku.Img
|
||||
}
|
||||
if img3 == "" {
|
||||
img3 = storeSku.Img
|
||||
}
|
||||
if img4 == "" {
|
||||
img4 = storeSku.Img
|
||||
}
|
||||
if img5 == "" {
|
||||
img5 = storeSku.Img
|
||||
}
|
||||
if storeSku.ImgMix != "" && ((storeSku.BrandID == storeSku.ExBrandID && storeSku.ExBrandID != 0) || storeSku.ExBrandID == 0) {
|
||||
foodData["picture"] = strings.Join(jxutils.BatchString2Slice(storeSku.ImgMix, img2, storeSku.ImgMix, storeSku.ImgMix, storeSku.ImgMix), ",")
|
||||
foodData["picture"] = strings.Join(jxutils.BatchString2Slice(storeSku.ImgMix, img2, img3, img4, img5), ",")
|
||||
} else {
|
||||
foodData["picture"] = strings.Join(jxutils.BatchString2Slice(storeSku.Img, img2, storeSku.Img, storeSku.Img, storeSku.Img), ",")
|
||||
foodData["picture"] = strings.Join(jxutils.BatchString2Slice(storeSku.Img, img2, img3, img4, img5), ",")
|
||||
}
|
||||
} else {
|
||||
foodData["picture"] = strings.Join(jxutils.BatchString2Slice(storeSku.Img, storeSku.Img2), ",")
|
||||
@@ -554,10 +566,10 @@ func vendorSku2Jx(appFood *mtwmapi.AppFood) (skuName *partner.SkuNameInfo) {
|
||||
skuName = &partner.SkuNameInfo{
|
||||
NameID: int(utils.Str2Int64WithDefault(appFood.AppFoodCode, 0)),
|
||||
VendorNameID: appFood.AppFoodCode,
|
||||
|
||||
Prefix: prefix,
|
||||
Name: name,
|
||||
Unit: unit,
|
||||
UPC: appFood.SkuList[0].Upc,
|
||||
Prefix: prefix,
|
||||
Name: name,
|
||||
Unit: unit,
|
||||
SkuList: []*partner.SkuInfo{
|
||||
&partner.SkuInfo{
|
||||
StoreSkuInfo: partner.StoreSkuInfo{
|
||||
|
||||
@@ -9,3 +9,7 @@ import (
|
||||
func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITask, act *model.Act2, actOrderRules []*model.ActOrderRule, actStoreSkuList []*model.ActStoreSku2) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error) {
|
||||
return ample, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user