コード例 #1
0
        public OutAPIResult GameUserLogin_WX(GameModel.EUserInfo wxUser)
        {
            NLogHelper.GameInfo("Login_WX In");
            if (Request.Method.Method.ToLower() == "options")
            {
                return(null);
            }

            OutAPIResult result = new OutAPIResult();

            try
            {
                using (GameContent db = new GameContent())
                {
                    var user = db.DBUserInfo.Where(a => a.openId == wxUser.openId).FirstOrDefault();
                    if (user == null)
                    {
                        result = GameUserRegister_WX(wxUser);
                    }
                    else
                    {
                        user.LastLogin = DateTime.Now;
                        user.LoginCount++;
                        db.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                result.ErrorMsg = ex.Message;
            }
            return(result);
        }