package controllers

import (
	"cc-officialweb/service"
	beego "github.com/beego/beego/v2/server/web"
)

type AboutController struct {
	beego.Controller
}

func (a *AboutController) Get() {
	about, err := service.GetRecruit("about")
	if err != nil {
		a.Data["content"] = "暂无内容"
	} else {
		a.Data["content"] = about
	}
	var success []string
	//获取成功案例轮播图
	exams := service.GetResource("example")
	for _, v := range exams {
		success = append(success, v.Url)
	}
	//获取产品分类
	productType := service.GetProductType()
	if len(productType) == 0 {
		a.Data["productFirst"] = "暂无产品分类"
	} else {
		a.Data["productFirst"] = productType[0].Name
	}
	a.Data["productType"] = productType

	a.Data["example"] = success
	a.TplName = "about.html"
}
