YULUserInfoFormatter.class.php
2.27 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
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
95
96
97
98
99
100
101
102
103
104
105
<?php
/**
* 用户信息格式器. 用来格式化产生插入日志数据库中的用户信息消息.消息格式如下
*
* 用户ID|加密码|模块|消息类型|消息内容
*
* @author dan
*
*/
class YULUserInfoFormatter extends YULMessageFormatter
{
const WAVE_SEARCH_COND = 0;
const WAVE_MARK = 1;
const OPT_MSG_SEND = 2;
const LOGIN_INFO = 3;
const LOGOUT_INFO = 4;
const REG_RESET_PWD = 5;
const MAIL_BOX = 6;
const CELL_PHONE = 7;
const IM = 8;
const PWD_PROT_QUESTION = 9;
const PWD_PROT_ANSWER = 10;
const USER_REAL_NAME = 11;
const USER_SEX = 12;
const USER_AGE = 13;
private $formatter = array(
// 消息类型
'type'=>self::USER_INFO_TYPE,
//用户ID
'userID'=>0,
//加密码
'skey'=>null,
//模块
'module'=>null,
//消息类型
'infoType'=>null,
//消息内容
'content'=>null,
);
function __construct()
{
}
public function setUserID($userID)
{
if (isset($userID))
{
$this->formatter['userID'] = $userID;
}
}
public function setSkey($skey)
{
if (isset($skey))
{
$this->formatter['skey'] = $skey;
}
}
public function setModule($module)
{
if (isset($module))
{
$this->formatter['module'] = $module;
}
}
public function setInfoType($infoType)
{
if (isset($infoType))
{
$this->formatter['infoType'] = $infoType;
}
}
public function setContent($content)
{
if (isset($content))
{
$this->formatter['content'] = $content;
}
}
/**
*
*/
public function toString()
{
$result = '';
$separator = $this->getSeparator();
foreach ($this->formatter as $format)
{
$result .= $format;
$result .= $separator;
}
return trim($result, $separator);
}
}
?>