email.go 936 Bytes
package models

import (
	"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 (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,
	})
}