CustomAttachmentRecommendAssistant.java 1.67 KB
Newer Older
konghaorui committed
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
package com.yidianling.im.session.extension;

import com.alibaba.fastjson.JSONObject;

/**
 * Created by Wi1ls on 2016/12/14;
 */
public class  CustomAttachmentRecommendAssistant extends CustomAttachment{
    private static final String KEY_TOUID="to_uid";
    private static final String KEY_IMG="img";
    private static final String KEY_NAME="name";
    private static final String KEY_USER_TYPE="user_type";
    private static final String KEY_TITLE="title";

    private String to_uid;//userType=1,表示助手uid;type=2表示用户uid
    private String img;//头像
    private String name;//用户名
    private String user_type;//1发送给用户,2发送给助手
    private String title;//用以消息列表展示

    public CustomAttachmentRecommendAssistant() {
        super(CustomAttachmentType.ASSISTANT);
    }

    @Override
    protected void parseData(JSONObject data) {
        to_uid=data.getString(KEY_TOUID);
        img=data.getString(KEY_IMG);
        name=data.getString(KEY_NAME);
        user_type=data.getString(KEY_USER_TYPE);
        title=data.getString(KEY_TITLE);
    }

    @Override
    protected JSONObject packData() {
        JSONObject data = new JSONObject();
        data.put(KEY_TOUID,to_uid);
        data.put(KEY_IMG,img);
        data.put(KEY_NAME,name);
        data.put(KEY_USER_TYPE,user_type);
        data.put(KEY_TITLE,title);
        return data;
    }

    public String getTouid() {
        return to_uid;
    }

    public String getImg() {
        return img;
    }

    public String getName() {
        return name;
    }

    public String getUser_type() {
        return user_type;
    }

    public String getTitle() {
        return title;
    }
}