package backend import ( "cron_admin/app/constants/errorcode" "cron_admin/app/http/controllers" "cron_admin/app/http/entities/backend" "cron_admin/app/services/db_service" "cron_admin/app/utils/helper" "cron_admin/app/utils/mapstructure" "github.com/gin-gonic/gin" ) func DbList(c *gin.Context) { request := controllers.GetRequest(c).(*backend.DbListRequest) count, DbListInfo, err := db_service.DbList(request, request.Page, request.Limit) if err != nil { controllers.HandCodeRes(c, nil, errorcode.ParamError) } else { var DbListResponse []backend.DbListResponse _ = mapstructure.DecodeWithTime(DbListInfo, &DbListResponse, helper.DefaultFormatLayout) controllers.HandRes(c, gin.H{"data": DbListResponse, "count": count}, err) } } func DbAdd(c *gin.Context) { request := controllers.GetRequest(c).(*backend.DbAddRequest) err := db_service.DbAdd(request) controllers.HandRes(c, nil, err) }