feat: add run.ps1 script to start projects easily
add a powershell script that supports starting MES, WMS, WMSClient, Workstation and Dashboard projects with one command, includes build and run logic for backend services and npm dev for dashboard
This commit is contained in:
@@ -33,14 +33,18 @@ func (s *Service) Seed(ctx context.Context) error {
|
||||
_ = s.ctx.EntClient.Role.Create().SetName(r.name).SetCode(r.code).SetPermissionCodes(codes).Exec(ctx)
|
||||
}
|
||||
|
||||
// 2. 超级管理员账号 admin / Hardman_2026
|
||||
if !s.ctx.EntClient.User.Query().Where(user.Username("admin")).ExistX(ctx) {
|
||||
hash, _ := bcrypt.GenerateFromPassword([]byte("Hardman_2026"), bcrypt.DefaultCost)
|
||||
adminRole, _ := s.ctx.EntClient.Role.Query().Where(role.Code("SUPER_ADMIN")).First(ctx)
|
||||
roleId := 0
|
||||
if adminRole != nil {
|
||||
roleId = adminRole.ID
|
||||
}
|
||||
// 2. 超级管理员账号 admin / Hardman_2026(对已存在的旧行做对齐,避免残留禁用状态)
|
||||
hash, _ := bcrypt.GenerateFromPassword([]byte("Hardman_2026"), bcrypt.DefaultCost)
|
||||
adminRole, _ := s.ctx.EntClient.Role.Query().Where(role.Code("SUPER_ADMIN")).First(ctx)
|
||||
roleId := 0
|
||||
if adminRole != nil {
|
||||
roleId = adminRole.ID
|
||||
}
|
||||
if s.ctx.EntClient.User.Query().Where(user.Username("admin")).ExistX(ctx) {
|
||||
_ = s.ctx.EntClient.User.Update().
|
||||
Where(user.Username("admin")).
|
||||
SetPassword(string(hash)).SetStatus("ENABLED").SetRoleId(roleId).Exec(ctx)
|
||||
} else {
|
||||
_ = s.ctx.EntClient.User.Create().
|
||||
SetUsername("admin").SetPassword(string(hash)).SetName("系统管理员").
|
||||
SetRoleId(roleId).SetStatus("ENABLED").Exec(ctx)
|
||||
|
||||
Reference in New Issue
Block a user