Commit ac792378 by lixinming

no message

parent 7fdace08
......@@ -5,10 +5,11 @@
import { ADMINLV, ADMINTYPE, MEMBERSTATE, STATE } from "../../config/enum";
import { ERRORENUM } from "../../config/errorEnum";
import { TABLEENUM } from "../../data/models/model";
import { findToPage } from "../../data/select";
import { findOnce, findToPage } from "../../data/select";
import { BizError } from "../../util/bizError";
import { changeEnumValue, eccEnumValue } from "../../util/verificationEnum";
import * as sysTools from "../../tools/system";
import { addOneData } from "../../data/add";
/**
* 管理员列表
......@@ -35,7 +36,7 @@ export async function adminList({pageNumber}) {
}
/**
* 添加管理员
* 添加管理员 success
*/
export async function addAdmin({userId, form}) {
let {loginId, pwd, confirmation, adminType, adminLv} = form;
......@@ -46,7 +47,6 @@ export async function addAdmin({userId, form}) {
/**校验密码 */
if (pwd.search(/^[A-Za-z0-9]{6,18}$/) < 0) throw new BizError(ERRORENUM.密码只能由618位字符和数字组成);
if (pwd != confirmation) throw new BizError(ERRORENUM.两次密码不一致);
let addInfo = {
userId:sysTools.generateUserId(),//系统生成唯一id
......@@ -57,4 +57,25 @@ export async function addAdmin({userId, form}) {
isAdmin:STATE.
};
await addOneData(TABLEENUM.用户表, addInfo);
return sysTools.successResult();
}
export async function changeAdminPwd({userId, form}) {
let {pwd, confirmation} = form;
let userInfo = await findOnce(TABLEENUM.用户表, {userId:form.userId});
/**校验密码 */
if (pwd.search(/^[A-Za-z0-9]{6,18}$/) < 0) throw new BizError(ERRORENUM.密码只能由618位字符和数字组成);
if (pwd != confirmation) throw new BizError(ERRORENUM.两次密码不一致);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment