package advisory

import (
	"hongze/hz_crm_api/controllers"
	"hongze/hz_crm_api/models"
	"hongze/hz_crm_api/models/advisory"
)

// 每日资讯
type AdminUserController struct {
	controllers.BaseAuthController
}

// @Title 获取关注的所有分类
// @Description 获取关注的所有分类接口
// @Success Ret=200 {object} models.MyChartPermissionResp
// @router /getmyfllow [get]
func (this *AdminUserController) GetMyFllow() {
	br := new(models.BaseResponse).Init()
	defer func() {
		this.Data["json"] = br
		this.ServeJSON()
	}()
	AdminUser := this.SysUser
	if AdminUser == nil {
		br.Msg = "请登录"
		br.ErrMsg = "请登录，用户信息为空"
		br.Ret = 408
		return
	}

	list, err := advisory.GetChartPermissionList()
	if err != nil {
		br.Msg = "获取用户关注分类信息失败"
		br.ErrMsg = "获取用户关注分类信息失败，Err:" + err.Error()
		return
	}
	resp := new(advisory.MyChartPermissionResp)
	resp.List = list
	br.Ret = 200
	br.Success = true
	br.Msg = "获取成功"
	br.Data = resp
	//if AdminUser.RoleTypeCode == "admin"{
	//	list, err := advisory.GetChartPermissionList()
	//	if err != nil {
	//		br.Msg = "获取用户关注分类信息失败"
	//		br.ErrMsg = "获取用户关注分类信息失败，Err:" + err.Error()
	//		return
	//	}
	//	resp := new(advisory.MyChartPermissionResp)
	//	resp.List = list
	//	br.Ret = 200
	//	br.Success = true
	//	br.Msg = "获取成功"
	//	br.Data = resp
	//}else{
	//	userFllowInfo, err := advisory.GetUserFllowInfo(AdminUser.AdminId)
	//	if userFllowInfo == nil {
	//		br.Msg = "该用户暂未关注"
	//		br.ErrMsg = "请关注，userFllowInfo Is Empty"
	//		br.Ret = 408
	//		return
	//	}
	//	if err != nil {
	//		br.Msg = "获取用户关注分类信息失败"
	//		br.ErrMsg = "获取用户关注分类信息失败，Err:" + err.Error()
	//		return
	//	}
	//	list, err := advisory.GetChartPermissionByIds(userFllowInfo.ChartPermissionId)
	//	resp := new(advisory.MyChartPermissionResp)
	//	resp.List = list
	//	br.Ret = 200
	//	br.Success = true
	//	br.Msg = "获取成功"
	//	br.Data = resp
	//}

}
