mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-04-21 11:29:34 +08:00
更新csb
This commit is contained in:
parent
a96dd0f7b1
commit
9fada0e811
@ -275,21 +275,24 @@ namespace Oshima.FunGame.OshimaServers
|
||||
try
|
||||
{
|
||||
long qq = Controller.JSON.GetObject<long>(data, "qq");
|
||||
long groupid = Controller.JSON.GetObject<long>(data, "groupid");
|
||||
double sc = Controller.JSON.GetObject<double>(data, "sc");
|
||||
sql.NewTransaction();
|
||||
sql.Script = "select * from saints where qq = @qq";
|
||||
sql.Script = "select * from saints where qq = @qq and `group` = @group";
|
||||
sql.Parameters.Add("qq", qq);
|
||||
sql.Parameters.Add("group", groupid);
|
||||
sql.ExecuteDataSet();
|
||||
sql.Parameters.Add("sc", sc);
|
||||
sql.Parameters.Add("qq", qq);
|
||||
if (sql.Success)
|
||||
{
|
||||
sql.Script = "update saints set sc = sc + @sc where qq = @qq";
|
||||
sql.Script = "update saints set sc = sc + @sc where qq = @qq and `group` = @group";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql.Script = "insert into saints(qq, sc) values(@qq, @sc)";
|
||||
sql.Script = "insert into saints(qq, sc, `group`) values(@qq, @sc, @group)";
|
||||
}
|
||||
sql.Parameters.Add("sc", sc);
|
||||
sql.Parameters.Add("qq", qq);
|
||||
sql.Parameters.Add("group", groupid);
|
||||
sql.Execute();
|
||||
if (sql.Success)
|
||||
{
|
||||
@ -314,14 +317,25 @@ namespace Oshima.FunGame.OshimaServers
|
||||
|
||||
public string SCList(Dictionary<string, object> data)
|
||||
{
|
||||
string result = $"☆--- OSMTV 圣人排行榜 TOP10 ---☆\r\n统计时间:{DateTime.Now.ToString(General.GeneralDateTimeFormatChinese)}\r\n";
|
||||
string result = "";
|
||||
|
||||
SQLHelper? sql = Controller.SQLHelper;
|
||||
if (sql != null)
|
||||
{
|
||||
long userQQ = Controller.JSON.GetObject<long>(data, "qq");
|
||||
(bool userHas, double userSC, int userTop, string userRemark) = (false, 0, 0, "");
|
||||
sql.Script = "select * from saints order by sc desc";
|
||||
long groupid = Controller.JSON.GetObject<long>(data, "groupid");
|
||||
bool reverse = Controller.JSON.GetObject<bool>(data, "reverse");
|
||||
if (!reverse)
|
||||
{
|
||||
result = $"☆--- OSMTV 圣人排行榜 TOP10 ---☆\r\n统计时间:{DateTime.Now.ToString(General.GeneralDateTimeFormatChinese)}\r\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = $"☆--- OSMTV 出生排行榜 TOP10 ---☆\r\n统计时间:{DateTime.Now.ToString(General.GeneralDateTimeFormatChinese)}\r\n";
|
||||
}
|
||||
sql.Script = "select * from saints where `group` = @group order by sc" + (!reverse ? " desc" : "");
|
||||
sql.Parameters.Add("group", groupid);
|
||||
sql.ExecuteDataSet();
|
||||
if (sql.Success && sql.DataSet.Tables.Count > 0)
|
||||
{
|
||||
@ -332,6 +346,11 @@ namespace Oshima.FunGame.OshimaServers
|
||||
long qq = Convert.ToInt64(dr["qq"]);
|
||||
double sc = Convert.ToDouble(dr["sc"]);
|
||||
string remark = Convert.ToString(dr["remark"]) ?? "";
|
||||
if (reverse)
|
||||
{
|
||||
sc = -sc;
|
||||
remark = remark.Replace("+", "-");
|
||||
}
|
||||
if (qq == userQQ)
|
||||
{
|
||||
userHas = true;
|
||||
@ -340,14 +359,37 @@ namespace Oshima.FunGame.OshimaServers
|
||||
userRemark = remark;
|
||||
}
|
||||
if (count > 10) continue;
|
||||
if (!reverse)
|
||||
{
|
||||
result += $"{count}. 用户:{qq},圣人点数:{sc} 分{(remark.Trim() != "" ? $" ({remark})" : "")}\r\n";
|
||||
}
|
||||
if (userHas)
|
||||
else
|
||||
{
|
||||
result += $"你的圣人点数为:{userSC} 分{(userRemark.Trim() != "" ? $"({userRemark})" : "")},排在第 {userTop} / {sql.DataSet.Tables[0].Rows.Count} 名。";
|
||||
result += $"{count}. 用户:{qq},出生点数:{sc} 分{(remark.Trim() != "" ? $" ({remark})" : "")}\r\n";
|
||||
}
|
||||
}
|
||||
if (!reverse && userHas)
|
||||
{
|
||||
result += $"你的圣人点数为:{userSC} 分{(userRemark.Trim() != "" ? $"({userRemark})" : "")},排在第 {userTop} / {sql.DataSet.Tables[0].Rows.Count} 名。\r\n" +
|
||||
$"本排行榜仅供娱乐,不代表任何官方立场或真实情况";
|
||||
}
|
||||
if (reverse && userHas)
|
||||
{
|
||||
result += $"你的出生点数为:{userSC} 分{(userRemark.Trim() != "" ? $"({userRemark})" : "")},排在出生榜第 {userTop} / {sql.DataSet.Tables[0].Rows.Count} 名。\r\n" +
|
||||
$"本排行榜仅供娱乐,不代表任何官方立场或真实情况";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (reverse)
|
||||
{
|
||||
result = "出生榜目前没有任何数据。";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "圣人榜目前没有任何数据。";
|
||||
}
|
||||
}
|
||||
else result = "圣人榜目前没有任何数据。";
|
||||
}
|
||||
else result = "无法调用此接口:SQL 服务不可用。";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user