|
@@ -25,14 +25,14 @@ type UserDetail struct {
|
|
}
|
|
}
|
|
|
|
|
|
func GetUserDetailByUserId(userId int) (item *UserDetail, err error) {
|
|
func GetUserDetailByUserId(userId int) (item *UserDetail, err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `SELECT * FROM wx_user WHERE user_id = ? `
|
|
sql := `SELECT * FROM wx_user WHERE user_id = ? `
|
|
err = o.Raw(sql, userId).QueryRow(&item)
|
|
err = o.Raw(sql, userId).QueryRow(&item)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func GetUserDetailByMobile(mobile string) (item *UserDetail, err error) {
|
|
func GetUserDetailByMobile(mobile string) (item *UserDetail, err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `SELECT * FROM wx_user WHERE mobile = ? `
|
|
sql := `SELECT * FROM wx_user WHERE mobile = ? `
|
|
err = o.Raw(sql, mobile).QueryRow(&item)
|
|
err = o.Raw(sql, mobile).QueryRow(&item)
|
|
return
|
|
return
|
|
@@ -64,7 +64,7 @@ func PcBindMobile(unionId, mobile string, userId, loginType int) (wxUserId int,
|
|
sql = "SELECT * FROM wx_user WHERE email = ? "
|
|
sql = "SELECT * FROM wx_user WHERE email = ? "
|
|
}
|
|
}
|
|
user := new(WxUser)
|
|
user := new(WxUser)
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
err = o.Raw(sql, mobile).QueryRow(&user)
|
|
err = o.Raw(sql, mobile).QueryRow(&user)
|
|
|
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
@@ -216,7 +216,7 @@ func GetCompanyPermission(companyId int) (permission string, err error) {
|
|
AND b.cygx_auth=1
|
|
AND b.cygx_auth=1
|
|
AND c.status IN('正式','试用','永续')
|
|
AND c.status IN('正式','试用','永续')
|
|
AND a.status IN('正式','试用','永续') `
|
|
AND a.status IN('正式','试用','永续') `
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
err = o.Raw(sql, companyId).QueryRow(&permission)
|
|
err = o.Raw(sql, companyId).QueryRow(&permission)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -231,7 +231,7 @@ func GetCompanyPermissionName(companyId int) (permission string, err error) {
|
|
AND b.cygx_auth=1
|
|
AND b.cygx_auth=1
|
|
AND c.status IN('正式','试用','永续')
|
|
AND c.status IN('正式','试用','永续')
|
|
AND a.status IN('正式','试用','永续') `
|
|
AND a.status IN('正式','试用','永续') `
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
err = o.Raw(sql, companyId).QueryRow(&permission)
|
|
err = o.Raw(sql, companyId).QueryRow(&permission)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -246,14 +246,14 @@ func GetCompanyPermissionId(companyId int) (permissionId string, err error) {
|
|
AND b.cygx_auth=1
|
|
AND b.cygx_auth=1
|
|
AND c.status IN('正式','试用','永续')
|
|
AND c.status IN('正式','试用','永续')
|
|
AND a.status IN('正式','试用','永续') `
|
|
AND a.status IN('正式','试用','永续') `
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
err = o.Raw(sql, companyId).QueryRow(&permissionId)
|
|
err = o.Raw(sql, companyId).QueryRow(&permissionId)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
// 用户绑定手机号时同时绑定外呼手机号
|
|
// 用户绑定手机号时同时绑定外呼手机号
|
|
func BindUserOutboundMobile(mobile, countryCode string, userId int) (err error) {
|
|
func BindUserOutboundMobile(mobile, countryCode string, userId int) (err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `UPDATE wx_user SET outbound_mobile=? ,outbound_country_code = ?, country_code= ? WHERE user_id=? `
|
|
sql := `UPDATE wx_user SET outbound_mobile=? ,outbound_country_code = ?, country_code= ? WHERE user_id=? `
|
|
_, err = o.Raw(sql, mobile, countryCode, countryCode, userId).Exec()
|
|
_, err = o.Raw(sql, mobile, countryCode, countryCode, userId).Exec()
|
|
return
|
|
return
|
|
@@ -269,7 +269,7 @@ type UserPermissionAuthInfo struct {
|
|
|
|
|
|
// 修改用户是否绑定外呼手机号弹窗
|
|
// 修改用户是否绑定外呼手机号弹窗
|
|
func ModifyWxUserIsMsgOutboundMobile(userId int) (err error) {
|
|
func ModifyWxUserIsMsgOutboundMobile(userId int) (err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `UPDATE wx_user SET is_msg_outbound_mobile=1 WHERE user_id=? `
|
|
sql := `UPDATE wx_user SET is_msg_outbound_mobile=1 WHERE user_id=? `
|
|
_, err = o.Raw(sql, userId).Exec()
|
|
_, err = o.Raw(sql, userId).Exec()
|
|
return
|
|
return
|
|
@@ -277,7 +277,7 @@ func ModifyWxUserIsMsgOutboundMobile(userId int) (err error) {
|
|
|
|
|
|
// 已经绑定手机号,没有绑定外呼手机号的的用户,预约外呼的时候,将外呼手机号同步成手机号
|
|
// 已经绑定手机号,没有绑定外呼手机号的的用户,预约外呼的时候,将外呼手机号同步成手机号
|
|
func BindUserOutboundMobileByMobile(mobile, countryCode string, userId int) (err error) {
|
|
func BindUserOutboundMobileByMobile(mobile, countryCode string, userId int) (err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `UPDATE wx_user SET outbound_mobile=? ,outbound_country_code = ? WHERE user_id=? `
|
|
sql := `UPDATE wx_user SET outbound_mobile=? ,outbound_country_code = ? WHERE user_id=? `
|
|
_, err = o.Raw(sql, mobile, countryCode, userId).Exec()
|
|
_, err = o.Raw(sql, mobile, countryCode, userId).Exec()
|
|
return
|
|
return
|
|
@@ -290,7 +290,7 @@ func GetWxUserByMobiles(mobiles []string) (items []*WxUser, err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
sql := `SELECT* FROM wx_user WHERE mobile in (` + utils.GetOrmInReplace(lenmobiles) + `) `
|
|
sql := `SELECT* FROM wx_user WHERE mobile in (` + utils.GetOrmInReplace(lenmobiles) + `) `
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
_, err = o.Raw(sql, mobiles).QueryRows(&items)
|
|
_, err = o.Raw(sql, mobiles).QueryRows(&items)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -310,13 +310,13 @@ func GetUserCompanyPermissionSand(companyId int) (items []*ChartPermissionResp,
|
|
AND b.chart_permission_name != '专家'
|
|
AND b.chart_permission_name != '专家'
|
|
GROUP BY b.chart_permission_name
|
|
GROUP BY b.chart_permission_name
|
|
ORDER BY b.sort ASC `
|
|
ORDER BY b.sort ASC `
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
_, err = o.Raw(sql, companyId).QueryRows(&items)
|
|
_, err = o.Raw(sql, companyId).QueryRows(&items)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func AddOutboundMobile(item *OutboundMobileItem, userId int) (err error) {
|
|
func AddOutboundMobile(item *OutboundMobileItem, userId int) (err error) {
|
|
- o, err := orm.NewOrm().Begin()
|
|
|
|
|
|
+ o, err := orm.NewOrmUsingDB("weekly_report").Begin()
|
|
if err != nil {
|
|
if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -346,7 +346,7 @@ type Headimgurl struct {
|
|
|
|
|
|
// 更改用户头像
|
|
// 更改用户头像
|
|
func UpdateUserHeadimgurl(headimgurl string, userId int) (err error) {
|
|
func UpdateUserHeadimgurl(headimgurl string, userId int) (err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `UPDATE wx_user SET headimgurl = ? WHERE user_id=? `
|
|
sql := `UPDATE wx_user SET headimgurl = ? WHERE user_id=? `
|
|
_, err = o.Raw(sql, headimgurl, userId).Exec()
|
|
_, err = o.Raw(sql, headimgurl, userId).Exec()
|
|
return
|
|
return
|
|
@@ -354,7 +354,7 @@ func UpdateUserHeadimgurl(headimgurl string, userId int) (err error) {
|
|
|
|
|
|
// 更改用户邮箱号
|
|
// 更改用户邮箱号
|
|
func UpdateUserEmail(email string, userId int) (err error) {
|
|
func UpdateUserEmail(email string, userId int) (err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `UPDATE wx_user SET email = ? WHERE user_id=? `
|
|
sql := `UPDATE wx_user SET email = ? WHERE user_id=? `
|
|
_, err = o.Raw(sql, email, userId).Exec()
|
|
_, err = o.Raw(sql, email, userId).Exec()
|
|
return
|
|
return
|