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
843745df
Commit
843745df
authored
Oct 28, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 用户查看
parent
fb2be6e8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
145 additions
and
33 deletions
+145
-33
RB_Member_Look_Extend.cs
Mall.Model/Extend/User/RB_Member_Look_Extend.cs
+9
-0
MemberLookModule.cs
Mall.Module.User/MemberLookModule.cs
+51
-1
RB_Member_LookRepository.cs
Mall.Repository/User/RB_Member_LookRepository.cs
+32
-0
AppletMiaiController.cs
Mall.WebApi/Controllers/Miai/AppletMiaiController.cs
+53
-2
MiaiController.cs
Mall.WebApi/Controllers/Miai/MiaiController.cs
+0
-30
No files found.
Mall.Model/Extend/User/RB_Member_Look_Extend.cs
View file @
843745df
...
...
@@ -10,5 +10,14 @@ namespace Mall.Model.Extend.User
/// </summary>
public
class
RB_Member_Look_Extend
:
RB_Member_Look
{
/// <summary>
/// 开始时间
/// </summary>
public
string
StartTime
{
get
;
set
;
}
/// <summary>
/// 结束时间
/// </summary>
public
string
EndTime
{
get
;
set
;
}
}
}
Mall.Module.User/MemberLookModule.cs
View file @
843745df
using
Mall.Model.Extend.User
;
using
Mall.Common
;
using
Mall.Model.Extend.User
;
using
Mall.Repository.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Mall.Module.User
...
...
@@ -15,6 +17,10 @@ namespace Mall.Module.User
/// 用户查看微信日志仓储层对象
/// </summary>
private
readonly
RB_Member_LookRepository
member_LookRepository
=
new
RB_Member_LookRepository
();
/// <summary>
///
/// </summary>
private
readonly
RB_Member_UserRepository
member_UserRepository
=
new
RB_Member_UserRepository
();
/// <summary>
/// 获取用户查看微信日志分页列表
...
...
@@ -46,9 +52,53 @@ namespace Mall.Module.User
/// <returns></returns>
public
bool
AddMemberLookModule
(
RB_Member_Look_Extend
model
)
{
#
region
验证当月时长已存在
string
STime
=
DateTime
.
Now
.
ToString
(
"yyyy-MM"
)
+
"-01"
;
string
ETime
=
Convert
.
ToDateTime
(
STime
).
AddMonths
(
1
).
AddDays
(-
1
).
ToString
(
"yyyy-MM-dd"
);
var
list
=
member_LookRepository
.
GetMemberLookListRepository
(
new
RB_Member_Look_Extend
()
{
MallBaseId
=
model
.
MallBaseId
,
UserId
=
model
.
UserId
,
CreateBy
=
model
.
CreateBy
,
StartTime
=
STime
,
EndTime
=
ETime
});
if
(
list
.
Any
())
{
return
false
;
}
#
endregion
var
newId
=
member_LookRepository
.
Insert
(
model
);
model
.
LookId
=
newId
;
return
newId
>
0
;
}
/// <summary>
/// 获取用户查看次数
/// </summary>
/// <param name="userId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
object
GetWeChatLookUser
(
int
userId
,
AppletUserInfo
userInfo
)
{
string
STime
=
DateTime
.
Now
.
ToString
(
"yyyy-MM"
)
+
"-01"
;
string
ETime
=
Convert
.
ToDateTime
(
STime
).
AddMonths
(
1
).
AddDays
(-
1
).
ToString
(
"yyyy-MM-dd"
);
//首先查询是否已查看
bool
IsLook
=
false
;
var
list
=
member_LookRepository
.
GetMemberLookListRepository
(
new
RB_Member_Look_Extend
()
{
MallBaseId
=
userInfo
.
MallBaseId
,
UserId
=
userId
,
CreateBy
=
userInfo
.
UserId
,
StartTime
=
STime
,
EndTime
=
ETime
});
if
(
list
.
Any
())
{
IsLook
=
true
;
}
//查询当月已查看次数
int
LookNum
=
member_LookRepository
.
GetMemberLookNum
(
userInfo
.
MallBaseId
,
userInfo
.
UserId
,
STime
,
ETime
);
//查询用户可查看次数
var
umodel
=
member_UserRepository
.
GetEntity
(
userInfo
.
UserId
);
int
TotalNum
=
umodel
.
LookTimes
;
if
(
umodel
.
LookTimes
<=
0
)
{
//查询配置表中
}
return
new
{
IsLook
,
TotalNum
,
SurplusNum
=
TotalNum
-
LookNum
>
0
?
TotalNum
-
LookNum
:
0
};
}
}
}
Mall.Repository/User/RB_Member_LookRepository.cs
View file @
843745df
...
...
@@ -65,8 +65,40 @@ WHERE 1=1
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Member_Look_Extend
.
MallBaseId
),
query
.
MallBaseId
);
}
if
(
query
.
UserId
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Member_Look_Extend
.
UserId
),
query
.
UserId
);
}
if
(
query
.
CreateBy
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Member_Look_Extend
.
CreateBy
),
query
.
CreateBy
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
StartTime
))
{
builder
.
AppendFormat
(
@" AND A.{0} >='{1}' "
,
nameof
(
RB_Member_Look_Extend
.
CreateDate
),
query
.
StartTime
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
EndTime
))
{
builder
.
AppendFormat
(
@" AND A.{0} <='{1} 23:59:59' "
,
nameof
(
RB_Member_Look_Extend
.
CreateDate
),
query
.
EndTime
);
}
}
return
Get
<
RB_Member_Look_Extend
>(
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 获取当月已查看次数
/// </summary>
/// <param name="mallBaseId"></param>
/// <param name="userId"></param>
/// <param name="sTime"></param>
/// <param name="eTime"></param>
/// <returns></returns>
public
int
GetMemberLookNum
(
int
mallBaseId
,
int
userId
,
string
sTime
,
string
eTime
)
{
string
sql
=
$@" select count(0) as num from RB_Member_Look where MallBaseId =
{
mallBaseId
}
and CreateBy =
{
userId
}
and CreateDate >='
{
sTime
}
' and CreateDate <='
{
eTime
}
23:59:59'"
;
var
obj
=
ExecuteScalar
(
sql
);
return
obj
!=
null
?
Convert
.
ToInt32
(
obj
)
:
0
;
}
}
}
Mall.WebApi/Controllers/Miai/AppletMiaiController.cs
View file @
843745df
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Mall.Common.API
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
...
...
@@ -11,7 +10,6 @@ using Mall.Common.Plugin;
using
Mall.CacheManager.User
;
using
Newtonsoft.Json.Linq
;
using
Mall.Common
;
using
Mall.AOP
;
using
Mall.Module.Miai
;
using
Mall.Model.Extend.Miai
;
using
Mall.Model.Entity.Education
;
...
...
@@ -20,6 +18,7 @@ using Mall.Module.User;
using
Microsoft.AspNetCore.Authorization
;
using
Mall.Model.Entity.Miai
;
using
Dnc.Api.Throttle
;
using
Mall.Model.Extend.User
;
namespace
Mall.WebApi.Controllers.MallBase
{
...
...
@@ -35,6 +34,10 @@ namespace Mall.WebApi.Controllers.MallBase
private
readonly
MiniProgramMsgModule
programMsgModule
=
new
MiniProgramMsgModule
();
private
readonly
Module
.
Education
.
EducationModule
educationModule
=
new
Module
.
Education
.
EducationModule
();
/// <summary>
/// 用户查看微信日志处理类
/// </summary>
private
readonly
MemberLookModule
memberLookModule
=
new
MemberLookModule
();
/// <summary>
/// 通用方法
/// </summary>
private
readonly
MiaiCommonModule
miaiCommonModule
=
new
MiaiCommonModule
();
...
...
@@ -2214,6 +2217,54 @@ namespace Mall.WebApi.Controllers.MallBase
}
#
endregion
#
region
用户查看微信日子处理类
/// <summary>
/// 插入用户查看日志
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetWechatLook
()
{
var
userInfo
=
base
.
AppletUserInfo
;
RB_Member_Look_Extend
demodel
=
JsonHelper
.
DeserializeObject
<
RB_Member_Look_Extend
>(
base
.
RequestParm
.
msg
.
ToString
());
if
(
demodel
.
UserId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递用户ID"
);
}
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
demodel
.
CreateBy
=
userInfo
.
UserId
;
demodel
.
CreateDate
=
DateTime
.
Now
;
demodel
.
UpdateBy
=
userInfo
.
UserId
;
demodel
.
UpdateDate
=
DateTime
.
Now
;
bool
flag
=
memberLookModule
.
AddMemberLookModule
(
demodel
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 获取用户查看次数
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetWeChatLookUser
()
{
var
userInfo
=
base
.
AppletUserInfo
;
JObject
parms
=
JObject
.
Parse
(
base
.
RequestParm
.
msg
.
ToString
());
int
UserId
=
parms
.
GetInt
(
"UserId"
,
0
);
//用户ID
if
(
UserId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
var
RObj
=
memberLookModule
.
GetWeChatLookUser
(
UserId
,
userInfo
);
return
ApiResult
.
Success
(
""
,
RObj
);
}
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Controllers/Miai/MiaiController.cs
View file @
843745df
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Mall.Common.API
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json
;
using
Mall.Common.Plugin
;
using
Mall.CacheManager.User
;
using
Newtonsoft.Json.Linq
;
using
Mall.Common
;
using
Mall.AOP
;
using
Mall.Module.Miai
;
using
Mall.Model.Extend.Miai
;
using
Mall.Model.Extend.Point
;
using
Mall.Model.Extend.User
;
using
Mall.Module.User
;
namespace
Mall.WebApi.Controllers.MallBase
{
...
...
@@ -29,11 +25,6 @@ namespace Mall.WebApi.Controllers.MallBase
private
readonly
MiaiModule
miaiModule
=
new
MiaiModule
();
private
readonly
Module
.
Education
.
PointModule
pointModule
=
new
Module
.
Education
.
PointModule
();
/// <summary>
/// 用户查看微信日志处理类
/// </summary>
private
readonly
MemberLookModule
memberLookModule
=
new
MemberLookModule
();
#
region
活动版块
/// <summary>
/// 获取活动版块分页列表
...
...
@@ -1398,27 +1389,6 @@ namespace Mall.WebApi.Controllers.MallBase
#
endregion
#
region
用户查看微信日子处理类
/// <summary>
/// 获取用户分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetWechatLog
()
{
JObject
param
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
model
=
new
RB_Member_Look_Extend
()
{
};
// memberLookModule.AddMemberLookModule()
return
ApiResult
.
Success
();
}
#
endregion
}
...
...
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