difenduandada
2024-12-31 34abe6963b344c882358274957f4b992456fee40
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
"use strict";
cc._RF.push(module, 'e14a3mA4nFMrZt0KhZlRwNx', 'mail_vo');
// Scripts/mod/mail/mail_vo.js
 
"use strict";
 
/*-----------------------------------------------------+
 * 邮件数据模块
 * @author zys
 +-----------------------------------------------------*/
var MailVo = cc.Class({
  "extends": gcore.BaseEvent,
  ctor: function ctor() {
    this.initData();
  },
  setContent: function setContent(value) {
    this.mail_count = value;
  },
  //初始化数据
  initData: function initData() {
    this.id = 0; //邮件bid
 
    this.srv_id = ""; //邮件服务器id
 
    this.type = 1; //0:私人 1:系统 2:公告
 
    this.from_name = ""; //发件人用户名
 
    this.subject = ""; //标题
 
    this.content = ""; //内容
 
    this.assets = []; //'资产类型 coin/gold'
 
    this.items = []; //'物品
 
    this.send_time = 0; //'发送时间
 
    this.send_time_order = 0; //用于排升序的发送时间
 
    this.read_time = 0; //阅读时间
 
    this.time_out = 0; //超时时间搓
 
    this.status = 0; //0:未读 1:已读 2:已领
 
    this.is_has = 1; //是否有附件 0有1没
  },
  //数据赋值(对传过来的协议进行赋值)
  initAttrData: function initAttrData(data_list) {
    if (data_list) {
      for (var k in data_list) {
        var v = data_list[k];
        this.update(k, v);
 
        if (data_list.send_time) {
          this.send_time_order = -data_list.send_time || 0;
        }
 
        if (data_list.assets || data_list.items) {
          if (data_list.assets.length > 0 || data_list.items.length > 0) {
            this.is_has = 0;
          } else {
            this.is_has = 1;
          }
        }
      }
    }
  },
  update: function update(key, value) {
    if (this[key] != null) {
      this[key] = value;
    }
  },
  setReaded: function setReaded(read_time) {
    if (read_time) {
      this.read_time = read_time;
    }
 
    this.status = 1;
  },
  removeAssets: function removeAssets(read_time) {
    if (read_time) {
      this.read_time = read_time;
    }
 
    this.items = {};
    this.assets = {};
    this.status = 2;
  }
});
module.exports = MailVo;
 
cc._RF.pop();