123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- package cygx
- import (
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- "time"
- )
- type CygxYanxuanSpecialAuthor struct {
- Id int `orm:"column(id);pk"`
- UserId int
- SpecialName string
- Introduction string
- Label string
- NickName string
- RealName string
- Mobile string
- MobileInit string
- CreateTime time.Time
- ModifyTime time.Time
- HeadImg string
- BgImg string
- BgImgDown string
- BgImgPc string
- Status int
- CompanyId int `description:"公司id"`
- CompanyName string `description:"公司名称"`
- InviteName string
- Remark string
- }
- type CygxYanxuanSpecialAuthorItem struct {
- Id int `orm:"column(id);pk"`
- UserId int
- CompanyName string
- CompanyId int
- SpecialName string
- Introduction string
- Label string
- NickName string
- RealName string
- Mobile string
- MobileInit string
- CreateTime string
- ModifyTime string
- HeadImg string
- BgImg string
- Status int
- Pv int
- Uv int
- ArticleNum int
- ArticlePublishTime string
- FansNum int
- ArticleCollectNum int
- SpecialAuthorId int
- InviteName string
- Remark string
- }
- type CygxYanxuanSpecialKeyWordReesp struct {
- KeyWord string
- }
- type CygxYanxuanSpecialKeyWordListReesp struct {
- List []*CygxYanxuanSpecialKeyWordReesp
- }
- func AddCygxYanxuanSpecialAuthor(item *CygxYanxuanSpecialAuthor) (lastId int64, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- lastId, err = o.Insert(item)
- return
- }
- type AddCygxYanxuanSpecialAuthorReq struct {
- UserId int
- RealName string
- Mobile string
- InviteName string
- Remark string
- }
- type EnableCygxYanxuanSpecialAuthorReq struct {
- UserId int
- Status int
- }
- func EnableYanxuanSpecialAuthor(userId, status int) (err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := ``
- sql = `UPDATE cygx_yanxuan_special_author SET status=? WHERE user_id = ? `
- _, err = o.Raw(sql, status, userId).Exec()
- return
- }
- func GetYanxuanSpecialAuthorCount(condition string, pars []interface{}) (count int, err error) {
- sqlCount := ` SELECT COUNT(1) AS count FROM cygx_yanxuan_special_author as art WHERE 1= 1 `
- if condition != "" {
- sqlCount += condition
- }
- o := orm.NewOrmUsingDB("hz_cygx")
- err = o.Raw(sqlCount, pars).QueryRow(&count)
- return
- }
- type GetCygxYanxuanSpecialAuthorItemResp struct {
- Paging *paging.PagingItem `description:"分页数据"`
- List []*CygxYanxuanSpecialAuthorItem
- }
- func GetYanxuanSpecialAuthorList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxYanxuanSpecialAuthorItem, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := `SELECT * FROM cygx_yanxuan_special_author as art WHERE 1= 1 `
- if condition != "" {
- sql += condition
- }
- sql += ` LIMIT ?,? `
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
- return
- }
- func UpdateSpecialAuthorComapony(userId, CompanyId int, CompanyName string) (err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := ``
- sql = `UPDATE cygx_yanxuan_special_author SET company_id=?,company_name = ? WHERE user_id = ? `
- _, err = o.Raw(sql, CompanyId, CompanyName, userId).Exec()
- return
- }
- func GetCygxYanxuanSpecialAuthorItemById(id int) (item *CygxYanxuanSpecialAuthorItem, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := `SELECT * FROM cygx_yanxuan_special_author WHERE id=? `
- err = o.Raw(sql, id).QueryRow(&item)
- return
- }
- func GetCygxYanxuanSpecialAuthorByUserId(userId int) (item *CygxYanxuanSpecialAuthorItem, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := `SELECT * FROM cygx_yanxuan_special_author WHERE user_id = ? `
- err = o.Raw(sql, userId).QueryRow(&item)
- return
- }
- type CygxYanxuanSpecialCenterAuthorResp struct {
- Id int
- UserId int
- PublishTime string
- Title string
- }
- func UpdateSpecialAuthormobile_init(mobile_init string, userId int) (err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := ``
- sql = `UPDATE cygx_yanxuan_special_author SET mobile_init = ? WHERE user_id = ? `
- _, err = o.Raw(sql, mobile_init, userId).Exec()
- return
- }
- func UpdateYanxuanSpecialAuthorInviteName(inviteName, remark string, userId int) (err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := ``
- sql = `UPDATE cygx_yanxuan_special_author SET invite_name=? , remark = ? WHERE user_id = ? `
- _, err = o.Raw(sql, inviteName, remark, userId).Exec()
- return
- }
|