zwxi 10 months ago
parent
commit
d9c15686cb

+ 34 - 2
controllers/yb_research_signup_statistics.go

@@ -63,7 +63,6 @@ func (this *BannerController) StatisticsItem() {
 		return
 	}
 
-
 	var resp models.YbResearchSignupStatisticsItemsResp
 	resp.List = list
 
@@ -103,9 +102,42 @@ func (this *BannerController) StatisticsDetail() {
 		return
 	}
 
-
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
 	br.Data = list
 }
+
+// @Title 调研报名统计列表
+// @Description 获取分类
+// @Param   Amount   query   float64  true       "付款金额"
+// @Param   YbResearchSignupStatisticsId   query   int  true       "报名id"
+// @Success 200 {object} models.BannerListResp
+// @router /research_statistics/amount [get]
+func (this *BannerController) Amount() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	ybResearchSignupStatisticsId, _ := this.GetInt("YbResearchSignupStatisticsId")
+	amount, _ := this.GetFloat("Amount")
+
+	if ybResearchSignupStatisticsId <= 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误"
+		return
+	}
+
+	err := models.UpdateYbResearchSignupStatisticsAmountById(amount, ybResearchSignupStatisticsId)
+	if err != nil {
+		br.Msg = "更新付款金额失败"
+		br.ErrMsg = "UpdateYbResearchSignupStatisticsAmountById,Err:" + err.Error()
+		return
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "修改成功"
+}

+ 8 - 0
models/yb_research_signup_statistics.go

@@ -108,3 +108,11 @@ ORDER BY
 	_, err = o.Raw(sql,mobile).QueryRows(&items)
 	return
 }
+
+// UpdateYbResearchSignupStatistics 更新付款金额
+func UpdateYbResearchSignupStatisticsAmountById(amount float64, id int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE yb_research_signup_statistics SET amount=? WHERE yb_research_signup_statistics_id=?`
+	_, err = o.Raw(sql, amount, id).Exec()
+	return
+}

+ 9 - 0
routers/commentsRouter.go

@@ -8899,6 +8899,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:BannerController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:BannerController"],
+        beego.ControllerComments{
+            Method: "Amount",
+            Router: `/research_statistics/amount`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:BannerController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:BannerController"],
         beego.ControllerComments{
             Method: "StatisticsDetail",