| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- package v1
- import (
- "dsbqj-admin/app/service"
- "dsbqj-admin/pkg/app"
- "dsbqj-admin/pkg/e"
- "net/http"
- "github.com/gin-gonic/gin"
- )
- func ChannelAll(c *gin.Context) {
- var appG = app.Gin{C: c}
- service := service.GameChannelService{}
- if err := c.ShouldBind(&service); err == nil {
- if res, err := service.All(); err != nil {
- appG.Response(http.StatusOK, e.INVALID_PARAMS, err.Error())
- } else {
- appG.Response(http.StatusOK, e.SUCCESS, res)
- }
- } else {
- appG.Response(http.StatusOK, e.INVALID_PARAMS, err.Error())
- }
- }
- // ChannelList 渠道列表
- func ChannelList(c *gin.Context) {
- var appG = app.Gin{C: c}
- var svc service.ChannelListService
- if err := c.ShouldBindQuery(&svc); err != nil {
- appG.Response(http.StatusOK, e.INVALID_PARAMS, err.Error())
- return
- }
- res, err := svc.List()
- if err != nil {
- appG.Response(http.StatusOK, e.ERROR, err.Error())
- return
- }
- appG.Response(http.StatusOK, e.SUCCESS, res)
- }
- // ChannelCreate 渠道新增
- func ChannelCreate(c *gin.Context) {
- var appG = app.Gin{C: c}
- var svc service.ChannelCreateService
- if err := c.ShouldBindJSON(&svc); err != nil {
- appG.Response(http.StatusOK, e.INVALID_PARAMS, err.Error())
- return
- }
- if err := svc.Create(); err != nil {
- appG.Response(http.StatusOK, e.ERROR, err.Error())
- return
- }
- appG.Response(http.StatusOK, e.SUCCESS, nil)
- }
- // ChannelUpdate 渠道修改
- func ChannelUpdate(c *gin.Context) {
- var appG = app.Gin{C: c}
- var svc service.ChannelUpdateService
- if err := c.ShouldBindJSON(&svc); err != nil {
- appG.Response(http.StatusOK, e.INVALID_PARAMS, err.Error())
- return
- }
- if err := svc.Update(); err != nil {
- appG.Response(http.StatusOK, e.ERROR, err.Error())
- return
- }
- appG.Response(http.StatusOK, e.SUCCESS, nil)
- }
- // ChannelDelete 渠道删除
- func ChannelDelete(c *gin.Context) {
- var appG = app.Gin{C: c}
- var svc service.ChannelDeleteService
- if err := c.ShouldBindJSON(&svc); err != nil {
- appG.Response(http.StatusOK, e.INVALID_PARAMS, err.Error())
- return
- }
- if err := svc.Delete(); err != nil {
- appG.Response(http.StatusOK, e.ERROR, err.Error())
- return
- }
- appG.Response(http.StatusOK, e.SUCCESS, nil)
- }
|