article_author.go 745 B

123456789101112131415161718192021222324252627
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. )
  5. type CygxArticleAuthor struct {
  6. Id int `orm:"column(id);pk;"description:"主键ID"`
  7. ArticleId int `description:"文章ID"`
  8. Mobile string `description:"手机号"`
  9. Name string `description:"姓名"`
  10. }
  11. //获取数量
  12. func GetActivityAuthorCount(articcleId int, mobile string) (count int, err error) {
  13. o := orm.NewOrm()
  14. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_article_author WHERE article_id=? AND mobile = ? `
  15. err = o.Raw(sqlCount, articcleId, mobile).QueryRow(&count)
  16. return
  17. }
  18. //添加优化建议
  19. func AddCygxActivityAuthor(item *CygxArticleAuthor) (lastId int64, err error) {
  20. o := orm.NewOrm()
  21. lastId, err = o.Insert(item)
  22. return
  23. }