胡轶钦 6 年前
父节点
当前提交
ac2a15af82

+ 1
- 2
controllers/flashbuy/flashbuy.go 查看文件

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

+ 1
- 1
models/customer/customer.go 查看文件

129
 
129
 
130
 	cust := CustWithWX{}
130
 	cust := CustWithWX{}
131
 	query := `
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
 	FROM
133
 	FROM
134
 		ta_user_mapping a
134
 		ta_user_mapping a
135
 	LEFT JOIN ta_customer b ON a.user_id = b.customer_id
135
 	LEFT JOIN ta_customer b ON a.user_id = b.customer_id

+ 1
- 0
models/customer/types.go 查看文件

14
 	BelongCaseId        string
14
 	BelongCaseId        string
15
 	BelongCaseStatus    int
15
 	BelongCaseStatus    int
16
 	RealName            string
16
 	RealName            string
17
+	RecommendCode       string
17
 }
18
 }

+ 17
- 4
models/flashbuy/flashbuy.go 查看文件

8
 	"strings"
8
 	"strings"
9
 	"time"
9
 	"time"
10
 
10
 
11
+	"github.com/astaxie/beego"
12
+
11
 	"github.com/go-xorm/xorm"
13
 	"github.com/go-xorm/xorm"
12
 )
14
 )
13
 
15
 
34
 	CaseName                 string
36
 	CaseName                 string
35
 	CustomerName             string
37
 	CustomerName             string
36
 	Phone                    string
38
 	Phone                    string
39
+	FlashBuyName             string
37
 }
40
 }
38
 type CustomerFlashResult struct {
41
 type CustomerFlashResult struct {
39
 	model.TaCustomerFlashBuy `xorm:"extends"`
42
 	model.TaCustomerFlashBuy `xorm:"extends"`
140
 		VerifyStatus:       models.VERIFY_USED,
143
 		VerifyStatus:       models.VERIFY_USED,
141
 		VerifyDate:         time.Now(),
144
 		VerifyDate:         time.Now(),
142
 	}
145
 	}
146
+	beego.Error("---------------------------------")
147
+	beego.Error(customerFlashBuy)
148
+	beego.Error("---------------------------------")
143
 	var cols = []string{
149
 	var cols = []string{
144
 		"verify_status",
150
 		"verify_status",
145
 		"verify_date",
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
 	return err
157
 	return err
149
 }
158
 }
150
 
159
 
154
 	a.*,
163
 	a.*,
155
 	b.customer_name,
164
 	b.customer_name,
156
 	b.phone,
165
 	b.phone,
157
-	c.case_name 
166
+	c.case_name,
167
+	d.flash_buy_id
158
 FROM
168
 FROM
159
 	ta_customer_flash_buy a
169
 	ta_customer_flash_buy a
160
 	INNER JOIN ta_customer b ON a.customer_id = b.customer_id
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
 WHERE
173
 WHERE
163
 	a.flash_buy_id = '` + flashBuyId + `' 
174
 	a.flash_buy_id = '` + flashBuyId + `' 
164
 	and a.status >` + strconv.Itoa(models.STATUS_DEL)
175
 	and a.status >` + strconv.Itoa(models.STATUS_DEL)
197
 	a.*,
208
 	a.*,
198
 	b.customer_name,
209
 	b.customer_name,
199
 	b.phone,
210
 	b.phone,
200
-	c.case_name 
211
+	c.case_name,
212
+	d.flash_buy_name
201
 FROM
213
 FROM
202
 	ta_customer_flash_buy a
214
 	ta_customer_flash_buy a
203
 	INNER JOIN ta_customer b ON a.customer_id = b.customer_id
215
 	INNER JOIN ta_customer b ON a.customer_id = b.customer_id
204
 	INNER JOIN sys_case c ON a.case_id = c.case_id 
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
 WHERE
218
 WHERE
206
 	a.customer_flash_buy_id ='` + customerFlashBuyId + `' and a.case_id = '` + caseId + `'`
219
 	a.customer_flash_buy_id ='` + customerFlashBuyId + `' and a.case_id = '` + caseId + `'`
207
 	sql += ` and a.validate_start <= now() and a.validate_end >= now()`
220
 	sql += ` and a.validate_start <= now() and a.validate_end >= now()`

+ 2
- 2
routers/common.go 查看文件

332
 		beego.NSRouter("/flashbuy/edit", &flashbuy.FlashBuyController{}, "put:SaveFlashBuy"),
332
 		beego.NSRouter("/flashbuy/edit", &flashbuy.FlashBuyController{}, "put:SaveFlashBuy"),
333
 		beego.NSRouter("/flashbuy/:flashBuyId", &flashbuy.FlashBuyController{}, "delete:DeleteFlashBuy"),
333
 		beego.NSRouter("/flashbuy/:flashBuyId", &flashbuy.FlashBuyController{}, "delete:DeleteFlashBuy"),
334
 		beego.NSRouter("/flashbuy/:flashBuyId/:flashBuyStatus", &flashbuy.FlashBuyController{}, "put:UpdateFlashBuy"),
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
 		beego.NSRouter("/flashbuy/model", &flashbuy.FlashBuyController{}, "get:GetFlashModelList"),
337
 		beego.NSRouter("/flashbuy/model", &flashbuy.FlashBuyController{}, "get:GetFlashModelList"),
338
 	)
338
 	)
339
 }
339
 }

+ 5
- 0
service/flashbuy/flashbuy.go 查看文件

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