ziwen 1 年之前
父節點
當前提交
c7de15ca15
共有 2 個文件被更改,包括 32 次插入24 次删除
  1. 32 22
      controllers/yanxuan_special.go
  2. 0 2
      models/cygx_yanxuan_special_user.go

+ 32 - 22
controllers/yanxuan_special.go

@@ -40,13 +40,14 @@ func (this *YanxuanSpecialController) List() {
 	if userId > 0 {
 		condition += ` AND a.user_id = ? `
 		pars = append(pars, userId)
+	}
 
-		specialUser, err = models.GetYanxuanSpecialAuthor(userId)
-		if err != nil && err.Error() != utils.ErrNoRow(){
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取失败, Err:" + err.Error()
-			return
-		}
+
+	specialUser, err = models.GetYanxuanSpecialAuthor(sysUser.UserId)
+	if err != nil && err.Error() != utils.ErrNoRow(){
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败, Err:" + err.Error()
+		return
 	}
 
 	condition += ` AND a.status = 2 `
@@ -147,8 +148,12 @@ func (this *YanxuanSpecialController) AuthorSave() {
 		return
 	}
 
+	if req.Id <= 0 {
+		br.Msg = "作者id有误"
+		return
+	}
 	if req.UserId <= 0 {
-		br.Msg = "请输入内容"
+		br.Msg = "用户id有误"
 		return
 	}
 	if req.RealName == "" {
@@ -176,23 +181,28 @@ func (this *YanxuanSpecialController) AuthorSave() {
 		Status:       1,
 	}
 
-	if req.Id == 0{
-		_, err = models.AddCygxYanxuanSpecialAuthor(&item)
-		if err != nil {
-			br.Msg = "新增失败"
-			br.ErrMsg = "新增失败,Err:" + err.Error()
-			return
-		}
-	} else {
-		err = models.UpdateYanxuanSpecialAuthor(&item)
-		if err != nil {
-			br.Msg = "保存失败"
-			br.ErrMsg = "保存失败,Err:" + err.Error()
-			return
-		}
+	//if req.Id == 0{
+	//	_, err = models.AddCygxYanxuanSpecialAuthor(&item)
+	//	if err != nil {
+	//		br.Msg = "新增失败"
+	//		br.ErrMsg = "新增失败,Err:" + err.Error()
+	//		return
+	//	}
+	//} else {
+	//	err = models.UpdateYanxuanSpecialAuthor(&item)
+	//	if err != nil {
+	//		br.Msg = "保存失败"
+	//		br.ErrMsg = "保存失败,Err:" + err.Error()
+	//		return
+	//	}
+	//}
+	err = models.UpdateYanxuanSpecialAuthor(&item)
+	if err != nil {
+		br.Msg = "保存失败"
+		br.ErrMsg = "保存失败,Err:" + err.Error()
+		return
 	}
 
-
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "保存成功"

+ 0 - 2
models/cygx_yanxuan_special_user.go

@@ -84,8 +84,6 @@ type SaveCygxYanxuanSpecialAuthorReq struct {
 	NickName     string    // 昵称
 	RealName     string    // 姓名
 	Mobile       string    // 手机号
-	CreateTime   time.Time // 创建时间
-	ModifyTime   time.Time // 修改时间
 	HeadImg      string    // 头像
 	BgImg        string    // 背景图
 }