using MrWu.Debug;
using ObjectModel.Game;
using Server.DB.Sql;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MrWu.DB;

namespace GameDAL.Game
{
    /// <summary>
    /// 玩家对战统计
    /// </summary>
    public class UserWarDataDal
    {
        /// <summary>
        /// 数据库
        /// </summary>
        const dbbase SQLDB = dbbase.game2018;

        private const string Fun_SaveUserWarData = "SaveUserWarData";

        public static Task<bool> SaveUserWarDataAsync(UserWarDataModel model)
        {
            return Task.Run(() => SaveUserWarData(model));
        }

        public static bool SaveUserWarData(UserWarDataModel model)
        {
            try
            {
                
            
                return true;
            }
            catch (Exception e)
            {
                Debug.Error($"出错:{e.Message}");
                return false;
            }
        }

        public static Task<UserWarDataModel> GetUserWarDataAsync(int userid,int gameid)
        {
            return Task.Run(() => GetUserWarData(userid, gameid));
        }

        /// <summary>
        /// 获取玩家的对战数据
        /// </summary>
        /// <param name="userid">userid</param>
        /// <param name="gameId">游戏ID</param>
        /// <returns></returns>
        public static UserWarDataModel GetUserWarData(int userid, int gameId) {
            //UserWarDataModel result = null;
            try
            {
                return UserWarDataModel.Create(userid,gameId);
            }
            catch (Exception e) {
                Debug.Error($"获取玩家的对战数据出错 msg:{e.Message},code:{e.StackTrace}");
            }
            return null; 
        }
    }
}
