Browse Source

用户注册新增

WH01243 5 ngày trước cách đây
mục cha
commit
bad4d54b02
2 tập tin đã thay đổi với 34 bổ sung2 xóa
  1. 1 0
      etc/config.yaml
  2. 33 2
      handler/activity/newUserAward.go

+ 1 - 0
etc/config.yaml

@@ -173,3 +173,4 @@ newRegister: #新注册送7天超级订阅
     wxUrl: /front/vipsubscribe/toSubVipSetPage
 cookieDomain: .jydev.jianyu360.com
 webhookURL: ["https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=24b0ac60-3a02-441f-842e-9cd3f75d1208"]
+clueService: 127.0.0.1:7090/clue/ClueBefore

+ 33 - 2
handler/activity/newUserAward.go

@@ -8,11 +8,16 @@ import (
 	"app.yhyue.com/moapp/message/handler/award"
 	"app.yhyue.com/moapp/message/model"
 	"app.yhyue.com/moapp/message/rpc"
-	. "bp.jydev.jianyu360.cn/BaseService/pushpkg/p"
+	"fmt"
+	"github.com/gogf/gf/v2/frame/g"
 	"github.com/gogf/gf/v2/os/gcfg"
 	"github.com/gogf/gf/v2/os/gctx"
 	"github.com/gogf/gf/v2/os/gtime"
+	"io/ioutil"
+	"log"
+	"net/http"
 	"strconv"
+	"strings"
 	"time"
 )
 
@@ -44,6 +49,7 @@ func NewUserActivity(msg *model.Message) {
 		if err != nil {
 			logger.Info("SendMsg Fail ", err)
 		}
+
 	}()
 	_ = award.GivenPoints(msg.E_userId, award.Points{
 		Num:          gcfg.Instance().MustGet(gctx.New(), "newUserAward.points", nil).Int64(),
@@ -53,7 +59,8 @@ func NewUserActivity(msg *model.Message) {
 		Desc:         "新用户注册奖励",
 	})
 	// 新注册用户赠送超级订阅
-
+	//用户注册进行线索分配
+	addClue(msg.E_userId)
 	startTime := gtime.NewFromStrLayout(gcfg.Instance().MustGet(gctx.New(), "newRegister.startTime").String(), "2006-01-02T15:04:05Z").Time
 	entTime := gtime.NewFromStrLayout(gcfg.Instance().MustGet(gctx.New(), "newRegister.entTime").String(), "2006-01-02T15:04:05Z").Time
 	now := time.Now()
@@ -93,3 +100,27 @@ func NewUserActivity(msg *model.Message) {
 	}
 
 }
+
+func addClue(userId string) {
+	log.Println("用户注册进线索", userId)
+	client := &http.Client{}
+	var data = strings.NewReader(fmt.Sprintf(`{ "position_Id":"%s", "action":"user", "source_desc":"" }`, userId))
+	clueService := g.Cfg().MustGet(gctx.New(), "clueService").String()
+	if clueService == "" {
+		return
+	}
+	req, err := http.NewRequest("POST", clueService, data)
+	if err != nil {
+		log.Fatal(err)
+	}
+	req.Header.Set("Content-Type", "application/json")
+	resp, err := client.Do(req)
+	if err != nil {
+		log.Fatal(err)
+	}
+	bodyText, err := ioutil.ReadAll(resp.Body)
+	if err != nil {
+		log.Fatal(err)
+	}
+	fmt.Printf(userId, "%s\n", bodyText)
+}