public string _getWinPlayId(string play_id, string type, string year, int uid) { string sql = "SELECT play_id FROM game_record_win_" + type + "_" + year + " WHERE play_id = @play_id and uid = @uid"; try { SqlDataBase db = new SqlDataBase(); string rs = db.Single <string>(sql, new { play_id = play_id, uid = uid }); return(rs); } catch (Exception) { return(null); } }
public UserAccount getUserInfoById(int userId) { string sql = @"SELECT *, case when DATEDIFF(day, addtime, getdate())> isnull((select top 1 value from rrl_config where item = 'NewUser_Confirm_Days'),7) then '0' ELSE '1' end as is_news_user FROM rrl_user WHERE id = @id"; try { SqlDataBase db = new SqlDataBase(); UserAccount user = db.Single <UserAccount>(sql, new { id = userId }); return(user); } catch (Exception) { return(null); } }
public UserAccount getUserInfoByToken(string token) { if (string.IsNullOrEmpty(token) || "null" == token || "undefined" == token) { return(null); } int userId = UserTokenUtils.getIdByTokenString(token); string sql = @"SELECT *, case when DATEDIFF(day, addtime, getdate())> isnull((select top 1 value from rrl_config where item = 'NewUser_Confirm_Days'),7) then '0' ELSE '1' end as is_news_user FROM rrl_user WHERE id = @id"; try { SqlDataBase db = new SqlDataBase(); UserAccount user = db.Single <UserAccount>(sql, new { id = userId }); return(user); } catch (Exception) { return(null); } /* * string sql = "SELECT * FROM rrl_user WHERE short_time_token = @token"; * try * { * SqlDataBase db = new SqlDataBase(); * UserAccount user = db.Single<UserAccount>(sql, new { token = token }); * return user; * } * catch (Exception) * { * * return null; * } */ }