Browse Source

Merge branch 'feature_yf' of HolaBIP/youngee_mc_api into master

houyunfeng 2 years ago
parent
commit
b7dde719c1

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

@@ -101,6 +101,13 @@ func (*talentAuthGetApi) GetTaskExeList(r *ghttp.Request) {
 		panic("write response error")
 	}
 }
+func (*talentAuthGetApi) GetTaskExeNum(r *ghttp.Request) {
+	res := youngee_talent_service.GetExeTaskNum(r)
+	err := r.Response.WriteJson(res)
+	if err != nil {
+		panic("write response error")
+	}
+}
 
 func (*talentAuthGetApi) GetTaskNum(r *ghttp.Request) {
 	res := youngee_talent_service.GetTaskNum(r)

+ 10 - 2
app/model/youngee_talent_model/task_info.go

@@ -76,6 +76,13 @@ type TaskNum struct {
 	CompletedNum int `json:"completed_num"`
 }
 
+type ExeTaskNum struct {
+	ScriptNum int `json:"script_num"`
+	SketchNum int `json:"sketch_num"`
+	LinkNum   int `json:"link_num"`
+	DataNum   int `json:"data_num"`
+}
+
 type TaskDetail struct {
 	TaskInfo      *model.YoungeeTaskInfo      `json:"task_info"`
 	ProjectDetail *ProjectDetail              `json:"project_detail"`
@@ -84,6 +91,7 @@ type TaskDetail struct {
 }
 
 type IsSign struct {
-	IsSign  int `json:"is_sign"`
-	IsAgree int `json:"is_agree"`
+	IsSign   int                    `json:"is_sign"`
+	IsAgree  int                    `json:"is_agree"`
+	TaskInfo *model.YoungeeTaskInfo `json:"task_info"`
 }

+ 1 - 1
app/service/youngee_talent_service/task_data.go

@@ -142,7 +142,7 @@ func SubmitTaskData(r *ghttp.Request) *TalentHttpResult {
 func GetTaskData(r *ghttp.Request) *TalentHttpResult {
 	taskId := r.Get("task_id")
 
-	res, err := g.DB().Model(dao.YounggeeDataInfo.Table).Where("is_submit = 1 and task_id = ?", taskId).OrderAsc("submit_at").All()
+	res, err := g.DB().Model(dao.YounggeeDataInfo.Table).Where("is_submit = 1 and is_review = 1 and task_id = ?", taskId).OrderAsc("submit_at").All()
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: err.Error()}
 	}

+ 2 - 2
app/service/youngee_talent_service/task_income.go

@@ -27,7 +27,7 @@ func GetWithdrawTaskInfo(r *ghttp.Request) *TalentHttpResult {
 	withdrawTaskInfoList := youngee_talent_model.WithdrawTaskInfoList{}
 	// 获取可提现任务列表
 	var taskList []*model.YoungeeTaskInfo
-	err = g.Model(dao.YoungeeTaskInfo.Table).Where("talent_id = ?", tid).And("withdraw_status IN(?)", g.Slice{2, 3, 4}).Scan(&taskList)
+	err = g.Model(dao.YoungeeTaskInfo.Table).Where("talent_id = ? and project_type = 1", tid).And("withdraw_status IN(?)", g.Slice{2, 3, 4}).Scan(&taskList)
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: "Get task list failed"}
 	}
@@ -44,7 +44,7 @@ func GetWithdrawTaskInfo(r *ghttp.Request) *TalentHttpResult {
 		strategy := model.RecruitStrategy{}
 		err = g.Model(dao.RecruitStrategy.Table).Where("project_id = ? and strategy_id = ?", v.ProjectId, v.StrategyId).Scan(&strategy)
 		if err != nil {
-			return &TalentHttpResult{Code: -1, Msg: "Get platform failed"}
+			return &TalentHttpResult{Code: -1, Msg: "Get RecruitStrategy failed"}
 		}
 
 		taskInfoBrief := &youngee_talent_model.WithdrawTaskInfo{

+ 44 - 28
app/service/youngee_talent_service/task_info.go

@@ -85,8 +85,8 @@ func SignUpTask(r *ghttp.Request) *TalentHttpResult {
 
 		// 2. 根据稿费形式、平台、粉丝数获取服务费最高的定价策略
 		// 2.1 查询所有对应定价策略
-		whereStr1 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low <= %d and fans_up >= %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersLow, strategy.FollowersLow)
-		orStr1 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low <= %d and fans_up >= %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersUp, strategy.FollowersUp)
+		whereStr1 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low <= %d and fans_up > %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersLow, strategy.FollowersLow)
+		orStr1 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low < %d and fans_up >= %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersUp, strategy.FollowersUp)
 		orStr2 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low >= %d and fans_up <= %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersLow, strategy.FollowersUp)
 		orStr3 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low <= %d and fans_up >= %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersLow, strategy.FollowersUp)
 		var pricings []*model.InfoPricingStrategy
