This commit is contained in:
yangduo 2024-08-16 11:26:41 +08:00
parent 867c237e87
commit e771ff72ce
3 changed files with 19 additions and 19 deletions

View File

@ -164,17 +164,17 @@ func (this *AnncApi) UpdateAnnc(c *gin.Context) {
return
}
db.Table(annc.TableName()).Where("idx != ?", idx).Where("annc_type = ?", annc.AnncType).Where("platform = ?", annc.PlatForm).Count(&count)
if count > 0 {
c.JSON(http.StatusOK, gin.H{
"code": 1,
"message": "已有同类型的公告",
})
return
}
// db.Table(annc.TableName()).Where("idx != ?", idx).Where("annc_type = ?", annc.AnncType).Where("platform = ?", annc.PlatForm).Count(&count)
// if count > 0 {
// c.JSON(http.StatusOK, gin.H{
// "code": 1,
// "message": "已有同类型的公告",
// })
// return
// }
annc.ModifyTime = int32(f5.GetApp().GetRealSeconds())
err := db.Select("*").Omit("idx", "createtime").Where("idx = ?", idx).Updates(&annc).Error
err := db.Select("*").Omit("idx", "createtime", "annc_type", "platform").Where("idx = ?", idx).Updates(&annc).Error
if err != nil {
c.JSON(http.StatusOK, gin.H{
"code": 1,

View File

@ -118,16 +118,16 @@ func (this *AuditApi) UpdateAudit(c *gin.Context) {
return
}
db.Table(audit.TableName()).Where("idx != ?", idx).Where("model = ?", audit.Model).Count(&count)
if count > 0 {
c.JSON(http.StatusOK, gin.H{
"code": 1,
"message": "已有同类型审核",
})
return
}
// db.Table(audit.TableName()).Where("idx != ?", idx).Where("model = ?", audit.Model).Count(&count)
// if count > 0 {
// c.JSON(http.StatusOK, gin.H{
// "code": 1,
// "message": "已有同类型审核",
// })
// return
// }
err := db.Select("*").Omit("idx").Where("idx = ?", idx).Updates(&audit).Error
err := db.Select("*").Omit("idx", "model").Where("idx = ?", idx).Updates(&audit).Error
if err != nil {
c.JSON(http.StatusOK, gin.H{
"code": 1,

View File

@ -15,7 +15,7 @@ func (this *AnncRouter) InitAnncRouter(priRouter *gin.RouterGroup) {
anncApi.Init()
{
priUserRouter.GET("anncList", middleware.Permission("api/v1/annc/anncList", anncApi.AnncList))
priUserRouter.POST("addAnnc", middleware.Permission("api/v1/annc/addAnnc", anncApi.AddAnnc))
// priUserRouter.POST("addAnnc", middleware.Permission("api/v1/annc/addAnnc", anncApi.AddAnnc))
priUserRouter.PUT("updateAnnc/:idx", middleware.Permission("api/v1/annc/updateAnnc", anncApi.UpdateAnnc))
priUserRouter.GET("anncIngameList", middleware.Permission("api/v1/annc/anncIngameList", anncApi.IngameAnncList))