package com.ruoyi.demo.entity.vo;


import com.ruoyi.demo.constant.ChannelMapContant;
import com.ruoyi.demo.utils.HashUtil;
import lombok.Data;

import java.io.Serializable;

@Data
public class ChannelAnalyseAceeptVo implements Serializable {
    String[] channel;

    String searchText;

    /*
     * 分页字段（list、point接口）
     * */
    int pageNum = 1;
    int pageSize = 10;

    public String[] getChannel() {
        if(this.channel == null || this.channel.length == 0){
            return channel = ChannelMapContant.FULL_CHANNEL;
        }
        return channel;
    }

    public String getHash(){
        StringBuilder stringBuilder = new StringBuilder();

        //搜索渠道
        for (String s : getChannel()) {
            stringBuilder.append(s);
        }
        //搜索文本
        stringBuilder.append(this.searchText);

        stringBuilder.append(pageNum);
        stringBuilder.append(pageSize);

        //生成Hash
        String s = stringBuilder.toString();
        String md5 = HashUtil.hash(s, "MD5");

        return md5;
    }
}