@@ -214,17 +214,20 @@ func SignUpTask(r *ghttp.Request) *TalentHttpResult {
 
 // 判断是否已报名任务
 func IsSignUpTask(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
 	projectId := r.GetQueryInt("project_id", -1)
-	accountId := r.GetQueryInt("account_id", -1)
 	fmt.Printf("%+v\n", projectId)
-	fmt.Printf("%+v\n", accountId)
 	task := []model.YoungeeTaskInfo{}
-	err := g.Model(dao.YoungeeTaskInfo.Table).Where("project_id = ? and account_id = ?", projectId, accountId).Scan(&task)
+	err = g.Model(dao.YoungeeTaskInfo.Table).Where("project_id = ? and talent_id = ?", projectId, tid).Scan(&task)
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: err.Error()}
 	}
 	isSign := youngee_talent_model.IsSign{}
 	if len(task) != 0 {
+		isSign.TaskInfo = &task[0]
 		isSign.IsSign = 1
 		isSign.IsAgree = task[0].TaskStatus
 	} else {
@@ -301,25 +304,25 @@ func GetExeTaskBriefList(r *ghttp.Request) *TalentHttpResult {
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
 	}
-	// var taskStageList = [5]int{0, 7, 9, 11, 13}
-	// taskStageKey := r.GetQueryInt("taskStage", 0)
-	// if taskStageKey == 0 {
-	// 	return &TalentHttpResult{Code: -2, Msg: "parse param error"}
-	// }
-	// taskStage := taskStageList[taskStageKey]
+	var taskStageList = [5]int{0, 7, 9, 11, 13}
+	taskStageKey := r.GetQueryInt("taskStage", 0)
+	if taskStageKey == 0 {
+		return &TalentHttpResult{Code: -2, Msg: "parse param error"}
+	}
+	taskStage := taskStageList[taskStageKey]
 
-	// // 获取任务列表
-	// var taskList []*model.YoungeeTaskInfo
-	// err = g.Model(dao.YoungeeTaskInfo.Table).Where("talent_id = ?", tid).And("task_stage = ?", taskStage).Scan(&taskList)
-	// if err != nil {
-	// 	return &TalentHttpResult{Code: -1, Msg: "Get task list failed"}
-	// }
 	// 获取任务列表
 	var taskList []*model.YoungeeTaskInfo
-	err = g.Model(dao.YoungeeTaskInfo.Table).Where("talent_id = ?", tid).And("task_stage IN(?)", g.Slice{7, 9, 11, 13}).Scan(&taskList)
+	err = g.Model(dao.YoungeeTaskInfo.Table).Where("talent_id = ?", tid).And("task_stage = ?", taskStage).Scan(&taskList)
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: "Get task list failed"}
 	}
+	// // 获取任务列表
+	// var taskList []*model.YoungeeTaskInfo
+	// err = g.Model(dao.YoungeeTaskInfo.Table).Where("talent_id = ?", tid).And("task_stage IN(?)", g.Slice{7, 9, 11, 13}).Scan(&taskList)
+	// if err != nil {
+	// 	return &TalentHttpResult{Code: -1, Msg: "Get task list failed"}
+	// }
 
 	// 为每个任务根据项目id查询项目名称和主图
 	taskBriefList := youngee_talent_model.EXETaskInfoBriefList{}
@@ -350,21 +353,34 @@ func GetExeTaskBriefList(r *ghttp.Request) *TalentHttpResult {
 			ScriptStatus:     v.ScriptStatus,
 			SketchStatus:     v.SketchStatus,
 		}
-		// taskBriefList.List1 = append(taskBriefList.List1, taskInfoBrief)
-		if v.TaskStage == 7 {
-			taskBriefList.List1 = append(taskBriefList.List1, taskInfoBrief)
-		} else if v.TaskStage == 9 {
-			taskBriefList.List2 = append(taskBriefList.List2, taskInfoBrief)
-		} else if v.TaskStage == 11 {
-			taskBriefList.List3 = append(taskBriefList.List3, taskInfoBrief)
-		} else if v.TaskStage == 13 {
-			taskBriefList.List4 = append(taskBriefList.List4, taskInfoBrief)
-		}
+		taskBriefList.List1 = append(taskBriefList.List1, taskInfoBrief)
+		// if v.TaskStage == 7 {
+		// 	taskBriefList.List1 = append(taskBriefList.List1, taskInfoBrief)
+		// } else if v.TaskStage == 9 {
+		// 	taskBriefList.List2 = append(taskBriefList.List2, taskInfoBrief)
+		// } else if v.TaskStage == 11 {
+		// 	taskBriefList.List3 = append(taskBriefList.List3, taskInfoBrief)
+		// } else if v.TaskStage == 13 {
+		// 	taskBriefList.List4 = append(taskBriefList.List4, taskInfoBrief)
+		// }
 	}
 
 	return &TalentHttpResult{Code: 0, Msg: "success", Data: taskBriefList}
 }
 
