Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -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,52 @@ func SetStoreAutoCallRider(vendorOrgCode string, openIDs, closeIDs []int64) (str
|
||||
return "", nil
|
||||
}
|
||||
|
||||
type MtRelInfo struct {
|
||||
PoiCode string `json:"poi_code"`
|
||||
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 {
|
||||
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,
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
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 +6221,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)
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -1620,6 +1622,48 @@ func (c *StoreController) BindJxPrinter() {
|
||||
|
||||
}
|
||||
|
||||
// @Title 批量获取美团门店logo图片
|
||||
// @Description 批量获取美团门店logo图片
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorOrgCode query string true "美团平台账号"
|
||||
// @Param storeIDs query string true "美团门店IDs"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /BatchGetMTStoreLogos [get]
|
||||
func (c *StoreController) BatchGetMTStoreLogos() {
|
||||
c.callBatchGetMTStoreLogos(func(params *tStoreBatchGetMTStoreLogosParams) (interface{}, string, error) {
|
||||
mtStoreIDs := cms.String2ArrayString(params.StoreIDs)
|
||||
retVal := cms.BatchGetMTStoreLogos(params.VendorOrgCode, mtStoreIDs)
|
||||
return retVal, "", nil
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 批量修改美团门店logo图片
|
||||
// @Description 批量修改美团门店logo图片
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorOrgCode query string true "美团平台账号"
|
||||
// @Param relInfos query string true "美团门店与logo链接的map"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /BatchUpdateMTStoreLogos [post]
|
||||
func (c *StoreController) BatchUpdateMTStoreLogos() {
|
||||
c.callBatchUpdateMTStoreLogos(func(params *tStoreBatchUpdateMTStoreLogosParams) (retVal interface{}, hint string, err error) {
|
||||
mtRelInfos := make([]cms.MtRelInfo, 0)
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 测试操作freight_template
|
||||
// @Description 测试操作freight_template
|
||||
// @Param token header string true "认证token"
|
||||
|
||||
@@ -3027,6 +3027,26 @@ func init() {
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
//批量获取美团门店logo图片
|
||||
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
|
||||
web.ControllerComments{
|
||||
Method: "BatchGetMTStoreLogos",
|
||||
Router: `/BatchGetMTStoreLogos`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
//批量修改美团门店logo图片
|
||||
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
|
||||
web.ControllerComments{
|
||||
Method: "BatchUpdateMTStoreLogos",
|
||||
Router: `/BatchUpdateMTStoreLogos`,
|
||||
AllowHTTPMethods: []string{"post"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
//测试用-ysq
|
||||
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
|
||||
web.ControllerComments{
|
||||
|
||||
Reference in New Issue
Block a user