新增物流接口

This commit is contained in:
zhongqiang
2025-06-23 16:00:54 +08:00
parent 12db943012
commit 9eecda8c5f
3 changed files with 37 additions and 6 deletions

View File

@@ -65,14 +65,36 @@ func TestAliCloudExpressClient_GetLogisticsInfoFormCache(t *testing.T) {
Host: "",
cache: cache,
}
gotRes, err := a.GetLogisticsInfoFormCache(context.Background(), "", "", time.Minute)
gotRes, err := a.GetLogisticsInfoFormCache(context.Background(), "", "", "", time.Minute)
log.Println(gotRes, err)
}
func TestAliCloudExpressClient_DeleteLogisticsInfoCache(t *testing.T) {
rdb := redis.NewClient(&redis.Options{
Addr: "",
Password: "",
DB: 1,
})
// 创建缓存实例
cache := NewRedisCache(rdb)
a := &AliCloudExpressClient{
AppCode: "",
Host: "",
cache: cache,
}
err := a.DeleteLogisticsInfoCache(context.Background(), "", "")
log.Println(err)
}
type RedisCache struct {
client *redis.Client
}
func (r *RedisCache) Del(ctx context.Context, number string) error {
return r.client.Del(ctx, number).Err()
}
func NewRedisCache(client *redis.Client) *RedisCache {
return &RedisCache{client: client}
}