|
@@ -1,9 +1,14 @@
|
1
|
1
|
package flashbuy
|
2
|
2
|
|
3
|
3
|
import (
|
|
4
|
+ "encoding/json"
|
|
5
|
+ "errors"
|
4
|
6
|
"spaceofcheng/services/controllers"
|
5
|
7
|
"spaceofcheng/services/models/model"
|
6
|
8
|
"spaceofcheng/services/service/flashbuy"
|
|
9
|
+ "spaceofcheng/services/utils"
|
|
10
|
+
|
|
11
|
+ "github.com/astaxie/beego"
|
7
|
12
|
)
|
8
|
13
|
|
9
|
14
|
// CaseController 信息
|
|
@@ -24,8 +29,9 @@ func (c *FlashBuyController) GetFlashBuyList() {
|
24
|
29
|
cases := c.Context.Get("cases").([]model.SysUserCase)
|
25
|
30
|
caseIDs = c.GetCaseIDs(cases)
|
26
|
31
|
}
|
27
|
|
- flashBuyName := c.GetString("flashBuyName")
|
28
|
|
- flashBuyStatus := c.GetString("flashBuyStatus")
|
|
32
|
+ flashBuyName := c.GetString("flashbuyname")
|
|
33
|
+ flashBuyStatus := c.GetString("flashbuystatus")
|
|
34
|
+ beego.Error(flashBuyStatus)
|
29
|
35
|
page, _ := c.GetInt("page")
|
30
|
36
|
pageSize, _ := c.GetInt("pagesize")
|
31
|
37
|
list, err := c.dao.GetFlashBuyList(caseIDs, flashBuyName, flashBuyStatus, page, pageSize)
|
|
@@ -78,11 +84,16 @@ func (c *FlashBuyController) GetCustomerFlashBuyId() {
|
78
|
84
|
}
|
79
|
85
|
|
80
|
86
|
func (c *FlashBuyController) SaveFlashBuy() {
|
81
|
|
- flashbuy := model.TaFlashBuy{}
|
82
|
|
- if err := c.ParseForm(&flashbuy); err != nil {
|
|
87
|
+ jsnStr := c.GetString("info")
|
|
88
|
+ if jsnStr == "" {
|
|
89
|
+ c.ResponseError(errors.New("未接收到保存内容"))
|
|
90
|
+ }
|
|
91
|
+ info := model.TaFlashBuy{}
|
|
92
|
+ if err := json.Unmarshal([]byte(jsnStr), &info); err != nil {
|
|
93
|
+ utils.LogError("抢购数据转换失败: " + err.Error())
|
83
|
94
|
c.ResponseError(err)
|
84
|
95
|
}
|
85
|
|
- newFlashBuy, err := c.dao.SaveFlashBuy(flashbuy)
|
|
96
|
+ newFlashBuy, err := c.dao.SaveFlashBuy(info)
|
86
|
97
|
if err != nil {
|
87
|
98
|
c.ResponseError(err)
|
88
|
99
|
}
|