package talentapi

import (
	"github.com/gogf/gf/net/ghttp"
	"youngmini_server/app/service/talent_service"
)

var TalentGetApi = talentGetApi{}

type talentGetApi struct {
}

// GetInfoTables 获取所有信息表
func (*talentGetApi)GetInfoTables(r *ghttp.Request)  {
	res := talent_service.GetInfoTables()

	err := r.Response.WriteJson(res)
	if err != nil {
		panic("write response error")
	}
}

// GetRegionInfo 根据行政区域获取下去内所有下级行政区域
func (*talentGetApi)GetRegionInfo(r *ghttp.Request)  {
	res := talent_service.GetRegionInfo(r)

	err := r.Response.WriteJson(res)
	if err != nil {
		panic("write response error")
	}
}

// GetTaskList 获取任务信息列表
func (*talentGetApi)GetTaskList(r *ghttp.Request)  {
	res := talent_service.GetTaskInfoList(r)

	err := r.Response.WriteJson(res)
	if err != nil {
		panic("write response error")
	}
}

// TaskDetail 获取单个任务详情
func (*talentGetApi)TaskDetail(r *ghttp.Request) {
	res := talent_service.GetTaskDetailInfo(r)

	err := r.Response.WriteJson(res)
	if err != nil {
		panic("write response error")
	}
}

func (*talentGetApi)SearchByTaskName(r *ghttp.Request) {
	res := talent_service.SearchByTaskName(r)

	err := r.Response.WriteJson(res)
	if err != nil {
		panic("write response error")
	}
}