feat: ren js save js
This commit is contained in:
parent
e41749404b
commit
f26efb61bd
@ -13,6 +13,8 @@ const config = useConfig<{ tokenSecret: string }>();
|
|||||||
|
|
||||||
type UserData = {
|
type UserData = {
|
||||||
orgs?: string[];
|
orgs?: string[];
|
||||||
|
wxUnionId?: string;
|
||||||
|
phone?: string;
|
||||||
};
|
};
|
||||||
export enum UserTypes {
|
export enum UserTypes {
|
||||||
'user' = 'user',
|
'user' = 'user',
|
||||||
@ -26,7 +28,6 @@ export class User extends Model {
|
|||||||
declare id: string;
|
declare id: string;
|
||||||
declare username: string;
|
declare username: string;
|
||||||
declare nickname: string; // 昵称
|
declare nickname: string; // 昵称
|
||||||
// declare alias: string; // 别名
|
|
||||||
declare password: string;
|
declare password: string;
|
||||||
declare salt: string;
|
declare salt: string;
|
||||||
declare needChangePassword: boolean;
|
declare needChangePassword: boolean;
|
||||||
@ -187,10 +188,7 @@ export const UserInit = async (newSequelize?: any, tableName?: string, sync?: Sy
|
|||||||
type: DataTypes.TEXT,
|
type: DataTypes.TEXT,
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
},
|
},
|
||||||
// alias: {
|
|
||||||
// type: DataTypes.TEXT,
|
|
||||||
// allowNull: true, // 别名,网络请求的别名,需要唯一,不能和username重复
|
|
||||||
// },
|
|
||||||
password: {
|
password: {
|
||||||
type: DataTypes.STRING,
|
type: DataTypes.STRING,
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
|
33
src/scripts/user-list.ts
Normal file
33
src/scripts/user-list.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import '../modules/init.ts';
|
||||||
|
import { User, UserInit } from '../models/user.ts';
|
||||||
|
import { Org, OrgInit } from '../models/org.ts';
|
||||||
|
import { useContextKey } from '@kevisual/use-config/context';
|
||||||
|
const sequelize = useContextKey('sequelize');
|
||||||
|
|
||||||
|
export const main = async () => {
|
||||||
|
// await UserInit(null ,null, {
|
||||||
|
// alter: true,
|
||||||
|
// });
|
||||||
|
await UserInit();
|
||||||
|
await OrgInit();
|
||||||
|
|
||||||
|
const userList = await User.findAll();
|
||||||
|
for (const user of userList) {
|
||||||
|
console.log('user', user.id, user.username, user.data);
|
||||||
|
}
|
||||||
|
process.exit(0);
|
||||||
|
|
||||||
|
// const userlist = await User.findAll();
|
||||||
|
// for (const user of userlist) {
|
||||||
|
// // console.log('user', user.id, user.username, user.type, 'alias', user.alias);
|
||||||
|
// if (user.username.startsWith('o-')) {
|
||||||
|
// user.data = {
|
||||||
|
// ...user.data,
|
||||||
|
// wxUnionId: user.username,
|
||||||
|
// };
|
||||||
|
// await user.save();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
process.exit(0);
|
||||||
|
};
|
||||||
|
main();
|
Loading…
x
Reference in New Issue
Block a user