Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
freemud.be.toolbox
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈宁
freemud.be.toolbox
Commits
b1b2a201
Commit
b1b2a201
authored
Mar 26, 2021
by
陈宁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
# dev
parent
7f585515
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
526 additions
and
38 deletions
+526
-38
Freemud.BE.Toolbox.Testing/GeneralTest.cs
+12
-0
Freemud.BE.Toolbox.WebApi/Infrastructure/Helpers/HttpHeper.cs
+32
-0
Freemud.BE.Toolbox.WebApi/Model/Request/GetProductInfoRequest.cs
+10
-2
Freemud.BE.Toolbox.WebApi/Model/Request/GetSubEquityCardListRequest.cs
+62
-0
Freemud.BE.Toolbox.WebApi/Model/Response/FreemudACT/FreemudACTResponse.cs
+29
-0
Freemud.BE.Toolbox.WebApi/Model/Response/FreemudACT/GetSubEquityCardListResponse.cs
+26
-0
Freemud.BE.Toolbox.WebApi/Model/Response/FreemudPUS/FreemudPUSResponse.cs
+29
-0
Freemud.BE.Toolbox.WebApi/Model/Response/FreemudPUS/GetEquityCardCouponPackageListResponse.cs
+9
-0
Freemud.BE.Toolbox.WebApi/Model/Response/FreemudPUS/GetEquityCardCouponPackageResponse.cs
+57
-0
Freemud.BE.Toolbox.WebApi/Model/Response/RequestResourceResponse.cs
+11
-0
Freemud.BE.Toolbox.WebApi/Model/Response/UserCardAdapter.cs
+8
-5
Freemud.BE.Toolbox.WebApi/Program.cs
+2
-0
Freemud.BE.Toolbox.WebApi/Proxy/BaseProxy.cs
+5
-2
Freemud.BE.Toolbox.WebApi/Proxy/FmActProxy.cs
+54
-0
Freemud.BE.Toolbox.WebApi/Proxy/FmCouponProxy.cs
+2
-1
Freemud.BE.Toolbox.WebApi/Proxy/FmProductProxy.cs
+3
-2
Freemud.BE.Toolbox.WebApi/Proxy/FmPusProxy.cs
+59
-0
Freemud.BE.Toolbox.WebApi/Proxy/FmStoreProxy.cs
+2
-1
Freemud.BE.Toolbox.WebApi/Services/Impl/RequestResourceService.cs
+78
-18
Freemud.BE.Toolbox.WebApi/Startup.cs
+4
-6
Freemud.BE.Toolbox.WebApi/appsettings.json
+31
-0
freemud.be.toolboxview.antdv/src/views/UserCoupons.vue
+1
-1
No files found.
Freemud.BE.Toolbox.Testing/GeneralTest.cs
View file @
b1b2a201
...
@@ -331,6 +331,18 @@ namespace Freemud.BE.Toolbox.Testing
...
@@ -331,6 +331,18 @@ namespace Freemud.BE.Toolbox.Testing
DateTime
startTime
=
TimeZone
.
CurrentTimeZone
.
ToLocalTime
(
new
DateTime
(
1970
,
1
,
1
));
DateTime
startTime
=
TimeZone
.
CurrentTimeZone
.
ToLocalTime
(
new
DateTime
(
1970
,
1
,
1
));
return
(
long
)(
input
-
startTime
).
TotalMilliseconds
;
return
(
long
)(
input
-
startTime
).
TotalMilliseconds
;
}
}
[
TestMethod
]
public
void
aslkdjalskjdoiqwjd
()
{
var
names
=
new
List
<
string
>
{
"A"
,
"B"
,
"C"
};
for
(
int
i
=
names
.
Count
-
1
;
i
>=
0
;
i
--)
{
Console
.
WriteLine
(
$"i:
{
i
}
names:
{
names
[
i
]}
"
);
names
.
Add
(
"D"
);
}
}
}
}
public
class
Customer
:
Person
public
class
Customer
:
Person
...
...
Freemud.BE.Toolbox.WebApi/Infrastructure/Helpers/HttpHeper.cs
View file @
b1b2a201
...
@@ -16,6 +16,12 @@ namespace Freemud.BE.Toolbox.WebApi.Infrastructure.Helpers
...
@@ -16,6 +16,12 @@ namespace Freemud.BE.Toolbox.WebApi.Infrastructure.Helpers
public
static
async
Task
<
IRestResponse
>
Post
(
string
url
,
Dictionary
<
string
,
object
>
headers
=
null
,
Dictionary
<
string
,
object
>
queries
=
null
,
object
jsonBody
=
null
)
public
static
async
Task
<
IRestResponse
>
Post
(
string
url
,
Dictionary
<
string
,
object
>
headers
=
null
,
Dictionary
<
string
,
object
>
queries
=
null
,
object
jsonBody
=
null
)
=>
await
ExecuteAsync
(
url
,
Method
.
POST
,
headers
,
queries
,
jsonBody
);
=>
await
ExecuteAsync
(
url
,
Method
.
POST
,
headers
,
queries
,
jsonBody
);
public
static
async
Task
<
IRestResponse
<
T
>>
Get
<
T
>(
string
url
,
Dictionary
<
string
,
object
>
headers
=
null
,
Dictionary
<
string
,
object
>
queries
=
null
)
=>
await
ExecuteAsync
<
T
>(
url
,
Method
.
GET
,
headers
,
queries
,
null
);
public
static
async
Task
<
IRestResponse
<
T
>>
Post
<
T
>(
string
url
,
Dictionary
<
string
,
object
>
headers
=
null
,
Dictionary
<
string
,
object
>
queries
=
null
,
object
jsonBody
=
null
)
=>
await
ExecuteAsync
<
T
>(
url
,
Method
.
POST
,
headers
,
queries
,
jsonBody
);
private
static
async
Task
<
IRestResponse
>
ExecuteAsync
(
string
url
,
Method
method
,
Dictionary
<
string
,
object
>
headers
=
null
,
Dictionary
<
string
,
object
>
queries
=
null
,
object
jsonBody
=
null
)
private
static
async
Task
<
IRestResponse
>
ExecuteAsync
(
string
url
,
Method
method
,
Dictionary
<
string
,
object
>
headers
=
null
,
Dictionary
<
string
,
object
>
queries
=
null
,
object
jsonBody
=
null
)
{
{
var
client
=
new
RestClient
();
var
client
=
new
RestClient
();
...
@@ -41,5 +47,31 @@ namespace Freemud.BE.Toolbox.WebApi.Infrastructure.Helpers
...
@@ -41,5 +47,31 @@ namespace Freemud.BE.Toolbox.WebApi.Infrastructure.Helpers
return
response
;
return
response
;
}
}
private
static
async
Task
<
IRestResponse
<
T
>>
ExecuteAsync
<
T
>(
string
url
,
Method
method
,
Dictionary
<
string
,
object
>
headers
=
null
,
Dictionary
<
string
,
object
>
queries
=
null
,
object
jsonBody
=
null
)
{
var
client
=
new
RestClient
();
var
request
=
new
RestRequest
(
url
,
method
);
foreach
(
var
h
in
headers
??
new
Dictionary
<
string
,
object
>())
request
.
AddHeader
(
h
.
Key
,
h
.
Value
.
ToString
().
Trim
());
foreach
(
var
p
in
queries
??
new
Dictionary
<
string
,
object
>())
request
.
AddQueryParameter
(
p
.
Key
,
p
.
Value
.
ToString
().
Trim
());
if
(
jsonBody
!=
null
)
request
.
AddJsonBody
(
jsonBody
);
Log
.
Information
(
$"url:
{
url
}
"
);
Log
.
Information
(
$"header:
{
JsonConvert
.
SerializeObject
(
headers
)}
"
);
Log
.
Information
(
$"query:
{
JsonConvert
.
SerializeObject
(
queries
)}
"
);
Log
.
Information
(
$"data:
{
JsonConvert
.
SerializeObject
(
jsonBody
)}
"
);
var
response
=
await
client
.
ExecuteAsync
<
T
>(
request
);
Log
.
Information
(
$"response:
{
response
.
Content
}
"
);
return
response
;
}
}
}
}
}
Freemud.BE.Toolbox.WebApi/Model/Request/GetProductInfoRequest.cs
View file @
b1b2a201
...
@@ -7,13 +7,21 @@ namespace Freemud.BE.Toolbox.WebApi.Model.Request
...
@@ -7,13 +7,21 @@ namespace Freemud.BE.Toolbox.WebApi.Model.Request
{
{
public
class
GetProductInfoRequest
:
BaseRequestResourceRequest
public
class
GetProductInfoRequest
:
BaseRequestResourceRequest
{
{
/// <summary>
/// 商品编号
/// </summary>
public
List
<
string
>
ProductId
{
get
;
set
;
}
public
List
<
string
>
ProductId
{
get
;
set
;
}
/// <summary>
/// 门店号
/// </summary>
public
string
StoreId
{
get
;
set
;
}
public
string
StoreId
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 时间; eg: 12:34:56
/// 时间; eg: 12:34:56
/// </summary>
/// </summary>
public
string
Time
{
get
;
set
;
}
public
string
Time
{
get
;
set
;
}
/// <summary>
/// 是否包含套餐子商品
/// </summary>
public
bool
IncludeGroupDetails
{
get
;
set
;
}
}
}
}
}
Freemud.BE.Toolbox.WebApi/Model/Request/GetSubEquityCardListRequest.cs
0 → 100644
View file @
b1b2a201
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
Freemud.BE.Toolbox.WebApi.Model.Request
{
public
class
GetSubEquityCardListRequest
:
BaseRequestResourceRequest
{
/// <summary>
/// cardId
/// </summary>
public
string
CardId
{
get
;
set
;
}
/// <summary>
/// couponCode
/// </summary>
public
string
CouponCode
{
get
;
set
;
}
/// <summary>
/// ⽤户unionId
/// </summary>
public
string
UnionId
{
get
;
set
;
}
/// <summary>
/// 回调渠道编号
/// </summary>
public
int
PartnerId
{
get
;
set
;
}
/// <summary>
/// 商户编号
/// </summary>
public
int
MerchantId
{
get
;
set
;
}
/// <summary>
/// 券⽣效开始时间
/// </summary>
public
string
validStart
{
get
;
set
;
}
/// <summary>
/// 券⽣效结束时间
/// </summary>
public
string
validEnds
{
get
;
set
;
}
/// <summary>
/// 商品名称
/// </summary>
public
string
Title
{
get
;
set
;
}
/// <summary>
/// 版本号
/// </summary>
public
long
Version
{
get
;
set
;
}
/// <summary>
/// 活动信息
/// </summary>
public
List
<
Activity
>
Activities
{
get
;
set
;
}
/// <summary>
/// 活动信息
/// </summary>
public
class
Activity
{
/// <summary>
/// 活动号
/// </summary>
public
string
no
{
get
;
set
;
}
}
}
}
Freemud.BE.Toolbox.WebApi/Model/Response/FreemudACT/FreemudACTResponse.cs
0 → 100644
View file @
b1b2a201
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
Freemud.BE.Toolbox.WebApi.Model.Response
{
public
class
FreemudACTResponse
<
T
>
{
/// <summary>
/// 消息响应Code,100=成功,其它-失败
/// </summary>
public
int
code
{
get
;
set
;
}
/// <summary>
/// 返回消息
/// </summary>
public
string
message
{
get
;
set
;
}
/// <summary>
/// 响应数据
/// </summary>
public
T
data
{
get
;
set
;
}
/// <summary>
/// 是否成功,True=是,False=否
/// </summary>
public
bool
IsSuccess
()
=>
code
==
2000
;
}
}
Freemud.BE.Toolbox.WebApi/Model/Response/FreemudACT/GetSubEquityCardListResponse.cs
0 → 100644
View file @
b1b2a201
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
Freemud.BE.Toolbox.WebApi.Model.Response
{
public
class
GetSubEquityCardListResponse
:
FreemudACTResponse
<
List
<
GetSubEquityCardListResponse
.
GetEquityCardActivityBodyDto
>>
{
public
class
GetEquityCardActivityBodyDto
{
/// <summary>
/// 活动号
/// </summary>
public
string
no
{
get
;
set
;
}
/// <summary>
/// 券号
/// </summary>
public
string
code
{
get
;
set
;
}
/// <summary>
/// 序号
/// </summary>
public
int
?
sequence
{
get
;
set
;
}
}
}
}
Freemud.BE.Toolbox.WebApi/Model/Response/FreemudPUS/FreemudPUSResponse.cs
0 → 100644
View file @
b1b2a201
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
Freemud.BE.Toolbox.WebApi.Model.Response
{
public
class
FreemudPUSResponse
<
T
>
{
/// <summary>
/// 消息响应Code,100=成功,其它-失败
/// </summary>
public
int
errcode
{
get
;
set
;
}
/// <summary>
/// 返回消息
/// </summary>
public
string
errmsg
{
get
;
set
;
}
/// <summary>
/// 响应数据
/// </summary>
public
T
data
{
get
;
set
;
}
/// <summary>
/// 是否成功,True=是,False=否
/// </summary>
public
bool
IsSuccess
()
=>
errcode
==
100
;
}
}
Freemud.BE.Toolbox.WebApi/Model/Response/FreemudPUS/GetEquityCardCouponPackageListResponse.cs
0 → 100644
View file @
b1b2a201
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
Freemud.BE.Toolbox.WebApi.Model.Response
{
public
class
GetEquityCardCouponPackageListResponse
:
FreemudPUSResponse
<
List
<
string
>>
{
}
}
Freemud.BE.Toolbox.WebApi/Model/Response/FreemudPUS/GetEquityCardCouponPackageResponse.cs
0 → 100644
View file @
b1b2a201
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
Freemud.BE.Toolbox.WebApi.Model.Response
{
public
class
GetEquityCardCouponPackageResponse
:
FreemudPUSResponse
<
GetEquityCardCouponPackageResponse
.
GetEquityCardCouponPackageBodyDto
>
{
public
class
GetEquityCardCouponPackageBodyDto
{
/// <summary>
/// 回调渠道编号
/// </summary>
public
int
partner_id
{
get
;
set
;
}
/// <summary>
/// 商户编号
/// </summary>
public
int
merchant_id
{
get
;
set
;
}
/// <summary>
/// 标题
/// </summary>
public
string
title
{
get
;
set
;
}
/// <summary>
/// 券生效开始时间
/// </summary>
public
string
valid_start
{
get
;
set
;
}
/// <summary>
/// 券生效结束时间
/// </summary>
public
string
valid_ends
{
get
;
set
;
}
/// <summary>
/// 版本号
/// </summary>
public
long
version
{
get
;
set
;
}
/// <summary>
/// 子权益列表
/// </summary>
public
List
<
Coupon
>
coupon
{
get
;
set
;
}
}
/// <summary>
/// 子权益信息
/// </summary>
public
class
Coupon
{
/// <summary>
/// 活动号
/// </summary>
public
string
no
{
get
;
set
;
}
/// <summary>
/// 序号
/// </summary>
public
int
sequence
{
get
;
set
;
}
}
}
}
Freemud.BE.Toolbox.WebApi/Model/Response/RequestResourceResponse.cs
View file @
b1b2a201
...
@@ -21,4 +21,15 @@ namespace Freemud.BE.Toolbox.WebApi.Model.Response
...
@@ -21,4 +21,15 @@ namespace Freemud.BE.Toolbox.WebApi.Model.Response
public
string
ResponseError
{
get
;
set
;
}
public
string
ResponseError
{
get
;
set
;
}
}
}
public
class
RequestResourceResponse
<
T
>
:
RequestResourceResponse
{
public
T
Data
{
get
;
set
;
}
protected
RequestResourceResponse
ToRequestResourceResponse
()
{
return
(
RequestResourceResponse
)
base
.
MemberwiseClone
();
}
}
}
}
Freemud.BE.Toolbox.WebApi/Model/Response/UserCardAdapter.cs
View file @
b1b2a201
...
@@ -22,12 +22,14 @@ namespace Freemud.BE.Toolbox.WebApi.Model.Response
...
@@ -22,12 +22,14 @@ namespace Freemud.BE.Toolbox.WebApi.Model.Response
/// 结束时间
/// 结束时间
/// </summary>
/// </summary>
public
string
EndDate
{
get
;
set
;
}
public
string
EndDate
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 卡券Id
/// 卡券Id
/// </summary>
/// </summary>
public
string
CardId
{
get
;
set
;
}
public
string
CardId
{
get
;
set
;
}
/// <summary>
/// 活动号
/// </summary>
public
string
ActiveId
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 卡券类型
/// 卡券类型
/// 10:微信卡券
/// 10:微信卡券
...
@@ -35,17 +37,18 @@ namespace Freemud.BE.Toolbox.WebApi.Model.Response
...
@@ -35,17 +37,18 @@ namespace Freemud.BE.Toolbox.WebApi.Model.Response
/// 30:Vendor卡券
/// 30:Vendor卡券
/// </summary>
/// </summary>
public
EnumCardType
CardType
{
get
;
set
;
}
public
EnumCardType
CardType
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 是否权益卡(1 是权益卡)
/// 是否权益卡(1 是权益卡)
/// </summary>
/// </summary>
public
int
?
IsEquityCard
{
get
;
set
;
}
public
int
?
IsEquityCard
{
get
;
set
;
}
/// <summary>
/// <summary>
/// ArchCard优惠券可用时段
/// ArchCard优惠券可用时段
/// </summary>
/// </summary>
public
string
AvailableTimeDesc
{
get
;
set
;
}
public
string
AvailableTimeDesc
{
get
;
set
;
}
/// <summary>
/// 浅表克隆
/// </summary>
/// <returns></returns>
public
UserCardAdapter
Clone
()
public
UserCardAdapter
Clone
()
{
{
return
(
UserCardAdapter
)
MemberwiseClone
();
return
(
UserCardAdapter
)
MemberwiseClone
();
...
...
Freemud.BE.Toolbox.WebApi/Program.cs
View file @
b1b2a201
...
@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Hosting;
...
@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Hosting;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging
;
using
Serilog
;
namespace
Freemud.BE.Toolbox.WebApi
namespace
Freemud.BE.Toolbox.WebApi
{
{
...
@@ -21,6 +22,7 @@ namespace Freemud.BE.Toolbox.WebApi
...
@@ -21,6 +22,7 @@ namespace Freemud.BE.Toolbox.WebApi
.
ConfigureWebHostDefaults
(
webBuilder
=>
.
ConfigureWebHostDefaults
(
webBuilder
=>
{
{
webBuilder
.
UseStartup
<
Startup
>();
webBuilder
.
UseStartup
<
Startup
>();
webBuilder
.
UseSerilog
();
});
});
}
}
}
}
Freemud.BE.Toolbox.WebApi/Proxy/BaseProxy.cs
View file @
b1b2a201
using
Freemud.BE.Toolbox.WebApi.Model
;
using
Freemud.BE.Toolbox.WebApi.Model
;
using
Freemud.BE.Toolbox.WebApi.Model.Constants
;
using
Freemud.BE.Toolbox.WebApi.Model.Constants
;
using
Freemud.BE.Toolbox.WebApi.Model.Response
;
using
Freemud.BE.Toolbox.WebApi.Model.Response
;
using
Microsoft.Extensions.Logging
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
...
@@ -10,10 +11,12 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
...
@@ -10,10 +11,12 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
{
{
public
abstract
class
BaseProxy
public
abstract
class
BaseProxy
{
{
protected
readonly
ILogger
<
BaseProxy
>
logger
;
private
readonly
List
<
RequestResourceConfiguration
>
requestResources
;
private
readonly
List
<
RequestResourceConfiguration
>
requestResources
;
protected
BaseProxy
(
ToolboxConfiguration
toolboxConfiguration
)
protected
BaseProxy
(
ILogger
<
BaseProxy
>
logger
,
ToolboxConfiguration
toolboxConfiguration
)
{
{
this
.
logger
=
logger
;
requestResources
=
toolboxConfiguration
.
RequestResources
;
requestResources
=
toolboxConfiguration
.
RequestResources
;
}
}
...
@@ -24,7 +27,7 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
...
@@ -24,7 +27,7 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
/// <param name="group"></param>
/// <param name="group"></param>
/// <param name="name"></param>
/// <param name="name"></param>
/// <returns></returns>
/// <returns></returns>
p
ublic
string
GetUrl
(
string
env
,
string
group
,
string
name
)
p
rotected
string
GetUrl
(
string
env
,
string
group
,
string
name
)
{
{
var
config
=
requestResources
?.
FirstOrDefault
(
d
=>
d
.
Name
.
Equals
(
group
,
StringComparison
.
OrdinalIgnoreCase
));
var
config
=
requestResources
?.
FirstOrDefault
(
d
=>
d
.
Name
.
Equals
(
group
,
StringComparison
.
OrdinalIgnoreCase
));
if
(
config
==
null
)
if
(
config
==
null
)
...
...
Freemud.BE.Toolbox.WebApi/Proxy/FmActProxy.cs
0 → 100644
View file @
b1b2a201
using
Freemud.BE.Toolbox.WebApi.Infrastructure.Helpers
;
using
Freemud.BE.Toolbox.WebApi.Model
;
using
Freemud.BE.Toolbox.WebApi.Model.Constants
;
using
Freemud.BE.Toolbox.WebApi.Model.Request
;
using
Freemud.BE.Toolbox.WebApi.Model.Response
;
using
Microsoft.Extensions.Logging
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Security.Cryptography
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Freemud.BE.Toolbox.WebApi.Proxy
{
public
class
FmActProxy
:
BaseProxy
{
public
FmActProxy
(
ILogger
<
FmActProxy
>
logger
,
ToolboxConfiguration
toolboxConfiguration
)
:
base
(
logger
,
toolboxConfiguration
)
{
}
/// <summary>
/// 查询麦霸卡cardiId列表
/// </summary>
/// <returns></returns>
public
async
Task
<
RequestResourceResponse
<
List
<
GetSubEquityCardListResponse
.
GetEquityCardActivityBodyDto
>>>
GetSubEquityCardList
(
GetSubEquityCardListRequest
request
)
{
var
url
=
string
.
Format
(
GetUrl
(
request
.
Env
,
"FreemudACT"
,
"getEquityCardActivity"
));
var
body
=
new
{
cardId
=
request
.
CardId
,
couponCode
=
request
.
CouponCode
,
merchantId
=
request
.
MerchantId
,
partnerId
=
request
.
PartnerId
,
unionId
=
request
.
UnionId
,
validStart
=
$"
{
request
.
validStart
:
yyyy
-
MM
-
dd
HH
:
mm
:
ss
}
"
,
validEnds
=
$"
{
request
.
validEnds
:
yyyy
-
MM
-
dd
HH
:
mm
:
ss
}
"
,
title
=
request
.
Title
,
ver
=
request
.
Version
,
activity
=
request
.
Activities
};
var
response
=
await
HttpHeper
.
Post
<
GetSubEquityCardListResponse
>(
url
,
jsonBody
:
body
);
return
new
RequestResourceResponse
<
List
<
GetSubEquityCardListResponse
.
GetEquityCardActivityBodyDto
>>
{
Name
=
"查询麦霸卡cardiId列表"
,
Url
=
url
,
ResponseContent
=
response
.
Content
,
ResponseError
=
response
.
ErrorMessage
,
Data
=
response
.
Data
.
data
};
}
}
}
Freemud.BE.Toolbox.WebApi/Proxy/FmCouponProxy.cs
View file @
b1b2a201
...
@@ -3,6 +3,7 @@ using Freemud.BE.Toolbox.WebApi.Model;
...
@@ -3,6 +3,7 @@ using Freemud.BE.Toolbox.WebApi.Model;
using
Freemud.BE.Toolbox.WebApi.Model.Constants
;
using
Freemud.BE.Toolbox.WebApi.Model.Constants
;
using
Freemud.BE.Toolbox.WebApi.Model.Request
;
using
Freemud.BE.Toolbox.WebApi.Model.Request
;
using
Freemud.BE.Toolbox.WebApi.Model.Response
;
using
Freemud.BE.Toolbox.WebApi.Model.Response
;
using
Microsoft.Extensions.Logging
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -15,7 +16,7 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
...
@@ -15,7 +16,7 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
{
{
public
class
FmCouponProxy
:
BaseProxy
public
class
FmCouponProxy
:
BaseProxy
{
{
public
FmCouponProxy
(
ToolboxConfiguration
toolboxConfiguration
)
:
base
(
toolboxConfiguration
)
{
}
public
FmCouponProxy
(
ILogger
<
FmActProxy
>
logger
,
ToolboxConfiguration
toolboxConfiguration
)
:
base
(
logger
,
toolboxConfiguration
)
{
}
/// <summary>
/// <summary>
/// 获取券码核销渠道
/// 获取券码核销渠道
...
...
Freemud.BE.Toolbox.WebApi/Proxy/FmProductProxy.cs
View file @
b1b2a201
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
using
Freemud.BE.Toolbox.WebApi.Model
;
using
Freemud.BE.Toolbox.WebApi.Model
;
using
Freemud.BE.Toolbox.WebApi.Model.Request
;
using
Freemud.BE.Toolbox.WebApi.Model.Request
;
using
Freemud.BE.Toolbox.WebApi.Model.Response
;
using
Freemud.BE.Toolbox.WebApi.Model.Response
;
using
Microsoft.Extensions.Logging
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
...
@@ -11,7 +12,7 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
...
@@ -11,7 +12,7 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
{
{
public
class
FmProductProxy
:
BaseProxy
public
class
FmProductProxy
:
BaseProxy
{
{
public
FmProductProxy
(
ToolboxConfiguration
toolboxConfiguration
)
:
base
(
toolboxConfiguration
)
{
}
public
FmProductProxy
(
ILogger
<
FmActProxy
>
logger
,
ToolboxConfiguration
toolboxConfiguration
)
:
base
(
logger
,
toolboxConfiguration
)
{
}
/// <summary>
/// <summary>
/// 获取商品基本信息
/// 获取商品基本信息
...
@@ -21,7 +22,7 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
...
@@ -21,7 +22,7 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
public
async
Task
<
RequestResourceResponse
>
GetProductBaseInfos
(
GetProductInfoRequest
request
)
public
async
Task
<
RequestResourceResponse
>
GetProductBaseInfos
(
GetProductInfoRequest
request
)
{
{
var
url
=
GetUrl
(
request
.
Env
,
"FreemudProduct"
,
"listBaseInfosByTimeV2"
);
var
url
=
GetUrl
(
request
.
Env
,
"FreemudProduct"
,
"listBaseInfosByTimeV2"
);
url
=
string
.
Format
(
url
,
string
.
Join
(
','
,
request
.
ProductId
),
$"
{
GetChannelUnifyId
(
request
.
Channel
,
request
.
Env
)}
_
{
request
.
StoreId
}
"
,
request
.
Time
,
true
);
url
=
string
.
Format
(
url
,
string
.
Join
(
','
,
request
.
ProductId
),
$"
{
GetChannelUnifyId
(
request
.
Channel
,
request
.
Env
)}
_
{
request
.
StoreId
}
"
,
request
.
Time
,
request
.
IncludeGroupDetails
);
var
response
=
await
HttpHeper
.
Get
(
url
);
var
response
=
await
HttpHeper
.
Get
(
url
);
...
...
Freemud.BE.Toolbox.WebApi/Proxy/FmPusProxy.cs
0 → 100644
View file @
b1b2a201
using
Freemud.BE.Toolbox.WebApi.Infrastructure.Helpers
;
using
Freemud.BE.Toolbox.WebApi.Model
;
using
Freemud.BE.Toolbox.WebApi.Model.Constants
;
using
Freemud.BE.Toolbox.WebApi.Model.Request
;
using
Freemud.BE.Toolbox.WebApi.Model.Response
;
using
Microsoft.Extensions.Logging
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Security.Cryptography
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Freemud.BE.Toolbox.WebApi.Proxy
{
public
class
FmPusProxy
:
BaseProxy
{
public
FmPusProxy
(
ILogger
<
FmPusProxy
>
logger
,
ToolboxConfiguration
toolboxConfiguration
)
:
base
(
logger
,
toolboxConfiguration
)
{
}
/// <summary>
/// 获取所有麦霸卡卡号列表
/// </summary>
/// <returns></returns>
public
async
Task
<
RequestResourceResponse
<
List
<
string
>>>
GetEquityCardIds
(
string
env
)
{
var
url
=
string
.
Format
(
GetUrl
(
env
,
"FreemudPUS"
,
"getEquityCardIds"
));
var
response
=
await
HttpHeper
.
Get
<
GetEquityCardCouponPackageListResponse
>(
url
);
return
new
RequestResourceResponse
<
List
<
string
>>
{
Name
=
"获取所有麦霸卡卡号列表"
,
Url
=
url
,
ResponseContent
=
response
.
Content
,
ResponseError
=
response
.
ErrorMessage
,
Data
=
response
.
Data
.
data
};
}
/// <summary>
/// 查询麦霸卡包含子权益信息
/// </summary>
/// <returns></returns>
public
async
Task
<
RequestResourceResponse
<
GetEquityCardCouponPackageResponse
.
GetEquityCardCouponPackageBodyDto
>>
GetEquityCardInfo
(
string
env
,
string
cardId
)
{
var
url
=
string
.
Format
(
GetUrl
(
env
,
"FreemudPUS"
,
"GetEquityCardInfo"
),
cardId
);
var
response
=
await
HttpHeper
.
Get
<
GetEquityCardCouponPackageResponse
>(
url
);
return
new
RequestResourceResponse
<
GetEquityCardCouponPackageResponse
.
GetEquityCardCouponPackageBodyDto
>
{
Name
=
"查询麦霸卡包含子权益信息"
,
Url
=
url
,
ResponseContent
=
response
.
Content
,
ResponseError
=
response
.
ErrorMessage
,
Data
=
response
.
Data
.
data
};
}
}
}
Freemud.BE.Toolbox.WebApi/Proxy/FmStoreProxy.cs
View file @
b1b2a201
using
Freemud.BE.Toolbox.WebApi.Infrastructure.Helpers
;
using
Freemud.BE.Toolbox.WebApi.Infrastructure.Helpers
;
using
Freemud.BE.Toolbox.WebApi.Model
;
using
Freemud.BE.Toolbox.WebApi.Model
;
using
Freemud.BE.Toolbox.WebApi.Model.Response
;
using
Freemud.BE.Toolbox.WebApi.Model.Response
;
using
Microsoft.Extensions.Logging
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
...
@@ -10,7 +11,7 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
...
@@ -10,7 +11,7 @@ namespace Freemud.BE.Toolbox.WebApi.Proxy
{
{
public
class
FmStoreProxy
:
BaseProxy
public
class
FmStoreProxy
:
BaseProxy
{
{
public
FmStoreProxy
(
ToolboxConfiguration
toolboxConfiguration
)
:
base
(
toolboxConfiguration
)
{
}
public
FmStoreProxy
(
ILogger
<
FmActProxy
>
logger
,
ToolboxConfiguration
toolboxConfiguration
)
:
base
(
logger
,
toolboxConfiguration
)
{
}
/// <summary>
/// <summary>
/// 请求餐道根据经纬度获取门店编号
/// 请求餐道根据经纬度获取门店编号
...
...
Freemud.BE.Toolbox.WebApi/Services/Impl/RequestResourceService.cs
View file @
b1b2a201
...
@@ -24,19 +24,25 @@ namespace Freemud.BE.Toolbox.WebApi.Services
...
@@ -24,19 +24,25 @@ namespace Freemud.BE.Toolbox.WebApi.Services
private
readonly
FmCouponProxy
fmCouponProxy
;
private
readonly
FmCouponProxy
fmCouponProxy
;
private
readonly
FmProductProxy
fmProductProxy
;
private
readonly
FmProductProxy
fmProductProxy
;
private
readonly
FmStoreProxy
fmStoreProxy
;
private
readonly
FmStoreProxy
fmStoreProxy
;
private
readonly
FmPusProxy
fmPusProxy
;
private
readonly
FmActProxy
fmActProxy
;
public
RequestResourceService
(
public
RequestResourceService
(
ILogger
<
RequestResourceService
>
logger
,
ILogger
<
RequestResourceService
>
logger
,
IUserRepository
userRepository
,
IUserRepository
userRepository
,
FmCouponProxy
fmCouponProxy
,
FmCouponProxy
fmCouponProxy
,
FmProductProxy
fmProductProxy
,
FmProductProxy
fmProductProxy
,
FmStoreProxy
fmStoreProxy
)
FmStoreProxy
fmStoreProxy
,
FmPusProxy
fmPusProxy
,
FmActProxy
fmActProxy
)
{
{
this
.
logger
=
logger
;
this
.
logger
=
logger
;
this
.
userRepository
=
userRepository
;
this
.
userRepository
=
userRepository
;
this
.
fmCouponProxy
=
fmCouponProxy
;
this
.
fmCouponProxy
=
fmCouponProxy
;
this
.
fmProductProxy
=
fmProductProxy
;
this
.
fmProductProxy
=
fmProductProxy
;
this
.
fmStoreProxy
=
fmStoreProxy
;
this
.
fmStoreProxy
=
fmStoreProxy
;
this
.
fmPusProxy
=
fmPusProxy
;
this
.
fmActProxy
=
fmActProxy
;
}
}
#
region
券码
#
region
券码
...
@@ -58,7 +64,8 @@ namespace Freemud.BE.Toolbox.WebApi.Services
...
@@ -58,7 +64,8 @@ namespace Freemud.BE.Toolbox.WebApi.Services
if
(
jo
.
ContainsKey
(
"couponlist"
))
if
(
jo
.
ContainsKey
(
"couponlist"
))
{
{
var
jCoupons
=
JArray
.
Parse
(
jo
[
"couponlist"
].
ToString
());
var
jCoupons
=
JArray
.
Parse
(
jo
[
"couponlist"
].
ToString
());
var
jCouponsPids
=
jCoupons
.
Where
(
d
=>
d
[
"codeInfo"
]
!=
null
&&
d
[
"codeInfo"
].
ToString
()
!=
"{}"
).
Select
(
d
=>
d
[
"codeInfo"
][
"products"
][
0
][
"mcd_productCode"
].
ToString
()).
ToList
();
logger
.
LogInformation
(
$"[GetCouponInfo] jCoupons:
{
JsonConvert
.
SerializeObject
(
jCoupons
)}
"
);
var
jCouponsPids
=
jCoupons
.
Where
(
d
=>
Convert
.
ToInt32
(
d
[
"statusCode"
])
==
100
&&
d
[
"codeInfo"
]
!=
null
&&
d
[
"codeInfo"
].
ToString
()
!=
"{}"
&&
d
[
"codeInfo"
][
"products"
]
!=
null
).
Select
(
d
=>
d
[
"codeInfo"
][
"products"
][
0
][
"mcd_productCode"
].
ToString
()).
ToList
();
if
(
jCouponsPids
?.
Any
()
??
false
)
if
(
jCouponsPids
?.
Any
()
??
false
)
{
{
...
@@ -69,6 +76,7 @@ namespace Freemud.BE.Toolbox.WebApi.Services
...
@@ -69,6 +76,7 @@ namespace Freemud.BE.Toolbox.WebApi.Services
StoreId
=
request
.
StoreId
,
StoreId
=
request
.
StoreId
,
Time
=
request
.
Time
,
Time
=
request
.
Time
,
ProductId
=
jCouponsPids
,
ProductId
=
jCouponsPids
,
IncludeGroupDetails
=
false
};
};
var
couponProducts
=
await
fmProductProxy
.
GetProductBaseInfos
(
getProductInfoRequest
);
var
couponProducts
=
await
fmProductProxy
.
GetProductBaseInfos
(
getProductInfoRequest
);
...
@@ -116,6 +124,7 @@ namespace Freemud.BE.Toolbox.WebApi.Services
...
@@ -116,6 +124,7 @@ namespace Freemud.BE.Toolbox.WebApi.Services
public
async
Task
<
List
<
RequestResourceResponse
>>
GetUserCoupons
(
GetUserCouponsRequest
request
)
public
async
Task
<
List
<
RequestResourceResponse
>>
GetUserCoupons
(
GetUserCouponsRequest
request
)
{
{
var
result
=
new
List
<
RequestResourceResponse
>();
var
result
=
new
List
<
RequestResourceResponse
>();
var
equityCardResult
=
new
List
<
RequestResourceResponse
>();
var
termsType
=
DecideUserIdentityInfoTermsType
(
request
.
Terms
);
var
termsType
=
DecideUserIdentityInfoTermsType
(
request
.
Terms
);
if
(
termsType
==
ToolboxConstants
.
UserIdentityInfoTermsEnum
.
Unknow
)
if
(
termsType
==
ToolboxConstants
.
UserIdentityInfoTermsEnum
.
Unknow
)
{
{
...
@@ -145,10 +154,6 @@ namespace Freemud.BE.Toolbox.WebApi.Services
...
@@ -145,10 +154,6 @@ namespace Freemud.BE.Toolbox.WebApi.Services
var
vendorCardsResponse
=
await
fmCouponProxy
.
GetVendorCardCoupons
(
request
.
Env
,
request
.
Channel
,
userIdentityInfo
.
UnionId
);
var
vendorCardsResponse
=
await
fmCouponProxy
.
GetVendorCardCoupons
(
request
.
Env
,
request
.
Channel
,
userIdentityInfo
.
UnionId
);
var
userCards
=
new
List
<
UserCardAdapter
>();
var
userCards
=
new
List
<
UserCardAdapter
>();
logger
.
LogInformation
(
$"[GetUserCoupons] wechatCardsResponse:
{
JsonConvert
.
SerializeObject
(
wechatCardsResponse
)}
"
);
logger
.
LogInformation
(
$"[GetUserCoupons] archCardsResponse:
{
JsonConvert
.
SerializeObject
(
archCardsResponse
)}
"
);
logger
.
LogInformation
(
$"[GetUserCoupons] vendorCardsResponse:
{
JsonConvert
.
SerializeObject
(
vendorCardsResponse
)}
"
);
#
region
解析微信券
#
region
解析微信券
{
{
var
jo
=
JObject
.
Parse
(
wechatCardsResponse
.
ResponseContent
);
var
jo
=
JObject
.
Parse
(
wechatCardsResponse
.
ResponseContent
);
...
@@ -160,11 +165,11 @@ namespace Freemud.BE.Toolbox.WebApi.Services
...
@@ -160,11 +165,11 @@ namespace Freemud.BE.Toolbox.WebApi.Services
{
{
userCards
.
AddRange
(
cards
.
Select
(
c
=>
new
UserCardAdapter
userCards
.
AddRange
(
cards
.
Select
(
c
=>
new
UserCardAdapter
{
{
//
CardId = c["card_id"].ToString(),
CardId
=
c
[
"card_id"
].
ToString
(),
Code
=
c
[
"code"
].
ToString
(),
Code
=
c
[
"code"
].
ToString
(),
CardType
=
EnumCardType
.
WeChat
,
CardType
=
EnumCardType
.
WeChat
,
//StartDate = $"{DateTime.Parse(c["start_date"].ToString()):yyyy/MM/dd
}",
StartDate
=
$"
{
DateTime
.
Parse
(
c
[
"start_date"
].
ToString
()):
yyyy
-
MM
-
dd
HH
:
mm
:
ss
}
"
,
//EndDate = $"{DateTime.Parse(c["end_date"].ToString()):yyyy/MM/dd
}",
EndDate
=
$"
{
DateTime
.
Parse
(
c
[
"end_date"
].
ToString
()):
yyyy
-
MM
-
dd
HH
:
mm
:
ss
}
"
,
//AvailableTimeDesc = c.GetAvailableTimeDesc()
//AvailableTimeDesc = c.GetAvailableTimeDesc()
}));
}));
}
}
...
@@ -178,18 +183,73 @@ namespace Freemud.BE.Toolbox.WebApi.Services
...
@@ -178,18 +183,73 @@ namespace Freemud.BE.Toolbox.WebApi.Services
if
(
jo
.
ContainsKey
(
"data"
))
if
(
jo
.
ContainsKey
(
"data"
))
{
{
var
cards
=
JArray
.
Parse
(
jo
[
"data"
][
"card_list"
].
ToString
());
var
cards
=
JArray
.
Parse
(
jo
[
"data"
][
"card_list"
].
ToString
());
logger
.
LogInformation
(
$"[GetUserCoupons] archCardsResponse.cards:
{
JsonConvert
.
SerializeObject
(
cards
)}
"
);
if
(
cards
?.
Any
()
??
false
)
if
(
cards
?.
Any
()
??
false
)
{
{
userCards
.
AddRange
(
cards
.
Select
(
c
=>
new
UserCardAdapter
userCards
.
AddRange
(
cards
.
Select
(
c
=>
new
UserCardAdapter
{
{
//
CardId = c["card_id"].ToString(),
CardId
=
c
[
"card_id"
].
ToString
(),
Code
=
c
[
"card_code"
].
ToString
(),
Code
=
c
[
"card_code"
].
ToString
(),
CardType
=
EnumCardType
.
ArchCard
,
CardType
=
EnumCardType
.
ArchCard
,
//StartDate = $"{DateTime.Parse(c["begin_date"].ToString()):yyyy/MM/dd
}",
StartDate
=
$"
{
DateTime
.
Parse
(
c
[
"begin_date"
].
ToString
()):
yyyy
-
MM
-
dd
HH
:
mm
:
ss
}
"
,
//EndDate = $"{DateTime.Parse(c["end_date"].ToString()):yyyy/MM/dd
}",
EndDate
=
$"
{
DateTime
.
Parse
(
c
[
"end_date"
].
ToString
()):
yyyy
-
MM
-
dd
HH
:
mm
:
ss
}
"
,
//AvailableTimeDesc = c.GetAvailableTimeDesc()
//AvailableTimeDesc = c.GetAvailableTimeDesc()
}));
}));
#
region
麦霸卡处理
var
getEquityCardIdsResponse
=
await
fmPusProxy
.
GetEquityCardIds
(
request
.
Env
);
equityCardResult
.
Add
(
getEquityCardIdsResponse
);
if
(
getEquityCardIdsResponse
.
Data
.
Any
())
{
for
(
int
i
=
userCards
.
Count
-
1
;
i
>=
0
;
i
--)
{
var
uc
=
userCards
[
i
];
// 非麦钱包卡券 & 非麦霸卡卡号, 则不处理
if
(
uc
.
CardType
!=
EnumCardType
.
ArchCard
)
continue
;
if
(!
getEquityCardIdsResponse
.
Data
.
Contains
(
uc
.
CardId
))
continue
;
// 麦霸卡权益卡信息
logger
.
LogInformation
(
$"[GetUserCoupons] uc.CardId:
{
uc
.
CardId
}
"
);
var
getEquityCardInfoResponse
=
await
fmPusProxy
.
GetEquityCardInfo
(
request
.
Env
,
uc
.
CardId
);
logger
.
LogInformation
(
$"[GetUserCoupons] getEquityCardInfoResponse:
{
JsonConvert
.
SerializeObject
(
getEquityCardInfoResponse
)}
"
);
equityCardResult
.
Add
(
getEquityCardInfoResponse
);
if
(
getEquityCardInfoResponse
?.
Data
?.
coupon
?.
Any
()
??
false
)
{
var
getSubEquityCardListRequest
=
new
GetSubEquityCardListRequest
{
Env
=
request
.
Env
,
//Channel = request.Channel,
CardId
=
uc
.
CardId
,
CouponCode
=
uc
.
Code
,
MerchantId
=
getEquityCardInfoResponse
.
Data
.
merchant_id
,
PartnerId
=
getEquityCardInfoResponse
.
Data
.
partner_id
,
UnionId
=
userIdentityInfo
.
UnionId
,
validStart
=
uc
.
StartDate
,
validEnds
=
uc
.
EndDate
,
Title
=
getEquityCardInfoResponse
.
Data
.
title
,
Version
=
getEquityCardInfoResponse
.
Data
.
version
,
Activities
=
getEquityCardInfoResponse
.
Data
.
coupon
.
Select
(
d
=>
new
GetSubEquityCardListRequest
.
Activity
{
no
=
d
.
no
}).
ToList
()
};
logger
.
LogInformation
(
$"[GetUserCoupons] getSubEquityCardListRequest:
{
JsonConvert
.
SerializeObject
(
getSubEquityCardListRequest
)}
"
);
var
getSubEquityCardListResponse
=
await
fmActProxy
.
GetSubEquityCardList
(
getSubEquityCardListRequest
);
logger
.
LogInformation
(
$"[GetUserCoupons] getSubEquityCardListResponse:
{
JsonConvert
.
SerializeObject
(
getSubEquityCardListResponse
)}
"
);
equityCardResult
.
Add
(
getSubEquityCardListResponse
);
if
(
getSubEquityCardListResponse
!=
null
)
{
foreach
(
var
subEquityCard
in
getSubEquityCardListResponse
.
Data
)
{
var
subCard
=
uc
.
Clone
();
subCard
.
Code
=
subEquityCard
.
code
;
subCard
.
IsEquityCard
=
1
;
subCard
.
ActiveId
=
subEquityCard
.
no
;
userCards
.
Add
(
subCard
);
}
}
}
}
}
#
endregion
}
}
}
}
}
}
...
@@ -201,16 +261,15 @@ namespace Freemud.BE.Toolbox.WebApi.Services
...
@@ -201,16 +261,15 @@ namespace Freemud.BE.Toolbox.WebApi.Services
if
(
jo
.
ContainsKey
(
"data"
))
if
(
jo
.
ContainsKey
(
"data"
))
{
{
var
cards
=
JArray
.
Parse
(
jo
[
"data"
][
"card_list"
].
ToString
());
var
cards
=
JArray
.
Parse
(
jo
[
"data"
][
"card_list"
].
ToString
());
logger
.
LogInformation
(
$"[GetUserCoupons] vendorCardsResponse.cards:
{
JsonConvert
.
SerializeObject
(
cards
)}
"
);
if
(
cards
?.
Any
()
??
false
)
if
(
cards
?.
Any
()
??
false
)
{
{
userCards
.
AddRange
(
cards
.
Select
(
c
=>
new
UserCardAdapter
userCards
.
AddRange
(
cards
.
Select
(
c
=>
new
UserCardAdapter
{
{
//
CardId = c["card_id"].ToString(),
CardId
=
c
[
"card_id"
].
ToString
(),
Code
=
c
[
"code"
].
ToString
(),
Code
=
c
[
"code"
].
ToString
(),
CardType
=
EnumCardType
.
VendorCard
,
CardType
=
EnumCardType
.
VendorCard
,
//StartDate = $"{DatetimeHelper.ToDateTimeAtSeconds(long.Parse(c["begin_time"].ToString())):yyyy/MM/dd
}",
StartDate
=
$"
{
DatetimeHelper
.
ToDateTimeAtSeconds
(
long
.
Parse
(
c
[
"begin_time"
].
ToString
())):
yyyy
-
MM
-
dd
HH
:
mm
:
ss
}
"
,
//EndDate = $"{DatetimeHelper.ToDateTimeAtSeconds(long.Parse(c["end_time"].ToString())):yyyy/MM/dd
}",
EndDate
=
$"
{
DatetimeHelper
.
ToDateTimeAtSeconds
(
long
.
Parse
(
c
[
"end_time"
].
ToString
())):
yyyy
-
MM
-
dd
HH
:
mm
:
ss
}
"
,
//AvailableTimeDesc = c.GetAvailableTimeDesc()
//AvailableTimeDesc = c.GetAvailableTimeDesc()
}));
}));
}
}
...
@@ -269,7 +328,7 @@ namespace Freemud.BE.Toolbox.WebApi.Services
...
@@ -269,7 +328,7 @@ namespace Freemud.BE.Toolbox.WebApi.Services
}
}
}
}
return
result
;
return
result
.
Concat
(
equityCardResult
).
ToList
()
;
}
}
#
endregion
#
endregion
...
@@ -326,6 +385,7 @@ namespace Freemud.BE.Toolbox.WebApi.Services
...
@@ -326,6 +385,7 @@ namespace Freemud.BE.Toolbox.WebApi.Services
/// <returns></returns>
/// <returns></returns>
public
async
Task
<
List
<
RequestResourceResponse
>>
GetProductInfo
(
GetProductInfoRequest
request
)
public
async
Task
<
List
<
RequestResourceResponse
>>
GetProductInfo
(
GetProductInfoRequest
request
)
{
{
request
.
IncludeGroupDetails
=
true
;
var
products
=
await
fmProductProxy
.
GetProductBaseInfos
(
request
);
var
products
=
await
fmProductProxy
.
GetProductBaseInfos
(
request
);
var
extendsions
=
await
fmProductProxy
.
GetProductExtensionInfo
(
request
.
Env
,
request
.
ProductId
);
var
extendsions
=
await
fmProductProxy
.
GetProductExtensionInfo
(
request
.
Env
,
request
.
ProductId
);
...
...
Freemud.BE.Toolbox.WebApi/Startup.cs
View file @
b1b2a201
...
@@ -49,6 +49,8 @@ namespace Freemud.BE.Toolbox.WebApi
...
@@ -49,6 +49,8 @@ namespace Freemud.BE.Toolbox.WebApi
services
.
AddSingleton
<
FmCouponProxy
>();
services
.
AddSingleton
<
FmCouponProxy
>();
services
.
AddSingleton
<
FmProductProxy
>();
services
.
AddSingleton
<
FmProductProxy
>();
services
.
AddSingleton
<
FmStoreProxy
>();
services
.
AddSingleton
<
FmStoreProxy
>();
services
.
AddSingleton
<
FmPusProxy
>();
services
.
AddSingleton
<
FmActProxy
>();
// Repositories
// Repositories
services
.
AddScoped
<
IUserRepository
,
UserRepository
>();
services
.
AddScoped
<
IUserRepository
,
UserRepository
>();
...
@@ -95,16 +97,12 @@ namespace Freemud.BE.Toolbox.WebApi
...
@@ -95,16 +97,12 @@ namespace Freemud.BE.Toolbox.WebApi
// 配置 Serilog
// 配置 Serilog
Log
.
Logger
=
new
LoggerConfiguration
()
Log
.
Logger
=
new
LoggerConfiguration
()
.
MinimumLevel
.
Debug
()
//.MinimumLevel.Debug()
.
MinimumLevel
.
Override
(
"Microsoft.AspNetCore"
,
LogEventLevel
.
Warning
)
//.MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning)
.
WriteTo
.
Console
()
.
WriteTo
.
File
(
path
:
"logs\\log.log"
,
rollingInterval
:
RollingInterval
.
Day
)
.
WriteTo
.
File
(
path
:
"logs\\log.log"
,
rollingInterval
:
RollingInterval
.
Day
)
.
CreateLogger
();
.
CreateLogger
();
app
.
UseGlobalExceptionHandler
();
app
.
UseGlobalExceptionHandler
();
Log
.
Logger
.
Information
(
"=== Configure ==="
);
Log
.
Logger
.
Information
(
JsonConvert
.
SerializeObject
(
toolboxConfiguration
));
if
(
toolboxConfiguration
.
RequiredCertification
)
if
(
toolboxConfiguration
.
RequiredCertification
)
{
{
app
.
UseRequestClientInfoReceiver
();
app
.
UseRequestClientInfoReceiver
();
...
...
Freemud.BE.Toolbox.WebApi/appsettings.json
View file @
b1b2a201
...
@@ -195,6 +195,37 @@
...
@@ -195,6 +195,37 @@
"Description"
:
"卡券通过access_token解码多个加密code"
"Description"
:
"卡券通过access_token解码多个加密code"
}
}
]
]
},
{
"Name"
:
"FreemudPUS"
,
"DevBaseUrl"
:
"https://129.211.102.44:8095"
,
"ProdBaseUrl"
:
"https://10.52.16.119"
,
"Description"
:
"PUS"
,
"Resources"
:
[
{
"Name"
:
"getEquityCardIds"
,
"Path"
:
"/api/coupon/package/list"
,
"Description"
:
"查询麦霸卡cardiId列表"
},
{
"Name"
:
"GetEquityCardInfo"
,
"Path"
:
"/api/coupon/package?cardId={0}"
,
"Description"
:
"查询麦霸卡信息"
}
]
},
{
"Name"
:
"FreemudACT"
,
"DevBaseUrl"
:
"https://129.211.102.44:8098"
,
"ProdBaseUrl"
:
"https://10.52.17.108"
,
"Description"
:
"非码活动服务"
,
"Resources"
:
[
{
"Name"
:
"getEquityCardActivity"
,
"Path"
:
"/api/coupon-package"
,
"Description"
:
"查询⽤户权益包信息"
}
]
}
}
]
]
},
},
...
...
freemud.be.toolboxview.antdv/src/views/UserCoupons.vue
View file @
b1b2a201
...
@@ -122,7 +122,7 @@ export default {
...
@@ -122,7 +122,7 @@ export default {
env
:
"test"
,
env
:
"test"
,
time
:
moment
(),
time
:
moment
(),
storeCode
:
"1450026"
,
storeCode
:
"1450026"
,
userTerms
:
"1
5618147550
"
,
userTerms
:
"1
8217660771
"
,
storeSuggestions
:
[
storeSuggestions
:
[
{
value
:
"1450026"
},
{
value
:
"1450026"
},
{
value
:
"1450217"
},
{
value
:
"1450217"
},
...
...
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