magic-boot/data/magic-api/api/系统管理/用户管理/个人信息修改.ms

43 lines
1.0 KiB
Plaintext
Raw Normal View History

2022-02-01 18:26:42 +08:00
{
"properties" : { },
"id" : "ebe40a0cf4b84192b6bbe923a0ecbd9c",
"script" : null,
"groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a",
"name" : "个人信息修改",
"createTime" : 1646490239466,
2022-02-01 19:04:36 +08:00
"updateTime" : 1643713357950,
2022-02-01 18:26:42 +08:00
"lock" : "0",
"createBy" : null,
"updateBy" : null,
2022-02-01 18:26:42 +08:00
"path" : "/center/update",
"method" : "POST",
2022-02-01 18:26:42 +08:00
"parameters" : [ ],
"options" : [ ],
2022-02-01 18:26:42 +08:00
"requestBody" : "{\r\n\t\r\n}",
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
2022-02-01 18:26:42 +08:00
}
================================
import cn.dev33.satoken.secure.SaSecureUtil;
2022-12-12 12:04:09 +08:00
var oldPassword = db.selectValue("""
select password from sys_user where id = #{id}
""")
if(oldPassword != SaSecureUtil.sha256(password)){
exit 0, '原密码不正确!'
}
2022-02-01 18:26:42 +08:00
var data = {
id,
phone,
headPortrait
}
if(newPassword){
data.password = newPassword ? SaSecureUtil.sha256(newPassword) : ''
}
2022-12-12 12:04:09 +08:00
return db.table('sys_user').primary('id').update(data, true)