胡轶钦 6 jaren geleden
bovenliggende
commit
ac2a15af82

+ 1
- 2
controllers/flashbuy/flashbuy.go Bestand weergeven

@@ -118,8 +118,7 @@ func (c *FlashBuyController) UpdateFlashBuy() {
118 118
 
119 119
 func (c *FlashBuyController) VerifyCustomerFlashBuyList() {
120 120
 	qrcode := c.GetString(":qrcode")
121
-	cases := c.Context.Get("cases").([]model.SysUserCase)
122
-	caseids := c.GetCaseIDs(cases)
121
+	caseids := c.GetString(":caseId")
123 122
 	customerFlashBuy, err := c.dao.VerifyCustomerFlashBuyList(qrcode, caseids)
124 123
 	if err != nil {
125 124
 		c.ResponseError(err)

+ 1
- 1
models/customer/customer.go Bestand weergeven

@@ -129,7 +129,7 @@ func (m *CustomerDAO) GetCustWithWXByOpenID(openid string) (*CustWithWX, error)
129 129
 
130 130
 	cust := CustWithWX{}
131 131
 	query := `
132
-	SELECT a.*,b.*, b.user_id as map_user,c.type_id as user_type_id,e.real_name
132
+	SELECT a.*,b.*, b.user_id as map_user,c.type_id as user_type_id,e.real_name,e.recommend_code
133 133
 	FROM
134 134
 		ta_user_mapping a
135 135
 	LEFT JOIN ta_customer b ON a.user_id = b.customer_id

+ 1
- 0
models/customer/types.go Bestand weergeven

@@ -14,4 +14,5 @@ type CustWithWX struct {
14 14
 	BelongCaseId        string
15 15
 	BelongCaseStatus    int
16 16
 	RealName            string
17
+	RecommendCode       string
17 18
 }

+ 17
- 4
models/flashbuy/flashbuy.go Bestand weergeven

@@ -8,6 +8,8 @@ import (
8 8
 	"strings"
9 9
 	"time"
10 10
 
11
+	"github.com/astaxie/beego"
12
+
11 13
 	"github.com/go-xorm/xorm"
12 14
 )
13 15
 
@@ -34,6 +36,7 @@ type CustomerFlashBuy struct {
34 36
 	CaseName                 string
35 37
 	CustomerName             string
36 38
 	Phone                    string
39
+	FlashBuyName             string
37 40
 }
38 41
 type CustomerFlashResult struct {
39 42
 	model.TaCustomerFlashBuy `xorm:"extends"`
@@ -140,11 +143,17 @@ func (m *FlashbuyDAO) VerifyFlashBuy(customerFlashBuyId string) error {
140 143
 		VerifyStatus:       models.VERIFY_USED,
141 144
 		VerifyDate:         time.Now(),
142 145
 	}
146
+	beego.Error("---------------------------------")
147
+	beego.Error(customerFlashBuy)
148
+	beego.Error("---------------------------------")
143 149
 	var cols = []string{
144 150
 		"verify_status",
145 151
 		"verify_date",
146 152
 	}
147
-	_, err := m.db.Cols(cols...).Where("customer_flash_buy_id = ?", customerFlashBuy.CustomerFlashBuyId).Update(customerFlashBuy)
153
+	record, err := m.db.Cols(cols...).Where("customer_flash_buy_id = ?", customerFlashBuy.CustomerFlashBuyId).Update(customerFlashBuy)
154
+	beego.Error("---------------------------------")
155
+	beego.Error(record)
156
+	beego.Error("---------------------------------")
148 157
 	return err
149 158
 }
150 159
 
@@ -154,11 +163,13 @@ func (m *FlashbuyDAO) GetCustomerFlashBuyById(flashBuyId, phone string, page, pa
154 163
 	a.*,
155 164
 	b.customer_name,
156 165
 	b.phone,
157
-	c.case_name 
166
+	c.case_name,
167
+	d.flash_buy_id
158 168
 FROM
159 169
 	ta_customer_flash_buy a
160 170
 	INNER JOIN ta_customer b ON a.customer_id = b.customer_id
161
-	INNER JOIN sys_case c ON a.case_id = c.case_id 
171
+	INNER JOIN sys_case c ON a.case_id = c.case_id
172
+	INNER JOIN ta_flash_buy d ON a.flash_buy_id = d.flash_buy_id
162 173
 WHERE
163 174
 	a.flash_buy_id = '` + flashBuyId + `' 
164 175
 	and a.status >` + strconv.Itoa(models.STATUS_DEL)
@@ -197,11 +208,13 @@ func (m *FlashbuyDAO) GetCustomerFlashBuyByQr(customerFlashBuyId, caseId string)
197 208
 	a.*,
198 209
 	b.customer_name,
199 210
 	b.phone,
200
-	c.case_name 
211
+	c.case_name,
212
+	d.flash_buy_name
201 213
 FROM
202 214
 	ta_customer_flash_buy a
203 215
 	INNER JOIN ta_customer b ON a.customer_id = b.customer_id
204 216
 	INNER JOIN sys_case c ON a.case_id = c.case_id 
217
+	INNER JOIN ta_flash_buy d ON a.flash_buy_id = d.flash_buy_id
205 218
 WHERE
206 219
 	a.customer_flash_buy_id ='` + customerFlashBuyId + `' and a.case_id = '` + caseId + `'`
207 220
 	sql += ` and a.validate_start <= now() and a.validate_end >= now()`

+ 2
- 2
routers/common.go Bestand weergeven

@@ -332,8 +332,8 @@ func getCommonRoutes(prefix string) beego.LinkNamespace {
332 332
 		beego.NSRouter("/flashbuy/edit", &flashbuy.FlashBuyController{}, "put:SaveFlashBuy"),
333 333
 		beego.NSRouter("/flashbuy/:flashBuyId", &flashbuy.FlashBuyController{}, "delete:DeleteFlashBuy"),
334 334
 		beego.NSRouter("/flashbuy/:flashBuyId/:flashBuyStatus", &flashbuy.FlashBuyController{}, "put:UpdateFlashBuy"),
335
-		beego.NSRouter("/flashbuy/:qrcode", &flashbuy.FlashBuyController{}, "get:VerifyCustomerFlashBuyList"),
336
-		beego.NSRouter("/flashbuy/:customerFlashBuyId", &flashbuy.FlashBuyController{}, "put:Verify"),
335
+		beego.NSRouter("/flashbuy/verify/:qrcode/:caseId", &flashbuy.FlashBuyController{}, "get:VerifyCustomerFlashBuyList"),
336
+		beego.NSRouter("/flashbuy/verify/:customerFlashBuyId", &flashbuy.FlashBuyController{}, "put:Verify"),
337 337
 		beego.NSRouter("/flashbuy/model", &flashbuy.FlashBuyController{}, "get:GetFlashModelList"),
338 338
 	)
339 339
 }

+ 5
- 0
service/flashbuy/flashbuy.go Bestand weergeven

@@ -10,6 +10,8 @@ import (
10 10
 	"spaceofcheng/services/service"
11 11
 	"spaceofcheng/services/utils"
12 12
 	"time"
13
+
14
+	"github.com/astaxie/beego"
13 15
 )
14 16
 
15 17
 // FlashBuyServ 系统处理
@@ -133,6 +135,9 @@ func (s *FlashBuyServ) VerifyCustomerFlashBuyList(qrcode, caseId string) (*flash
133 135
 	var customerFlashBuyId string
134 136
 	var customerVerify *flashbuy.CustomerFlashBuy
135 137
 	customerFlashBuyId, err = s.vdao.GetCustomerCourseIdByQrcode(qrcode)
138
+	beego.Error("________________________________")
139
+	beego.Error(customerFlashBuyId)
140
+	beego.Error("________________________________")
136 141
 	if err != nil {
137 142
 		utils.LogError("获取核销列表失败: " + err.Error())
138 143
 		return nil, errors.New("获取核销列表失败")