|
@@ -1,6 +1,7 @@
|
|
|
package controllers
|
|
|
|
|
|
import (
|
|
|
+ "encoding/json"
|
|
|
"fmt"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hongze_cygx/models"
|
|
@@ -118,18 +119,6 @@ func (this *TacticsController) List() {
|
|
|
listTacticsSrt = strings.TrimRight(listTacticsSrt, ",")
|
|
|
condition = ` AND category_id IN(` + listTacticsSrt + `)`
|
|
|
} else {
|
|
|
- //categoryIdSet, errCategory := models.GetdetailByCategoryIdSet(categoryId)
|
|
|
- //if errCategory != nil {
|
|
|
- // br.Msg = "获取信息失败"
|
|
|
- // br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
|
|
|
- // return
|
|
|
- //}
|
|
|
- //if categoryIdSet != "" {
|
|
|
- // condition = ` AND category_id IN(` + categoryIdSet + `)`
|
|
|
- //} else {
|
|
|
- // condition = ` AND category_id IN(` + strconv.Itoa(categoryId) + `)`
|
|
|
- //}
|
|
|
-
|
|
|
if detail.CeLueFieldId != "" {
|
|
|
condition = ` AND ce_lue_field_id IN(` + detail.CeLueFieldId + `)`
|
|
|
} else if detail.PolymerizationId != "" {
|
|
@@ -137,7 +126,6 @@ func (this *TacticsController) List() {
|
|
|
} else {
|
|
|
condition = ` AND category_id IN(` + strconv.Itoa(categoryId) + `)`
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
total, err = models.GetHomeCount(condition, pars)
|
|
|
if err != nil {
|
|
@@ -145,7 +133,6 @@ func (this *TacticsController) List() {
|
|
|
br.Msg = "获取帖子总数失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
page = paging.GetPaging(currentIndex, pageSize, total)
|
|
|
list, err := models.GetReportTacticsList(condition, pars, uid, startSize, pageSize)
|
|
|
if err != nil {
|
|
@@ -381,3 +368,129 @@ Loop:
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// @Title 时间线列表
|
|
|
+// @Description 时间线列表接口
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Success 200 {object} models.GetCygxTacticsTimeLineResp
|
|
|
+// @router /tacticsTimeLine/list [get]
|
|
|
+func (this *TacticsController) TacticsTimeLineList() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,用户信息为空"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := new(models.GetCygxTacticsTimeLineResp)
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ condition += ` AND art.status = 1 `
|
|
|
+ total, err := models.GetCygxTacticsTimeLineCount(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ condition += " ORDER BY art.publish_time DESC , art.time_line_id DESC "
|
|
|
+ list, err := models.GetCygxTacticsTimeLineList(condition, pars, startSize, pageSize)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range list {
|
|
|
+ v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
|
|
|
+ }
|
|
|
+ if len(list) == 0 {
|
|
|
+ list = make([]*models.CygxTacticsTimeLineResp, 0)
|
|
|
+ }
|
|
|
+ cf, err := models.GetConfigByCode(utils.CYGX_TACTICS_TIME_LINE_STATUS)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //如果不是弘则用户,并且设置了内部可见,那么数据就隐藏
|
|
|
+ if user.CompanyId != utils.HZ_COMPANY_ID && cf.ConfigValue != "1" {
|
|
|
+ list = make([]*models.CygxTacticsTimeLineResp, 0)
|
|
|
+ }
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+ resp.List = list
|
|
|
+ resp.Paging = page
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 时间线列表
|
|
|
+// @Description 时间线列表接口
|
|
|
+// @Param request body models.TacticsTimeLineTimeLineIdReq true "type json string"
|
|
|
+// @Success Ret=200 新增成功
|
|
|
+// @router /tacticsTimeLine/history [post]
|
|
|
+func (this *TacticsController) History() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,用户信息为空"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var req models.TacticsTimeLineTimeLineIdReq
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ timeLineId := req.TimeLineId
|
|
|
+ if timeLineId == 0 {
|
|
|
+ br.Msg = "时间线ID错误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var sellerName string
|
|
|
+ sellerName, err = models.GetCompanySellerName(user.CompanyId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "报名失败!"
|
|
|
+ br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ item := models.CygxTacticsTimeLineHistory{
|
|
|
+ TimeLineId: timeLineId,
|
|
|
+ UserId: user.UserId,
|
|
|
+ Mobile: user.Mobile,
|
|
|
+ Email: user.Email,
|
|
|
+ CompanyId: user.CompanyId,
|
|
|
+ CompanyName: user.CompanyName,
|
|
|
+ RealName: user.RealName,
|
|
|
+ SellerName: sellerName,
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ ModifyTime: time.Now(),
|
|
|
+ }
|
|
|
+ err = models.AddCygxTacticsTimeLineHistory(&item)
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+}
|