检查静态数据与视图差额

parent e3eed673
......@@ -39,17 +39,36 @@ public void FreezeAllotSync(int allotId)
/// <returns></returns>
public void FreezeAllot(int allotId)
{
try
{
int i = 0;
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();
try
{
string sql = $@"call proc_freeze_allot({allotId})";
connection.Execute(sql, commandTimeout: 60 * 60);
}
catch (Exception)
}
decimal QueryDiff(int allotId)
{
throw;
using (var connection = new MySqlConnection(_options.Value.PerformanceConnectionString))
{
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