fix(camel_oil): 优化预拉取订单库存日志记录
- 在创建订单响应时日志中添加手机号信息 - 替换未使用的日志保存代码为真实调用 - 预拉取订单库存不足时添加日志记录补充单数 - 统一日志格式,提升监控和调试的可读性
This commit is contained in:
@@ -438,16 +438,14 @@ func (s *sCamelOil) SupplementPrefetchOrders(ctx context.Context) (supplementedC
|
||||
return 0, gerror.Wrap(err2, "获取预拉取订单库存失败")
|
||||
}
|
||||
|
||||
glog.Infof(ctx, "当前预拉取订单库存 (面额 %d): %d", denom.Denomination, capacity)
|
||||
|
||||
// 2. 如果库存充足,无需补充
|
||||
if capacity >= denom.MinCapacity {
|
||||
glog.Infof(ctx, "面额 %d 预拉取订单库存充足 (%d >= %d),无需补充", denom.Denomination, capacity, denom.MinCapacity)
|
||||
continue
|
||||
}
|
||||
|
||||
// 3. 计算需要补充的数量
|
||||
needCount := denom.TargetCapacity - capacity
|
||||
s.SavePrefetchOrderLog(ctx, fmt.Sprintf("面额 %d 预拉取订单库存不足,需要补充 %d 单", denom.Denomination, needCount))
|
||||
glog.Infof(ctx, "面额 %d 预拉取订单库存不足,需要补充 %d 单", denom.Denomination, needCount)
|
||||
|
||||
// 4. 并发拉取订单
|
||||
|
||||
@@ -391,9 +391,7 @@ func (c *Client) CreateCamelOilOrder(ctx context.Context, phone, token string, a
|
||||
}
|
||||
respStr := resp.ReadAllString()
|
||||
glog.Info(ctx, "创建订单响应", respStr)
|
||||
|
||||
//记录响应数据到日志
|
||||
//service.CamelOil().SavePrefetchOrderLog(ctx, respStr)
|
||||
service.CamelOil().SavePrefetchOrderLog(ctx, fmt.Sprintf("创建订单响应 - 手机号: %s, 响应: %s", phone, respStr))
|
||||
|
||||
respStruct := struct {
|
||||
Code string `json:"code"`
|
||||
|
||||
Reference in New Issue
Block a user