123456789101112131415161718192021222324252627282930313233343536373839 |
- package models
- import "github.com/rdlucklib/rdluck_tools/orm"
- type FreeViewerDetails struct {
- UserId int
- RealName string
- Mobile string
- Note string
- CreatedTime string
- MaxCreatedTime string
- Email string
- }
- func GetFreeViewerDetails(startTime, endTime string) (items []*FreeViewerDetails, err error) {
- sql := `select u.user_id,u.real_name,u.mobile,u.note,u.created_time,max(uvh.created_time) as max_created_time,u.email
- from wx_user u
- LEFT JOIN user_view_history uvh on u.user_id = uvh.user_id
- INNER JOIN user_record AS c ON u.user_id=c.user_id
- where u.company_id = 1
- and u.is_deal=0
- and u.apply_method<>2
- and u.mobile is not null
- AND u.mobile<>''
- and u.created_time > ?
- and u.created_time <= ?
- AND c.create_platform<>4
- AND u.is_deal = 0
- group by u.user_id`
- _, err = orm.NewOrm().Raw(sql, startTime, endTime).QueryRows(&items)
- return
- }
- // DealWxUser 处理用户标记状态
- func DealWxUser(userId int) (err error) {
- sql := `update wx_user set is_deal = 1 where user_id=?`
- _, err = orm.NewOrm().Raw(sql, userId).Exec()
- return
- }
|