检查静态数据与视图差额

parent e3eed673
...@@ -39,17 +39,36 @@ public void FreezeAllotSync(int allotId) ...@@ -39,17 +39,36 @@ public void FreezeAllotSync(int allotId)
/// <returns></returns> /// <returns></returns>
public void FreezeAllot(int allotId) public void FreezeAllot(int allotId)
{ {
using (var connection = new MySqlConnection(_options.Value.PerformanceConnectionString)) try
{ {
if (connection.State != ConnectionState.Open) connection.Open(); int i = 0;
try do
{
HanderFreeze(allotId);
i++;
} while (QueryDiff(allotId) < -50 && i <= 3);
}
catch
{
}
void HanderFreeze(int allotId)
{
using (var connection = new MySqlConnection(_options.Value.PerformanceConnectionString))
{ {
if (connection.State != ConnectionState.Open) connection.Open();
string sql = $@"call proc_freeze_allot({allotId})"; string sql = $@"call proc_freeze_allot({allotId})";
connection.Execute(sql, commandTimeout: 60 * 60); connection.Execute(sql, commandTimeout: 60 * 60);
} }
catch (Exception) }
decimal QueryDiff(int allotId)
{
using (var connection = new MySqlConnection(_options.Value.PerformanceConnectionString))
{ {
throw; if (connection.State != ConnectionState.Open) connection.Open();
string sql = $@"SELECT Diff FROM view_allot_result_diff WHERE AllotID = @allotId LIMIT 1";
return connection.QuerySingle<decimal>(sql, new { allotId }, commandTimeout: 60 * 60);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment