This commit is contained in:
li 2023-07-10 14:44:36 +08:00
parent a59d86ec08
commit f34f2c48af
2 changed files with 31 additions and 15 deletions

View File

@ -1672,7 +1672,8 @@ func TestExportGameList(t *testing.T) {
if err != nil {
fmt.Println(err)
}
defer f.Close()
//f.Name()
//defer f.Close()
//w := csv.NewWriter(f)
//os.WriteFile()
@ -1692,10 +1693,10 @@ func TestExportGameList(t *testing.T) {
f.WriteString(w)
}
if err := f.Close(); err != nil {
//log.Fatal(err)
logger.Error(" err:", err)
}
//if err := f.Close(); err != nil {
// //log.Fatal(err)
// logger.Error(" err:", err)
//}
}
@ -2394,6 +2395,7 @@ func TestOrderCardUserRentCard(t *testing.T) {
if err != nil {
logger.Error("err:", err)
}
accountUids := []uint32{41062552, 61322858, 79502493, 5151314, 75683046, 92301496, 84098843}
userOrderMap := make(map[uint32]OrderCard, 0)
//storeMap := make(map[uint32]Store, 0)
storeIds := make([]uint32, 0, len(cards))
@ -2415,15 +2417,21 @@ func TestOrderCardUserRentCard(t *testing.T) {
}
}
storeIds = append(storeIds, cards[i].StoreId)
//storeIds = append(storeIds, cards[i].StoreId)
gameIds = append(gameIds, cards[i].GameCardId)
}
accountUserMap, _ := GetUserMap(accountUids)
for _, user := range accountUserMap {
storeIds = append(storeIds, uint32(user.StoreId))
}
storeMap, err := GetStoreMap(storeIds)
if err != nil {
logger.Error("err:", err)
}
gameMap := GetGameCardMap(gameIds)
userMap, _ := GetUserMap(userIds)
file := excelize.NewFile()
streamWriter, err := file.NewStreamWriter("Sheet1")
if err != nil {
@ -2432,7 +2440,7 @@ func TestOrderCardUserRentCard(t *testing.T) {
fileName := time.Now().Format(TimeFormat) + "锁卡订单数据" + ".xlsx"
title := []interface{}{"订单id", "门店id", "门店名称", "游戏id", "游戏名称", "游戏卡编码", "锁卡时间", "订单状态", "还卡时间", "借卡用户uid", "开通会员时间", "是否拉新"}
title := []interface{}{"订单id", "账号uid", "门店id", "门店名称", "游戏id", "游戏名称", "游戏卡编码", "锁卡时间", "订单状态", "还卡时间", "借卡用户uid", "开通会员时间", "是否拉新"}
cell, _ := excelize.CoordinatesToCellName(1, 1)
if err = streamWriter.SetRow(cell, title); err != nil {
fmt.Println(err)
@ -2440,7 +2448,8 @@ func TestOrderCardUserRentCard(t *testing.T) {
list := cards
var row []interface{}
for rowId := 0; rowId < len(list); rowId++ {
store, _ := storeMap[list[rowId].StoreId]
accountUser, _ := accountUserMap[list[rowId].Uid]
store, _ := storeMap[uint32(accountUser.StoreId)]
gameCard := gameMap[list[rowId].GameCardId]
userOrder, _ := userOrderMap[list[rowId].ID]
userInfo := userMap[userOrder.Uid]
@ -2451,7 +2460,7 @@ func TestOrderCardUserRentCard(t *testing.T) {
fmt.Println("---------------userInfo")
}
row = []interface{}{list[rowId].ID, store.ID, store.Name, list[rowId].GameCardId, gameCard.Name, list[rowId].SerialNumber,
row = []interface{}{list[rowId].ID, list[rowId].Uid, store.ID, store.Name, list[rowId].GameCardId, gameCard.Name, list[rowId].SerialNumber,
list[rowId].CreatedAt.Format(TimeFormat), GetOrderStatus(list[rowId].CardStatus), list[rowId].DeliveryTime.Format(TimeFormat),
userOrder.Uid, GetUserOpenMemberTime(userInfo.OpenMemberTime), IsPullingNew(userInfo.OpenMemberTime, list[rowId].DeliveryTime),
}
@ -2597,9 +2606,13 @@ func LachineCardInfo() {
}
storeIds := make([]uint32, 0, len(cards))
gameIds := make([]uint32, 0, len(cards))
accountUids := []uint32{41062552, 61322858, 79502493, 5151314, 75683046, 92301496, 84098843}
accountUserMap, _ := GetUserMap(accountUids)
for _, user := range accountUserMap {
storeIds = append(storeIds, uint32(user.StoreId))
}
for i, _ := range cards {
storeIds = append(storeIds, cards[i].StoreId)
//storeIds = append(storeIds, cards[i].StoreId)
gameIds = append(gameIds, cards[i].GameCardId)
}
storeMap, err := GetStoreMap(storeIds)
@ -2615,7 +2628,7 @@ func LachineCardInfo() {
fileName := time.Now().Format(TimeFormat) + "锁卡数据" + ".xlsx"
title := []interface{}{"订单id", "门店id", "门店名称", "游戏id", "游戏名称", "游戏卡编码", "锁卡时间", "订单状态"}
title := []interface{}{"订单id", "账号uid", "门店id", "门店名称", "游戏id", "游戏名称", "游戏卡编码", "锁卡时间", "订单状态"}
cell, _ := excelize.CoordinatesToCellName(1, 1)
if err = streamWriter.SetRow(cell, title); err != nil {
fmt.Println(err)
@ -2623,10 +2636,12 @@ func LachineCardInfo() {
list := cards
var row []interface{}
for rowId := 0; rowId < len(list); rowId++ {
store, _ := storeMap[list[rowId].StoreId]
accountUser, _ := accountUserMap[list[rowId].Uid]
store, _ := storeMap[uint32(accountUser.StoreId)]
//store, _ := storeMap[list[rowId].StoreId]
gameCard := gameMap[list[rowId].GameCardId]
row = []interface{}{list[rowId].ID, store.ID, store.Name, list[rowId].GameCardId, gameCard.Name, list[rowId].SerialNumber,
row = []interface{}{list[rowId].ID, list[rowId].Uid, store.ID, store.Name, list[rowId].GameCardId, gameCard.Name, list[rowId].SerialNumber,
list[rowId].CreatedAt.Format(TimeFormat), GetOrderStatus(list[rowId].CardStatus),
}
cell, _ := excelize.CoordinatesToCellName(1, rowId+2)

View File

@ -12,8 +12,9 @@ import (
"time"
)
//go:generate goqueryset -in user.go
// gen:qs
//
//go:generate goqueryset -in user.go
type User struct {
Model