CustomAttachmentShareMsg.java 2.5 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
package com.yidianling.im.session.extension;

import com.alibaba.fastjson.JSONObject;
import com.yidianling.im.session.enums.ShareMsgTypeEnum;

/**
 * Created by haorui on 2019-11-06 .
 * Des: 分享消息 拓展
 */
public class CustomAttachmentShareMsg extends CustomAttachment {

    private final String KEY_SHARETYPE="shareType";// 分享的类型,0:测试;1,课程;2,文章;3:倾诉
    private final String KEY_SHAREPICURL="sharePicUrl";// 分享的图片
    private final String KEY_SHARETITLE="shareTitle";// 分享的title
    private final String KEY_SHAREAUTHOR="shareAuthor";// 分享的作者
    private final String KEY_SHAREREADED="shareReaded";// 分享的阅读数
    private final String KEY_SHARETESTED="shareTested";// 分享的测试数
    private final String KEY_PRICE="price";// 价格
    private final String KEY_THEWAY="theWay";// 方式
    private final String KEY_DURATION="duration";// 时长
    private final String KEY_SHAREPOPULAR="sharePopular";// 分享的人气
    private final String KEY_SHARE_JUMP_URL="url";// 分享的跳转链接

24 25 26
    private final String KEY_CONFIDEDID="confidedId";//倾诉id
    private final String KEY_DOCTORID="doctorId";

konghaorui committed
27 28 29 30 31
    private String shareUrl;
    private String sharePrice;
    //分享类型,0:测试;1,课程;2,文章;3:倾诉
    private int shareType;

32 33 34
    private String confidedId;
    private String doctorId;

konghaorui committed
35 36 37 38 39 40 41 42 43 44
    public CustomAttachmentShareMsg() {
        super(CustomAttachmentType.TYPE_PUSH_SHARE);
    }


    @Override
    protected void parseData(JSONObject data) {
        this.shareUrl=data.getString(KEY_SHARE_JUMP_URL);
        this.sharePrice =data.getString(KEY_PRICE);
        this.shareType = data.getInteger(KEY_SHARETYPE);
45 46
        this.confidedId = data.getString(KEY_CONFIDEDID);
        this.doctorId = data.getString(KEY_DOCTORID);
konghaorui committed
47 48 49 50 51 52 53 54
    }

    @Override
    protected JSONObject packData() {
        JSONObject data = new JSONObject();
        data.put(KEY_SHARE_JUMP_URL, shareUrl);
        data.put(KEY_PRICE, sharePrice);
        data.put(KEY_SHARETYPE, shareType);
55 56
        data.put(KEY_CONFIDEDID, confidedId);
        data.put(KEY_DOCTORID, doctorId);
konghaorui committed
57 58 59 60 61 62 63 64 65 66 67 68 69 70
        return data;
    }

    public String getShareUrl() {
        return shareUrl;
    }

    public String getSharePrice() {
        return sharePrice;
    }

    public int getShareType() {
        return shareType;
    }
71 72 73 74 75 76 77
    public String getConfidedId() {
        return confidedId;
    }

    public String getDoctorId() {
        return doctorId;
    }
konghaorui committed
78
}