|
|
@@ -5,6 +5,7 @@ import ( |
|
|
|
"applet/app/e" |
|
|
|
md "applet/app/md/institutional_management/egg_energy" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
) |
|
|
|
|
|
|
@@ -58,20 +59,28 @@ func GetActivePointsUserCoinList(c *gin.Context) { |
|
|
|
} |
|
|
|
activePointsWalletList := make([]md.ActivePointsWalletNode, len(wallets)) |
|
|
|
userDb := implement.NewUserDb(db.Db) |
|
|
|
userIDs := make([]int64, len(wallets)) |
|
|
|
for i, wallet := range wallets { |
|
|
|
userIDs[i] = wallet.Uid |
|
|
|
} |
|
|
|
users, err := userDb.UserFindByParams(map[string]interface{}{ |
|
|
|
"key": "id", |
|
|
|
"value": userIDs, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
userMap := make(map[int64]model.User) |
|
|
|
for _, user := range users { |
|
|
|
userMap[user.Id] = user |
|
|
|
} |
|
|
|
for _, wallet := range wallets { |
|
|
|
user, err4 := userDb.UserGetOneByParams(map[string]interface{}{ |
|
|
|
"key": "uid", |
|
|
|
"value": wallet.Id, |
|
|
|
}) |
|
|
|
if err4 != nil { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err4.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
activePointsWallet := md.ActivePointsWalletNode{ |
|
|
|
Amount: wallet.Amount, |
|
|
|
Uid: user.Id, |
|
|
|
UserName: user.Nickname, |
|
|
|
UserPhone: user.Phone, |
|
|
|
Uid: userMap[wallet.Uid].Id, |
|
|
|
UserName: userMap[wallet.Uid].Nickname, |
|
|
|
UserPhone: userMap[wallet.Uid].Phone, |
|
|
|
} |
|
|
|
activePointsWalletList = append(activePointsWalletList, activePointsWallet) |
|
|
|
} |
|
|
@@ -123,17 +132,9 @@ func GetActivePointsUserCoinFlowList(c *gin.Context) { |
|
|
|
Total: total, |
|
|
|
} |
|
|
|
|
|
|
|
map1 := md.DirectionMap{ |
|
|
|
Key: "1", |
|
|
|
Value: "收入", |
|
|
|
} |
|
|
|
map2 := md.DirectionMap{ |
|
|
|
Key: "2", |
|
|
|
Value: "支出", |
|
|
|
} |
|
|
|
|
|
|
|
direction := []md.DirectionMap{ |
|
|
|
map1, map2, |
|
|
|
direction := []map[string]string{ |
|
|
|
{"key": "1", "value": "收入"}, |
|
|
|
{"key": "2", "value": "支出"}, |
|
|
|
} |
|
|
|
selectData := md.SelectData{Direction: direction} |
|
|
|
|
|
|
@@ -215,20 +216,28 @@ func GetGreenEnergyUserCoinList(c *gin.Context) { |
|
|
|
} |
|
|
|
activePointsWalletList := make([]md.ActivePointsWalletNode, len(wallets)) |
|
|
|
userDb := implement.NewUserDb(db.Db) |
|
|
|
userIDs := make([]int64, len(wallets)) |
|
|
|
for i, wallet := range wallets { |
|
|
|
userIDs[i] = wallet.Uid |
|
|
|
} |
|
|
|
users, err := userDb.UserFindByParams(map[string]interface{}{ |
|
|
|
"key": "id", |
|
|
|
"value": userIDs, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
userMap := make(map[int64]model.User) |
|
|
|
for _, user := range users { |
|
|
|
userMap[user.Id] = user |
|
|
|
} |
|
|
|
for _, wallet := range wallets { |
|
|
|
user, err4 := userDb.UserGetOneByParams(map[string]interface{}{ |
|
|
|
"key": "uid", |
|
|
|
"value": wallet.Id, |
|
|
|
}) |
|
|
|
if err4 != nil { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err4.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
activePointsWallet := md.ActivePointsWalletNode{ |
|
|
|
Amount: wallet.Amount, |
|
|
|
Uid: user.Id, |
|
|
|
UserName: user.Nickname, |
|
|
|
UserPhone: user.Phone, |
|
|
|
Uid: userMap[wallet.Uid].Id, |
|
|
|
UserName: userMap[wallet.Uid].Nickname, |
|
|
|
UserPhone: userMap[wallet.Uid].Phone, |
|
|
|
} |
|
|
|
activePointsWalletList = append(activePointsWalletList, activePointsWallet) |
|
|
|
} |
|
|
@@ -280,17 +289,9 @@ func GetGreenEnergyUserCoinFlowList(c *gin.Context) { |
|
|
|
Total: total, |
|
|
|
} |
|
|
|
|
|
|
|
map1 := md.DirectionMap{ |
|
|
|
Key: "1", |
|
|
|
Value: "收入", |
|
|
|
} |
|
|
|
map2 := md.DirectionMap{ |
|
|
|
Key: "2", |
|
|
|
Value: "支出", |
|
|
|
} |
|
|
|
|
|
|
|
direction := []md.DirectionMap{ |
|
|
|
map1, map2, |
|
|
|
direction := []map[string]string{ |
|
|
|
{"key": "1", "value": "收入"}, |
|
|
|
{"key": "2", "value": "支出"}, |
|
|
|
} |
|
|
|
selectData := md.SelectData{Direction: direction} |
|
|
|
|
|
|
|