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
214f9fa8
Commit
214f9fa8
authored
Feb 26, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
相亲评论 内容检测
parent
d870a3d8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
156 additions
and
2 deletions
+156
-2
RB_Education_ViolationLog.cs
Mall.Model/Entity/Education/RB_Education_ViolationLog.cs
+1
-1
MiniProgramMsgModule.cs
Mall.Module.User/MiniProgramMsgModule.cs
+64
-1
AppletMiaiController.cs
Mall.WebApi/Controllers/Miai/AppletMiaiController.cs
+91
-0
No files found.
Mall.Model/Entity/Education/RB_Education_ViolationLog.cs
View file @
214f9fa8
...
...
@@ -27,7 +27,7 @@ namespace Mall.Model.Entity.Education
public
DateTime
CreateDate
{
get
;
set
;
}
/// <summary>
/// 1-文章评论,2-老师动态评论
/// 1-文章评论,2-老师动态评论
, 3-相亲评论
/// </summary>
public
int
ViolationType
{
get
;
set
;
}
...
...
Mall.Module.User/MiniProgramMsgModule.cs
View file @
214f9fa8
...
...
@@ -14,6 +14,8 @@ using Mall.Repository.User;
using
Mall.Model.Extend.Statistics
;
using
Mall.Model.Query
;
using
VT.FW.DB
;
using
Mall.Model.Entity.Education
;
using
Mall.Repository.Education
;
namespace
Mall.Module.User
{
...
...
@@ -37,6 +39,11 @@ namespace Mall.Module.User
/// </summary>
private
readonly
RB_Member_UserRepository
userRepository
=
new
Repository
.
User
.
RB_Member_UserRepository
();
/// <summary>
/// 评论违规记录仓储
/// </summary>
private
readonly
RB_Education_ViolationLogRepository
educationViolationLogRepository
=
new
RB_Education_ViolationLogRepository
();
#
region
发送小程序订阅信息
...
...
@@ -996,7 +1003,7 @@ namespace Mall.Module.User
}
#
endregion
#
region
#
region
评论违规检测
/// <summary>
/// 违规文字检测
/// </summary>
...
...
@@ -1043,6 +1050,62 @@ namespace Mall.Module.User
return
0
;
}
#
region
评论违规记录
/// <summary>
/// 获取用户的违规记录
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Education_ViolationLog
>
GetViolationLogList
(
RB_Education_ViolationLog
query
)
{
return
educationViolationLogRepository
.
GetListRepository
(
query
);
}
/// <summary>
/// 新增用户的违规记录
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetEducationViolationLog
(
RB_Education_ViolationLog
model
)
{
return
educationViolationLogRepository
.
Insert
(
model
)
>
0
;
}
/// <summary>
/// 将用户加入黑名单
/// </summary>
/// <param name="TenantId"></param>
/// <param name="MallBaseId"></param>
/// <param name="UserId"></param>
/// <returns></returns>
public
bool
UpdateUserBlacklist
(
int
TenantId
,
int
MallBaseId
,
int
UserId
)
{
Dictionary
<
string
,
object
>
cols
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_User
.
Blacklist
),
1
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_User
.
Id
),
FiledValue
=
UserId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_User
.
TenantId
),
FiledValue
=
TenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_User
.
MallBaseId
),
FiledValue
=
MallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
userRepository
.
Update
(
cols
,
wheres
);
}
#
endregion
#
endregion
...
...
Mall.WebApi/Controllers/Miai/AppletMiaiController.cs
View file @
214f9fa8
...
...
@@ -16,6 +16,7 @@ using Mall.Module.Miai;
using
Mall.Model.Extend.Miai
;
using
Mall.Model.Entity.Education
;
using
Mall.Model.Extend.Education
;
using
Mall.Module.User
;
namespace
Mall.WebApi.Controllers.MallBase
{
...
...
@@ -27,6 +28,10 @@ namespace Mall.WebApi.Controllers.MallBase
{
private
readonly
MiaiModule
miaiModule
=
new
MiaiModule
();
private
readonly
Module
.
Education
.
DynamicModule
dynamicModule
=
new
Module
.
Education
.
DynamicModule
();
private
readonly
MiniProgramModule
programModule
=
new
MiniProgramModule
();
private
readonly
MiniProgramMsgModule
programMsgModule
=
new
MiniProgramMsgModule
();
#
region
活动版块
/// <summary>
/// 获取活动版块列表
...
...
@@ -119,6 +124,11 @@ namespace Mall.WebApi.Controllers.MallBase
{
var
parms
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
AppletUserInfo
uInfo
=
UserReidsCache
.
GetAppletUserBlacklistInfo
(
userInfo
.
UserId
);
if
((
uInfo
?.
Blacklist
??
0
)
==
1
)
{
return
ApiResult
.
Failed
(
"已进入黑名单,无法访问"
);
}
RB_Miai_Activity_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Miai_Activity_Extend
>(
parms
.
msg
.
ToString
());
if
(
demodel
.
ForumId
<=
0
)
{
...
...
@@ -136,6 +146,45 @@ namespace Mall.WebApi.Controllers.MallBase
{
return
ApiResult
.
ParamIsNull
(
"请重新选择报名截止日期"
);
}
#
region
内容是否违规
try
{
var
miniModel
=
programModule
.
GetMiniProgramModule
(
new
Model
.
Extend
.
User
.
RB_MiniProgram_Extend
{
TenantId
=
userInfo
.
TenantId
,
MallBaseId
=
userInfo
.
MallBaseId
});
int
violationNum
=
programMsgModule
.
CheckViolation
(
miniModel
,
StringHelper
.
FromUnicodeString
(
demodel
.
ActivityTitle
));
int
violationNum2
=
programMsgModule
.
CheckViolation
(
miniModel
,
StringHelper
.
FromUnicodeString
(
demodel
.
Content
));
if
(
violationNum
==
0
||
violationNum2
==
0
)
{
return
ApiResult
.
Failed
(
"评论内容检测失败,请稍后再试"
);
}
else
if
(
violationNum
==
1
||
violationNum2
==
1
)
{
var
violationLogList
=
programMsgModule
.
GetViolationLogList
(
new
RB_Education_ViolationLog
{
TenantId
=
userInfo
.
TenantId
,
MallBaseId
=
userInfo
.
MallBaseId
,
UserId
=
userInfo
.
UserId
});
if
(
violationLogList
!=
null
&&
violationLogList
.
Any
()
&&
violationLogList
.
Count
()
>=
1
)
{
userInfo
=
new
AppletUserInfo
{
MallBaseId
=
uInfo
.
MallBaseId
,
UserId
=
uInfo
.
UserId
,
TenantId
=
uInfo
.
TenantId
,
Name
=
uInfo
.
Name
,
SuperiorId
=
uInfo
.
SuperiorId
,
Blacklist
=
1
};
CacheManager
.
User
.
UserReidsCache
.
AppletUserInfoSet
(
CacheKey
.
UserModuleCacheKeyConfig
.
Applet_Blacklist_Info
+
uInfo
.
UserId
,
userInfo
,
Config
.
JwtExpirTime
);
programMsgModule
.
UpdateUserBlacklist
(
userInfo
.
TenantId
,
userInfo
.
MallBaseId
,
userInfo
.
UserId
);
}
programMsgModule
.
SetEducationViolationLog
(
new
RB_Education_ViolationLog
{
TenantId
=
userInfo
.
TenantId
,
MallBaseId
=
userInfo
.
MallBaseId
,
UserId
=
userInfo
.
UserId
,
ViolationType
=
3
,
CreateDate
=
System
.
DateTime
.
Now
});
return
ApiResult
.
Failed
(
"评论存在违规内容,若多次发布违规内容将被拉黑"
);
}
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"SetActivityInfo"
);
return
ApiResult
.
Failed
(
"评论内容检测失败,请稍后再试"
);
}
#
endregion
demodel
.
ImageList
??=
new
List
<
string
>();
demodel
.
Images
=
JsonConvert
.
SerializeObject
(
demodel
.
ImageList
);
demodel
.
TenantId
=
userInfo
.
TenantId
;
...
...
@@ -271,6 +320,11 @@ namespace Mall.WebApi.Controllers.MallBase
{
var
parms
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
AppletUserInfo
uInfo
=
UserReidsCache
.
GetAppletUserBlacklistInfo
(
userInfo
.
UserId
);
if
((
uInfo
?.
Blacklist
??
0
)
==
1
)
{
return
ApiResult
.
Failed
(
"已进入黑名单,无法访问"
);
}
RB_Miai_ActivityDiscuss_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Miai_ActivityDiscuss_Extend
>(
parms
.
msg
.
ToString
());
if
(
demodel
.
ActivityId
<=
0
)
{
...
...
@@ -281,6 +335,43 @@ namespace Mall.WebApi.Controllers.MallBase
return
ApiResult
.
ParamIsNull
(
"请传递内容"
);
}
#
region
内容是否违规
try
{
var
miniModel
=
programModule
.
GetMiniProgramModule
(
new
Model
.
Extend
.
User
.
RB_MiniProgram_Extend
{
TenantId
=
userInfo
.
TenantId
,
MallBaseId
=
userInfo
.
MallBaseId
});
int
violationNum
=
programMsgModule
.
CheckViolation
(
miniModel
,
StringHelper
.
FromUnicodeString
(
demodel
.
Content
));
if
(
violationNum
==
0
)
{
return
ApiResult
.
Failed
(
"评论内容检测失败,请稍后再试"
);
}
else
if
(
violationNum
==
1
)
{
var
violationLogList
=
programMsgModule
.
GetViolationLogList
(
new
RB_Education_ViolationLog
{
TenantId
=
userInfo
.
TenantId
,
MallBaseId
=
userInfo
.
MallBaseId
,
UserId
=
userInfo
.
UserId
});
if
(
violationLogList
!=
null
&&
violationLogList
.
Any
()
&&
violationLogList
.
Count
()
>=
1
)
{
userInfo
=
new
AppletUserInfo
{
MallBaseId
=
uInfo
.
MallBaseId
,
UserId
=
uInfo
.
UserId
,
TenantId
=
uInfo
.
TenantId
,
Name
=
uInfo
.
Name
,
SuperiorId
=
uInfo
.
SuperiorId
,
Blacklist
=
1
};
CacheManager
.
User
.
UserReidsCache
.
AppletUserInfoSet
(
CacheKey
.
UserModuleCacheKeyConfig
.
Applet_Blacklist_Info
+
uInfo
.
UserId
,
userInfo
,
Config
.
JwtExpirTime
);
programMsgModule
.
UpdateUserBlacklist
(
userInfo
.
TenantId
,
userInfo
.
MallBaseId
,
userInfo
.
UserId
);
}
programMsgModule
.
SetEducationViolationLog
(
new
RB_Education_ViolationLog
{
TenantId
=
userInfo
.
TenantId
,
MallBaseId
=
userInfo
.
MallBaseId
,
UserId
=
userInfo
.
UserId
,
ViolationType
=
3
,
CreateDate
=
System
.
DateTime
.
Now
});
return
ApiResult
.
Failed
(
"评论存在违规内容,若多次发布违规内容将被拉黑"
);
}
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"SetActivityInfo"
);
return
ApiResult
.
Failed
(
"评论内容检测失败,请稍后再试"
);
}
#
endregion
demodel
.
ImageList
??=
new
List
<
string
>();
demodel
.
Images
=
JsonConvert
.
SerializeObject
(
demodel
.
ImageList
);
demodel
.
TenantId
=
userInfo
.
TenantId
;
...
...
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