59 lines
1.5 KiB
Go
59 lines
1.5 KiB
Go
package controller
|
|
|
|
//import (
|
|
// "centerBook/util/esClient"
|
|
// "centerBook/util/pdd"
|
|
// "centerBook/util/redisClient"
|
|
// "context"
|
|
// "log"
|
|
//)
|
|
//
|
|
//// 推测pddCatId类目
|
|
//func getPddCatId() {
|
|
//
|
|
// ctx := context.Background()
|
|
// // 为两个数据库创建命名客户端
|
|
// redisClient.AddClient("db4", "36.212.20.113", "j8nZ4jra2E", 4)
|
|
// redisClient.AddClient("db14", "36.212.20.113", "j8nZ4jra2E", 14)
|
|
//
|
|
// // 从 db4 获取数据示例
|
|
// db4Client, err := redisClient.GetClientByName("db4")
|
|
// if err == nil {
|
|
// // 示例:获取键为 "key1" 的值
|
|
// val, err := db4Client.Get(ctx, "1995373681100910593").Result()
|
|
// if err == nil {
|
|
// log.Println(val)
|
|
// }
|
|
// }
|
|
//
|
|
// bookName := ""
|
|
//
|
|
// instance, err := pdd.GetPddInstance()
|
|
// if err != nil {
|
|
// return
|
|
// }
|
|
// instance.PddGoodsOuterCatMappingGet("", "15543", "书籍/杂志/报纸", "书籍 "+bookName)
|
|
//
|
|
// // 从 db14 获取数据示例
|
|
// db14Client, err := redisClient.GetClientByName("db14")
|
|
// if err == nil {
|
|
// // 示例:获取键为 "key2" 的值
|
|
// val, err := db14Client.Get(ctx, "key2").Result()
|
|
// if err == nil {
|
|
// // 处理获取到的值
|
|
// }
|
|
// }
|
|
//
|
|
//}
|
|
//
|
|
//// connectES 连接到 Elasticsearch
|
|
//func connectES(addresses []string, username, password string) (*esClient.ESClient, error) {
|
|
// return esClient.NewESClient(addresses, username, password)
|
|
//}
|
|
//
|
|
//// connectRedis 连接到 Redis
|
|
//func connectRedis(addr, password string, db int) {
|
|
// redisClient.InitRedis(addr, password, db)
|
|
// redisClient.GetClient()
|
|
//}
|