Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bltdc
DataCenter_Core2.1_20190520
Commits
13ffa463
Commit
13ffa463
authored
Dec 03, 2019
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加汇率接口
parent
d7b137e4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
18 deletions
+76
-18
dc_exchange_rate.cs
Bailun.DC.Models/dc_exchange_rate.cs
+20
-0
CommonServices.cs
Bailun.DC.Services/CommonServices.cs
+18
-0
Program.cs
Bailun.DC.SkuDailyPurchaseAndSales/Program.cs
+18
-18
ApiController.cs
Bailun.DC.Web/Controllers/ApiController.cs
+20
-0
No files found.
Bailun.DC.Models/dc_exchange_rate.cs
0 → 100644
View file @
13ffa463
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.DC.Models
{
public
class
dc_exchange_rate
{
public
int
id
{
get
;
set
;
}
public
string
init_curreny
{
get
;
set
;
}
public
string
final_curreny
{
get
;
set
;
}
public
decimal
exchange_rate
{
get
;
set
;
}
public
DateTime
record_time
{
get
;
set
;
}
}
}
Bailun.DC.Services/CommonServices.cs
View file @
13ffa463
...
...
@@ -414,6 +414,24 @@ namespace Bailun.DC.Services
return
list
;
}
/// <summary>
/// 获取每日汇率
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
public
List
<
dc_exchange_rate
>
ListDateExchangeRate
(
DateTime
date
)
{
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
var
obj
=
cn
.
Query
<
dc_exchange_rate
>(
"select * from dc_exchange_rate where record_time='"
+
date
.
ToString
(
"yyyy-MM-dd"
)
+
"'"
).
ToList
();
return
obj
;
}
}
}
#
region
汇率实体
ExchangeRate
...
...
Bailun.DC.SkuDailyPurchaseAndSales/Program.cs
View file @
13ffa463
...
...
@@ -7,27 +7,27 @@ namespace Bailun.DC.SkuDailyPurchaseAndSales
{
class
Program
{
static
async
Task
Main
(
string
[]
args
)
{
Console
.
WriteLine
(
"进入保存每日采购数和售出数"
);
var
builder
=
new
HostBuilder
().
ConfigureServices
((
hostContext
,
services
)
=>
{
services
.
AddHostedService
<
Services
>();
});
await
builder
.
RunConsoleAsync
();
}
//static void Main(string[] args)
//static async Task Main(string[] args)
//{
//
var start = DateTime.Parse("2019-11-18
");
//
while (start.AddDays(1) < DateTime.Now)
//
Console.WriteLine("进入保存每日采购数和售出数
");
//
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
// {
//
Console.WriteLine(start.ToString("yyyy-MM-dd")
);
//
new Services().Init(start, start.AddDays(1)
);
// start = start.AddDays(1);
//
}
//
services.AddHostedService<Services>(
);
//
}
);
//
await builder.RunConsoleAsync();
//}
static
void
Main
(
string
[]
args
)
{
var
start
=
DateTime
.
Parse
(
"2019-11-24"
);
while
(
start
.
AddDays
(
1
)
<
DateTime
.
Now
)
{
Console
.
WriteLine
(
start
.
ToString
(
"yyyy-MM-dd"
));
new
Services
().
Init
(
start
,
start
.
AddDays
(
1
));
start
=
start
.
AddDays
(
1
);
}
}
}
}
Bailun.DC.Web/Controllers/ApiController.cs
View file @
13ffa463
...
...
@@ -571,6 +571,25 @@ namespace Bailun.DC.Web.Controllers
}
}
/// <summary>
/// 获取每日汇率
/// </summary>
/// <param name="date">日期</param>
/// <returns></returns>
[
HttpPost
]
public
JsonResult
DailyExchangeRate
(
DateTime
date
)
{
var
obj
=
new
Services
.
CommonServices
().
ListDateExchangeRate
(
date
);
return
Json
(
new
{
success
=
true
,
data
=
obj
.
Select
(
a
=>
new
{
record_time
=
a
.
record_time
.
ToString
(
"yyyy-MM-dd"
),
a
.
init_curreny
,
a
.
final_curreny
,
a
.
exchange_rate
,
})
});
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment