admin
2019-01-18 0ec80d1281c95fba831092755bf07124f798ede4
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package com.yeshi.fanli.util.factory.msg;
 
import java.util.Date;
 
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.util.StringUtil;
 
public class MsgAccountDetailFactory {
    public final static int TYPE_WX = 1;// 微信
    public final static int TYPE_TB = 2;// 淘宝
    public final static int TYPE_PHONE = 3;// 电话
 
    /**
     * 账号绑定成功
     * 
     * @param uid
     * @param type
     * @return
     */
    public static MsgAccountDetail createBindingAccount(Long uid, int type) {
        String msg = "";
        if (type == TYPE_PHONE) {
            msg = "<highlight>恭喜你手机号绑定成功</highlight>";
        } else if (type == TYPE_TB) {
            msg = "<highlight>恭喜你淘宝绑定成功</highlight>";
        } else if (type == TYPE_WX) {
            msg = "<highlight>恭喜你微信绑定成功</highlight>";
        }
        if (StringUtil.isNullOrEmpty(msg))
            return null;
        MsgAccountDetail detail = new MsgAccountDetail();
        detail.setBeiZhu("无");
        detail.setContent(msg);
        detail.setTitle("绑定账号");
        detail.setType(MsgTypeAccountTypeEnum.bingding);
        detail.setUser(new UserInfo(uid));
        detail.setCreateTime(new Date());
        detail.setRead(false);
        return detail;
    }
 
    /**
     * 账号解绑成功
     * 
     * @param uid
     * @param type
     * @return
     */
    public static MsgAccountDetail createUnBindingAccount(Long uid, int type) {
        String msg = "";
        if (type == TYPE_PHONE) {
            msg = "<highlight>手机号解绑成功</highlight>";
        } else if (type == TYPE_TB) {
            msg = "<highlight>淘宝解绑成功</highlight>";
        } else if (type == TYPE_WX) {
            msg = "<highlight>微信解绑成功</highlight>";
        }
        if (StringUtil.isNullOrEmpty(msg))
            return null;
        MsgAccountDetail detail = new MsgAccountDetail();
        detail.setBeiZhu("无");
        detail.setContent(msg);
        detail.setTitle("解绑账号");
        detail.setType(MsgTypeAccountTypeEnum.cancelBinding);
        detail.setUser(new UserInfo(uid));
        detail.setCreateTime(new Date());
        detail.setRead(false);
        return detail;
    }
 
    /**
     * 账号更换成功
     * 
     * @param uid
     * @param type
     * @return
     */
    public static MsgAccountDetail createChangeBindingAccount(Long uid, int type) {
        String msg = "";
        if (type == TYPE_PHONE) {
            msg = "<highlight>手机号更换绑定成功</highlight>";
        } else if (type == TYPE_TB) {
            msg = "<highlight>淘宝更换绑定成功</highlight>";
        } else if (type == TYPE_WX) {
            msg = "<highlight>微信更换绑定成功</highlight>";
        }
        if (StringUtil.isNullOrEmpty(msg))
            return null;
        MsgAccountDetail detail = new MsgAccountDetail();
        detail.setBeiZhu("无");
        detail.setContent(msg);
        detail.setTitle("更换绑定账号");
        detail.setType(MsgTypeAccountTypeEnum.bingdingChange);
        detail.setUser(new UserInfo(uid));
        detail.setCreateTime(new Date());
        detail.setRead(false);
        return detail;
    }
 
    /**
     * 账号打通
     * 
     * @param mainUid
     * @param lessUid
     * @return
     */
    public static MsgAccountDetail createConnectAccount(Long mainUid, Long lessUid) {
        if (mainUid == null || lessUid == null)
            return null;
        String msg = String.format("恭喜你账号合并成功,由“<highlight>%s</highlight>”合并到“<highlight>%s</highlight>”", lessUid + "",
                mainUid + "");
        MsgAccountDetail detail = new MsgAccountDetail();
        detail.setBeiZhu("无");
        detail.setContent(msg);
        detail.setTitle("账号合并");
        detail.setType(MsgTypeAccountTypeEnum.connect);
        detail.setUser(new UserInfo(mainUid));
        detail.setCreateTime(new Date());
        detail.setRead(false);
        return detail;
    }
 
    // TODO 账号等级
 
}