Parcourir la source

内容奖励 短剧 短视频

adv_callback
huangjiajun il y a 2 semaines
Parent
révision
308f54aaad
11 fichiers modifiés avec 2925 ajouts et 278 suppressions
  1. +2
    -2
      app/hdl/friend_circle/hdl_comment.go
  2. +1
    -1
      app/hdl/friend_circle/hdl_friend_circle.go
  3. +35
    -0
      app/hdl/hdl_playlet.go
  4. +14
    -0
      app/md/md_playlet.go
  5. +5
    -0
      app/router/router.go
  6. +119
    -0
      app/svc/svc_playlet.go
  7. +4
    -4
      app/svc/svc_video.go
  8. +1023
    -99
      docs/docs.go
  9. +1000
    -75
      docs/swagger.json
  10. +720
    -95
      docs/swagger.yaml
  11. +2
    -2
      go.mod

+ 2
- 2
app/hdl/friend_circle/hdl_comment.go Voir le fichier

@@ -203,7 +203,7 @@ func CommentDelete(c *gin.Context) {
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param comment_index_id query string "评论文档记录"
// @Param comment_index_id query string true "评论文档记录"
// @Success 200 {string} "success"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/circleFriends/CommentLike [Get]
@@ -271,7 +271,7 @@ func CommentLike(c *gin.Context) {
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param comment_index_id query string "评论文档记录"
// @Param comment_index_id query string true "评论文档记录"
// @Success 200 {string} "success"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/circleFriends/CommentLike [Get]


+ 1
- 1
app/hdl/friend_circle/hdl_friend_circle.go Voir le fichier

@@ -72,7 +72,7 @@ func IsCanPublish(c *gin.Context) {
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body comm.PublishReq true "请求参数"
// @Param req body friend_circles.PublishReq true "请求参数"
// @Success 200 {string} "success"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/circleFriends/public [POST]


+ 35
- 0
app/hdl/hdl_playlet.go Voir le fichier

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

import (
"applet/app/svc"
"github.com/gin-gonic/gin"
)

// PlayletBase
// @Summary 短视频-基本信息
// @Tags 短视频
// @Description 短视频-基本信息
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Success 200 {object} md.PlayletBaseData "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/playlet/base [get]
func PlayletBase(c *gin.Context) {
svc.PlayletBase(c)
}

// PlayletReward
// @Summary 实名认证-保存
// @Tags 实名认证
// @Description 实名认证-保存
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.PlayletRewardRequest true "参数"
// @Success 200 {string} "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/playlet/reward [post]
func PlayletReward(c *gin.Context) {
svc.PlayletReward(c)
}

+ 14
- 0
app/md/md_playlet.go Voir le fichier

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

type PlayletBaseData struct {
Reward string `json:"reward" example:"单次奖励"`
Total string `json:"total" example:"可领取总次数"`
FirstCount string `json:"first_count" example:"首次可观看集数"`
SecondCount string `json:"second_count" example:"看一次广告解锁集数"`
Leave string `json:"leave" example:"剩余次数"`
Sum string `json:"sum" example:"奖励总数"`
CoinName string `json:"coin_name" example:"积分名称"`
}
type PlayletRewardRequest struct {
Id string `json:"id" example:"广告id"`
}

+ 5
- 0
app/router/router.go Voir le fichier

@@ -188,6 +188,11 @@ func route(r *gin.RouterGroup) {
rVideo.GET("/base", hdl.VideoBase) //基础数据
rVideo.POST("/reward", hdl.VideoReward) //奖励
}
rPlaylet := r.Group("/playlet") //短剧
{
rPlaylet.GET("/base", hdl.PlayletBase) //基础数据
rPlaylet.POST("/reward", hdl.PlayletReward) //奖励
}
}

func rCircleFriends(r *gin.RouterGroup) {


+ 119
- 0
app/svc/svc_playlet.go Voir le fichier

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

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"
"code.fnuoos.com/EggPlanet/egg_system_rules.git/enum"
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
"github.com/gin-gonic/gin"
"github.com/tidwall/gjson"
"time"
)

func PlayletBase(c *gin.Context) {
playletBase := GetSysCfgStr("playlet_base")
var res = md.PlayletBaseData{
Reward: gjson.Get(playletBase, "reward").String(),
Total: gjson.Get(playletBase, "total").String(),
FirstCount: gjson.Get(playletBase, "first_count").String(),
SecondCount: gjson.Get(playletBase, "second_count").String(),
Leave: gjson.Get(playletBase, "total").String(),
Sum: "0.00",
CoinName: "活跃值",
}
user := GetUser(c)
//剩余次数
NewPlayletTotalDb := implement.NewPlayletTotalDb(db.Db)
total, _ := NewPlayletTotalDb.GetPlayletTotal(utils.Int64ToStr(user.Id), time.Now().Format("20060102"))
if total != nil {
res.Leave = utils.IntToStr(utils.StrToInt(res.Total) - total.Total)
if utils.StrToInt(res.Leave) < 0 {
res.Leave = "0"
}
}
NewEggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db)
eggData, _ := NewEggEnergyBasicSettingDb.EggEnergyBasicSettingGetOne()
NewUserVirtualAmountDb := implement.NewUserVirtualAmountDb(db.Db)
coin, _ := NewUserVirtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggData.PersonEggPointsCoinId)
if coin != nil {
res.Sum = coin.Amount
}
e.OutSuc(c, res, nil)
return
}

