wangshan hai 1 ano
pai
achega
177714bcf3
Modificáronse 2 ficheiros con 26 adicións e 1 borrados
  1. 15 1
      src/service/action/info.go
  2. 11 0
      src/service/exhibition/exhibition.go

+ 15 - 1
src/service/action/info.go

@@ -122,8 +122,12 @@ func (i *Info) ExhSignIn() {
 			SignNum:   fre,
 			SignState: 0,
 		}
-		//是否 已签到
 		mgoUserId := qu.ObjToString(sessVal["mgoUserId"])
+		//是否可签到
+		if !IsSignInIng(exhCode) {
+			return entity.NewResultSales{Error_msg: "当前活动未到签到时间", ExhRes: exhResult}
+		}
+		//是否 已签到
 		b, href := IsSignIn(mgoUserId, exhCode)
 		exhResult.Href = href
 		if !b {
@@ -235,6 +239,11 @@ func (i *Info) CollectInfo() {
 				//展会状态 是否结束
 				return entity.NewResultSales{Error_code: Error_code_1004, Error_msg: "活动已结束或当前活动不存在"}
 			}
+			if strings.Contains(Sysconfig.Source[source].Remark, "签到") && !IsSignInIng(exhCode) {
+				//未到签到时间
+				return entity.NewResultSales{Error_code: Error_code_1004, Error_msg: "当前活动未到签到时间"}
+
+			}
 		}
 		//企业验证
 		if Sysconfig.Source[source] != nil && Sysconfig.Source[source].EntValidation {
@@ -459,6 +468,11 @@ func (i *Info) RetainedCapital() {
 			//是否已报名
 			b, h := IsSignUp(mgoUserId, qu.ObjToString(phone), exhCode, state) //i.Header("user-agent"), "", sessVal
 			if b {
+				//是否可签到
+				if !IsSignInIng(exhCode) {
+					i.ServeJson(entity.FuncResult{Error_msg: "当前活动未到签到时间", ExhRes: exhResult})
+					return
+				}
 				//已报名 是否已签到
 				b, _ = IsSignIn(mgoUserId, exhCode)
 				//未签到

+ 11 - 0
src/service/exhibition/exhibition.go

@@ -28,6 +28,17 @@ func IsClosed(code string) bool {
 	return false
 }
 
+// IsSignInIng 当前活动是否签到中
+func IsSignInIng(code string) bool {
+	now := time.Now()
+	if exh := entity.ExhibitionMap[code]; exh.InternalName != "" {
+		startTime, _ := time.ParseInLocation(date.Date_Full_Layout, exh.SignStartTime, time.Local)
+		endTime, _ := time.ParseInLocation(date.Date_Full_Layout, exh.SignEndTime, time.Local)
+		return endTime.Unix() > now.Unix() && startTime.Unix() < now.Unix()
+	}
+	return false
+}
+
 // 1、报名页面查看是否已报名  查userid;2、签到页面查看是否已报名 userid或phone
 func IsSignUp(userId, phone, code string, state int) (b bool, h string) {
 	exhId := entity.ExhibitionMap[code].Id