1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package cygx
- import (
- "github.com/beego/beego/v2/client/orm"
- )
- type ActivityHelpAsk struct {
- AskId int `orm:"column(ask_id);主键ID"`
- ActivityId int `description:"活动ID"`
- UserId int `description:"用户ID"`
- CreateTime string `description:"创建时间"`
- Mobile string `description:"手机号"`
- CompanyName string `description:"公司名称"`
- CompanyId int `description:"公司ID"`
- RealName string `description:"姓名"`
- Content string `description:"内容"`
- }
- type ActivityHelpAskListResp struct {
- List []*ActivityHelpAsk
- }
- // 列表
- func GetActivityHelpAskList(activityId int) (items []*ActivityHelpAsk, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := `SELECT k.*
- FROM cygx_activity_help_ask as k
- WHERE activity_id = ? ORDER BY create_time DESC`
- _, err = o.Raw(sql, activityId).QueryRows(&items)
- return
- }
- // 获取活动带问的用户的openID
- func GetActivityHelpAskOpenIdList(activityId int) (items []*OpenIdList, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- var sql string
- sql = `SELECT DISTINCT
- u.open_id,
- u.cygx_user_id AS user_id
- FROM
- cygx_activity_help_ask AS m
- INNER JOIN cygx_user_record AS u ON u.cygx_bind_account = m.mobile
- AND u.cygx_user_id = m.user_id
- WHERE
- m.activity_id = ? `
- _, err = o.Raw(sql, activityId).QueryRows(&items)
- return
- }
- // 获取活动带问的用户的openID
- func GetMfyxActivityHelpAskOpenIdList(activityId int) (items []*OpenIdList, err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- var sql string
- sql = `SELECT DISTINCT
- u.open_id,
- u.cygx_user_id AS user_id
- FROM
- cygx_activity_help_ask AS m
- INNER JOIN cygx_mfyx_gzh_user_record AS u ON u.cygx_bind_account = m.mobile
- AND u.cygx_user_id = m.user_id
- WHERE
- m.activity_id = ? `
- _, err = o.Raw(sql, activityId).QueryRows(&items)
- return
- }
|