package com.cyksj.common.util;

import cn.hutool.core.util.StrUtil;

/**
 * 项目名: yhlxj2
 * 文件名: TicketCodeCommonUtil
 * 创建者: JavaZou
 * 创建时间:2024/5/24 15:31
 */

public class TicketCodeCommonUtil {
	/**
	 * 车票邮箱验证码
	 */
	public static String getTicketCodeStr(String body, Long goodsId) {
		if (StrUtil.isEmpty(body)) {
			return body;
		}
		String str = null;
		if (goodsId == 33l) {
			str = "color:#505050; font-family:adobe-clean, Helvetica Neue, Helvetica, Verdana, Arial, sans-serif;";
		}
		if (goodsId == 3l) {
			str = "letter-spacing:4px; line-height:38px; mso-line-height-rule: exactly";
		}
		if (StrUtil.isEmpty(str)) {
			return str;
		}
		int index = body.indexOf(str);
		if (index == -1) {
			if (goodsId == 33l) {
				str = "X-Report-Abuse: abuse@adobe.com";
			}
			index = body.indexOf(str);
		}
		String code = StrUtil.subWithLength(body, index, 512);
		if (StrUtil.isNotBlank(code)) {
			code = code.replace(str, "");
		}
		return code;
	}
}
