yuliang1112 пре 2 година
родитељ
комит
464ae865a8
4 измењених фајлова са 7 додато и 4 уклоњено
  1. 1 1
      db/workspace.go
  2. 1 2
      middleware/login_auth.go
  3. 1 1
      model/system_model/config.go
  4. 4 0
      service/login_auth.go

+ 1 - 1
db/workspace.go

@@ -96,7 +96,7 @@ func GetWorkspaceDDLproject(ctx context.Context, enterpriseID string, pageSize,
 func GetWorkspaceBarNums(ctx context.Context, enterpriseID string, projectType int64) (*http_model.WorkspaceBarNums, error) {
 	var workspaceNums http_model.WorkspaceBarNums
 	var DataPendingNum, LinkPendingNum, SketchPendingNum, ScriptPendingNum, AccSelecting, ShipmentPendingNum, ShippedNum int64
-	fmt.Printf("TypeShow %+v", projectType)
+	//fmt.Printf("TypeShow %+v", projectType)
 	//先查企业所属的全部项目
 	var RecruitingProjectIDs []string
 	db := GetReadDB(ctx)

+ 1 - 2
middleware/login_auth.go

@@ -1,7 +1,6 @@
 package middleware
 
 import (
-	"fmt"
 	"youngee_b_api/consts"
 	"youngee_b_api/model/redis_model"
 	"youngee_b_api/service"
@@ -15,7 +14,7 @@ import (
 func LoginAuthMiddleware(c *gin.Context) {
 	token := c.Request.Header.Get("Authorization")
 	if token != "" {
-		fmt.Println(token)
+		//fmt.Println(token)
 		if auth, err := service.LoginAuth.AuthToken(c, token); err == nil {
 			c.Set(consts.SessionAuthSchema, auth)
 			c.Next()

+ 1 - 1
model/system_model/config.go

@@ -19,7 +19,7 @@ type Redis struct {
 	Database int32  `yaml:"database"`
 }
 type Session struct {
-	TTL int32 `yaml:"ttl"`
+	 TTL int32 `yaml:"ttl"`
 }
 type Server struct {
 	Host    string   `yaml:"host"`

+ 4 - 0
service/login_auth.go

@@ -165,11 +165,13 @@ func (l *loginAuth) getSessionAuth(ctx context.Context, phone string) (*redis_mo
 	}
 	return auth, nil
 }
+
 func (l *loginAuth) getToken(ctx context.Context, phone string) string {
 	timeSeed := strconv.FormatInt(time.Now().Unix(), 10)
 	token := phone + "." + timeSeed + "." + util.MD5(phone, timeSeed, consts.AuthSalt)
 	return token
 }
+
 func (l *loginAuth) parseToken(ctx context.Context, token string) (string, error) {
 	parts := strings.Split(token, ".")
 	if len(parts) == 3 {
@@ -181,9 +183,11 @@ func (l *loginAuth) parseToken(ctx context.Context, token string) (string, error
 	}
 	return "", errors.New("token invalid")
 }
+
 func (l *loginAuth) encryptPassword(password string) string {
 	return util.MD5(password)
 }
+
 func (l *loginAuth) getRedisKey(key string) string {
 	return fmt.Sprintf("%s%s", consts.SessionRedisPrefix, key)
 }