email.go
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package models
import (
"pro2d/common"
"pro2d/common/components"
"pro2d/pb"
)
const EMAIL_LIMIT = 50
type EmailModel struct {
components.ISchema
Data *pb.Email
}
func NewEmailModel(id string) *EmailModel {
data := &pb.Email{Id: id}
m := &EmailModel{
ISchema: NewSchema(data.Id, data),
Data: data,
}
return m
}
func NewEmailModelPB(email *pb.Email) *EmailModel {
m := &EmailModel{
ISchema: NewSchema(email.Id, email),
Data: email,
}
return m
}
func InsertEmail(email *pb.Email) bool {
data := &EmailModel{
ISchema: NewSchema(email.Id, email),
Data: email,
}
data.SetProperty("createtime", common.Timex())
err := data.Create()
if err != nil {
return false
}
return true
}
func (m *EmailModel) Log(role *RoleModel, action int32) {
//{desc = "onMail", int1 = self:getProperty("id"), int2 = self:getProperty("status"), cint1 = self:getProperty("emailId"),
// short1 = action, key1=self:getProperty("title"), key2=self:getProperty("attachments")})
role.MyLog("mail_action", &pb.LogConf{
Desc: "onMail",
//Int1: email.Data.Id,
Int2: string(m.Data.Status),
//Cint1:
Short1: action,
Key1: m.Data.Title,
Key2: m.Data.Attachments,
})
}