批量美团

This commit is contained in:
richboo111
2023-03-22 17:57:32 +08:00
parent 165753575c
commit a28f4545c8
4 changed files with 111 additions and 4 deletions

View File

@@ -14,6 +14,8 @@ import (
"strings"
"time"
"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
warehouse_getFences_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_getFences/response"
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
@@ -6159,6 +6161,47 @@ func SetStoreAutoCallRider(vendorOrgCode string, openIDs, closeIDs []int64) (str
return "", nil
}
type MtRelInfo struct {
PoiCode string `json:"poi_code"`
PicUrl string `json:"pic_url"`
}
//批量获取美团门店logos
func BatchGetMTStoreLogos(vendorOrgCode string, mtStoreIDs []string) (storeLogos []MtRelInfo) {
for _, v := range mtStoreIDs {
if storeInfos, err1 := mtwm.GetAPI(vendorOrgCode, 0, "").PoiGet(v); err1 == nil {
storeLogos = append(storeLogos, MtRelInfo{
PoiCode: v,
PicUrl: " ",
})
} else {
if len(storeInfos.PicURL) != 0 {
storeLogos = append(storeLogos, MtRelInfo{
PoiCode: v,
PicUrl: storeInfos.PicURL,
})
}
}
}
return storeLogos
}
//批量更新美团门店logos
func BatchUpdateMTStoreLogos(vendorOrgCode string, relInfo []MtRelInfo) (hint string) {
for _, v := range relInfo {
param := map[string]interface{}{
"pic_url": v.PicUrl,
}
if err := mtwm.GetAPI(vendorOrgCode, 0, "").PoiSave(v.PoiCode, param); err != nil {
hint += fmt.Sprintf("%s:%v\n", v.PoiCode, err)
}
}
if len(hint) != 0 {
return hint
}
return ""
}
//操作 freight_template
func ReplaceInsertFreight(storeID, templateID, warehouseID, tradeLimitID int, vendorStoreID, fenceID string) error {
return dao.ReplaceInsertFreight2(storeID, templateID, warehouseID, tradeLimitID, vendorStoreID, fenceID)
@@ -6173,6 +6216,15 @@ func String2ArrayInt64(data string) (retVal []int64) {
}
return retVal
}
func String2ArrayString(data string) (retVal []string) {
temp := strings.Split(data, ",")
for _, v := range temp {
retVal = append(retVal, v)
}
return retVal
}
func GetVendorStoreBind(vendorStoreId string, vendorId int) (int, error) {
return dao.GetCodeAndIDByMeiTuan(vendorStoreId, vendorId)
}

View File

@@ -5,16 +5,17 @@ import (
"encoding/json"
"errors"
"fmt"
"sort"
"strings"
"sync"
"time"
"git.rosy.net.cn/baseapi/platformapi/alipayapi"
"git.rosy.net.cn/baseapi/platformapi/qywxapi"
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/alipay"
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
"git.rosy.net.cn/jx-callback/business/partner"
beego "github.com/astaxie/beego/server/web"
"sort"
"strings"
"sync"
"time"
"git.rosy.net.cn/jx-callback/business/jxstore/permission"