Remove 买点 (user acquisition tracking) subsystem
Delete the dataReport SDK, event storage model, and scheduled uploader, along with the reportser/srv_report wrapper services and all ~20 Report* call sites in business code. Also drop the ReportSDKConfig field from the APP config response, the TrackerAppId helper, and the related dataReport yaml config block. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -2,18 +2,11 @@ package rechargeser
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"videoweb/pub/common/log"
|
||||
"videoweb/pub/common/srvdef"
|
||||
"videoweb/pub/common/useragent"
|
||||
"videoweb/pub/dataReport"
|
||||
"videoweb/pub/models/eventmod"
|
||||
"videoweb/pub/models/rechargepackagemod"
|
||||
"videoweb/pub/models/usermod"
|
||||
"videoweb/pub/models/vipordermod"
|
||||
@@ -104,8 +97,6 @@ func CreateOrder(ctx context.Context,
|
||||
return nil, serr
|
||||
}
|
||||
|
||||
go reportOrderCreated(ctx, order, pkg, userId, ip)
|
||||
|
||||
return &SubmitOrderResp{
|
||||
TradeNo: tradeNo,
|
||||
PayUrl: payInfo.PayUrl,
|
||||
@@ -138,56 +129,3 @@ func GetOrderHistory(ctx context.Context, userId int64, page, pageSize int64) (v
|
||||
func GetUserInfo(ctx context.Context, userId int64) (*usermod.User, *srvdef.SrvErr) {
|
||||
return usermod.FindOneUser(ctx, bson.M{usermod.FN.User.Id: userId})
|
||||
}
|
||||
|
||||
func reportOrderCreated(ctx context.Context, order *vipordermod.VipOrder, pkg *rechargepackagemod.RechargePackage, userId int64, ip string) {
|
||||
user, _ := usermod.FindOneUser(ctx, bson.M{usermod.FN.User.Id: userId})
|
||||
districtCode := ""
|
||||
if user != nil {
|
||||
districtCode = user.DistrictCode
|
||||
}
|
||||
|
||||
sourceKey, sourceName := "deposit", "金币充值"
|
||||
if order.Client != nil {
|
||||
if value := strings.TrimSpace(order.Client.SourcePageKey); value != "" {
|
||||
sourceKey = value
|
||||
}
|
||||
if value := strings.TrimSpace(order.Client.SourcePageName); value != "" {
|
||||
sourceName = value
|
||||
}
|
||||
}
|
||||
ua := order.Client.UA(order.SysType)
|
||||
eventId := newEventId(pubdef.TrackerAppId(), user.Id, order.TradeNo, order.CreatedAt.Unix())
|
||||
commonField := dataReport.NewCommonField(eventId, dataReport.EventTypeOrderCreated, districtCode, ua, strconv.FormatInt(user.Id, 10), ip)
|
||||
|
||||
commonField.Payload = dataReport.JsonRawMessage(&dataReport.OrderCreatedEvent{
|
||||
OrderID: order.TradeNo,
|
||||
OrderType: "vip_subscription",
|
||||
ProductID: strconv.FormatInt(pkg.Id, 10),
|
||||
ProductName: pkg.Name,
|
||||
Amount: dataReport.JsonNumber(order.Amount),
|
||||
Currency: "CNY",
|
||||
SourcePageKey: sourceKey,
|
||||
SourcePageName: sourceName,
|
||||
CreateTime: dataReport.JsonNumber(order.CreatedAt.Unix()),
|
||||
})
|
||||
|
||||
eventData, _ := json.Marshal(commonField)
|
||||
if err := eventmod.InsertOneEvent(ctx, &eventmod.Event{
|
||||
EventId: commonField.EventID,
|
||||
EventType: commonField.Event,
|
||||
Data: string(eventData),
|
||||
Status: eventmod.Default,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}); err != nil {
|
||||
log.Error("reportOrderCreated InsertOneEvent failed",
|
||||
log.Any("tradeNo", order.TradeNo), log.E(err))
|
||||
}
|
||||
}
|
||||
|
||||
func newEventId(appId string, uid int64, orderId interface{}, createTime int64) string {
|
||||
input := fmt.Sprintf("%v%v%v%v", appId, uid, orderId, createTime)
|
||||
h := md5.New()
|
||||
h.Write([]byte(input))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user