|
- package hdl
-
- import (
- "applet/app/e"
- "applet/app/lib/validate"
- "applet/app/md"
- "applet/app/svc"
- "applet/app/utils"
- db "code.fnuoos.com/zhimeng/model.git/src"
- "code.fnuoos.com/zhimeng/model.git/src/super/implement"
- "github.com/gin-gonic/gin"
- )
-
- // Base
- // @Summary 右上角基本数据
- // @Tags 首页------嘉俊
- // @Description 首页-右上角基本数据
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Accept json
- // @Produce json
- // @Success 200 {string} "具体看返回内容 这是data里面的数据"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/index/base [GET]
- func Base(c *gin.Context) {
- user := svc.GetUser(c)
- NewMediumListDb := implement.NewMediumListDb(db.Db)
- data, _ := NewMediumListDb.GetMediumList(user.MediumId)
- settleType := []string{"", "日结", "周结", "月结", "预付"}
- name := user.Username
- if data.CompanyName != "" {
- name = data.CompanyName
- }
- if data.CompanyAbbreviation != "" {
- name = data.CompanyAbbreviation
- }
- state := "0"
- if data.State == 2 {
- state = "1"
- }
- res := map[string]string{
- "account_id": utils.IntToStr(user.MediumId),
- "name": name,
- "account": user.Username,
- "state": state,
- "settle_type": utils.IntToStr(data.SettlementType),
- "settle_type_str": settleType[data.SettlementType],
- }
- e.OutSuc(c, res, nil)
- return
- }
-
- // IndexTotal
- // @Summary 统计数据
- // @Tags 首页------嘉俊
- // @Description 首页-统计数据
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Accept json
- // @Produce json
- // @Success 200 {string} "具体看返回内容 这是data里面的数据"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/index/total [GET]
- func IndexTotal(c *gin.Context) {
- svc.IndexTotal(c)
- }
-
- // IndexAppList
- // @Summary 应用列表
- // @Tags 首页------嘉俊
- // @Description 首页-应用列表
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Accept json
- // @Produce json
- // @Param args body md.IndexAppListReq true "请求参数"
- // @Success 200 {object} md.IndexAppListRes "具体看返回内容 这是data里面的数据"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/index/app/list [POST]
- func IndexAppList(c *gin.Context) {
- var req md.IndexAppListReq
- err := c.ShouldBindJSON(&req)
- if err != nil {
- err = validate.HandleValidateErr(err)
- err1 := err.(e.E)
- e.OutErr(c, err1.Code, err1.Error())
- return
- }
- res := svc.IndexAppList(c, req)
- e.OutSuc(c, res, nil)
- return
- }
|