增加异步日志和库存展示
This commit is contained in:
@@ -92,7 +92,7 @@ func (c *HTTPClient) CallRPC(ctx context.Context, service, method string, reqStr
|
||||
httpReq = httpReq.WithContext(ctx)
|
||||
}
|
||||
|
||||
c.logf("[HTTP] POST %s.%s body=%dB", service, method, len(body))
|
||||
c.logf("[HTTP] 请求 %s.%s", service, method)
|
||||
httpResp, err := client.Do(httpReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -141,6 +141,9 @@ func (c *HTTPClient) QueryUserScore(ctx context.Context, uid int64, cookie strin
|
||||
req := &GetUserScoreReq{User: c.buildUser(uid, cookie, ActivityWebUA), SID: sid}
|
||||
var resp GetUserScoreResp
|
||||
_, err := c.CallRPC(ctx, ServantWebActUI, FuncGetUserScore, req, &resp, CallOptions{UID: uid, Cookie: cookie, RequestID: 2})
|
||||
if err == nil {
|
||||
c.logf("[HTTP] 积分已解码 uid=%d sid=%d status=%d 可用=%d msg=%s", uid, sid, resp.Status, resp.AvailableScore(), resp.Msg)
|
||||
}
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
@@ -148,6 +151,10 @@ func (c *HTTPClient) GetActPrizeList(ctx context.Context, uid int64, cookie stri
|
||||
req := &GetActPrizeListReq{User: c.buildUser(uid, cookie, ActivityWebUA), SID: sid}
|
||||
var resp GetActPrizeListResp
|
||||
_, err := c.CallRPC(ctx, ServantWebActUI, FuncPrizeList, req, &resp, CallOptions{UID: uid, Cookie: cookie, RequestID: 1})
|
||||
if err == nil {
|
||||
left, total, leftKnown, totalKnown := prizeListInventorySummary(resp.Prizes)
|
||||
c.logf("[HTTP] 商品列表已解码 uid=%d sid=%d status=%d count=%d 剩余=%d/%d项 总量=%d/%d项 msg=%s", uid, sid, resp.Status, len(resp.Prizes), left, leftKnown, total, totalKnown, resp.Msg)
|
||||
}
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
@@ -157,6 +164,9 @@ func (c *HTTPClient) GetUserPrizeRecords(ctx context.Context, uid int64, cookie
|
||||
req := &GetUserPrizeRecordsReq{User: user, SID: sid}
|
||||
var resp GetUserPrizeRecordsResp
|
||||
_, err := c.CallRPC(ctx, ServantWebActUI, FuncPrizeRecords, req, &resp, CallOptions{UID: uid, Cookie: cookie, RequestID: 6})
|
||||
if err == nil {
|
||||
c.logf("[HTTP] 兑换记录已解码 uid=%d sid=%d status=%d count=%d msg=%s", uid, sid, resp.Status, len(resp.Records), resp.Msg)
|
||||
}
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
@@ -170,5 +180,8 @@ func (c *HTTPClient) ScoreExchangePrize(ctx context.Context, uid int64, cookie s
|
||||
}
|
||||
var resp ScoreExchangePrizeResp
|
||||
_, err := c.CallRPC(ctx, ServantWebActUI, FuncExchangePrize, req, &resp, CallOptions{UID: uid, Cookie: cookie, RequestID: 1})
|
||||
if err == nil {
|
||||
c.logf("[HTTP] 兑换结果已解码 uid=%d sid=%d pid=%d status=%d order=%s msg=%s", uid, sid, pid, resp.Status, resp.OrderID, exchangeResponseMessage(&resp))
|
||||
}
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user