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