Commit fab7fbdd by jianshuqin

新增功能:新开了3个站点shopify的广告费

parent 5dc3bb15
......@@ -59,7 +59,7 @@ namespace Bailun.DC.SyncShopifyFee
if (!btime.HasValue)
{
btime = DateTime.Now.AddHours(-2);
btime = this.GetBtime(websiteUrl.Key);
}
if (!etime.HasValue)
{
......@@ -92,7 +92,7 @@ namespace Bailun.DC.SyncShopifyFee
}
}
public void Save(string website, IList<response_shopify_fee> list)
private void Save(string website, IList<response_shopify_fee> list)
{
int updateCount = 0;
int insertCount = 0;
......@@ -122,5 +122,22 @@ namespace Bailun.DC.SyncShopifyFee
Console.WriteLine($"同步{website}shopify广告费新增{insertCount}条数据,更新{updateCount}条数据");
}
}
private DateTime GetBtime(string website)
{
DateTime btime = DateTime.Now.AddHours(-2);
using (var db = new MySqlConnection(Common.GlobalConfig.ConnectionString_Data))
{
if (db.State == System.Data.ConnectionState.Closed)
{
db.Open();
}
string sql = "select DATE_FORMAT(max(ts),'%Y-%m-%d %H:00:00') from dc_base_finance_shopify_fee where website = @website";
btime = db.QueryFirstOrDefault<DateTime?>(sql, new { website = website }) ?? DateTime.Now.AddHours(-2);
Console.WriteLine($"同步{website}的shopify广告费开始时间为{ btime.ToString("yyyy-MM-dd HH:mm:ss")}");
}
return btime;
}
}
}
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