func PlayletReward(c *gin.Context) {
var args md.PlayletRewardRequest
if err := c.ShouldBindJSON(&args); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
eg := db.Db
playletBase := GetSysCfgStr("playlet_base")
sess := eg.NewSession()
defer sess.Close()
sess.Begin()
user := GetUser(c)
NewPlayletTotalDb := implement.NewPlayletTotalDb(db.Db)
total, _ := NewPlayletTotalDb.GetPlayletTotalSess(sess, utils.Int64ToStr(user.Id), time.Now().Format("20060102"))
if total == nil {
total = &model.PlayletTotal{
Uid: int(user.Id),
Date: utils.StrToInt(time.Now().Format("20060102")),
Time: time.Now(),
}
insert, err := sess.Insert(total)
if insert == 0 || err != nil {
sess.Rollback()

e.OutErr(c, 400, e.NewErr(400, "获取奖励失败"))
return
}
}
Leave := utils.StrToInt(gjson.Get(playletBase, "total").String()) - total.Total
if Leave-1 < 0 {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "今天已领取完"))
return
}
total.Total++

update, err2 := sess.Where("id=?", total.Id).Cols("total").Update(total)
if update == 0 || err2 != nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "获取奖励失败"))
return
}
sess.Commit()
ch, err := rabbit.Cfg.Pool.GetChannel()
if err == nil {
defer ch.Release()
NewEggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db)
eggData, _ := NewEggEnergyBasicSettingDb.EggEnergyBasicSettingGetOne()
err = ch.PublishV2(md2.EggEnergyExchange, md2.EggEnergyStructForDealUserVirtualCoinData{
Kind: "add",
Title: enum.EggEnergyPlayletRewardPersonalActiveCoin.String(),
TransferType: int(enum.EggEnergyPlayletRewardPersonalActiveCoin),
CoinId: eggData.PersonEggPointsCoinId,
Uid: user.Id,
Amount: utils.StrToFloat64(gjson.Get(playletBase, "reward").String()),
}, md2.EggEnergyRoutKeyForDealUserVirtualCoinData)
if err != nil {
ch.PublishV2(md2.EggEnergyExchange, md2.EggEnergyStructForDealUserVirtualCoinData{
Kind: "add",
Title: enum.EggEnergyPlayletRewardPersonalActiveCoin.String(),
TransferType: int(enum.EggEnergyPlayletRewardPersonalActiveCoin),
CoinId: eggData.PersonEggPointsCoinId,
Uid: user.Id,
Amount: utils.StrToFloat64(gjson.Get(playletBase, "reward").String()),
}, md2.EggEnergyRoutKeyForDealUserVirtualCoinData)
}
}
e.OutSuc(c, "success", nil)
return
}

+ 4
- 4
app/svc/svc_video.go Voir le fichier

@@ -97,8 +97,8 @@ func VideoReward(c *gin.Context) {
eggData, _ := NewEggEnergyBasicSettingDb.EggEnergyBasicSettingGetOne()
err = ch.PublishV2(md2.EggEnergyExchange, md2.EggEnergyStructForDealUserVirtualCoinData{
Kind: "add",
Title: enum.EggEnergyWatchAdRewardPersonalActiveCoin.String(),
TransferType: int(enum.EggEnergyWatchAdRewardPersonalActiveCoin),
Title: enum.EggEnergyVideoRewardPersonalActiveCoin.String(),
TransferType: int(enum.EggEnergyVideoRewardPersonalActiveCoin),
CoinId: eggData.PersonEggPointsCoinId,
Uid: user.Id,
Amount: utils.StrToFloat64(gjson.Get(videoBase, "reward").String()),
@@ -106,8 +106,8 @@ func VideoReward(c *gin.Context) {
if err != nil {
ch.PublishV2(md2.EggEnergyExchange, md2.EggEnergyStructForDealUserVirtualCoinData{
Kind: "add",
Title: enum.EggEnergyWatchAdRewardPersonalActiveCoin.String(),
TransferType: int(enum.EggEnergyWatchAdRewardPersonalActiveCoin),
Title: enum.EggEnergyVideoRewardPersonalActiveCoin.String(),
TransferType: int(enum.EggEnergyVideoRewardPersonalActiveCoin),
CoinId: eggData.PersonEggPointsCoinId,
Uid: user.Id,
Amount: utils.StrToFloat64(gjson.Get(videoBase, "reward").String()),


+ 1023
- 99
docs/docs.go
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 1000
- 75
docs/swagger.json
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 720
- 95
docs/swagger.yaml
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 2
- 2
go.mod Voir le fichier

@@ -32,8 +32,8 @@ require (
)

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241204095350-c895baf67bc5
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241204100652-09a6749b5f44
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241204145112-7b4c29691a6d
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241205020101-e9fa2d461875
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


Chargement…
Annuler
Enregistrer