|
@@ -277,3 +277,31 @@ func isEmail(value string) bool {
|
|
|
var emailPattern = regexp.MustCompile("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$")
|
|
|
return emailPattern.MatchString(value)
|
|
|
}
|
|
|
+
|
|
|
+func GetAllSubSet(mgo *MongodbSim, userId string) *map[string]interface{} {
|
|
|
+ user := map[string]interface{}{}
|
|
|
+ if IsObjectIdHex(userId) {
|
|
|
+ temp, ok := mgo.FindById("user", userId, `{"o_member_jy":1,"o_vipjy":1,"o_jy":1}`)
|
|
|
+ if ok && temp != nil && len(*temp) > 0 {
|
|
|
+ user = *temp
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ entniche_rule, ok := mgo.Find("entniche_rule", map[string]interface{}{
|
|
|
+ "i_userid": util.IntAll(userId),
|
|
|
+ }, nil, `{"o_entniche":1}`, false, -1, -1)
|
|
|
+ if ok && entniche_rule != nil && len(*entniche_rule) > 0 {
|
|
|
+ for _, v := range *entniche_rule {
|
|
|
+ i_type := util.IntAll(v["i_type"])
|
|
|
+ if i_type == 0 {
|
|
|
+ user["o_entniche"] = v["o_entniche"]
|
|
|
+ } else if i_type == 1 {
|
|
|
+ user["o_vipjy"] = v["o_entniche"]
|
|
|
+ user["o_member_jy"] = v["o_entniche"]
|
|
|
+ } else if i_type == 2 {
|
|
|
+ user["o_jy"] = v["o_entniche"]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return &user
|
|
|
+}
|