Browse Source

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 1 year ago
parent
commit
8302a9a650
6 changed files with 69 additions and 6 deletions
  1. 4 0
      controllers/activity.go
  2. 5 3
      controllers/report.go
  3. 26 0
      models/chart.go
  4. 27 1
      services/activity.go
  5. 1 1
      services/admin.go
  6. 6 1
      services/chart.go

+ 4 - 0
controllers/activity.go

@@ -547,6 +547,10 @@ func (this *ActivityCoAntroller) Detail() {
 		}
 		//处理按钮是否展示问题
 		resp.Detail = services.ActivityButtonShow(activityInfo)
+		// 暂时写死,客户需要 5.16
+		if activityInfo.ActivityId == 2992 {
+			activityInfo.ActivityTypeName = "分析师线下沙龙"
+		}
 	} else {
 		hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionActivity(user, activityInfo)
 		if err != nil {

+ 5 - 3
controllers/report.go

@@ -725,14 +725,16 @@ func (this *ReportController) List() {
 			list[k].ImgUrlPc = mapCategoryUrl[id]
 
 			if mapCategoryUrl[id] == "" {
-				if detail.ChartPermissionId == utils.YI_YAO_ID {
-					list[k].ImgUrlPc = utils.YI_YAO_QI_TA
+				if detail != nil {
+					if detail.ChartPermissionId == utils.YI_YAO_ID {
+						list[k].ImgUrlPc = utils.YI_YAO_QI_TA
+					}
 				}
 			}
 		}
 
 		resp := new(models.TimeLineReportListResp)
-		resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]
+		//resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]
 
 		resp.List = list
 		resp.Paging = page

+ 26 - 0
models/chart.go

@@ -318,3 +318,29 @@ func GetChartDetailById(chartId, uid int) (item *CygxChartDetail, err error) {
 	err = o.Raw(sql, uid, chartId).QueryRow(&item)
 	return
 }
+
+// 删除
+func DeleteCygxChart(chartId int) (err error) {
+	o, err := orm.NewOrm().Begin()
+	if err != nil {
+		return
+	}
+	defer func() {
+
+		if err == nil {
+			o.Commit()
+		} else {
+			o.Rollback()
+		}
+	}()
+	sql := `DELETE  FROM cygx_chart   WHERE  chart_id=? `
+	_, err = o.Raw(sql, chartId).Exec()
+
+	if err != nil {
+		return err
+	}
+
+	sql = `DELETE  FROM cygx_chart_all   WHERE  chart_id=? `
+	_, err = o.Raw(sql, chartId).Exec()
+	return
+}

+ 27 - 1
services/activity.go

@@ -497,10 +497,36 @@ func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.Ac
 	var companyDetailStatus string
 	var userTypeStr string
 	//如果是弘则的用户或者宏观的权限不做校验
-	if user.CompanyId == utils.HZ_COMPANY_ID || activityInfo.ChartPermissionName == utils.HONG_GUAN_NAME {
+	if GetBelongingRai(user.Mobile) || activityInfo.ChartPermissionName == utils.HONG_GUAN_NAME {
 		havePower = true
 		return
 	}
+	//处理决策人可见权限
+	if user.IsMaker == 0 && activityInfo.IsMakerShow == 1 {
+		havePower = false
+		return
+	}
+	// 处理本组可见权限
+	if activityInfo.VisibleRange == 1 {
+		adminIds, e := models.GetSelleridWhichGroup(user.CompanyId, 2)
+		if e != nil {
+			err = errors.New("GetSelleridWhichGroup, Err: " + e.Error())
+			return
+		}
+		haveVisibleRange := false
+		adminIdSlice := strings.Split(adminIds, ",")
+
+		for _, v := range adminIdSlice {
+			if v == strconv.Itoa(activityInfo.AdminId) {
+				haveVisibleRange = true
+			}
+		}
+		if !haveVisibleRange {
+			havePower = false
+			return
+		}
+	}
+
 	userType, permissionStr, permissionStrZhengShi, e := GetUserTypeZhengShi(user.CompanyId)
 	if e != nil {
 		err = errors.New("GetCompanyPermissionUpgrade, Err: " + e.Error())

+ 1 - 1
services/admin.go

@@ -6,7 +6,7 @@ import (
 )
 
 func GetAdminMobileMap() (mapItem map[string]string, err error) {
-	adminList, e := models.GetAdminByRole()
+	adminList, e := models.GetRaiAdmin()
 	if e != nil {
 		err = e
 		return

+ 6 - 1
services/chart.go

@@ -419,7 +419,7 @@ func GetChartDetailByChartId(cont context.Context) (err error) {
 }
 
 //func init() {
-//	GetChartDetailByApi(6159)
+//	GetChartDetailByApi(6370)
 //}
 
 // 同步图表详情
@@ -460,6 +460,11 @@ func GetChartDetailByApi(chartId int) (err error) {
 		return err
 	}
 	v := resultDate.Data
+
+	if v.ChartId == 0 {
+		err = models.DeleteCygxChart(chartId)
+		return
+	}
 	item := new(models.CygxChart)
 	item.ChartId = v.ChartId
 	item.PtagId = v.PtagId