package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type UserDetail struct { Headimgurl string `description:"用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空"` Mobile string `description:"手机号码"` Email string `description:"邮箱"` NickName string `description:"用户昵称"` RealName string `description:"用户实际名称"` CompanyName string `description:"公司名称"` PermissionName string `description:"拥有权限分类,多个用英文逗号分隔"` HasPermission int `description:"1:无该行业权限,不存在权益客户下,2:潜在客户,未提交过申请,3:潜在客户,已提交过申请"` SellerMobile string `description:"销售手机号"` SellerName string `description:"销售名称"` Note string `json:"-" description:"申请提交时,公司名称"` CountryCode string `description:"区号"` OutboundMobile string `description:"外呼手机号"` OutboundCountryCode string `description:"外呼手机号区号"` PermissionStatus string `description:"状态"` StartDate string `description:"开始日期"` EndDate string `description:"结束日期"` CompanyPointsNum float64 `description:"公司剩余点数"` } type UserPermission struct { CompanyName string `description:"公司名称"` ChartPermissionName string `description:"权限"` } type LoginReq struct { LoginType int `description:"登录方式:1:微信手机,2:邮箱,3:自定义手机登录"` Mobile string `description:"手机号"` Email string `description:"邮箱"` VCode string `description:"验证码"` CountryCode string `description:"区号"` } type LoginResp struct { UserId int `description:"用户id"` Authorization string `description:"Token"` Headimgurl string `description:"用户头像"` Mobile string `description:"手机号"` Email string `description:"邮箱"` CompanyName string `description:"客户名称"` Status string `description:"状态"` EndDate string `description:"到期日期"` ProductName string `description:"客户类型名称"` } type CheckStatusResp struct { IsBind bool `description:"true:需要绑定手机号或邮箱,false:不需要绑定手机号或邮箱"` IsAuth bool `description:"true:需要授权,false:不需要授权"` PermissionName string `description:"拥有权限分类,多个用英文逗号分隔"` } type ApplyTryReq struct { BusinessCardUrl string `description:"名片地址"` RealName string `description:"姓名"` CompanyName string `description:"公司名称"` ApplyMethod int `description:"1:已付费客户申请试用,2:非客户申请试用,3:非客户申请试用(ficc下,不需要进行数据校验)"` } type CountryCode struct { IsNeedAddCountryCode bool `description:"是否需要填写区号:需要填写,false:不需要填写"` } type OutboundMobile struct { IsNeedAddOutboundMobile bool `description:"是否需要填写外呼手机号:需要填写,false:不需要填写"` } type CountryCodeItem struct { CountryCode string `description:"区号"` } // 修改外呼手机号 type OutboundMobileItem struct { OutboundMobile string `description:"外呼手机号"` OutboundCountryCode string `description:"外呼手机号区号"` ActivityId int `description:"活动ID"` } type UserWhiteList struct { Mobile string `description:"手机号码"` RealName string `description:"用户实际名称"` CompanyName string `description:"公司名称"` Permission string `description:"拥有权限分类,多个用英文逗号分隔"` CountryCode string `description:"区号"` SellerName string `description:"销售姓名"` CreatedTime time.Time Status string `description:"客户状态'试用','永续','冻结','流失','正式','潜在'"` } type UserWhiteListRep struct { List []*UserWhiteList } type UserDetailByUserLogin struct { Headimgurl string `description:"头像"` Mobile string `description:"手机号码"` RealName string `description:"用户实际名称"` CompanyName string `description:"公司名称"` Permission string `description:"拥有权限分类,多个用英文逗号分隔"` HasPermission int `description:"1:有该行业权限,正常展示,2:无权限,非潜在客户,3:未在小程序授权用户信息 等"` Token string `description:"Token"` } func GetCompanyPermissionId(companyId int) (permissionId string, err error) { o := orm.NewOrmUsingDB("weekly_report") sql := ` SELECT GROUP_CONCAT(DISTINCT b.chart_permission_id ORDER BY b.sort ASC SEPARATOR ',') AS permissionId FROM company_report_permission AS a INNER JOIN chart_permission AS b ON a.chart_permission_id=b.chart_permission_id INNER JOIN company_product AS c ON a.company_id=c.company_id AND a.product_id=c.product_id WHERE a.company_id=? AND c.is_suspend=0 AND b.cygx_auth=1 AND c.status IN('正式','试用','永续') AND a.status IN('正式','试用','永续') ` err = o.Raw(sql, companyId).QueryRow(&permissionId) return } func UserSubscribe(subscribeType, userId int) (err error) { o := orm.NewOrmUsingDB("weekly_report") sql := `UPDATE wx_user SET mfyx_subscribe=?,mfyx_subscribe_time=NOW() WHERE user_id = ? ` _, err = o.Raw(sql, subscribeType, userId).Exec() return } func UserSubscribeInit(subscribeType, userId int, mfyx_subscribe_time string) (err error) { o := orm.NewOrmUsingDB("weekly_report") sql := `UPDATE wx_user SET mfyx_subscribe=?,mfyx_subscribe_time=? WHERE user_id = ? ` _, err = o.Raw(sql, subscribeType, mfyx_subscribe_time, userId).Exec() return } func CygxUserSubscribe(subscribeType int, unionid string) (err error) { o := orm.NewOrm() sql := `UPDATE cygx_mfyx_gzh_user_record SET subscribe=?,subscribe_time=NOW() WHERE union_id = ? ` _, err = o.Raw(sql, subscribeType, unionid).Exec() return } func GetUserDetailByUserId(userId int) (item *UserDetail, err error) { o := orm.NewOrmUsingDB("weekly_report") sql := `SELECT * FROM wx_user WHERE user_id = ? ` err = o.Raw(sql, userId).QueryRow(&item) return }