package cn.qinys.platform.upms.api.resp;

import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * Description:
 *
 * @author tanlie
 * Date: 2024/7/26 17:06
 */
@Data
public class SmsLogPageResp implements Serializable {


    private Integer id;
    /**
     * 手机号
     */
    private String mobile;
    /**
     * 发送内容
     */
    private String content;
    /**
     * 发送结果
     */
    private String result;


    private LocalDateTime createTime;


    private LocalDateTime updateTime;


    private String tenantId;


    public String getMobile() {
        if (!mobile.contains(",")) {
            return mobile.replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2");
        }
        String[] mobiles = mobile.split(",");
        StringBuilder sb = new StringBuilder();
        for (String s : mobiles) {
            sb.append(s.replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2")).append(",");
        }
        String str = sb.toString();
        return str.substring(0, str.length() - 1);
    }

}
