Files
jx-callback/business/partner/purchase/doudian/store.go
richboo111 e5565b050f tmp
2022-09-22 18:03:35 +08:00

63 lines
2.1 KiB
Go

package doudian
import (
shop_batchCreateStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_batchCreateStore/request"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals/api"
)
// shop/batchCreateStore 批量创建门店
func (P *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}, storeDetail *dao.StoreDetail) (vendorStoreID string, err error) {
//ShopBatchCreateStoreParam:=[]*shop_batchCreateStore_request.ShopBatchCreateStoreParam{}
var (
storeIDs string
)
//tempOpenTime := strings.Split(storeDetail.OpenTime, ",")
//m := make(map[int64]string)
//for _, i := range tempOpenTime {
// parts := strings.Split(i, ":")
// m[utils.Str2Int64(parts[0])] = parts[1]
//}
lists := []shop_batchCreateStore_request.StoreListItem{}
list := shop_batchCreateStore_request.StoreListItem{
RowId: storeDetail.RowID,
Name: storeDetail.Name,
StoreCode: storeDetail.StoreCode,
Longitude: utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lng)),
Latitude: utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lat)),
Province: storeDetail.ProvinceName,
City: storeDetail.CityName,
District: storeDetail.DistrictName,
Address: storeDetail.Address,
Contact: storeDetail.Tel1,
OpenTime: &shop_batchCreateStore_request.OpenTime{
DayMap: storeDetail.OpenTime,
},
}
lists = append(lists, list)
ShopBatchCreateStoreParam := &shop_batchCreateStore_request.ShopBatchCreateStoreParam{
StoreList: lists,
}
if resp, err := api.DouDianApi.BatchCreateStore(ShopBatchCreateStoreParam); err != nil {
return "", err
} else {
for _, v := range resp.ResultList {
storeIDs += utils.Int64ToStr(v.Store.StoreId)
}
return storeIDs, nil
}
}
// shop/editStore 编辑门店信息 正向推送平台
func (P *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName string) (err error) {
if db == nil {
db = dao.GetDB()
}
//doudianApi:=getapi
//storeDetail:=dao.GetStoreDetail(db,storeID,)
return err
}