diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 57ffdc7c..f243f2b9 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,9 @@
-
+
+
+
diff --git a/server/adminserver/api/v1/system/mail.go b/server/adminserver/api/v1/system/mail.go
index c855164d..a6303cab 100644
--- a/server/adminserver/api/v1/system/mail.go
+++ b/server/adminserver/api/v1/system/mail.go
@@ -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)
diff --git a/server/adminserver/middleware/actlog.go b/server/adminserver/middleware/actlog.go
index d2c52dd4..b068b0a7 100644
--- a/server/adminserver/middleware/actlog.go
+++ b/server/adminserver/middleware/actlog.go
@@ -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
diff --git a/server/adminserver/model/system/mail.go b/server/adminserver/model/system/mail.go
index e1952a30..1284137b 100644
--- a/server/adminserver/model/system/mail.go
+++ b/server/adminserver/model/system/mail.go
@@ -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"`