yankun 5 tháng trước cách đây
mục cha
commit
5277d86c19

BIN
.DS_Store


+ 26 - 0
app/api/youngee_talent_api/talent_auth_get_api.go

@@ -265,6 +265,14 @@ func (*talentAuthGetApi) GetTaskBriefList(r *ghttp.Request) {
 	}
 }
 
+func (*talentAuthGetApi) GetLocalTaskBriefList(r *ghttp.Request) {
+	res := youngee_task_service.GetLocalTaskBriefList(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
 // 返回指定任务阶段的任务列表
 //func (*talentAuthGetApi) GetTaskExeList(r *ghttp.Request) {
 //	res := youngee_task_service.GetExeTaskBriefList(r)
@@ -301,6 +309,15 @@ func (*talentAuthGetApi) GetTaskDetail(r *ghttp.Request) {
 	}
 }
 
+func (*talentAuthGetApi) GetLocalTaskDetail(r *ghttp.Request) {
+	fmt.Println("获取种草任务详情")
+	res := youngee_task_service.GetLocalTaskDetail(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
 func (*talentAuthGetApi) GetTaskLogisticsInfo(r *ghttp.Request) {
 	res := youngee_task_service.GetTaskLogisticsInfo(r)
 	err := r.Response.WriteJson(res)
@@ -409,6 +426,15 @@ func (*talentAuthGetApi) GetTaskLink(r *ghttp.Request) {
 	}
 }
 
+// younggee_link_info
+func (*talentAuthGetApi) GetLocalTaskBook(r *ghttp.Request) {
+	res := youngee_task_service.GetLocalTaskBook(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
 // SubmitTaskLink 提交任务链接
 // younggee_link_info
 //func (*talentAuthGetApi) SubmitTaskLink(r *ghttp.Request) {

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

@@ -121,6 +121,22 @@ func (*talentAuthPostApi) AddTaskSketch(r *ghttp.Request) {
 	}
 }
 
+func (*talentAuthPostApi) AddLocalTaskBook(r *ghttp.Request) {
+	res := youngee_task_service.AddLocalTaskBook(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
+func (*talentAuthPostApi) AddLocalTaskPhoto(r *ghttp.Request) {
+	res := youngee_task_service.AddLocalTaskPhoto(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
+
 // AddTaskLink 添加链接
 // younggee_link_info
 func (*talentAuthPostApi) AddTaskLink(r *ghttp.Request) {
@@ -246,6 +262,7 @@ func (*talentAuthPostApi) SignUpTaskWithKsAccount(r *ghttp.Request) {
 	}
 }
 
+// 本地生活报名
 func (*talentAuthPostApi) SignUpLocalWithKsAccount(r *ghttp.Request) {
 	res := youngee_task_service.SignUpLocalWithKsAccount(r)
 	err := r.Response.WriteJson(res)

+ 2 - 0
app/model/youngee_talent_model/auth_model.go

@@ -47,6 +47,8 @@ type KuaishouUserInfo struct {
 	UseCode      int         `json:"use_code" ` //满足条件的账号可被选择
 	BindCode     int         `json:"bind_code"` //账号绑定情况
 	IsSign       int         `json:"is_sign"`   //是否报名该任务
+	City         string      `json:"city"`      //用户城市
+	Sex          string      `json:"sex"`       //用户性别
 }
 
 // 快手列表返回的结果

+ 3 - 2
app/model/youngee_talent_model/product_info.go

@@ -28,8 +28,9 @@ type YounggeeProduct struct {
 
 type YounggeeProductPhoto struct {
 	gmeta.Meta     `orm:"table:younggee_product_photo"`
-	ProductPhotoId int         `json:"product_photo_id"`                          // 商品图片id
-	PhotoUrl       string      `json:"photo_url"`                                 // 图片或视频url
+	ProductPhotoId int         `json:"product_photo_id"` // 商品图片id
+	PhotoUrl       string      `json:"photo_url"`        // 图片或视频url
+	StoreId        int         `json:"store_id"`
 	PhotoUid       string      `json:"photo_uid"`                                 //
 	Symbol         int         `json:"symbol"`                                    // 图片为主图或详情图标志位,1为主图,2为详情图,3为视频
 	ProductId      int         `json:"product_id"`                                // 所属商品id

+ 1 - 1
app/model/youngee_talent_model/task_income.go

@@ -26,7 +26,7 @@ type WithdrawTaskInfoList struct {
 }
 
 type WithdrawInfo struct {
-	IncomeIdList string  `json:"income_id_list"` // 收益记录id列表
+	IncomeIdList string  `json:"income_id_list"` // younggee_talent_income表中的主键
 	TotalAmount  float64 `json:"total_amount"`   // 提现金额
 }
 

+ 49 - 7
app/model/youngee_talent_model/task_info.go

@@ -34,10 +34,11 @@ import (
 //	}
 type YoungeeTaskInfo struct {
 	gmeta.Meta             `orm:"table:youngee_task_info"`
-	TaskId                 string         `json:"task_id"`                   // 任务ID
-	ProjectId              string         `json:"project_id"`                // 项目ID
-	TalentId               string         `json:"talent_id"`                 // 达人ID
-	AccountId              int            `json:"account_id"`                // 账号ID
+	TaskId                 string         `json:"task_id"`    // 任务ID
+	ProjectId              string         `json:"project_id"` // 项目ID
+	TalentId               string         `json:"talent_id"`  // 达人ID
+	AccountId              int            `json:"account_id"` // 账号ID
+	PlatformId             int            `json:"platform_id"`
 	OpenId                 string         `json:"open_id"`                   // 快手唯一标识
 	StrategyId             int            `json:"strategy_id"`               // 报名选择的招募策略ID
 	TalentPlatformInfoSnap string         `json:"talent_platform_info_snap"` // 达人平台信息快照
@@ -95,9 +96,10 @@ type YoungeeTaskInfo struct {
 
 type YoungeeLocalTaskInfo struct {
 	gmeta.Meta             `orm:"table:youngee_local_task_info"`
-	TaskId                 string         `json:"task_id"`                   // 任务ID
-	LocalId                string         `json:"local_id"`                  // 项目ID
-	TalentId               string         `json:"talent_id"`                 // 达人ID
+	TaskId                 string         `json:"task_id"`   // 任务ID
+	LocalId                string         `json:"local_id"`  // 项目ID
+	TalentId               string         `json:"talent_id"` // 达人ID
+	PlatformId             int            `json:"platform_id"`
 	AccountId              int            `json:"account_id"`                // 账号ID
 	OpenId                 string         `json:"open_id"`                   // 快手唯一标识
 	StrategyId             int            `json:"strategy_id"`               // 报名选择的招募策略ID
@@ -194,12 +196,44 @@ type TaskInfoBrief struct {
 	SignUpTime       *gtime.Time       `json:"sign_up_time"` //报名时间
 }
 
+type LocalTaskInfoBrief struct {
+	TaskId           string                `json:"task_id"`
+	PlatformIconUrl  string                `json:"platform_icon_url"`
+	PlatformName     string                `json:"platform_name"`
+	PlatformNickName string                `json:"platform_nick_name"`
+	ProjectName      string                `json:"project_name"`
+	ProductPhotoSnap string                `json:"product_photo_snap"`
+	TaskStatus       int                   `json:"task_status"`
+	TaskStage        int                   `json:"task_stage"`
+	ScriptStatus     int                   `json:"script_status"` // 脚本上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
+	SketchStatus     int                   `json:"sketch_status"` // 初稿上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
+	LinkStatus       int                   `json:"link_status"`   // 链接上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
+	DataStatus       int                   `json:"data_status"`   // 数据上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
+	TaskReward       float64               `json:"task_reward"`   // 达人报酬
+	BreakRate        int                   `json:"break_rate"`    // 违约扣款比例,百分之
+	CurBreakAt       *gtime.Time           `json:"cur_break_at"`  // 当前阶段截止时间
+	FeeForm          int                   `json:"fee_form"`      // 稿费形式,1,2,3分别代表产品置换、固定稿费、自报价
+	LocalDetail      *LocalInfoDetail      `json:"local_detail"`
+	AccountInfo      *KuaishouUserInfo     `json:"account_info"` //报名平台账号信息
+	TaskInfo         *YoungeeLocalTaskInfo `json:"task_info"`
+	SignUpTime       *gtime.Time           `json:"sign_up_time"` //报名时间
+}
+
 type TaskInfoBriefList struct {
 	AllTaskInfoList       []*TaskInfoBrief `json:"all_Task_info_list"`
 	SignUpTaskInfoList    []*TaskInfoBrief `json:"sign_up_Task_info_list"`
 	GoingOnTaskInfoList   []*TaskInfoBrief `json:"going_on_Task_info_list"`
 	CompletedTaskInfoList []*TaskInfoBrief `json:"completed_Task_info_list"`
 }
+
+type LocalTaskInfoBriefList struct {
+	AllTaskInfoList       []*LocalTaskInfoBrief `json:"all_Task_info_list"`
+	WaitBookList          []*LocalTaskInfoBrief `json:"book_Task_info_list"`
+	SignUpTaskInfoList    []*LocalTaskInfoBrief `json:"sign_up_Task_info_list"`
+	GoingOnTaskInfoList   []*LocalTaskInfoBrief `json:"going_on_Task_info_list"`
+	CompletedTaskInfoList []*LocalTaskInfoBrief `json:"completed_Task_info_list"`
+}
+
 type EXETaskInfoBriefList struct {
 	List1 []*TaskInfoBrief `json:"list1"`
 	List2 []*TaskInfoBrief `json:"list2"`
@@ -229,6 +263,14 @@ type TaskDetail struct {
 	WithdrawStatus int                         `json:"withdraw_status"`
 }
 
+type LocalTaskDetail struct {
+	TaskInfo       *YoungeeLocalTaskInfo `json:"task_info"`
+	LocalDetail    *LocalInfoDetail      `json:"local_detail"`
+	ProductPhoto   *YounggeeProductPhoto `json:"product_photo"`
+	Strategy       *RecruitStrategy      `json:"strategy"`
+	WithdrawStatus int                   `json:"withdraw_status"`
+}
+
 type IsSign struct {
 	IsSign   int                    `json:"is_sign"`
 	IsAgree  int                    `json:"is_agree"`

+ 86 - 45
app/model/youngee_talent_model/task_sketch.go

@@ -1,45 +1,86 @@
-package youngee_talent_model
-
-import (
-	"github.com/gogf/gf/os/gtime"
-	"github.com/gogf/gf/util/gmeta"
-)
-
-type AddTaskSketchRequest struct {
-	TaskId   string `orm:"task_id"           json:"task_id"` // 任务id
-	Title    string `orm:"title"             json:"title"`   // 标题
-	Type     int    `orm:"type"              json:"type"`    // 初稿形式,1为图片,2为视频
-	Content  string `orm:"content"           json:"content"` // 正文
-	PhotoUrl string `orm:"photo_url"  json:"photo_url"`      // 视频或图文的url列表
-}
-
-type TaskSketchInfo struct {
-	gmeta.Meta        `orm:"table:younggee_sketch_info"`
-	SketchId          int                    `orm:"sketch_id,primary" json:"sketch_id"`               // 初稿id
-	TaskId            string                 `orm:"task_id"           json:"task_id"`                 // 任务id
-	Title             string                 `orm:"title"             json:"title"`                   // 标题
-	Type              int                    `orm:"type"              json:"type"`                    // 初稿形式,1为图片,2为视频
-	Content           string                 `orm:"content"           json:"content"`                 // 正文
-	ReviseOpinion     string                 `orm:"revise_opinion"    json:"revise_opinion"`          // 反馈意见
-	IsSubmit          int                    `orm:"is_submit"         json:"is_submit"`               // 是否提交
-	IsReview          int                    `orm:"is_review"         json:"is_review"`               // 是否审核
-	IsOk              int                    `orm:"is_ok"             json:"is_ok"`                   // 是否合格
-	CreateAt          *gtime.Time            `orm:"create_at"            json:"create_at"`            // 创建时间
-	AgreeAt           *gtime.Time            `orm:"agree_at"             json:"agree_at"`             // 同意时间
-	RejectAt          *gtime.Time            `orm:"reject_at"            json:"reject_at"`            // 驳回时间
-	SubmitAt          *gtime.Time            `orm:"submit_at"            json:"submit_at"`            // 提交时间
-	AutoAgreeAt       *gtime.Time            `orm:"auto_agree_at"        json:"auto_agree_at"`        // 初稿自动审核时间
-	AutoLinkBreakAt   *gtime.Time            `orm:"auto_link_break_at"   json:"auto_link_break_at"`   // 链接违约自动处理时间
-	AutoSketchBreakAt *gtime.Time            `orm:"auto_sketch_break_at" json:"auto_sketch_break_at"` // 初稿违约自动处理时间
-	Photo             []*YounggeeSketchPhoto `orm:"with:sketch_id=sketch_id"`
-}
-
-type YounggeeSketchPhoto struct {
-	gmeta.Meta `orm:"table:younggee_sketch_photo"`
-	Id         int         `orm:"id,primary" json:"id"`        // 脚本id
-	SketchId   int         `orm:"sketch_id"  json:"sketch_id"` //
-	PhotoUrl   string      `orm:"photo_url"  json:"photo_url"` //
-	PhotoUid   string      `orm:"photo_uid"  json:"photo_uid"` //
-	Symbol     int         `orm:"symbol"     json:"symbol"`    // 1是图片,2是视频
-	CreateAt   *gtime.Time `orm:"create_at"  json:"create_at"` //
-}
+package youngee_talent_model
+
+import (
+	"github.com/gogf/gf/os/gtime"
+	"github.com/gogf/gf/util/gmeta"
+)
+
+type AddTaskSketchRequest struct {
+	TaskId   string `orm:"task_id"           json:"task_id"` // 任务id
+	Title    string `orm:"title"             json:"title"`   // 标题
+	Type     int    `orm:"type"              json:"type"`    // 初稿形式,1为图片,2为视频
+	Content  string `orm:"content"           json:"content"` // 正文
+	PhotoUrl string `orm:"photo_url"  json:"photo_url"`      // 视频或图文的url列表
+}
+
+type AddLocalTaskBookRequest struct {
+	TaskId string      `orm:"task_id"           json:"task_id"` // 任务id
+	Day    *gtime.Time `orm:"task_id"           json:"day"`     // 预计探店日期
+	Time   *gtime.Time `orm:"time"             json:"time"`     // 预计探店时间
+}
+
+type AddLocalTaskPhotoRequest struct {
+	TaskId   string `orm:"task_id"           json:"task_id"` // 任务id
+	PhotoUrl string `orm:"photo_url"  json:"photo_url"`      // 图文的url列表
+}
+
+type TaskSketchInfo struct {
+	gmeta.Meta        `orm:"table:younggee_sketch_info"`
+	SketchId          int                    `orm:"sketch_id,primary" json:"sketch_id"`               // 初稿id
+	TaskId            string                 `orm:"task_id"           json:"task_id"`                 // 任务id
+	Title             string                 `orm:"title"             json:"title"`                   // 标题
+	Type              int                    `orm:"type"              json:"type"`                    // 初稿形式,1为图片,2为视频
+	Content           string                 `orm:"content"           json:"content"`                 // 正文
+	ReviseOpinion     string                 `orm:"revise_opinion"    json:"revise_opinion"`          // 反馈意见
+	IsSubmit          int                    `orm:"is_submit"         json:"is_submit"`               // 是否提交
+	IsReview          int                    `orm:"is_review"         json:"is_review"`               // 是否审核
+	IsOk              int                    `orm:"is_ok"             json:"is_ok"`                   // 是否合格
+	CreateAt          *gtime.Time            `orm:"create_at"            json:"create_at"`            // 创建时间
+	AgreeAt           *gtime.Time            `orm:"agree_at"             json:"agree_at"`             // 同意时间
+	RejectAt          *gtime.Time            `orm:"reject_at"            json:"reject_at"`            // 驳回时间
+	SubmitAt          *gtime.Time            `orm:"submit_at"            json:"submit_at"`            // 提交时间
+	AutoAgreeAt       *gtime.Time            `orm:"auto_agree_at"        json:"auto_agree_at"`        // 初稿自动审核时间
+	AutoLinkBreakAt   *gtime.Time            `orm:"auto_link_break_at"   json:"auto_link_break_at"`   // 链接违约自动处理时间
+	AutoSketchBreakAt *gtime.Time            `orm:"auto_sketch_break_at" json:"auto_sketch_break_at"` // 初稿违约自动处理时间
+	Photo             []*YounggeeSketchPhoto `orm:"with:sketch_id=sketch_id"`
+}
+
+type LocalTaskBookInfo struct {
+	gmeta.Meta        `orm:"table:younggee_book_info"`
+	BookId            int                  `orm:"book_id,primary" json:"sketch_id"`                 // 初稿id
+	TaskId            string               `orm:"task_id"           json:"task_id"`                 // 任务id
+	Day               *gtime.Time          `orm:"day"             json:"day"`                       // 标题
+	Time              *gtime.Time          `orm:"time"             json:"time"`                     // 标题
+	ReviseOpinion     string               `orm:"revise_opinion"    json:"revise_opinion"`          // 反馈意见
+	IsSubmit          int                  `orm:"is_submit"         json:"is_submit"`               // 是否提交
+	IsReview          int                  `orm:"is_review"         json:"is_review"`               // 是否审核
+	IsOk              int                  `orm:"is_ok"             json:"is_ok"`                   // 是否合格
+	CreateAt          *gtime.Time          `orm:"create_at"            json:"create_at"`            // 创建时间
+	AgreeAt           *gtime.Time          `orm:"agree_at"             json:"agree_at"`             // 同意时间
+	RejectAt          *gtime.Time          `orm:"reject_at"            json:"reject_at"`            // 驳回时间
+	SubmitAt          *gtime.Time          `orm:"submit_at"            json:"submit_at"`            // 提交时间
+	AutoAgreeAt       *gtime.Time          `orm:"auto_agree_at"        json:"auto_agree_at"`        // 初稿自动审核时间
+	AutoLinkBreakAt   *gtime.Time          `orm:"auto_link_break_at"   json:"auto_link_break_at"`   // 链接违约自动处理时间
+	AutoSketchBreakAt *gtime.Time          `orm:"auto_sketch_break_at" json:"auto_sketch_break_at"` // 初稿违约自动处理时间
+	Photo             []*YounggeeBookPhoto `orm:"with:book_id=book_id"`
+}
+
+type YounggeeSketchPhoto struct {
+	gmeta.Meta `orm:"table:younggee_sketch_photo"`
+	Id         int         `orm:"id,primary" json:"id"`        // 脚本id
+	SketchId   int         `orm:"sketch_id"  json:"sketch_id"` //
+	PhotoUrl   string      `orm:"photo_url"  json:"photo_url"` //
+	PhotoUid   string      `orm:"photo_uid"  json:"photo_uid"` //
+	Symbol     int         `orm:"symbol"     json:"symbol"`    // 1是图片,2是视频
+	CreateAt   *gtime.Time `orm:"create_at"  json:"create_at"` //
+}
+
+type YounggeeBookPhoto struct {
+	gmeta.Meta `orm:"table:younggee_book_photo"`
+	Id         int         `orm:"id,primary" json:"id"`    //
+	BookId     int         `orm:"book_id"  json:"book_id"` //探店id
+	TaskId     string      `orm:"task_id"  json:"task_id"`
+	PhotoUrl   string      `orm:"photo_url"  json:"photo_url"` //
+	PhotoUid   string      `orm:"photo_uid"  json:"photo_uid"` //
+	CreateAt   *gtime.Time `orm:"create_at"  json:"create_at"` //
+}

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

@@ -11,7 +11,9 @@ import (
 	"sort"
 	"strconv"
 	"youngmini_server/app/dao"
+	"youngmini_server/app/model"
 	"youngmini_server/app/model/youngee_talent_model"
+	"youngmini_server/app/service/youngee_talent_service"
 	"youngmini_server/app/utils"
 )
 
@@ -335,3 +337,254 @@ func GetLocalLifeDetail(r *ghttp.Request) *TalentHttpResult {
 
 	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 {
+			taskBriefList.CompletedTaskInfoList = append(taskBriefList.CompletedTaskInfoList, taskInfoBrief)
+		}
+
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: taskBriefList}
+}
+
+func GetLocalTaskDetail(r *ghttp.Request) *TalentHttpResult {
+	taskId := r.GetQueryInt("task_id", -1)
+
+	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.ProjectDetail{}).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.Model(dao.RecruitStrategy.Table).Where("local_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}
+
+}
+
+func GetLocalTaskBook(r *ghttp.Request) *TalentHttpResult {
+	taskId := r.Get("task_id")
+	res, err := g.DB().Model("younggee_book_info").Where("is_review = 1 and task_id = ?", taskId).OrderDesc("create_at").All()
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: err.Error()}
+	}
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: res}
+}
+
+// 添加初稿service done
+func AddLocalTaskBook(r *ghttp.Request) *TalentHttpResult {
+	var bookInfoReq *youngee_talent_model.AddLocalTaskBookRequest
+	//解析添加初稿的图文
+	err := r.ParseForm(&bookInfoReq)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: err.Error()}
+	}
+
+	taskbookInfo := []youngee_talent_model.LocalTaskBookInfo{}
+
+	err = g.DB().Model("younggee_book_info").Where("task_id = ? ", bookInfoReq.TaskId).OrderDesc("create_at").Scan(&taskbookInfo)
+	if err != nil {
+		return &TalentHttpResult{Code: -2, Msg: "YounggeeSketchInfo find failed"}
+	}
+	//上传过但是被拒了
+	var condition1 bool = len(taskbookInfo) != 0 && taskbookInfo[0].IsReview == 1 && taskbookInfo[0].IsOk == 0
+	//没有上传过初稿
+	var condition2 bool = len(taskbookInfo) == 0
+
+	bookInfo := youngee_talent_model.LocalTaskBookInfo{
+		TaskId:   bookInfoReq.TaskId,
+		Day:      bookInfoReq.Day,
+		Time:     bookInfoReq.Time,
+		CreateAt: gtime.Now(),
+		IsReview: 0,
+		IsSubmit: 0, //忽略
+		IsOk:     0,
+	}
+	//只有这两种情况才能上传探店时间
+	if condition1 || condition2 {
+		//插入新数据
+		_, err := g.DB().Model("younggee_book_info").Data(bookInfo).InsertAndGetId()
+		if err != nil {
+			return &TalentHttpResult{Code: -3, Msg: "YounggeeSketchInfo insert failed"}
+		}
+
+	}
+
+	//修改task表中的字段待添加变成已添加,待修改变成已修改
+	bookStatus, err := g.DB().Model(model.YoungeeTaskInfo{}).Fields("book_status").Where("task_id = ?", bookInfoReq.TaskId).Value()
+	if err != nil {
+		return &TalentHttpResult{Code: -5, Msg: "Get task info failed"}
+	}
+	if bookStatus.Int64() == 1 {
+		_, err = g.Model(dao.YoungeeTaskInfo.Table).Where("task_id = ?", bookInfoReq.TaskId).Update(g.Map{"bookStatus": 2})
+		if err != nil {
+			return &TalentHttpResult{Code: -6, Msg: "YoungeeTaskInfo update failed"}
+		}
+	} else if bookStatus.Int64() == 3 {
+		_, err = g.Model(dao.YoungeeTaskInfo.Table).Where("task_id = ?", bookInfoReq.TaskId).Update(g.Map{"bookStatus": 4})
+		if err != nil {
+			return &TalentHttpResult{Code: -6, Msg: "YoungeeTaskInfo update failed"}
+		}
+	}
+
+	//task设置为预约确认中
+	_, err = g.DB().Model("youngee_local_task_info").Data(g.Map{"task_stage": "5"}).Where("task_id = ?", bookInfoReq.TaskId).Update()
+
+	return &TalentHttpResult{Code: 0, Msg: "success"}
+}
+
+func AddLocalTaskPhoto(r *ghttp.Request) *TalentHttpResult {
+	var bookInfoReq *youngee_talent_model.AddLocalTaskPhotoRequest
+	//解析添加初稿的图文
+	err := r.ParseForm(&bookInfoReq)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: err.Error()}
+	}
+
+	bookPhotoInfo := youngee_talent_model.YounggeeBookPhoto{
+		TaskId:   bookInfoReq.TaskId,
+		PhotoUrl: bookInfoReq.PhotoUrl,
+		CreateAt: gtime.Now(),
+	}
+
+	//修改task表中的字段待添加变成已添加,待修改变成已修改
+	_, err = g.DB().Model("younggee_book_photo").Data(&bookPhotoInfo).Insert()
+	if err != nil {
+		return &TalentHttpResult{Code: -5, Msg: "Get task info failed"}
+	}
+	_, err = g.DB().Model("youngee_local_task_info").Where("task_id = ?", bookInfoReq.TaskId).Data(g.Map{"task_stage": 9}).Update()
+	_, err = g.DB().Model("youngee_local_task_info").Where("task_id = ?", bookInfoReq.TaskId).Data(g.Map{"book_status": 5}).Update()
+	if err != nil {
+		return &TalentHttpResult{Code: -5, Msg: "Get task info failed"}
+	}
+
+	return &TalentHttpResult{Code: 0, Msg: "success"}
+}

+ 1 - 13
app/service/youngee_task_service/task_income.go

@@ -96,18 +96,6 @@ func Withdraw(r *ghttp.Request) *TalentHttpResult {
 	if err != nil {
 		return &TalentHttpResult{Code: -2, Msg: err.Error()}
 	}
-	incomeIdList := strings.Split(DataInfoReq.IncomeIdList, ",")
-	// taskIdListInt := utils.TypeTran.String2Int(taskIdListStr)
-
-	// 检验是否taskIdList中所有task均处于可提现状态,且talent_id是否正确
-	var incomeList []model.YounggeeTalentIncome
-	err = g.Model(dao.YounggeeTalentIncome.Table).Where("talent_id = ? and withdraw_status = 1", tid).And("task_id IN (?)", incomeIdList).Scan(&incomeList)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: "Get task list failed"}
-	}
-	if len(incomeIdList) != len(incomeList) {
-		return &TalentHttpResult{Code: -4, Msg: "Task TalentID Error"}
-	}
 
 	var talentBank model.YounggeeTalentBank
 	err = g.Model(dao.YounggeeTalentBank.Table).Where("talent_id = ?", tid).Scan(&talentBank)
@@ -146,7 +134,7 @@ func Withdraw(r *ghttp.Request) *TalentHttpResult {
 		}
 
 		// 更新income表中提现状态
-		_, err1 = tx.Ctx(ctx).Model(dao.YounggeeTalentIncome.Table).Where("task_id IN (?)", incomeIdList).Update(g.Map{"withdraw_status": 2, "withdraw_at": gtime.Now()})
+		_, err1 = tx.Ctx(ctx).Model(dao.YounggeeTalentIncome.Table).Where("id IN (?)", incomeIdList).Update(g.Map{"withdraw_status": 2, "withdraw_at": gtime.Now()})
 		if err1 != nil {
 			fmt.Printf("[Withdraw Transaction] Error:%+v\n", err1)
 			return err1

+ 50 - 72
app/service/youngee_task_service/task_info.go

@@ -684,7 +684,7 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 		} else {
 			//不经过服务商
 			var strategy *youngee_talent_model.RecruitStrategy
-			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and project_id= ?", signTaskInfo.StrategyId, signTaskInfo.ProjectId).Scan(&strategy)
+			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and s_project_id= ?", signTaskInfo.StrategyId, signTaskInfo.SProjectId).Scan(&strategy)
 			if err != nil {
 				return &TalentHttpResult{Code: -10, Msg: err.Error()}
 			}
@@ -860,13 +860,13 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 	if err != nil {
 		return &TalentHttpResult{Code: -9, Msg: "encode delivery address snap failed"}
 	}
-	taskInfo := youngee_talent_model.YoungeeTaskInfo{}
+	taskInfo := youngee_talent_model.YoungeeLocalTaskInfo{}
 	// 公开任务
 	if projectDetail.LocalType == 1 {
 		//经过服务商
 		if signTaskInfo.SLocalId != 0 {
 			var strategy *youngee_talent_model.RecruitStrategy
-			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and project_id= ?", signTaskInfo.StrategyId, signTaskInfo.LocalId).Scan(&strategy)
+			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and s_local_id= ?", signTaskInfo.StrategyId, signTaskInfo.SLocalId).Scan(&strategy)
 			var ServiceChargePrice = 0.0      //服务费
 			var SupporPricer = 0.0            //提报价
 			if signTaskInfo.StrategyId == 3 { //自报价
@@ -883,9 +883,9 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 			if err != nil {
 				return &TalentHttpResult{Code: -10, Msg: err.Error()}
 			}
-			taskInfo = youngee_talent_model.YoungeeTaskInfo{
+			taskInfo = youngee_talent_model.YoungeeLocalTaskInfo{
 				TaskId:                 newTaskId,
-				ProjectId:              signTaskInfo.LocalId,
+				PlatformId:             projectDetail.LocalPlatform,
 				SProjectId:             signTaskInfo.SLocalId,
 				TalentId:               tid,
 				OpenId:                 signTaskInfo.OpenID,
@@ -902,15 +902,15 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 				LogisticsStatus:        1,
 				LinkStatus:             1,
 				DataStatus:             1,
-				ScriptStatus:           1,
-				SketchStatus:           1,
-				CompleteStatus:         1,
-				CurDefaultType:         0,
-				WithdrawStatus:         1,
-				SettleStatus:           1,
-				DraftFee:               signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的也是t_offer,
-				SettleAmount:           signTaskInfo.Offer,
-				SupplierStatus:         1,
+				//ScriptStatus:           1,
+				SketchStatus:   1,
+				CompleteStatus: 1,
+				CurDefaultType: 0,
+				WithdrawStatus: 1,
+				SettleStatus:   1,
+				DraftFee:       signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的也是t_offer,
+				SettleAmount:   signTaskInfo.Offer,
+				SupplierStatus: 1,
 			}
 
 		} else {
@@ -920,9 +920,9 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 			if err != nil {
 				return &TalentHttpResult{Code: -10, Msg: err.Error()}
 			}
-			taskInfo = youngee_talent_model.YoungeeTaskInfo{
+			taskInfo = youngee_talent_model.YoungeeLocalTaskInfo{
 				TaskId:                 newTaskId,
-				ProjectId:              signTaskInfo.LocalId,
+				LocalId:                signTaskInfo.LocalId,
 				TalentId:               tid,
 				OpenId:                 signTaskInfo.OpenID,
 				TalentPlatformInfoSnap: string(accountSnap),
@@ -938,14 +938,14 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 				LogisticsStatus:        1,
 				LinkStatus:             1,
 				DataStatus:             1,
-				ScriptStatus:           1,
-				SketchStatus:           1,
-				CompleteStatus:         1,
-				CurDefaultType:         0,
-				WithdrawStatus:         1,
-				SettleStatus:           1,
-				DraftFee:               signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的也是t_offer,
-				SettleAmount:           signTaskInfo.Offer,
+				//ScriptStatus:           1,
+				SketchStatus:   1,
+				CompleteStatus: 1,
+				CurDefaultType: 0,
+				WithdrawStatus: 1,
+				SettleStatus:   1,
+				DraftFee:       signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的也是t_offer,
+				SettleAmount:   signTaskInfo.Offer,
 			}
 
 		}
@@ -954,10 +954,10 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 		if signTaskInfo.SLocalId != 0 {
 			//查找服务商定义的策略
 			var strategy *youngee_talent_model.RecruitStrategy
-			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and s_project_id= ?", signTaskInfo.StrategyId, signTaskInfo.SLocalId).Scan(&strategy)
-			taskInfo = youngee_talent_model.YoungeeTaskInfo{
+			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and s_local_id= ?", signTaskInfo.StrategyId, signTaskInfo.SLocalId).Scan(&strategy)
+			taskInfo = youngee_talent_model.YoungeeLocalTaskInfo{
 				TaskId:                 newTaskId,
-				ProjectId:              signTaskInfo.LocalId,
+				LocalId:                signTaskInfo.LocalId,
 				TalentId:               tid,
 				OpenId:                 signTaskInfo.OpenID,
 				TalentPlatformInfoSnap: string(accountSnap),
@@ -968,15 +968,15 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 				LogisticsStatus:        1,
 				LinkStatus:             1,
 				DataStatus:             1,
-				ScriptStatus:           1,
-				SketchStatus:           1,
-				CompleteStatus:         1,
-				CurDefaultType:         0,
-				WithdrawStatus:         1,
-				ServiceCharge:          0,                  //不经过服务商,无服务费
-				ServiceRate:            0,                  //服务费率
-				SupportFee:             signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
-				DraftFee:               signTaskInfo.Offer, //稿费价格,一口价
+				//ScriptStatus:           1,
+				SketchStatus:   1,
+				CompleteStatus: 1,
+				CurDefaultType: 0,
+				WithdrawStatus: 1,
+				ServiceCharge:  0,                  //不经过服务商,无服务费
+				ServiceRate:    0,                  //服务费率
+				SupportFee:     signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
+				DraftFee:       signTaskInfo.Offer, //稿费价格,一口价
 			}
 
 		} else {
@@ -984,9 +984,10 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 			//查找服务商定义的策略
 			var strategy *youngee_talent_model.RecruitStrategy
 			err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and s_project_id= ?", signTaskInfo.StrategyId, signTaskInfo.SLocalId).Scan(&strategy)
-			taskInfo = youngee_talent_model.YoungeeTaskInfo{
+			taskInfo = youngee_talent_model.YoungeeLocalTaskInfo{
 				TaskId:                 newTaskId,
-				ProjectId:              signTaskInfo.LocalId,
+				LocalId:                signTaskInfo.LocalId,
+				PlatformId:             projectDetail.LocalPlatform,
 				TalentId:               tid,
 				OpenId:                 signTaskInfo.OpenID,
 				TalentPlatformInfoSnap: string(accountSnap),
@@ -997,52 +998,29 @@ func SignUpLocalWithKsAccount(r *ghttp.Request) *TalentHttpResult {
 				LogisticsStatus:        1,
 				LinkStatus:             1,
 				DataStatus:             1,
-				ScriptStatus:           1,
-				SketchStatus:           1,
-				CompleteStatus:         1,
-				CurDefaultType:         0,
-				WithdrawStatus:         1,
-				ServiceCharge:          0,                  //不经过服务商,无服务费
-				ServiceRate:            0,                  //服务费率
-				SupportFee:             signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
-				DraftFee:               signTaskInfo.Offer, //稿费价格,一口价
+				//ScriptStatus:           1,
+				SketchStatus:   1,
+				CompleteStatus: 1,
+				CurDefaultType: 0,
+				WithdrawStatus: 1,
+				ServiceCharge:  0,                  //不经过服务商,无服务费
+				ServiceRate:    0,                  //服务费率
+				SupportFee:     signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
+				DraftFee:       signTaskInfo.Offer, //稿费价格,一口价
 			}
 
 		}
 
-		//定向任务,服务费在哪设置
-		taskInfo = youngee_talent_model.YoungeeTaskInfo{
-			TaskId:                 newTaskId,
-			ProjectId:              signTaskInfo.LocalId,
-			TalentId:               tid,
-			OpenId:                 signTaskInfo.OpenID,
-			TalentPlatformInfoSnap: string(accountSnap),
-			TalentPersonalInfoSnap: string(talentSnap),
-			TaskStage:              1,
-			CreateDate:             gtime.Now(),
-			TaskStatus:             1,
-			LogisticsStatus:        1,
-			LinkStatus:             1,
-			DataStatus:             1,
-			ScriptStatus:           1,
-			SketchStatus:           1,
-			CompleteStatus:         1,
-			CurDefaultType:         0,
-			WithdrawStatus:         1,
-			SupportFee:             signTaskInfo.Offer, //不经过服务商,  提报价格=一口价*(1+服务费率)
-			DraftFee:               signTaskInfo.Offer, //稿费价格,一口价
-		}
-
 	}
 	err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
 		// 在task_info表中插入任务
-		_, err = tx.Ctx(ctx).Model(dao.YoungeeTaskInfo.Table).Data(&taskInfo).Insert()
+		_, err = tx.Ctx(ctx).Model("youngee_local_task_info").Data(&taskInfo).Insert()
 		if err != nil {
 			return err
 		}
 
 		// 对应项目的报名人数自增
-		_, err = tx.Ctx(ctx).Model(dao.ProjectInfo.Table).Where(dao.ProjectInfo.Columns.ProjectId, projectDetail.LocalId).Increment(dao.ProjectInfo.Columns.ApplyNum, 1)
+		_, err = tx.Ctx(ctx).Model("younggee_local_life_info").Where("local_id=?", projectDetail.LocalId).Increment("apply_num", 1)
 		if err != nil {
 			return err
 		}

+ 7 - 4
router/router.go

@@ -269,10 +269,13 @@ func init() {
 				HeadUri:      res_info.Data.Head,
 				NickName:     res_info.Data.Name,
 				Fan:          res_info.Data.Fan,
-				LikeNum:      likeCount,              //点赞数
-				VideoNum:     videoCount.PublicCount, //作品数目
-				UpdateTime:   gtime.Now(),
-				CreateTime:   gtime.Now(),
+
+				LikeNum:    likeCount,              //点赞数
+				VideoNum:   videoCount.PublicCount, //作品数目
+				UpdateTime: gtime.Now(),
+				CreateTime: gtime.Now(),
+				City:       res_info.Data.City,
+				Sex:        res_info.Data.Sex,
 			}
 			if _, err := g.DB().Model("platform_kuaishou_user_info").Save(authInfo); err != nil {
 				r.Response.WriteJson(g.Map{