|
@@ -1,56 +1,60 @@
|
|
|
package util
|
|
|
|
|
|
import (
|
|
|
- qutil "app.yhyue.com/moapp/jybase/common"
|
|
|
- "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
- "app.yhyue.com/moapp/jybase/mongodb"
|
|
|
- "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
- "jy/src/jfw/modules/bigmember/src/config"
|
|
|
- "jy/src/jfw/modules/bigmember/src/db"
|
|
|
- "time"
|
|
|
+ qutil "app.yhyue.com/moapp/jybase/common"
|
|
|
+ "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
+ "app.yhyue.com/moapp/jybase/mongodb"
|
|
|
+ "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
+ "jy/src/jfw/modules/bigmember/src/config"
|
|
|
+ "jy/src/jfw/modules/bigmember/src/db"
|
|
|
+ "time"
|
|
|
)
|
|
|
|
|
|
//后期
|
|
|
//获取用户主账号userid
|
|
|
func MainUserId(session *httpsession.Session) (string, string, int) {
|
|
|
- bigMsg := jy.GetBigVipUserBaseMsg( session, *config.Middleground)
|
|
|
- return bigMsg.Data.Member.Pid, "phone", bigMsg.Status
|
|
|
+ bigMsg := jy.GetBigVipUserBaseMsg(session, *config.Middleground)
|
|
|
+ if bigMsg.Data.Member.Pid == "" {
|
|
|
+ userId := session.Get("userId").(string)
|
|
|
+ return userId, "phone", bigMsg.Status
|
|
|
+ }
|
|
|
+ return bigMsg.Data.Member.Pid, "phone", bigMsg.Status
|
|
|
}
|
|
|
|
|
|
//获取该用户所有主账号+子账号
|
|
|
func AllAccount(session *httpsession.Session) []string {
|
|
|
- mainId, _, _ := MainUserId(session)
|
|
|
- account := []string{mainId}
|
|
|
- data, ok := db.Mgo.Find("user", map[string]interface{}{"s_member_mainid": mainId, "i_member_sub_status": 1}, nil, `{"_id":1}`, false, -1, -1)
|
|
|
- if ok && data != nil && len(*data) > 0 {
|
|
|
- for _, v := range *data {
|
|
|
- account = append(account, mongodb.BsonIdToSId(v["_id"]))
|
|
|
- }
|
|
|
- }
|
|
|
- return account
|
|
|
+ mainId, _, _ := MainUserId(session)
|
|
|
+ account := []string{mainId}
|
|
|
+ data, ok := db.Mgo.Find("user", map[string]interface{}{"s_member_mainid": mainId, "i_member_sub_status": 1}, nil, `{"_id":1}`, false, -1, -1)
|
|
|
+ if ok && data != nil && len(*data) > 0 {
|
|
|
+ for _, v := range *data {
|
|
|
+ account = append(account, mongodb.BsonIdToSId(v["_id"]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return account
|
|
|
}
|
|
|
|
|
|
//招标文件解读次数
|
|
|
func IsBidfilePower(session *httpsession.Session) (int, bool) {
|
|
|
- overdue := false
|
|
|
- count := 0
|
|
|
- mainid, _, _ := MainUserId(session)
|
|
|
- res := db.Mysql.SelectBySql(`select i_frequency from bigmember_service_user
|
|
|
+ overdue := false
|
|
|
+ count := 0
|
|
|
+ mainid, _, _ := MainUserId(session)
|
|
|
+ res := db.Mysql.SelectBySql(`select i_frequency from bigmember_service_user
|
|
|
where s_userid =? and s_serviceid=? and i_status=0`, mainid, 11)
|
|
|
- if res != nil && len(*res) > 0 {
|
|
|
- count = qutil.IntAll((*res)[0]["i_frequency"])
|
|
|
- bidfile_endtime := "2021年11月15日" //目前招标文件解读到11/15到期
|
|
|
- bed := GetTime("2006年01月02日", bidfile_endtime)
|
|
|
- overdue = true
|
|
|
- n := time.Now()
|
|
|
- if bed.Before(n) {
|
|
|
- overdue = false
|
|
|
- }
|
|
|
- }
|
|
|
- return count, overdue
|
|
|
+ if res != nil && len(*res) > 0 {
|
|
|
+ count = qutil.IntAll((*res)[0]["i_frequency"])
|
|
|
+ bidfile_endtime := "2021年11月15日" //目前招标文件解读到11/15到期
|
|
|
+ bed := GetTime("2006年01月02日", bidfile_endtime)
|
|
|
+ overdue = true
|
|
|
+ n := time.Now()
|
|
|
+ if bed.Before(n) {
|
|
|
+ overdue = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return count, overdue
|
|
|
}
|
|
|
|
|
|
func GetTime(layout, t string) time.Time {
|
|
|
- times, _ := time.ParseInLocation(layout, t, time.Local)
|
|
|
- return times
|
|
|
+ times, _ := time.ParseInLocation(layout, t, time.Local)
|
|
|
+ return times
|
|
|
}
|