Browse Source

update

master
shenjiachi 1 month ago
parent
commit
9b3a3d2399
2 changed files with 46 additions and 50 deletions
  1. +45
    -44
      app/hdl/institutional_management/egg_Energy/hdl_basic.go
  2. +1
    -6
      app/md/institutional_management/egg_energy/md_egg_energy.go

+ 45
- 44
app/hdl/institutional_management/egg_Energy/hdl_basic.go View File

@@ -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}



+ 1
- 6
app/md/institutional_management/egg_energy/md_egg_energy.go View File

@@ -47,13 +47,8 @@ type Paginate struct {
Total int64 `json:"total"` // 总数据量
}

type DirectionMap struct {
Key string `json:"key"`
Value string `json:"value"`
}

type SelectData struct {
Direction []DirectionMap `json:"direction"`
Direction []map[string]string `json:"direction"`
}

type UserVirtualCoinFlow struct {


Loading…
Cancel
Save