This commit is contained in:
aozhiwei 2024-08-08 14:22:53 +08:00
commit f06a69dd14
4 changed files with 20 additions and 17 deletions

4
.idea/workspace.xml generated
View File

@ -4,7 +4,9 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="fca4d8d0-8602-4587-a207-260dbd5fab5a" name="Changes" comment="" />
<list default="true" id="fca4d8d0-8602-4587-a207-260dbd5fab5a" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />

View File

@ -25,7 +25,7 @@ func (this *MailApi) ListMail(c *gin.Context) {
inSub := `tag1 IN (` + q5.ToString(jccommon.MAIL_TAG1_CUSTOM)
inSub += ")"
//q5.AppendSlice(&subFilters, f5.GetDbFilter().Custom(inSub).And())
f5.GetDbFilter().Custom("deleted = 0").And()
q5.AppendSlice(&subFilters, f5.GetDbFilter().Custom("deleted = 0").And())
}
mails := []*system.Mail{}
rspObj := struct {
@ -164,7 +164,7 @@ func (this *MailApi) EditMail(c *gin.Context) {
}
var count int64 = 0
if f5.GetApp().GetOrmDb(constant.MAIL_DB).Where("mail_id = ?", reqJson.MailId).Count(&count); count < 1 {
if f5.GetApp().GetOrmDb(constant.MAIL_DB).Table("t_mail").Where("mail_id = ?", reqJson.MailId).Count(&count); count < 1 {
c.JSON(http.StatusOK, gin.H{
"code": 2,
"message": "mailid不存在",
@ -204,7 +204,8 @@ func (this *MailApi) DelMail(c *gin.Context) {
mailid := q5.ToInt64(c.Param("mailid"))
var count int64 = 0
if f5.GetApp().GetOrmDb(constant.MAIL_DB).Table("t_mail").Where("mail_id = ?", mailid).Count(&count); count < 1 {
db := f5.GetApp().GetOrmDb(constant.MAIL_DB).Table("t_mail").Where("mail_id = ?", mailid)
if db.Count(&count); count < 1 {
c.JSON(http.StatusOK, gin.H{
"code": 2,
"message": "mailid不存在",
@ -213,15 +214,19 @@ func (this *MailApi) DelMail(c *gin.Context) {
}
nowDaySeconds := int32(f5.GetApp().GetRealSeconds())
mail := new(system.Mail)
mail.MailId = mailid
mail.Deleted = 1
mail.ModifyTime = nowDaySeconds
f5.GetApp().GetOrmDb(constant.MAIL_DB).Save(mail)
delMail := struct {
Deleted int32 `gorm:"column:deleted" json:"-"`
ModifyTime int32 `gorm:"column:modifytime" json:"modifytime"`
}{
1,
nowDaySeconds,
}
db.Save(delMail)
{
e := new(jccommon.MailEvent)
e.EventName = jccommon.EVENT_MAIL_UPDATE
e.Param1 = q5.ToString(mail.MailId)
e.Param1 = q5.ToString(mailid)
e.CreateTime = nowDaySeconds
e.ModifyTime = nowDaySeconds
f5.GetApp().GetOrmDb(constant.MAIL_DB).Create(e)

View File

@ -7,7 +7,6 @@ import (
"f5"
"io"
"main/common"
"net/http"
"strings"
"github.com/gin-gonic/gin"
@ -23,7 +22,7 @@ func ActLog(c *gin.Context) bool {
return false
}
url := c.Request.URL.String()
url := c.Request.URL.Path
if len(url) > 64*1024 {
return false
}
@ -68,10 +67,7 @@ func ActLog(c *gin.Context) bool {
}
}
if err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Table("t_op_log").Create(info).Error; err != nil {
c.JSON(http.StatusOK, gin.H{
"code": 1,
"message": err.Error(),
})
f5.GetSysLog().Error("!!!!!!!record op_log error:%s, %s, %s", info.Account, info.URL, info.Params)
}
return true

View File

@ -30,7 +30,7 @@ type Mail struct {
Content string `gorm:"column:content" json:"content"`
Recipients []string `gorm:"column:recipients;serializer:json" json:"recipients"`
Attachments []common.Attachment `gorm:"column:attachments;serializer:json" json:"attachments"`
Deleted int32 `gorm:"column:deleted" json:"deleted"`
Deleted int32 `gorm:"column:deleted" json:"-"`
SendTime int32 `gorm:"column:sendtime" json:"sendtime"`
UserRegStartTime int32 `gorm:"column:user_reg_start_time" json:"user_reg_start_time"`
UserRegEndTime int32 `gorm:"column:user_reg_end_time" json:"user_reg_end_time"`