소스 검색

update

master
shenjiachi 1 주 전
부모
커밋
b72d761595
8개의 변경된 파일603개의 추가작업 그리고 8개의 파일을 삭제
  1. +12
    -3
      app/hdl/hdl_add_friend.go
  2. +124
    -0
      app/hdl/hdl_points_center.go
  3. +4
    -1
      app/md/md_add_friend.go
  4. +17
    -0
      app/md/md_points_center.go
  5. +6
    -4
      app/router/router.go
  6. +164
    -0
      docs/docs.go
  7. +164
    -0
      docs/swagger.json
  8. +112
    -0
      docs/swagger.yaml

+ 12
- 3
app/hdl/hdl_add_friend.go 파일 보기

@@ -580,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")
@@ -715,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)
@@ -729,6 +734,7 @@ func NineDimensionalSpace(c *gin.Context) {
MaxCount: utils.Float64ToStr(maxCount),
NowCount: utils.Int64ToStr(nowUserCount),
})
spaceTotalNums += maxCount
}

//2、统计当前用户下多少人数
@@ -737,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)


+ 124
- 0
app/hdl/hdl_points_center.go 파일 보기

@@ -303,3 +303,127 @@ func ExchangeEnergy(c *gin.Context) {
}
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)
}

+ 4
- 1
app/md/md_add_friend.go 파일 보기

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


+ 17
- 0
app/md/md_points_center.go 파일 보기

@@ -13,3 +13,20 @@ type PointsCenterGetBasicResp struct {
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"`
}

+ 6
- 4
app/router/router.go 파일 보기

@@ -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) // 主页-是否可以获得红包
@@ -85,9 +85,11 @@ func route(r *gin.RouterGroup) {
}
rPointsCenter := r.Group("/pointsCenter") // 积分中心
{
rPointsCenter.GET("/getBasic", hdl.PointsCenterGetBasic) // 积分中-基础数据
rPointsCenter.GET("/priceCurve", hdl.GetPriceCurve) // 积分中心-获取价格曲线
rPointsCenter.POST("/exchangeEnergy", hdl.ExchangeEnergy) // 积分中心-能量兑换
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) // 积分中心-贡献值明细
}

}


+ 164
- 0
docs/docs.go 파일 보기

@@ -214,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": {
@@ -694,6 +708,96 @@ 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": "能量兑换",
@@ -1076,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": {
@@ -1269,6 +1394,33 @@ 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": {
@@ -1500,6 +1652,14 @@ const docTemplate = `{
"description": "全网至多用户数",
"type": "string"
},
"day_num": {
"description": "连续x天不活跃",
"type": "string"
},
"rows": {
"description": "行数",
"type": "string"
},
"space_list": {
"description": "数据列表",
"type": "array",
@@ -1514,6 +1674,10 @@ const docTemplate = `{
"space_total_nums": {
"description": "空间总数",
"type": "string"
},
"times": {
"description": "排数",
"type": "string"
}
}
},


+ 164
- 0
docs/swagger.json 파일 보기

@@ -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,96 @@
}
}
},
"/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": "能量兑换",
@@ -1070,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": {
@@ -1263,6 +1388,33 @@
}
}
},
"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": {
@@ -1494,6 +1646,14 @@
"description": "全网至多用户数",
"type": "string"
},
"day_num": {
"description": "连续x天不活跃",
"type": "string"
},
"rows": {
"description": "行数",
"type": "string"
},
"space_list": {
"description": "数据列表",
"type": "array",
@@ -1508,6 +1668,10 @@
"space_total_nums": {
"description": "空间总数",
"type": "string"
},
"times": {
"description": "排数",
"type": "string"
}
}
},


+ 112
- 0
docs/swagger.yaml 파일 보기

@@ -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:
@@ -169,6 +184,24 @@ 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:
@@ -332,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:
@@ -343,6 +382,9 @@ definitions:
space_total_nums:
description: 空间总数
type: string
times:
description: 排数
type: string
type: object
md.OneLineUserNode:
properties:
@@ -656,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:
@@ -973,6 +1025,66 @@ 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:


불러오는 중...
취소
저장