|
@@ -259,6 +259,7 @@ func (this *EdbController) Detail() {
|
|
|
//}
|
|
|
|
|
|
resp := data_manage.FormatEdbInfo2Item(edb)
|
|
|
+
|
|
|
br.Data = resp
|
|
|
br.Ret = 200
|
|
|
br.Msg = "获取成功"
|
|
@@ -535,3 +536,157 @@ func (this *EdbController) EdbInfoDataSeasonal() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// AuthList
|
|
|
+// @Title 指标列表
|
|
|
+// @Description 指标列表
|
|
|
+// @Success 200 {object} data_manage.ChartInfoItem
|
|
|
+// @router /auth_list [get]
|
|
|
+func (this *EdbController) AuthList() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ //classifyId, _ := this.GetInt("ClassifyId")
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+ businessCode := this.GetString("BusinessCode")
|
|
|
+ if businessCode == "" {
|
|
|
+ br.Msg = "商家编码不允许为空"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果不传入每页数据,那么就默认为10000条
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = 10000
|
|
|
+ }
|
|
|
+ var startSize int
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
+
|
|
|
+ edbPermissionOb := new(data_manage.EtaBusinessEdbPermission)
|
|
|
+
|
|
|
+ cond := ` AND a.appid = ? `
|
|
|
+ pars := []interface{}{this.Appid}
|
|
|
+
|
|
|
+ if businessCode != "" {
|
|
|
+ cond += ` AND a.business_code = ? `
|
|
|
+ pars = append(pars, businessCode)
|
|
|
+ }
|
|
|
+
|
|
|
+ total, e := edbPermissionOb.GetItemsTotal(cond, pars)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "EdbList GetItemsTotal err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := new(data_manage.BaseEdbInfoItemResp)
|
|
|
+ if total == 0 {
|
|
|
+ resp.List = make([]*data_manage.BaseEdbInfoItem, 0)
|
|
|
+ resp.Paging = paging.GetPaging(currentIndex, pageSize, 0)
|
|
|
+ br.Data = resp
|
|
|
+ br.Ret = 200
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ edbList, e := edbPermissionOb.GetItemsPageByCondition(cond, pars, []string{}, "create_time DESC, sort ASC", startSize, pageSize)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "EdbList GetItemsPageByCondition err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ list := make([]*data_manage.BaseEdbInfoItem, 0)
|
|
|
+ for _, v := range edbList {
|
|
|
+ list = append(list, data_manage.FormatEdbInfo2BaseItem(v))
|
|
|
+ }
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+
|
|
|
+ resp.List = list
|
|
|
+ resp.Paging = page
|
|
|
+
|
|
|
+ br.Data = resp
|
|
|
+ br.Ret = 200
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// Detail
|
|
|
+// @Title 指标详情
|
|
|
+// @Description 指标详情
|
|
|
+// @Success 200 {object} data_manage.EdbInfoItem
|
|
|
+// @router /base_detail [get]
|
|
|
+func (this *EdbController) BaseDetail() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ unicode := this.GetString("UniqueCode")
|
|
|
+ edbCode := this.GetString("EdbCode")
|
|
|
+ if unicode == "" && edbCode == "" {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ edbOb := new(data_manage.EdbInfo)
|
|
|
+ edb := new(data_manage.EdbInfo)
|
|
|
+ var e error
|
|
|
+ if unicode != "" {
|
|
|
+ edb, e = edbOb.GetItemByUniCode(unicode)
|
|
|
+ if e != nil {
|
|
|
+ if e.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "指标不存在"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "EdbDetail GetItemByUniCode err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else if edbCode != "" {
|
|
|
+ edb, e = edbOb.GetItemByEdbCode(edbCode)
|
|
|
+ if e != nil {
|
|
|
+ if e.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "指标不存在"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "EdbDetail GetItemByEdbCode err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ edbPermissionOb := new(data_manage.EtaBusinessEdbPermission)
|
|
|
+
|
|
|
+ cond := ` AND a.appid = ? AND a.edb_info_id = ? `
|
|
|
+ pars := []interface{}{this.Appid, edb.EdbInfoId}
|
|
|
+ total, e := edbPermissionOb.GetItemsTotal(cond, pars)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "BaseDetail GetItemsTotal err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if total <= 0 {
|
|
|
+ br.Msg = "您没有权限查看该指标"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ classifyList, err, errMsg := services.GetFullClassifyByClassifyId(edb.ClassifyId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = err.Error()
|
|
|
+ br.ErrMsg = errMsg
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ resp := data_manage.FormatEdbInfo2BaseItem(edb)
|
|
|
+ resp.ClassifyList = classifyList
|
|
|
+
|
|
|
+ br.Data = resp
|
|
|
+ br.Ret = 200
|
|
|
+ br.Msg = "获取成功"
|
|
|
+}
|