|
@@ -210,6 +210,86 @@ func (t CooperationService) GetSupplierCount(param *vo.SupplierConfirmingParam)
|
|
|
return res
|
|
|
}
|
|
|
|
|
|
+// 达人合作数据
|
|
|
+func (t CooperationService) GetCoopTalentData(param *vo.TalentDataParam) vo.ReTalentCoopData {
|
|
|
+ var res vo.ReTalentCoopData
|
|
|
+ talent, err1 := dao.TalentInfoDao{}.GetTalentInfo(param.TalentId)
|
|
|
+ user, err2 := dao.PlatformKuaishouUserInfoDao{}.GetUserInfoById(param.PlatFormUserId)
|
|
|
+ if err1 != nil && err2 != nil {
|
|
|
+ return vo.ReTalentCoopData{}
|
|
|
+ }
|
|
|
+ talentDataPreview := &vo.TalentDataPreview{
|
|
|
+ TalentId: talent.ID,
|
|
|
+ AvatarUrl: user.HeadUri,
|
|
|
+ Sex: user.Gender,
|
|
|
+ TalentName: user.NickName,
|
|
|
+ WXAccount: talent.WxNum,
|
|
|
+ Phone: talent.TalentPhoneNumber,
|
|
|
+ Skill: user.Skill,
|
|
|
+ OpenId: user.OpenID,
|
|
|
+ }
|
|
|
+ res.TalentDataPreview = talentDataPreview
|
|
|
+ var applynum, executenum, endnum int64
|
|
|
+ executenum = dao.ProjectTaskInfoDao{}.CountExcuteNumByOpenid(user.OpenID)
|
|
|
+ applynum = dao.ProjectTaskInfoDao{}.CountAllByOpenid(user.OpenID)
|
|
|
+ endnum = dao.ProjectTaskInfoDao{}.CountByOpenid(user.OpenID, 15)
|
|
|
+
|
|
|
+ executenum += dao.SelectionTaskInfoDao{}.CountExcuteNumByOpenid(user.OpenID)
|
|
|
+ applynum += dao.SelectionTaskInfoDao{}.CountAllByOpenid(user.OpenID)
|
|
|
+ endnum += dao.SelectionTaskInfoDao{}.CountByOpenid(user.OpenID, 10)
|
|
|
+
|
|
|
+ executenum += dao.LocalLifeTaskInfoDao{}.CountExcuteNumByOpenid(user.OpenID)
|
|
|
+ applynum += dao.LocalLifeTaskInfoDao{}.CountAllByOpenid(user.OpenID)
|
|
|
+ endnum += dao.LocalLifeTaskInfoDao{}.CountByOpenid(user.OpenID, 15)
|
|
|
+
|
|
|
+ coopdata := &vo.TalentCoopData{
|
|
|
+ SignTaskNum: applynum,
|
|
|
+ SelectedTaskNum: endnum + executenum,
|
|
|
+ PerformTaskNum: executenum,
|
|
|
+ CompleteTaskNum: endnum,
|
|
|
+ }
|
|
|
+ res.TalentCoopData = coopdata
|
|
|
+ return res
|
|
|
+}
|
|
|
+
|
|
|
+// 达人数据
|
|
|
+func (t CooperationService) GetTalentData(param *vo.TalentDataParam) vo.ReTalentData {
|
|
|
+ var res vo.ReTalentData
|
|
|
+ talent, err1 := dao.TalentInfoDao{}.GetTalentInfo(param.TalentId)
|
|
|
+ user, err2 := dao.PlatformKuaishouUserInfoDao{}.GetUserInfoById(param.PlatFormUserId)
|
|
|
+ if err1 != nil && err2 != nil {
|
|
|
+ return vo.ReTalentData{}
|
|
|
+ }
|
|
|
+ talentDataPreview := &vo.TalentDataPreview{
|
|
|
+ TalentId: talent.ID,
|
|
|
+ AvatarUrl: user.HeadUri,
|
|
|
+ Sex: user.Gender,
|
|
|
+ TalentName: user.NickName,
|
|
|
+ WXAccount: talent.WxNum,
|
|
|
+ Phone: talent.TalentPhoneNumber,
|
|
|
+ Skill: user.Skill,
|
|
|
+ OpenId: user.OpenID,
|
|
|
+ }
|
|
|
+ res.TalentDataPreview = talentDataPreview
|
|
|
+ var avgLikeNum float64
|
|
|
+ if user.VideoNum != 0 {
|
|
|
+ avgLikeNum = float64(user.LikeNum) / float64(user.VideoNum)
|
|
|
+ } else {
|
|
|
+ avgLikeNum = 0
|
|
|
+ }
|
|
|
+ coreData := &vo.TalentCoreData{
|
|
|
+ FansNum: user.Fan,
|
|
|
+ AvgLikeNum: avgLikeNum,
|
|
|
+ AvgCollect: 0,
|
|
|
+ AvgComment: 0,
|
|
|
+ ThirtySaleNum: 0,
|
|
|
+ SixtySaleNum: 0,
|
|
|
+ NinetySaleNum: 0,
|
|
|
+ }
|
|
|
+ res.TalentCoreData = coreData
|
|
|
+ return res
|
|
|
+}
|
|
|
+
|
|
|
// 服务商管理-服务商数据卡
|
|
|
func (t CooperationService) GetSupplierData(param *vo.SupplierDataParam) vo.ReSupplierCoopData {
|
|
|
var reSupplierCoopData vo.ReSupplierCoopData
|
|
@@ -266,6 +346,117 @@ func (t CooperationService) GetSupplierData(param *vo.SupplierDataParam) vo.ReSu
|
|
|
return reSupplierCoopData
|
|
|
}
|
|
|
|
|
|
+// 达人管理-达人数据卡列表
|
|
|
+func (t CooperationService) GetTalentPerform(param *vo.TalentDataParam) (vo.ResultVO, error) {
|
|
|
+ if param.Page <= 0 {
|
|
|
+ param.Page = 1
|
|
|
+ }
|
|
|
+ if param.PageSize <= 0 {
|
|
|
+ param.PageSize = 10
|
|
|
+ }
|
|
|
+ var talentDataParams []*vo.TalentPerformance
|
|
|
+ var total int64
|
|
|
+ result := vo.ResultVO{
|
|
|
+ Page: param.Page,
|
|
|
+ PageSize: param.PageSize,
|
|
|
+ Total: total,
|
|
|
+ Data: talentDataParams,
|
|
|
+ }
|
|
|
+ //带货
|
|
|
+ if param.TaskType == 1 {
|
|
|
+ sectasks, total1, err1 := dao.SelectionTaskInfoDao{}.GetSecInfoByOpenId(param.TalentId, param.Others, param.SortField, param.SortOrder, param.Page, param.PageSize, param.RelType, param.EnterpriseId)
|
|
|
+ total = total1
|
|
|
+ if err1 != nil {
|
|
|
+ return result, err1
|
|
|
+ }
|
|
|
+ for _, sectask := range sectasks {
|
|
|
+ var perform vo.TalentPerformance
|
|
|
+ secid := sectask.SelectionID
|
|
|
+ sec, err2 := dao.SelectionInfoDAO{}.GetSelectionInfoById(secid)
|
|
|
+ if err2 != nil {
|
|
|
+ return result, err2
|
|
|
+ }
|
|
|
+ var product entity.Product
|
|
|
+ var productMainPhoto entity.ProductPhoto
|
|
|
+ err11 := json.Unmarshal([]byte(sec.ProductSnap), &product)
|
|
|
+ err12 := json.Unmarshal([]byte(sec.ProductPhotoSnap), &productMainPhoto)
|
|
|
+ if err11 != nil || err12 != nil {
|
|
|
+ perform.MainImage = productMainPhoto.PhotoUrl
|
|
|
+ perform.ProductName = product.ProductName
|
|
|
+ perform.Price = product.ProductPrice
|
|
|
+ perform.Category = product.ProductCategory
|
|
|
+ perform.SalesNum = sectask.SaleActual
|
|
|
+ }
|
|
|
+ talentDataParams = append(talentDataParams, &perform)
|
|
|
+ }
|
|
|
+ } else if param.TaskType == 2 {
|
|
|
+ prjtasks, total2, err2 := dao.ProjectTaskInfoDao{}.GetProjectInfoByTalentId(param.TalentId, param.Others, param.SortField, param.SortOrder, param.Page, param.PageSize, param.RelType, param.EnterpriseId, param.Platform)
|
|
|
+ total = total2
|
|
|
+ if err2 != nil {
|
|
|
+ return result, err2
|
|
|
+ }
|
|
|
+ for _, sectask := range prjtasks {
|
|
|
+ var perform vo.TalentPerformance
|
|
|
+ secid := sectask.ProjectID
|
|
|
+ sec, err2 := dao.ProjectDAO{}.GetProjectById(secid)
|
|
|
+ if err2 != nil {
|
|
|
+ return result, err2
|
|
|
+ }
|
|
|
+ var product entity.Product
|
|
|
+ var productMainPhoto entity.ProductPhoto
|
|
|
+ err11 := json.Unmarshal([]byte(sec.ProductSnap), &product)
|
|
|
+ err12 := json.Unmarshal([]byte(sec.ProductPhotoSnap), &productMainPhoto)
|
|
|
+ if err11 != nil || err12 != nil {
|
|
|
+ perform.MainImage = productMainPhoto.PhotoUrl
|
|
|
+ perform.ProductName = product.ProductName
|
|
|
+ perform.Price = product.ProductPrice
|
|
|
+ perform.VoteCount = sectask.VoteAvg
|
|
|
+ perform.ViewCount = sectask.ViewNum
|
|
|
+ perform.CollectCount = sectask.CollectNum
|
|
|
+ perform.CommentCount = sectask.CommitAvg
|
|
|
+
|
|
|
+ }
|
|
|
+ talentDataParams = append(talentDataParams, &perform)
|
|
|
+ }
|
|
|
+ } else if param.TaskType == 3 {
|
|
|
+ prjtasks, total3, err3 := dao.LocalLifeTaskInfoDao{}.GetLocalLifeInfoByTalentId(param.TalentId, param.Others, param.SortField, param.SortOrder, param.Page, param.PageSize, param.RelType, param.EnterpriseId, param.Platform)
|
|
|
+ total = total3
|
|
|
+ if err3 != nil {
|
|
|
+ return result, err3
|
|
|
+ }
|
|
|
+ for _, sectask := range prjtasks {
|
|
|
+ var perform vo.TalentPerformance
|
|
|
+ secid := sectask.LocalID
|
|
|
+ sec, err2 := dao.ProjectDAO{}.GetProjectById(secid)
|
|
|
+ if err2 != nil {
|
|
|
+ return result, err2
|
|
|
+ }
|
|
|
+ var product entity.Product
|
|
|
+ var productMainPhoto entity.ProductPhoto
|
|
|
+ err11 := json.Unmarshal([]byte(sec.ProductSnap), &product)
|
|
|
+ err12 := json.Unmarshal([]byte(sec.ProductPhotoSnap), &productMainPhoto)
|
|
|
+ if err11 != nil || err12 != nil {
|
|
|
+ perform.MainImage = productMainPhoto.PhotoUrl
|
|
|
+ perform.ProductName = product.ProductName
|
|
|
+ perform.Price = product.ProductPrice
|
|
|
+ perform.VoteCount = int(sectask.VoteAvg)
|
|
|
+ perform.ViewCount = 0
|
|
|
+ perform.CollectCount = sectask.CollectNum
|
|
|
+ perform.CommentCount = int(sectask.CommitAvg)
|
|
|
+
|
|
|
+ }
|
|
|
+ talentDataParams = append(talentDataParams, &perform)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result = vo.ResultVO{
|
|
|
+ Page: param.Page,
|
|
|
+ PageSize: param.PageSize,
|
|
|
+ Total: total,
|
|
|
+ Data: talentDataParams,
|
|
|
+ }
|
|
|
+ return result, nil
|
|
|
+}
|
|
|
+
|
|
|
// 服务商管理-服务商数据卡列表
|
|
|
func (t CooperationService) GetSupplierPerform(param *vo.SupplierDataParam) (vo.ResultVO, error) {
|
|
|
if param.Page <= 0 {
|