Prechádzať zdrojové kódy

Merge branch 'refs/heads/develop' into develop-zhou

Ethan 4 mesiacov pred
rodič
commit
19b027c74c

+ 1 - 1
consts/error_code.go

@@ -10,7 +10,7 @@ const DefaultToast = ""
 const ErrorSuccess int32 = 20000
 const ErrorNotLogin int32 = 44000
 const ErrorParamCheck int32 = 40000
-const ErrorInternal int32 = 50001
+const ErrorInternal int32 = 40000
 
 func init() {
 	errorCodeToastMap[ErrorSuccess] = "请求成功"

+ 16 - 0
db/platform_kuaishou_user.go

@@ -0,0 +1,16 @@
+package db
+
+import (
+	"context"
+	"youngee_b_api/model/gorm_model"
+)
+
+func FindUserInfoByTalentId(ctx context.Context, talentId string) (*gorm_model.PlatformKuaishouUserInfo, error) {
+	db := GetReadDB(ctx)
+	var userInfo gorm_model.PlatformKuaishouUserInfo
+	err := db.Model(gorm_model.PlatformKuaishouUserInfo{}).Where("talent_id = ? and platform_id = ?", talentId, 4).Find(&userInfo).Error
+	if err != nil {
+		return nil, err
+	}
+	return &userInfo, nil
+}

+ 13 - 0
db/sectask.go

@@ -101,6 +101,19 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 	//		newSecTaskInfoList[i].DetailAddr = GetRegion(ctx, secTask.RegionCode) + newSecTaskInfoList[i].DetailAddr
 	//	}
 	//}
+
+	// 写入达人头像
+	for _, v := range newSecTaskInfoList {
+		kuaishouUserInfo, kuaishouUserErr := FindUserInfoByTalentId(ctx, v.TalentId)
+		if kuaishouUserErr != nil {
+			return nil, 0, kuaishouUserErr
+		}
+		v.TalentAvatar = kuaishouUserInfo.HeadUri
+		v.PlatformNickname = kuaishouUserInfo.NickName
+		v.KuaiShouUserGender = kuaishouUserInfo.Gender
+		v.KuaiShouUserLocation = kuaishouUserInfo.City
+	}
+
 	var resSecTaskInfoList []*http_model.SecTaskInfo
 	if searchValue != "" {
 		for _, v := range newSecTaskInfoList {

+ 14 - 0
db/selection.go

@@ -7,6 +7,7 @@ import (
 	"fmt"
 	"github.com/issue9/conv"
 	"github.com/sirupsen/logrus"
+	"github.com/tidwall/gjson"
 	"gorm.io/gorm"
 	"reflect"
 	"strings"
@@ -129,6 +130,19 @@ func GetSelectionList(ctx context.Context, enterpriseID string, pageSize, pageNu
 	var newSelectionInfos []*gorm_model.YounggeeSelectionInfo
 	for _, v := range selectionInfos {
 		fmt.Printf("查询选品列表 %+v\n", v)
+		//v.ProductSnap = conv.MustString(gjson.Get(v.ProductSnap, "ProductName"), "") + " " + conv.MustString(gjson.Get(v.ProductSnap, "ProductPrice"), "")
+		kuaiShouProductInfo := map[string]interface{}{
+			"ProductName":  conv.MustString(gjson.Get(v.ProductSnap, "ProductName")),
+			"ProductPrice": conv.MustString(gjson.Get(v.ProductSnap, "ProductPrice")),
+		}
+		//kuaiShouProductInfo["ProductName"] = conv.MustString(gjson.Get(v.ProductSnap, "ProductName"))
+		//kuaiShouProductInfo["ProductPrice"] = conv.MustString(gjson.Get(v.ProductSnap, "ProductPrice"))
+		jsonData, mapErr := json.Marshal(kuaiShouProductInfo)
+		if mapErr != nil {
+			return nil, 0, mapErr
+		}
+		v.ProductSnap = string(jsonData)
+
 		if searchValue == "" {
 			newSelectionInfos = append(newSelectionInfos, v)
 		} else if strings.Contains(v.SelectionID, searchValue) {

+ 1 - 3
go.mod

@@ -39,7 +39,7 @@ require (
 	github.com/kr/pretty v0.3.0 // indirect
 	github.com/kr/text v0.2.0 // indirect
 	github.com/leodido/go-urn v1.2.1 // indirect
-	github.com/lin-jim-leon/kuaishou v0.3.0 // indirect
+	github.com/lin-jim-leon/kuaishou v0.4.0 // indirect
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/nxadm/tail v1.4.8 // indirect
 	github.com/onsi/ginkgo v1.16.5 // indirect
@@ -55,7 +55,6 @@ require (
 	github.com/tidwall/pretty v1.2.0 // indirect
 	github.com/tjfoc/gmsm v1.4.1 // indirect
 	github.com/ugorji/go/codec v1.2.7 // indirect
-	go.mongodb.org/mongo-driver v1.12.0 // indirect
 	github.com/urfave/cli/v2 v2.3.0 // indirect
 	github.com/yuin/goldmark v1.4.13 // indirect
 	go.mongodb.org/mongo-driver v1.12.0 // indirect
@@ -64,7 +63,6 @@ require (
 	golang.org/x/text v0.15.0 // indirect
 	golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
 	gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
-	gopkg.in/ini.v1 v1.67.0 // indirect
 	gopkg.in/errgo.v2 v2.1.0 // indirect
 	gopkg.in/fsnotify.v1 v1.4.7 // indirect
 	gopkg.in/ini.v1 v1.67.0 // indirect

+ 2 - 0
go.sum

@@ -134,6 +134,8 @@ github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
 github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
 github.com/lin-jim-leon/kuaishou v0.3.0 h1:Gb0DRc62K51/78680Pq+zupOXTnd1CN1Lfv5NrqRIHo=
 github.com/lin-jim-leon/kuaishou v0.3.0/go.mod h1:BFbAhNC3PUIhAaA9YDSi6WDB0UcRMPS9C7dpFAtENaY=
+github.com/lin-jim-leon/kuaishou v0.4.0 h1:CQJmtN0YPvcmgZce2rF28x0WQ5LFUtL8EnCOD/23P/A=
+github.com/lin-jim-leon/kuaishou v0.4.0/go.mod h1:BFbAhNC3PUIhAaA9YDSi6WDB0UcRMPS9C7dpFAtENaY=
 github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
 github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
 github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=

+ 1 - 1
handler/GetSecTaskList.go

@@ -44,7 +44,7 @@ func (c GetSecTaskList) run() {
 		logrus.Info("GetSecTaskList fail,req:%+v", c.req)
 		return
 	}
-	c.resp.Message = "ok"
+	c.resp.Message = "成功查询带货子任务"
 	c.resp.Data = res
 	c.resp.Status = 20000
 	return

+ 2 - 0
handler/PassSecTaskCoop.go

@@ -42,6 +42,8 @@ func (c PassSecTaskCoop) run() {
 		logrus.Errorf("[PassSecTaskCoop] call PassSecTaskCoop err:%+v\n", err)
 		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
 		logrus.Info("PassSecTaskCoop fail,req:%+v", c.req)
+		c.resp.Message = err.Error()
+		c.resp.Status = 40000
 		return
 	}
 	c.resp.Message = "ok"

+ 9 - 1
handler/find_kuaishou_product.go

@@ -3,8 +3,10 @@ package handler
 import (
 	"github.com/gin-gonic/gin"
 	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
 	"youngee_b_api/model/http_model"
 	"youngee_b_api/service"
+	"youngee_b_api/util"
 )
 
 func WrapFindKuaishouProductHandler(ctx *gin.Context) {
@@ -35,6 +37,7 @@ func (h *FindKuaishouProductHandler) getContext() *gin.Context {
 func (h *FindKuaishouProductHandler) getResponse() interface{} {
 	return h.resp
 }
+
 func (h *FindKuaishouProductHandler) run() {
 	data := *&http_model.FindKuaishouProductRequest{}
 	data = *h.req
@@ -42,11 +45,16 @@ func (h *FindKuaishouProductHandler) run() {
 
 	res, err := service.Product.QueryKuaishouProduct(h.ctx, data)
 	if err != nil {
-		logrus.Info("FindKuaishouProduct fail,req:%+v", h.req)
+		logrus.WithContext(h.ctx).Errorf("[FindKuaishouProductHandler] error FindKuaishouProductHandler, err:%+v", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast)
+		h.resp.Message = err.Error()
 		return
 	}
+	h.resp.Status = 20000
+	h.resp.Message = "成功查询"
 	h.resp.Data = res
 }
+
 func (h *FindKuaishouProductHandler) checkParam() error {
 	return nil
 }

+ 1 - 1
handler/selection_find_all.go

@@ -48,7 +48,7 @@ func (f FindAllSelectionHandler) run() {
 	}
 	f.resp.Data = data
 	f.resp.Status = 20000
-	f.resp.Message = "ok"
+	f.resp.Message = "成功查询带货任务"
 	return
 }
 

+ 2 - 0
model/gorm_model/platform_kuaishou_user_info.go

@@ -23,6 +23,8 @@ type PlatformKuaishouUserInfo struct {
 	IsDelete     int       `gorm:"column:is_delete;type:int(11);default:0;comment:是否被删除" json:"is_delete"`
 	LikeNum      int       `gorm:"column:like_num;type:int(11);default:0;comment:点赞数" json:"like_num"`
 	VideoNum     int       `gorm:"column:video_num;type:int(11);default:0;comment:作品数" json:"video_num"`
+	Gender       string    `gorm:"column:gender;type:varchar(255);comment:快手性别" json:"gender"`
+	City         string    `gorm:"column:city;type:varchar(255);comment:快手用户城市所在地" json:"city"`
 }
 
 func (m *PlatformKuaishouUserInfo) TableName() string {

+ 1 - 0
model/gorm_model/selection_info.go

@@ -8,6 +8,7 @@ type YounggeeSelectionInfo struct {
 	SelectionID       string     `gorm:"column:selection_id;primary_key"` // 选品项目id
 	SelectionName     string     `gorm:"column:selection_name"`           // 选品项目名称
 	EnterpriseID      string     `gorm:"column:enterprise_id"`            // 所属企业id
+	SubAccountId      int        `gorm:"column:sub_account_id"`           // 子账号id
 	ProductID         int        `gorm:"column:product_id"`               // 关联商品id
 	ContentType       int        `gorm:"column:content_type"`             // 内容形式,1代表图文,2代表视频,3代表直播
 	SelectionStatus   int        `gorm:"column:selection_status"`         // 选品项目状态,1-8分别代表创建中、待审核、审核通过、待支付、已支付、执行中、失效、已结案

+ 33 - 29
model/http_model/GetSecTaskList.go

@@ -20,35 +20,39 @@ type GetSecTaskListData struct {
 }
 
 type SecTaskInfo struct {
-	SecTaskId             string    `json:"sec_task_id"`            // 带货任务ID
-	PlatformNickname      string    `json:"platform_nickname"`      // 帐号昵称
-	TalentId              string    `json:"talent_id"`              // 达人ID
-	FansCount             string    `json:"fans_count"`             // 粉丝数
-	HomePageCaptureUrl    string    `json:"home_page_capture_url"`  // 主页截图链接
-	HomePageUrl           string    `json:"home_page_url"`          // 主页链接
-	RegionCode            int       `json:"region_code"`            // 区域编码
-	DetailAddr            string    `json:"detail_addr"`            // 物流信息
-	CompanyName           string    `json:"company_name"`           // 物流公司
-	LogisticsNumber       string    `json:"logistics_number"`       // 物流单号
-	ExplorestoreStarttime time.Time `json:"explorestore_starttime"` // 线下探店-探店开始时间
-	ExplorestoreEndtime   time.Time `json:"explorestore_endtime"`   // 线下探店-探店结束时间
-	ExplorestorePeriod    string    `json:"explorestore_period"`    // 线下探店-探店持续时间
-	DataScreenshot        string    `json:"data_screenshot"`        // 数据截图
-	AssignmentLink        string    `json:"assignment_link"`        // 作业链接
-	ReturnMoney           string    `json:"return_money"`           // 返现
-	TaskReward            string    `json:"task_reward"`            // 悬赏金
-	IsPayReward           int       `json:"is_pay_reward"`          // 是否给悬赏金
-	IsPayPayment          int       `json:"is_pay_payment"`         // 是否返现
-	CreateDate            string    `json:"create_date"`            // 创建时间
-	SelectDate            string    `json:"select_date"`            // 反选时间
-	DeliveryDate          string    `json:"delivery_date"`          // 发货时间
-	CompleteDate          string    `json:"complete_date"`          // 结算时间
-	SignedTime            string    `json:"signed_time"`            // 快递签收时间
-	SaleNum               int       `json:"sale_num"`               // 30天橱窗销量
-	FreeStrategyId        int       `json:"free_strategy_id"`       // 免费领样策略id
-	ProductId             int       `json:"product_id"`             // 商品ID
-	FreeStage             int       `json:"free_stage"`             // 免费领样阶段,1-5分别代表已申请、已拒绝、待发货、已发货、已收货
-	RewardStage           int       `json:"reward_stage"`           // 悬赏阶段,1-2分别代表待结算(管理后台设置)、已结算(小程序端设置)
+	SecTaskId             string    `json:"sec_task_id"`             // 带货任务ID
+	PlatformNickname      string    `json:"platform_nickname"`       // 帐号昵称
+	TalentId              string    `json:"talent_id"`               // 达人ID
+	TalentAvatar          string    `json:"talent_avatar"`           // 达人头像
+	KuaiShouUserId        string    `json:"kuai_shou_user_id"`       // 快手账号
+	KuaiShouUserGender    string    `json:"kuai_shou_user_gender"`   // 快手用户性别
+	KuaiShouUserLocation  string    `json:"kuai_shou_user_location"` // 快手用户ip属地
+	FansCount             string    `json:"fans_count"`              // 粉丝数
+	HomePageCaptureUrl    string    `json:"home_page_capture_url"`   // 主页截图链接
+	HomePageUrl           string    `json:"home_page_url"`           // 主页链接
+	RegionCode            int       `json:"region_code"`             // 区域编码
+	DetailAddr            string    `json:"detail_addr"`             // 物流信息
+	CompanyName           string    `json:"company_name"`            // 物流公司
+	LogisticsNumber       string    `json:"logistics_number"`        // 物流单号
+	ExplorestoreStarttime time.Time `json:"explorestore_starttime"`  // 线下探店-探店开始时间
+	ExplorestoreEndtime   time.Time `json:"explorestore_endtime"`    // 线下探店-探店结束时间
+	ExplorestorePeriod    string    `json:"explorestore_period"`     // 线下探店-探店持续时间
+	DataScreenshot        string    `json:"data_screenshot"`         // 数据截图
+	AssignmentLink        string    `json:"assignment_link"`         // 作业链接
+	ReturnMoney           string    `json:"return_money"`            // 返现
+	TaskReward            string    `json:"task_reward"`             // 悬赏金
+	IsPayReward           int       `json:"is_pay_reward"`           // 是否给悬赏金
+	IsPayPayment          int       `json:"is_pay_payment"`          // 是否返现
+	CreateDate            string    `json:"create_date"`             // 创建时间
+	SelectDate            string    `json:"select_date"`             // 反选时间
+	DeliveryDate          string    `json:"delivery_date"`           // 发货时间
+	CompleteDate          string    `json:"complete_date"`           // 结算时间
+	SignedTime            string    `json:"signed_time"`             // 快递签收时间
+	SaleNum               int       `json:"sale_num"`                // 30天橱窗销量
+	FreeStrategyId        int       `json:"free_strategy_id"`        // 免费领样策略id
+	ProductId             int       `json:"product_id"`              // 商品ID
+	FreeStage             int       `json:"free_stage"`              // 免费领样阶段,1-5分别代表已申请、已拒绝、待发货、已发货、已收货
+	RewardStage           int       `json:"reward_stage"`            // 悬赏阶段,1-2分别代表待结算(管理后台设置)、已结算(小程序端设置)
 }
 
 func NewGetSecTaskListRequest() *GetSecTaskListRequest {

+ 15 - 14
model/http_model/find_kuaishou_product.go

@@ -16,20 +16,21 @@ type KuaishouDetailPhoto struct {
 }
 
 type FindKuaishouProductData struct {
-	ProductName                 string   `json:"product_name"`                    // 商品名称
-	ProductPrice                float64  `json:"product_price"`                   // 商品价值
-	ProductDetail               string   `json:"product_detail"`                  // 商品描述
-	KuaishouMainPhoto           string   `json:"kuaishou_main_photo"`             // 商品主图
-	KuaishouCarousePhotoList    []string `json:"kuaishou_carouse_photo_list"`     // 商品轮播图列表
-	KuaishouDetailPhotoList     []string `json:"kuaishou_detail_photo_list"`      // 商品详情图列表
-	ProductUrl                  string   `json:"product_url"`                     // 商品链接,可为电商网址、公司官网、大众点评的店铺地址等可以说明商品信息或者品牌信息的线上地址;
-	EnterpriseID                string   `json:"enterprise_id"`                   // 所属企业id
-	BrandName                   string   `json:"brand_name"`                      // 品牌名称
-	PublicCommission            float64  `json:"public_commission"`               // 公开佣金
-	ExclusiveCommission         float64  `json:"exclusive_commission"`            // 专属佣金
-	CommissionPrice             float64  `json:"commission_price"`                // 佣金金额
-	KuaishouProductId           int64    `json:"kuaishou_product_id"`             // 快手商品ID
-	MerchantSoldCountThirtyDays int64    `json:"merchant_sold_count_thirty_days"` // 商品30天销量
+	ProductName                 string          `json:"product_name"`                    // 商品名称
+	ProductPrice                float64         `json:"product_price"`                   // 商品价值
+	ProductDetail               string          `json:"product_detail"`                  // 商品描述
+	KuaishouMainPhoto           string          `json:"kuaishou_main_photo"`             // 商品主图
+	KuaishouCarousePhotoList    []string        `json:"kuaishou_carouse_photo_list"`     // 商品轮播图列表
+	KuaishouDetailPhotoList     []string        `json:"kuaishou_detail_photo_list"`      // 商品详情图列表
+	ProductUrl                  string          `json:"product_url"`                     // 商品链接,可为电商网址、公司官网、大众点评的店铺地址等可以说明商品信息或者品牌信息的线上地址;
+	EnterpriseID                string          `json:"enterprise_id"`                   // 所属企业id
+	BrandName                   string          `json:"brand_name"`                      // 品牌名称
+	PublicCommission            float64         `json:"public_commission"`               // 公开佣金
+	ExclusiveCommission         float64         `json:"exclusive_commission"`            // 专属佣金
+	CommissionPrice             float64         `json:"commission_price"`                // 佣金金额
+	KuaishouProductId           int64           `json:"kuaishou_product_id"`             // 快手商品ID
+	MerchantSoldCountThirtyDays int64           `json:"merchant_sold_count_thirty_days"` // 商品30天销量
+	ProductPhotos               []*ProductPhoto `json:"product_photos"`                  // 结构化的图片信息
 }
 
 func NewFindKuaishouProductRequest() *FindKuaishouProductRequest {

+ 1 - 1
model/http_model/product_find.go

@@ -7,7 +7,7 @@ type FindProductRequest struct {
 type ProductPhoto struct {
 	PhotoUrl string `json:"photo_url"` // 图片或视频url
 	PhotoUid string `json:"photo_uid"`
-	Symbol   int64  `json:"symbol"` // 图片为主图或详情图标志位,1为主图,2为详情图,3为视频
+	Symbol   int64  `json:"symbol"` // 图片为主图或详情图标志位
 }
 
 type FindProductData struct {

+ 14 - 0
pack/sec_task_list.go

@@ -42,3 +42,17 @@ func GormSecTaskToHttpSecTask(secTask *gorm_model.YounggeeSecTaskInfo) *http_mod
 		ProductId:          secTask.ProductId,
 	}
 }
+
+/*
+type T struct {
+	DoorNum      int    `json:"door_num"`
+	TalentId     string `json:"talent_id"`
+	AddressId    int    `json:"address_id"`
+	DefaultTag   int    `json:"default_tag"`
+	DetailAddr   string `json:"detail_addr"`
+	RegionCode   int    `json:"region_code"`
+	PhoneNumber  string `json:"phone_number"`
+	ReceiverName string `json:"receiver_name"`
+}
+
+*/

+ 4 - 7
route/init.go

@@ -1,15 +1,14 @@
 package route
 
 import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
 	swaggerFiles "github.com/swaggo/files"
 	ginSwagger "github.com/swaggo/gin-swagger"
 	"youngee_b_api/app/controller"
 	"youngee_b_api/handler"
 	"youngee_b_api/middleware"
 	"youngee_b_api/model/http_model"
-
-	"github.com/gin-gonic/gin"
-	"github.com/sirupsen/logrus"
 )
 
 func InitRoute(r *gin.Engine) {
@@ -50,8 +49,9 @@ func InitRoute(r *gin.Engine) {
 			auth := middleware.GetSessionAuth(c)
 			logrus.Infof("auth:%+v", auth)
 		})
-		m.POST("/product/findall", handler.WrapFindAllProductHandler)                   //查询全部产品
+		m.POST("/product/findall", handler.WrapFindAllProductHandler)                   // 查询全部产品
 		m.POST("/product/find", handler.WrapFindProductHandler)                         // 查找单个产品
+		m.POST("/product/findKuaishou", handler.WrapFindKuaishouProductHandler)         // 查询快手产品信息
 		m.POST("/project/create", handler.WrapCreateProjectHandler)                     // 创建项目
 		m.POST("/project/show", handler.WrapShowProjectHandler)                         // 展示项目内容
 		m.POST("/project/update", handler.WrapUpdateProjectHandler)                     // 更新项目
@@ -168,7 +168,6 @@ func InitRoute(r *gin.Engine) {
 	task := r.Group("/youngee/b/task")
 	{
 		task.Use(middleware.LoginAuthMiddleware)
-
 		task.POST("/product/findAll", controller.TaskController{}.GetAllProduct) // 关联商品-已有商品展示
 		task.POST("/product/create", controller.TaskController{}.CreateProduct)  // 关联商品-新建商品
 
@@ -311,7 +310,6 @@ func InitRoute(r *gin.Engine) {
 		finance.POST("/bill/selection/list", controller.BillController{}.SelectionBillList) // 账单查询-电商带货列表
 		finance.POST("/bill/project/list", controller.BillController{}.ProjectBillList)     // 账单查询-品牌种草列表
 		finance.POST("/bill/local/list", controller.BillController{}.LocalLifeBillList)     // 账单查询-本地生活列表
-
 	}
 	// 推广合作-服务商相关接口
 	cooperation := r.Group("/youngee/b/cooperation/supplier")
@@ -348,5 +346,4 @@ func InitRoute(r *gin.Engine) {
 		account.Use(middleware.LoginAuthMiddleware)
 		account.POST("/businessLicense", controller.AccountController{}.OCRIdentify) // 营业执照OCR识别/认证
 	}
-
 }

+ 105 - 4
service/product.go

@@ -4,7 +4,9 @@ import (
 	"context"
 	"fmt"
 	"github.com/lin-jim-leon/kuaishou"
+	"math/rand"
 	"strconv"
+	"time"
 	"youngee_b_api/consts"
 	"youngee_b_api/db"
 	"youngee_b_api/model/gorm_model"
@@ -172,14 +174,32 @@ func (*product) GetAllProduct(ctx context.Context, req *http_model.GetAllProduct
 
 // QueryKuaishouProduct 通过快手商品ID从SDK拉取快手商品信息
 func (*product) QueryKuaishouProduct(ctx context.Context, newKuaishouProduct http_model.FindKuaishouProductRequest) (*http_model.FindKuaishouProductData, error) {
-	AccessToken := "ChFvYXV0aC5hY2Nlc3NUb2tlbhJgpNyhn_OyOXO-hSkJDAmlssr8lCAzT0CePeh-9-NyQEK3quECYOVm40RG0ppGMSnV0xq-_hlLrO7BoBOj-ai75oD4hzJ1QDNWChUhEZaXWwv9BtHAPp4Hioa08mw3ZiakGhI3fO2jrXtNfq7z9Xoxtovjx-YiINfD-RUDsg0A2tscTHxuBVd4yaWdtWWbN9QNeaTOLf31KAUwAQ"
 	appKey := "ks651333097154138217"
 	signSecret := "bf6393dce0a2b669ee348bebb837b0da"
-	kuaishouProduct, err := kuaishou.Queryselectiondetail(appKey, signSecret, AccessToken, newKuaishouProduct.ItemList)
+	//var SignSecret string = "dBt0rVRhTpUqcrOYGGpv0A"
+
+	// 1. 拿到快手的AccessToken
+	kuaishouUserInfo, userErr := db.FindUserInfoByTalentId(ctx, "214300313")
+	if userErr != nil {
+		return nil, userErr
+	}
+	fmt.Println(kuaishouUserInfo.Gender)
+
+	// 2. 可能需要刷新Token
+	//newAccessToken, Tokenerr := kuaishou.RefreshAccessToken(kuaishouUserInfo.RefreshToken, appKey, SignSecret)
+	//if Tokenerr != nil {
+	//	return nil, Tokenerr
+	//}
+	//fmt.Println(newAccessToken.AccessToken)
+
+	// 3. 查找对应的快手商品
+	kuaishouProduct, err := kuaishou.Queryselectiondetail(appKey, signSecret, "ChFvYXV0aC5hY2Nlc3NUb2tlbhJgVUcKpMMPhw6IsRe6j49Z_u5HNB4X4mEcFrPKQ6S4adSCGiJ_fnoNzQOfv5hv2iCI3jEU380e44aG0fH5cqVrghZWQxs-LlatHGWltM2einjuMdOLU-hw_-7gAgg46DHaGhJwAv7lQ4RI-YbDWturzqUxgFYiIH7EzXN1tK4s3OnxyrD227gtYmLoDs0jsnXzYvhocbBeKAUwAQ", newKuaishouProduct.ItemList)
 	if err != nil {
+		fmt.Println("快手错误信息: ", err)
 		return nil, err
 	}
-	fmt.Println("kuaishouProduct: ", kuaishouProduct)
+
+	// 4. 组织返回数据
 	findKuaishouProductData := http_model.FindKuaishouProductData{
 		ProductName:                 kuaishouProduct.ItemList[0].ItemTitle,
 		ProductPrice:                float64(kuaishouProduct.ItemList[0].ItemPrice) * 0.01,
@@ -191,6 +211,87 @@ func (*product) QueryKuaishouProduct(ctx context.Context, newKuaishouProduct htt
 		MerchantSoldCountThirtyDays: kuaishouProduct.ItemList[0].MerchantSoldCountThirtyDays,
 		KuaishouProductId:           kuaishouProduct.ItemList[0].ItemID,
 	}
-	// print("kuaoshou_product: ", findKuaishouProductData.ProductName)
+
+	// 5. 图片数据结构化
+	// 5.1. 主图
+	var currProductMainPhoto *http_model.ProductPhoto
+	rand.Seed(time.Now().UnixNano())
+	currProductMainPhoto = &http_model.ProductPhoto{
+		PhotoUrl: findKuaishouProductData.KuaishouMainPhoto,
+		PhotoUid: generateRandomString(10),
+		Symbol:   1,
+	}
+	findKuaishouProductData.ProductPhotos = append(findKuaishouProductData.ProductPhotos, currProductMainPhoto)
+
+	// 5.2. 轮播图
+	for _, url := range findKuaishouProductData.KuaishouCarousePhotoList {
+		var currProductPhoto *http_model.ProductPhoto
+		rand.Seed(time.Now().UnixNano())
+		currProductPhoto = &http_model.ProductPhoto{
+			PhotoUrl: url,
+			PhotoUid: generateRandomString(10),
+			Symbol:   2,
+		}
+		findKuaishouProductData.ProductPhotos = append(findKuaishouProductData.ProductPhotos, currProductPhoto)
+	}
+
+	// 5.3. 详情图
+	for _, url := range findKuaishouProductData.KuaishouDetailPhotoList {
+		var currProductPhoto *http_model.ProductPhoto
+		rand.Seed(time.Now().UnixNano())
+		currProductPhoto = &http_model.ProductPhoto{
+			PhotoUrl: url,
+			PhotoUid: generateRandomString(10),
+			Symbol:   4,
+		}
+		findKuaishouProductData.ProductPhotos = append(findKuaishouProductData.ProductPhotos, currProductPhoto)
+	}
 	return &findKuaishouProductData, err
 }
+
+const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+
+var seededRand *rand.Rand = rand.New(rand.NewSource(time.Now().UnixNano()))
+
+func generateRandomString(length int) string {
+	b := make([]byte, length)
+	for i := range b {
+		b[i] = charset[seededRand.Intn(len(charset))]
+	}
+	return string(b)
+}
+
+/*
+type T struct {
+	CreatedAt           time.Time `json:"CreatedAt"`
+	UpdatedAt           time.Time `json:"UpdatedAt"`
+	ProductUrl          string    `json:"ProductUrl"`
+	SalesCount          string    `json:"SalesCount"`
+	ProductId           int       `json:"product_id"`
+	ProductName         string    `json:"ProductName"`
+	ProductType         int       `json:"ProductType"`
+	EnterpriseID        string    `json:"EnterpriseID"`
+	ProductPrice        int       `json:"ProductPrice"`
+	SubAccountID        int       `json:"SubAccountID"`
+	ProductDetail       string    `json:"ProductDetail"`
+	CommissionPrice     int       `json:"CommissionPrice"`
+	ProductCategory     string    `json:"ProductCategory"`
+	PublicCommission    int       `json:"PublicCommission"`
+	KuaishouProductId   string    `json:"KuaishouProductId"`
+	ExclusiveCommission int       `json:"ExclusiveCommission"`
+}
+
+
+type T struct {
+	Symbol           int       `json:"Symbol"`
+	StoreID          int       `json:"StoreID"`
+	PhotoUid         string    `json:"PhotoUid"`
+	PhotoUrl         string    `json:"PhotoUrl"`
+	CreatedAt        time.Time `json:"CreatedAt"`
+	ProductID        int       `json:"ProductID"`
+	TeamBuyingID     int       `json:"TeamBuyingID"`
+	ProductPhotoID   int       `json:"ProductPhotoID"`
+	ProductPhotoType int       `json:"ProductPhotoType"`
+}
+
+*/