|
@@ -4,8 +4,10 @@ import (
|
|
|
"encoding/json"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hongze_mobile_admin/controllers"
|
|
|
+ "hongze/hongze_mobile_admin/models"
|
|
|
"hongze/hongze_mobile_admin/models/roadshow"
|
|
|
"hongze/hongze_mobile_admin/models/tables/admin"
|
|
|
+ "hongze/hongze_mobile_admin/models/tables/english_company"
|
|
|
"hongze/hongze_mobile_admin/models/tables/system"
|
|
|
"hongze/hongze_mobile_admin/services"
|
|
|
"hongze/hongze_mobile_admin/services/rs"
|
|
@@ -305,3 +307,88 @@ func (this *ActivityController) List() {
|
|
|
resp.List = dataList
|
|
|
this.OkDetailed(resp, "保存成功")
|
|
|
}
|
|
|
+
|
|
|
+// @Title 活动详情
|
|
|
+// @Description 活动详情接口
|
|
|
+// @Param RsActivitySellerId query int true "活动销售id"
|
|
|
+// @Success 200 {object} rs.RsActivityDetailResp
|
|
|
+// @router /activity/detail [get]
|
|
|
+func (this *ActivityController) ActivityDetail() {
|
|
|
+ sysUser := this.AdminWx
|
|
|
+ if sysUser == nil {
|
|
|
+ this.FailWithMessage("请登录", "请登录,SysUser Is Empty")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ rsActivitySellerId, _ := this.GetInt("RsActivitySellerId")
|
|
|
+
|
|
|
+ if rsActivitySellerId <= 0 {
|
|
|
+ this.FailWithMessage("参数错误", "rsActivitySellerId 为零")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ rsActivitySellerItem, err := roadshow.GetRsActivitySellerById(rsActivitySellerId)
|
|
|
+ if err != nil {
|
|
|
+ this.FailWithMessage("获取数据失败", "获取数据失败!GetRsActivitySellerById:"+err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ rsActivityItem, err := roadshow.GetRsActivityByRsActivityId(rsActivitySellerItem.RsActivityId)
|
|
|
+ if err != nil {
|
|
|
+ this.FailWithMessage("获取数据失败", "获取数据失败!GetRsActivityByRsActivityId:"+err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ companyDetailView := new(roadshow.CompanyDetailView)
|
|
|
+ productId := services.GetProductId(sysUser.RoleTypeCode)
|
|
|
+ if productId == 0 {
|
|
|
+ productId = 1
|
|
|
+ }
|
|
|
+ if rsActivityItem != nil && rsActivityItem.CompanyId > 0 {
|
|
|
+ // 中文客户
|
|
|
+ if rsActivityItem.EnglishCompany == 0 {
|
|
|
+ companyId := rsActivityItem.CompanyId
|
|
|
+ companyProductItem, err := models.GetCompanyProductByCompanyIdAndProductId(companyId, productId)
|
|
|
+ if err != nil {
|
|
|
+ this.FailWithMessage("获取数据失败", "获取数据失败!GetCompanyProductByCompanyIdAndProductId:"+err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ permissionList, err := models.GetCompanyProductReportPermissionList(companyId, productId)
|
|
|
+ if err != nil {
|
|
|
+ this.FailWithMessage("搜索客户权限失败", "搜索客户权限失败!GetCompanyProductReportPermissionList:"+err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var permissionArr []string
|
|
|
+ for _, v := range permissionList {
|
|
|
+ permissionArr = append(permissionArr, v.PermissionName)
|
|
|
+ }
|
|
|
+
|
|
|
+ readNum := companyProductItem.ViewTotal
|
|
|
+ companyDetailView.CompanyId = companyProductItem.CompanyId
|
|
|
+ companyDetailView.CompanyName = companyProductItem.CompanyName
|
|
|
+ companyDetailView.Status = companyProductItem.Status
|
|
|
+ companyDetailView.IndustryId = companyProductItem.IndustryId
|
|
|
+ companyDetailView.IndustryName = companyProductItem.IndustryName
|
|
|
+ companyDetailView.PermissionName = strings.Join(permissionArr, "/")
|
|
|
+ companyDetailView.ReportReadTotal = readNum //ficc报告-累计阅读次数
|
|
|
+ }
|
|
|
+ // 英文客户
|
|
|
+ if rsActivityItem.EnglishCompany == 1 {
|
|
|
+ enItem, e := english_company.GetEnglishCompanyById(rsActivityItem.CompanyId)
|
|
|
+ if e != nil {
|
|
|
+ this.FailWithMessage("搜索客户失败!", "获取英文客户详情失败, GetEnglishCompanyById Err: "+e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ companyDetailView.CompanyId = enItem.CompanyId
|
|
|
+ companyDetailView.CompanyName = enItem.CompanyName
|
|
|
+ companyDetailView.Status = "正常"
|
|
|
+ companyDetailView.EnglishCompany = 1
|
|
|
+ companyDetailView.EnglishCountry = enItem.Country
|
|
|
+ companyDetailView.EnglishViewTotal = enItem.ViewTotal
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resp := new(roadshow.RsActivityDetailResp)
|
|
|
+ resp.RsActivityItem = rsActivityItem
|
|
|
+ resp.RsActivitySellerItem = rsActivitySellerItem
|
|
|
+ resp.CompanyDetail = companyDetailView
|
|
|
+ this.OkDetailed(resp, "获取成功")
|
|
|
+}
|