Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EduSpider
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
viitto
EduSpider
Commits
335e8794
Commit
335e8794
authored
Jun 15, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1111
parent
ac3c4dff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
9 deletions
+99
-9
IAccountService.cs
EduSpider.IServices/IAccountService.cs
+8
-0
AccountService.cs
EduSpider.Services/AccountService.cs
+35
-8
LoginController.cs
EduSpider.WebApi/Controllers/User/LoginController.cs
+56
-1
No files found.
EduSpider.IServices/IAccountService.cs
View file @
335e8794
...
...
@@ -14,6 +14,14 @@ namespace EduSpider.IServices
public
interface
IAccountService
:
IDependency
{
List
<
rb_account_hk_Extend
>
GetAccountList
(
rb_account_hk_Extend
demodel
);
bool
UpdateAccountUnionId
(
rb_account_hk_Extend
model
);
/// <summary>
/// 修改登录密码
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
UpdatePassword
(
rb_account_hk_Extend
model
);
}
}
EduSpider.Services/AccountService.cs
View file @
335e8794
...
...
@@ -9,6 +9,7 @@ using System.Text;
using
System.Threading.Tasks
;
using
VTX.FW.Attr
;
using
VTX.FW.DB
;
using
VTX.FW.Helper
;
namespace
EduSpider.Services
{
...
...
@@ -41,15 +42,41 @@ namespace EduSpider.Services
/// <returns></returns>
public
bool
UpdateAccountUnionId
(
rb_account_hk_Extend
model
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
()
{
{
nameof
(
rb_account_hk_Extend
.
OpenId
),
model
.
OpenId
},
{
nameof
(
rb_account_hk_Extend
.
UnionId
),
model
.
UnionId
},
Dictionary
<
string
,
object
>
keyValues
=
new
()
{
{
nameof
(
rb_account_hk_Extend
.
OpenId
),
model
.
OpenId
},
{
nameof
(
rb_account_hk_Extend
.
UnionId
),
model
.
UnionId
},
};
List
<
WhereHelper
>
wheres
=
new
()
{
new
WhereHelper
(){
FiledName
=
nameof
(
rb_account_hk_Extend
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
List
<
WhereHelper
>
wheres
=
new
()
{
new
WhereHelper
()
{
FiledName
=
nameof
(
rb_account_hk_Extend
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
accountRepository
.
Update
(
keyValues
,
wheres
);
}
/// <summary>
/// 修改登录密码
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
UpdatePassword
(
rb_account_hk_Extend
model
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
()
{
{
nameof
(
rb_account_hk_Extend
.
Password
),
DESHepler
.
Encrypt
(
model
.
Password
)
},
};
List
<
WhereHelper
>
wheres
=
new
()
{
new
WhereHelper
()
{
FiledName
=
nameof
(
rb_account_hk_Extend
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
accountRepository
.
Update
(
keyValues
,
wheres
);
...
...
EduSpider.WebApi/Controllers/User/LoginController.cs
View file @
335e8794
...
...
@@ -91,7 +91,7 @@ namespace EduSpider.WebApi.Controllers
#
region
获取进阶思维小程序端
token
BaseUserInfo
UserInfo
=
new
()
{
BaseUserId
=
model
.
UniqueId
};
string
token
=
JwtHelper
.
CreateToken
(
UserInfo
,
Config
.
JwtSecretKey
,
Config
.
JwtExpirTime
);
string
token
=
JwtHelper
.
CreateToken
(
UserInfo
,
Config
.
JwtSecretKey
,
Config
.
JwtExpirTime
);
#
endregion
Model
.
Cache
.
UserInfo
obj
=
new
()
...
...
@@ -435,5 +435,60 @@ namespace EduSpider.WebApi.Controllers
return
res
;
}
#
endregion
/// <summary>
/// 修改教师密码
/// </summary>
/// <returns></returns>
[
HttpGet
]
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
UpdatePwd
()
{
string
account
=
base
.
ReqParameters
.
GetString
(
"Account"
);
//原密码
string
oldPassword
=
base
.
ReqParameters
.
GetString
(
"OldPassword"
).
Trim
();
//新密码
string
newPassword1
=
base
.
ReqParameters
.
GetString
(
"NewPassword1"
).
Trim
();
string
newPassword2
=
base
.
ReqParameters
.
GetString
(
"NewPassword2"
).
Trim
();
var
accountModel
=
AccountService
.
GetAccountList
(
new
rb_account_hk_Extend
()
{
AccountType
=
Utility
.
Enum
.
AccountTypeEnum
.
Teacher
,
Account
=
account
}).
FirstOrDefault
();
if
(
accountModel
==
null
)
{
return
ApiResult
.
Failed
(
message
:
"未找到此用户"
);
}
if
(
string
.
IsNullOrWhiteSpace
(
oldPassword
))
{
return
ApiResult
.
Failed
(
message
:
"原密码不能为空!"
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
oldPassword
)
&&
accountModel
.
Password
!=
DESHepler
.
Encrypt
(
oldPassword
))
{
return
ApiResult
.
Failed
(
message
:
"原密码不正确!"
);
}
if
(
string
.
IsNullOrWhiteSpace
(
newPassword1
)
)
{
return
ApiResult
.
Failed
(
message
:
"请填写新密码!"
);
}
if
(
string
.
IsNullOrWhiteSpace
(
newPassword2
))
{
return
ApiResult
.
Failed
(
message
:
"请再次输入新密码!"
);
}
if
(
newPassword1
!=
newPassword2
)
{
return
ApiResult
.
Failed
(
message
:
"两次密码填写不一致!"
);
}
var
newModel
=
new
rb_account_hk_Extend
()
{
Id
=
accountModel
.
Id
,
Account
=
account
,
Password
=
newPassword1
};
bool
flag
=
AccountService
.
UpdatePassword
(
newModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
}
}
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