package com.ssj.service.sys.push.service.task;

import com.ssj.push.util.jiguang.MessagePushUtils;
import com.ssj.taskthread.Task;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

/**
 * @author yangcan
 * 类描述:腾讯信鸽异步推送IOS端线程
 * 创建时间:2018年5月15日 下午5:06:36

 */
public class XingeIosPushThreadTask extends Task{
	
	private String content; //推送内容
	private String iosToken; //信鸽token ios端
	private int platformType;//1:贝壳端 2:家长端 3:学生端 4:老师端 5:校长端
	private String sound; //推送声音
	private Map<String,Object> custom;//ios自定义下发的参数
	private int iosEnv = 2;//ios生产环境IOSENV_PROD = 1,ios开发环境 IOSENV_DEV = 2
    private int bagde = 0;//ios_app推送设置角标
	
	public XingeIosPushThreadTask(String content, String iosToken, int platformType,String sound,Map<String,Object> custom,int iosEnv,int bagde) {
		super();
		this.content = content;
		this.iosToken = iosToken;
		this.platformType = platformType;
		this.sound = sound;
		this.custom = custom;
		this.iosEnv = iosEnv;
        this.bagde = bagde;
	}

	public void run() {
		logger.error("信鸽异步开始推送IOS---------------");
		try {
			if(StringUtils.isNotBlank(iosToken)) {
				MessagePushUtils.pushByIos(iosToken, content, platformType,sound,custom,iosEnv,bagde);
			}
		}catch (Exception e) {
			logger.error("腾讯信鸽推送IOS异常...");
		}
		logger.error(Thread.currentThread().getName()+"信鸽异步结束推送IOS---------------");
	}
}
