Răsfoiți Sursa

addkuaishou

Xingyu Xian 4 luni în urmă
părinte
comite
414a0f3933

+ 1 - 1
db/platform_kuaishou_user.go

@@ -8,7 +8,7 @@ import (
 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 = ? ", talentId).Find(&userInfo).Error
+	err := db.Model(gorm_model.PlatformKuaishouUserInfo{}).Where("talent_id = ? and platform_id = ?", talentId, 4).Find(&userInfo).Error
 	if err != nil {
 		return nil, err
 	}

+ 1 - 0
db/sectask.go

@@ -111,6 +111,7 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 		v.TalentAvatar = kuaishouUserInfo.HeadUri
 		v.PlatformNickname = kuaishouUserInfo.NickName
 		v.KuaiShouUserGender = kuaishouUserInfo.Gender
+		v.KuaiShouUserLocation = kuaishouUserInfo.City
 	}
 
 	var resSecTaskInfoList []*http_model.SecTaskInfo

+ 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 - 0
model/gorm_model/platform_kuaishou_user_info.go

@@ -24,6 +24,7 @@ type PlatformKuaishouUserInfo struct {
 	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 - 32
model/http_model/GetSecTaskList.go

@@ -20,38 +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
-	TalentAvatar          string    `json:"talent_avatar"`          // 达人头像
-	KuaiShouUserId        string    `json:"kuai_shou_user_id"`      // 快手账号
-	KuaiShouUserGender    string    `json:"kuai_shou_user_gender"`  // 快手用户性别
-	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 {

+ 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"`
+}
+
+*/

+ 0 - 1
route/init.go

@@ -169,7 +169,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)  // 关联商品-新建商品
 

+ 44 - 8
service/product.go

@@ -174,23 +174,24 @@ func (*product) GetAllProduct(ctx context.Context, req *http_model.GetAllProduct
 func (*product) QueryKuaishouProduct(ctx context.Context, newKuaishouProduct http_model.FindKuaishouProductRequest) (*http_model.FindKuaishouProductData, error) {
 	appKey := "ks651333097154138217"
 	signSecret := "bf6393dce0a2b669ee348bebb837b0da"
-	var SignSecret string = "dBt0rVRhTpUqcrOYGGpv0A"
+	//var SignSecret string = "dBt0rVRhTpUqcrOYGGpv0A"
 
 	// 1. 拿到快手的AccessToken
-	kuaishouUserInfo, userErr := db.FindUserInfoByTalentId(ctx, "207235984")
+	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)
+	//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, newAccessToken.AccessToken, newKuaishouProduct.ItemList)
+	kuaishouProduct, err := kuaishou.Queryselectiondetail(appKey, signSecret, "ChFvYXV0aC5hY2Nlc3NUb2tlbhJgl2DZPM2ZSVHLUoU-t4425Bznh2b2QjIJkTjxF5tY6XYfjJ9X0bG4sB9W5if90iC22glyHe7ZbOQ22ndVHCKgCgYEc7QXN0w-lHlTCnKLsKmh1u46gZ0ivhHqf0QEQcLrGhLiICkHPKJFr7JGeErh7m5jzagiIKZOZcTU8A6KIgJoqCLbADf7fRlv7aYWcwEdfjGl6T8YKAUwAQ", newKuaishouProduct.ItemList)
 	if err != nil {
 		fmt.Println("快手错误信息: ", err)
 		return nil, err
@@ -210,3 +211,38 @@ func (*product) QueryKuaishouProduct(ctx context.Context, newKuaishouProduct htt
 	}
 	return &findKuaishouProductData, err
 }
+
+/*
+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"`
+}
+
+*/