yankun 4 сар өмнө
parent
commit
62eb07da00
33 өөрчлөгдсөн 636 нэмэгдсэн , 302 устгасан
  1. BIN
      .DS_Store
  2. 9 1
      app/api/youngee_talent_api/talent_auth_get_api.go
  3. 18 0
      app/api/youngee_talent_api/talent_auth_post_api.go
  4. 0 1
      app/api/youngee_talent_api/talent_post_api.go
  5. 9 6
      app/model/youngee_talent_model/auth_model.go
  6. 8 2
      app/model/youngee_talent_model/selection_task.go
  7. 28 23
      app/model/youngee_talent_model/talent_account.go
  8. 28 28
      app/model/youngee_talent_model/talent_address.go
  9. 4 0
      app/model/youngee_talent_model/task_info.go
  10. 46 43
      app/service/youngee_sectask_service/seletion_square.go
  11. 103 6
      app/service/youngee_talent_service/BrowseHistory.go
  12. 5 1
      app/service/youngee_talent_service/LoginFromSms.go
  13. 1 2
      app/service/youngee_talent_service/SendSmsCode.go
  14. 88 22
      app/service/youngee_talent_service/talent_account.go
  15. 98 95
      app/service/youngee_talent_service/talent_address.go
  16. 15 0
      app/service/youngee_talent_service/talent_info.go
  17. 52 45
      app/service/youngee_talent_service/talent_ks_auth.go
  18. 26 0
      app/service/youngee_talent_service/wxlogin.go
  19. 0 1
      app/service/youngee_task_service/local_life_info.go
  20. 65 13
      app/service/youngee_task_service/project_info.go
  21. 8 10
      app/service/youngee_task_service/task_book.go
  22. 11 0
      app/service/youngee_task_service/task_income.go
  23. 8 0
      app/service/youngee_task_service/task_info.go
  24. BIN
      bin/main
  25. BIN
      bin/v4.1.1/.DS_Store
  26. BIN
      bin/v4.1.1/linux_amd64/youngmini_server
  27. BIN
      bin/v4.1.1/windows_amd64/youngmini_server.exe
  28. BIN
      bin/v4.1.2/linux_amd64/youngmini_server
  29. BIN
      bin/v4.1.3/.DS_Store
  30. BIN
      bin/v4.1.3/linux_amd64/youngmini_server
  31. BIN
      bin/v4.1.3/windows_amd64/youngmini_server.exe
  32. 2 2
      config/config.toml
  33. 4 1
      router/router.go

BIN
.DS_Store


+ 9 - 1
app/api/youngee_talent_api/talent_auth_get_api.go

@@ -202,7 +202,7 @@ func (*talentAuthGetApi) AddWindowKuaishouList(r *ghttp.Request) {
 	}
 }
 
-// 带货---免费领样---展示可选择的快手信息(多了对是否报名的判断)
+// 带货---免费领样---展示可选择的快手信息(多了对是否报名的判断、是否满足领样)
 func (*talentAuthGetApi) SignUpSecKuaishouList(r *ghttp.Request) {
 	res := youngee_talent_service.SignUpSecKuaishouList(r)
 	err := r.Response.WriteJson(res)
@@ -686,6 +686,14 @@ func (*talentAuthGetApi) GetProjectBrowseHistory(r *ghttp.Request) {
 	}
 }
 
