소스 검색

Merge branch 'master' into feature/v4.9.38

lianbingjie 1 년 전
부모
커밋
2bd81d5c44

+ 16 - 0
src/jfw/front/shorturl.go

@@ -146,6 +146,22 @@ func (s *Short) Article(stype, id string) error {
 							//userId, _ = s.GetSession("userId").(string)
 							sess = s.Session().GetMultiple()
 							userId, _ = sess["userId"].(string)
+							//新关注微信公众号用户是否绑定手机号
+							phone, ok := sess["phone"].(string)
+							if ok && phone == "" {
+								//注册时间
+								regTime := util.Int64All(s.GetSession("registedate"))
+								//新用户时间
+								accountMergeOnline, _ := config.Sysconfig["accountMergeOnline"].(string)
+								if accountMergeOnline != "" && regTime > 0 {
+									reg := time.Unix(regTime, 0)
+									onLineTime, _ := time.ParseInLocation(date.Date_Full_Layout, accountMergeOnline, time.Local)
+									//如果未绑定手机号,老用户不用强制绑定;新用户需要绑定手机号
+									if onLineTime.Before(reg) {
+										return s.Redirect("/swordfish/frontPage/userMerge/sess/bind?from=detail")
+									}
+								}
+							}
 						} else if !bm { //未关注用户 pc端到关注页面
 							log.Println("PC微信端浏览器 未关注用户 访问地址----")
 							s.Request.Header.Del("Referer")

+ 3 - 2
src/jfw/modules/publicapply/src/activityday/dao/drawLottery.go

@@ -160,8 +160,9 @@ func (r *RaffleInfo) DistributePrize() (err error) {
 				}
 			default: //第三方权益
 				//TODO: 查询兑换码信息
-				redeemCodeSql := fmt.Sprintf("SELECT * FROM %s ei WHERE ei.active_id = ? AND ei.prize_id = ? AND ei.state = 0 LIMIT 1;", consts.TableEquityInfo)
-				equityInfos := db.BaseMysql.SelectBySqlByTx(tx, redeemCodeSql, r.Prize.ActiveId, r.Prize.Id)
+				nowStr := date.NowFormat(date.Date_Full_Layout)
+				redeemCodeSql := fmt.Sprintf("SELECT * FROM %s ei WHERE ei.active_id = ? AND ei.prize_id = ? AND ei.state = 0 and ei.ex_end_time>? LIMIT 1;", consts.TableEquityInfo)
+				equityInfos := db.BaseMysql.SelectBySqlByTx(tx, redeemCodeSql, r.Prize.ActiveId, r.Prize.Id, nowStr)
 				if equityInfos != nil && len(*equityInfos) > 0 {
 					equityInfo := (*equityInfos)[0]
 					r.Prize.RedeemId = common.Int64All(equityInfo["id"])

+ 6 - 5
src/jfw/modules/subscribepay/src/entity/equityActive.go

@@ -129,8 +129,9 @@ func (e *EquityActive) processEquityInfo(activeName string, activeId, mold int)
 		log.Println("equityActive db Begin:", err)
 		return
 	}
-	countQuery := fmt.Sprintf("SELECT count(*)  FROM %s where state= 0 and mold=? and active_id=? ;", TableEquityInfo)
-	rows, err := tx.Query(countQuery, mold, activeId)
+	now := date.NowFormat(date.Date_Full_Layout)
+	countQuery := fmt.Sprintf("SELECT count(*)  FROM %s where state= 0 and mold=? and active_id=? and ex_end_time>?;", TableEquityInfo)
+	rows, err := tx.Query(countQuery, mold, activeId, now)
 	if err != nil || rows == nil {
 		log.Println("获取剩余库存数量失败:", err, rows, e.OrderCode)
 		return
@@ -144,11 +145,11 @@ func (e *EquityActive) processEquityInfo(activeName string, activeId, mold int)
 		}
 	}
 	if count <= 0 {
-		log.Println("库存剩余为0:", countQuery, mold, activeId)
+		log.Println("库存剩余为0:", countQuery, mold, activeId, now)
 		return
 	}
-	query := fmt.Sprintf("SELECT id,name,code,date_format(ex_end_time,'%%Y-%%m-%%d') as ex_end_time  FROM %s where state= 0 and mold=? and active_id=? limit 1  for update;", TableEquityInfo)
-	data, err := tx.Query(query, mold, activeId)
+	query := fmt.Sprintf("SELECT id,name,code,date_format(ex_end_time,'%%Y-%%m-%%d') as ex_end_time  FROM %s where state= 0 and mold=? and active_id=? and ex_end_time>? limit 1  for update;", TableEquityInfo)
+	data, err := tx.Query(query, mold, activeId, now)
 	if err != nil || data == nil {
 		tx.Rollback()
 		log.Println("获取视频权益码信息失败:", err, data, e.OrderCode)