123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- 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:"手机号码"`
- UserId int `description:"用户ID"`
- 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:"外呼手机号区号"`
- }
- 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 GetCompanyPermission(companyId int) (permission string, err error) {
- sql := ` SELECT GROUP_CONCAT(DISTINCT b.chart_permission_name ORDER BY b.sort ASC SEPARATOR ',') AS permission
- 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('正式','试用','永续') `
- o := orm.NewOrm()
- err = o.Raw(sql, companyId).QueryRow(&permission)
- return
- }
- func GetCompanyPermissionId(companyId int) (permissionId string, err error) {
- 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('正式','试用','永续') `
- o := orm.NewOrm()
- err = o.Raw(sql, companyId).QueryRow(&permissionId)
- return
- }
- func UserSubscribe(subscribeType, userId int) (err error) {
- o := orm.NewOrm()
- sql := `UPDATE wx_user SET cygx_subscribe=?,cygx_subscribe_time=NOW() WHERE user_id = ? `
- _, err = o.Raw(sql, subscribeType, userId).Exec()
- return
- }
- func CygxUserSubscribe(subscribeType int, unionid string) (err error) {
- o := orm.NewOrmUsingDB("hz_cygx")
- sql := `UPDATE cygx_user_record SET subscribe=?,subscribe_time=NOW() WHERE union_id = ? `
- _, err = o.Raw(sql, subscribeType, unionid).Exec()
- return
- }
|