@@ -0,0 +1,75 @@
|
||||
package integeralctrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/integral_config_ser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/stderr"
|
||||
"91porn-server/models/v/integralconfigmod"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// ExchangeIntegral doc
|
||||
// @Summary 积分兑换
|
||||
// @Description 积分兑换
|
||||
// @Tags 积分配置
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param id formData string true "积分兑换配置ID"
|
||||
// @Param name formData string false "兑换用户姓名"
|
||||
// @Param tel formData string false "积分兑换用户电话"
|
||||
// @Param address formData string false "兑换用户地址"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /app/integral/exchangeIntegral [post]
|
||||
func ExchangeIntegral(ctx *gin.Context) {
|
||||
uid, err := common.GetUID(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrNoToken, err)
|
||||
return
|
||||
}
|
||||
var in integralconfigmod.ExchangeIntegralReq
|
||||
if err = ctx.ShouldBind(&in); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err)
|
||||
return
|
||||
}
|
||||
code := integral_config_ser.ExchangeIntegral(uid, &in)
|
||||
if code != stderr.Success {
|
||||
common.ServeJSON(ctx, code, code.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, code, stderr.Success.Msg())
|
||||
}
|
||||
|
||||
// GetList doc
|
||||
// @Summary 积分兑换列表
|
||||
// @Description 积分兑换列表
|
||||
// @Tags 积分配置
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /app/integral/list [get]
|
||||
func GetList(c *gin.Context) {
|
||||
data := integral_config_ser.GetAllConfig()
|
||||
common.ServeJSON(c, stderr.Success, data)
|
||||
}
|
||||
|
||||
// GetRecordList doc
|
||||
// @Summary 积分兑换记录列表
|
||||
// @Description 积分兑换记录列表
|
||||
// @Tags 积分配置
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Success 200 object integralconfigmod.AppIntegralRecord "成功"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /app/integral/record/list [get]
|
||||
func GetRecordList(ctx *gin.Context) {
|
||||
uid, err := common.GetUID(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrNoToken, err)
|
||||
return
|
||||
}
|
||||
data := integral_config_ser.GetRecordConfig(uid)
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
Reference in New Issue
Block a user