+func (*talentAuthGetApi) GetProjectDetailFromBrowse(r *ghttp.Request) {
+	res := youngee_task_service.GetProjectDetailFromBrowse(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
 // 获取带货浏览历史列表 get selectionid,productid
 func (*talentAuthGetApi) GetSelectionBrowseHistory(r *ghttp.Request) {
 	res := youngee_talent_service.GetSelectionBrowseHistory(r)

+ 18 - 0
app/api/youngee_talent_api/talent_auth_post_api.go

@@ -270,3 +270,21 @@ func (*talentAuthPostApi) SignUpLocalWithKsAccount(r *ghttp.Request) {
 		panic("write response error")
 	}
 }
+
+// 本地生活报名
+func (*talentAuthPostApi) AddTalentSkill(r *ghttp.Request) {
+	res := youngee_talent_service.AddTalentSkill(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
+func (*talentAuthPostApi) AuthCurrentPhone(r *ghttp.Request) {
+	res := youngee_talent_service.AuthCurrentPhone(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+
+}

+ 0 - 1
app/api/youngee_talent_api/talent_post_api.go

@@ -50,7 +50,6 @@ func (*talentPostApi) GetQrcode(r *ghttp.Request) {
 
 // 达人短信登录,发送验证码
 func (*talentPostApi) SendSmsCode(r *ghttp.Request) {
-	// 向微信服务端校验登录凭证
 	res := youngee_talent_service.SendSmsCode(r)
 	err := r.Response.WriteJson(res)
 	if err != nil {

+ 9 - 6
app/model/youngee_talent_model/auth_model.go

@@ -43,12 +43,15 @@ type KuaishouUserInfo struct {
 	IsDelete     int         `json:"is_delete" orm:"is_delete"`
 	LikeNum      int         `json:"like_num" orm:"like_num"`
 	VideoNum     int         `json:"video_num" orm:"video_num"`
-	Status       int         `json:"status"`
-	UseCode      int         `json:"use_code" ` //满足条件的账号可被选择
-	BindCode     int         `json:"bind_code"` //账号绑定情况
-	IsSign       int         `json:"is_sign"`   //是否报名该任务
-	City         string      `json:"city"`      //用户城市
-	Sex          string      `json:"sex"`       //用户性别
+	City         string      `json:"city"`   //用户城市
+	Gender       string      `json:"gender"` //用户性别,"F"为女性,"M"为男性,"其他"为未知
+	Skill        string      `json:"skill"`  //擅长领域
+	Status       int         `json:"status"` //绑定状态,绑定一个还是两个
+	//UseCode      int         `json:"use_code" ` //满足条件的账号可被选择
+	//BindCode     int         `json:"bind_code"` //账号绑定情况
+	IsSign int `json:"is_sign"` //是否报名该任务
+	IsOk   int `json:"is_ok"`   //是否满足领样条件
+
 }
 
 // 快手列表返回的结果

+ 8 - 2
app/model/youngee_talent_model/selection_task.go

@@ -14,8 +14,14 @@ type SignSecTaskReq struct {
 	TeamId      string `json:"team_id"`      //添加橱窗不需要
 	SaleNum     int    `json:"saleNum"`
 	FansNum     int    `json:"fans"`
-	OpenId      string `json:"open_id"`
-	IsOk        int    `json:"is_ok"` //此快手是否满足领样条件 0不满足,1满足
+	OpenId      string `json:"open_id"` //选中账号的openid
+	//IsOk        int    `json:"is_ok"`   //此快手是否满足领样条件 0不满足,1满足
+}
+
+type SignSecTaskFromWindowReq struct {
+	SelectionId string `json:"selection_id"`
+	ProductId   string `json:"product_id"`
+	OpenId      string `json:"open_id"` //选中账号的openid
 }
 
 type SignSecTaskResp struct {

+ 28 - 23
app/model/youngee_talent_model/talent_account.go

@@ -1,23 +1,28 @@
-package youngee_talent_model
-
-import "github.com/gogf/gf/util/gmeta"
-
-type InfoThirdPlatform struct {
-	gmeta.Meta   `orm:"table:info_third_platform"`
-	PlatformId   uint   `json:"platform_id"`   // 平台id,主键
-	PlatformName string `json:"platform_name"` // 平台名
-	PlatformIcon string `json:"platform_icon"` // 平台图标url
-}
-
-type PlatformAccountInfo struct {
-	gmeta.Meta         `orm:"table:youngee_platform_account_info"`
-	AccountId          int                `json:"account_id"`            //
-	TalentId           string             `json:"talent_id"`             // 达人账号id(youngee_talent_info表id值)
-	PlatformId         int                `json:"platform_id"`           // 平台id,与third_platform_info中的id相同
-	PlatformUid        int                `json:"platform_uid"`          // 在平台上的id
-	PlatformNickname   string             `json:"platform_nickname"`     // 在平台上的昵称
-	HomePageUrl        string             `json:"home_page_url"`         // 主页链接
-	FansCount          int64              `json:"fans_count"`            // 粉丝数
-	HomePageCaptureUrl string             `json:"home_page_capture_url"` // 主页截图链接
-	PlatformInfo       *InfoThirdPlatform `orm:"with:platform_id=platform_id"`
-}
+package youngee_talent_model
+
+import "github.com/gogf/gf/util/gmeta"
+
+type InfoThirdPlatform struct {
+	gmeta.Meta   `orm:"table:info_third_platform"`
+	PlatformId   uint   `json:"platform_id"`   // 平台id,主键
+	PlatformName string `json:"platform_name"` // 平台名
+	PlatformIcon string `json:"platform_icon"` // 平台图标url
+}
+
+type PlatformAccountInfo struct {
+	gmeta.Meta         `orm:"table:platform_kuaishou_user_info"`
+	TalentId           string             `json:"talent_id"`             // 达人账号id(youngee_talent_info表id值)
+	PlatformId         int                `json:"platform_id"`           // 平台id
+	Nickname           string             `json:"nick_name"`             // 在平台上的昵称
+	HomePageUrl        string             `json:"home_page_url"`         // 主页链接
+	HomePageCaptureUrl string             `json:"home_page_capture_url"` // 主页截图链接
+	PlatformInfo       *InfoThirdPlatform `orm:"with:platform_id=platform_id"`
+}
+
+type AddAccountReq struct {
+	PlatformId int `json:"platform_id"` // 平台id
+	//Nickname           string             `json:"nick_name"`             // 废弃,不填写
+	HomePageUrl        string             `json:"home_page_url"`         // 主页链接
+	HomePageCaptureUrl string             `json:"home_page_capture_url"` // 主页截图链接
+	PlatformInfo       *InfoThirdPlatform `orm:"with:platform_id=platform_id"`
+}

+ 28 - 28
app/model/youngee_talent_model/talent_address.go

@@ -1,28 +1,28 @@
-package youngee_talent_model
-
-import "github.com/gogf/gf/util/gmeta"
-
-type TalentDeliveryAddress struct {
-	gmeta.Meta   `orm:"table:youngee_talent_delivery_address"`
-	RegionCode   int    `json:"region_code"`   // 区域码,取info_region表中的self_code字段值
-	DetailAddr   string `json:"detail_addr"`   // 详细地址
-	PhoneNumber  string `json:"phone_number"`  // 联系电话
-	ReceiverName string `json:"receiver_name"` // 收货人名字
-	DefaultTag   int    `json:"default_tag"`   // 是否默认收货地址
-	TalentId     string `json:"talent_id"`     // 达人id(youngee_talent_info表中的id)
-}
-
-type DeleteDeliveryAddress struct {
-	gmeta.Meta `orm:"table:youngee_talent_delivery_address"`
-	AddressId  int `json:"address_id"`
-	DefaultTag int `json:"default_tag"`
-}
-
-type DeliveryAddressModifyReq struct {
-	gmeta.Meta   `orm:"table:youngee_talent_delivery_address"`
-	AddressId    int64  `json:"address_id"`    //
-	RegionCode   int    `json:"region_code"`   // 区域码,取info_region表中的self_code字段值
-	DetailAddr   string `json:"detail_addr"`   // 详细地址
-	PhoneNumber  string `json:"phone_number"`  // 联系电话
-	ReceiverName string `json:"receiver_name"` // 收货人名字
-}
+package youngee_talent_model
+
+import "github.com/gogf/gf/util/gmeta"
+
+type TalentDeliveryAddress struct {
+	gmeta.Meta   `orm:"table:youngee_talent_delivery_address"`
+	DoorNumber   string `json:"door_number"`   // 门牌号
+	DetailAddr   string `json:"detail_addr"`   // 所在地区
+	PhoneNumber  string `json:"phone_number"`  // 联系电话
+	ReceiverName string `json:"receiver_name"` // 收货人名字
+	DefaultTag   int    `json:"default_tag"`   // 是否默认收货地址 1是  0不是
+}
+
+type DeleteDeliveryAddress struct {
+	gmeta.Meta `orm:"table:youngee_talent_delivery_address"`
+	AddressId  int `json:"address_id"`
+	DefaultTag int `json:"default_tag"`
+}
+
+type DeliveryAddressModifyReq struct {
+	gmeta.Meta   `orm:"table:youngee_talent_delivery_address"`
+	AddressId    int    `json:"address_id"`
+	DoorNumber   string `json:"door_number"`   // 门牌号
+	DetailAddr   string `json:"detail_addr"`   // 所在地区
+	PhoneNumber  string `json:"phone_number"`  // 联系电话
+	ReceiverName string `json:"receiver_name"` // 收货人名字
+	DefaultTag   int    `json:"default_tag"`   // 是否默认收货地址 1是  0不是
+}

+ 4 - 0
app/model/youngee_talent_model/task_info.go

@@ -92,6 +92,7 @@ type YoungeeTaskInfo struct {
 	SOperatorType          int            `json:"s_operator_type"`           // 服务商操作人类型
 	SProjectId             int            `json:"s_project_id"`              // 服务商种草任务ID
 	ProjectDetail          *ProjectDetail `json:"project_detail"`            //项目详情
+	WxNum                  string         `json:"wx_num"`
 }
 
 type YoungeeLocalTaskInfo struct {
@@ -154,6 +155,7 @@ type YoungeeLocalTaskInfo struct {
 	SOperatorType          int            `json:"s_operator_type"`           // 服务商操作人类型
 	SProjectId             int            `json:"s_project_id"`              // 服务商种草任务ID
 	ProjectDetail          *ProjectDetail `json:"project_detail"`            //项目详情
+	WxNum                  string         `json:"wx_num"`
 }
 
 type SignTaskInfo struct {
@@ -163,6 +165,7 @@ type SignTaskInfo struct {
 	AddressId  uint64  `json:"address_id"`
 	StrategyId int     `json:"strategy_id"`
 	Offer      float64 `json:"offer"` //最终提交时的稿费
+	WxNum      string  `json:"wx_num"`
 }
 
 type SignLocalTaskInfo struct {
@@ -171,6 +174,7 @@ type SignLocalTaskInfo struct {
 	OpenID     string  `json:"open_id"`    //选中快手账号唯一标识
 	StrategyId int     `json:"strategy_id"`
 	Offer      float64 `json:"offer"` //最终提交时的稿费
+	WxNum      string  `json:"wx_num"`
 }
 
 type TaskInfoBrief struct {

+ 46 - 43
app/service/youngee_sectask_service/seletion_square.go

@@ -486,7 +486,6 @@ func GetSelectionDetail(r *ghttp.Request) *TalentHttpResult {
 	//带货浏览历史
 	//浏览历史
 	currentDate := gtime.Now().Format("Ymd")
-	fmt.Println("date-----:", currentDate)
 	// 设计 Redis Key
 	redisBrowseKey := fmt.Sprintf("browseSelection:%s:%s", currentDate, tid)
 	fmt.Println("redis浏览记录的key为——————————", redisBrowseKey)
@@ -592,7 +591,9 @@ func IsSignUpSecTask(r *ghttp.Request) *TalentHttpResult {
 // 添加橱窗--选中账号--此账号是否有报名信息
 func IsCreateSecTask(r *ghttp.Request) *TalentHttpResult {
 	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	openId := r.GetString("open_id", "")
+	var signSecTaskReq *youngee_talent_model.SignSecTaskFromWindowReq
+	err = r.ParseForm(&signSecTaskReq)
+
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
 	}
@@ -601,13 +602,12 @@ func IsCreateSecTask(r *ghttp.Request) *TalentHttpResult {
 	//1.查task表全部数据
 	var task []youngee_talent_model.SecTaskInfoDetail
 	err = g.DB().Model(youngee_talent_model.SecTaskInfoDetail{}).WithAll().
-		Where("talent_id = ? AND selection_id = ? open_id = ?", tid, selectionId, openId).
+		Where("talent_id = ? AND selection_id = ? open_id = ?", tid, selectionId, signSecTaskReq.OpenId).
 		Scan(&task)
 	if err != nil {
 		return &TalentHttpResult{Code: 0, Msg: err.Error(), Data: nil}
 	}
 	isSign := youngee_talent_model.IsSignSecTask{}
-
 	//添加橱窗时,有task了就不再创建
 	if len(task) != 0 {
 		isSign.IsSign = 1
@@ -632,9 +632,9 @@ func SignUpSecTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 	if err != nil {
 		return &TalentHttpResult{Code: -2, Msg: "parse param error"}
 	}
-	if signSecTaskReq.IsOk == 0 {
-		return &TalentHttpResult{Code: -10, Msg: "此账号领样条件不满足"}
-	}
+	//if signSecTaskReq.IsOk == 0 {
+	//	return &TalentHttpResult{Code: -10, Msg: "此账号领样条件不满足"}
+	//}
 	// 查得的selectionDetail包含product、photo、策略表等综合数据
 	var selectionDetail *youngee_talent_model.SelectionDetail
 	err = g.DB().Model(youngee_talent_model.SelectionDetail{}).WithAll().Where("selection_id", signSecTaskReq.SelectionId).Scan(&selectionDetail)
@@ -662,7 +662,7 @@ func SignUpSecTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 	}
 
 	// 社媒账号详情
-	var accountInfo *youngee_talent_model.PlatformAccountInfo
+	var accountInfo *youngee_talent_model.AddAccountReq
 	err = g.DB().Model("youngee_platform_account_info").WithAll().Where("talent_id = ? and platform_id = ?", tid, selectionDetail.Platform).Scan(&accountInfo)
 	if err != nil {
 		return &TalentHttpResult{Code: -5, Msg: err.Error()}
@@ -703,7 +703,6 @@ func SignUpSecTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 		FansNum:                signSecTaskReq.FansNum,
 		OpenId:                 signSecTaskReq.OpenId,
 		TalentId:               tid,
-		AccountId:              accountInfo.AccountId,
 		TalentPlatformInfoSnap: string(accountSnap),
 		TalentPersonalInfoSnap: string(talentSnap),
 		TalentPostAddrSnap:     string(addrSnap),
@@ -803,7 +802,7 @@ func SignUpSecTaskFromWindow(r *ghttp.Request) *TalentHttpResult {
 		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
 	}
 	// 解析body/json参数
-	var signSecTaskReq *youngee_talent_model.SignSecTaskReq
+	var signSecTaskReq *youngee_talent_model.SignSecTaskFromWindowReq
 	err = r.ParseForm(&signSecTaskReq)
 	if err != nil {
 		return &TalentHttpResult{Code: -2, Msg: "parse param error"}
@@ -815,9 +814,15 @@ func SignUpSecTaskFromWindow(r *ghttp.Request) *TalentHttpResult {
 		return &TalentHttpResult{Code: -3, Msg: err.Error()}
 	}
 
+	var kuaishouInfo *youngee_talent_model.KuaishouUserInfo
+	err = g.DB().Model(youngee_talent_model.KuaishouUserInfo{}).Where("open_id", signSecTaskReq.OpenId).Scan(&kuaishouInfo)
+	if err != nil {
+		return &TalentHttpResult{Code: -3, Msg: err.Error()}
+	}
+
 	//获取选品表中的ddl
-	var selectionInfo *model.YounggeeSelectionInfo
-	err = g.DB().Model("younggee_selection_info").Where("selection_id", signSecTaskReq.SelectionId).Scan(&selectionInfo)
+	//var selectionInfo *model.YounggeeSelectionInfo
+	//err = g.DB().Model("younggee_selection_info").Where("selection_id", signSecTaskReq.SelectionId).Scan(&selectionInfo)
 
 	var product model.YounggeeProduct
 	err = json.Unmarshal([]byte(selectionDetail.ProductSnap), &product)
@@ -851,22 +856,21 @@ func SignUpSecTaskFromWindow(r *ghttp.Request) *TalentHttpResult {
 	}
 	//没有任务被创建时,用此数据
 	secTaskInfo := youngee_talent_model.SecTaskInfoWindowDetail{
-		TaskId:                 newTaskId,
-		SelectionId:            signSecTaskReq.SelectionId,
-		ProductId:              signSecTaskReq.ProductId,
-		SaleNum:                signSecTaskReq.SaleNum,
-		FansNum:                signSecTaskReq.FansNum,
+		TaskId:      newTaskId,
+		SelectionId: signSecTaskReq.SelectionId,
+		ProductId:   signSecTaskReq.ProductId,
+		//SaleNum:                kuasihouInfo.SaleNum,
+		FansNum:                kuaishouInfo.Fan,
 		TalentId:               tid,
 		OpenId:                 signSecTaskReq.OpenId,
-		AccountId:              accountInfo.AccountId,
 		TalentPlatformInfoSnap: string(accountSnap),
 		TalentPersonalInfoSnap: string(talentSnap),
 		//TalentPostAddrSnap:     string(addrSnap),
-		TaskReward:       selectionInfo.TaskReward,
+		TaskReward:       selectionDetail.TaskReward,
 		TalentPayment:    product.ProductPrice,
 		IsPayPayment:     0,
 		IsPayReward:      0,
-		TaskMode:         selectionInfo.TaskMode,
+		TaskMode:         selectionDetail.TaskMode,
 		SampleMode:       3, //添加橱窗,当作不提供领样处理
 		PlatformId:       4, //快手电商平台
 		TaskStage:        3,
@@ -877,11 +881,11 @@ func SignUpSecTaskFromWindow(r *ghttp.Request) *TalentHttpResult {
 		AssignmentStatus: 1,
 		UpdateAt:         gtime.Now(),
 		WithdrawStatus:   1,
-		LeadTeamId:       signSecTaskReq.LeadTeamId,
-		TeamId:           signSecTaskReq.TeamId,
-		TeamIncome:       0,
-		TeamPoint:        0,
-		TaskDdl:          selectionInfo.TaskDdl,
+		//LeadTeamId:       signSecTaskReq.LeadTeamId,
+		//TeamId:           signSecTaskReq.TeamId,
+		TeamIncome: 0,
+		TeamPoint:  0,
+		TaskDdl:    selectionDetail.TaskDdl,
 	}
 	//如果已经有数据了,删除。模拟在快手侧里把橱窗商品删了,想再加回来
 
@@ -906,21 +910,20 @@ func SignUpSecTaskFromWindow(r *ghttp.Request) *TalentHttpResult {
 		}
 		//插入新的(含free_stage)
 		secTaskInfo_new := youngee_talent_model.SecTaskInfoWindowDetail{
-			TaskId:                 newTaskId,
-			SelectionId:            signSecTaskReq.SelectionId,
-			ProductId:              signSecTaskReq.ProductId,
-			SaleNum:                signSecTaskReq.SaleNum,
-			FansNum:                signSecTaskReq.FansNum,
+			TaskId:      newTaskId,
+			SelectionId: signSecTaskReq.SelectionId,
+			ProductId:   signSecTaskReq.ProductId,
+			//SaleNum:                signSecTaskReq.SaleNum,
+			//FansNum:                signSecTaskReq.FansNum,
 			TalentId:               tid,
-			AccountId:              accountInfo.AccountId,
 			TalentPlatformInfoSnap: string(accountSnap),
 			TalentPersonalInfoSnap: string(talentSnap),
 			//TalentPostAddrSnap:     string(addrSnap),
-			TaskReward:       selectionInfo.TaskReward,
-			TalentPayment:    product.ProductPrice,
-			IsPayPayment:     0,
-			IsPayReward:      0,
-			TaskMode:         selectionInfo.TaskMode,
+			//TaskReward:       selectionInfo.TaskReward,
+			TalentPayment: product.ProductPrice,
+			IsPayPayment:  0,
+			IsPayReward:   0,
+			//TaskMode:         selectionInfo.TaskMode,
 			SampleMode:       3, //添加橱窗,当作不提供领样处理
 			PlatformId:       4, //快手平台
 			TaskStage:        3,
@@ -931,12 +934,12 @@ func SignUpSecTaskFromWindow(r *ghttp.Request) *TalentHttpResult {
 			AssignmentStatus: 1,
 			UpdateAt:         gtime.Now(),
 			WithdrawStatus:   1,
-			LeadTeamId:       signSecTaskReq.LeadTeamId,
-			TeamId:           signSecTaskReq.TeamId,
-			TeamIncome:       0,
-			TeamPoint:        0,
-			TaskDdl:          selectionInfo.TaskDdl,
-			FreeStage:        free_stage,
+			//LeadTeamId:       signSecTaskReq.LeadTeamId,
+			//TeamId:           signSecTaskReq.TeamId,
+			TeamIncome: 0,
+			TeamPoint:  0,
+			//TaskDdl:          selectionInfo.TaskDdl,
+			FreeStage: free_stage,
 		}
 		err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
 			// 新建任务,初始化状态为待确认
@@ -954,7 +957,7 @@ func SignUpSecTaskFromWindow(r *ghttp.Request) *TalentHttpResult {
 			TaskId: newTaskId,
 		}
 		return &TalentHttpResult{Code: 0, Msg: "success", Data: signSecTaskResp}
-	} else {
+	} else { //上面的代码一定不会被执行,不管了
 		//3.如果已经报过名了需要传递给新的数据。删除添加橱窗时创建的不完整的数据
 		_, err = g.DB().Model("younggee_sec_task_info").
 			Where("talent_id = ? AND selection_id = ? ", tid, signSecTaskReq.SelectionId).

+ 103 - 6
app/service/youngee_talent_service/BrowseHistory.go

@@ -22,6 +22,55 @@ type BrowseSelectionHistory struct {
 	SelectionList []youngee_talent_model.SelectionDetail `json:"selectionList"`
 }
 
+// 存储每个日期和对应的本地生活列表
+type BrowseLocalHistory struct {
+	Date      string                                 `json:"date"`
+	LocalList []youngee_talent_model.LocalInfoDetail `json:"localList"`
+}
+
+func GetLocalBrowseHistory(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+	// 获取所有相关的 Redis Key
+	redisKeyPattern := fmt.Sprintf("browseLocal:*:%s", tid)
+	keys, err := g.Redis().DoVar("KEYS", redisKeyPattern)
+	if err != nil {
+		fmt.Println("Get redis keys error", err)
+	}
+
+	// 初始化返回的数据
+	var browseLocalHistories []BrowseLocalHistory
+
+	// 遍历所有的日期 Key
+	for _, key := range keys.Slice() {
+		// 获取日期部分
+		keyStr := gconv.String(key)
+		date := strings.Split(keyStr, ":")[1]
+		// 获取该日期下的所有 pid
+		localIds, err := g.Redis().DoVar("SMEMBERS", keyStr)
+		if err != nil {
+			println("Get redis keys error", err)
+		}
+
+		// 使用 localIds 查询数据库,获取商品列表
+		var localList []youngee_talent_model.LocalInfoDetail
+		err = g.DB().Model("project_info").WithAll().Where("local_id IN(?)", localIds.Strings()).Scan(&localList)
+		if err != nil {
+			println("Get redis projects error", err)
+		}
+		// 构建 BrowseHistory 对象
+		browseLocalHistory := BrowseLocalHistory{
+			Date:      date,
+			LocalList: localList,
+		}
+		// 添加到结果列表中
+		browseLocalHistories = append(browseLocalHistories, browseLocalHistory)
+	}
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: browseLocalHistories}
+}
+
 func GetProjectBrowseHistory(r *ghttp.Request) *TalentHttpResult {
 	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
 	if err != nil {
@@ -29,6 +78,7 @@ func GetProjectBrowseHistory(r *ghttp.Request) *TalentHttpResult {
 	}
 	// 获取所有相关的 Redis Key
 	redisKeyPattern := fmt.Sprintf("browseProject:*:%s", tid)
+	//获取存储了pid和sPid的所有key
 	keys, err := g.Redis().DoVar("KEYS", redisKeyPattern)
 	if err != nil {
 		fmt.Println("Get redis keys error", err)
@@ -42,23 +92,69 @@ func GetProjectBrowseHistory(r *ghttp.Request) *TalentHttpResult {
 		// 获取日期部分
 		keyStr := gconv.String(key)
 		date := strings.Split(keyStr, ":")[1]
-		// 获取该日期下的所有 pid
-		pids, err := g.Redis().DoVar("SMEMBERS", keyStr)
+
+		// 获取该日期下的所有 pid:s_project_id 组合
+		browseItems, err := g.Redis().DoVar("SMEMBERS", keyStr)
 		if err != nil {
 			println("Get redis keys error", err)
+			continue
 		}
 
-		// 使用 pids 查询数据库,获取商品列表
+		// 准备存放项目详细信息的列表
 		var projectList []youngee_talent_model.ProjectDetail
-		err = g.DB().Model("project_info").WithAll().Where("project_id IN(?)", pids.Strings()).Scan(&projectList)
-		if err != nil {
-			println("Get redis projects error", err)
+
+		// 遍历每个 pid:s_project_id 组合
+		for _, item := range browseItems.Strings() {
+			parts := strings.Split(item, ":")
+			if len(parts) < 2 {
+				println("Invalid format for browse item:", item)
+				continue
+			}
+
+			pid := parts[0]
+			s_project_id := gconv.Int(parts[1])
+
+			// 查询项目详情(`project_info` 表中的基础信息)
+			var projectDetail youngee_talent_model.ProjectDetail
+			err = g.DB().Model("project_info").WithAll().Where("project_id = ?", pid).Scan(&projectDetail)
+			if err != nil {
+				println("Get project detail error", err)
+				continue
+			}
+
+			// 判断 `s_project_id` 是否为 0,若不为 0,表示来自服务商
+			if s_project_id != 0 {
+				// 查询 `project_info_supplier` 表获取服务商信息
+				projectInfoSupplier := youngee_talent_model.ProjectInfoSupplier{}
+				err = g.DB().Model("younggee_s_project_info").Where("s_project_id = ?", s_project_id).Scan(&projectInfoSupplier)
+				if err != nil {
+					println("Get projectInfoSupplier error:", err)
+					continue
+				}
+
+				// 根据供应商 ID 查询 `younggee_supplier` 表获取供应商详细信息
+				var younggeeSupplier *youngee_talent_model.YounggeeSupplier
+				err = g.DB().Model("younggee_supplier").WithAll().Where("supplier_id", projectInfoSupplier.SupplierID).Scan(&younggeeSupplier)
+				if err != nil {
+					println("Get younggeeSupplier error:", err)
+					continue
+				}
+
+				// 将供应商信息和项目供应商信息赋值给项目详情
+				projectDetail.YounggeeSupplier = younggeeSupplier
+				projectDetail.ProjectInfoSupplier = &projectInfoSupplier
+			}
+
+			// 将项目详情添加到项目列表
+			projectList = append(projectList, projectDetail)
 		}
+
 		// 构建 BrowseHistory 对象
 		browseProjectHistory := BrowseProjectHistory{
 			Date:        date,
 			ProjectList: projectList,
 		}
+
 		// 添加到结果列表中
 		browseProjectHistories = append(browseProjectHistories, browseProjectHistory)
 	}
@@ -73,6 +169,7 @@ func GetSelectionBrowseHistory(r *ghttp.Request) *TalentHttpResult {
 	}
 	// 获取所有相关的 Redis Key
 	redisKeyPattern := fmt.Sprintf("browseSelection:*:%s", tid)
+	//返回该达人所有day的key
 	keys, err := g.Redis().DoVar("KEYS", redisKeyPattern)
 	if err != nil {
 		fmt.Println("Get redis keys error", err)

+ 5 - 1
app/service/youngee_talent_service/LoginFromSms.go

@@ -20,8 +20,12 @@ type LoginReq struct {
 	Vcode string `json:"vcode"`
 }
 
-// 通过短信登录
+type AuthLoginReq struct {
+	Phone string `json:"phone"` //旧手机号
+	Vcode string `json:"vcode"` //验证码
+}
 
+// 通过短信登录
 func LoginFromSms(r *ghttp.Request) *TalentHttpResult {
 	l := LoginReq{}
 	err := r.ParseForm(&l)

+ 1 - 2
app/service/youngee_talent_service/SendSmsCode.go

@@ -37,7 +37,6 @@ func SendSmsCode(r *ghttp.Request) *TalentHttpResult {
 		return &TalentHttpResult{Code: -1, Msg: "请求体解析失败"}
 	}
 	vcode := GetCode()
-	fmt.Println("验证码为=====>", vcode)
 
 	err = SendCodeImp(l.Phone, vcode)
 	if err != nil {
@@ -47,7 +46,7 @@ func SendSmsCode(r *ghttp.Request) *TalentHttpResult {
 	//验证码存redis
 	_ = SetRedis(l.Phone, vcode)
 
-	return &TalentHttpResult{Code: 0, Msg: "sendSmsCodeSuccess"}
+	return &TalentHttpResult{Code: 0, Msg: "sendSmsCodeSuccess", Data: vcode}
 }
 
 func SetRedis(phone string, vcode string) error {

+ 88 - 22
app/service/youngee_talent_service/talent_account.go

@@ -2,6 +2,10 @@ package youngee_talent_service
 
 import (
 	"fmt"
+	"github.com/gogf/gf/encoding/gjson"
+	"io/ioutil"
+	"net/http"
+	"net/url"
 	"youngmini_server/app/dao"
 	"youngmini_server/app/model/youngee_talent_model"
 	"youngmini_server/app/utils"
@@ -56,45 +60,107 @@ func OnAddTalentAccount(r *ghttp.Request) *TalentHttpResult {
 		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
 	}
 
-	account := youngee_talent_model.PlatformAccountInfo{}
+	account := youngee_talent_model.AddAccountReq{}
+	//account := youngee_talent_model.KuaishouUserInfo{}
 	err = r.ParseForm(&account)
 	if err != nil {
 		return &TalentHttpResult{Code: -2, Msg: err.Error()}
 	}
+	//获取 基本信息,头像昵称、粉丝数、作品数目、点赞数
+
+	//小红书
+	if account.PlatformId == 1 {
+		//获取匿名cookie
+		cookie := getXHSCookie()
+		if cookie == "" {
+			return &TalentHttpResult{Code: -1, Msg: "小红书cookie获取失败"}
+		}
+		//获取用户唯一标识
+		shareText := account.HomePageUrl
+		parsedURL, err := url.Parse(shareText)
+		if err != nil {
+			fmt.Println("Error parsing URL:", err)
+		}
+		queryParams := parsedURL.Query()
+		appuid := queryParams.Get("appuid")
+		if appuid != "" {
+			fmt.Println("appuid:", appuid)
+		} else {
+			fmt.Println("AppUID not found")
+		}
+		//获取用户基本信息
+
+		//插入平台表
+
+	} else {
+		// 插入达人账号信息
+		_, err = g.Model("platform_kuaishou_user_info").Insert(account)
+		if err != nil {
+			return &TalentHttpResult{Code: -2, Msg: err.Error()}
+		}
+
+		// 修改talent表字段is_bind_account值为1
+		_, err = g.Model(dao.YoungeeTalentInfo.Table).Data("is_bind_account=1").Where("id", tid).Update()
+		if err != nil {
+			return &TalentHttpResult{Code: -2, Msg: err.Error()}
+		}
+
+		return &TalentHttpResult{Code: 0, Msg: "success"}
 
-	// 将达人id存入结构体
-	account.TalentId = tid
-	// 插入达人账号信息
-	_, err = g.Model(dao.YoungeePlatformAccountInfo.Table).Insert(account)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: err.Error()}
 	}
+	return &TalentHttpResult{Code: 0, Msg: "success"}
 
-	// 修改talent表字段is_bind_account值为1
-	_, err = g.Model(dao.YoungeeTalentInfo.Table).Data("is_bind_account=1").Where("id", tid).Update()
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: err.Error()}
-	}
+}
 
+func OnUpdateTalentAccount(r *ghttp.Request) *TalentHttpResult {
+	//tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	//if err != nil {
+	//	return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	//}
+	//account := youngee_talent_model.PlatformAccountInfo{}
+	//err = r.ParseForm(&account)
+	//if err != nil {
+	//	return &TalentHttpResult{Code: -2, Msg: err.Error()}
+	//}
+	//account.TalentId = tid
+	//_, err = g.DB().Model(dao.YoungeePlatformAccountInfo.Table).Update(account, "account_id = ? and talent_id = ?", account.AccountId, tid)
+	//if err != nil {
+	//	return &TalentHttpResult{Code: -3, Msg: "update failed"}
+	//}
 	return &TalentHttpResult{Code: 0, Msg: "success"}
 }
 
-func OnUpdateTalentAccount(r *ghttp.Request) *TalentHttpResult {
-	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+func getXHSCookie() string {
+	// 请求的 URL
+	url := "http://120.46.92.62:6888/api/xhs/any_account"
+
+	// 创建 POST 请求(无请求体)
+	resp, err := http.Post(url, "application/json", nil)
 	if err != nil {
-		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+		fmt.Println("Error sending POST request:", err)
+		return ""
 	}
+	defer resp.Body.Close()
 
-	account := youngee_talent_model.PlatformAccountInfo{}
-	err = r.ParseForm(&account)
+	// 读取响应体
+	body, err := ioutil.ReadAll(resp.Body)
 	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: err.Error()}
+		fmt.Println("Error reading response body:", err)
+		return ""
 	}
-	account.TalentId = tid
-	_, err = g.DB().Model(dao.YoungeePlatformAccountInfo.Table).Update(account, "account_id = ? and talent_id = ?", account.AccountId, tid)
+
+	// 解析 JSON 响应
+	jsonData, err := gjson.LoadContent(string(body))
 	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "update failed"}
+		fmt.Println("Error parsing JSON:", err)
+		return ""
 	}
 
-	return &TalentHttpResult{Code: 0, Msg: "success"}
+	// 提取 `cookie` 字段的值
+	cookie := jsonData.GetString("data.response_body.data.cookie")
+	if cookie != "" {
+		return cookie
+	} else {
+		return ""
+	}
 }

+ 98 - 95
app/service/youngee_talent_service/talent_address.go

@@ -2,9 +2,7 @@ package youngee_talent_service
 
 import (
 	"context"
-	"fmt"
 	"youngmini_server/app/dao"
-	"youngmini_server/app/model"
 	"youngmini_server/app/model/youngee_talent_model"
 	"youngmini_server/app/utils"
 
@@ -21,7 +19,7 @@ func GetTalentDefaultAddress(r *ghttp.Request) *TalentHttpResult {
 		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
 	}
 
-	res, err := g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).Where("talent_id = ? and default_tag = 1", tid).One()
+	res, err := g.DB().Model("youngee_talent_delivery_address").Where("talent_id = ? and default_tag = 1", tid).One()
 	if err != nil {
 		return &TalentHttpResult{Code: -2, Msg: err.Error()}
 	}
@@ -35,12 +33,10 @@ func GetTalentAddress(r *ghttp.Request) *TalentHttpResult {
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
 	}
-
-	res, err := g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).All("talent_id", tid)
+	res, err := g.DB().Model("youngee_talent_delivery_address").All("talent_id", tid)
 	if err != nil {
 		return &TalentHttpResult{Code: -2, Msg: err.Error()}
 	}
-
 	return &TalentHttpResult{Code: 0, Msg: "success", Data: res}
 }
 
@@ -69,65 +65,30 @@ func OnAddTalentAddress(r *ghttp.Request) *TalentHttpResult {
 
 	tAddr := youngee_talent_model.TalentDeliveryAddress{}
 	err = r.ParseForm(&tAddr)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: err.Error()}
+	info := g.Map{
+		"talent_id":      tid,
+		"door_num":       tAddr.DoorNumber,
+		"detail_address": tAddr.DetailAddr,
+		"receive_name":   tAddr.ReceiverName,
+		"default_tag":    tAddr.DefaultTag,
 	}
-
-	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-		var tErr error
-		//等价于
-		//UPDATE talent_info
-		//SET is_bind_location = 1
-		//WHERE id = ?
-		_, tErr = tx.Ctx(ctx).Model(dao.YoungeeTalentInfo.Table).Update("is_bind_location=1", "id", tid)
-		if err != nil {
-			return tErr
-		}
-
-		// 如果当前无地址则将其设为默认地址
-		c, tErr := tx.Ctx(ctx).Model(dao.YoungeeTalentDeliveryAddress.Table).Where("talent_id", tid).Count()
-		if tErr != nil {
-			return tErr
-		}
-		if c == 0 {
-			tAddr.DefaultTag = 1
-		}
-
-		// 如果设置的是地址是默认地址,则把当前默认地址设为非默认
-		if tAddr.DefaultTag > 0 {
-			_, tErr = tx.Ctx(ctx).Model(dao.YoungeeTalentDeliveryAddress.Table).
-				Update("default_tag=0", "talent_id=? and default_tag = 1", tid)
-			if tErr != nil {
-				return tErr
-			}
-		}
-		if tAddr.DefaultTag == 1 {
-			_, tErr = tx.Ctx(ctx).Model(dao.YoungeeTalentInfo.Table).
-				Update("talent_phone_number = ?", "id = ?", tAddr.PhoneNumber, tid)
-			if tErr != nil {
-				return tErr
-			}
-		}
-
-		// 将达人id存入结构体
-		tAddr.TalentId = tid
-		// 插入新的收货地址记录
-		_, tErr = tx.Ctx(ctx).Model(dao.YoungeeTalentDeliveryAddress.Table).Insert(tAddr)
-		if tErr != nil {
-			return tErr
-		}
-
-		return nil
-	})
-
+	count, err := g.DB().Model("youngee_talent_delivery_address").Where("talent_id", tid).Count()
+	if count == 0 {
+		tAddr.DefaultTag = 1
+	}
+	if count > 0 {
+		tAddr.DefaultTag = 0
+	}
+	_, err = g.DB().Model("youngee_talent_delivery_address").Where("talent_id", tid).Data(info).Update()
+	_, err = g.DB().Model("youngee_talent_info").Where("talent_id", tid).Data(g.Map{"is_bind_location": 1}).Update()
 	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "failed"}
+		return &TalentHttpResult{Code: -2, Msg: err.Error()}
 	}
 
 	return &TalentHttpResult{Code: 0, Msg: "success"}
 }
 
-// 删除收货地址
+// 删除收货地址 todo
 func OnDeleteTalentAddress(r *ghttp.Request) *TalentHttpResult {
 	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
 	if err != nil {
@@ -148,7 +109,7 @@ func OnDeleteTalentAddress(r *ghttp.Request) *TalentHttpResult {
 			}
 		}
 		// 删除收货地址记录
-		_, err1 := tx.Ctx(ctx).Model(dao.YoungeeTalentDeliveryAddress.Table).Delete("address_id", deleteReq.AddressId)
+		_, err1 := tx.Ctx(ctx).Model("youngee_talent_delivery_address").Delete("address_id", deleteReq.AddressId)
 		if err1 != nil {
 			return err1
 		}
@@ -177,22 +138,70 @@ func OnUpdateTalentAddress(r *ghttp.Request) *TalentHttpResult {
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: "Update talent address failed"}
 	}
-
 	var modifyReq *youngee_talent_model.DeliveryAddressModifyReq
 	err = r.ParseForm(&modifyReq)
-	fmt.Println("sdafa", &modifyReq)
 	if err != nil {
 		return &TalentHttpResult{Code: -2, Msg: "params error"}
 	}
-
-	_, err = g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).Update(modifyReq, "address_id = ? and talent_id = ?", modifyReq.AddressId, tid)
+	_, err = g.DB().Model("youngee_talent_delivery_address").Update(modifyReq, "address_id = ? and talent_id = ?", modifyReq.AddressId, tid)
 	if err != nil {
 		return &TalentHttpResult{Code: -3, Msg: "update failed"}
 	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: "bbb"}
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: nil}
 }
 
+// SetDefaultDeliveryAddr 设置默认收货地址
+//func SetDefaultDeliveryAddr(r *ghttp.Request) *TalentHttpResult {
+//	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+//	}
+//
+//	aid := r.GetRequestInt32("address_id", 0)
+//	if aid == 0 {
+//		return &TalentHttpResult{Code: -1, Msg: "Get address id error"}
+//	}
+//
+//	rec, err := g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).One("talent_id = ? and default_tag = 1", tid)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -2, Msg: "found default delivery address error"}
+//	}
+//
+//	if rec == nil {
+//		_, err = g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).Update("default_tag = 1", "address_id", aid)
+//	} else {
+//		err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
+//			_, err1 := tx.Ctx(ctx).Model(dao.YoungeeTalentDeliveryAddress.Table).Update("default_tag = 0", "address_id", rec["address_id"])
+//			if err1 != nil {
+//				return err1
+//			}
+//
+//			_, err1 = tx.Ctx(ctx).Model(dao.YoungeeTalentDeliveryAddress.Table).Update("default_tag = 1", "address_id", aid)
+//			if err1 != nil {
+//				return err1
+//			}
+//
+//			return nil
+//		})
+//	}
+//	if err != nil {
+//		return &TalentHttpResult{Code: -3, Msg: "database error"}
+//	}
+//	addressInfo := model.YoungeeTalentDeliveryAddress{}
+//	err = g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).Where("address_id", aid).Scan(&addressInfo)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -4, Msg: "address id error"}
+//	}
+//
+//	_, err = g.DB().Model(dao.YoungeeTalentInfo.Table).
+//		Update("talent_phone_number = ?", "id = ?", addressInfo.PhoneNumber, tid)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -4, Msg: "address id error"}
+//	}
+//
+//	return &TalentHttpResult{Code: 0, Msg: "success"}
+//}
+
 // SetDefaultDeliveryAddr 设置默认收货地址
 func SetDefaultDeliveryAddr(r *ghttp.Request) *TalentHttpResult {
 	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
@@ -200,47 +209,41 @@ func SetDefaultDeliveryAddr(r *ghttp.Request) *TalentHttpResult {
 		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
 	}
 
-	aid := r.GetRequestInt32("address_id", 0)
-	if aid == 0 {
-		return &TalentHttpResult{Code: -1, Msg: "Get address id error"}
+	// Assuming you get the address ID to set as default from the request
+	addressId := r.GetInt("address_id", 0)
+	if addressId == 0 {
+		return &TalentHttpResult{Code: -1, Msg: "Address ID is required"}
 	}
 
-	rec, err := g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).One("talent_id = ? and default_tag = 1", tid)
+	// Start a transaction to ensure atomicity
+	tx, err := g.DB().Begin()
 	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "found default delivery address error"}
+		return &TalentHttpResult{Code: -1, Msg: "Failed to begin transaction"}
 	}
+	defer tx.Rollback()
 
-	if rec == nil {
-		_, err = g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).Update("default_tag = 1", "address_id", aid)
-	} else {
-		err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
-			_, err1 := tx.Ctx(ctx).Model(dao.YoungeeTalentDeliveryAddress.Table).Update("default_tag = 0", "address_id", rec["address_id"])
-			if err1 != nil {
-				return err1
-			}
-
-			_, err1 = tx.Ctx(ctx).Model(dao.YoungeeTalentDeliveryAddress.Table).Update("default_tag = 1", "address_id", aid)
-			if err1 != nil {
-				return err1
-			}
-
-			return nil
-		})
-	}
+	// First, set all addresses to non-default (default_tag = 0)
+	_, err = tx.Model("youngee_talent_delivery_address").
+		Where("talent_id = ?", tid).
+		Update("default_tag", 0)
 	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "database error"}
+		return &TalentHttpResult{Code: -1, Msg: "Failed to reset default addresses"}
 	}
-	addressInfo := model.YoungeeTalentDeliveryAddress{}
-	err = g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).Where("address_id", aid).Scan(&addressInfo)
+
+	// Then, set the chosen address as default (default_tag = 1)
+	_, err = tx.Model("delivery_addresses").
+		Where("address_id = ? AND talent_id = ?", addressId, tid).
+		Update("default_tag", 1)
 	if err != nil {
-		return &TalentHttpResult{Code: -4, Msg: "address id error"}
+		return &TalentHttpResult{Code: -1, Msg: "Failed to set default address"}
 	}
 
-	_, err = g.DB().Model(dao.YoungeeTalentInfo.Table).
-		Update("talent_phone_number = ?", "id = ?", addressInfo.PhoneNumber, tid)
+	// Commit the transaction
+	err = tx.Commit()
 	if err != nil {
-		return &TalentHttpResult{Code: -4, Msg: "address id error"}
+		return &TalentHttpResult{Code: -1, Msg: "Failed to commit transaction"}
 	}
 
-	return &TalentHttpResult{Code: 0, Msg: "success"}
+	// Return success
+	return &TalentHttpResult{Code: 0, Msg: "Default address updated successfully"}
 }

+ 15 - 0
app/service/youngee_talent_service/talent_info.go

@@ -144,3 +144,18 @@ func GetMyInfoNum(r *ghttp.Request) *TalentHttpResult {
 
 	return &TalentHttpResult{Code: 0, Msg: "success", Data: talentInfoNum}
 }
+
+func AddTalentSkill(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+	skills := r.GetQueryString("skills", "")
+	openId := r.GetQueryString("open_id")
+
+	_, err = g.DB().Model("platform_kuaishou_user_info").Where("open_id=? and talent_id=?", openId, tid).Data(g.Map{"skill": skills}).Update()
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Update talent info failed"}
+	}
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: skills}
+}

+ 52 - 45
app/service/youngee_talent_service/talent_ks_auth.go

@@ -73,14 +73,12 @@ func GetQrcode(r *ghttp.Request) *TalentHttpResult {
 	// 构建包含 tid 的 urlstr
 	var urlstr string
 	typePlatform := r.GetInt("platform_id")
-	if typePlatform == 4 { //快手电商
-		urlstr = fmt.Sprintf("https://open.kuaishou.com/oauth2/connect?state=%s&app_id=ks651333097154138217&redirect_uri=https://younggee.com/kuaishouauth&scope=merchant_distribution,merchant_refund,merchant_item,merchant_order,user_info,merchant_servicemarket,merchant_user,merchant_logistics&response_type=code", tid)
-	} else if typePlatform == 8 { //快手平台
+	if typePlatform == 8 { //快手平台
 		urlstr = fmt.Sprintf("https://open.kuaishou.com/oauth2/connect?state=%s&app_id=ks671599294546520767&redirect_uri=https://younggee.com/kuaishouVideoVideo&scope=user_video_info,user_info&response_type=code", tid)
 	} else if typePlatform == 2 { //抖音平台
-		urlstr = fmt.Sprintf("https://open.kuaishou.com/oauth2/connect?state=%s&app_id=ks671599294546520767&redirect_uri=https://younggee.com/douyinauth&scope=user_info,data.external.user,video.list.bind&response_type=code", tid)
+		urlstr = fmt.Sprintf("https://open.douyin.com/platform/oauth/connect/?state=%s&client_key=awi77xl5kpl16hmi&response_type=code&scope=user_info,data.external.user,video.list.bind&redirect_uri=https://www.younggee.com/douyinauth", tid)
 	} else {
-		urlstr = "unknow"
+		return &TalentHttpResult{Code: -1, Msg: "platform_id值不合法"}
 	}
 	// 执行任务
 	//var buf []byte
@@ -115,7 +113,6 @@ func GetQrcode(r *ghttp.Request) *TalentHttpResult {
 }
 
 func GetKsEcomQrcode(r *ghttp.Request) *TalentHttpResult {
-	fmt.Println("GetKsEcomQrcode-----")
 	//达人id获取
 	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
 	fmt.Println("tid:", tid, "err:", err)
@@ -231,6 +228,8 @@ func HandleAfterRedirect(r *ghttp.Request) *TalentHttpResult {
 		}
 		//点击后授权成功
 		err = chromedp.Run(ctx, chromedp.Click(`#root > div > div > div > div > div.flex.f-jc-c.UcUNDIrRp1R3a9EnEbQE > div > div.f-1.f-fs-0.Zcms9k6vZGxKICWMIrdG > div.wNrvV7C_9L5FB2oxmyLe > button`))
+		fmt.Println("ok")
+
 	} else {
 		fmt.Println("已经被后端API捕捉。")
 		fmt.Println("currentURL-----:", currentURL)
@@ -322,12 +321,12 @@ func CheckDyNewAccount(r *ghttp.Request) *TalentHttpResult {
 func CheckKsNewAccount(r *ghttp.Request) *TalentHttpResult {
 	//check到了更新时间在两秒内的插入的数据。则说明已绑定。弹窗消失。
 	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	if err != nil {
-		return &TalentHttpResult{Code: -2, Msg: "Get talent id failed"}
-	}
 	redisKsBindStatusKey := fmt.Sprintf("KsBind:%s", tid)
 	bindStatus, err := g.Redis().DoVar("GET", redisKsBindStatusKey)
-	if bindStatus.String() == "bound_to_other" {
+	//if bindStatus == nil {
+	//
+	//}
+	if bindStatus != nil && bindStatus.String() == "bound_to_other" {
 		return &TalentHttpResult{Code: -1, Msg: "此快手账号已被其他达人绑定", Data: nil}
 	}
 	if err != nil {
@@ -348,6 +347,8 @@ func CheckKsNewAccount(r *ghttp.Request) *TalentHttpResult {
 	//当前达人没有绑定过账号
 	if len(userInfos) == 0 {
 		// 如果没有符合条件的数据,返回失败
+		// 如果没有符合条件的数据,返回继续轮询的提示
+		return &TalentHttpResult{Code: -5, Msg: "没有数据,继续轮询"}
 	}
 
 	// 找到 CreateTime 最新的记录
@@ -365,7 +366,7 @@ func CheckKsNewAccount(r *ghttp.Request) *TalentHttpResult {
 	}
 
 	// 超过时间差,返回失败
-	return &TalentHttpResult{Code: -6, Msg: "Time difference exceeds 3 seconds"}
+	return &TalentHttpResult{Code: -2, Msg: "数据还没进来,继续轮训"}
 }
 
 func CheckTokenExp(openId string, platformId int, talentId string) int {
@@ -486,7 +487,7 @@ func AddWindowKuaishouList(r *ghttp.Request) *TalentHttpResult {
 		openIdMap[record.OpenId] = append(openIdMap[record.OpenId], record)
 	}
 
-	// 筛选出 open_id 对应两条数据且 platform_id = 4 的记录
+	//筛选出 open_id 对应两条数据且 platform_id = 4 的记录
 	var resInfo []*youngee_talent_model.KuaishouUserInfo
 	for _, records := range openIdMap {
 		if len(records) == 2 { // 确保有两条数据,排除只有一个 platform_id 的情况
@@ -510,14 +511,15 @@ func AddWindowKuaishouList(r *ghttp.Request) *TalentHttpResult {
 
 func SignUpSecKuaishouList(r *ghttp.Request) *TalentHttpResult {
 	selectionId := r.GetString("selection_id")
-	// 定义用于存储查询结果的结构体切片
-	var results []*youngee_talent_model.KuaishouUserInfo
+	//领样条件
+	//todo
+	var recruitStrategies []*youngee_talent_model.FreeStrategy
+	err := g.DB().Model("free_strategy").Where("selection_id = ?", selectionId).Scan(&recruitStrategies)
 
-	// 获取talent_id
+	var results []*youngee_talent_model.KuaishouUserInfo
 	tid, _ := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-
 	// 查询此达人下,platform_id 为 8 或 4 的所有数据,并将结果扫描到结构体切片中
-	err := g.DB().Model(&youngee_talent_model.KuaishouUserInfo{}).
+	err = g.DB().Model(&youngee_talent_model.KuaishouUserInfo{}).
 		Where("talent_id = ?", tid).
 		Where("platform_id IN (?, ?)", 4, 8).
 		Order("open_id ASC, platform_id DESC"). // 按 open_id 排序,确保每组的数据连续,并且 platform_id=4 的数据排在前面
@@ -547,7 +549,7 @@ func SignUpSecKuaishouList(r *ghttp.Request) *TalentHttpResult {
 			}
 		}
 	}
-	// 遍历 resInfo 检查过期和是否报名
+	// 遍历 resInfo 检查过期、是否报名、是否满足领养条件
 	for _, record := range resInfo {
 		// 调用 CheckKuaishouTokenExp 函数,检查 openId 是否过期
 		expired := CheckKuaishouTokenExp(record.OpenId)
@@ -561,42 +563,36 @@ func SignUpSecKuaishouList(r *ghttp.Request) *TalentHttpResult {
 		} else {
 			record.IsSign = 1 // 查到数据,设置为 1
 		}
+		//fanNum := record.Fan
+		//saleNum30 := record.SaleNum30day
+		//todo
 
 	}
-	return &TalentHttpResult{Code: 0, Msg: "加入橱窗成功", Data: resInfo}
+	return &TalentHttpResult{Code: 0, Msg: "列表展示成功", Data: resInfo}
 }
 
 // 只有绑定两个快手,且快手电商没有过期,才能访问到这
 func AddWindowWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 	// 获取talent_id
 	tid, _ := utils.SessionTalentInfo.GetTalentIdFromSession(r)
-	pId := r.GetString("product_id")
-	openId := r.GetString("open_id")
-	selectionDetail := youngee_talent_model.SelectionDetail{}
-	err2 := g.DB().Model("younggee_selection_info").Where("selection_id=?", selectionDetail.SelectionId).Scan(&selectionDetail)
-	if err2 != nil {
-		fmt.Println("err--", err2.Error())
+
+	var signSecTaskReq *youngee_talent_model.SignSecTaskFromWindowReq
+	err := r.ParseForm(&signSecTaskReq)
+
+	if err != nil {
+		fmt.Println("err--", err.Error())
+		return &TalentHttpResult{Code: -1, Msg: "POST参数解析失败", Data: err.Error()}
 	}
-	value, err := g.DB().Model("platform_kuaishou_user_info").Fields("open_id").Where("talent_id=? AND open_id = ?", tid, openId).Value()
+
+	value, err := g.DB().Model("platform_kuaishou_user_info").Fields("access_token").Where("talent_id=? AND open_id = ?", tid, signSecTaskReq.OpenId).Value()
 	if err != nil {
 		fmt.Println("query db fail")
 	}
 	accessToken := value.String()
-	//通过pId获取kuaishou_product_id
-	pIdSlice := []string{pId}
-	//如果此tId。此openId下已有此product的task则不
-	//res_info, err := merchant.AddItemsToShelf(ClientKey, SignSecret, accessToken, pIdSlice)
+	pIdSlice := []string{signSecTaskReq.ProductId}
 	httpResult := youngee_sectask_service.IsCreateSecTask(r)
+
 	if httpResult.Code == 1 { //存在报名信息,仅添加橱窗
-		updateData := g.Map{
-			"enroll_num": selectionDetail.EnrollNum + 1, // enroll_num + 1
-		}
-		// 执行更新操作
-		_, err = g.DB().Model("younggee_selection_info").Where("selection_id=?", selectionDetail.SelectionId).Data(updateData).Update()
-		if err != nil {
-			// 错误处理
-			fmt.Println(err.Error())
-		}
 		_, err := merchant.AddItemsToShelf(ClientKey, SignSecret, accessToken, pIdSlice)
 		if err != nil {
 			//表示添加失敗,沒有開通
@@ -605,11 +601,10 @@ func AddWindowWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 		// 查询成功,返回成功结果和数据
 		return &TalentHttpResult{Code: 0, Msg: "无需创建任务,加入橱窗成功", Data: nil}
 	} else { //不存在报名信息
-
 		//创建并插入报名信息
 		code := youngee_sectask_service.SignUpSecTaskFromWindow(r).Code
 		if code != 0 {
-			fmt.Println("错误代码为----》", code)
+			return &TalentHttpResult{Code: -1, Msg: "创建报名信息失败", Data: nil}
 		}
 		//加入橱窗
 		_, err := merchant.AddItemsToShelf(ClientKey, SignSecret, accessToken, pIdSlice)
@@ -617,7 +612,15 @@ func AddWindowWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 			//表示添加失敗,沒有開通
 			return &TalentHttpResult{Code: -1, Msg: "快手未開通橱窗、商品不存在或已下线", Data: nil}
 		}
-		// 查询成功,返回成功结果和数据
+		//报名人数加一
+		_, err = g.DB().Model("younggee_selection_info").
+			Where("selection_id=?", signSecTaskReq.SelectionId).
+			Increment("enroll_num", 1)
+
+		if err != nil {
+			// 错误处理
+			fmt.Println(err.Error())
+		}
 		return &TalentHttpResult{Code: 0, Msg: "创建了任务,加入橱窗成功", Data: nil}
 	}
 
@@ -835,7 +838,7 @@ func GetKuaishouList(r *ghttp.Request) *TalentHttpResult {
 
 	// 查询 platformId 为 8 或 4 的所有数据
 	results, err := g.DB().Model(userInfo).Where("talent_id = ?", tid).
-		Where("platform_Id IN (?, ?)", 4, 8).
+		Where("platform_id IN (?, ?)", 4, 8).
 		Order("platform_Id DESC").
 		All()
 	if err != nil {
@@ -844,19 +847,20 @@ func GetKuaishouList(r *ghttp.Request) *TalentHttpResult {
 	}
 
 	// 检查查询结果是否为空
-	if results.IsEmpty() {
+	if len(results) == 0 {
 		return &TalentHttpResult{Code: -2, Msg: "此达人无快手账号绑定", Data: nil}
 	}
 
 	// 使用集合来存储唯一的 open_id,并计算不同的 open_id 的个数
 	openIDSet := make(map[string]struct{})
+	//key--openId  value--对应的信息
 	userInfoMap := make(map[string]*youngee_talent_model.KuaishouUserInfo)
 
 	for _, record := range results.List() {
 		openID := gconv.String(record["open_id"])
 		platformID := record["platform_id"] //int类型
 		status := 0                         //初始化
-		// 检查 userInfoMap 中是否已经存在 openID
+		//检查 userInfoMap 中是否已经存在 openID
 		//肯定会先处理8,所以遇到重复情况肯定是两个都授权了
 		_, exists := userInfoMap[openID]
 		if exists {
@@ -887,6 +891,9 @@ func GetKuaishouList(r *ghttp.Request) *TalentHttpResult {
 				OpenId:   openID,
 				HeadUri:  gconv.String(record["head_uri"]),
 				NickName: gconv.String(record["nick_name"]),
+				Skill:    gconv.String(record["skill"]),
+				Gender:   gconv.String(record["gender"]),
+
 				// 添加其他需要的字段
 				Fan: gconv.Int(record["fan"]),
 				//这两个值默认为0

+ 26 - 0
app/service/youngee_talent_service/wxlogin.go

@@ -212,3 +212,29 @@ func getPhoneNum(code string) string {
 func IsLogin(r *ghttp.Request) *TalentHttpResult {
 	return &TalentHttpResult{Code: 0, Msg: "success!"}
 }
+
+func AuthCurrentPhone(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+	l := AuthLoginReq{}
+	err = r.ParseForm(&l)
+	if err != nil {
+		r.Response.WriteJson("前端数据解析错误")
+	}
+	//通过手机号和验证码构造出key。
+	VcodeKey := fmt.Sprintf("%s%s", "c_user:", l.Phone)
+	//viewCount, err := g.Redis().DoVar("GET", projectViewKey)
+	Vcode, err := g.Redis().DoVar("GET", VcodeKey)
+
+	rec, err := g.DB().Model("youngee_talent_info").Where("id", tid).One("talent_phone_number", l.Phone)
+	//验证码正确
+	if Vcode.String() == l.Vcode && l.Phone == rec["talent_phone_number"].String() {
+		//根据电话号码,查询达人信息。达人与电话号码一一对应
+		return &TalentHttpResult{Code: 0, Msg: "验证成功!"}
+	} else { //验证码不正确
+		return &TalentHttpResult{Code: -1, Msg: "验证码错误"}
+	}
+
+}

+ 0 - 1
app/service/youngee_task_service/local_life_info.go

@@ -305,7 +305,6 @@ func GetLocalLifeDetail(r *ghttp.Request) *TalentHttpResult {
 	// 设计 Redis Key
 	redisBrowseKey := fmt.Sprintf("browseLocal:%s:%s", currentDate, tid)
 	fmt.Println("redis浏览记录的key为——————————", redisBrowseKey)
-	// 将 project_id 添加到 Redis 中的 SET
 	_, err = g.Redis().Do("SADD", redisBrowseKey, local_id)
 	if err != nil {
 		return &TalentHttpResult{Code: 0, Msg: "Redis 存浏览历史数据失败"}

+ 65 - 13
app/service/youngee_task_service/project_info.go

@@ -277,16 +277,8 @@ func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 	//通过首页进入的详情页,获取服务商id,younggee_supplier表
 	enterprise_id := r.GetQueryString("enterprise_id", "")
 	//通过扫服务商码进入的详情页,获取服务商id,younggee_supplier表
-	//supplier_id := r.GetQueryString("supplier_id", "")
-	s_project_id := r.GetQueryString("s_project_id", "")
-	projectInfoSupplier := youngee_talent_model.ProjectInfoSupplier{}
-	if s_project_id != "" {
-		// 来自服务商
-		err := g.DB().Model("younggee_s_project_info").Where("s_project_id=?", s_project_id).Scan(&projectInfoSupplier)
-		if err != nil {
-			fmt.Println("projectInfoSupplier err:", err.Error())
-		}
-	}
+	s_project_id := r.GetQueryInt("s_project_id", 0)
+
 	// Redis key
 	projectViewKey := "project:view:" + strconv.Itoa(pid)
 	userViewedKey := "user:viewed:" + tid + ":" + strconv.Itoa(pid)
@@ -342,8 +334,10 @@ func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 	// 设计 Redis Key
 	redisBrowseKey := fmt.Sprintf("browseProject:%s:%s", currentDate, tid)
 	fmt.Println("redis浏览记录的key为——————————", redisBrowseKey)
-	// 将 project_id 添加到 Redis 中的 SET
-	_, err = g.Redis().Do("SADD", redisBrowseKey, pid)
+	// 将 project_id:s_project_id  添加到 Redis 中的 SET 中,因为project_id可以对应多个s_project_id(被多个服务商接手)
+	// 组合 pid 和 s_project_id
+	browseItem := fmt.Sprintf("%s:%s", pid, s_project_id)
+	_, err = g.Redis().Do("SADD", redisBrowseKey, browseItem)
 	if err != nil {
 		return &TalentHttpResult{Code: 0, Msg: "Redis 存浏览历史数据失败"}
 	}
@@ -353,7 +347,21 @@ func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 		return &TalentHttpResult{Code: 0, Msg: "Redis 设置过期时间失败"}
 	}
 
-	if enterprise_id != "" { //project来自商家
+	// 来自服务商
+	if s_project_id != 0 {
+		projectInfoSupplier := youngee_talent_model.ProjectInfoSupplier{}
+		err := g.DB().Model("younggee_s_project_info").Where("s_project_id=?", s_project_id).Scan(&projectInfoSupplier)
+		if err != nil {
+			fmt.Println("projectInfoSupplier err:", err.Error())
+		}
+		var younggeeSupplier *youngee_talent_model.YounggeeSupplier
+		err = g.DB().Model("younggee_supplier").WithAll().Where("supplier_id", projectInfoSupplier.SupplierID).Scan(&younggeeSupplier)
+		if err != nil {
+			return &TalentHttpResult{Code: -3, Msg: err.Error()}
+		}
+		ProjectDetail.YounggeeSupplier = younggeeSupplier
+		ProjectDetail.ProjectInfoSupplier = &projectInfoSupplier
+	} else {
 		var enterprise *youngee_talent_model.Enterprise
 		err = g.DB().Model("enterprise").WithAll().Where("enterprise_id", enterprise_id).Scan(&enterprise)
 		if err != nil {
@@ -361,8 +369,45 @@ func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 		}
 		ProjectDetail.Enterprise = enterprise
 	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: ProjectDetail}
+}
+
+func GetProjectDetailFromBrowse(r *ghttp.Request) *TalentHttpResult {
+	//从redis的 key--》browseProject:currentDate:tid中获取对应的  project_id:s_project_id
+
+	pid := r.GetQueryInt("project_id", 0)
+	enterprise_id := r.GetQueryString("enterprise_id", "") //来自商家
+	s_project_id := r.GetQueryString("s_project_id", "")
+	projectInfoSupplier := youngee_talent_model.ProjectInfoSupplier{}
 	if s_project_id != "" {
 		// 来自服务商
+		err := g.DB().Model("younggee_s_project_info").Where("s_project_id=?", s_project_id).Scan(&projectInfoSupplier)
+		if err != nil {
+			fmt.Println("projectInfoSupplier err:", err.Error())
+		}
+	}
+
+	if pid == 0 {
+		return &TalentHttpResult{Code: -2, Msg: "parse param error"}
+	}
+
+	var ProjectDetail *youngee_talent_model.ProjectDetail
+	err := g.DB().Model("project_info").WithAll().Where("project_id", pid).Scan(&ProjectDetail)
+	if err != nil {
+		return &TalentHttpResult{Code: -3, Msg: err.Error()}
+	}
+	//违约
+	one, err := g.DB().Model("info_auto_default_handle").Where("auto_default_id=?", ProjectDetail.AutoDefaltId).One()
+	one2, err := g.DB().Model("info_auto_task").Where("auto_task_id=?", ProjectDetail.AutoTaskId).One()
+	ProjectDetail.DraftDefault.BreakPecent = one["sketch_replace_not_upload"].Int()
+	ProjectDetail.LinkDefault.BreakPecent = one["link_replace_not_upload"].Int()
+	ProjectDetail.DataDefault.BreakPecent = one["data_replace_not_upload"].Int()
+	ProjectDetail.DraftDefault.BreakTime = one2["draft_default"].Int()
+	ProjectDetail.DraftDefault.BreakTime = one2["link_breach"].Int()
+	ProjectDetail.DraftDefault.BreakTime = one2["case_close_default"].Int()
+
+	if s_project_id != "" { // 来自服务商
 		var younggeeSupplier *youngee_talent_model.YounggeeSupplier
 		err = g.DB().Model("younggee_supplier").WithAll().Where("supplier_id", projectInfoSupplier.SupplierID).Scan(&younggeeSupplier)
 		if err != nil {
@@ -370,6 +415,13 @@ func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 		}
 		ProjectDetail.YounggeeSupplier = younggeeSupplier
 		ProjectDetail.ProjectInfoSupplier = &projectInfoSupplier
+	} else { //project来自商家
+		var enterprise *youngee_talent_model.Enterprise
+		err = g.DB().Model("enterprise").WithAll().Where("enterprise_id", enterprise_id).Scan(&enterprise)
+		if err != nil {
+			return &TalentHttpResult{Code: -3, Msg: err.Error()}
+		}
+		ProjectDetail.Enterprise = enterprise
 	}
 
 	return &TalentHttpResult{Code: 0, Msg: "success", Data: ProjectDetail}

+ 8 - 10
app/service/youngee_task_service/task_book.go

@@ -1,13 +1,11 @@
 package youngee_task_service
 
-import "github.com/gogf/gf/net/ghttp"
-
 // 提交探店申请
-func AddTaskBook(r *ghttp.Request) *TalentHttpResult {
-
-}
-
-// 预约探店审核历史
-func GetTaskBook(r *ghttp.Request) *TalentHttpResult {
-
-}
+//func AddTaskBook(r *ghttp.Request) *TalentHttpResult {
+//
+//}
+
+//// 预约探店审核历史
+//func GetTaskBook(r *ghttp.Request) *TalentHttpResult {
+//
+//}

+ 11 - 0
app/service/youngee_task_service/task_income.go

@@ -96,6 +96,17 @@ func Withdraw(r *ghttp.Request) *TalentHttpResult {
 	if err != nil {
 		return &TalentHttpResult{Code: -2, Msg: err.Error()}
 	}
+	incomeIdStrList := strings.Split(DataInfoReq.IncomeIdList, ",") //to String 类型数组,
+	incomeIdList := utils.TypeTran.String2Int(incomeIdStrList)      //to int类型数组
+	// 检验是否均处于可提现状态,且达人id是否对应
+	var incomeList []model.YounggeeTalentIncome
+	err = g.Model(dao.YounggeeTalentIncome.Table).Where("talent_id = ? and withdraw_status = 1", tid).And("id IN (?)", incomeIdList).Scan(&incomeList)
+	if err != nil {
+		return &TalentHttpResult{Code: -4, Msg: err.Error()}
+	}
+	if len(incomeIdList) != len(incomeList) {
+		return &TalentHttpResult{Code: -3, Msg: "Req IncomeIdList Error"}
+	}
 
 	var talentBank model.YounggeeTalentBank
 	err = g.Model(dao.YounggeeTalentBank.Table).Where("talent_id = ?", tid).Scan(&talentBank)

+ 8 - 0
app/service/youngee_task_service/task_info.go

@@ -679,6 +679,7 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 				DraftFee:               signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的也是t_offer,
 				SettleAmount:           signTaskInfo.Offer,
 				SupplierStatus:         1,
+				WxNum:                  signTaskInfo.WxNum,
 			}
 
 		} else {
@@ -715,6 +716,7 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 				SettleStatus:           1,
 				DraftFee:               signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的也是t_offer,
 				SettleAmount:           signTaskInfo.Offer,
+				WxNum:                  signTaskInfo.WxNum,
 			}
 
 		}
@@ -747,6 +749,7 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 				ServiceRate:            0,                  //服务费率
 				SupportFee:             signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
 				DraftFee:               signTaskInfo.Offer, //稿费价格,一口价
+				WxNum:                  signTaskInfo.WxNum,
 			}
 
 		} else {
@@ -776,6 +779,7 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 			WithdrawStatus:         1,
 			SupportFee:             signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
 			DraftFee:               signTaskInfo.Offer, //稿费价格,一口价
+			WxNum:                  signTaskInfo.WxNum,
 		}
 
 	}
@@ -911,6 +915,7 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 				DraftFee:       signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的也是t_offer,
 				SettleAmount:   signTaskInfo.Offer,
 				SupplierStatus: 1,
+				WxNum:          signTaskInfo.WxNum,
 			}
 
 		} else {
@@ -946,6 +951,7 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 				SettleStatus:   1,
 				DraftFee:       signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的也是t_offer,
 				SettleAmount:   signTaskInfo.Offer,
+				WxNum:          signTaskInfo.WxNum,
 			}
 
 		}
@@ -977,6 +983,7 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 				ServiceRate:    0,                  //服务费率
 				SupportFee:     signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
 				DraftFee:       signTaskInfo.Offer, //稿费价格,一口价
+				WxNum:          signTaskInfo.WxNum,
 			}
 
 		} else {
@@ -1007,6 +1014,7 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 				ServiceRate:    0,                  //服务费率
 				SupportFee:     signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
 				DraftFee:       signTaskInfo.Offer, //稿费价格,一口价
+				WxNum:          signTaskInfo.WxNum,
 			}
 
 		}

BIN
bin/main


BIN
bin/v4.1.1/.DS_Store


BIN
bin/v4.1.1/linux_amd64/youngmini_server


BIN
bin/v4.1.1/windows_amd64/youngmini_server.exe


BIN
bin/v4.1.2/linux_amd64/youngmini_server


BIN
bin/v4.1.3/.DS_Store


BIN
bin/v4.1.3/linux_amd64/youngmini_server


BIN
bin/v4.1.3/windows_amd64/youngmini_server.exe


+ 2 - 2
config/config.toml

@@ -18,8 +18,8 @@ mod = "none"
 name = "youngmini_server"
 output = "./bin"
 pack = ""
-system = "linux,windows"
-version = "v3.7.6"
+system = "linux"
+version = "v4.1.3"
 [gfcli.gen.dao]
 jsonCase = "Snake"
 link = "mysql:root:Younggee_root_DB_123@tcp(1.92.142.62:3306)/youngmini"

+ 4 - 1
router/router.go

@@ -92,6 +92,7 @@ func init() {
 		})
 		//扫码之后---用于快手电商:nignx转发含code的请求到此处
 		s.BindHandler("/kuaishouauth", func(r *ghttp.Request) {
+
 			fmt.Println("****进入rounter中的/kuaishouauth*******")
 			ClientKey := "ks651333097154138217"
 			ClientSecret := "dBt0rVRhTpUqcrOYGGpv0A"
@@ -191,6 +192,8 @@ func init() {
 				HeadUri:      res_info.Data.Head,
 				NickName:     res_info.Data.Name,
 				Fan:          res_info.Data.Fan,
+				City:         res_info.Data.City,
+				Gender:       res_info.Data.Sex,
 				UpdateTime:   gtime.Now(),
 				CreateTime:   gtime.Now(),
 			}
@@ -275,7 +278,7 @@ func init() {
 				UpdateTime: gtime.Now(),
 				CreateTime: gtime.Now(),
 				City:       res_info.Data.City,
-				Sex:        res_info.Data.Sex,
+				Gender:     res_info.Data.Sex,
 			}
 			if _, err := g.DB().Model("platform_kuaishou_user_info").Save(authInfo); err != nil {
 				r.Response.WriteJson(g.Map{