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
4bca082c
Commit
4bca082c
authored
Jan 16, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
活动 + 小程序黑名单验证
parent
bb1d72f9
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
121 additions
and
14 deletions
+121
-14
UserReidsCache.cs
Mall.CacheManager/User/UserReidsCache.cs
+45
-0
UserModuleCacheKeyConfig.cs
Mall.CacheManager/keyManager/UserModuleCacheKeyConfig.cs
+8
-0
AppletUserInfo.cs
Mall.Common/API/AppletUserInfo.cs
+4
-0
RB_Goods_Activity.cs
Mall.Model/Entity/Product/RB_Goods_Activity.cs
+5
-0
RB_Goods_Order.cs
Mall.Model/Entity/Product/RB_Goods_Order.cs
+5
-0
ActivityModule.cs
Mall.Module.Product/ActivityModule.cs
+6
-3
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+19
-3
RB_Goods_OrderRepository.cs
Mall.Repository/Product/RB_Goods_OrderRepository.cs
+4
-4
AppletOrderController.cs
Mall.WebApi/Controllers/Product/AppletOrderController.cs
+4
-3
ProductController.cs
Mall.WebApi/Controllers/Product/ProductController.cs
+3
-0
ApiFilterAttribute.cs
Mall.WebApi/Filter/ApiFilterAttribute.cs
+18
-1
No files found.
Mall.CacheManager/User/UserReidsCache.cs
View file @
4bca082c
...
...
@@ -230,6 +230,51 @@ namespace Mall.CacheManager.User
return
null
;
}
/// <summary>
/// 获取小程序用户黑名单信息
/// </summary>
/// <param name="UserId"></param>
/// <returns></returns>
public
static
AppletUserInfo
GetAppletUserBlacklistInfo
(
object
UserId
)
{
if
(
UserId
!=
null
)
{
string
cacheKey
=
UserModuleCacheKeyConfig
.
Applet_Blacklist_Info
+
UserId
.
ToString
();
AppletUserInfo
userInfo
=
null
;
try
{
userInfo
=
redis
.
StringGet
<
AppletUserInfo
>(
cacheKey
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"GetAppletUserBlacklistInfo"
);
}
if
(
userInfo
==
null
)
{
Int32
.
TryParse
(
UserId
.
ToString
(),
out
int
NewUserId
);
if
(
NewUserId
>
0
)
{
var
umodel
=
member_UserRepository
.
GetEntity
<
RB_Member_User_Extend
>(
NewUserId
);
if
(
umodel
!=
null
)
{
userInfo
=
new
AppletUserInfo
{
MallBaseId
=
umodel
.
MallBaseId
,
UserId
=
NewUserId
,
TenantId
=
umodel
.
TenantId
,
Name
=
umodel
.
Name
,
SuperiorId
=
umodel
.
SuperiorId
??
0
,
Blacklist
=
umodel
.
Blacklist
};
AppletUserInfoSet
(
UserModuleCacheKeyConfig
.
Applet_Blacklist_Info
+
UserId
,
userInfo
,
Config
.
JwtExpirTime
);
}
}
}
return
userInfo
;
}
return
null
;
}
#
region
不可开发票总金额
...
...
Mall.CacheManager/keyManager/UserModuleCacheKeyConfig.cs
View file @
4bca082c
...
...
@@ -27,6 +27,14 @@ namespace Mall.CacheKey
get
{
return
"Applet_Login_Info_"
;
}
}
/// <summary>
/// 小程序用户黑名单缓存
/// </summary>
public
static
string
Applet_Blacklist_Info
{
get
{
return
"Applet_Blacklist_Info_"
;
}
}
public
static
string
DATA_WeiXinToken
{
get
{
return
"DATA_WeiXinToken"
;
}
...
...
Mall.Common/API/AppletUserInfo.cs
View file @
4bca082c
...
...
@@ -112,6 +112,10 @@ namespace Mall.Common
/// </summary>
public
string
SecretKey
{
get
;
set
;
}
/// <summary>
/// 是否加入了黑名单 1是
/// </summary>
public
int
?
Blacklist
{
get
;
set
;
}
/// <summary>
/// 类型
...
...
Mall.Model/Entity/Product/RB_Goods_Activity.cs
View file @
4bca082c
...
...
@@ -157,5 +157,10 @@ namespace Mall.Model.Entity.Product
get
;
set
;
}
/// <summary>
/// 活动对象 1分销商 2所有用户
/// </summary>
public
int
ActiveObject
{
get
;
set
;
}
}
}
Mall.Model/Entity/Product/RB_Goods_Order.cs
View file @
4bca082c
...
...
@@ -336,6 +336,11 @@ namespace Mall.Model.Entity.Product
/// </summary>
public
string
UserTree
{
get
;
set
;
}
/// <summary>
/// 分销商id,所有的父级分销商,英文逗号分隔
/// </summary>
public
string
DistributorTree
{
get
;
set
;
}
/// <summary>
/// 版本来源 0默认商城 1教育
/// </summary>
...
...
Mall.Module.Product/ActivityModule.cs
View file @
4bca082c
...
...
@@ -289,7 +289,7 @@ namespace Mall.Module.Product
List
<
RB_Goods_Extend
>
goodsList
=
new
List
<
RB_Goods_Extend
>();
if
(!
string
.
IsNullOrEmpty
(
GoodsIds
))
{
goodsList
=
goodsRepository
.
GetSingleList
ForGoodsId
(
new
RB_Goods_Extend
()
{
TenantId
=
model
.
TenantId
,
MallBaseId
=
model
.
MallBaseId
,
GoodsIds
=
GoodsIds
});
goodsList
=
goodsRepository
.
GetSingleList
(
new
RB_Goods_Extend
()
{
TenantId
=
model
.
TenantId
,
MallBaseId
=
model
.
MallBaseId
,
GoodsIds
=
GoodsIds
});
}
if
(
model
.
RangeType
==
1
)
...
...
@@ -298,7 +298,8 @@ namespace Mall.Module.Product
model
.
RangeList
=
categoryList
.
Where
(
x
=>
RangeIdList
.
Contains
(
x
.
Id
)).
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
x
.
Name
,
Image
=
""
});
}
else
...
...
@@ -307,7 +308,8 @@ namespace Mall.Module.Product
model
.
RangeList
=
goodsList
.
Where
(
x
=>
RangeIdList
.
Contains
(
x
.
Id
)).
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
x
.
Name
,
Image
=
x
.
CarouselImage
!=
""
&&
x
.
CarouselImage
!=
"[]"
?
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
x
.
CarouselImage
)[
0
]
:
""
});
}
return
model
;
...
...
@@ -345,6 +347,7 @@ namespace Mall.Module.Product
{
nameof
(
RB_Goods_Activity_Extend
.
Description
),
demodel
.
Description
},
{
nameof
(
RB_Goods_Activity_Extend
.
ReceiveTime
),
demodel
.
ReceiveTime
},
{
nameof
(
RB_Goods_Activity_Extend
.
UpdateDate
),
demodel
.
UpdateDate
},
{
nameof
(
RB_Goods_Activity_Extend
.
ActiveObject
),
demodel
.
ActiveObject
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
...
...
Mall.Module.Product/OrderModule.cs
View file @
4bca082c
...
...
@@ -4186,8 +4186,24 @@ namespace Mall.Module.Product
try
{
string
parentIds
=
member_UserRepository
.
GetMemberParentIdStr
(
UserId
);
string
distributorIds
=
""
;
if
(!
string
.
IsNullOrEmpty
(
parentIds
))
{
//查询用户是否是分销商
var
dlist
=
distributor_InfoRepository
.
GetListForSingle
(
new
RB_Distributor_Info_Extend
()
{
UserIds
=
parentIds
,
AuditStatus
=
DistributorAuditStatusEnum
.
Audited
});
List
<
int
>
pList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
"["
+
parentIds
+
"]"
);
foreach
(
var
item
in
pList
)
{
var
dmodel
=
dlist
.
Where
(
x
=>
x
.
UserId
==
item
).
FirstOrDefault
();
if
(
dmodel
!=
null
)
{
distributorIds
+=
item
+
","
;
}
}
if
(!
string
.
IsNullOrEmpty
(
distributorIds
))
{
distributorIds
=
distributorIds
[
0.
.^
1
];
}
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_Order_Extend
.
UserTree
),
parentIds
}
{
nameof
(
RB_Goods_Order_Extend
.
UserTree
),
parentIds
},
{
nameof
(
RB_Goods_Order_Extend
.
DistributorTree
),
distributorIds
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
...
...
@@ -4196,8 +4212,8 @@ namespace Mall.Module.Product
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goods_OrderRepository
.
Update
(
keyValues
,
wheres
);
return
true
;
bool
flag
=
goods_OrderRepository
.
Update
(
keyValues
,
wheres
);
return
flag
;
}
catch
(
Exception
)
{
...
...
Mall.Repository/Product/RB_Goods_OrderRepository.cs
View file @
4bca082c
...
...
@@ -2275,15 +2275,15 @@ WHERE {where} GROUP BY o.OrderId ORDER BY o.CreateDate DESC ";
string
where
=
@
$"AND o.`Status` =0 AND o.Recycled=2 AND o.OrderStatus =5 and oa.ReOrderId is null
AND
o
.
CreateDate
>=
'
{
dmodel
.
StartTime
.
ToString
(
"yyyy-MM-dd"
)}
'
AND
o
.
CreateDate
<=
'
{
dmodel
.
EndTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
'
AND
o
.
ReceivingTime
<=
'
{
DateTime
.
Now
.
AddDays
(
0
-
AfterTime
).
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
'
AND
IFNULL
(
o
.
UserTree
,
''
)
<>
''
";
AND
IFNULL
(
o
.
{(
dmodel
.
ActiveObject
==
1
?
"DistributorTree"
:
"UserTree"
)}
,
''
)
<>
''
";
if
(
UserId
>
0
)
{
where
+=
$" AND FIND_IN_SET(
{
UserId
}
,o.
UserTree
)"
;
where
+=
$" AND FIND_IN_SET(
{
UserId
}
,o.
{(
dmodel
.
ActiveObject
==
1
?
"DistributorTree"
:
"UserTree"
)}
)"
;
}
if
(
dmodel
.
RangeType
==
1
)
{
string
sql
=
$@"
SELECT od.Id,od.Number,od.Final_Price,o.OrderId,o.UserTree FROM rb_goods_orderdetail od
SELECT od.Id,od.Number,od.Final_Price,o.OrderId,o.
{(
dmodel
.
ActiveObject
==
1
?
"DistributorTree"
:
"UserTree"
)}
as
UserTree FROM rb_goods_orderdetail od
LEFT JOIN rb_goods_order o ON o.OrderId = od.OrderId
LEFT JOIN rb_goods_category gc ON od.GoodsId = gc.GoodsId
left join rb_goods_orderaftersale oa on od.Id= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (1,2,3,4,5)
...
...
@@ -2294,7 +2294,7 @@ GROUP BY od.Id ";
}
else
{
string
sql
=
$@"
SELECT od.Id,od.Number,od.Final_Price,o.OrderId,o.UserTree FROM rb_goods_orderdetail od
SELECT od.Id,od.Number,od.Final_Price,o.OrderId,o.
{(
dmodel
.
ActiveObject
==
1
?
"DistributorTree"
:
"UserTree"
)}
as
UserTree FROM rb_goods_orderdetail od
LEFT JOIN rb_goods_order o ON o.OrderId = od.OrderId
left join rb_goods_orderaftersale oa on od.Id= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (1,2,3,4,5)
WHERE od.GoodsId in(
{
dmodel
.
RangeIds
}
)
...
...
Mall.WebApi/Controllers/Product/AppletOrderController.cs
View file @
4bca082c
...
...
@@ -1644,7 +1644,7 @@ namespace Mall.WebApi.Controllers.MallBase
x
.
PrizeImage
,
StartTime
=
x
.
StartTime
.
ToString
(
"yyyy-MM-dd"
),
EndTime
=
x
.
EndTime
.
ToString
(
"yyyy-MM-dd"
),
SurplusDay
=
(
x
.
EndTime
-
DateTime
.
Now
).
Days
,
SurplusDay
=
Math
.
Ceiling
((
x
.
EndTime
-
DateTime
.
Now
).
TotalDays
)
,
x
.
CoverImage
,
x
.
Description
,
x
.
IsFinish
,
...
...
@@ -1683,9 +1683,10 @@ namespace Mall.WebApi.Controllers.MallBase
model
.
PrizeImage
,
StartTime
=
model
.
StartTime
.
ToString
(
"yyyy-MM-dd"
),
EndTime
=
model
.
EndTime
.
ToString
(
"yyyy-MM-dd"
),
SurplusDay
=
(
model
.
EndTime
-
DateTime
.
Now
).
Days
,
SurplusDay
=
Math
.
Ceiling
((
model
.
EndTime
-
DateTime
.
Now
).
TotalDays
)
,
model
.
CoverImage
,
model
.
Description
,
model
.
ActiveObject
,
ReceiveTime
=
model
.
ReceiveTime
.
ToString
(
"yyyy-MM-dd"
)
});
}
...
...
@@ -1718,7 +1719,7 @@ namespace Mall.WebApi.Controllers.MallBase
x
.
PrizeName
,
x
.
PrizeImage
,
x
.
ReceiveTime
,
SurplusDay
=
(
x
.
ReceiveTime
-
DateTime
.
Now
).
Days
,
SurplusDay
=
Math
.
Ceiling
((
x
.
ReceiveTime
-
DateTime
.
Now
).
TotalDays
)
,
x
.
Way
});
return
ApiResult
.
Success
(
""
,
pagelist
);
...
...
Mall.WebApi/Controllers/Product/ProductController.cs
View file @
4bca082c
...
...
@@ -2636,6 +2636,7 @@ namespace Mall.WebApi.Controllers.MallBase
x
.
Description
,
ReceiveTime
=
x
.
ReceiveTime
.
ToString
(
"yyyy-MM-dd"
),
x
.
Enable
,
x
.
ActiveObject
,
x
.
TenantId
,
x
.
MallBaseId
,
CreateDate
=
x
.
CreateDate
.
HasValue
?
x
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
...
...
@@ -2678,6 +2679,7 @@ namespace Mall.WebApi.Controllers.MallBase
EndTime
=
model
.
EndTime
.
ToString
(
"yyyy-MM-dd"
),
model
.
CoverImage
,
model
.
Description
,
model
.
ActiveObject
,
ReceiveTime
=
model
.
ReceiveTime
.
ToString
(
"yyyy-MM-dd"
)
});
}
...
...
@@ -2737,6 +2739,7 @@ namespace Mall.WebApi.Controllers.MallBase
demodel
.
StartTime
=
Convert
.
ToDateTime
(
demodel
.
StartTime
.
ToString
(
"yyyy-MM-dd"
));
demodel
.
EndTime
=
Convert
.
ToDateTime
(
demodel
.
EndTime
.
ToString
(
"yyyy-MM-dd"
)
+
" 23:59:59"
);
demodel
.
ReceiveTime
=
Convert
.
ToDateTime
(
demodel
.
ReceiveTime
.
ToString
(
"yyyy-MM-dd"
)
+
" 23:59:59"
);
demodel
.
ActiveObject
=
demodel
.
ActiveObject
==
0
?
1
:
demodel
.
ActiveObject
;
bool
flag
=
activityModule
.
SetGoodsActivityInfo
(
demodel
);
if
(
flag
)
...
...
Mall.WebApi/Filter/ApiFilterAttribute.cs
View file @
4bca082c
...
...
@@ -184,7 +184,24 @@ namespace Mall.WebApi.Filter
string
secret
=
Config
.
JwtSecretKey
;
var
json
=
decoder
.
Decode
(
token
,
secret
,
verify
:
true
);
//token为之前生成的字符串
JObject
jwtJson
=
JObject
.
Parse
(
json
);
actionContext
.
HttpContext
.
Items
[
GlobalKey
.
TokenUserInfo
]
=
jwtJson
[
"mall_userInfo"
];
var
muserInfo
=
jwtJson
[
"mall_userInfo"
];
actionContext
.
HttpContext
.
Items
[
GlobalKey
.
TokenUserInfo
]
=
muserInfo
;
TokenUserInfo
userInfo
=
JsonConvert
.
DeserializeObject
<
TokenUserInfo
>(
muserInfo
.
ToString
());
if
(
userInfo
!=
null
&&
userInfo
.
requestFrom
==
Common
.
Enum
.
ApiRequestFromEnum
.
MiniProgram
)
{
//查询是否是黑名单
AppletUserInfo
uInfo
=
UserReidsCache
.
GetAppletUserBlacklistInfo
(
userInfo
.
uid
);
if
((
uInfo
?.
Blacklist
??
0
)
==
1
)
{
actionContext
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
new
ApiResult
{
resultCode
=
(
int
)
ResultCode
.
TokenIllegal
,
message
=
"已进入黑名单,无法访问"
,
data
=
null
});
}
}
}
catch
(
SignatureVerificationException
sve
)
{
...
...
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