Browse Source

no message

xingzai 1 year ago
parent
commit
5e881c204f
2 changed files with 22 additions and 10 deletions
  1. 20 10
      controllers/cygx/yanxuan_special.go
  2. 2 0
      models/cygx/cygx_yanxuan_special_user.go

+ 20 - 10
controllers/cygx/yanxuan_special.go

@@ -55,18 +55,28 @@ func (this *YanxuanSpecialController) Add() {
 		br.Msg = "请输入手机号"
 		return
 	}
+
+	infoUser, err := cygx.GetUserAndCompanyNameList(req.UserId)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+
 	rnd := utils.GetRandInt(1, 5)
 	item := cygx.CygxYanxuanSpecialAuthor{
-		UserId:     req.UserId,
-		RealName:   req.RealName,
-		Mobile:     req.Mobile,
-		CreateTime: time.Now(),
-		ModifyTime: time.Now(),
-		HeadImg:    utils.CYGX_YANXUAN_SPECIAL_HEAD_IMG_URL + strconv.Itoa(rnd) + ".png",
-		BgImg:      utils.CYGX_YANXUAN_SPECIAL_BG_IMG_URL + strconv.Itoa(rnd) + "a.png",
-		BgImgDown:  utils.CYGX_YANXUAN_SPECIAL_BG_IMG_URL + strconv.Itoa(rnd) + "b.png",
-		BgImgPc:    utils.CYGX_YANXUAN_SPECIAL_BG_IMG_URL_PC + strconv.Itoa(rnd) + ".png",
-		Status:     1,
+		UserId:      req.UserId,
+		RealName:    req.RealName,
+		Mobile:      req.Mobile,
+		CompanyName: infoUser.CompanyName,
+		CompanyId:   infoUser.CompanyId,
+		CreateTime:  time.Now(),
+		ModifyTime:  time.Now(),
+		HeadImg:     utils.CYGX_YANXUAN_SPECIAL_HEAD_IMG_URL + strconv.Itoa(rnd) + ".png",
+		BgImg:       utils.CYGX_YANXUAN_SPECIAL_BG_IMG_URL + strconv.Itoa(rnd) + "a.png",
+		BgImgDown:   utils.CYGX_YANXUAN_SPECIAL_BG_IMG_URL + strconv.Itoa(rnd) + "b.png",
+		BgImgPc:     utils.CYGX_YANXUAN_SPECIAL_BG_IMG_URL_PC + strconv.Itoa(rnd) + ".png",
+		Status:      1,
 	}
 
 	_, err = cygx.AddCygxYanxuanSpecialAuthor(&item)

+ 2 - 0
models/cygx/cygx_yanxuan_special_user.go

@@ -21,6 +21,8 @@ type CygxYanxuanSpecialAuthor struct {
 	BgImgDown    string    // 背景图下部分
 	BgImgPc      string    // pc背景图
 	Status       int       // 1启用2禁用
+	CompanyId    int       `description:"公司id"`
+	CompanyName  string    `description:"公司名称"`
 }
 
 type CygxYanxuanSpecialAuthorItem struct {