批量美团logo
This commit is contained in:
@@ -6166,10 +6166,11 @@ type MtRelInfo struct {
|
||||
PicUrl string `json:"pic_url"`
|
||||
}
|
||||
|
||||
//[]{PoiCode:"16594433",PicUrl:"http://p0.meituan.net/business/e23d337029fcf74f5a7bcea4e01dac98219292.jpg"}
|
||||
//批量获取美团门店logos
|
||||
func BatchGetMTStoreLogos(vendorOrgCode string, mtStoreIDs []string) (storeLogos []MtRelInfo) {
|
||||
for _, v := range mtStoreIDs {
|
||||
if storeInfos, err1 := mtwm.GetAPI(vendorOrgCode, 0, "").PoiGet(v); err1 == nil {
|
||||
if storeInfos, err1 := mtwm.GetAPI(vendorOrgCode, 0, "").PoiGet(v); err1 != nil {
|
||||
storeLogos = append(storeLogos, MtRelInfo{
|
||||
PoiCode: v,
|
||||
PicUrl: " ",
|
||||
@@ -6192,7 +6193,11 @@ func BatchUpdateMTStoreLogos(vendorOrgCode string, relInfo []MtRelInfo) (hint st
|
||||
param := map[string]interface{}{
|
||||
"pic_url": v.PicUrl,
|
||||
}
|
||||
if err := mtwm.GetAPI(vendorOrgCode, 0, "").PoiSave(v.PoiCode, param); err != nil {
|
||||
storeDetail, err1 := dao.GetStoreDetailForDD(dao.GetDB(), 0, model.VendorIDMTWM, v.PoiCode, "")
|
||||
if err1 != nil {
|
||||
hint += fmt.Sprintf("%s:%v\n", v.PoiCode, err1)
|
||||
}
|
||||
if err := mtwm.GetAPI(vendorOrgCode, storeDetail.Store.ID, "").PoiSave(v.PoiCode, param); err != nil {
|
||||
hint += fmt.Sprintf("%s:%v\n", v.PoiCode, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -1647,9 +1649,17 @@ func (c *StoreController) BatchGetMTStoreLogos() {
|
||||
func (c *StoreController) BatchUpdateMTStoreLogos() {
|
||||
c.callBatchUpdateMTStoreLogos(func(params *tStoreBatchUpdateMTStoreLogosParams) (retVal interface{}, hint string, err error) {
|
||||
mtRelInfos := make([]cms.MtRelInfo, 0)
|
||||
if err := utils.UnmarshalUseNumber([]byte(params.RelInfos), &mtRelInfos); err == nil {
|
||||
b := bytes.NewBufferString(params.RelInfos)
|
||||
decoder := json.NewDecoder(b)
|
||||
if err = decoder.Decode(&mtRelInfos); err == nil {
|
||||
hint = cms.BatchUpdateMTStoreLogos(params.VendorOrgCode, mtRelInfos)
|
||||
}
|
||||
//if err = mapstructure.Decode(params.RelInfos, &mtRelInfos); err == nil {
|
||||
// hint = cms.BatchUpdateMTStoreLogos(params.VendorOrgCode, mtRelInfos)
|
||||
//}
|
||||
//if err := utils.UnmarshalUseNumber([]byte(params.RelInfos), &mtRelInfos); err == nil {
|
||||
// hint = cms.BatchUpdateMTStoreLogos(params.VendorOrgCode, mtRelInfos)
|
||||
//}
|
||||
return nil, hint, nil
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user