|
@@ -1,45 +1,47 @@
|
|
|
package util
|
|
|
|
|
|
import (
|
|
|
- "app.yhyue.com/moapp/jybase/common"
|
|
|
- "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
- "jy/src/jfw/modules/publicapply/src/db"
|
|
|
+ "app.yhyue.com/moapp/jybase/common"
|
|
|
+ "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
+ "jy/src/jfw/modules/publicapply/src/db"
|
|
|
)
|
|
|
|
|
|
// SessUserInfo 从session获取用户基本信息
|
|
|
type SessUserInfo struct {
|
|
|
- BaseUserId int64
|
|
|
- AccountId int64
|
|
|
- EntId int64
|
|
|
- PositionType int64
|
|
|
- PositionId int64
|
|
|
- EntUserId int64
|
|
|
- Phone string
|
|
|
- MgoUserId string
|
|
|
- UserId string
|
|
|
+ BaseUserId int64
|
|
|
+ AccountId int64
|
|
|
+ EntId int64
|
|
|
+ PositionType int64
|
|
|
+ PositionId int64
|
|
|
+ EntUserId int64
|
|
|
+ Phone string
|
|
|
+ MgoUserId string
|
|
|
+ UserId string
|
|
|
}
|
|
|
|
|
|
// GetUserBaseInfo 获取用户基本信息从session
|
|
|
func GetUserBaseInfo(sess *httpsession.Session) SessUserInfo {
|
|
|
- getSession := sess.GetMultiple()
|
|
|
- return SessUserInfo{
|
|
|
- MgoUserId: common.ObjToString(getSession["mgoUserId"]),
|
|
|
- BaseUserId: common.Int64All(getSession["base_user_id"]),
|
|
|
- AccountId: common.Int64All(getSession["accountId"]),
|
|
|
- EntId: common.Int64All(getSession["entId"]),
|
|
|
- PositionType: common.Int64All(getSession["positionType"]),
|
|
|
- PositionId: common.Int64All(getSession["positionId"]),
|
|
|
- Phone: common.ObjToString(getSession["phone"]),
|
|
|
- UserId: common.ObjToString(getSession["userId"]),
|
|
|
- EntUserId: common.Int64All(getSession["entUserId"]),
|
|
|
- }
|
|
|
+ getSession := sess.GetMultiple()
|
|
|
+ return SessUserInfo{
|
|
|
+ MgoUserId: common.ObjToString(getSession["mgoUserId"]),
|
|
|
+ BaseUserId: common.Int64All(getSession["base_user_id"]),
|
|
|
+ AccountId: common.Int64All(getSession["accountId"]),
|
|
|
+ EntId: common.Int64All(getSession["entId"]),
|
|
|
+ PositionType: common.Int64All(getSession["positionType"]),
|
|
|
+ PositionId: common.Int64All(getSession["positionId"]),
|
|
|
+ Phone: common.ObjToString(getSession["phone"]),
|
|
|
+ UserId: common.ObjToString(getSession["userId"]),
|
|
|
+ EntUserId: common.Int64All(getSession["entUserId"]),
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 手机号用户是否存在
|
|
|
func UserIsExists(phoneNum string) bool {
|
|
|
- query := map[string]interface{}{
|
|
|
- "s_phone": phoneNum,
|
|
|
- "i_appid": 2,
|
|
|
- }
|
|
|
- return db.Mgo.Count("user", query) > 0
|
|
|
+ query := map[string]interface{}{
|
|
|
+ "$or": []map[string]interface{}{
|
|
|
+ {"s_phone": phoneNum},
|
|
|
+ {"s_m_phone": phoneNum}},
|
|
|
+ "i_appid": 2,
|
|
|
+ }
|
|
|
+ return db.Mgo.Count("user", query) > 0
|
|
|
}
|