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,19 +2,12 @@ package coinser
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"videoweb/app/service/rechargeser"
|
||||
"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"
|
||||
@@ -116,8 +109,6 @@ func CreateCoinOrder(ctx context.Context,
|
||||
return nil, serr
|
||||
}
|
||||
|
||||
go reportCoinOrderCreated(order, pkg, ip)
|
||||
|
||||
return &BuyCoinResp{
|
||||
TradeNo: tradeNo,
|
||||
PayUrl: payInfo.PayUrl,
|
||||
@@ -126,65 +117,6 @@ func CreateCoinOrder(ctx context.Context,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func reportCoinOrderCreated(order *vipordermod.VipOrder, pkg *rechargepackagemod.RechargePackage, ip string) {
|
||||
ctx := context.Background()
|
||||
user, _ := usermod.FindOneUser(ctx, bson.M{usermod.FN.User.Id: order.UserId})
|
||||
districtCode := order.DistrictCode
|
||||
if user != nil && strings.TrimSpace(user.DistrictCode) != "" {
|
||||
districtCode = user.DistrictCode
|
||||
}
|
||||
|
||||
sourceKey, sourceName := orderSource(order)
|
||||
ua := order.Client.UA(order.SysType)
|
||||
eventId := newEventId(pubdef.TrackerAppId(), order.UserId, order.TradeNo, order.CreatedAt.Unix())
|
||||
commonField := dataReport.NewCommonField(eventId, dataReport.EventTypeOrderCreated, districtCode, ua, strconv.FormatInt(order.UserId, 10), ip)
|
||||
commonField.Payload = dataReport.JsonRawMessage(&dataReport.OrderCreatedEvent{
|
||||
OrderID: order.TradeNo,
|
||||
OrderType: "coin_purchase",
|
||||
ProductID: strconv.FormatInt(pkg.Id, 10),
|
||||
ProductName: pkg.Name,
|
||||
Amount: dataReport.JsonNumber(order.Amount),
|
||||
Currency: "CNY",
|
||||
CoinQuantity: dataReport.JsonNumber(order.Coin),
|
||||
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("reportCoinOrderCreated InsertOneEvent failed",
|
||||
log.Any("tradeNo", order.TradeNo), log.E(err))
|
||||
}
|
||||
}
|
||||
|
||||
func orderSource(order *vipordermod.VipOrder) (string, string) {
|
||||
key, name := "deposit", "金币充值"
|
||||
if order != nil && order.Client != nil {
|
||||
if value := strings.TrimSpace(order.Client.SourcePageKey); value != "" {
|
||||
key = value
|
||||
}
|
||||
if value := strings.TrimSpace(order.Client.SourcePageName); value != "" {
|
||||
name = value
|
||||
}
|
||||
}
|
||||
return key, name
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
|
||||
// GetCoinOrderHistory 查询用户金币购买记录
|
||||
func GetCoinOrderHistory(ctx context.Context, userId int64, page, pageSize int64) (vipordermod.VipOrderList, int64, *srvdef.SrvErr) {
|
||||
filter := bson.M{
|
||||
|
||||
Reference in New Issue
Block a user