Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
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
黄奎
Education
Commits
460e78dd
Commit
460e78dd
authored
Dec 01, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
7b46a13c
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
372 additions
and
70 deletions
+372
-70
CacheKey.cs
Edu.Cache/CacheKey.cs
+8
-0
UserReidsCache.cs
Edu.Cache/User/UserReidsCache.cs
+82
-1
AppletCustomerInfo.cs
Edu.Common/API/AppletCustomerInfo.cs
+101
-0
RequestParm.cs
Edu.Common/API/RequestParm.cs
+11
-0
GlobalKey.cs
Edu.Common/GlobalKey.cs
+2
-1
RB_Customer.cs
Edu.Model/Entity/Customer/RB_Customer.cs
+6
-1
RB_Task.cs
Edu.Model/Entity/Customer/RB_Task.cs
+2
-2
RB_TaskDetails.cs
Edu.Model/Entity/Customer/RB_TaskDetails.cs
+2
-2
RB_Order_Guest.cs
Edu.Model/Entity/Sell/RB_Order_Guest.cs
+7
-0
RB_TaskDetails_Extend.cs
Edu.Model/ViewModel/Customer/RB_TaskDetails_Extend.cs
+1
-1
RB_Task_Extend.cs
Edu.Model/ViewModel/Customer/RB_Task_Extend.cs
+2
-2
CustomerTaskModule.cs
Edu.Module.Customer/CustomerTaskModule.cs
+34
-34
RB_TaskDetailsRepository.cs
Edu.Repository/Customer/RB_TaskDetailsRepository.cs
+7
-7
RB_TaskRepository.cs
Edu.Repository/Customer/RB_TaskRepository.cs
+7
-7
BaseController.cs
Edu.WebApi/Controllers/BaseController.cs
+18
-0
B2BCustomerController.cs
Edu.WebApi/Controllers/Customer/B2BCustomerController.cs
+5
-5
ApiFilterAttribute.cs
Edu.WebApi/Filter/ApiFilterAttribute.cs
+71
-5
WebApiTokenHelper.cs
Edu.WebApi/Helper/WebApiTokenHelper.cs
+6
-2
No files found.
Edu.Cache/CacheKey.cs
View file @
460e78dd
...
...
@@ -73,5 +73,13 @@ namespace Edu.Cache
/// </summary>
public
static
string
GZH_ZYSH_Key
=
"GZH_ZYSHToken_Key_"
;
/// <summary>
/// AppletB2B_Login_1(用户id)
/// </summary>
public
static
string
AppletB2B_Login_Info_
{
get
{
return
"AppletB2B_Login_"
;
}
}
}
}
Edu.Cache/User/UserReidsCache.cs
View file @
460e78dd
using
Edu.CacheManager.Base
;
using
Edu.Common
;
using
Edu.Common.API
;
using
Edu.Common.Enum
;
using
Edu.Common.Enum.Customer
;
using
Edu.Model.CacheModel
;
using
Edu.Repository.Customer
;
using
Edu.Repository.User
;
using
System
;
using
System.Linq
;
...
...
@@ -176,8 +180,85 @@ namespace Edu.Cache.User
/// <param name="Id"></param>
public
static
void
ClearUserLoginCache
(
object
Id
)
{
string
cacheKey
=
Cache
.
Cache
Key
.
User_Login_Key
+
Id
.
ToString
();
string
cacheKey
=
CacheKey
.
User_Login_Key
+
Id
.
ToString
();
redis
.
KeyDelete
(
cacheKey
);
}
/// <summary>
/// 同业
/// </summary>
private
static
readonly
RB_CustomerRepository
customerRepository
=
new
RB_CustomerRepository
();
/// <summary>
/// 获取同于用户登录信息
/// </summary>
/// <param name="CustomerId"></param>
/// <returns></returns>
public
static
AppletCustomerInfo
GetAppletCustomerLoginInfo
(
object
CustomerId
)
{
if
(
CustomerId
!=
null
)
{
string
cacheKey
=
CacheKey
.
AppletB2B_Login_Info_
+
CustomerId
.
ToString
();
AppletCustomerInfo
userInfo
=
null
;
try
{
userInfo
=
redis
.
StringGet
<
AppletCustomerInfo
>(
cacheKey
);
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"GetAppletCustomerLoginInfo"
);
}
if
(
userInfo
==
null
)
{
Int32
.
TryParse
(
CustomerId
.
ToString
(),
out
int
NewUserId
);
if
(
NewUserId
>
0
)
{
string
token
=
""
;
var
umodel
=
customerRepository
.
GetEntity
(
NewUserId
);
if
(
umodel
!=
null
&&
umodel
.
CustomerState
==
CustomerStateEnum
.
Normal
)
{
userInfo
=
new
AppletCustomerInfo
{
MallBaseId
=
umodel
.
MallBaseId
,
MallName
=
""
,
Mobile
=
umodel
.
ContactNumber
,
CustomerId
=
NewUserId
,
CustomerName
=
umodel
.
CustomerName
,
OpenId
=
umodel
.
OpenId
,
Photo
=
umodel
.
WeChatPhoto
,
Source
=
umodel
.
CustomerSourceType
,
CustomerToken
=
token
,
Blacklist
=
0
,
GroupId
=
umodel
.
Group_Id
,
IsAdmin
=
0
,
AdminId
=
0
};
AppletCustomerSet
(
CacheKey
.
AppletB2B_Login_Info_
+
CustomerId
,
userInfo
,
Config
.
JwtExpirTime
);
}
}
}
return
userInfo
;
}
return
null
;
}
/// <summary>
/// 设置同业用户缓存
/// </summary>
/// <param name="cacheKey"></param>
/// <param name="model"></param>
/// <param name="JwtExpirTime"></param>
public
static
void
AppletCustomerSet
(
string
cacheKey
,
AppletCustomerInfo
model
,
int
JwtExpirTime
)
{
try
{
TimeSpan
ts
=
GetExpirTime
(
JwtExpirTime
);
redis
.
StringSet
<
AppletCustomerInfo
>(
cacheKey
,
model
,
ts
);
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"AppletCustomerSet缓存设置失败"
);
}
}
}
}
\ No newline at end of file
Edu.Common/API/AppletCustomerInfo.cs
0 → 100644
View file @
460e78dd
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Edu.Common.API
{
/// <summary>
/// 小程序同业信息缓存
/// </summary>
public
class
AppletCustomerInfo
{
/// <summary>
/// 教育集团
/// </summary>
public
int
GroupId
{
get
;
set
;
}
/// <summary>
/// 小程序ID
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
/// <summary>
/// 同业id
/// </summary>
public
int
CustomerId
{
get
;
set
;
}
/// <summary>
/// 唯一码
/// </summary>
public
string
OpenId
{
get
;
set
;
}
/// <summary>
/// 名称
/// </summary>
public
string
CustomerName
{
get
;
set
;
}
/// <summary>
/// 手机号码
/// </summary>
public
string
Mobile
{
get
;
set
;
}
/// <summary>
/// 头像
/// </summary>
public
string
Photo
{
get
;
set
;
}
/// <summary>
/// 来源 1微信 2支付宝
/// </summary>
public
int
Source
{
get
;
set
;
}
/// <summary>
/// 商城名称
/// </summary>
public
string
MallName
{
get
;
set
;
}
/// <summary>
/// token
/// </summary>
public
string
CustomerToken
{
get
;
set
;
}
/// <summary>
/// 是否加入了黑名单 1是
/// </summary>
public
int
?
Blacklist
{
get
;
set
;
}
/// <summary>
/// 是否管理员 1是
/// </summary>
public
int
IsAdmin
{
get
;
set
;
}
/// <summary>
/// 小程序管理员编号
/// </summary>
public
int
AdminId
{
get
;
set
;
}
}
}
Edu.Common/API/RequestParm.cs
View file @
460e78dd
...
...
@@ -14,6 +14,12 @@
/// 用户ID
/// </summary>
public
string
Uid
{
get
;
set
;
}
/// <summary>
/// 客户编号
/// </summary>
public
string
CustomerId
{
get
;
set
;
}
/// <summary>
/// 请求消息
/// </summary>
...
...
@@ -34,6 +40,11 @@
/// </summary>
public
string
Token
{
get
;
set
;
}
/// <summary>
/// 同业小程序用户Token
/// </summary>
public
string
B2BToken
{
get
;
set
;
}
/// <summary>
/// 客户端版本
/// </summary>
...
...
Edu.Common/GlobalKey.cs
View file @
460e78dd
...
...
@@ -29,7 +29,8 @@
/// <summary>
/// Mall用户TokenKey
/// </summary>
public
const
string
JWT_Mall_User_Key
=
"userInfo"
;
public
const
string
JWT_Mall_Customer_Key
=
"mall_userInfo"
;
/// <summary>
/// app学生用户TokenKey
/// </summary>
...
...
Edu.Model/Entity/Customer/RB_Customer.cs
View file @
460e78dd
...
...
@@ -186,5 +186,10 @@ namespace Edu.Model.Entity.Customer
/// 头像
/// </summary>
public
string
WeChatPhoto
{
get
;
set
;
}
/// <summary>
/// 小程序ID
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Model/Entity/Customer/RB_
Customer_
Task.cs
→
Edu.Model/Entity/Customer/RB_Task.cs
View file @
460e78dd
...
...
@@ -5,11 +5,11 @@ using VT.FW.DB;
namespace
Edu.Model.Entity.Customer
{
/// <summary>
///
同业客户
任务实体类
/// 任务实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_
Customer_
Task
public
class
RB_Task
{
/// <summary>
/// 主键编号
...
...
Edu.Model/Entity/Customer/RB_
Customer_
TaskDetails.cs
→
Edu.Model/Entity/Customer/RB_TaskDetails.cs
View file @
460e78dd
...
...
@@ -7,11 +7,11 @@ using VT.FW.DB;
namespace
Edu.Model.Entity.Customer
{
/// <summary>
///
同业客户
任务详情实体类
/// 任务详情实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_
Customer_
TaskDetails
public
class
RB_TaskDetails
{
/// <summary>
/// 任务详情编号
...
...
Edu.Model/Entity/Sell/RB_Order_Guest.cs
View file @
460e78dd
...
...
@@ -226,5 +226,12 @@ namespace Edu.Model.Entity.Sell
/// 学员毕业时间
/// </summary>
public
DateTime
?
GraduationTime
{
get
;
set
;
}
/// <summary>
/// 续费状态 1正常 2续费
/// </summary>
public
int
RenewState
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/Customer/RB_
Customer_
TaskDetails_Extend.cs
→
Edu.Model/ViewModel/Customer/RB_TaskDetails_Extend.cs
View file @
460e78dd
...
...
@@ -9,7 +9,7 @@ namespace Edu.Model.ViewModel.Customer
/// <summary>
/// 同业客户任务详情扩展实体类
/// </summary>
public
class
RB_
Customer_TaskDetails_Extend
:
RB_Customer
_TaskDetails
public
class
RB_
TaskDetails_Extend
:
RB
_TaskDetails
{
/// <summary>
/// 任务编号【逗号分割】
...
...
Edu.Model/ViewModel/Customer/RB_
Customer_
Task_Extend.cs
→
Edu.Model/ViewModel/Customer/RB_Task_Extend.cs
View file @
460e78dd
...
...
@@ -8,7 +8,7 @@ namespace Edu.Model.ViewModel.Customer
/// <summary>
/// 同业客户任务扩展实体类
/// </summary>
public
class
RB_
Customer_Task_Extend
:
RB_Customer
_Task
public
class
RB_
Task_Extend
:
RB
_Task
{
/// <summary>
/// 创建人
...
...
@@ -18,7 +18,7 @@ namespace Edu.Model.ViewModel.Customer
/// <summary>
/// 任务详情列表
/// </summary>
public
List
<
RB_
Customer_
TaskDetails_Extend
>
DetailsList
{
get
;
set
;
}
public
List
<
RB_TaskDetails_Extend
>
DetailsList
{
get
;
set
;
}
/// <summary>
/// 任务开始时间
...
...
Edu.Module.Customer/CustomerTaskModule.cs
View file @
460e78dd
...
...
@@ -19,12 +19,12 @@ namespace Edu.Module.Customer
/// <summary>
/// 任务仓储层对象
/// </summary>
private
readonly
RB_
Customer_TaskRepository
customer_TaskRepository
=
new
RB_Customer
_TaskRepository
();
private
readonly
RB_
TaskRepository
customer_TaskRepository
=
new
RB
_TaskRepository
();
/// <summary>
/// 任务详情仓储层对象
/// </summary>
private
readonly
RB_
Customer_TaskDetailsRepository
detailsRepository
=
new
RB_Customer
_TaskDetailsRepository
();
private
readonly
RB_
TaskDetailsRepository
detailsRepository
=
new
RB
_TaskDetailsRepository
();
/// <summary>
/// 课程仓储层对象
...
...
@@ -49,16 +49,16 @@ namespace Edu.Module.Customer
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_
Customer_Task_Extend
>
GetCustomerTaskPageModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Customer
_Task_Extend
query
)
public
List
<
RB_
Task_Extend
>
GetTaskPageModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB
_Task_Extend
query
)
{
var
list
=
customer_TaskRepository
.
Get
Customer
TaskPageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
var
list
=
customer_TaskRepository
.
GetTaskPageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
string
Ids
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
Id
));
var
detailsList
=
new
List
<
RB_
Customer_
TaskDetails_Extend
>();
var
detailsList
=
new
List
<
RB_TaskDetails_Extend
>();
if
(!
string
.
IsNullOrEmpty
(
Ids
))
{
detailsList
=
detailsRepository
.
Get
CustomerTaskDetailsListRepository
(
new
RB_Customer
_TaskDetails_Extend
()
detailsList
=
detailsRepository
.
Get
TaskDetailsListRepository
(
new
RB
_TaskDetails_Extend
()
{
QTaskIds
=
Ids
});
...
...
@@ -76,7 +76,7 @@ namespace Edu.Module.Customer
/// 处理子任务
/// </summary>
/// <param name="detailsList"></param>
private
void
ParsingSubTaskTarget
(
List
<
RB_
Customer_
TaskDetails_Extend
>
detailsList
)
private
void
ParsingSubTaskTarget
(
List
<
RB_TaskDetails_Extend
>
detailsList
)
{
if
(
detailsList
!=
null
&&
detailsList
.
Count
>
0
)
{
...
...
@@ -163,24 +163,24 @@ namespace Edu.Module.Customer
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetCustomerTaskModule
(
RB_
Customer_
Task_Extend
model
)
public
bool
SetCustomerTaskModule
(
RB_Task_Extend
model
)
{
bool
flag
=
false
;
if
(
model
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_
Customer_
Task_Extend
.
TaskName
),
model
.
TaskName
},
{
nameof
(
RB_
Customer_
Task_Extend
.
TaskSubTitle
),
model
.
TaskSubTitle
},
{
nameof
(
RB_
Customer_
Task_Extend
.
TaskImage
),
model
.
TaskImage
},
{
nameof
(
RB_
Customer_
Task_Extend
.
TaskStartTime
),
model
.
TaskStartTime
},
{
nameof
(
RB_
Customer_
Task_Extend
.
TaskEndTime
),
model
.
TaskEndTime
},
{
nameof
(
RB_
Customer_
Task_Extend
.
TaskDesc
),
model
.
TaskDesc
},
{
nameof
(
RB_
Customer_
Task_Extend
.
UpdateBy
),
model
.
UpdateBy
},
{
nameof
(
RB_
Customer_
Task_Extend
.
UpdateTime
),
model
.
UpdateTime
},
{
nameof
(
RB_
Customer_
Task_Extend
.
ExchangeEndTime
),
model
.
ExchangeEndTime
},
{
nameof
(
RB_Task_Extend
.
TaskName
),
model
.
TaskName
},
{
nameof
(
RB_Task_Extend
.
TaskSubTitle
),
model
.
TaskSubTitle
},
{
nameof
(
RB_Task_Extend
.
TaskImage
),
model
.
TaskImage
},
{
nameof
(
RB_Task_Extend
.
TaskStartTime
),
model
.
TaskStartTime
},
{
nameof
(
RB_Task_Extend
.
TaskEndTime
),
model
.
TaskEndTime
},
{
nameof
(
RB_Task_Extend
.
TaskDesc
),
model
.
TaskDesc
},
{
nameof
(
RB_Task_Extend
.
UpdateBy
),
model
.
UpdateBy
},
{
nameof
(
RB_Task_Extend
.
UpdateTime
),
model
.
UpdateTime
},
{
nameof
(
RB_Task_Extend
.
ExchangeEndTime
),
model
.
ExchangeEndTime
},
};
flag
=
customer_TaskRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_
Customer_
Task_Extend
.
Id
),
model
.
Id
));
flag
=
customer_TaskRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Task_Extend
.
Id
),
model
.
Id
));
}
else
{
...
...
@@ -192,7 +192,7 @@ namespace Edu.Module.Customer
if
(
model
.
DetailsList
!=
null
&&
model
.
DetailsList
.
Count
>
0
)
{
var
oldList
=
detailsRepository
.
Get
CustomerTaskDetailsListRepository
(
new
RB_Customer
_TaskDetails_Extend
()
{
var
oldList
=
detailsRepository
.
Get
TaskDetailsListRepository
(
new
RB
_TaskDetails_Extend
()
{
TaskId
=
model
.
Id
});
//以前没有任务详情信息【直接新增】
...
...
@@ -234,17 +234,17 @@ namespace Edu.Module.Customer
{
Dictionary
<
string
,
object
>
subFileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_
Customer_
TaskDetails_Extend
.
TaskId
),
item
.
TaskId
},
{
nameof
(
RB_
Customer_
TaskDetails_Extend
.
DetailsName
),
item
.
DetailsName
},
{
nameof
(
RB_
Customer_
TaskDetails_Extend
.
TaskType
),
item
.
TaskType
},
{
nameof
(
RB_
Customer_
TaskDetails_Extend
.
TargetId
),
item
.
TargetId
},
{
nameof
(
RB_
Customer_
TaskDetails_Extend
.
TaskFinishType
),
item
.
TaskFinishType
},
{
nameof
(
RB_
Customer_
TaskDetails_Extend
.
TaskFinishValue
),
item
.
TaskFinishValue
},
{
nameof
(
RB_
Customer_
TaskDetails_Extend
.
TaskKudo
),
item
.
TaskKudo
},
{
nameof
(
RB_
Customer_
TaskDetails_Extend
.
TaskKudoImg
),
item
.
TaskKudoImg
},
{
nameof
(
RB_
Customer_
TaskDetails_Extend
.
KudoDescription
),
item
.
KudoDescription
},
{
nameof
(
RB_TaskDetails_Extend
.
TaskId
),
item
.
TaskId
},
{
nameof
(
RB_TaskDetails_Extend
.
DetailsName
),
item
.
DetailsName
},
{
nameof
(
RB_TaskDetails_Extend
.
TaskType
),
item
.
TaskType
},
{
nameof
(
RB_TaskDetails_Extend
.
TargetId
),
item
.
TargetId
},
{
nameof
(
RB_TaskDetails_Extend
.
TaskFinishType
),
item
.
TaskFinishType
},
{
nameof
(
RB_TaskDetails_Extend
.
TaskFinishValue
),
item
.
TaskFinishValue
},
{
nameof
(
RB_TaskDetails_Extend
.
TaskKudo
),
item
.
TaskKudo
},
{
nameof
(
RB_TaskDetails_Extend
.
TaskKudoImg
),
item
.
TaskKudoImg
},
{
nameof
(
RB_TaskDetails_Extend
.
KudoDescription
),
item
.
KudoDescription
},
};
detailsRepository
.
Update
(
subFileds
,
new
WhereHelper
(
nameof
(
RB_
Customer_
TaskDetails_Extend
.
DetailId
),
item
.
DetailId
));
detailsRepository
.
Update
(
subFileds
,
new
WhereHelper
(
nameof
(
RB_TaskDetails_Extend
.
DetailId
),
item
.
DetailId
));
}
}
}
...
...
@@ -265,9 +265,9 @@ namespace Edu.Module.Customer
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_
Customer_
Task_Extend
.
Status
),(
int
)
DateStateEnum
.
Delete
},
{
nameof
(
RB_Task_Extend
.
Status
),(
int
)
DateStateEnum
.
Delete
},
};
var
flag
=
customer_TaskRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_
Customer_
Task_Extend
.
Id
),
Id
));
var
flag
=
customer_TaskRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Task_Extend
.
Id
),
Id
));
return
flag
;
}
...
...
@@ -277,12 +277,12 @@ namespace Edu.Module.Customer
/// </summary>
/// <param name="CustomerId"></param>
/// <returns></returns>
public
RB_
Customer_
Task_Extend
GetCustomerTaskModule
(
object
Id
)
public
RB_Task_Extend
GetCustomerTaskModule
(
object
Id
)
{
var
extModel
=
customer_TaskRepository
.
GetEntity
<
RB_
Customer_
Task_Extend
>(
Id
);
var
extModel
=
customer_TaskRepository
.
GetEntity
<
RB_Task_Extend
>(
Id
);
if
(
extModel
!=
null
)
{
var
detailsList
=
detailsRepository
.
Get
CustomerTaskDetailsListRepository
(
new
RB_Customer
_TaskDetails_Extend
()
var
detailsList
=
detailsRepository
.
Get
TaskDetailsListRepository
(
new
RB
_TaskDetails_Extend
()
{
TaskId
=
extModel
.
Id
});
...
...
Edu.Repository/Customer/RB_
Customer_
TaskDetailsRepository.cs
→
Edu.Repository/Customer/RB_TaskDetailsRepository.cs
View file @
460e78dd
...
...
@@ -10,33 +10,33 @@ namespace Edu.Repository.Customer
/// <summary>
/// 同业客户任务详情仓储层
/// </summary>
public
class
RB_
Customer_TaskDetailsRepository
:
BaseRepository
<
RB_Customer
_TaskDetails
>
public
class
RB_
TaskDetailsRepository
:
BaseRepository
<
RB
_TaskDetails
>
{
/// <summary>
/// 获取任务详情列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_
Customer_TaskDetails_Extend
>
GetCustomerTaskDetailsListRepository
(
RB_Customer
_TaskDetails_Extend
query
)
public
List
<
RB_
TaskDetails_Extend
>
GetTaskDetailsListRepository
(
RB
_TaskDetails_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_
Customer_
TaskDetails AS A
FROM RB_TaskDetails AS A
WHERE 1=1
"
);
if
(
query
!=
null
)
{
if
(
query
.
TaskId
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_
Customer_
TaskDetails_Extend
.
TaskId
),
query
.
TaskId
);
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_TaskDetails_Extend
.
TaskId
),
query
.
TaskId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QTaskIds
))
{
builder
.
AppendFormat
(
@" AND A.{0} IN({1}) "
,
nameof
(
RB_
Customer_
TaskDetails_Extend
.
TaskId
),
query
.
QTaskIds
);
builder
.
AppendFormat
(
@" AND A.{0} IN({1}) "
,
nameof
(
RB_TaskDetails_Extend
.
TaskId
),
query
.
QTaskIds
);
}
}
return
Get
<
RB_
Customer_
TaskDetails_Extend
>(
builder
.
ToString
()).
ToList
();
return
Get
<
RB_TaskDetails_Extend
>(
builder
.
ToString
()).
ToList
();
}
...
...
@@ -47,7 +47,7 @@ WHERE 1=1
/// <returns></returns>
public
bool
DeleteByTaskIdRepository
(
int
TaskId
)
{
string
sql
=
string
.
Format
(
" DELETE FROM RB_
Customer_
TaskDetails WHERE TaskId IN({0}) "
,
TaskId
);
string
sql
=
string
.
Format
(
" DELETE FROM RB_TaskDetails WHERE TaskId IN({0}) "
,
TaskId
);
return
base
.
Execute
(
sql
)
>
0
;
}
}
...
...
Edu.Repository/Customer/RB_
Customer_
TaskRepository.cs
→
Edu.Repository/Customer/RB_TaskRepository.cs
View file @
460e78dd
...
...
@@ -12,7 +12,7 @@ namespace Edu.Repository.Customer
/// <summary>
/// 同业客户任务仓储层
/// </summary>
public
class
RB_
Customer_TaskRepository
:
BaseRepository
<
RB_Customer
_Task
>
public
class
RB_
TaskRepository
:
BaseRepository
<
RB
_Task
>
{
/// <summary>
/// 获取任务分页列表
...
...
@@ -22,29 +22,29 @@ namespace Edu.Repository.Customer
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_
Customer_Task_Extend
>
GetCustomerTaskPageRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Customer
_Task_Extend
query
)
public
List
<
RB_
Task_Extend
>
GetTaskPageRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB
_Task_Extend
query
)
{
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_
Customer_
Task AS A
FROM RB_Task AS A
WHERE 1=1
"
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_
Customer_
Task_Extend
.
Status
),
(
int
)
DateStateEnum
.
Normal
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Task_Extend
.
Status
),
(
int
)
DateStateEnum
.
Normal
);
if
(
query
!=
null
)
{
if
(
query
.
Group_Id
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_
Customer_
Task_Extend
.
Group_Id
),
query
.
Group_Id
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Task_Extend
.
Group_Id
),
query
.
Group_Id
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
TaskName
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @TaskName "
,
nameof
(
RB_
Customer_
Task_Extend
.
TaskName
));
builder
.
AppendFormat
(
" AND A.{0} LIKE @TaskName "
,
nameof
(
RB_Task_Extend
.
TaskName
));
parameters
.
Add
(
"TaskName"
,
"%"
+
query
.
TaskName
.
Trim
()
+
"%"
);
}
}
return
GetPage
<
RB_
Customer_
Task_Extend
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
(),
parameters
).
ToList
();
return
GetPage
<
RB_Task_Extend
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
(),
parameters
).
ToList
();
}
}
}
Edu.WebApi/Controllers/BaseController.cs
View file @
460e78dd
...
...
@@ -43,6 +43,11 @@ namespace Edu.WebApi.Controllers
JObject
parms
=
JObject
.
Parse
(
Request
.
HttpContext
.
Items
[
GlobalKey
.
TokenUserInfo
].
ToString
());
requestParm
.
Uid
=
parms
.
GetStringValue
(
"uid"
);
}
if
(
Request
.
HttpContext
.
Items
[
GlobalKey
.
JWT_Mall_Customer_Key
]
!=
null
)
{
JObject
parms
=
JObject
.
Parse
(
Request
.
HttpContext
.
Items
[
GlobalKey
.
JWT_Mall_Customer_Key
].
ToString
());
requestParm
.
CustomerId
=
parms
.
GetStringValue
(
"uid"
);
}
}
#
endregion
//根据token 获取uid
...
...
@@ -103,5 +108,18 @@ namespace Edu.WebApi.Controllers
}
return
flag
;
}
/// <summary>
/// 获取同业用户缓存
/// </summary>
public
AppletCustomerInfo
AppletCustomerInfo
{
get
{
var
parm
=
this
.
RequestParm
;
AppletCustomerInfo
userInfo
=
UserReidsCache
.
GetAppletCustomerLoginInfo
(
parm
.
CustomerId
);
return
userInfo
;
}
}
}
}
\ No newline at end of file
Edu.WebApi/Controllers/Customer/B2BCustomerController.cs
View file @
460e78dd
...
...
@@ -172,12 +172,12 @@ namespace Edu.WebApi.Controllers.Customer
public
ApiResult
GetCustomerTaskPage
()
{
var
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
new
RB_
Customer_
Task_Extend
()
var
query
=
new
RB_Task_Extend
()
{
Group_Id
=
base
.
UserInfo
.
Group_Id
,
TaskName
=
base
.
ParmJObj
.
GetStringValue
(
"TaskName"
),
};
var
list
=
taskModule
.
Get
Customer
TaskPageModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
var
list
=
taskModule
.
GetTaskPageModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
foreach
(
var
item
in
list
)
{
if
(
item
.
CreateBy
>
0
)
...
...
@@ -197,7 +197,7 @@ namespace Edu.WebApi.Controllers.Customer
[
HttpPost
]
public
ApiResult
SetCustomerTask
()
{
var
model
=
new
RB_
Customer_
Task_Extend
()
var
model
=
new
RB_Task_Extend
()
{
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
),
TaskName
=
base
.
ParmJObj
.
GetStringValue
(
"TaskName"
),
...
...
@@ -221,7 +221,7 @@ namespace Edu.WebApi.Controllers.Customer
model
.
UpdateTime
=
DateTime
.
Now
;
model
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
model
.
School_Id
=
base
.
UserInfo
.
School_Id
;
model
.
DetailsList
=
new
List
<
RB_
Customer_
TaskDetails_Extend
>();
model
.
DetailsList
=
new
List
<
RB_TaskDetails_Extend
>();
string
details
=
base
.
ParmJObj
.
GetStringValue
(
"DetailsList"
);
if
(!
string
.
IsNullOrEmpty
(
details
))
{
...
...
@@ -243,7 +243,7 @@ namespace Edu.WebApi.Controllers.Customer
{
imgKudoList
=
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
taskKudoImageList
);
}
model
.
DetailsList
.
Add
(
new
RB_
Customer_
TaskDetails_Extend
()
model
.
DetailsList
.
Add
(
new
RB_TaskDetails_Extend
()
{
DetailId
=
jobj
.
GetInt
(
"DetailId"
),
TaskId
=
jobj
.
GetInt
(
"TaskId"
),
...
...
Edu.WebApi/Filter/ApiFilterAttribute.cs
View file @
460e78dd
...
...
@@ -28,8 +28,9 @@ namespace Edu.WebApi.Filter
public
override
void
OnActionExecuting
(
ActionExecutingContext
actionContext
)
{
string
token
=
""
;
string
customerToken
=
""
;
//请求参数
DoApiMonitorLog
(
actionContext
,
ref
token
);
DoApiMonitorLog
(
actionContext
,
ref
token
,
ref
customerToken
);
bool
isCheckToken
=
true
;
var
endpoint
=
actionContext
.
HttpContext
.
Features
.
Get
<
IEndpointFeature
>()?.
Endpoint
;
if
(
endpoint
!=
null
&&
endpoint
.
Metadata
.
GetMetadata
<
AllowAnonymousAttribute
>()
!=
null
)
...
...
@@ -40,7 +41,7 @@ namespace Edu.WebApi.Filter
//Token校验
if
(
isCheckToken
)
{
JWTValidat
(
actionContext
,
token
);
JWTValidat
(
actionContext
,
token
,
customerToken
);
}
#
region
验证表单重复提交
...
...
@@ -86,7 +87,7 @@ namespace Edu.WebApi.Filter
/// <param name="actionContext"></param>
/// <param name="token"></param>
/// <returns></returns>
private
JObject
DoApiMonitorLog
(
ActionExecutingContext
actionContext
,
ref
string
token
)
private
JObject
DoApiMonitorLog
(
ActionExecutingContext
actionContext
,
ref
string
token
,
ref
string
customerToken
)
{
JObject
parm
=
new
JObject
();
var
request
=
actionContext
.
HttpContext
.
Request
;
...
...
@@ -112,6 +113,7 @@ namespace Edu.WebApi.Filter
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
string
.
Format
(
"DoApiMonitorLog:{0}"
,
responseData
));
}
token
=
headers
[
"token"
].
ToString
();
customerToken
=
headers
[
"B2BToken"
].
ToString
();
}
#
endregion
return
parm
;
...
...
@@ -122,7 +124,7 @@ namespace Edu.WebApi.Filter
/// </summary>
/// <param name="actionContext"></param>
/// <param name="token"></param>
private
static
void
JWTValidat
(
ActionExecutingContext
actionContext
,
string
token
)
private
static
void
JWTValidat
(
ActionExecutingContext
actionContext
,
string
token
,
string
customerToken
)
{
if
(!
string
.
IsNullOrEmpty
(
token
))
{
...
...
@@ -133,7 +135,7 @@ namespace Edu.WebApi.Filter
var
tokenUser
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
EduUserInfoToken
>(
jwtJson
[
Common
.
GlobalKey
.
JWT_User_Key
].
ToString
());
if
(
tokenUser
!=
null
)
{
var
cacheUser
=
UserReidsCache
.
GetUserLoginInfo
(
tokenUser
.
uid
,
apiRequestFromEnum
:
tokenUser
.
requestFrom
);
var
cacheUser
=
UserReidsCache
.
GetUserLoginInfo
(
tokenUser
.
uid
,
apiRequestFromEnum
:
tokenUser
.
requestFrom
);
if
(
Common
.
Config
.
IsOnline
&&
cacheUser
.
ApiRequestFromEnum
==
tokenUser
.
requestFrom
&&
(
cacheUser
.
Token
!=
token
||
string
.
IsNullOrWhiteSpace
(
cacheUser
.
Token
)))
{
actionContext
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
...
...
@@ -185,6 +187,68 @@ namespace Edu.WebApi.Filter
});
}
}
else
if
(!
string
.
IsNullOrEmpty
(
customerToken
))
{
//解析token,校验是否失效
try
{
JObject
jwtJson
=
WebApiTokenHelper
.
AnalysisToken
(
customerToken
,
isCustomer
:
true
);
JObject
customerInfo
=
JObject
.
Parse
(
jwtJson
[
Common
.
GlobalKey
.
JWT_Mall_Customer_Key
].
ToString
());
string
customerId
=
customerInfo
.
GetStringValue
(
"uid"
);
if
(!
string
.
IsNullOrEmpty
(
customerId
))
{
var
cacheCustomer
=
UserReidsCache
.
GetAppletCustomerLoginInfo
(
customerId
);
if
(
Common
.
Config
.
IsOnline
&&
(
cacheCustomer
.
CustomerToken
!=
customerToken
||
string
.
IsNullOrWhiteSpace
(
cacheCustomer
.
CustomerToken
)))
{
actionContext
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
new
ApiResult
{
Code
=
(
int
)
ResultCode
.
TokenOverdue
,
Message
=
"用户凭证失效,请重新登录0"
,
Data
=
null
});
}
else
{
actionContext
.
HttpContext
.
Items
[
Common
.
GlobalKey
.
JWT_Mall_Customer_Key
]
=
jwtJson
[
Common
.
GlobalKey
.
JWT_Mall_Customer_Key
];
}
}
}
catch
(
SignatureVerificationException
sve
)
{
string
message
=
sve
.
Message
;
actionContext
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
new
ApiResult
{
Code
=
(
int
)
ResultCode
.
TokenOverdue
,
Message
=
"用户凭证失效,请重新登录1"
,
Data
=
null
});
}
catch
(
ArgumentException
ae
)
{
string
message
=
ae
.
Message
;
actionContext
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
new
ApiResult
{
Code
=
(
int
)
ResultCode
.
TokenIllegal
,
Message
=
"用户凭证失效,请重新登录2"
,
Data
=
null
});
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"JWTValidat3"
);
actionContext
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
HttpStatusCode
.
OK
,
new
ApiResult
{
Code
=
(
int
)
ResultCode
.
TokenIllegal
,
Message
=
"用户凭证失效,请重新登录3"
,
Data
=
null
});
}
}
else
{
actionContext
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
...
...
@@ -195,6 +259,8 @@ namespace Edu.WebApi.Filter
Data
=
null
});
}
}
}
}
\ No newline at end of file
Edu.WebApi/Helper/WebApiTokenHelper.cs
View file @
460e78dd
...
...
@@ -44,14 +44,18 @@ namespace Edu.WebApi.Helper
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
public
static
JObject
AnalysisToken
(
string
token
)
public
static
JObject
AnalysisToken
(
string
token
,
bool
isCustomer
=
false
)
{
IJsonSerializer
serializer
=
new
JsonNetSerializer
();
IDateTimeProvider
provider
=
new
UtcDateTimeProvider
();
IJwtValidator
validator
=
new
JwtValidator
(
serializer
,
provider
);
IBase64UrlEncoder
urlEncoder
=
new
JwtBase64UrlEncoder
();
IJwtDecoder
decoder
=
new
JwtDecoder
(
serializer
,
validator
,
urlEncoder
);
string
secret
=
Common
.
Config
.
JwtSecretKey
;
string
secret
=
Common
.
Config
.
JwtSecretKey
;
;
if
(
isCustomer
)
{
secret
=
Common
.
Config
.
MallJwtSecretKey
;
}
//token为之前生成的字符串
var
json
=
decoder
.
Decode
(
token
,
secret
,
verify
:
true
);
JObject
jwtJson
=
JObject
.
Parse
(
json
);
...
...
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