@@ -7,14 +7,13 @@ import ( | |||
"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" | |||
enum "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | |||
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" | |||
) | |||
@@ -126,51 +125,61 @@ func EggEnergyDetails(c *gin.Context) { | |||
totalEggEnergyPrice := totalEggEnergy * utils.StrToFloat64(coreData.NowPrice) | |||
transferTypeList := md.TransferTypeList{ | |||
AvailableIntegralList: md.IntegralList{ | |||
PersonalTransferTypeList: md.IntegralList{ | |||
IncomeList: []md.TransferTypeNode{ | |||
{ | |||
Value: strconv.Itoa(md3.EggPlantEggEnergySignInSettlementPersonalRewardForUserVirtualCoinFlow), | |||
Name: md3.EggPlantEggEnergySignInSettlementPersonalReward, | |||
// 浏览视频 | |||
Value: utils.AnyToString(enum.EggEnergyWatchAdRewardPersonalActiveCoin), | |||
Name: enum.EggEnergyWatchAdRewardPersonalActiveCoin.String(), | |||
}, | |||
{ | |||
Value: strconv.Itoa(md3.EggPlantBalanceExchangeForEggEnergyForUserVirtualCoinFlow), | |||
Name: md3.EggPlantBalanceExchangeForEggEnergy, | |||
// 圈层奖励 | |||
Value: utils.AnyToString(enum.EggEnergyWatchAdRewardTeamActiveCoin), | |||
Name: enum.EggEnergyWatchAdRewardTeamActiveCoin.String(), | |||
}, | |||
{ | |||
Value: strconv.Itoa(md3.EggPlantPersonalActiveCoinExchangeEggEnergyForUserVirtualCoinFlow), | |||
Name: md3.EggPlantPersonalActiveCoinExchangeEggEnergy, | |||
// 兑换到个人蛋蛋能量 | |||
Value: utils.AnyToString(enum.PersonEggGetByEnergyEggPointCoin), | |||
Name: enum.PersonEggGetByEnergyEggPointCoin.String(), | |||
}, | |||
{ | |||
Value: strconv.Itoa(md3.EggPlantSettlementEggEnergyExchangeEggEnergyForUserVirtualCoinFlow), | |||
Name: md3.EggPlantSettlementEggEnergyExchangeEggEnergy, | |||
// 释放到个人蛋蛋能量 | |||
Value: utils.AnyToString(enum.TeamEggEnergyReleaseToPersonEggEnergy), | |||
Name: enum.TeamEggEnergyReleaseToPersonEggEnergy.String(), | |||
}, | |||
{ | |||
// 蛋蛋能量-社区分红 | |||
Value: utils.AnyToString(enum.EggEnergyCommunityDividends), | |||
Name: enum.EggEnergyCommunityDividends.String(), | |||
}, | |||
{ | |||
// 星级分红 | |||
Value: utils.AnyToString(enum.SettlementStarLevelDividends), | |||
Name: enum.SettlementStarLevelDividends.String(), | |||
}, | |||
}, | |||
ExpendList: []md.TransferTypeNode{ | |||
{ | |||
Value: strconv.Itoa(md3.EggPlantEggEnergyExchangeForBalanceForUserVirtualCoinFlow), | |||
Name: md3.EggPlantEggEnergyExchangeForBalance, | |||
// 个人蛋蛋能量兑换余额 | |||
Value: utils.AnyToString(enum.EggEnergyToExchangeToAmount), | |||
Name: enum.EggEnergyToExchangeToAmount.String(), | |||
}, | |||
}, | |||
}, | |||
SettlementIntegralList: md.IntegralList{ | |||
TeamTransferTypeList: 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, | |||
// 兑换到团队蛋蛋能量 | |||
Value: utils.AnyToString(enum.TeamEggGetByEnergyEggPointCoin), | |||
Name: enum.TeamEggGetByEnergyEggPointCoin.String(), | |||
}, | |||
}, | |||
ExpendList: []md.TransferTypeNode{ | |||
{ | |||
Value: strconv.Itoa(md3.EggPlantSettlementEggEnergyExchangeTobeEggEnergyForUserVirtualCoinFlow), | |||
Name: md3.EggPlantSettlementEggEnergyExchangeEggEnergy, | |||
// 团队蛋蛋能量释放 | |||
Value: utils.AnyToString(enum.TeamEggEnergyReleaseToPersonEggEnergy), | |||
Name: enum.TeamEggEnergyReleaseToPersonEggEnergy.String(), | |||
}, | |||
}, | |||
}, | |||
@@ -303,39 +312,23 @@ func EggPointDetails(c *gin.Context) { | |||
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, | |||
}, | |||
}, | |||
PersonalTransferTypeList: md.IntegralList{ | |||
IncomeList: []md.TransferTypeNode{}, | |||
ExpendList: []md.TransferTypeNode{ | |||
{ | |||
Value: strconv.Itoa(md3.EggPlantPersonalActiveCoinExchangeToBeEggEnergyForUserVirtualCoinFlow), | |||
Name: md3.EggPlantPersonalActiveCoinExchangeToBeEggEnergy, | |||
// 个人蛋蛋积分兑换 | |||
Value: utils.AnyToString(enum.EggPointCoinToExchangeToPersonEggEnergy), | |||
Name: enum.EggPointCoinToExchangeToPersonEggEnergy.String(), | |||
}, | |||
}, | |||
}, | |||
SettlementIntegralList: md.IntegralList{ | |||
IncomeList: []md.TransferTypeNode{ | |||
{ | |||
Value: strconv.Itoa(md3.EggPlantWatchAdRewardTeamActiveCoinForUserVirtualCoinFlow), | |||
Name: md3.EggPlantWatchAdRewardTeamActiveCoin, | |||
}, | |||
{ | |||
Value: strconv.Itoa(md3.EggPlantConsumeOrdersGiveEggEnergyToTeamForUserVirtualCoinFlow), | |||
Name: md3.EggPlantConsumeOrdersGiveEggEnergyForTeam, | |||
}, | |||
}, | |||
TeamTransferTypeList: md.IntegralList{ | |||
IncomeList: []md.TransferTypeNode{}, | |||
ExpendList: []md.TransferTypeNode{ | |||
{ | |||
Value: strconv.Itoa(md3.EggPlantTeamActiveCoinExchangeToBeEggEnergyForUserVirtualCoinFlow), | |||
Name: md3.EggPlantTeamActiveCoinExchangeToBeEggEnergy, | |||
// 团队蛋蛋积分兑换 | |||
Value: utils.AnyToString(enum.EggPointCoinToExchangeToTeamEggEnergy), | |||
Name: enum.EggPointCoinToExchangeToTeamEggEnergy.String(), | |||
}, | |||
}, | |||
}, | |||
@@ -587,12 +580,14 @@ func MyFans(c *gin.Context) { | |||
// @Accept json | |||
// @Produce json | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Param limit query int true "每页大小" | |||
// @Param page query int true "页数" | |||
// @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") | |||
limit := c.DefaultQuery("limit", "20") | |||
now := time.Now() | |||
val, exists := c.Get("user") | |||
@@ -722,6 +717,9 @@ func NineDimensionalSpace(c *gin.Context) { | |||
} | |||
uid := user.Id | |||
row := setting.SeveralRows | |||
times := setting.SeveralTimes | |||
var spaceTotalNums float64 | |||
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) | |||
@@ -736,6 +734,7 @@ func NineDimensionalSpace(c *gin.Context) { | |||
MaxCount: utils.Float64ToStr(maxCount), | |||
NowCount: utils.Int64ToStr(nowUserCount), | |||
}) | |||
spaceTotalNums += maxCount | |||
} | |||
//2、统计当前用户下多少人数 | |||
@@ -744,10 +743,13 @@ func NineDimensionalSpace(c *gin.Context) { | |||
hasUserCount := utils.StrToInt64(nativeString1[0]["total"]) | |||
resp := md.NineDimensionalSpaceResp{ | |||
SpaceTotalNums: "29523", | |||
Rows: utils.IntToStr(row), | |||
Times: utils.IntToStr(times), | |||
SpaceTotalNums: utils.Float64ToStr(spaceTotalNums), | |||
SpaceNums: utils.Int64ToStr(hasUserCount), | |||
SpaceList: list, | |||
ALotOfNums: "29523", | |||
ALotOfNums: utils.Float64ToStr(spaceTotalNums), | |||
DayNum: utils.IntToStr(setting.SystemPunishReplaceValue), | |||
} | |||
e.OutSuc(c, resp, nil) | |||
@@ -0,0 +1,429 @@ | |||
package hdl | |||
import ( | |||
"applet/app/cfg" | |||
"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" | |||
"code.fnuoos.com/EggPlanet/egg_system_rules.git" | |||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | |||
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" | |||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule" | |||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy" | |||
md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" | |||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/svc" | |||
"fmt" | |||
"github.com/gin-gonic/gin" | |||
"github.com/shopspring/decimal" | |||
"time" | |||
) | |||
// PointsCenterGetBasic | |||
// @Summary 蛋蛋星球-积分中心-基础信息(获取) | |||
// @Tags 积分中心 | |||
// @Description 基础信息(获取) | |||
// @Accept json | |||
// @Produce json | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Success 200 {object} md.PointsCenterGetBasicResp "具体数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/v1/pointsCenter/getBasic [GET] | |||
func PointsCenterGetBasic(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. 获取蛋蛋能量货币类型 | |||
settingDb := implement.NewEggEnergyBasicSettingDb(db.Db) | |||
setting, err := settingDb.EggEnergyBasicSettingGetOne() | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
coinID := setting.PersonEggEnergyCoinId | |||
// 2. 获取可兑蛋蛋能量 | |||
virtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) | |||
eggEnergyAmount, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, coinID) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
// 3. 可用现金 | |||
walletDb := implement.NewUserWalletDb(db.Db) | |||
wallet, err := walletDb.GetUserVirtualWallet(user.Id) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
resp := md.PointsCenterGetBasicResp{ | |||
AvailableEnergy: eggEnergyAmount.Amount, | |||
AvailableCash: wallet.Amount, | |||
} | |||
e.OutSuc(c, resp, nil) | |||
} | |||
// GetPriceCurve | |||
// @Summary 蛋蛋星球-积分中心-价格趋势(获取) | |||
// @Tags 积分中心 | |||
// @Description 价格趋势(获取) | |||
// @Accept json | |||
// @Produce json | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Param kind query string false "1:按天 2:按小时 3:按周" | |||
// @Success 200 {object} md.GetPriceCurveResp "具体数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/v1/pointsCenter/priceCurve [GET] | |||
func GetPriceCurve(c *gin.Context) { | |||
kind := c.DefaultQuery("kind", "1") | |||
now := time.Now() | |||
priceDb := implement.NewEggEnergyPriceDb(db.Db) | |||
m, has, err := priceDb.EggEnergyPriceGetLastOne() | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
if has == false { | |||
e.OutErr(c, e.ERR_NO_DATA, "未查询到数据") | |||
return | |||
} | |||
var yData []interface{} | |||
var xData []interface{} | |||
switch kind { | |||
case "1": | |||
var date = now.AddDate(0, 0, -30).Format("2006-01-02") | |||
var sql = fmt.Sprintf("SELECT price,date FROM `egg_energy_price` WHERE HOUR = 23 AND DATE >= \"%s\" AND DATE != \"%s\" ORDER BY DATE ASC ", date, now.Format("2006-01-02")) | |||
results, _ := db.Db.QueryString(sql) | |||
for _, v := range results { | |||
tmpDate := utils.TimeParseStd(v["date"]) | |||
yData = append(yData, v["price"]) | |||
xData = append(xData, tmpDate.Format("01-02")) | |||
} | |||
yData = append(yData, m.Price) | |||
tmpDate := utils.TimeParseStd(m.Date) | |||
xData = append(xData, tmpDate.Format("01-02")) | |||
break | |||
case "2": | |||
for i := 29; i >= 1; i-- { | |||
date := now.Add(-time.Hour * 4 * time.Duration(i)).Format("2006-01-02") | |||
hour := now.Add(-time.Hour * 4 * time.Duration(i)).Hour() | |||
var sql = "SELECT price,date,hour FROM `egg_energy_price` WHERE HOUR = %d AND DATE = \"%s\" " | |||
sql = fmt.Sprintf(sql, hour, date) | |||
results, _ := db.Db.QueryString(sql) | |||
if results != nil { | |||
//if results[0]["date"] != now.Format("2006-01-02") { | |||
// continue | |||
//} | |||
yData = append(yData, results[0]["price"]) | |||
xData = append(xData, results[0]["hour"]+":00") | |||
} | |||
} | |||
yData = append(yData, m.Price) | |||
xData = append(xData, m.Hour+":00") | |||
break | |||
case "3": | |||
var nums = 29 | |||
for i := nums; i >= 1; i-- { | |||
var date = now.AddDate(0, 0, -7*i).Format("2006-01-02") | |||
var sql = "SELECT price, date FROM `egg_energy_price` WHERE HOUR = 23 AND DATE = \"%s\" " | |||
sql = fmt.Sprintf(sql, date) | |||
results, _ := db.Db.QueryString(sql) | |||
if results != nil { | |||
tmpDate := utils.TimeParseStd(results[0]["date"]) | |||
yData = append(yData, results[0]["price"]) | |||
xData = append(xData, tmpDate.Format("01-02")) | |||
} | |||
} | |||
yData = append(yData, m.Price) | |||
tmpDate := utils.TimeParseStd(m.Date) | |||
xData = append(xData, tmpDate.Format("01-02")) | |||
break | |||
} | |||
e.OutSuc(c, md.GetPriceCurveResp{ | |||
YData: yData, | |||
XData: xData, | |||
}, nil) | |||
return | |||
} | |||
// ExchangeEnergy | |||
// @Summary 蛋蛋星球-积分中心-能量兑换 | |||
// @Tags 积分中心 | |||
// @Description 能量兑换 | |||
// @Accept json | |||
// @Produce json | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Param req body md.ExchangeEnergyReq true "需要兑换的能量值" | |||
// @Success 200 {string} "success" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/v1/pointsCenter/exchangeEnergy [POST] | |||
func ExchangeEnergy(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.ExchangeEnergyReq | |||
if err1 := c.ShouldBindJSON(&req); err1 != nil { | |||
e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error()) | |||
return | |||
} | |||
// 1. 获取蛋蛋能量货币类型 | |||
settingDb := implement.NewEggEnergyBasicSettingDb(db.Db) | |||
setting, err := settingDb.EggEnergyBasicSettingGetOne() | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
coinID := setting.PersonEggEnergyCoinId | |||
session := db.Db.NewSession() | |||
defer session.Close() | |||
// 2. 计算蛋蛋能量兑换的金额 | |||
egg_system_rules.Init(cfg.RedisAddr) | |||
eggEnergyCoreData, cb, err1 := svc.GetEggEnergyCoreData(db.Db) | |||
if err1 != nil { | |||
fmt.Println("EggEnergyAutoRecordPrices_ERR:::::", err1.Error()) | |||
return | |||
} | |||
if cb != nil { | |||
defer cb() // 释放锁 | |||
} | |||
energyAmount, err := decimal.NewFromString(req.EnergyAmount) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) | |||
return | |||
} | |||
nowPrice, err := decimal.NewFromString(eggEnergyCoreData.NowPrice) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) | |||
return | |||
} | |||
amount, ok := energyAmount.Div(nowPrice).Float64() | |||
if !ok { | |||
e.OutErr(c, e.ERR_UNMARSHAL, nil) | |||
return | |||
} | |||
// 3. 获取用户蛋蛋能量余额 | |||
eggEnergyAmount, err := rule.GetUserCoinAmount(session, coinID, user.Id) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
// 4. 判断蛋蛋能量是否足够兑换 | |||
if utils.StrToFloat64(eggEnergyAmount) < utils.StrToFloat64(req.EnergyAmount) { | |||
e.OutErr(c, e.ERR_BALANCE_NOT_ENOUGH, nil) | |||
} | |||
// 5. 调用降价公式 | |||
err, calcPriceReductionFormula := egg_energy.CalcPriceReductionFormula(req.EnergyAmount, eggEnergyCoreData) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
// 6. 更改动态数据 | |||
err = egg_energy.DealAvailableEggEnergyCoin(session, int(enum.EggEnergyExchangeAccountBalance), eggEnergyCoreData, md3.DealAvailableEggEnergyCoinReq{ | |||
Amount: calcPriceReductionFormula.GetEggEnergyAmount, | |||
AmountFee: "", | |||
BeforePrice: calcPriceReductionFormula.BeforePrice, | |||
AfterPrice: calcPriceReductionFormula.AfterPrice, | |||
BeforePlanetTotalValue: calcPriceReductionFormula.BeforePlanetTotalValue, | |||
AfterPlanetTotalValue: calcPriceReductionFormula.AfterPlanetTotalValue, | |||
BeforeEnergyTotalNums: calcPriceReductionFormula.BeforeEnergyTotalNums, | |||
AfterEnergyTotalNums: calcPriceReductionFormula.AfterEnergyTotalNums, | |||
}) | |||
if err != nil { | |||
fmt.Println("ActivityCoinAutoExchangeEggPersonEnergy:::::err111:::", err) | |||
_ = session.Rollback() | |||
return | |||
} | |||
// 7. 扣除蛋蛋能量 | |||
dealUserVirtualCoinReq := md2.DealUserVirtualCoinReq{ | |||
Kind: "sub", | |||
Title: enum.EggEnergyToExchangeToAmount.String(), | |||
TransferType: int(enum.EggEnergyToExchangeToAmount), | |||
CoinId: coinID, | |||
Uid: user.Id, | |||
Amount: utils.StrToFloat64(req.EnergyAmount), | |||
} | |||
err = rule.DealUserVirtualCoin(session, dealUserVirtualCoinReq) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
session.Rollback() | |||
return | |||
} | |||
// 8. 增加账户余额 | |||
dealUserWalletReq := md2.DealUserWalletReq{ | |||
Direction: "add", | |||
Kind: int(enum.EggEnergyExchangeAccountBalance), | |||
Title: enum.EggEnergyExchangeAccountBalance.String(), | |||
Uid: user.Id, | |||
Amount: amount, | |||
} | |||
err = rule.DealUserWallet(session, dealUserWalletReq) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
session.Rollback() | |||
return | |||
} | |||
err = session.Commit() | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
e.OutSuc(c, "success", nil) | |||
} | |||
// GetContributionValue | |||
// @Summary 蛋蛋星球-积分中心-贡献值(获取) | |||
// @Tags 积分中心 | |||
// @Description 贡献值(获取) | |||
// @Accept json | |||
// @Produce json | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Success 200 {object} md.GetContributionValueResp "具体数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/v1/pointsCenter/contributionValue [GET] | |||
func GetContributionValue(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 | |||
} | |||
settingDb := implement.NewEggEnergyBasicSettingDb(db.Db) | |||
setting, err := settingDb.EggEnergyBasicSettingGetOne() | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
coinID := setting.ContributionCoinId | |||
virtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) | |||
virtualAmount, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, coinID) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
var contributionValue string | |||
if virtualAmount != nil { | |||
contributionValue = virtualAmount.Amount | |||
} | |||
coinDb := implement.NewVirtualCoinDb(db.Db) | |||
coin, err := coinDb.VirtualCoinGetOneByParams(map[string]interface{}{ | |||
"key": "id", | |||
"value": coinID, | |||
}) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
var ratio string | |||
if coin != nil { | |||
ratio = coin.ExchangeRatio | |||
} | |||
resp := md.GetContributionValueResp{ | |||
ContributionValue: contributionValue, | |||
Ratio: ratio, | |||
} | |||
e.OutSuc(c, resp, nil) | |||
} | |||
// GetContributionValueFlow | |||
// @Summary 蛋蛋星球-积分中心-贡献值明细(获取) | |||
// @Tags 积分中心 | |||
// @Description 贡献值明细(获取) | |||
// @Accept json | |||
// @Produce json | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Param limit query int true "每页大小" | |||
// @Param page query int true "页数" | |||
// @Success 200 {object} md.GetContributionValueFlowResp "具体数据" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/v1/pointsCenter/contributionValueFlow [GET] | |||
func GetContributionValueFlow(c *gin.Context) { | |||
page := c.DefaultQuery("page", "1") | |||
limit := c.DefaultQuery("limit", "10") | |||
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 | |||
} | |||
settingDb := implement.NewEggEnergyBasicSettingDb(db.Db) | |||
setting, err := settingDb.EggEnergyBasicSettingGetOne() | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
coinID := setting.ContributionCoinId | |||
flowDb := implement.NewUserVirtualCoinFlowDb(db.Db) | |||
flows, total, err := flowDb.UserVirtualCoinFlowFindByCoinAndUser(utils.StrToInt(page), utils.StrToInt(limit), coinID, user.Id, "", "", 0, false, 0) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
list := make([]md.ContributionValueFlowNode, len(flows)) | |||
for i, flow := range flows { | |||
list[i].Title = flow.Title | |||
list[i].Amount = flow.Amount | |||
list[i].Direction = utils.IntToStr(flow.Direction) | |||
list[i].CreateAt = flow.CreateAt | |||
} | |||
resp := md.GetContributionValueFlowResp{ | |||
List: list, | |||
Paginate: md.Paginate{ | |||
Limit: utils.StrToInt(limit), | |||
Page: utils.StrToInt(page), | |||
Total: total, | |||
}, | |||
} | |||
e.OutSuc(c, resp, nil) | |||
} |
@@ -76,11 +76,6 @@ type GetEggCoreDataListResp struct { | |||
UserHoldTotalNums map[string]string `json:"user_hold_total_nums"` // 用户持有总量 | |||
} | |||
type GetPriceCurveResp struct { | |||
XData []interface{} `json:"x_data"` | |||
YData []interface{} `json:"y_data"` | |||
} | |||
type GetFundDataListReq struct { | |||
Kind int `json:"kind"` // 数据类型 | |||
StartAt string `json:"start_at" example:"开始时间"` | |||
@@ -20,8 +20,8 @@ type IntegralList struct { | |||
} | |||
type TransferTypeList struct { | |||
AvailableIntegralList IntegralList `json:"available_integral_list"` // 可用积分列表 | |||
SettlementIntegralList IntegralList `json:"settlement_integral_list"` // 结算积分列表 | |||
PersonalTransferTypeList IntegralList `json:"personal_transfer_type_list"` // 个人积分变动列表 | |||
TeamTransferTypeList IntegralList `json:"TeamTransferTypeList"` // 团队积分变动列表 | |||
} | |||
type EggEnergyDetailResp struct { | |||
@@ -77,10 +77,13 @@ type SpaceListNode struct { | |||
} | |||
type NineDimensionalSpaceResp struct { | |||
SpaceTotalNums string `json:"space_total_nums"` //空间总数 | |||
Rows string `json:"rows"` // 行数 | |||
Times string `json:"times"` // 排数 | |||
SpaceTotalNums string `json:"space_total_nums"` // 空间总数 | |||
SpaceNums string `json:"space_nums"` // 空间人数 | |||
SpaceList []SpaceListNode `json:"space_list"` // 数据列表 | |||
ALotOfNums string `json:"a_lot_of_nums"` // 全网至多用户数 | |||
DayNum string `json:"day_num"` // 连续x天不活跃 | |||
} | |||
type BasalRateResp struct { | |||
@@ -0,0 +1,32 @@ | |||
package md | |||
type GetPriceCurveResp struct { | |||
XData []interface{} `json:"x_data"` | |||
YData []interface{} `json:"y_data"` | |||
} | |||
type PointsCenterGetBasicResp struct { | |||
AvailableEnergy string `json:"available_energy"` // 可用能量 | |||
AvailableCash string `json:"available_cash"` // 可用现金 | |||
} | |||
type ExchangeEnergyReq struct { | |||
EnergyAmount string `json:"energy_amount,required"` // 兑换能量数值 | |||
} | |||
type GetContributionValueResp struct { | |||
ContributionValue string `json:"contribution_value"` // 贡献值 | |||
Ratio string `json:"ratio"` // 兑换比率(x 分兑换 1 人民币) | |||
} | |||
type ContributionValueFlowNode struct { | |||
Title string `json:"title"` // 标题 | |||
CreateAt string `json:"create_at"` // 完成时间 | |||
Direction string `json:"direction"` // 方向: 1.收入 2.支出 | |||
Amount string `json:"amount"` // 变更数量 | |||
} | |||
type GetContributionValueFlowResp struct { | |||
List []ContributionValueFlowNode `json:"list"` | |||
Paginate Paginate `json:"paginate"` | |||
} |
@@ -64,7 +64,7 @@ func route(r *gin.RouterGroup) { | |||
rHomePage := r.Group("/homePage") | |||
{ | |||
rHomePage.GET("/index", hdl.HomePage) // 主页 | |||
rHomePage.GET("/adRule", hdl.HomePageWatchAdRule) // 主页-可以观看广告列表 | |||
rHomePage.GET("/adRule", hdl.HomePageWatchAdRule) // 主页-可以观看广告规则 | |||
rHomePage.GET("/realTimePrice", hdl.RealTimePrice) // 主页-实时数据 | |||
rHomePage.GET("/isCanSignIn", hdl.IsCanSignIn) // 主页-是否可以观看广告 | |||
rHomePage.GET("/isCanGetRedPackage", hdl.IsCanGetRedPackage) // 主页-是否可以获得红包 | |||
@@ -83,6 +83,14 @@ func route(r *gin.RouterGroup) { | |||
{ | |||
rMemberCenter.GET("/getBasic", hdl.MemberCenterGetBasic) // 会员中心-基础数据 | |||
} | |||
rPointsCenter := r.Group("/pointsCenter") // 积分中心 | |||
{ | |||
rPointsCenter.GET("/getBasic", hdl.PointsCenterGetBasic) // 积分中-基础数据 | |||
rPointsCenter.GET("/priceCurve", hdl.GetPriceCurve) // 积分中心-获取价格曲线 | |||
rPointsCenter.POST("/exchangeEnergy", hdl.ExchangeEnergy) // 积分中心-能量兑换 | |||
rPointsCenter.GET("/contributionValue", hdl.GetContributionValue) // 积分中心-贡献值 | |||
rPointsCenter.GET("/contributionValueFlow", hdl.GetContributionValueFlow) // 积分中心-贡献值明细 | |||
} | |||
} | |||
@@ -1,5 +1,4 @@ | |||
// Code generated by swaggo/swag. DO NOT EDIT. | |||
// Package docs Code generated by swaggo/swag. DO NOT EDIT | |||
package docs | |||
import "github.com/swaggo/swag" | |||
@@ -215,6 +214,20 @@ const docTemplate = `{ | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
}, | |||
{ | |||
"type": "integer", | |||
"description": "每页大小", | |||
"name": "limit", | |||
"in": "query", | |||
"required": true | |||
}, | |||
{ | |||
"type": "integer", | |||
"description": "页数", | |||
"name": "page", | |||
"in": "query", | |||
"required": true | |||
} | |||
], | |||
"responses": { | |||
@@ -695,6 +708,225 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"/api/v1/pointsCenter/contributionValue": { | |||
"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.GetContributionValueResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/v1/pointsCenter/contributionValueFlow": { | |||
"get": { | |||
"description": "贡献值明细(获取)", | |||
"consumes": [ | |||
"application/json" | |||
], | |||
"produces": [ | |||
"application/json" | |||
], | |||
"tags": [ | |||
"积分中心" | |||
], | |||
"summary": "蛋蛋星球-积分中心-贡献值明细(获取)", | |||
"parameters": [ | |||
{ | |||
"type": "string", | |||
"description": "验证参数Bearer和token空格拼接", | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
}, | |||
{ | |||
"type": "integer", | |||
"description": "每页大小", | |||
"name": "limit", | |||
"in": "query", | |||
"required": true | |||
}, | |||
{ | |||
"type": "integer", | |||
"description": "页数", | |||
"name": "page", | |||
"in": "query", | |||
"required": true | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "具体数据", | |||
"schema": { | |||
"$ref": "#/definitions/md.GetContributionValueFlowResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/v1/pointsCenter/exchangeEnergy": { | |||
"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.ExchangeEnergyReq" | |||
} | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "success", | |||
"schema": { | |||
"type": "string" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/v1/pointsCenter/getBasic": { | |||
"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.PointsCenterGetBasicResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/v1/pointsCenter/priceCurve": { | |||
"get": { | |||
"description": "价格趋势(获取)", | |||
"consumes": [ | |||
"application/json" | |||
], | |||
"produces": [ | |||
"application/json" | |||
], | |||
"tags": [ | |||
"积分中心" | |||
], | |||
"summary": "蛋蛋星球-积分中心-价格趋势(获取)", | |||
"parameters": [ | |||
{ | |||
"type": "string", | |||
"description": "验证参数Bearer和token空格拼接", | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
}, | |||
{ | |||
"type": "string", | |||
"description": "1:按天 2:按小时 3:按周", | |||
"name": "kind", | |||
"in": "query" | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "具体数据", | |||
"schema": { | |||
"$ref": "#/definitions/md.GetPriceCurveResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/v1/register": { | |||
"post": { | |||
"description": "注册", | |||
@@ -794,9 +1026,7 @@ const docTemplate = `{ | |||
"name": "req", | |||
"in": "body", | |||
"required": true, | |||
"schema": { | |||
"type": "object" | |||
} | |||
"schema": {} | |||
} | |||
], | |||
"responses": { | |||
@@ -950,6 +1180,27 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"md.ContributionValueFlowNode": { | |||
"type": "object", | |||
"properties": { | |||
"amount": { | |||
"description": "变更数量", | |||
"type": "string" | |||
}, | |||
"create_at": { | |||
"description": "完成时间", | |||
"type": "string" | |||
}, | |||
"direction": { | |||
"description": "方向: 1.收入 2.支出", | |||
"type": "string" | |||
}, | |||
"title": { | |||
"description": "标题", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"md.EggEnergyDetailReq": { | |||
"type": "object", | |||
"properties": { | |||
@@ -1102,6 +1353,15 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"md.ExchangeEnergyReq": { | |||
"type": "object", | |||
"properties": { | |||
"energy_amount": { | |||
"description": "兑换能量数值", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"md.FastLoginReq": { | |||
"type": "object", | |||
"properties": { | |||
@@ -1134,6 +1394,46 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"md.GetContributionValueFlowResp": { | |||
"type": "object", | |||
"properties": { | |||
"list": { | |||
"type": "array", | |||
"items": { | |||
"$ref": "#/definitions/md.ContributionValueFlowNode" | |||
} | |||
}, | |||
"paginate": { | |||
"$ref": "#/definitions/applet_app_md.Paginate" | |||
} | |||
} | |||
}, | |||
"md.GetContributionValueResp": { | |||
"type": "object", | |||
"properties": { | |||
"contribution_value": { | |||
"description": "贡献值", | |||
"type": "string" | |||
}, | |||
"ratio": { | |||
"description": "兑换比率(x 分兑换 1 人民币)", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"md.GetPriceCurveResp": { | |||
"type": "object", | |||
"properties": { | |||
"x_data": { | |||
"type": "array", | |||
"items": {} | |||
}, | |||
"y_data": { | |||
"type": "array", | |||
"items": {} | |||
} | |||
} | |||
}, | |||
"md.HomePageResp": { | |||
"type": "object", | |||
"properties": { | |||
@@ -1352,6 +1652,14 @@ const docTemplate = `{ | |||
"description": "全网至多用户数", | |||
"type": "string" | |||
}, | |||
"day_num": { | |||
"description": "连续x天不活跃", | |||
"type": "string" | |||
}, | |||
"rows": { | |||
"description": "行数", | |||
"type": "string" | |||
}, | |||
"space_list": { | |||
"description": "数据列表", | |||
"type": "array", | |||
@@ -1366,6 +1674,10 @@ const docTemplate = `{ | |||
"space_total_nums": { | |||
"description": "空间总数", | |||
"type": "string" | |||
}, | |||
"times": { | |||
"description": "排数", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
@@ -1386,6 +1698,19 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"md.PointsCenterGetBasicResp": { | |||
"type": "object", | |||
"properties": { | |||
"available_cash": { | |||
"description": "可用现金", | |||
"type": "string" | |||
}, | |||
"available_energy": { | |||
"description": "可用能量", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"md.RealTimePriceResp": { | |||
"type": "object", | |||
"properties": { | |||
@@ -1542,16 +1867,16 @@ const docTemplate = `{ | |||
"md.TransferTypeList": { | |||
"type": "object", | |||
"properties": { | |||
"available_integral_list": { | |||
"description": "可用积分列表", | |||
"TeamTransferTypeList": { | |||
"description": "团队积分变动列表", | |||
"allOf": [ | |||
{ | |||
"$ref": "#/definitions/md.IntegralList" | |||
} | |||
] | |||
}, | |||
"settlement_integral_list": { | |||
"description": "结算积分列表", | |||
"personal_transfer_type_list": { | |||
"description": "个人积分变动列表", | |||
"allOf": [ | |||
{ | |||
"$ref": "#/definitions/md.IntegralList" | |||
@@ -1626,6 +1951,8 @@ var SwaggerInfo = &swag.Spec{ | |||
Description: "APP客户端-Api接口", | |||
InfoInstanceName: "swagger", | |||
SwaggerTemplate: docTemplate, | |||
LeftDelim: "{{", | |||
RightDelim: "}}", | |||
} | |||
func init() { | |||
@@ -208,6 +208,20 @@ | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
}, | |||
{ | |||
"type": "integer", | |||
"description": "每页大小", | |||
"name": "limit", | |||
"in": "query", | |||
"required": true | |||
}, | |||
{ | |||
"type": "integer", | |||
"description": "页数", | |||
"name": "page", | |||
"in": "query", | |||
"required": true | |||
} | |||
], | |||
"responses": { | |||
@@ -688,6 +702,225 @@ | |||
} | |||
} | |||
}, | |||
"/api/v1/pointsCenter/contributionValue": { | |||
"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.GetContributionValueResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/v1/pointsCenter/contributionValueFlow": { | |||
"get": { | |||
"description": "贡献值明细(获取)", | |||
"consumes": [ | |||
"application/json" | |||
], | |||
"produces": [ | |||
"application/json" | |||
], | |||
"tags": [ | |||
"积分中心" | |||
], | |||
"summary": "蛋蛋星球-积分中心-贡献值明细(获取)", | |||
"parameters": [ | |||
{ | |||
"type": "string", | |||
"description": "验证参数Bearer和token空格拼接", | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
}, | |||
{ | |||
"type": "integer", | |||
"description": "每页大小", | |||
"name": "limit", | |||
"in": "query", | |||
"required": true | |||
}, | |||
{ | |||
"type": "integer", | |||
"description": "页数", | |||
"name": "page", | |||
"in": "query", | |||
"required": true | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "具体数据", | |||
"schema": { | |||
"$ref": "#/definitions/md.GetContributionValueFlowResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/v1/pointsCenter/exchangeEnergy": { | |||
"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.ExchangeEnergyReq" | |||
} | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "success", | |||
"schema": { | |||
"type": "string" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/v1/pointsCenter/getBasic": { | |||
"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.PointsCenterGetBasicResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/v1/pointsCenter/priceCurve": { | |||
"get": { | |||
"description": "价格趋势(获取)", | |||
"consumes": [ | |||
"application/json" | |||
], | |||
"produces": [ | |||
"application/json" | |||
], | |||
"tags": [ | |||
"积分中心" | |||
], | |||
"summary": "蛋蛋星球-积分中心-价格趋势(获取)", | |||
"parameters": [ | |||
{ | |||
"type": "string", | |||
"description": "验证参数Bearer和token空格拼接", | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
}, | |||
{ | |||
"type": "string", | |||
"description": "1:按天 2:按小时 3:按周", | |||
"name": "kind", | |||
"in": "query" | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "具体数据", | |||
"schema": { | |||
"$ref": "#/definitions/md.GetPriceCurveResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/v1/register": { | |||
"post": { | |||
"description": "注册", | |||
@@ -787,9 +1020,7 @@ | |||
"name": "req", | |||
"in": "body", | |||
"required": true, | |||
"schema": { | |||
"type": "object" | |||
} | |||
"schema": {} | |||
} | |||
], | |||
"responses": { | |||
@@ -943,6 +1174,27 @@ | |||
} | |||
} | |||
}, | |||
"md.ContributionValueFlowNode": { | |||
"type": "object", | |||
"properties": { | |||
"amount": { | |||
"description": "变更数量", | |||
"type": "string" | |||
}, | |||
"create_at": { | |||
"description": "完成时间", | |||
"type": "string" | |||
}, | |||
"direction": { | |||
"description": "方向: 1.收入 2.支出", | |||
"type": "string" | |||
}, | |||
"title": { | |||
"description": "标题", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"md.EggEnergyDetailReq": { | |||
"type": "object", | |||
"properties": { | |||
@@ -1095,6 +1347,15 @@ | |||
} | |||
} | |||
}, | |||
"md.ExchangeEnergyReq": { | |||
"type": "object", | |||
"properties": { | |||
"energy_amount": { | |||
"description": "兑换能量数值", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"md.FastLoginReq": { | |||
"type": "object", | |||
"properties": { | |||
@@ -1127,6 +1388,46 @@ | |||
} | |||
} | |||
}, | |||
"md.GetContributionValueFlowResp": { | |||
"type": "object", | |||
"properties": { | |||
"list": { | |||
"type": "array", | |||
"items": { | |||
"$ref": "#/definitions/md.ContributionValueFlowNode" | |||
} | |||
}, | |||
"paginate": { | |||
"$ref": "#/definitions/applet_app_md.Paginate" | |||
} | |||
} | |||
}, | |||
"md.GetContributionValueResp": { | |||
"type": "object", | |||
"properties": { | |||
"contribution_value": { | |||
"description": "贡献值", | |||
"type": "string" | |||
}, | |||
"ratio": { | |||
"description": "兑换比率(x 分兑换 1 人民币)", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"md.GetPriceCurveResp": { | |||
"type": "object", | |||
"properties": { | |||
"x_data": { | |||
"type": "array", | |||
"items": {} | |||
}, | |||
"y_data": { | |||
"type": "array", | |||
"items": {} | |||
} | |||
} | |||
}, | |||
"md.HomePageResp": { | |||
"type": "object", | |||
"properties": { | |||
@@ -1345,6 +1646,14 @@ | |||
"description": "全网至多用户数", | |||
"type": "string" | |||
}, | |||
"day_num": { | |||
"description": "连续x天不活跃", | |||
"type": "string" | |||
}, | |||
"rows": { | |||
"description": "行数", | |||
"type": "string" | |||
}, | |||
"space_list": { | |||
"description": "数据列表", | |||
"type": "array", | |||
@@ -1359,6 +1668,10 @@ | |||
"space_total_nums": { | |||
"description": "空间总数", | |||
"type": "string" | |||
}, | |||
"times": { | |||
"description": "排数", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
@@ -1379,6 +1692,19 @@ | |||
} | |||
} | |||
}, | |||
"md.PointsCenterGetBasicResp": { | |||
"type": "object", | |||
"properties": { | |||
"available_cash": { | |||
"description": "可用现金", | |||
"type": "string" | |||
}, | |||
"available_energy": { | |||
"description": "可用能量", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"md.RealTimePriceResp": { | |||
"type": "object", | |||
"properties": { | |||
@@ -1535,16 +1861,16 @@ | |||
"md.TransferTypeList": { | |||
"type": "object", | |||
"properties": { | |||
"available_integral_list": { | |||
"description": "可用积分列表", | |||
"TeamTransferTypeList": { | |||
"description": "团队积分变动列表", | |||
"allOf": [ | |||
{ | |||
"$ref": "#/definitions/md.IntegralList" | |||
} | |||
] | |||
}, | |||
"settlement_integral_list": { | |||
"description": "结算积分列表", | |||
"personal_transfer_type_list": { | |||
"description": "个人积分变动列表", | |||
"allOf": [ | |||
{ | |||
"$ref": "#/definitions/md.IntegralList" | |||
@@ -39,6 +39,21 @@ definitions: | |||
description: 收益倒计时 | |||
type: string | |||
type: object | |||
md.ContributionValueFlowNode: | |||
properties: | |||
amount: | |||
description: 变更数量 | |||
type: string | |||
create_at: | |||
description: 完成时间 | |||
type: string | |||
direction: | |||
description: 方向: 1.收入 2.支出 | |||
type: string | |||
title: | |||
description: 标题 | |||
type: string | |||
type: object | |||
md.EggEnergyDetailReq: | |||
properties: | |||
asc: | |||
@@ -141,6 +156,12 @@ definitions: | |||
- $ref: '#/definitions/md.TransferTypeList' | |||
description: 转账类型列表 | |||
type: object | |||
md.ExchangeEnergyReq: | |||
properties: | |||
energy_amount: | |||
description: 兑换能量数值 | |||
type: string | |||
type: object | |||
md.FastLoginReq: | |||
properties: | |||
invite_code: | |||
@@ -163,6 +184,33 @@ definitions: | |||
required: | |||
- mobile | |||
type: object | |||
md.GetContributionValueFlowResp: | |||
properties: | |||
list: | |||
items: | |||
$ref: '#/definitions/md.ContributionValueFlowNode' | |||
type: array | |||
paginate: | |||
$ref: '#/definitions/applet_app_md.Paginate' | |||
type: object | |||
md.GetContributionValueResp: | |||
properties: | |||
contribution_value: | |||
description: 贡献值 | |||
type: string | |||
ratio: | |||
description: 兑换比率(x 分兑换 1 人民币) | |||
type: string | |||
type: object | |||
md.GetPriceCurveResp: | |||
properties: | |||
x_data: | |||
items: {} | |||
type: array | |||
y_data: | |||
items: {} | |||
type: array | |||
type: object | |||
md.HomePageResp: | |||
properties: | |||
egg_energy_now_price: | |||
@@ -317,6 +365,12 @@ definitions: | |||
a_lot_of_nums: | |||
description: 全网至多用户数 | |||
type: string | |||
day_num: | |||
description: 连续x天不活跃 | |||
type: string | |||
rows: | |||
description: 行数 | |||
type: string | |||
space_list: | |||
description: 数据列表 | |||
items: | |||
@@ -328,6 +382,9 @@ definitions: | |||
space_total_nums: | |||
description: 空间总数 | |||
type: string | |||
times: | |||
description: 排数 | |||
type: string | |||
type: object | |||
md.OneLineUserNode: | |||
properties: | |||
@@ -340,6 +397,15 @@ definitions: | |||
nickname: | |||
type: string | |||
type: object | |||
md.PointsCenterGetBasicResp: | |||
properties: | |||
available_cash: | |||
description: 可用现金 | |||
type: string | |||
available_energy: | |||
description: 可用能量 | |||
type: string | |||
type: object | |||
md.RealTimePriceResp: | |||
properties: | |||
is_rises: | |||
@@ -450,14 +516,14 @@ definitions: | |||
type: object | |||
md.TransferTypeList: | |||
properties: | |||
available_integral_list: | |||
TeamTransferTypeList: | |||
allOf: | |||
- $ref: '#/definitions/md.IntegralList' | |||
description: 可用积分列表 | |||
settlement_integral_list: | |||
description: 团队积分变动列表 | |||
personal_transfer_type_list: | |||
allOf: | |||
- $ref: '#/definitions/md.IntegralList' | |||
description: 结算积分列表 | |||
description: 个人积分变动列表 | |||
type: object | |||
md.TransferTypeNode: | |||
properties: | |||
@@ -632,6 +698,16 @@ paths: | |||
name: Authorization | |||
required: true | |||
type: string | |||
- description: 每页大小 | |||
in: query | |||
name: limit | |||
required: true | |||
type: integer | |||
- description: 页数 | |||
in: query | |||
name: page | |||
required: true | |||
type: integer | |||
produces: | |||
- application/json | |||
responses: | |||
@@ -949,6 +1025,151 @@ paths: | |||
summary: 蛋蛋星球-会员中心-基础数据(获取) | |||
tags: | |||
- 会员中心 | |||
/api/v1/pointsCenter/contributionValue: | |||
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.GetContributionValueResp' | |||
"400": | |||
description: 具体错误 | |||
schema: | |||
$ref: '#/definitions/md.Response' | |||
summary: 蛋蛋星球-积分中心-贡献值(获取) | |||
tags: | |||
- 积分中心 | |||
/api/v1/pointsCenter/contributionValueFlow: | |||
get: | |||
consumes: | |||
- application/json | |||
description: 贡献值明细(获取) | |||
parameters: | |||
- description: 验证参数Bearer和token空格拼接 | |||
in: header | |||
name: Authorization | |||
required: true | |||
type: string | |||
- description: 每页大小 | |||
in: query | |||
name: limit | |||
required: true | |||
type: integer | |||
- description: 页数 | |||
in: query | |||
name: page | |||
required: true | |||
type: integer | |||
produces: | |||
- application/json | |||
responses: | |||
"200": | |||
description: 具体数据 | |||
schema: | |||
$ref: '#/definitions/md.GetContributionValueFlowResp' | |||
"400": | |||
description: 具体错误 | |||
schema: | |||
$ref: '#/definitions/md.Response' | |||
summary: 蛋蛋星球-积分中心-贡献值明细(获取) | |||
tags: | |||
- 积分中心 | |||
/api/v1/pointsCenter/exchangeEnergy: | |||
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.ExchangeEnergyReq' | |||
produces: | |||
- application/json | |||
responses: | |||
"200": | |||
description: success | |||
schema: | |||
type: string | |||
"400": | |||
description: 具体错误 | |||
schema: | |||
$ref: '#/definitions/md.Response' | |||
summary: 蛋蛋星球-积分中心-能量兑换 | |||
tags: | |||
- 积分中心 | |||
/api/v1/pointsCenter/getBasic: | |||
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.PointsCenterGetBasicResp' | |||
"400": | |||
description: 具体错误 | |||
schema: | |||
$ref: '#/definitions/md.Response' | |||
summary: 蛋蛋星球-积分中心-基础信息(获取) | |||
tags: | |||
- 积分中心 | |||
/api/v1/pointsCenter/priceCurve: | |||
get: | |||
consumes: | |||
- application/json | |||
description: 价格趋势(获取) | |||
parameters: | |||
- description: 验证参数Bearer和token空格拼接 | |||
in: header | |||
name: Authorization | |||
required: true | |||
type: string | |||
- description: 1:按天 2:按小时 3:按周 | |||
in: query | |||
name: kind | |||
type: string | |||
produces: | |||
- application/json | |||
responses: | |||
"200": | |||
description: 具体数据 | |||
schema: | |||
$ref: '#/definitions/md.GetPriceCurveResp' | |||
"400": | |||
description: 具体错误 | |||
schema: | |||
$ref: '#/definitions/md.Response' | |||
summary: 蛋蛋星球-积分中心-价格趋势(获取) | |||
tags: | |||
- 积分中心 | |||
/api/v1/register: | |||
post: | |||
consumes: | |||
@@ -1011,8 +1232,7 @@ paths: | |||
in: body | |||
name: req | |||
required: true | |||
schema: | |||
type: object | |||
schema: {} | |||
produces: | |||
- application/json | |||
responses: | |||
@@ -4,7 +4,7 @@ go 1.19 | |||
// 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 | |||