|
@@ -8,14 +8,19 @@ package services
|
|
|
|
|
|
import (
|
|
|
"errors"
|
|
|
+ "fmt"
|
|
|
"log"
|
|
|
"net/http"
|
|
|
"net/url"
|
|
|
+ "time"
|
|
|
|
|
|
"github.com/kataras/iris/v12"
|
|
|
"go.mod/comm"
|
|
|
"go.mod/conf"
|
|
|
+ "go.mod/dao"
|
|
|
+ "go.mod/datasource"
|
|
|
"go.mod/lib"
|
|
|
+ "go.mod/models"
|
|
|
"go.mod/web/viewmodels"
|
|
|
)
|
|
|
|
|
@@ -38,14 +43,14 @@ type BackstageService interface {
|
|
|
//返回service操作类
|
|
|
type backstageService struct {
|
|
|
// projectAccountDao *dao.ProjectAccountDao
|
|
|
- // projectDao *dao.ProjectDao
|
|
|
+ managerDao *dao.ManagerDao
|
|
|
}
|
|
|
|
|
|
//创建项目用户service
|
|
|
func NewBackstageService() BackstageService {
|
|
|
return &backstageService{
|
|
|
// projectAccountDao: dao.NewProjectAccountDao(datasource.InstanceDbMaster()),
|
|
|
- // projectDao: dao.NewProjectDao(datasource.InstanceDbMaster()),
|
|
|
+ managerDao: dao.NewManagerDao(datasource.InstanceDbMaster()),
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -198,7 +203,29 @@ func (s *backstageService) ValidCldStaff(loginData viewmodels.StaffCld, writer h
|
|
|
return nil, errors.New(result.Msg)
|
|
|
}
|
|
|
|
|
|
- // 2.写入登录态
|
|
|
+ fmt.Println(result)
|
|
|
+
|
|
|
+ // 2.cld账号写入管理员表
|
|
|
+ managerData := s.managerDao.GetUserName(result.Data.UserName)
|
|
|
+ if managerData.Id == 0 {
|
|
|
+ // 写入管理表
|
|
|
+ manager := &models.CmManager{}
|
|
|
+
|
|
|
+ manager.Username = result.Data.UserName
|
|
|
+
|
|
|
+ manager.CreateTime = time.Now()
|
|
|
+ manager.LastLogin = time.Now()
|
|
|
+ manager.Category = result.Data.Category
|
|
|
+ manager.Telephone = ""
|
|
|
+ manager.Email = ""
|
|
|
+ manager.Qq = ""
|
|
|
+ manager.Fixedphone = ""
|
|
|
+ manager.Position = ""
|
|
|
+
|
|
|
+ // err := s.managerDao.Add(project)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3.写入登录态
|
|
|
// 加密用户标识
|
|
|
identity, err := comm.AesEncrypt(result.Data.UserName, conf.CookieSecret)
|
|
|
if err != nil {
|