message_dto.go 903 字节
package dto

import (
	"math/rand"
	"time"
)

type MessageDto struct {
	MsgId      int    `json:"msgId"`
	MsgContent string `json:"msgContent"`
	MsgTime    int64  `json:"msgTime"`
	MsgType    int    `json:"msgType"`
	MsgIcon    string `json:"msgIcon"`
	Read       int    `json:"read"`
	DynamicId  int    `json:"dynamicId"`
}

func NewMessageDto() *MessageDto {
	return &MessageDto{
		MsgId:      rand.Intn(10000),
		MsgContent: "消息",
		MsgTime:    time.Now().Unix() * 1000,
		MsgType:    1,
		Read:       1,
	}
}

func (m *MessageDto) LoadMsgType(module string, action string) int {
	switch module {
	case "module01":
		switch action {
		case "action01_01", "action01_02":
			return 1001 //跳转共创申请列表页面
		case "action01_03":
			return 1002 //跳转共创企业列表页面
		case "action01_04", "action01_05", "action01_06":
			return 1003
		}
	}
	return 1 // 系统注册消息
}