+// 查询执行中所有任务
+func GetExeTaskNum(r *ghttp.Request) *TalentHttpResult {
+	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+	nums, err := g.Model("youngee_task_info").Where("talent_id = ?", tid).Fields("COUNT(*) ,task_stage").Group("task_stage").All()
+	if err != nil {
+		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
+	}
+	return &TalentHttpResult{Code: 0, Msg: "success", Data: nums}
+}
+
 func GetTaskNum(r *ghttp.Request) *TalentHttpResult {
 
 	tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)

+ 1 - 1
app/service/youngee_talent_service/task_link.go

@@ -139,7 +139,7 @@ func SubmitTaskLink(r *ghttp.Request) *TalentHttpResult {
 func GetTaskLink(r *ghttp.Request) *TalentHttpResult {
 	taskId := r.Get("task_id")
 
-	res, err := g.DB().Model(dao.YounggeeLinkInfo.Table).Where("is_submit = 1 and task_id = ?", taskId).OrderAsc("submit_at").All()
+	res, err := g.DB().Model(dao.YounggeeLinkInfo.Table).Where("is_submit = 1 and is_review = 1 and task_id = ?", taskId).OrderAsc("submit_at").All()
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: err.Error()}
 	}

+ 1 - 1
app/service/youngee_talent_service/task_script.go

@@ -138,7 +138,7 @@ func SubmitTaskScript(r *ghttp.Request) *TalentHttpResult {
 func GetTaskScript(r *ghttp.Request) *TalentHttpResult {
 	taskId := r.Get("task_id")
 
-	res, err := g.DB().Model(dao.YounggeeScriptInfo.Table).Where("is_submit = 1 and task_id = ?", taskId).OrderAsc("submit_at").All()
+	res, err := g.DB().Model(dao.YounggeeScriptInfo.Table).Where("is_submit = 1 and is_review = 1 and task_id = ?", taskId).OrderAsc("submit_at").All()
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: err.Error()}
 	}

+ 1 - 1
app/service/youngee_talent_service/task_sketch.go

@@ -155,7 +155,7 @@ func GetTaskSketch(r *ghttp.Request) *TalentHttpResult {
 	taskId := r.Get("task_id")
 
 	var sketchInfoList []*youngee_talent_model.TaskSketchInfo
-	err := g.DB().Model(dao.YounggeeSketchInfo.Table).Where("is_submit = 1 and task_id = ?", taskId).OrderAsc("submit_at").Scan(&sketchInfoList)
+	err := g.DB().Model(dao.YounggeeSketchInfo.Table).Where("is_submit = 1 and is_review = 1 and task_id = ?", taskId).OrderAsc("submit_at").Scan(&sketchInfoList)
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: err.Error()}
 	}

+ 1 - 1
app/utils/uuid.go

@@ -20,7 +20,7 @@ func (*getUuid) GetTalentId() string {
 	return tid
 }
 func (*getUuid) GetTaskId(ProjectId string, EnterpriseId string, TalentId string) string {
-	str1 := ProjectId[8:10] + EnterpriseId[8:9] + TalentId[7:9]
+	str1 := ProjectId[len(ProjectId)-2:] + EnterpriseId[len(EnterpriseId)-1:] + TalentId[len(TalentId)-2:]
 	str2 := fmt.Sprintf("%05v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(100000))
 	tid := str1 + str2
 	return tid

BIN
bin/v7.0.3/linux_amd64/youngmini_server


BIN
bin/v7.0.3/windows_amd64/youngmini_server.exe


BIN
bin/v7.0.4/linux_amd64/youngmini_server


BIN
bin/v7.0.4/windows_amd64/youngmini_server.exe


BIN
bin/v7.0.6/linux_amd64/youngmini_server


BIN
bin/v7.0.6/windows_amd64/youngmini_server.exe


BIN
bin/v7.0.8/linux_amd64/youngmini_server


BIN
bin/v7.0.8/windows_amd64/youngmini_server.exe


BIN
bin/v7.0.9/linux_amd64/youngmini_server


BIN
bin/v7.0.9/windows_amd64/youngmini_server.exe


+ 1 - 1
config/config.toml

@@ -19,7 +19,7 @@ name = "youngmini_server"
 output = "./bin"
 pack = ""
 system = "linux,windows"
-version = "v7.0.3"
+version = "v7.0.9"
 [gfcli.gen.dao]
 jsonCase = "Snake"
 link = "mysql:talent:talentDB_123@tcp(139.9.53.143:3306)/youngmini"