package com.backfire.doudizhu.lobby;

import java.util.HashMap;

import android.content.Context;

import com.backfire.doudizhu.common.APNUtil;
import com.backfire.doudizhu.userinfo.UserMessageCenter;
import com.umeng.analytics.MobclickAgent;
/*
 * 添加友盟统计
 */
public class AddStatistics {
	/*
	 * 登录失败统计
	 */
	public static void addLoginFailedStatistics(Context context,String retMsg){
		HashMap<String, String> purchase= new HashMap<String, String>();
		purchase.put("version", UserMessageCenter.getInstance().version);
		purchase.put("genSn", UserMessageCenter.getInstance().genSn);
		purchase.put("phoneSn", UserMessageCenter.getInstance().phoneSn);
		purchase.put("apn", APNUtil.getApnName(context));
		purchase.put("msg", retMsg);
		MobclickAgent.onEvent(context, "LOGIN_FAILED", purchase);
	}
	/*
	 * 支付失败统计
	 */
	public static void addCanNotPayStatistics(Context context,String msg){
		HashMap<String, String> purchase= new HashMap<String, String>();
		purchase.put("version", UserMessageCenter.getInstance().version);
		purchase.put("uid", UserMessageCenter.getInstance().getUserInfo().getUid()+"");
		purchase.put("apn", APNUtil.getApnName(context));
		purchase.put("msg", msg);
		MobclickAgent.onEvent(context, "Can_Not_Pay", purchase);
	}
	/*
	 * 升级失败统计
	 */
	public static void addUpgradeFailedStatistics(Context context,String retMsg){
		HashMap<String, String> purchase= new HashMap<String, String>();
		purchase.put("version", UserMessageCenter.getInstance().version);
		purchase.put("genSn", UserMessageCenter.getInstance().genSn);
		purchase.put("phoneSn", UserMessageCenter.getInstance().phoneSn);
		purchase.put("apn", APNUtil.getApnName(context));
		purchase.put("msg", retMsg);
		MobclickAgent.onEvent(context, "UPGRADE_FAILED", purchase);
	}
	/*
	 * 进入房间失败失败统计
	 */
	public static void addEnterRoomFailedStatistics(Context context,String retMsg){
		HashMap<String, String> purchase= new HashMap<String, String>();
		purchase.put("version", UserMessageCenter.getInstance().version);
		purchase.put("uid", UserMessageCenter.getInstance().getUserInfo().getUid()+"");
		purchase.put("apn", APNUtil.getApnName(context));
		purchase.put("msg", retMsg);
		MobclickAgent.onEvent(context, "ENTER_ROOM_FAILED", purchase);
	}
	/*
	 * 获取房间列表失败统计
	 */
	public static void addGetTableTypeFailedStatistics(Context context,String retMsg){
		HashMap<String, String> purchase= new HashMap<String, String>();
		purchase.put("version", UserMessageCenter.getInstance().version);
		purchase.put("uid", UserMessageCenter.getInstance().getUserInfo().getUid()+"");
		purchase.put("apn", APNUtil.getApnName(context));
		purchase.put("msg", retMsg);
		MobclickAgent.onEvent(context, "GET_TABLE_TYPE_FAILED", purchase);
	}
	/*
	 *支付成功统计
	 */
	public static void addPaySuccessStatistics(Context context,int times){
		HashMap<String, String> purchase= new HashMap<String, String>();
		purchase.put("version", UserMessageCenter.getInstance().version);
		purchase.put("uid", UserMessageCenter.getInstance().getUserInfo().getUid()+"");
		purchase.put("apn", APNUtil.getApnName(context));
		purchase.put("msg", "发货成功："+times);
		MobclickAgent.onEvent(context, "PAY_SUCCESS", purchase);
	}
	/*
	 * 亮牌失败统计
	 */
	public static void addLookFailedStatistics(Context context){
		HashMap<String, String> purchase= new HashMap<String, String>();
		purchase.put("version", UserMessageCenter.getInstance().version);
		purchase.put("uid", UserMessageCenter.getInstance().getUserInfo().getUid()+"");
		purchase.put("apn", APNUtil.getApnName(context));
		MobclickAgent.onEvent(context, "LOOK_CARD_FAILED", purchase);
	}
}
