123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584 |
- package youngee_task_service
- import (
- "fmt"
- "github.com/gogf/gf/frame/g"
- "github.com/gogf/gf/net/ghttp"
- "github.com/gogf/gf/os/glog"
- "github.com/gogf/gf/os/gtime"
- "github.com/gogf/gf/util/gconv"
- "math"
- "reflect"
- "sort"
- "strconv"
- "youngmini_server/app/dao"
- "youngmini_server/app/model"
- "youngmini_server/app/model/youngee_talent_model"
- "youngmini_server/app/utils"
- )
- func GetLocalLifeList(r *ghttp.Request) *TalentHttpResult {
- pageIndex := r.GetQueryInt("idx", -1)
- cntPerPage := r.GetQueryInt("cnt", -1)
- //组合筛选
- platform := r.Get("platform", nil) //抖音、快手、红Book、B站、微博
- //taskForm := r.Get("task_form", nil) //任务形式,1-2分别代表线下探店,素材分发
- contentType := r.Get("contenttype", nil) //图文形式、视频形式
- createTime := r.Get("createTime", nil) //任务上线时间
- //categoryForm := r.Get("categoryform", "") ////商品类目 智能家居、食品饮料等20种
- //todo 城市参数?
- //Location := r.GetQueryString("city", "") //门店store所属城市,
- //排根据浏览量排序
- viewOrder := r.GetQueryInt("pageViewOrder", -1) //根据哪个字段排序
- //仅稿费”+“稿费+赠品"。这个在recruit表中,得到列表之后进行排序
- feeForm := r.GetInt("feeform", 0)
- searchValue := r.Get("searchvalue")
- if pageIndex == -1 || cntPerPage == -1 || cntPerPage == 0 {
- return &TalentHttpResult{Code: -1, Msg: "参数错误"}
- }
- // 如果有任务形式的过滤条件,则将过滤条件保存于taskModeList
- //var taskFormList []interface{}
- //taskFormList = nil
- //if taskForm != nil {
- //
- // if reflect.TypeOf(taskForm).Kind() != reflect.Slice {
- // return &TalentHttpResult{Code: -2, Msg: "搜索条件任务形式错误"}
- // }
- //
- // taskFormList = make([]interface{}, 0)
- // taskFormList = taskForm.([]interface{})
- //} else {
- // taskFormList = make([]interface{}, 0)
- //}
- // 如果有平台的过滤条件,则将平台列表保存于platformList
- var platformList []interface{}
- if platform != nil {
- if reflect.TypeOf(platform).Kind() != reflect.Slice {
- return &TalentHttpResult{Code: -2, Msg: "搜索条件平台类型错误"}
- }
- platformList = make([]interface{}, 0)
- platformList = platform.([]interface{})
- }
- // 如果有内容形式的过滤条件,则将过滤条件保存于taskModeList
- var contentTypeList []interface{}
- if contentType != nil {
- if reflect.TypeOf(contentType).Kind() != reflect.Slice {
- return &TalentHttpResult{Code: -2, Msg: "搜索条件任务形式错误"}
- }
- contentTypeList = make([]interface{}, 0)
- contentTypeList = contentType.([]interface{})
- }
- // 上线时间
- var createTimeList []interface{}
- if createTime != nil {
- if reflect.TypeOf(createTime).Kind() != reflect.Slice {
- return &TalentHttpResult{Code: -2, Msg: "搜索条件任务形式错误"}
- }
- createTimeList = make([]interface{}, 0)
- createTimeList = createTime.([]interface{})
- }
- // 如果有商品类目的过滤条件,则将过滤条件保存于categoryFormList
- //var categoryFormList []interface{}
- //if categoryForm != nil {
- // if reflect.TypeOf(categoryForm).Kind() != reflect.Slice {
- // return &TalentHttpResult{Code: -2, Msg: "搜索条件任务形式错误"}
- // }
- //
- // categoryFormList = make([]interface{}, 0)
- // categoryFormList = categoryForm.([]interface{})
- //}
- //if len(categoryFormList) > 0 {
- // // 使用 categoryFormList 进行某些操作
- // fmt.Println("Filtered categoryFormList:", categoryFormList)
- //}
- // 构造查询的条件
- startId := pageIndex * cntPerPage
- // whereStr := fmt.Sprintf("(project_status >= %d and project_status <> %d and project_type = 1)", projectStatusRecruiting, projectStatusInvalid)
- whereStr := fmt.Sprintf("(task_status >= %d and local_type = 1)", projectStatusRecruiting)
- if platformList != nil {
- whereStr = whereStr + " and local_platform in ("
- for _, v := range platformList {
- whereStr += v.(string) + ", "
- }
- whereStr = whereStr[0 : len(whereStr)-2]
- whereStr += ")"
- }
- if contentTypeList != nil {
- whereStr = whereStr + " and content_type in ("
- for _, v := range contentTypeList {
- whereStr += v.(string) + ", "
- }
- whereStr = whereStr[0 : len(whereStr)-2]
- whereStr += ")"
- }
- // 处理 selectionFormList (创建时间的过滤条件)
- if createTimeList != nil {
- whereStr += " AND created_at >= (NOW() - INTERVAL "
- for _, v := range createTimeList {
- switch v.(string) {
- case "1": // 近7天
- whereStr += "7 DAY"
- case "2": // 近30天
- whereStr += "30 DAY"
- case "3": // 近90天
- whereStr += "90 DAY"
- default:
- continue // 无效的过滤条件,跳过
- }
- }
- whereStr += ")"
- }
- //if taskFormList != nil {
- // fmt.Println("????")
- // whereStr += " and task_form in ("
- // for _, v := range taskFormList {
- // whereStr += v.(string) + ", "
- // }
- //
- // whereStr = whereStr[0 : len(whereStr)-2]
- // whereStr += ")"
- //}
- if searchValue != nil {
- whereStr += " and local_name like '%" + searchValue.(string) + "%'"
- }
- fmt.Println("whereStr:-----》 ", whereStr)
- // 查询所有project
- var localList = []youngee_talent_model.YounggeeLocalLifeInfo{}
- err := g.Model("younggee_local_life_info").Where(whereStr).Scan(&localList)
- if err != nil {
- return &TalentHttpResult{Code: -3, Msg: "查询数据库失败"}
- }
- // 判断请求页面是否超过最大页面
- c, err := g.DB().Model("younggee_local_life_info").Fields("local_id").Where(whereStr).Count()
- if c <= 0 {
- return &TalentHttpResult{Code: -4, Msg: "has no fullproject", Data: nil}
- }
- maxPage := c / cntPerPage
- if c%cntPerPage > 0 {
- maxPage += 1
- }
- if pageIndex+1 > maxPage {
- return &TalentHttpResult{Code: -5, Msg: "over max page"}
- }
- var localInfoList = youngee_talent_model.LocalInfoList{}
- err = g.DB().Model("younggee_local_life_info").WithAll().Where(whereStr).
- Order("task_status ASC,recruit_ddl DESC").Limit(startId, cntPerPage).Scan(&localInfoList.LocalInfos)
- if err != nil {
- return &TalentHttpResult{Code: -6, Msg: err.Error()}
- }
- // 遍历projectList
- for i, local := range localInfoList.LocalInfos {
- //处理浏览量
- localViewKey := "local:view:" + gconv.String(local.LocalId)
- //redis中取浏览量 返回的是gvar.Var类型。 不存咋则为nil。经过viewCount.Int变成0
- viewCount, err := g.Redis().DoVar("GET", localViewKey)
- if err != nil {
- glog.Error(err)
- return &TalentHttpResult{Code: 0, Msg: "Redis error"}
- }
- localInfoList.LocalInfos[i].WatchNum = viewCount.Int()
- // 根据 WatchedNum 从高到低排序
- if viewOrder != -1 {
- sort.Slice(localInfoList.LocalInfos, func(i, j int) bool {
- return localInfoList.LocalInfos[i].WatchNum > localInfoList.LocalInfos[j].WatchNum
- })
- }
- // 统计 RecruitStrategys 数组中的最低粉丝量和最高粉丝量
- var minFollowers, maxFollowers int
- // 初始值可以设为极大/极小值
- minFollowers = math.MaxInt32
- maxFollowers = math.MinInt32
- // 遍历 RecruitStrategys,找出最低粉丝量和最高粉丝量
- for _, strategy := range local.RecruitStrategys {
- if strategy.FollowersLow < minFollowers {
- minFollowers = strategy.FollowersLow
- }
- if strategy.FollowersUp > maxFollowers {
- maxFollowers = strategy.FollowersUp
- }
- }
- // 如果需要,可以将这些值保存到 ProjectInfo 中,供后续使用
- localInfoList.LocalInfos[i].MinFollowers = minFollowers
- localInfoList.LocalInfos[i].MaxFollowers = maxFollowers
- //稿费的展示情况
- allFeeFormNoFee := true // 假设都是无费置换
- var hasSelfPrice bool
- var minOffer, maxOffer int
- for _, strategy := range local.RecruitStrategys {
- if strategy.FeeForm != 1 { // 如果存在非无费置换的策略
- allFeeFormNoFee = false
- }
- if strategy.FeeForm == 3 { // 存在自报价
- hasSelfPrice = true
- }
- if strategy.FeeForm == 2 { // 一口价策略
- if strategy.TOffer < minOffer || minOffer == 0 {
- minOffer = strategy.TOffer
- }
- if strategy.TOffer > maxOffer {
- maxOffer = strategy.TOffer
- }
- }
- }
- // 根据判断结果设置 IsShowOffer 和 HaveSelfPrice
- if allFeeFormNoFee {
- local.IsShowOffer = 2 // 不展示稿费
- } else {
- local.IsShowOffer = 1 // 展示稿费
- if hasSelfPrice {
- local.HaveSelfOffer = 1 //存在自报价
- } else {
- local.HaveSelfOffer = 2 //不存在自报价
- }
- localInfoList.LocalInfos[i].MaxOffer = maxOffer
- localInfoList.LocalInfos[i].MinOffer = minOffer
- }
- }
- localInfoList.MaxPage = maxPage
- var filteredLocalInfo []*youngee_talent_model.YounggeeLocalLifeInfo
- //筛选出“仅稿费”+“稿费+赠品”任务,
- //只要策略中有 无费置换 之外的fee_form就是有稿费,donate=1就是有赠品
- if feeForm != 0 {
- for _, local := range localInfoList.LocalInfos {
- if local.Donate == 1 {
- filteredLocalInfo = append(filteredLocalInfo, local)
- continue // 如果满足条件1,直接跳过后续条件判断
- }
- // 条件2:RecruitStrategy 中存在 fee_form 不等于 1 的数据
- for _, strategy := range local.RecruitStrategys {
- if strategy.FeeForm != 1 {
- filteredLocalInfo = append(filteredLocalInfo, local)
- break // 找到符合条件的策略,跳出当前循环,避免重复添加
- }
- }
- }
- localInfoList.LocalInfos = filteredLocalInfo
- }
- return &TalentHttpResult{Code: 0, Msg: "success", Data: localInfoList}
- }
- func GetLocalLifeDetail(r *ghttp.Request) *TalentHttpResult {
- tid, _ := utils.SessionTalentInfo.GetTalentIdFromSession(r)
- local_id := r.GetQueryString("id", "")
- //通过首页进入的详情页,获取服务商id,younggee_supplier表
- enterprise_id := r.GetQueryString("enterprise_id", "")
- //通过扫服务商码进入的详情页,获取服务商id,younggee_supplier表
- //supplier_id := r.GetQueryString("supplier_id", "")
- s_local_id := r.GetQueryString("s_local_id", "")
- localInfoSupplier := youngee_talent_model.LocalInfoSupplier{}
- if s_local_id != "" {
- // 来自服务商
- err := g.DB().Model("younggee_s_local__info").Where("s_local_id=?", s_local_id).Scan(&localInfoSupplier)
- if err != nil {
- fmt.Println("projectInfoSupplier err:", err.Error())
- }
- }
- // Redis key
- loalViewKey := "local:view:" + local_id
- userViewedKey := "user:viewed:" + tid + ":" + local_id
- if local_id == "" {
- return &TalentHttpResult{Code: -2, Msg: "parse param error"}
- }
- //在redis中增加浏览量
- // Check if the user has already viewed the product
- //DoVar方便进行类型转化
- viewed, err := g.Redis().DoVar("GET", userViewedKey)
- if err != nil {
- glog.Error(err)
- return &TalentHttpResult{Code: 0, Msg: "Redis error"}
- }
- var LocalDetail *youngee_talent_model.LocalInfoDetail
- err = g.DB().Model("younggee_local_life_info").WithAll().Where("local_id", local_id).Scan(&LocalDetail)
- if err != nil {
- return &TalentHttpResult{Code: -3, Msg: err.Error()}
- }
- //var younggeeProductPhoto []*youngee_talent_model.YounggeeProductPhoto
- //err = g.DB().Model(youngee_talent_model.YounggeeProductPhoto{}).WithAll().Where("product_id", pid).Scan(&younggeeProductPhoto)
- //if err != nil {
- // return &TalentHttpResult{Code: -3, Msg: err.Error()}
- //}
- var younggeePhoto []*youngee_talent_model.YounggeeProductPhoto
- teamBuyingId := LocalDetail.TeamBuyingId
- if teamBuyingId != 0 {
- err := g.DB().Model("younggee_product_photo").Where("team_buying_id", teamBuyingId).Scan(&younggeePhoto)
- if err != nil {
- return &TalentHttpResult{Code: -3, Msg: err.Error()}
- }
- }
- StoreId := LocalDetail.StoreId
- if StoreId != 0 {
- err := g.DB().Model("younggee_product_photo").Where("store_id", StoreId).Scan(&younggeePhoto)
- if err != nil {
- return &TalentHttpResult{Code: -3, Msg: err.Error()}
- }
- fmt.Println("younggeePhoto", younggeePhoto)
- }
- fmt.Println("younggeePhoto", younggeePhoto)
- LocalDetail.YounggeeProductPhoto = younggeePhoto
- //违约
- //if LocalDetail.AutoTaskId != 0 && LocalDetail.AutoDefaultId != 0 {
- // one, _ := g.DB().Model("info_auto_default_handle").Where("auto_default_id=?", LocalDetail.AutoDefaultId).One()
- // one2, _ := g.DB().Model("info_auto_task").Where("auto_task_id=?", LocalDetail.AutoTaskId).One()
- // LocalDetail.DraftDefault.BreakPecent = one["sketch_replace_not_upload"].Int()
- // LocalDetail.LinkDefault.BreakPecent = one["link_replace_not_upload"].Int()
- // LocalDetail.DataDefault.BreakPecent = one["data_replace_not_upload"].Int()
- // LocalDetail.DraftDefault.BreakTime = one2["draft_default"].Int()
- // LocalDetail.DraftDefault.BreakTime = one2["link_breach"].Int()
- // LocalDetail.DraftDefault.BreakTime = one2["case_close_default"].Int()
- //}
- if viewed.IsNil() {
- // User hasn't viewed this product yet, increase the view count
- _, err = g.Redis().Do("INCR", loalViewKey)
- if err != nil {
- glog.Error(err)
- return &TalentHttpResult{Code: 0, Msg: "Redis error"}
- }
- // Mark the product as viewed by this user
- _, err = g.Redis().Do("SET", userViewedKey, true)
- if err != nil {
- glog.Error(err)
- return &TalentHttpResult{Code: 0, Msg: "Redis error"}
- }
- }
- viewNum, err := g.Redis().DoVar("GET", loalViewKey)
- if err != nil {
- fmt.Println("获取浏览量失败")
- }
- LocalDetail.WatchedNum = viewNum.Int()
- //浏览历史
- currentDate := gtime.Now().Format("Ymd")
- // 设计 Redis Key
- redisBrowseKey := fmt.Sprintf("browseLocal:%s:%s", currentDate, tid)
- fmt.Println("redis浏览记录的key为——————————", redisBrowseKey)
- _, err = g.Redis().Do("SADD", redisBrowseKey, local_id)
- if err != nil {
- return &TalentHttpResult{Code: 0, Msg: "Redis 存浏览历史数据失败"}
- }
- // 设置 Key 的过期时间为 7 天
- _, err = g.Redis().Do("EXPIRE", redisBrowseKey, 7*24*60*60) // 7 天的秒数
- if err != nil {
- return &TalentHttpResult{Code: 0, Msg: "Redis 设置过期时间失败"}
- }
- if enterprise_id != "" { //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()}
- }
- LocalDetail.Enterprise = enterprise
- }
- if s_local_id != "" {
- // 来自服务商
- var younggeeSupplier *youngee_talent_model.YounggeeSupplier
- err = g.DB().Model("younggee_supplier").WithAll().Where("supplier_id", localInfoSupplier.SupplierID).Scan(&younggeeSupplier)
- if err != nil {
- return &TalentHttpResult{Code: -3, Msg: err.Error()}
- }
- LocalDetail.YounggeeSupplier = younggeeSupplier
- LocalDetail.LocalInfoSupplier = &localInfoSupplier
- }
- return &TalentHttpResult{Code: 0, Msg: "success", Data: LocalDetail}
- }
- // 查询所有任务
- func GetLocalTaskBriefList(r *ghttp.Request) *TalentHttpResult {
- tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
- if err != nil {
- return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
- }
- // 构造查询条件
- whereStr := fmt.Sprintf("talent_id = '%s'", tid)
- // 获取任务列表
- var taskList []*youngee_talent_model.YoungeeLocalTaskInfo
- //此达人下,所有快手账号的任务都展示
- err = g.Model("youngee_local_task_info").Where(whereStr).Scan(&taskList)
- if err != nil {
- return &TalentHttpResult{Code: -1, Msg: "Get task list failed"}
- }
- //后续根据 PlatformId 快速查找平台信息。platformMap的key是PlatformId,value是平台具体描述
- platformMap := make(map[string]model.InfoThirdPlatform)
- platformInfo := []*model.InfoThirdPlatform{}
- if len(taskList) != 0 {
- err := g.Model(dao.InfoThirdPlatform.Table).Scan(&platformInfo)
- if err != nil {
- return &TalentHttpResult{Code: -1, Msg: "Get platform failed"}
- }
- for i, _ := range platformInfo {
- platformMap[strconv.Itoa(platformInfo[i].PlatformId)] = *platformInfo[i]
- }
- }
- //为每个任务根据项目id查询项目名称和主图
- //taskBriefList存了各个阶段的tasklist
- taskBriefList := youngee_talent_model.LocalTaskInfoBriefList{}
- for _, v := range taskList { //taskList含所有任务
- //获取具体的招募策略,taskInfo中
- var localDetail *youngee_talent_model.LocalInfoDetail
- err := g.Model("younggee_local_life_info").WithAll().Where("local_id = ?", v.LocalId).Scan(&localDetail)
- if err != nil {
- return &TalentHttpResult{Code: -1, Msg: "Get fullproject info failed"}
- }
- var account *youngee_talent_model.KuaishouUserInfo
- fmt.Println("openid---->", v.OpenId)
- err = g.Model("platform_kuaishou_user_info").Where("platform_id = ? and talent_id = ? and open_id = ?", localDetail.LocalPlatform, tid, v.OpenId).Scan(&account)
- //拿快手平台验证是否过期
- //expired := youngee_talent_service.CheckKuaishouTokenExp(account.OpenId)
- //account.Expired = expired
- if err != nil {
- return &TalentHttpResult{Code: -1, Msg: "Get account info failed"}
- }
- //taskInfoBrief含需要展示在页面的内容,被加入各阶段List
- taskInfoBrief := &youngee_talent_model.LocalTaskInfoBrief{
- TaskId: v.TaskId,
- PlatformIconUrl: platformMap[strconv.Itoa(localDetail.PlatformInfo.PlatformId)].PlatformIcon,
- //PlatformName: platformMap[projectInfo[dao.ProjectInfo.Columns.ProjectPlatform].String()].PlatformName,
- //PlatformNickName: account[dao.YoungeePlatformAccountInfo.Columns.PlatformNickname].String(),
- ProjectName: localDetail.LocalName,
- //ProductPhotoSnap: localDetail.ProductPhotoSnap,
- TaskStatus: v.TaskStatus,
- TaskStage: v.TaskStage,
- LinkStatus: v.LinkStatus,
- DataStatus: v.DataStatus,
- //ScriptStatus: v.ScriptStatus,
- SketchStatus: v.SketchStatus,
- TaskReward: v.TaskReward,
- BreakRate: v.ScriptBreakRate + v.SketchBreakRate + v.LinkBreakRate + v.DataBreakRate,
- CurBreakAt: v.CurBreakAt,
- FeeForm: v.FeeForm,
- LocalDetail: localDetail,
- TaskInfo: v,
- AccountInfo: account, //含是否过期,粉丝数,作品数目
- }
- taskBriefList.AllTaskInfoList = append(taskBriefList.AllTaskInfoList, taskInfoBrief)
- if v.TaskStage <= 2 {
- taskBriefList.SignUpTaskInfoList = append(taskBriefList.SignUpTaskInfoList, taskInfoBrief)
- } else if v.TaskStage == 4 { //如果是线下探店
- taskBriefList.WaitBookList = append(taskBriefList.WaitBookList, taskInfoBrief)
- } else if v.TaskStage <= 14 && v.TaskStage >= 5 {
- taskBriefList.GoingOnTaskInfoList = append(taskBriefList.GoingOnTaskInfoList, taskInfoBrief)
- } else if v.TaskStage == 15 {
- taskBriefList.WaitToPayInfoList = append(taskBriefList.WaitToPayInfoList, taskInfoBrief)
- } else {
- taskBriefList.CompletedTaskInfoList = append(taskBriefList.CompletedTaskInfoList, taskInfoBrief)
- }
- }
- return &TalentHttpResult{Code: 0, Msg: "success", Data: taskBriefList}
- }
- func GetLocalTaskDetail(r *ghttp.Request) *TalentHttpResult {
- taskId := r.Get("task_id", "")
- if taskId == "" {
- return &TalentHttpResult{Code: -1, Msg: "task_id is empty"}
- }
- var task *youngee_talent_model.YoungeeLocalTaskInfo
- err := g.Model("youngee_local_task_info").Where("task_id = ?", taskId).Scan(&task)
- if err != nil {
- return &TalentHttpResult{Code: -1, Msg: "Get task info failed"}
- }
- var localDetail *youngee_talent_model.LocalInfoDetail
- err = g.Model(youngee_talent_model.LocalInfoDetail{}).WithAll().Where("local_id", task.LocalId).Scan(&localDetail)
- if err != nil {
- return &TalentHttpResult{Code: -3, Msg: "data query failed"}
- }
- var productPhoto *youngee_talent_model.YounggeeProductPhoto
- err = g.Model("younggee_product_photo").Where("store_id = ? and symbol = 1", localDetail.StoreId).Scan(&productPhoto)
- if err != nil {
- return &TalentHttpResult{Code: -3, Msg: "data query failed"}
- }
- var withdrawStatus = 1
- var taskIncome *model.YounggeeTalentIncome
- err = g.Model(dao.YounggeeTalentIncome.Table).Where("task_id = ? and income_type = 1", taskId).Scan(&taskIncome)
- if err != nil {
- return &TalentHttpResult{Code: -3, Msg: "Get task income detail failed."}
- }
- if taskIncome != nil {
- withdrawStatus = taskIncome.WithdrawStatus + 1
- }
- taskDetail := &youngee_talent_model.LocalTaskDetail{}
- if localDetail.LocalType == 1 {
- var strategy *youngee_talent_model.RecruitStrategy
- err = g.DB().Model("recruit_strategy").Where("project_id = ? and strategy_id = ?", task.LocalId, task.StrategyId).Scan(&strategy)
- if err != nil {
- return &TalentHttpResult{Code: -3, Msg: "data query failed"}
- }
- taskDetail = &youngee_talent_model.LocalTaskDetail{
- TaskInfo: task,
- LocalDetail: localDetail,
- ProductPhoto: productPhoto, //首页图片
- Strategy: strategy,
- WithdrawStatus: withdrawStatus,
- }
- } else {
- taskDetail = &youngee_talent_model.LocalTaskDetail{
- TaskInfo: task,
- LocalDetail: localDetail,
- ProductPhoto: productPhoto,
- WithdrawStatus: withdrawStatus,
- }
- }
- return &TalentHttpResult{Code: 0, Msg: "success", Data: taskDetail}
- }
|