Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
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
黄奎
mall.oytour.com
Commits
a53ef10e
Commit
a53ef10e
authored
Aug 25, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增服务
parent
70b11cf0
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
356 additions
and
101 deletions
+356
-101
RB_Live_Config.cs
Mall.Model/Entity/AppletWeChat/RB_Live_Config.cs
+60
-0
RB_Goods.cs
Mall.Model/Entity/Product/RB_Goods.cs
+10
-0
RB_Distributor_FXGrade.cs
Mall.Model/Entity/User/RB_Distributor_FXGrade.cs
+5
-0
RB_Live_Config_Extend.cs
Mall.Model/Extend/AppletWeChat/RB_Live_Config_Extend.cs
+18
-0
ProductModule.cs
Mall.Module.Product/ProductModule.cs
+2
-0
MiniProgramModule.cs
Mall.Module.User/MiniProgramModule.cs
+50
-3
UserModule.cs
Mall.Module.User/UserModule.cs
+6
-1
RB_Live_ConfigRepository.cs
Mall.Repository/AppletWeChat/RB_Live_ConfigRepository.cs
+42
-0
MallController.cs
Mall.WebApi/Controllers/Mall/MallController.cs
+13
-0
ProductController.cs
Mall.WebApi/Controllers/Product/ProductController.cs
+3
-1
TenantController.cs
Mall.WebApi/Controllers/User/TenantController.cs
+31
-0
UserController.cs
Mall.WebApi/Controllers/User/UserController.cs
+1
-0
PathHelper.cs
Mall.WindowsService/Helper/PathHelper.cs
+1
-68
TimersHelper.cs
Mall.WindowsService/Helper/TimersHelper.cs
+18
-0
Mall.WindowsService.csproj
Mall.WindowsService/Mall.WindowsService.csproj
+4
-0
CommandModel.cs
Mall.WindowsService/Model/CommandModel.cs
+0
-27
GoodsShelvesModule.cs
Mall.WindowsService/Module/GoodsShelvesModule.cs
+78
-0
WindowsService.cs
Mall.WindowsService/WindowsService.cs
+13
-0
appsettings.json
Mall.WindowsService/appsettings.json
+1
-1
No files found.
Mall.Model/Entity/AppletWeChat/RB_Live_Config.cs
0 → 100644
View file @
a53ef10e
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
VT.FW.DB
;
namespace
Mall.Model.Entity.AppletWeChat
{
/// <summary>
/// 直播海报配置实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Live_Config
{
/// <summary>
/// 主键Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 海报背景图
/// </summary>
public
string
LiveBgImg
{
get
;
set
;
}
/// <summary>
/// 二维码大小
/// </summary>
public
int
?
LiveQrCodeSize
{
get
;
set
;
}
/// <summary>
/// 二维码上间距
/// </summary>
public
int
?
LiveQrCodePaddingTop
{
get
;
set
;
}
/// <summary>
/// 二维码左间距
/// </summary>
public
int
?
LiveQrCodePaddingLeft
{
get
;
set
;
}
/// <summary>
/// 二维码形状(0-圆形,1-方形)
/// </summary>
public
int
?
LiveQrCodeType
{
get
;
set
;
}
/// <summary>
/// 商户Id
/// </summary>
public
int
?
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序id
/// </summary>
public
int
?
MallBaseId
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
DateTime
?
CreateDate
{
get
;
set
;
}
}
}
Mall.Model/Entity/Product/RB_Goods.cs
View file @
a53ef10e
...
...
@@ -444,5 +444,15 @@ namespace Mall.Model.Entity.Product
/// 是否是直播商品 1是 2否
/// </summary>
public
int
?
IsLiveGoods
{
get
;
set
;
}
/// <summary>
/// 自动上架时间
/// </summary>
public
DateTime
?
ShelvesDate
{
get
;
set
;
}
/// <summary>
/// 自动下架时间
/// </summary>
public
DateTime
?
DownDate
{
get
;
set
;
}
}
}
Mall.Model/Entity/User/RB_Distributor_FXGrade.cs
View file @
a53ef10e
...
...
@@ -162,5 +162,10 @@ namespace Mall.Model.Entity.User
/// 会员权益描述
/// </summary>
public
string
Description
{
get
;
set
;
}
/// <summary>
/// 粉象等级图标
/// </summary>
public
string
Icon
{
get
;
set
;
}
}
}
Mall.Model/Extend/AppletWeChat/RB_Live_Config_Extend.cs
0 → 100644
View file @
a53ef10e
using
Mall.Model.Entity.AppletWeChat
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
VT.FW.DB
;
namespace
Mall.Model.Extend.AppletWeChat
{
/// <summary>
/// 直播海报配置扩展实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Live_Config_Extend
:
RB_Live_Config
{
}
}
Mall.Module.Product/ProductModule.cs
View file @
a53ef10e
...
...
@@ -4289,6 +4289,8 @@ namespace Mall.Module.Product
{
nameof
(
RB_Goods
.
SubName
),
demodel
.
SubName
},
{
nameof
(
RB_Goods
.
MarketingLogo
),
demodel
.
MarketingLogo
},
{
nameof
(
RB_Goods
.
IsLiveGoods
),
demodel
.
IsLiveGoods
},
{
nameof
(
RB_Goods
.
ShelvesDate
),
demodel
.
ShelvesDate
},
{
nameof
(
RB_Goods
.
DownDate
),
demodel
.
DownDate
},
};
if
(
goodsModel
.
IsProcurement
==
1
)
{
...
...
Mall.Module.User/MiniProgramModule.cs
View file @
a53ef10e
...
...
@@ -16,6 +16,7 @@ using Mall.Model.Query;
using
VT.FW.DB
;
using
Mall.Model.Extend.AppletWeChat
;
using
Mall.Model.Entity.AppletWeChat
;
using
Mall.Repository.AppletWeChat
;
namespace
Mall.Module.User
{
...
...
@@ -78,6 +79,11 @@ namespace Mall.Module.User
/// </summary>
private
readonly
MallStatisticsRepository
mallStatisticsRepository
=
new
MallStatisticsRepository
();
/// <summary>
/// 直播配置仓储层
/// </summary>
private
readonly
RB_Live_ConfigRepository
live_ConfigRepository
=
new
RB_Live_ConfigRepository
();
#
region
轮播图管理
/// <summary>
...
...
@@ -1782,7 +1788,7 @@ namespace Mall.Module.User
newLiveHouse
.
room_info
.
ForEach
(
x
=>
x
.
TenantId
=
model
.
TenantId
??
0
);
newLiveHouse
.
room_info
.
ForEach
(
x
=>
x
.
MallBaseId
=
model
.
MallBaseId
);
newLiveHouse
.
room_info
.
ForEach
(
x
=>
x
.
CreateDate
=
System
.
DateTime
.
Now
);
AddLiveHouse
(
newLiveHouse
.
room_info
,
new
Model
.
Entity
.
AppletWeChat
.
RB_Live_House
{
TenantId
=
model
.
TenantId
??
0
,
MallBaseId
=
model
.
MallBaseId
});
return
true
;
}
...
...
@@ -1917,13 +1923,13 @@ namespace Mall.Module.User
string
datetime
=
GetTime
(
item
.
start_time
);
if
(!
string
.
IsNullOrWhiteSpace
(
datetime
))
{
item
.
LiveTime
=
Convert
.
ToDateTime
(
datetime
);
item
.
LiveTime
=
Convert
.
ToDateTime
(
datetime
);
}
}
catch
(
Exception
)
{
}
}
liveHouseRepository
.
InsertBatch
(
list
);
...
...
@@ -2132,5 +2138,46 @@ namespace Mall.Module.User
{
return
mallStatisticsRepository
.
MallDistributorDayStatisticsRepository
(
query
);
}
#
region
直播配置
/// <summary>
/// 获取直播配置实体
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
RB_Live_Config_Extend
GetLiveConfigModule
(
RB_Live_Config_Extend
query
)
{
return
live_ConfigRepository
.
GetLiveConfigRepository
(
query
);
}
/// <summary>
/// 新增修改直播配置
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public
bool
SetLiveConfigModule
(
RB_Live_Config_Extend
extModel
)
{
var
flag
=
false
;
var
oldModel
=
GetLiveConfigModule
(
extModel
);
if
(
oldModel
!=
null
&&
oldModel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Live_Config_Extend
.
LiveBgImg
),
extModel
.
LiveBgImg
},
{
nameof
(
RB_Live_Config_Extend
.
LiveQrCodeSize
),
extModel
.
LiveQrCodeSize
},
{
nameof
(
RB_Live_Config_Extend
.
LiveQrCodePaddingTop
),
extModel
.
LiveQrCodePaddingTop
},
{
nameof
(
RB_Live_Config_Extend
.
LiveQrCodePaddingLeft
),
extModel
.
LiveQrCodePaddingLeft
},
{
nameof
(
RB_Live_Config_Extend
.
LiveQrCodeType
),
extModel
.
LiveQrCodeType
},
};
flag
=
live_ConfigRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Live_Config_Extend
.
Id
),
extModel
.
Id
));
}
else
{
flag
=
live_ConfigRepository
.
Insert
(
extModel
)
>
0
;
}
return
flag
;
}
#
endregion
}
}
Mall.Module.User/UserModule.cs
View file @
a53ef10e
...
...
@@ -3294,9 +3294,11 @@ namespace Mall.Module.User
string
GradeName
=
"默认等级"
;
int
HpEnabled
=
2
;
int
IsVip
=
2
;
string
Icon
=
""
;
if
((
basicsModel
?.
IsEnableFXGrade
??
0
)
==
1
)
{
var
gmodel
=
distributor_FXGradeRepository
.
GetEntity
((
model
.
FXGradeId
??
0
));
Icon
=
gmodel
.
Icon
??
""
;
GradeName
=
gmodel
?.
GradeName
??
"默认等级"
;
if
((
gmodel
?.
IsGuest
??
0
)
==
3
)
{
...
...
@@ -3397,6 +3399,7 @@ namespace Mall.Module.User
UserName
=
umodel
.
Name
,
umodel
.
Photo
,
GradeName
,
GradeIcon
=
Icon
,
SuperiorId
,
SuperiorName
,
DistributorGradeEntrance
=
HpEnabled
==
1
?
2
:
(
basicsModel
?.
GradeEntrance
??
2
),
...
...
@@ -3411,7 +3414,8 @@ namespace Mall.Module.User
IsEnableFXGrade
=
(
basicsModel
?.
IsEnableFXGrade
??
0
),
IsVip
,
VipExpiryDate
=
model
.
VipExpiryDate
.
HasValue
?
model
.
VipExpiryDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
,
VipBuyCommission
VipBuyCommission
,
}
};
}
...
...
@@ -5162,6 +5166,7 @@ namespace Mall.Module.User
{
nameof
(
RB_Distributor_FXGrade
.
UpdateDate
),
demodel
.
UpdateDate
},
{
nameof
(
RB_Distributor_FXGrade
.
DecimalType
),
demodel
.
DecimalType
},
{
nameof
(
RB_Distributor_FXGrade
.
Description
),
demodel
.
Description
},
{
nameof
(
RB_Distributor_FXGrade
.
Icon
),
demodel
.
Icon
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
...
...
Mall.Repository/AppletWeChat/RB_Live_ConfigRepository.cs
0 → 100644
View file @
a53ef10e
using
Mall.Model.Entity.AppletWeChat
;
using
Mall.Model.Extend.AppletWeChat
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Linq
;
namespace
Mall.Repository.AppletWeChat
{
/// <summary>
/// 直播海报配置仓储层
/// </summary>
public
class
RB_Live_ConfigRepository
:
BaseRepository
<
RB_Live_Config
>
{
/// <summary>
/// 获取直播配置实体
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
RB_Live_Config_Extend
GetLiveConfigRepository
(
RB_Live_Config_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@" SELECT * FROM RB_Live_Config WHERE 1=1 "
);
if
(
query
!=
null
)
{
if
(
query
.
MallBaseId
>
0
)
{
builder
.
AppendFormat
(
@" AND {0}={1} "
,
nameof
(
RB_Live_Config_Extend
.
MallBaseId
),
query
.
MallBaseId
);
}
if
(
query
.
TenantId
>
0
)
{
builder
.
AppendFormat
(
@" AND {0}={1} "
,
nameof
(
RB_Live_Config_Extend
.
TenantId
),
query
.
TenantId
);
}
if
(
query
.
Id
>
0
)
{
builder
.
AppendFormat
(
@" AND {0}={1} "
,
nameof
(
RB_Live_Config_Extend
.
Id
),
query
.
Id
);
}
}
return
Get
<
RB_Live_Config_Extend
>(
builder
.
ToString
()).
FirstOrDefault
();
}
}
}
Mall.WebApi/Controllers/Mall/MallController.cs
View file @
a53ef10e
...
...
@@ -114,6 +114,9 @@ namespace Mall.WebApi.Controllers.MallBase
//小程序
var
mall
=
new
object
();
//直播海报配置
var
liveConfig
=
new
object
();
//获取小程序信息
var
miniProgram
=
new
RB_MiniProgram_Extend
();
if
(
MiniAppId
!=
null
&&
!
string
.
IsNullOrEmpty
(
MiniAppId
))
...
...
@@ -387,6 +390,15 @@ namespace Mall.WebApi.Controllers.MallBase
hotspot
=
hotspotLogin
,
hotspot_cancel
=
hotspotCancel
};
var
liveConfigModel
=
programModule
.
GetLiveConfigModule
(
new
Model
.
Extend
.
AppletWeChat
.
RB_Live_Config_Extend
()
{
MallBaseId
=
miniProgram
.
MallBaseId
,
TenantId
=
miniProgram
.
TenantId
});
liveConfig
=
new
{
liveConfigModel
?.
LiveQrCodeSize
,
liveConfigModel
?.
LiveBgImg
,
liveConfigModel
?.
LiveQrCodePaddingLeft
,
liveConfigModel
?.
LiveQrCodePaddingTop
,
liveConfigModel
?.
LiveQrCodeType
,
};
var
miniPageList
=
programPageModule
.
GetMiniprogram_Page_ListExtModule
(
new
RB_MiniProgram_Page_Extend
()
{
MallBaseId
=
RequestParm
.
MallBaseId
});
var
objResult
=
new
{
...
...
@@ -398,6 +410,7 @@ namespace Mall.WebApi.Controllers.MallBase
share_setting_custom
,
cat_style
,
auth_page
,
//授权页面
liveConfig
,
bar_title
=
miniPageList
?.
Select
(
qitem
=>
new
{
name
=
qitem
.
PageName
,
value
=
qitem
.
PageUrl
,
new_name
=
qitem
.
SelfPageName
}),
//导航标题
};
return
ApiResult
.
Success
(
data
:
objResult
);
...
...
Mall.WebApi/Controllers/Product/ProductController.cs
View file @
a53ef10e
...
...
@@ -1562,7 +1562,9 @@ namespace Mall.WebApi.Controllers.MallBase
model
?.
PresentFXMonth
,
model
?.
Advertising
,
model
?.
SubName
,
model
?.
MarketingLogo
model
?.
MarketingLogo
,
model
?.
ShelvesDate
,
model
?.
DownDate
,
});
}
...
...
Mall.WebApi/Controllers/User/TenantController.cs
View file @
a53ef10e
...
...
@@ -22,6 +22,7 @@ using Mall.Model.Entity.User;
using
Mall.Module.Product
;
using
Microsoft.AspNetCore.Authorization
;
using
Mall.Model.Query
;
using
Mall.Model.Extend.AppletWeChat
;
namespace
Mall.WebApi.Controllers.User
{
...
...
@@ -1785,5 +1786,35 @@ namespace Mall.WebApi.Controllers.User
return
ApiResult
.
Success
(
data
:
basicData
);
}
#
endregion
#
region
直播配置
/// <summary>
/// 获取直播配置实体
/// </summary>
/// <returns></returns>
public
ApiResult
GetLiveConfig
()
{
var
query
=
JsonConvert
.
DeserializeObject
<
RB_Live_Config_Extend
>(
RequestParm
.
msg
.
ToString
());
query
.
MallBaseId
=
RequestParm
.
MallBaseId
;
query
.
TenantId
=
RequestParm
.
TenantId
;
var
extModel
=
programModule
.
GetLiveConfigModule
(
query
);
return
ApiResult
.
Success
(
data
:
extModel
);
}
/// <summary>
/// 添加修改直播配置
/// </summary>
/// <returns></returns>
public
ApiResult
SetLiveConfig
()
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Live_Config_Extend
>(
RequestParm
.
msg
.
ToString
());
extModel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
extModel
.
TenantId
=
RequestParm
.
TenantId
;
extModel
.
CreateDate
=
DateTime
.
Now
;
var
flag
=
programModule
.
SetLiveConfigModule
(
extModel
);
return
ApiResult
.
Success
(
data
:
extModel
);
}
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Controllers/User/UserController.cs
View file @
a53ef10e
...
...
@@ -2739,6 +2739,7 @@ namespace Mall.WebApi.Controllers.User
x
.
DecimalType
,
x
.
UpgradeId
,
x
.
Description
,
x
.
Icon
,
UpdateDate
=
x
.
UpdateDate
.
HasValue
?
x
.
UpdateDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
});
return
ApiResult
.
Success
(
""
,
pagelist
);
...
...
Mall.WindowsService/Helper/PathHelper.cs
View file @
a53ef10e
using
Mall.WindowsService.Model
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Converters
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -25,70 +24,4 @@ namespace Mall.WindowsService.Helper
}
}
}
/// <summary>
/// 配置文件帮助类
/// </summary>
public
class
ConfigHelper
{
/// <summary>
/// 获取任务配置文件
/// </summary>
/// <returns></returns>
public
static
IList
<
CommandModel
>
GetTaskConfig
()
{
IList
<
CommandModel
>
list
=
new
List
<
CommandModel
>();
//加载接口配置文件
string
settingPath
=
PathHelper
.
RootPath
+
@"\task.json"
;
using
(
StreamReader
sr
=
new
StreamReader
(
settingPath
))
{
try
{
JsonSerializer
serializer
=
new
JsonSerializer
();
serializer
.
Converters
.
Add
(
new
JavaScriptDateTimeConverter
());
serializer
.
NullValueHandling
=
NullValueHandling
.
Ignore
;
//构建Json.net的读取流
JsonReader
reader
=
new
JsonTextReader
(
sr
);
//对读取出的Json.net的reader流进行反序列化,并装载到模型中
list
=
serializer
.
Deserialize
<
IList
<
CommandModel
>>(
reader
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
"加载配置文件"
+
ex
.
Message
.
ToString
());
}
}
return
list
;
}
/// <summary>
/// 加载DLL文件
/// </summary>
/// <returns></returns>
public
static
Dictionary
<
string
,
object
>
LoadAssembly
()
{
Dictionary
<
string
,
object
>
assemblyDic
=
new
Dictionary
<
string
,
object
>();
string
path
=
PathHelper
.
RootPath
;
DirectoryInfo
directoryInfo
=
new
DirectoryInfo
(
path
);
if
(
directoryInfo
.
Exists
)
{
//搜索dll文件
FileInfo
[]
dllList
=
directoryInfo
.
GetFiles
(
"*.dll"
);
if
(!
object
.
Equals
(
dllList
,
null
)
&&
dllList
.
Length
>
0
)
{
foreach
(
var
item
in
dllList
)
{
AssemblyName
assemblyName
=
AssemblyName
.
GetAssemblyName
(
item
.
FullName
);
Assembly
ass
=
Assembly
.
Load
(
assemblyName
);
foreach
(
var
type
in
ass
.
ExportedTypes
)
{
string
fullName
=
type
.
FullName
;
assemblyDic
.
Add
(
fullName
,
type
);
}
}
}
}
return
assemblyDic
;
}
}
}
Mall.WindowsService/Helper/TimersHelper.cs
View file @
a53ef10e
...
...
@@ -13,6 +13,7 @@ namespace Mall.WindowsService.Helper
private
static
int
inTimer1
=
0
;
private
static
int
inTimer2
=
0
;
private
static
int
inTimer3
=
0
;
private
static
int
inTimer4
=
0
;
/// <summary>
/// 收入单子服务开始执行方法
...
...
@@ -103,5 +104,22 @@ namespace Mall.WindowsService.Helper
Interlocked
.
Exchange
(
ref
inTimer3
,
0
);
}
}
/// <summary>
/// 商品定时上架,下架
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public
void
GoodsShelves
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
if
(
Interlocked
.
Exchange
(
ref
inTimer4
,
1
)
==
0
)
{
LogHelper
.
Write
(
"GoodsShelves=====Start"
);
Module
.
GoodsShelvesModule
.
ShelvesGoodsModule
();
Module
.
GoodsShelvesModule
.
DownGoodsModule
();
LogHelper
.
Write
(
"GoodsShelves=====End"
);
Interlocked
.
Exchange
(
ref
inTimer4
,
0
);
}
}
}
}
Mall.WindowsService/Mall.WindowsService.csproj
View file @
a53ef10e
...
...
@@ -31,4 +31,8 @@
<ProjectReference Include="..\Mall.Repository\Mall.Repository.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Model\" />
</ItemGroup>
</Project>
Mall.WindowsService/Model/CommandModel.cs
deleted
100644 → 0
View file @
70b11cf0
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.WindowsService.Model
{
/// <summary>
/// 任务命令实体类
/// </summary>
public
class
CommandModel
{
/// <summary>
/// 对应方法名称
/// </summary>
public
string
Method
{
get
;
set
;
}
/// <summary>
/// 执行方式(1-每天,2-间隔多少小时,3-间隔多少分钟)
/// </summary>
public
int
ActionType
{
get
;
set
;
}
/// <summary>
/// 执行时间(01:00)
/// </summary>
public
string
ActionTime
{
get
;
set
;
}
}
}
Mall.WindowsService/Module/GoodsShelvesModule.cs
0 → 100644
View file @
a53ef10e
using
Mall.Repository.Product
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Linq
;
using
Mall.Model.Entity.Product
;
using
VT.FW.DB
;
namespace
Mall.WindowsService.Module
{
/// <summary>
/// 商品自动上架下架
/// </summary>
public
class
GoodsShelvesModule
{
/// <summary>
/// 商品仓储层对象
/// </summary>
private
static
readonly
RB_GoodsRepository
goodsRepository
=
new
RB_GoodsRepository
();
/// <summary>
/// 商品自动上架时间
/// </summary>
/// <returns></returns>
public
static
bool
ShelvesGoodsModule
()
{
bool
flag
=
false
;
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT Id,GoodsStatus,ShelvesDate,DownDate
FROM rb_goods
WHERE Status=0 AND '{0}'>=ShelvesDate AND '{0}'<=DownDate AND GoodsStatus<>1
"
,
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
var
list
=
goodsRepository
.
Get
<
RB_Goods
>(
builder
.
ToString
()).
ToList
();
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
foreach
(
var
item
in
list
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods
.
GoodsStatus
),
1
}
};
flag
=
goodsRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Goods
.
Id
),
item
.
Id
));
}
}
return
flag
;
}
/// <summary>
/// 商品自动下架
/// </summary>
/// <returns></returns>
public
static
bool
DownGoodsModule
()
{
bool
flag
=
false
;
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT Id,GoodsStatus,ShelvesDate,DownDate
FROM rb_goods
WHERE Status=0 AND DownDate<='{0}' AND GoodsStatus=1 "
,
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
var
list
=
goodsRepository
.
Get
<
RB_Goods
>(
builder
.
ToString
()).
ToList
();
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
foreach
(
var
item
in
list
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods
.
GoodsStatus
),
2
}
};
flag
=
goodsRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Goods
.
Id
),
item
.
Id
));
}
}
return
flag
;
}
}
}
Mall.WindowsService/WindowsService.cs
View file @
a53ef10e
...
...
@@ -15,6 +15,7 @@ namespace Mall.WindowsService
private
System
.
Timers
.
Timer
timer2
;
//订单取消计时器
private
System
.
Timers
.
Timer
timer3
;
//订单自动收货计时器
private
System
.
Timers
.
Timer
timer4
;
//七天自动取消下线计时器
private
System
.
Timers
.
Timer
timer5
;
//定时上架和下架
public
WindowsService
()
{
...
...
@@ -65,6 +66,17 @@ namespace Mall.WindowsService
timer4
.
Enabled
=
true
;
#
endregion
timer5
=
new
System
.
Timers
.
Timer
();
timer5
=
new
System
.
Timers
.
Timer
{
Interval
=
1000
*
(
60
*
0.2
)
//60分钟调用一次
};
timer5
.
Elapsed
+=
new
System
.
Timers
.
ElapsedEventHandler
(
helper
.
GoodsShelves
);
timer5
.
Enabled
=
true
;
#
region
#
endregion
}
protected
override
void
OnStop
()
...
...
@@ -75,6 +87,7 @@ namespace Mall.WindowsService
this
.
timer2
.
Enabled
=
false
;
this
.
timer3
.
Enabled
=
false
;
this
.
timer4
.
Enabled
=
false
;
this
.
timer5
.
Enabled
=
false
;
}
}
}
Mall.WindowsService/appsettings.json
View file @
a53ef10e
{
"ConnectionStrings"
:
{
"DefaultConnection"
:
"server=192.168.2.214;user id=reborn;password=Reborn@2018;database=
reborn_mall
;CharSet=utf8; Convert Zero Datetime=true; "
,
"DefaultConnection"
:
"server=192.168.2.214;user id=reborn;password=Reborn@2018;database=
test_reborn_mall_3
;CharSet=utf8; Convert Zero Datetime=true; "
,
"DefaultConnectionPName"
:
"MySql.Data.MySqlClient"
,
"FinanceConnection"
:
"server=192.168.2.214;user id=reborn;password=Reborn@2018;database=reborn_finance;CharSet=utf8; Convert Zero Datetime=true; "
,
"FinanceConnectionPName"
:
"MySql.Data.MySqlClient"
...
...
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