12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxYanxuanSpecialFollow struct {
- CygxYanxuanSpecialFollowId int `orm:"column(cygx_yanxuan_special_follow_id);pk"`
- UserId int
- FollowUserId int
- Mobile string
- Email string
- CompanyId int
- CompanyName string
- RealName string
- SellerName string
- CreateTime time.Time
- ModifyTime time.Time
- RegisterPlatform int
- YanxuanSpecialId int
- }
- type FollowCygxYanxuanSpecialReq struct {
- FollowSpecialColumnId int
- Status int
- SpecialId int
- }
- func AddCygxYanxuanSpecialFollow(item *CygxYanxuanSpecialFollow) (err error) {
- o := orm.NewOrm()
- _, err = o.Insert(item)
- return
- }
- func DelCygxYanxuanSpecialFollow(userId, followUserId int) (err error) {
- o := orm.NewOrm()
- sql := `DELETE FROM cygx_yanxuan_special_follow WHERE user_id=? AND follow_user_id=? `
- _, err = o.Raw(sql, userId, followUserId).Exec()
- return
- }
- func GetCygxYanxuanSpecialFollowOpenIdList(followUserId int) (items []*OpenIdList, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- cr.*,
- c.user_id
- FROM
- user_record AS c
- INNER JOIN cygx_user_record AS cr ON cr.union_id = c.union_id
- INNER JOIN cygx_yanxuan_special_follow AS cf ON cf.user_id = c.user_id
- AND cf.follow_user_id = ?
- WHERE
- create_platform = 4 `
- _, err = o.Raw(sql, followUserId).QueryRows(&items)
- return
- }
- func GetCygxYanxuanSpecialFollowCount(condition string, pars []interface{}) (count int, err error) {
- sqlCount := ` SELECT COUNT(1) AS count FROM cygx_yanxuan_special_follow as a WHERE 1= 1 `
- if condition != "" {
- sqlCount += condition
- }
- o := orm.NewOrm()
- err = o.Raw(sqlCount, pars).QueryRow(&count)
- return
- }
- func GetCygxYanxuanSpecialFollowCountByUser(userId, followUserId int) (count int, err error) {
- sqlCount := ` SELECT COUNT(1) AS count FROM cygx_yanxuan_special_follow as a WHERE user_id=? AND follow_user_id=? `
- o := orm.NewOrm()
- err = o.Raw(sqlCount, userId, followUserId).QueryRow(&count)
- return
- }
|