mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-25 03:48:35 +08:00
【更新】更新restful
This commit is contained in:
@@ -20,15 +20,7 @@ type ResEmailsApi struct {
|
||||
ResEmailsApp services.ResEmailsModel
|
||||
}
|
||||
|
||||
// @Summary ResEmails列表数据
|
||||
// @Tags ResEmails
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Param status query string false "状态"
|
||||
// @Param category query string false "分类"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /resource/email/list [get]
|
||||
// @Security
|
||||
// GetResEmailsList ResEmails列表数据
|
||||
func (p *ResEmailsApi) GetResEmailsList(rc *restfulx.ReqCtx) {
|
||||
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
@@ -52,28 +44,13 @@ func (p *ResEmailsApi) GetResEmailsList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取ResEmails
|
||||
// @Description 获取JSON
|
||||
// @Tags ResEmails
|
||||
// @Param mailId path int true "mailId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /resource/email/{mailId} [get]
|
||||
// @Security
|
||||
// GetResEmails 获取ResEmails
|
||||
func (p *ResEmailsApi) GetResEmails(rc *restfulx.ReqCtx) {
|
||||
mailId := restfulx.PathParamInt(rc, "mailId")
|
||||
p.ResEmailsApp.FindOne(int64(mailId))
|
||||
}
|
||||
|
||||
// @Summary 添加ResEmails
|
||||
// @Description 获取JSON
|
||||
// @Tags ResEmails
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.ResEmail true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/email [post]
|
||||
// @Security X-TOKEN
|
||||
// InsertResEmails 添加ResEmails
|
||||
func (p *ResEmailsApi) InsertResEmails(rc *restfulx.ReqCtx) {
|
||||
var data entity.ResEmail
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -81,16 +58,7 @@ func (p *ResEmailsApi) InsertResEmails(rc *restfulx.ReqCtx) {
|
||||
p.ResEmailsApp.Insert(data)
|
||||
}
|
||||
|
||||
// @Summary 修改ResEmails
|
||||
// @Description 获取JSON
|
||||
// @Tags ResEmails
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.ResEmail true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/email [put]
|
||||
// @Security X-TOKEN
|
||||
// UpdateResEmails 修改ResEmails
|
||||
func (p *ResEmailsApi) UpdateResEmails(rc *restfulx.ReqCtx) {
|
||||
var data entity.ResEmail
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -103,29 +71,14 @@ func (p *ResEmailsApi) UpdateResEmails(rc *restfulx.ReqCtx) {
|
||||
p.ResEmailsApp.Update(data)
|
||||
}
|
||||
|
||||
// @Summary 删除ResEmails
|
||||
// @Description 删除数据
|
||||
// @Tags ResEmails
|
||||
// @Param mailId path string true "mailId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /resource/email/{mailId} [delete]
|
||||
// DeleteResEmails 删除ResEmails
|
||||
func (p *ResEmailsApi) DeleteResEmails(rc *restfulx.ReqCtx) {
|
||||
mailId := restfulx.PathParam(rc, "mailId")
|
||||
mailIds := utils.IdsStrToIdsIntGroup(mailId)
|
||||
p.ResEmailsApp.Delete(mailIds)
|
||||
}
|
||||
|
||||
// @Summary 删除ResEmails
|
||||
// @Description 获取JSON
|
||||
// @Tags ResOsses
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.ResEmail true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/oss [put]
|
||||
// @Security X-TOKEN
|
||||
// UpdateMailStatus 删除ResEmails
|
||||
func (p *ResEmailsApi) UpdateMailStatus(rc *restfulx.ReqCtx) {
|
||||
var data entity.ResEmail
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -133,16 +86,7 @@ func (p *ResEmailsApi) UpdateMailStatus(rc *restfulx.ReqCtx) {
|
||||
p.ResEmailsApp.Update(entity.ResEmail{MailId: data.MailId, Status: data.Status})
|
||||
}
|
||||
|
||||
// @Summary 测试发邮件
|
||||
// @Description 获取JSON
|
||||
// @Tags ResEmails
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body from.SendMail true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/email/debugMail [post]
|
||||
// @Security X-TOKEN
|
||||
// DebugMail 测试发邮件
|
||||
func (p *ResEmailsApi) DebugMail(rc *restfulx.ReqCtx) {
|
||||
var data from.SendMail
|
||||
restfulx.BindQuery(rc, &data)
|
||||
|
||||
@@ -21,16 +21,7 @@ type ResOssesApi struct {
|
||||
ResOssesApp services.ResOssesModel
|
||||
}
|
||||
|
||||
// @Summary ResOsses列表数据
|
||||
// @Tags ResOsses
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Param status query string false "状态"
|
||||
// @Param category query string false "分类"
|
||||
// @Param ossCode query string false "编号"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /resource/oss/list [get]
|
||||
// @Security
|
||||
// GetResOssesList ResOsses列表数据
|
||||
func (p *ResOssesApi) GetResOssesList(rc *restfulx.ReqCtx) {
|
||||
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
@@ -55,28 +46,13 @@ func (p *ResOssesApi) GetResOssesList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取ResOsses
|
||||
// @Description 获取JSON
|
||||
// @Tags ResOsses
|
||||
// @Param ossId path int true "ossId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /resource/oss/{ossId} [get]
|
||||
// @Security
|
||||
// GetResOsses 获取ResOsses
|
||||
func (p *ResOssesApi) GetResOsses(rc *restfulx.ReqCtx) {
|
||||
ossId := restfulx.PathParamInt(rc, "ossId")
|
||||
p.ResOssesApp.FindOne(int64(ossId))
|
||||
}
|
||||
|
||||
// @Summary 添加ResOsses
|
||||
// @Description 获取JSON
|
||||
// @Tags ResOsses
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.ResOss true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/oss [post]
|
||||
// @Security X-TOKEN
|
||||
// InsertResOsses 添加ResOsses
|
||||
func (p *ResOssesApi) InsertResOsses(rc *restfulx.ReqCtx) {
|
||||
var data entity.ResOss
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -84,16 +60,7 @@ func (p *ResOssesApi) InsertResOsses(rc *restfulx.ReqCtx) {
|
||||
p.ResOssesApp.Insert(data)
|
||||
}
|
||||
|
||||
// @Summary 修改ResOsses
|
||||
// @Description 获取JSON
|
||||
// @Tags ResOsses
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.ResOss true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/oss [put]
|
||||
// @Security X-TOKEN
|
||||
// UpdateResOsses 修改ResOsses
|
||||
func (p *ResOssesApi) UpdateResOsses(rc *restfulx.ReqCtx) {
|
||||
var data entity.ResOss
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -106,25 +73,14 @@ func (p *ResOssesApi) UpdateResOsses(rc *restfulx.ReqCtx) {
|
||||
p.ResOssesApp.Update(data)
|
||||
}
|
||||
|
||||
// @Summary 删除ResOsses
|
||||
// @Description 删除数据
|
||||
// @Tags ResOsses
|
||||
// @Param ossId path string true "ossId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /resource/oss/{ossId} [delete]
|
||||
// DeleteResOsses 删除ResOsses
|
||||
func (p *ResOssesApi) DeleteResOsses(rc *restfulx.ReqCtx) {
|
||||
ossId := restfulx.PathParam(rc, "ossId")
|
||||
ossIds := utils.IdsStrToIdsIntGroup(ossId)
|
||||
p.ResOssesApp.Delete(ossIds)
|
||||
}
|
||||
|
||||
// @Summary 上传文件ResOsses
|
||||
// @Description 上传文件
|
||||
// @Tags ResOsses
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /resource/oss/uploadFile [post]
|
||||
// UplaodResOsses 上传文件ResOsses
|
||||
func (p *ResOssesApi) UplaodResOsses(rc *restfulx.ReqCtx) {
|
||||
_, handler, _ := rc.Request.Request.FormFile("file")
|
||||
ossCode := restfulx.QueryParam(rc, "ossCode")
|
||||
@@ -139,16 +95,7 @@ func (p *ResOssesApi) UplaodResOsses(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = fmt.Sprintf("https://%s.%s/%s", li[0].BucketName, li[0].Endpoint, yunFileTmpPath)
|
||||
}
|
||||
|
||||
// @Summary 修改ResOsses状态
|
||||
// @Description 获取JSON
|
||||
// @Tags ResOsses
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.ResOss true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /resource/oss [put]
|
||||
// @Security X-TOKEN
|
||||
// UpdateOssStatus 修改ResOsses状态
|
||||
func (p *ResOssesApi) UpdateOssStatus(rc *restfulx.ReqCtx) {
|
||||
var data entity.ResOss
|
||||
restfulx.BindQuery(rc, &data)
|
||||
|
||||
Reference in New Issue
Block a user