This commit is contained in:
richboo111
2022-09-22 19:18:30 +08:00
parent 17284dbe9e
commit 2380e9da03

View File

@@ -1,53 +1,50 @@
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]
////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 := []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
}
//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
//}
return "", nil
}
// shop/editStore 编辑门店信息 正向推送平台