ziwen 1 年之前
父節點
當前提交
94a17d23c8
共有 2 個文件被更改,包括 8 次插入19 次删除
  1. 5 12
      controllers/yanxuan_special.go
  2. 3 7
      models/cygx_yanxuan_special_user.go

+ 5 - 12
controllers/yanxuan_special.go

@@ -148,35 +148,28 @@ func (this *YanxuanSpecialController) AuthorSave() {
 		return
 	}
 
-	if req.Id <= 0 {
-		br.Msg = "作者id有误"
-		return
-	}
+
 	if req.UserId <= 0 {
 		br.Msg = "用户id有误"
 		return
 	}
-	if req.RealName == "" {
-		br.Msg = "请输入内容"
+	if req.SpecialName == "" {
+		br.Msg = "请输入专栏名称"
 		return
 	}
-	if req.Mobile == "" {
-		br.Msg = "请输入内容"
+	if req.NickName == "" {
+		br.Msg = "请输入昵称"
 		return
 	}
 
 	item := models.CygxYanxuanSpecialAuthor{
-		Id:           req.Id,
 		UserId:       req.UserId,
 		SpecialName:  req.SpecialName,
 		Introduction: req.Introduction,
 		Label:        req.Label,
 		NickName:     req.NickName,
-		RealName:     req.RealName,
-		Mobile:       req.Mobile,
 		CreateTime:   time.Now(),
 		ModifyTime:   time.Now(),
-		HeadImg:      "",
 		BgImg:        "",
 		Status:       1,
 	}

+ 3 - 7
models/cygx_yanxuan_special_user.go

@@ -76,23 +76,19 @@ FROM
 }
 
 type SaveCygxYanxuanSpecialAuthorReq struct {
-	Id           int
 	UserId       int       // 用户ID
 	SpecialName  string    // 专栏名称
 	Introduction string    // 介绍
 	Label        string    // 标签
 	NickName     string    // 昵称
-	RealName     string    // 姓名
-	Mobile       string    // 手机号
-	HeadImg      string    // 头像
 	BgImg        string    // 背景图
 }
 
 func UpdateYanxuanSpecialAuthor(item *CygxYanxuanSpecialAuthor) (err error) {
 	o := orm.NewOrm()
 	sql := ``
-	sql = `UPDATE cygx_yanxuan_special_author SET special_name=?,introduction=?,label=?,nick_name=?,
-	head_img=?,modify_time=NOW() WHERE id = ? `
-	_, err = o.Raw(sql, item.SpecialName, item.Introduction, item.Label, item.NickName, item.HeadImg).Exec()
+	sql = `UPDATE cygx_yanxuan_special_author SET special_name=?,introduction=?,label=?,nick_name=?
+	,modify_time=NOW() WHERE user_id = ? `
+	_, err = o.Raw(sql, item.SpecialName, item.Introduction, item.Label, item.NickName, item.UserId).Exec()
 	return
 }