Browse Source

add add friend

master
shenjiachi 14 hours ago
parent
commit
179ac3439b
12 changed files with 2378 additions and 16 deletions
  1. +737
    -0
      app/hdl/hdl_add_friend.go
  2. +33
    -4
      app/hdl/hdl_home_page.go
  3. +84
    -0
      app/md/md_add_friend.go
  4. +7
    -0
      app/md/md_comm.go
  5. +4
    -0
      app/md/md_home_page.go
  6. +14
    -5
      app/router/router.go
  7. +1
    -0
      app/svc/svc_add_friend.go
  8. +0
    -0
      app/svc/svc_home_page.go
  9. +561
    -1
      docs/docs.go
  10. +561
    -1
      docs/swagger.json
  11. +372
    -1
      docs/swagger.yaml
  12. +4
    -4
      go.mod

+ 737
- 0
app/hdl/hdl_add_friend.go View File

@@ -0,0 +1,737 @@
package hdl

import (
"applet/app/db"
"applet/app/e"
"applet/app/md"
"applet/app/utils"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md"
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"github.com/shopspring/decimal"
"math"
"strconv"
"strings"
"time"
)

// EggEnergyDetails
// @Summary 蛋蛋星球-添加好友-蛋蛋能量明细(获取)
// @Tags 添加好友
// @Description 蛋蛋能量明细(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.EggEnergyDetailReq true "分页类型必填"
// @Success 200 {object} md.EggEnergyDetailResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/addFriend/eggEnergyDetails [POST]
func EggEnergyDetails(c *gin.Context) {
val, exists := c.Get("user")
if !exists {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
user, ok := val.(*model.User)
if !ok {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
var req *md.EggEnergyDetailReq
if err1 := c.ShouldBindJSON(&req); err1 != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
return
}

//1、查找 `OneCirclesPublicPlatoonBasicSetting` 基础设置
energyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db)
eggEnergyBasicSetting, err := energyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{
"key": "is_open",
"value": 1,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
var coinID int
isAsc := false
if req.Kind == "1" { // 待结
coinID = eggEnergyBasicSetting.PersonEggEnergyCoinId
} else { // 可用
coinID = eggEnergyBasicSetting.TeamEggEnergyCoinId
}
if req.Asc == "1" {
isAsc = true
}
direction := 0
switch req.Direction {
case "1":
direction = 1
case "2":
direction = 2
default:
direction = 0
}
transferType := 0
switch req.Type {
case "1":
transferType = 1
case "2":
transferType = 2
default:
transferType = 0
}
flowDb := implement.NewUserVirtualCoinFlowDb(db.Db)
flows, total, err := flowDb.UserVirtualCoinFlowFindByCoinAndUser(req.Page, req.Limit, coinID, user.Id, "", "", direction, isAsc, transferType)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

var list = make([]map[string]string, 0)
for _, flow := range flows {
var tmp = map[string]string{
"title": flow.Title,
"time": flow.CreateAt,
"type": utils.IntToStr(flow.Direction),
"value": flow.Amount,
"transfer_type": utils.IntToStr(flow.TransferType),
}
list = append(list, tmp)
}

//3、获取当前用户 蛋蛋能量(可用+结算)、 预估总价值
var teamRewardSetting *md2.TeamRewardSettingStruct
err = json.Unmarshal([]byte(eggEnergyBasicSetting.DirectPushReward), &teamRewardSetting)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
virtualAmountDb := implement.NewUserVirtualAmountDb(db.Db)
personEggEnergy, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggEnergyCoinId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
teamEggEnergy, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.TeamEggEnergyCoinId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
coreDataDb := implement.NewEggEnergyCoreDataDb(db.Db)
coreData, err := coreDataDb.EggEnergyCoreDataGet()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
totalEggEnergy := utils.StrToFloat64(personEggEnergy.Amount) + utils.StrToFloat64(teamEggEnergy.Amount)
totalEggEnergyPrice := totalEggEnergy * utils.StrToFloat64(coreData.NowPrice)

transferTypeList := md.TransferTypeList{
AvailableIntegralList: md.IntegralList{
IncomeList: []md.TransferTypeNode{
{
Value: strconv.Itoa(md3.EggPlantEggEnergySignInSettlementPersonalRewardForUserVirtualCoinFlow),
Name: md3.EggPlantEggEnergySignInSettlementPersonalReward,
},
{
Value: strconv.Itoa(md3.EggPlantBalanceExchangeForEggEnergyForUserVirtualCoinFlow),
Name: md3.EggPlantBalanceExchangeForEggEnergy,
},
{
Value: strconv.Itoa(md3.EggPlantPersonalActiveCoinExchangeEggEnergyForUserVirtualCoinFlow),
Name: md3.EggPlantPersonalActiveCoinExchangeEggEnergy,
},
{
Value: strconv.Itoa(md3.EggPlantSettlementEggEnergyExchangeEggEnergyForUserVirtualCoinFlow),
Name: md3.EggPlantSettlementEggEnergyExchangeEggEnergy,
},
},
ExpendList: []md.TransferTypeNode{
{
Value: strconv.Itoa(md3.EggPlantEggEnergyExchangeForBalanceForUserVirtualCoinFlow),
Name: md3.EggPlantEggEnergyExchangeForBalance,
},
},
},
SettlementIntegralList: md.IntegralList{
IncomeList: []md.TransferTypeNode{
{
Value: strconv.Itoa(md3.EggPlantEggEnergySignInSettlementTeamRewardForUserVirtualCoinFlow),
Name: md3.EggPlantEggEnergySignInSettlementTeamReward,
},
{
Value: strconv.Itoa(md3.EggPlantTeamActiveCoinExchangeEggEnergyForUserVirtualCoinFlow),
Name: md3.EggPlantTeamActiveCoinExchangeEggEnergy,
},
{
Value: strconv.Itoa(md3.EggPlantSettlementStarLevelDividendsForUserVirtualCoinFlow),
Name: md3.EggPlantSettlementStarLevelDividends,
},
},
ExpendList: []md.TransferTypeNode{
{
Value: strconv.Itoa(md3.EggPlantSettlementEggEnergyExchangeTobeEggEnergyForUserVirtualCoinFlow),
Name: md3.EggPlantSettlementEggEnergyExchangeEggEnergy,
},
},
},
}

resp := md.EggEnergyDetailResp{
PersonEggEnergy: personEggEnergy.Amount,
TeamEggEnergy: teamEggEnergy.Amount,
TotalEggEnergy: utils.Float64ToStr(totalEggEnergy),
TotalEggEnergyPrice: utils.Float64ToStr(totalEggEnergyPrice),
List: list,
TransferTypeList: transferTypeList,
Paginate: md.Paginate{
Limit: req.Limit,
Page: req.Page,
Total: total,
},
}

e.OutSuc(c, resp, nil)
}

// EggPointDetails
// @Summary 蛋蛋星球-添加好友-蛋蛋积分明细(获取)
// @Tags 添加好友
// @Description 蛋蛋积分明细(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.EggPointDetailsReq true "分页类型必填"
// @Success 200 {object} md.EggPointDetailsResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/addFriend/eggPointDetails [POST]
func EggPointDetails(c *gin.Context) {
val, exists := c.Get("user")
if !exists {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
user, ok := val.(*model.User)
if !ok {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
var req *md.EggPointDetailsReq
if err1 := c.ShouldBindJSON(&req); err1 != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error())
return
}

//1、查找 `OneCirclesPublicPlatoonBasicSetting` 基础设置
energyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db)
eggEnergyBasicSetting, err := energyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{
"key": "is_open",
"value": 1,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
var coinID int
isAsc := false
if req.Kind == "1" { // 待结
coinID = eggEnergyBasicSetting.PersonEggPointsCoinId
} else { // 可用
coinID = eggEnergyBasicSetting.TeamEggPointsCoinId
}
if req.Asc == "1" {
isAsc = true
}
direction := 0
switch req.Direction {
case "1":
direction = 1
case "2":
direction = 2
default:
direction = 0
}
transferType := 0
switch req.Type {
case "1":
transferType = 1
case "2":
transferType = 2
default:
transferType = 0
}
flowDb := implement.NewUserVirtualCoinFlowDb(db.Db)
flows, total, err := flowDb.UserVirtualCoinFlowFindByCoinAndUser(req.Page, req.Limit, coinID, user.Id, "", "", direction, isAsc, transferType)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
var list = make([]map[string]string, 0)
for _, flow := range flows {
var tmp = map[string]string{
"title": flow.Title,
"time": flow.CreateAt,
"type": utils.IntToStr(flow.Direction),
"value": flow.Amount,
"transfer_type": utils.IntToStr(flow.TransferType),
}
list = append(list, tmp)
}
var teamRewardSetting *md2.TeamRewardSettingStruct
err = json.Unmarshal([]byte(eggEnergyBasicSetting.DirectPushReward), &teamRewardSetting)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
virtualAmountDb := implement.NewUserVirtualAmountDb(db.Db)
var totalEggPoints float64
personEggPoints, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggEnergyCoinId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
teamEggPoints, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.TeamEggEnergyCoinId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
totalEggPoints = utils.StrToFloat64(personEggPoints.Amount) + utils.StrToFloat64(teamEggPoints.Amount)
coinDb := implement.NewVirtualCoinDb(db.Db)
coin, err := coinDb.VirtualCoinGetOneByParams(map[string]interface{}{
"key": "id",
"value": eggEnergyBasicSetting.PersonEggPointsCoinId,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
exchangeRatio, _ := decimal.NewFromString(coin.ExchangeRatio)
totalEggPointsValue := decimal.NewFromFloat(totalEggPoints)
totalEggPointsAmount := totalEggPointsValue.Div(exchangeRatio).String()

transferTypeList := md.TransferTypeList{
AvailableIntegralList: md.IntegralList{
IncomeList: []md.TransferTypeNode{
{
Value: strconv.Itoa(md3.EggPlantWatchAdRewardPersonalActiveCoinForUserVirtualCoinFlow),
Name: md3.EggPlantWatchAdRewardPersonalActiveCoin,
},
{
Value: strconv.Itoa(md3.EggPlantConsumeOrdersGiveEggEnergyToPersonForUserVirtualCoinFlow),
Name: md3.EggPlantConsumeOrdersGiveEggEnergyForPerson,
},
},
ExpendList: []md.TransferTypeNode{
{
Value: strconv.Itoa(md3.EggPlantPersonalActiveCoinExchangeToBeEggEnergyForUserVirtualCoinFlow),
Name: md3.EggPlantPersonalActiveCoinExchangeToBeEggEnergy,
},
},
},
SettlementIntegralList: md.IntegralList{
IncomeList: []md.TransferTypeNode{
{
Value: strconv.Itoa(md3.EggPlantWatchAdRewardTeamActiveCoinForUserVirtualCoinFlow),
Name: md3.EggPlantWatchAdRewardTeamActiveCoin,
},
{
Value: strconv.Itoa(md3.EggPlantConsumeOrdersGiveEggEnergyToTeamForUserVirtualCoinFlow),
Name: md3.EggPlantConsumeOrdersGiveEggEnergyForTeam,
},
},
ExpendList: []md.TransferTypeNode{
{
Value: strconv.Itoa(md3.EggPlantTeamActiveCoinExchangeToBeEggEnergyForUserVirtualCoinFlow),
Name: md3.EggPlantTeamActiveCoinExchangeToBeEggEnergy,
},
},
},
}

resp := md.EggPointDetailsResp{
PersonEggPoints: personEggPoints.Amount,
TeamEggPoints: teamEggPoints.Amount,
TotalEggPoints: utils.Float64ToStr(totalEggPoints),
TotalEggPointsAmount: totalEggPointsAmount,
List: list,
TransferTypeList: transferTypeList,
Paginate: md.Paginate{
Limit: req.Limit,
Page: req.Page,
Total: total,
},
}

e.OutSuc(c, resp, nil)
}

func BasalRate(c *gin.Context) {
//val, exists := c.Get("user")
//if !exists {
// e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
// return
//}
//user, ok := val.(*model.User)
//if !ok {
// e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
// return
//}
//
////1、查找 `one_circles_green_energy_basic_setting` 基础设置
//energyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db)
//eggEnergyBasicSetting, err := energyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{
// "key": "is_open",
// "value": 1,
//})
//if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
//}
//var teamRewardSetting *md2.TeamRewardSettingStruct
//err = json.Unmarshal([]byte(eggEnergyBasicSetting.DirectPushReward), &teamRewardSetting)
//if err != nil {
// e.OutErr(c, e.ERR, err.Error())
// return
//}
//now := time.Now()
//var oneRoundDuration = utils.StrToInt(teamRewardSetting.OneRoundDuration)
//startTime := now.Add(-time.Hour * time.Duration(oneRoundDuration)).Format("2006-01-02 15:04:05")
//
//signInDb := implement.NewEggSignInDb(db.Db)
//get, eggSignIn, err := signInDb.EggSignINGetOneByTimeAndUid(startTime, "", user.Id, 0)
//if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
//}
//var signRewardEggEnergy string
//var signCountdown string
//if !get {
// signRewardEggEnergy = "0.00"
//} else {
// signRewardEggEnergy = eggSignIn.EstimatePerSecondEggEnergyValue
// endTime := utils.TimeParseStd(eggSignIn.EndTime)
// if endTime.Before(now) {
// //TODO::证明此时上一轮签到已结束,暂时还没结算
// signRewardEggEnergy = "0.00"
// } else {
// duration := endTime.Sub(now) // 计算时间差值
// hours := duration / time.Hour // 获取小时部分
// minutes := duration % time.Hour / time.Minute // 获取分钟部分(先除去小时后再乘以60)
// seconds := int64(duration/time.Second) % 60
// signCountdown = fmt.Sprintf("%d:%d:%d", hours, minutes, seconds) //收益倒计时
// }
//}
//nowBasalRate := utils.StrToFloat64(signRewardEggEnergy) * 60 * 60 //每小时基础速率
//
////2、组装距状图数据
//var signInRewards []*md.SignInRewardStruct
//err = json.Unmarshal([]byte(oneCirclesGreenEnergyBasicSetting.SignInReward), &signInRewards)
//if err != nil {
// e.OutErr(c, e.ERR, err.Error())
// return
//}
//var barChartYData, barChartXData []string
//for _, v := range signInRewards {
// barChartYData = append(barChartYData, utils.Float64ToStrPrec8(utils.StrToFloat64(v.RewardValue)*60*60))
// var vipMemberStartNum, vipMemberEndNums int64
// vipMemberStartNum = utils.StrToInt64(v.VipMemberStartNums)
// vipMemberEndNums = utils.StrToInt64(v.VipMemberEndNums)
// var vipMemberStartNumStr, vipMemberEndNumsStr string
// if vipMemberStartNum >= 10000 && vipMemberStartNum < 100000 {
// vipMemberStartNum = vipMemberStartNum / 10000
// vipMemberStartNumStr = utils.Int64ToStr(vipMemberStartNum) + "万"
// } else if vipMemberStartNum >= 100000 && vipMemberStartNum < 1000000 {
// vipMemberStartNum = vipMemberStartNum / 100000
// vipMemberStartNumStr = utils.Int64ToStr(vipMemberStartNum) + "十万"
// } else if vipMemberStartNum >= 1000000 && vipMemberStartNum < 10000000 {
// vipMemberStartNum = vipMemberStartNum / 1000000
// vipMemberStartNumStr = utils.Int64ToStr(vipMemberStartNum) + "百万"
// } else if vipMemberStartNum >= 10000000 && vipMemberStartNum < 100000000 {
// vipMemberStartNum = vipMemberStartNum / 10000000
// vipMemberStartNumStr = utils.Int64ToStr(vipMemberStartNum) + "千万"
// } else if vipMemberStartNum >= 100000000 {
// vipMemberStartNum = vipMemberStartNum / 100000000
// vipMemberStartNumStr = utils.Int64ToStr(vipMemberStartNum) + "亿"
// } else {
// vipMemberStartNumStr = utils.Int64ToStr(vipMemberStartNum)
// }
//
// if vipMemberEndNums >= 10000 && vipMemberEndNums < 100000 {
// vipMemberEndNums = vipMemberEndNums / 10000
// vipMemberEndNumsStr = utils.Int64ToStr(vipMemberEndNums) + "万"
// } else if vipMemberEndNums >= 100000 && vipMemberEndNums < 1000000 {
// vipMemberEndNums = vipMemberEndNums / 100000
// vipMemberEndNumsStr = utils.Int64ToStr(vipMemberEndNums) + "十万"
// } else if vipMemberEndNums >= 1000000 && vipMemberEndNums < 10000000 {
// vipMemberEndNums = vipMemberEndNums / 1000000
// vipMemberEndNumsStr = utils.Int64ToStr(vipMemberEndNums) + "百万"
// } else if vipMemberEndNums >= 10000000 && vipMemberEndNums < 100000000 {
// vipMemberEndNums = vipMemberEndNums / 10000000
// vipMemberEndNumsStr = utils.Int64ToStr(vipMemberEndNums) + "千万"
// } else if vipMemberEndNums >= 100000000 {
// vipMemberEndNums = vipMemberEndNums / 100000000
// vipMemberEndNumsStr = utils.Int64ToStr(vipMemberEndNums) + "亿"
// } else {
// vipMemberEndNumsStr = utils.Int64ToStr(vipMemberEndNums)
//
// }
// barChartXData = append(barChartXData, vipMemberStartNumStr+"~"+vipMemberEndNumsStr)
//}
//
////3、统计当前平台累计用户、距离下次减产还剩多少人
//results, err := commDb.QueryNativeString(engine, "SELECT COUNT(*)AS total FROM user")
//if err != nil {
// e.OutErr(c, e.ERR_DB_ORM, err.Error())
// return
//}
//userCount := utils.StrToInt64(results[0]["total"])
//var nextReduceMembers string
//for k, v := range signInRewards {
// if zhios_order_relate_utils.StrToInt64(v.VipMemberEndNums) >= userCount && userCount >= zhios_order_relate_utils.StrToInt64(v.VipMemberStartNums) {
// nextReduceMembers = utils.Int64ToStr(utils.StrToInt64(signInRewards[k+1].VipMemberStartNums) - userCount)
// }
//}
//e.OutSuc(c, map[string]interface{}{
// "now_basal_rate": nowBasalRate,
// "sign_countdown": signCountdown,
// "user_count": userCount,
// "next_reduce_members": nextReduceMembers,
// "bar_chart_data": map[string]interface{}{
// "x_data": barChartXData,
// "y_data": barChartYData,
// },
//}, nil)
//return
e.OutSuc(c, nil, nil)
}

// MyFans
// @Summary 蛋蛋星球-添加好友-粉丝团队-我的粉丝-团队加速速率(获取)
// @Tags 添加好友
// @Description 团队加速速率(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Success 200 {object} md.MyFansResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/addFriend/myFans [GET]
func MyFans(c *gin.Context) {
val, exists := c.Get("user")
if !exists {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
user, ok := val.(*model.User)
if !ok {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
// 找出公排中所有关联用户
userRelateDb := implement.NewUserRelateDb(db.Db)
total, err := userRelateDb.UserRelatesCountByParentUid(user.Id, 0)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err)
return
}
session := db.Db.NewSession()
defer session.Close()
now := time.Now()
assistanceDb := implement.NewEggEnergyTeamAssistanceDb(db.Db)
assistance, err := assistanceDb.EggEnergyTeamAssistanceGetOneBySession(session, user.Id, now.Format("2006-01-02"))
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err)
return
}
var nowTeamAssistanceNum int
var nowTeamAssistanceReward string
if assistance != nil {
nowTeamAssistanceNum = assistance.AssistedNum
nowTeamAssistanceReward = assistance.RewardScore
}
resp := md.MyFansResp{
NowTeamUser: total,
NowTeamAssistanceNum: nowTeamAssistanceNum,
NowTeamAssistanceReward: nowTeamAssistanceReward,
}
e.OutSuc(c, resp, nil)
return
}

// MyFansUserList
// @Summary 蛋蛋星球-添加好友-粉丝团队-我的粉丝-在线好友列表(获取)
// @Tags 添加好友
// @Description 在线好友列表(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Success 200 {object} md.MyFansUserListResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/addFriend/myFansUserList [GET]
func MyFansUserList(c *gin.Context) {
page := c.DefaultQuery("page", "")
limit := c.DefaultQuery("page_size", "20")

now := time.Now()
val, exists := c.Get("user")
if !exists {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
user, ok := val.(*model.User)
if !ok {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}

energyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db)
eggEnergyBasicSetting, err := energyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{
"key": "is_open",
"value": 1,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
var teamRewardSetting *md2.TeamRewardSettingStruct
err = json.Unmarshal([]byte(eggEnergyBasicSetting.DirectPushReward), &teamRewardSetting)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
var oneRoundDuration = utils.StrToInt(teamRewardSetting.OneRoundDuration)
startTime := now.Add(-time.Hour * time.Duration(oneRoundDuration)).Format("2006-01-02 15:04:05")
relateDb := implement.NewUserRelateDb(db.Db)
userRelates, err := relateDb.FindUserRelateByParentUid(user.Id, 1)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
var userRelatesUids []string
var userSignInMap = map[int64]interface{}{}
var results []map[string]string
if userRelates != nil {
for _, userRelate := range *userRelates {
userRelatesUids = append(userRelatesUids, utils.Int64ToStr(userRelate.Uid))
}
signInDb := implement.NewEggSignInDb(db.Db)

eggSignIns, err1 := signInDb.EggSignInFindByTimeAndParams(startTime, "", 0, map[string]interface{}{
"key": "uid",
"value": userRelatesUids,
})
if err1 != nil {
e.OutErr(c, e.ERR_DB_ORM, err1.Error())
return
}
for _, eggSignIn := range eggSignIns {
userSignInMap[eggSignIn.Uid] = *eggSignIn
}

var sql string
sql = "SELECT user.id AS uid, user.avatar AS avatar, user.nickname AS nickname, user_relate.invite_time AS invite_time " +
"FROM `user_relate` " +
"LEFT JOIN `user` ON user_relate.uid = user.uid " +
"where user_relate.uid IN(%s)"
sql += " ORDER BY user_relate.invite_time DESC LIMIT %d, %d;"
sql = fmt.Sprintf(sql, strings.Join(userRelatesUids, ","), (utils.StrToInt64(page)-1)*utils.StrToInt64(limit), utils.StrToInt64(limit))
results, err = db.QueryNativeString(db.Db, sql)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
}

var data []md.OneLineUserNode
for _, v := range results {
isOnline := false
if userSignInMap[utils.AnyToInt64(v["uid"])] != nil {
isOnline = true
}
data = append(data, md.OneLineUserNode{
IsOnline: isOnline,
AvatarURL: v["avatar_url"],
Nickname: v["nickname"],
InviteTime: v["invite_time"],
})
}
resp := md.MyFansUserListResp{
List: data,
}

e.OutSuc(c, resp, nil)
return
}

// NineDimensionalSpace
// @Summary 蛋蛋星球-添加好友-粉丝团队-九维空间(获取)
// @Tags 添加好友
// @Description 九维空间(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Success 200 {object} md.NineDimensionalSpaceResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/addFriend/nineDimensionalSpace [GET]
func NineDimensionalSpace(c *gin.Context) {
//1、 查找 `one_circles_public_platoon_basic_setting` 基础设置
settingDb := implement.NewPublicPlatoonBasicSettingDb(db.Db)
setting, err := settingDb.PublicPlatoonBasicSettingGetOneByParams(map[string]interface{}{
"key": "is_open",
"value": 1,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if setting == nil {
e.OutErr(c, e.ERR_NO_DATA, nil)
return
}
val, exists := c.Get("user")
if !exists {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
user, ok := val.(*model.User)
if !ok {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
uid := user.Id

var list []md.SpaceListNode
for i := 1; i <= setting.SeveralRows; i++ {
var tmpSql = fmt.Sprintf("SELECT COUNT(*)AS total FROM `public_platoon_user_relation` WHERE father_uid%d = %d", i, uid)
tmpNativeString, _ := db.QueryNativeString(db.Db, tmpSql)
nowUserCount := utils.StrToInt64(tmpNativeString[0]["total"])
maxCount := math.Pow(float64(setting.SeveralTimes), float64(i))
if nowUserCount > int64(maxCount) {
nowUserCount = int64(maxCount)
}
list = append(list, md.SpaceListNode{
Name: utils.IntToStr(i) + "维",
MaxCount: utils.Float64ToStr(maxCount),
NowCount: utils.Int64ToStr(nowUserCount),
})
}

//2、统计当前用户下多少人数
sql := fmt.Sprintf("SELECT COUNT(*)AS total FROM `public_platoon_user_relation` WHERE father_uid1 = %d OR father_uid2= %d OR father_uid3= %d OR father_uid4= %d OR father_uid5= %d OR father_uid6= %d OR father_uid7= %d OR father_uid8= %d OR father_uid9= %d", uid, uid, uid, uid, uid, uid, uid, uid, uid)
nativeString1, _ := db.QueryNativeString(db.Db, sql)
hasUserCount := utils.StrToInt64(nativeString1[0]["total"])

resp := md.NineDimensionalSpaceResp{
SpaceTotalNums: "29523",
SpaceNums: utils.Int64ToStr(hasUserCount),
SpaceList: list,
ALotOfNums: "29523",
}

e.OutSuc(c, resp, nil)
return
}

app/hdl/home_page/hdl_basic.go → app/hdl/hdl_home_page.go View File

@@ -1,10 +1,10 @@
package home_page
package hdl

import (
"applet/app/db"
"applet/app/e"
md "applet/app/md/home_page"
svc "applet/app/svc/home_page"
"applet/app/md"
"applet/app/svc"
"applet/app/utils"
"applet/app/utils/cache"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
@@ -341,7 +341,7 @@ func RealTimePrice(c *gin.Context) {
// IsCanSignIn
// @Summary 蛋蛋星球-主页-是否能签到(获取)
// @Tags 主页
// @Description 是否签到(获取)
// @Description 是否可以签到(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
@@ -407,3 +407,32 @@ func IsCanSignIn(c *gin.Context) {
e.OutSuc(c, resp, nil)
return
}

// IsCanGetRedPackage
// @Summary 蛋蛋星球-主页-是否领取红包(获取)
// @Tags 主页
// @Description 是否可以领取红包(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Success 200 {object} md.IsCanGetRedPackageResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/homePage/isCanGetRedPackage [get]
func IsCanGetRedPackage(c *gin.Context) {
redPackageDb := implement.NewNewUserRedPackageDb(db.Db)
redPackage, err := redPackageDb.NewUserRedPackageGetOne()
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
isCan := false
if redPackage != nil {
if redPackage.IsOpen == 1 {
isCan = true
}
}
resp := md.IsCanGetRedPackageResp{
IsCan: isCan,
}
e.OutSuc(c, resp, nil)
}

+ 84
- 0
app/md/md_add_friend.go View File

@@ -0,0 +1,84 @@
package md

type EggEnergyDetailReq struct {
Page int `json:"page,required"` // 页数
Limit int `json:"limit,required"` // 每页大小
Kind string `json:"kind"` // 类型:1. 个人蛋蛋能量 2.团队蛋蛋能量
Direction string `json:"direction"` // 类型 1.收入 2.支出 全部则传空
Type string `json:"type"` // 变动类型 全部则传空
Asc string `json:"asc"` // 1.升序 2.倒序
}

type TransferTypeNode struct {
Value string `json:"value"`
Name string `json:"name"`
}

type IntegralList struct {
IncomeList []TransferTypeNode `json:"income_list"` // 收入类型列表
ExpendList []TransferTypeNode `json:"expend_list"` // 支出类型列表
}

type TransferTypeList struct {
AvailableIntegralList IntegralList `json:"available_integral_list"` // 可用积分列表
SettlementIntegralList IntegralList `json:"settlement_integral_list"` // 结算积分列表
}

type EggEnergyDetailResp struct {
PersonEggEnergy string `json:"person_egg_energy"` // 个人蛋蛋能量
TeamEggEnergy string `json:"team_egg_energy"` // 团队蛋蛋能量
TotalEggEnergy string `json:"total_egg_energy"` // 总蛋蛋能量
TotalEggEnergyPrice string `json:"total_egg_energy_price"` // 蛋蛋能量总价
List []map[string]string `json:"list"` // 流水数据
TransferTypeList TransferTypeList `json:"transfer_type_list"` // 转账类型列表
Paginate Paginate `json:"paginate"` // 分页信息
}

type EggPointDetailsReq struct {
Page int `json:"page,required"` // 页数
Limit int `json:"limit,required"` // 每页大小
Kind string `json:"kind"` // 类型:1. 个人蛋蛋积分 2.团队蛋蛋积分
Direction string `json:"direction"` // 类型 1.收入 2.支出 全部则传空
Type string `json:"type"` // 变动类型 全部则传空
Asc string `json:"asc"` // 1.升序 2.倒序
}

type EggPointDetailsResp struct {
PersonEggPoints string `json:"person_egg_points"` // 个人蛋蛋积分
TeamEggPoints string `json:"team_egg_points"` // 团队蛋蛋积分
TotalEggPoints string `json:"total_egg_points"` // 总蛋蛋积分
TotalEggPointsAmount string `json:"total_egg_points_amount"` // 蛋蛋积分余额
List []map[string]string `json:"list"` // 流水数据
TransferTypeList TransferTypeList `json:"transfer_type_list"` // 转账类型列表
Paginate Paginate `json:"paginate"` // 分页信息
}

type MyFansResp struct {
NowTeamUser int64 `json:"now_team_user"` // 团队人数
NowTeamAssistanceNum int `json:"now_team_assistance_num"` // 团队助力人数
NowTeamAssistanceReward string `json:"now_team_assistance_reward"` // 团队助力收益
}

type OneLineUserNode struct {
IsOnline bool `json:"is_online"`
AvatarURL string `json:"avatar_url"`
Nickname string `json:"nickname"`
InviteTime string `json:"invite_time"`
}

type MyFansUserListResp struct {
List []OneLineUserNode `json:"list"`
}

type SpaceListNode struct {
Name string `json:"name"` // 维度
MaxCount string `json:"max_count"` // 最大容纳人数
NowCount string `json:"now_count"` // 当前人数
}

type NineDimensionalSpaceResp struct {
SpaceTotalNums string `json:"space_total_nums"` //空间总数
SpaceNums string `json:"space_nums"` // 空间人数
SpaceList []SpaceListNode `json:"space_list"` // 数据列表
ALotOfNums string `json:"a_lot_of_nums"` // 全网至多用户数
}

+ 7
- 0
app/md/md_comm.go View File

@@ -0,0 +1,7 @@
package md

type Paginate struct {
Limit int `json:"limit"` // 每页大小
Page int `json:"page"` // 页数
Total int64 `json:"total"` // 总数据量
}

app/md/home_page/md_basic.go → app/md/md_home_page.go View File

@@ -33,3 +33,7 @@ type RealTimePriceResp struct {
type IsCanSignInResp struct {
IsCan bool `json:"is_can_sign_in"`
}

type IsCanGetRedPackageResp struct {
IsCan bool `json:"is_can_get_red_package"`
}

+ 14
- 5
app/router/router.go View File

@@ -4,7 +4,6 @@ import (
"applet/app/cfg"
"applet/app/hdl"
"applet/app/hdl/comm"
"applet/app/hdl/home_page"
"applet/app/mw"
_ "applet/docs"
"github.com/gin-gonic/gin"
@@ -59,10 +58,20 @@ func route(r *gin.RouterGroup) {
rComm(r.Group("/comm"))
rHomePage := r.Group("/homePage")
{
rHomePage.GET("/index", home_page.HomePage) // 主页
rHomePage.GET("/adRule", home_page.HomePageWatchAdRule) // 可以观看广告列表
rHomePage.GET("/realTimePrice", home_page.RealTimePrice) // 实时数据
rHomePage.GET("/isCanSignIn", home_page.IsCanSignIn) // 是否可以观看广告
rHomePage.GET("/index", hdl.HomePage) // 主页
rHomePage.GET("/adRule", hdl.HomePageWatchAdRule) // 主页-可以观看广告列表
rHomePage.GET("/realTimePrice", hdl.RealTimePrice) // 主页-实时数据
rHomePage.GET("/isCanSignIn", hdl.IsCanSignIn) // 主页-是否可以观看广告
rHomePage.GET("/isCanGetRedPackage", hdl.IsCanGetRedPackage) // 主页-是否可以获得红包
}
rAddFriend := r.Group("/addFriend")
{
rAddFriend.POST("/eggEnergyDetails", hdl.EggEnergyDetails) // 添加好友-蛋蛋能量明细
rAddFriend.POST("/eggPointDetails", hdl.EggPointDetails) // 添加好友-蛋蛋积分明细
rAddFriend.GET("/basalRate", hdl.BasalRate)
rAddFriend.GET("/myFans", hdl.MyFans) // 添加好友-我的粉丝-团队速率
rAddFriend.GET("/myFansUserList", hdl.MyFansUserList) // 添加好友-我的粉丝-好友列表
rAddFriend.GET("/nineDimensionalSpace", hdl.NineDimensionalSpace) // 添加好友-我的粉丝-九维空间
}

}


+ 1
- 0
app/svc/svc_add_friend.go View File

@@ -0,0 +1 @@
package svc

app/svc/home_page/svc_basic.go → app/svc/svc_home_page.go View File


+ 561
- 1
docs/docs.go View File

@@ -24,6 +24,214 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/addFriend/eggEnergyDetails": {
"post": {
"description": "蛋蛋能量明细(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"添加好友"
],
"summary": "蛋蛋星球-添加好友-蛋蛋能量明细(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "分页类型必填",
"name": "req",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/md.EggEnergyDetailReq"
}
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.EggEnergyDetailResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/addFriend/eggPointDetails": {
"post": {
"description": "蛋蛋积分明细(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"添加好友"
],
"summary": "蛋蛋星球-添加好友-蛋蛋积分明细(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "分页类型必填",
"name": "req",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/md.EggPointDetailsReq"
}
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.EggPointDetailsResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/addFriend/myFans": {
"get": {
"description": "团队加速速率(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"添加好友"
],
"summary": "蛋蛋星球-添加好友-粉丝团队-我的粉丝-团队加速速率(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.MyFansResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/addFriend/myFansUserList": {
"get": {
"description": "在线好友列表(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"添加好友"
],
"summary": "蛋蛋星球-添加好友-粉丝团队-我的粉丝-在线好友列表(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.MyFansUserListResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/addFriend/nineDimensionalSpace": {
"get": {
"description": "九维空间(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"添加好友"
],
"summary": "蛋蛋星球-添加好友-粉丝团队-九维空间(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.NineDimensionalSpaceResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/comm/getOssUrl": {
"get": {
"description": "上传许可链接(获取)",
@@ -138,9 +346,47 @@ const docTemplate = `{
}
}
},
"/api/v1/homePage/isCanGetRedPackage": {
"get": {
"description": "是否可以领取红包(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"主页"
],
"summary": "蛋蛋星球-主页-是否领取红包(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.IsCanGetRedPackageResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/homePage/isCanSignIn": {
"get": {
"description": "是否能签到(获取)",
"description": "是否可以签到(获取)",
"consumes": [
"application/json"
],
@@ -335,6 +581,175 @@ const docTemplate = `{
}
},
"definitions": {
"applet_app_md.Paginate": {
"type": "object",
"properties": {
"limit": {
"description": "每页大小",
"type": "integer"
},
"page": {
"description": "页数",
"type": "integer"
},
"total": {
"description": "总数据量",
"type": "integer"
}
}
},
"md.EggEnergyDetailReq": {
"type": "object",
"properties": {
"asc": {
"description": "1.升序 2.倒序",
"type": "string"
},
"direction": {
"description": "类型 1.收入 2.支出 全部则传空",
"type": "string"
},
"kind": {
"description": "类型:1. 个人蛋蛋能量 2.团队蛋蛋能量",
"type": "string"
},
"limit": {
"description": "每页大小",
"type": "integer"
},
"page": {
"description": "页数",
"type": "integer"
},
"type": {
"description": "变动类型 全部则传空",
"type": "string"
}
}
},
"md.EggEnergyDetailResp": {
"type": "object",
"properties": {
"list": {
"description": "流水数据",
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"paginate": {
"description": "分页信息",
"allOf": [
{
"$ref": "#/definitions/applet_app_md.Paginate"
}
]
},
"person_egg_energy": {
"description": "个人蛋蛋能量",
"type": "string"
},
"team_egg_energy": {
"description": "团队蛋蛋能量",
"type": "string"
},
"total_egg_energy": {
"description": "总蛋蛋能量",
"type": "string"
},
"total_egg_energy_price": {
"description": "蛋蛋能量总价",
"type": "string"
},
"transfer_type_list": {
"description": "转账类型列表",
"allOf": [
{
"$ref": "#/definitions/md.TransferTypeList"
}
]
}
}
},
"md.EggPointDetailsReq": {
"type": "object",
"properties": {
"asc": {
"description": "1.升序 2.倒序",
"type": "string"
},
"direction": {
"description": "类型 1.收入 2.支出 全部则传空",
"type": "string"
},
"kind": {
"description": "类型:1. 个人蛋蛋积分 2.团队蛋蛋积分",
"type": "string"
},
"limit": {
"description": "每页大小",
"type": "integer"
},
"page": {
"description": "页数",
"type": "integer"
},
"type": {
"description": "变动类型 全部则传空",
"type": "string"
}
}
},
"md.EggPointDetailsResp": {
"type": "object",
"properties": {
"list": {
"description": "流水数据",
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"paginate": {
"description": "分页信息",
"allOf": [
{
"$ref": "#/definitions/applet_app_md.Paginate"
}
]
},
"person_egg_points": {
"description": "个人蛋蛋积分",
"type": "string"
},
"team_egg_points": {
"description": "团队蛋蛋积分",
"type": "string"
},
"total_egg_points": {
"description": "总蛋蛋积分",
"type": "string"
},
"total_egg_points_amount": {
"description": "蛋蛋积分余额",
"type": "string"
},
"transfer_type_list": {
"description": "转账类型列表",
"allOf": [
{
"$ref": "#/definitions/md.TransferTypeList"
}
]
}
}
},
"md.HomePageResp": {
"type": "object",
"properties": {
@@ -413,6 +828,33 @@ const docTemplate = `{
}
}
},
"md.IntegralList": {
"type": "object",
"properties": {
"expend_list": {
"description": "支出类型列表",
"type": "array",
"items": {
"$ref": "#/definitions/md.TransferTypeNode"
}
},
"income_list": {
"description": "收入类型列表",
"type": "array",
"items": {
"$ref": "#/definitions/md.TransferTypeNode"
}
}
}
},
"md.IsCanGetRedPackageResp": {
"type": "object",
"properties": {
"is_can_get_red_package": {
"type": "boolean"
}
}
},
"md.IsCanSignInResp": {
"type": "object",
"properties": {
@@ -450,6 +892,75 @@ const docTemplate = `{
}
}
},
"md.MyFansResp": {
"type": "object",
"properties": {
"now_team_assistance_num": {
"description": "团队助力人数",
"type": "integer"
},
"now_team_assistance_reward": {
"description": "团队助力收益",
"type": "string"
},
"now_team_user": {
"description": "团队人数",
"type": "integer"
}
}
},
"md.MyFansUserListResp": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/md.OneLineUserNode"
}
}
}
},
"md.NineDimensionalSpaceResp": {
"type": "object",
"properties": {
"a_lot_of_nums": {
"description": "全网至多用户数",
"type": "string"
},
"space_list": {
"description": "数据列表",
"type": "array",
"items": {
"$ref": "#/definitions/md.SpaceListNode"
}
},
"space_nums": {
"description": "空间人数",
"type": "string"
},
"space_total_nums": {
"description": "空间总数",
"type": "string"
}
}
},
"md.OneLineUserNode": {
"type": "object",
"properties": {
"avatar_url": {
"type": "string"
},
"invite_time": {
"type": "string"
},
"is_online": {
"type": "boolean"
},
"nickname": {
"type": "string"
}
}
},
"md.RealTimePriceResp": {
"type": "object",
"properties": {
@@ -525,6 +1036,55 @@ const docTemplate = `{
"example": "具体错误原因"
}
}
},
"md.SpaceListNode": {
"type": "object",
"properties": {
"max_count": {
"description": "最大容纳人数",
"type": "string"
},
"name": {
"description": "维度",
"type": "string"
},
"now_count": {
"description": "当前人数",
"type": "string"
}
}
},
"md.TransferTypeList": {
"type": "object",
"properties": {
"available_integral_list": {
"description": "可用积分列表",
"allOf": [
{
"$ref": "#/definitions/md.IntegralList"
}
]
},
"settlement_integral_list": {
"description": "结算积分列表",
"allOf": [
{
"$ref": "#/definitions/md.IntegralList"
}
]
}
}
},
"md.TransferTypeNode": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
}`


+ 561
- 1
docs/swagger.json View File

@@ -18,6 +18,214 @@
"host": "ddxq.izhim.com",
"basePath": "/api/v1",
"paths": {
"/api/v1/addFriend/eggEnergyDetails": {
"post": {
"description": "蛋蛋能量明细(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"添加好友"
],
"summary": "蛋蛋星球-添加好友-蛋蛋能量明细(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "分页类型必填",
"name": "req",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/md.EggEnergyDetailReq"
}
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.EggEnergyDetailResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/addFriend/eggPointDetails": {
"post": {
"description": "蛋蛋积分明细(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"添加好友"
],
"summary": "蛋蛋星球-添加好友-蛋蛋积分明细(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "分页类型必填",
"name": "req",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/md.EggPointDetailsReq"
}
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.EggPointDetailsResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/addFriend/myFans": {
"get": {
"description": "团队加速速率(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"添加好友"
],
"summary": "蛋蛋星球-添加好友-粉丝团队-我的粉丝-团队加速速率(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.MyFansResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/addFriend/myFansUserList": {
"get": {
"description": "在线好友列表(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"添加好友"
],
"summary": "蛋蛋星球-添加好友-粉丝团队-我的粉丝-在线好友列表(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.MyFansUserListResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/addFriend/nineDimensionalSpace": {
"get": {
"description": "九维空间(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"添加好友"
],
"summary": "蛋蛋星球-添加好友-粉丝团队-九维空间(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.NineDimensionalSpaceResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/comm/getOssUrl": {
"get": {
"description": "上传许可链接(获取)",
@@ -132,9 +340,47 @@
}
}
},
"/api/v1/homePage/isCanGetRedPackage": {
"get": {
"description": "是否可以领取红包(获取)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"主页"
],
"summary": "蛋蛋星球-主页-是否领取红包(获取)",
"parameters": [
{
"type": "string",
"description": "验证参数Bearer和token空格拼接",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "具体数据",
"schema": {
"$ref": "#/definitions/md.IsCanGetRedPackageResp"
}
},
"400": {
"description": "具体错误",
"schema": {
"$ref": "#/definitions/md.Response"
}
}
}
}
},
"/api/v1/homePage/isCanSignIn": {
"get": {
"description": "是否能签到(获取)",
"description": "是否可以签到(获取)",
"consumes": [
"application/json"
],
@@ -329,6 +575,175 @@
}
},
"definitions": {
"applet_app_md.Paginate": {
"type": "object",
"properties": {
"limit": {
"description": "每页大小",
"type": "integer"
},
"page": {
"description": "页数",
"type": "integer"
},
"total": {
"description": "总数据量",
"type": "integer"
}
}
},
"md.EggEnergyDetailReq": {
"type": "object",
"properties": {
"asc": {
"description": "1.升序 2.倒序",
"type": "string"
},
"direction": {
"description": "类型 1.收入 2.支出 全部则传空",
"type": "string"
},
"kind": {
"description": "类型:1. 个人蛋蛋能量 2.团队蛋蛋能量",
"type": "string"
},
"limit": {
"description": "每页大小",
"type": "integer"
},
"page": {
"description": "页数",
"type": "integer"
},
"type": {
"description": "变动类型 全部则传空",
"type": "string"
}
}
},
"md.EggEnergyDetailResp": {
"type": "object",
"properties": {
"list": {
"description": "流水数据",
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"paginate": {
"description": "分页信息",
"allOf": [
{
"$ref": "#/definitions/applet_app_md.Paginate"
}
]
},
"person_egg_energy": {
"description": "个人蛋蛋能量",
"type": "string"
},
"team_egg_energy": {
"description": "团队蛋蛋能量",
"type": "string"
},
"total_egg_energy": {
"description": "总蛋蛋能量",
"type": "string"
},
"total_egg_energy_price": {
"description": "蛋蛋能量总价",
"type": "string"
},
"transfer_type_list": {
"description": "转账类型列表",
"allOf": [
{
"$ref": "#/definitions/md.TransferTypeList"
}
]
}
}
},
"md.EggPointDetailsReq": {
"type": "object",
"properties": {
"asc": {
"description": "1.升序 2.倒序",
"type": "string"
},
"direction": {
"description": "类型 1.收入 2.支出 全部则传空",
"type": "string"
},
"kind": {
"description": "类型:1. 个人蛋蛋积分 2.团队蛋蛋积分",
"type": "string"
},
"limit": {
"description": "每页大小",
"type": "integer"
},
"page": {
"description": "页数",
"type": "integer"
},
"type": {
"description": "变动类型 全部则传空",
"type": "string"
}
}
},
"md.EggPointDetailsResp": {
"type": "object",
"properties": {
"list": {
"description": "流水数据",
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"paginate": {
"description": "分页信息",
"allOf": [
{
"$ref": "#/definitions/applet_app_md.Paginate"
}
]
},
"person_egg_points": {
"description": "个人蛋蛋积分",
"type": "string"
},
"team_egg_points": {
"description": "团队蛋蛋积分",
"type": "string"
},
"total_egg_points": {
"description": "总蛋蛋积分",
"type": "string"
},
"total_egg_points_amount": {
"description": "蛋蛋积分余额",
"type": "string"
},
"transfer_type_list": {
"description": "转账类型列表",
"allOf": [
{
"$ref": "#/definitions/md.TransferTypeList"
}
]
}
}
},
"md.HomePageResp": {
"type": "object",
"properties": {
@@ -407,6 +822,33 @@
}
}
},
"md.IntegralList": {
"type": "object",
"properties": {
"expend_list": {
"description": "支出类型列表",
"type": "array",
"items": {
"$ref": "#/definitions/md.TransferTypeNode"
}
},
"income_list": {
"description": "收入类型列表",
"type": "array",
"items": {
"$ref": "#/definitions/md.TransferTypeNode"
}
}
}
},
"md.IsCanGetRedPackageResp": {
"type": "object",
"properties": {
"is_can_get_red_package": {
"type": "boolean"
}
}
},
"md.IsCanSignInResp": {
"type": "object",
"properties": {
@@ -444,6 +886,75 @@
}
}
},
"md.MyFansResp": {
"type": "object",
"properties": {
"now_team_assistance_num": {
"description": "团队助力人数",
"type": "integer"
},
"now_team_assistance_reward": {
"description": "团队助力收益",
"type": "string"
},
"now_team_user": {
"description": "团队人数",
"type": "integer"
}
}
},
"md.MyFansUserListResp": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/md.OneLineUserNode"
}
}
}
},
"md.NineDimensionalSpaceResp": {
"type": "object",
"properties": {
"a_lot_of_nums": {
"description": "全网至多用户数",
"type": "string"
},
"space_list": {
"description": "数据列表",
"type": "array",
"items": {
"$ref": "#/definitions/md.SpaceListNode"
}
},
"space_nums": {
"description": "空间人数",
"type": "string"
},
"space_total_nums": {
"description": "空间总数",
"type": "string"
}
}
},
"md.OneLineUserNode": {
"type": "object",
"properties": {
"avatar_url": {
"type": "string"
},
"invite_time": {
"type": "string"
},
"is_online": {
"type": "boolean"
},
"nickname": {
"type": "string"
}
}
},
"md.RealTimePriceResp": {
"type": "object",
"properties": {
@@ -519,6 +1030,55 @@
"example": "具体错误原因"
}
}
},
"md.SpaceListNode": {
"type": "object",
"properties": {
"max_count": {
"description": "最大容纳人数",
"type": "string"
},
"name": {
"description": "维度",
"type": "string"
},
"now_count": {
"description": "当前人数",
"type": "string"
}
}
},
"md.TransferTypeList": {
"type": "object",
"properties": {
"available_integral_list": {
"description": "可用积分列表",
"allOf": [
{
"$ref": "#/definitions/md.IntegralList"
}
]
},
"settlement_integral_list": {
"description": "结算积分列表",
"allOf": [
{
"$ref": "#/definitions/md.IntegralList"
}
]
}
}
},
"md.TransferTypeNode": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
}

+ 372
- 1
docs/swagger.yaml View File

@@ -1,5 +1,119 @@
basePath: /api/v1
definitions:
applet_app_md.Paginate:
properties:
limit:
description: 每页大小
type: integer
page:
description: 页数
type: integer
total:
description: 总数据量
type: integer
type: object
md.EggEnergyDetailReq:
properties:
asc:
description: 1.升序 2.倒序
type: string
direction:
description: 类型 1.收入 2.支出 全部则传空
type: string
kind:
description: 类型:1. 个人蛋蛋能量 2.团队蛋蛋能量
type: string
limit:
description: 每页大小
type: integer
page:
description: 页数
type: integer
type:
description: 变动类型 全部则传空
type: string
type: object
md.EggEnergyDetailResp:
properties:
list:
description: 流水数据
items:
additionalProperties:
type: string
type: object
type: array
paginate:
allOf:
- $ref: '#/definitions/applet_app_md.Paginate'
description: 分页信息
person_egg_energy:
description: 个人蛋蛋能量
type: string
team_egg_energy:
description: 团队蛋蛋能量
type: string
total_egg_energy:
description: 总蛋蛋能量
type: string
total_egg_energy_price:
description: 蛋蛋能量总价
type: string
transfer_type_list:
allOf:
- $ref: '#/definitions/md.TransferTypeList'
description: 转账类型列表
type: object
md.EggPointDetailsReq:
properties:
asc:
description: 1.升序 2.倒序
type: string
direction:
description: 类型 1.收入 2.支出 全部则传空
type: string
kind:
description: 类型:1. 个人蛋蛋积分 2.团队蛋蛋积分
type: string
limit:
description: 每页大小
type: integer
page:
description: 页数
type: integer
type:
description: 变动类型 全部则传空
type: string
type: object
md.EggPointDetailsResp:
properties:
list:
description: 流水数据
items:
additionalProperties:
type: string
type: object
type: array
paginate:
allOf:
- $ref: '#/definitions/applet_app_md.Paginate'
description: 分页信息
person_egg_points:
description: 个人蛋蛋积分
type: string
team_egg_points:
description: 团队蛋蛋积分
type: string
total_egg_points:
description: 总蛋蛋积分
type: string
total_egg_points_amount:
description: 蛋蛋积分余额
type: string
transfer_type_list:
allOf:
- $ref: '#/definitions/md.TransferTypeList'
description: 转账类型列表
type: object
md.HomePageResp:
properties:
egg_energy_now_price:
@@ -57,6 +171,24 @@ definitions:
description: 奖励X个活跃积分
type: string
type: object
md.IntegralList:
properties:
expend_list:
description: 支出类型列表
items:
$ref: '#/definitions/md.TransferTypeNode'
type: array
income_list:
description: 收入类型列表
items:
$ref: '#/definitions/md.TransferTypeNode'
type: array
type: object
md.IsCanGetRedPackageResp:
properties:
is_can_get_red_package:
type: boolean
type: object
md.IsCanSignInResp:
properties:
is_can_sign_in:
@@ -82,6 +214,53 @@ definitions:
token:
type: string
type: object
md.MyFansResp:
properties:
now_team_assistance_num:
description: 团队助力人数
type: integer
now_team_assistance_reward:
description: 团队助力收益
type: string
now_team_user:
description: 团队人数
type: integer
type: object
md.MyFansUserListResp:
properties:
list:
items:
$ref: '#/definitions/md.OneLineUserNode'
type: array
type: object
md.NineDimensionalSpaceResp:
properties:
a_lot_of_nums:
description: 全网至多用户数
type: string
space_list:
description: 数据列表
items:
$ref: '#/definitions/md.SpaceListNode'
type: array
space_nums:
description: 空间人数
type: string
space_total_nums:
description: 空间总数
type: string
type: object
md.OneLineUserNode:
properties:
avatar_url:
type: string
invite_time:
type: string
is_online:
type: boolean
nickname:
type: string
type: object
md.RealTimePriceResp:
properties:
is_rises:
@@ -135,6 +314,36 @@ definitions:
example: 具体错误原因
type: string
type: object
md.SpaceListNode:
properties:
max_count:
description: 最大容纳人数
type: string
name:
description: 维度
type: string
now_count:
description: 当前人数
type: string
type: object
md.TransferTypeList:
properties:
available_integral_list:
allOf:
- $ref: '#/definitions/md.IntegralList'
description: 可用积分列表
settlement_integral_list:
allOf:
- $ref: '#/definitions/md.IntegralList'
description: 结算积分列表
type: object
md.TransferTypeNode:
properties:
name:
type: string
value:
type: string
type: object
host: ddxq.izhim.com
info:
contact:
@@ -149,6 +358,143 @@ info:
title: 蛋蛋星球-APP客户端
version: "1.0"
paths:
/api/v1/addFriend/eggEnergyDetails:
post:
consumes:
- application/json
description: 蛋蛋能量明细(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 分页类型必填
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.EggEnergyDetailReq'
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.EggEnergyDetailResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 蛋蛋星球-添加好友-蛋蛋能量明细(获取)
tags:
- 添加好友
/api/v1/addFriend/eggPointDetails:
post:
consumes:
- application/json
description: 蛋蛋积分明细(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 分页类型必填
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.EggPointDetailsReq'
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.EggPointDetailsResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 蛋蛋星球-添加好友-蛋蛋积分明细(获取)
tags:
- 添加好友
/api/v1/addFriend/myFans:
get:
consumes:
- application/json
description: 团队加速速率(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.MyFansResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 蛋蛋星球-添加好友-粉丝团队-我的粉丝-团队加速速率(获取)
tags:
- 添加好友
/api/v1/addFriend/myFansUserList:
get:
consumes:
- application/json
description: 在线好友列表(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.MyFansUserListResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 蛋蛋星球-添加好友-粉丝团队-我的粉丝-在线好友列表(获取)
tags:
- 添加好友
/api/v1/addFriend/nineDimensionalSpace:
get:
consumes:
- application/json
description: 九维空间(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.NineDimensionalSpaceResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 蛋蛋星球-添加好友-粉丝团队-九维空间(获取)
tags:
- 添加好友
/api/v1/comm/getOssUrl:
get:
consumes:
@@ -224,11 +570,36 @@ paths:
summary: 蛋蛋星球-主页-基础信息(获取)
tags:
- 主页
/api/v1/homePage/isCanGetRedPackage:
get:
consumes:
- application/json
description: 是否可以领取红包(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.IsCanGetRedPackageResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 蛋蛋星球-主页-是否领取红包(获取)
tags:
- 主页
/api/v1/homePage/isCanSignIn:
get:
consumes:
- application/json
description: 是否能签到(获取)
description: 是否可以签到(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header


+ 4
- 4
go.mod View File

@@ -2,9 +2,9 @@ module applet

go 1.19

replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models
// replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models
//
replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules
// replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules

require (
github.com/boombuler/barcode v1.0.1
@@ -33,8 +33,8 @@ require (
)

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241119114643-e5842e3aad32
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241119120223-896224742c0d
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241121103041-c8eab82bd33d
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241121102152-7a1c318aed7e
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible


Loading…
Cancel
Save