@@ -0,0 +1,126 @@
|
||||
package vidctrl
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/constant"
|
||||
"91porn-server/common/stderr"
|
||||
"91porn-server/models/l/operatorlgmod"
|
||||
"91porn-server/models/v/rjctmpltmod"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
// GetRejectTemplate doc
|
||||
// @Summary 获取审核拒绝模版
|
||||
// @Description 获取审核拒绝模版
|
||||
// @Tags recharge
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/web/recharge/channel/list [get]
|
||||
func GetRejectTemplate(ctx *gin.Context) {
|
||||
rType := ctx.Query("type")
|
||||
infos, err := rjctmpltmod.FindMany(rType)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, gin.H{
|
||||
"list": infos,
|
||||
})
|
||||
}
|
||||
|
||||
// RejectTemplateInsert doc
|
||||
// @Summary 新增
|
||||
// @Description 新增
|
||||
// @Tags recharge
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param reachargeDetails formData rjctmpltmod.RejectTemplate ture "product卡"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/web/rejectTemp/insert [post]
|
||||
func RejectTemplateInsert(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
r := rjctmpltmod.RejectTemplate{}
|
||||
if err = ctx.ShouldBind(&r); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err = rjctmpltmod.InsertOne(r); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbInputExist, err.Error())
|
||||
return
|
||||
}
|
||||
log, _ := json.Marshal(r)
|
||||
_ = operatorlgmod.RecordOperation(manager, constant.RejectTemplate, constant.Add, string(log), ctx.Request.URL.RequestURI())
|
||||
common.ServeJSON(ctx, stderr.Success, nil)
|
||||
}
|
||||
|
||||
// RejectTemplateUpdate doc
|
||||
// @Summary 编辑充值渠道
|
||||
// @Description 编辑充值渠道
|
||||
// @Tags recharge
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/web/recharge/channel/update [post]
|
||||
func RejectTemplateUpdate(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
set := rjctmpltmod.Edit{}
|
||||
if err = ctx.ShouldBind(&set); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err = rjctmpltmod.Update(set); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbUpdateError, err.Error())
|
||||
return
|
||||
}
|
||||
log, _ := json.Marshal(set)
|
||||
_ = operatorlgmod.RecordOperation(manager, constant.RejectTemplate, constant.Modify, string(log), ctx.Request.URL.RequestURI())
|
||||
common.ServeJSON(ctx, stderr.Success, nil)
|
||||
}
|
||||
|
||||
// RejectTemplateDelete doc
|
||||
// @Summary 删除
|
||||
// @Description 删除
|
||||
// @Tags recharge
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param id formData int true "product等级""
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/web/recharge/channel/delete [delete]
|
||||
func RejectTemplateDelete(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
var p struct {
|
||||
IDs []primitive.ObjectID `json:"ids"`
|
||||
}
|
||||
if err = ctx.ShouldBind(&p); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err = rjctmpltmod.DeleteMany(p.IDs); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrDbDeleteError, err.Error())
|
||||
return
|
||||
}
|
||||
log, _ := json.Marshal(p)
|
||||
_ = operatorlgmod.RecordOperation(manager, constant.RejectTemplate, constant.Delete, string(log), ctx.Request.URL.RequestURI())
|
||||
common.ServeJSON(ctx, stderr.Success, nil)
|
||||
}
|
||||
Reference in New Issue
Block a user