|
@@ -1,6 +1,7 @@
|
|
|
package service
|
|
|
|
|
|
import (
|
|
|
+ "app.yhyue.com/moapp/jypkg/common/src/qfw/util/dataexport"
|
|
|
"context"
|
|
|
"fmt"
|
|
|
"jy/src/jfw/modules/subscribepay/src/config"
|
|
@@ -13,17 +14,17 @@ import (
|
|
|
"strings"
|
|
|
"time"
|
|
|
|
|
|
- "github.com/gogf/gf/v2/frame/g"
|
|
|
- "github.com/gogf/gf/v2/util/gconv"
|
|
|
-
|
|
|
. "app.yhyue.com/moapp/jybase/api"
|
|
|
qutil "app.yhyue.com/moapp/jybase/common"
|
|
|
+ . "app.yhyue.com/moapp/jybase/date"
|
|
|
"app.yhyue.com/moapp/jybase/encrypt"
|
|
|
"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
"app.yhyue.com/moapp/jybase/go-xweb/xweb"
|
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
|
"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
pcc "bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/pb"
|
|
|
+ "github.com/gogf/gf/v2/frame/g"
|
|
|
+ "github.com/gogf/gf/v2/util/gconv"
|
|
|
)
|
|
|
|
|
|
type UserAccount struct {
|
|
@@ -396,6 +397,72 @@ func getPhoneByUserId(userId string) (phone string) {
|
|
|
return ""
|
|
|
}
|
|
|
|
|
|
+// 我的页面 获取基本信息
|
|
|
+// 手机号 邮箱 头像 昵称 超级订阅 大会员 用户加密id
|
|
|
+func (this *UserAccount) GetAccountInfo() {
|
|
|
+ rData, errMsg := func() (interface{}, error) {
|
|
|
+ sessVal := this.Session().GetMultiple()
|
|
|
+ userId, _ := sessVal["mgoUserId"].(string)
|
|
|
+ //由于超级订阅vip状态需要查库,无法从session中获取,所以直接所有字段从数据库中获取
|
|
|
+ userMsg := util.Compatible.Select(userId, `{"s_m_phone":1,"s_phone":1,"s_myemail":1,"s_nickname":1,"s_headimageurl":1,"s_password":1,"s_company":1,"s_unionid":1}`)
|
|
|
+ if userMsg == nil || len(*userMsg) == 0 {
|
|
|
+ return nil, DBQUERY_ERROR
|
|
|
+ }
|
|
|
+ //微信昵称>手机号>剑鱼昵称
|
|
|
+ nickname := qutil.ObjToString((*userMsg)["s_nickname"])
|
|
|
+ phone := qutil.ObjToString(qutil.If((*userMsg)["s_phone"] != nil, (*userMsg)["s_phone"], (*userMsg)["s_m_phone"]))
|
|
|
+ jyname := qutil.ObjToString((*userMsg)["s_jyname"])
|
|
|
+ isWx := false
|
|
|
+ if unionid, ok := (*userMsg)["s_unionid"]; ok {
|
|
|
+ if len(qutil.ObjToString(unionid)) > 11 { //手机号用户s_unionid为手机号
|
|
|
+ isWx = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ breakRenewTip := 0
|
|
|
+ orders := util.Mysql.SelectBySql(`SELECT pay_time from dataexport_order where user_id=? and order_status=1 and product_type='VIP订阅' and vip_type is null order by pay_time desc limit 1`, userId)
|
|
|
+ if orders != nil && len(*orders) == 1 {
|
|
|
+ timeA, errorA := time.ParseInLocation(Date_Full_Layout, config.Config.BreakRenewTipTime, time.Local)
|
|
|
+ timeB, errorB := time.ParseInLocation(Date_Full_Layout, qutil.ObjToString((*orders)[0]["pay_time"]), time.Local)
|
|
|
+ if errorA == nil && errorB == nil && timeB.Before(timeA) {
|
|
|
+ breakRenewTip = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ b := jy.GetBigVipUserBaseMsg(this.Session(), *config.Middleground)
|
|
|
+ //s从数据导出填写的邮箱或者从数据定制服务这里获取的邮箱
|
|
|
+ _, otherMail := dataexport.GetLastExportPhoneAndMail(util.Mysql, qutil.ObjToString(sessVal["userId"]))
|
|
|
+ if otherMail == "" {
|
|
|
+ saleData, _ := util.MQFW.FindOne("saleLeads", map[string]interface{}{
|
|
|
+ "userid": sessVal["userId"],
|
|
|
+ "mail": map[string]interface{}{
|
|
|
+ "$exists": true,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ if saleData != nil && len(*saleData) > 0 {
|
|
|
+ otherMail = qutil.ObjToString((*saleData)["mail"])
|
|
|
+ }
|
|
|
+ if qutil.ObjToString((*userMsg)["s_myemail"]) != "" {
|
|
|
+ otherMail = qutil.ObjToString((*userMsg)["s_myemail"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return map[string]interface{}{
|
|
|
+ "userId": encrypt.EncodeArticleId(userId),
|
|
|
+ "email": qutil.ObjToString((*userMsg)["s_myemail"]),
|
|
|
+ "phone": phone,
|
|
|
+ "nickname": nickname,
|
|
|
+ "jyname": jyname,
|
|
|
+ "headimageurl": strings.Replace(qutil.ObjToString((*userMsg)["s_headimageurl"]), "http://", "https://", 1),
|
|
|
+ "bigmemberVip": b.Status,
|
|
|
+ "subscribeVip": b.VipStatus,
|
|
|
+ "hasPwd": qutil.ObjToString((*userMsg)["s_password"]) != "",
|
|
|
+ "company": qutil.ObjToString((*userMsg)["s_company"]),
|
|
|
+ "isWx": isWx, //是否是微信账号
|
|
|
+ "breakRenewTip": breakRenewTip,
|
|
|
+ "otherMail": otherMail, //从数据导出填写的邮箱或者从数据定制服务这里获取的邮箱
|
|
|
+ }, nil
|
|
|
+ }()
|
|
|
+ this.ServeJson(NewResult(rData, errMsg))
|
|
|
+}
|
|
|
+
|
|
|
// 获取用户unionid
|
|
|
func getWxUnionId(userId string) (uninoId string) {
|
|
|
if userId != "" {
|