Explorar o código

wip:订阅关键词

wangshan hai 2 meses
pai
achega
5a813ca399
Modificáronse 1 ficheiros con 17 adicións e 1 borrados
  1. 17 1
      jyBXSubscribe/rpc/model/service/subscribe.go

+ 17 - 1
jyBXSubscribe/rpc/model/service/subscribe.go

@@ -109,13 +109,29 @@ func (this *SubseribeService) Update() (int64, error) {
 				}
 				newKeyLen := GetKeyWordLen(this.Items)
 				if newKeyLen > keyLen {
-					jy.Publish(this.MgoLog, IC.C.Nsq, IC.C.NsqTopic, "task", this.UserId, jy.Jyweb_node2, map[string]interface{}{
+					err := jy.Publish(this.MgoLog, IC.C.Nsq, IC.C.NsqTopic, "task", this.UserId, jy.Jyweb_node2, map[string]interface{}{
 						"code":       1015, //首次订阅
 						"types":      "subscribeKeyWords",
 						"num":        50,
 						"baseUserId": this.BaseUserId,
 						"positionId": this.PositionId,
 					})
+					if err != nil {
+						log.Println("nsq队列写入失败-->", err, "task", this.UserId)
+					}
+					//首次设置关键词 赠送一次抽奖机会
+					err = jy.Publish(this.MgoLog, IC.C.Nsq, IC.C.NsqTopic, "lottery_draw_task", this.UserId, jy.Jyweb_node2, map[string]interface{}{
+						"phone":      this.UserId,
+						"userId":     this.UserId,
+						"mgoUserId":  this.MgoUserId,
+						"positionId": this.PositionId,
+						"activeId":   16,
+						"taskInfoId": 2,
+						"nickName":   this.UserId,
+					})
+					if err != nil {
+						log.Println("nsq队列写入失败-->", err, "lottery_draw_task", this.UserId)
+					}
 				}
 			}
 			//大会员