wangfei 6 years ago
parent
commit
ab42d48f5d

+ 2
- 1
models/gymcard/gymcard.go View File

263
 }
263
 }
264
 
264
 
265
 // SendGymcardToCustomer 新增用户健身卡
265
 // SendGymcardToCustomer 新增用户健身卡
266
-func (m *GymcardDAO) SendGymcardToCustomer(gymcard *model.TaGymCard, customerId, salesId, salesName string) (*model.TaCustomerGym, error) {
266
+func (m *GymcardDAO) SendGymcardToCustomer(gymcard *model.TaGymCard, customerId, salesId, salesName, receivingtype string) (*model.TaCustomerGym, error) {
267
 	var customerGym model.TaCustomerGym
267
 	var customerGym model.TaCustomerGym
268
 	customerGym.CustomerGymId = utils.GetGUID()
268
 	customerGym.CustomerGymId = utils.GetGUID()
269
 	customerGym.CaseId = gymcard.CaseId
269
 	customerGym.CaseId = gymcard.CaseId
279
 	customerGym.SalesId = salesId
279
 	customerGym.SalesId = salesId
280
 	customerGym.SalesName = salesName
280
 	customerGym.SalesName = salesName
281
 	customerGym.CardStatus = models.CARD_COUPON_RECEIVED
281
 	customerGym.CardStatus = models.CARD_COUPON_RECEIVED
282
+	customerGym.ReceivingType = receivingtype
282
 	_, err := m.db.Insert(customerGym)
283
 	_, err := m.db.Insert(customerGym)
283
 	return &customerGym, err
284
 	return &customerGym, err
284
 }
285
 }

+ 3
- 0
models/model/ta_customer_course_detail.go View File

16
 	VerifyUser       string    `xorm:"VARCHAR(64)"`
16
 	VerifyUser       string    `xorm:"VARCHAR(64)"`
17
 	CaseId           string    `xorm:"VARCHAR(64)"`
17
 	CaseId           string    `xorm:"VARCHAR(64)"`
18
 	Status           int       `xorm:"SMALLINT(6)"`
18
 	Status           int       `xorm:"SMALLINT(6)"`
19
+	CustomerId       string    `xorm:"VARCHAR(64)"`
20
+	OrgId            string    `xorm:"VARCHAR(64)"`
21
+	CourseName       string    `xorm:"VARCHAR(255)"`
19
 }
22
 }

+ 3
- 0
service/coupon/coupon.go View File

291
 		ReceiveDate:        now,
291
 		ReceiveDate:        now,
292
 		CaseId:             cp.CaseId,
292
 		CaseId:             cp.CaseId,
293
 		OrgId:              cp.OrgId,
293
 		OrgId:              cp.OrgId,
294
+		ReceivingType:      models.RECEIVEING_TYPE_GIVE,
294
 	}
295
 	}
295
 
296
 
296
 	// 放入赠送记录
297
 	// 放入赠送记录
526
 		CaseId:             coupon.CaseId,
527
 		CaseId:             coupon.CaseId,
527
 		OrgId:              coupon.OrgId,
528
 		OrgId:              coupon.OrgId,
528
 		SerialCode:         serialcode,
529
 		SerialCode:         serialcode,
530
+		ReceivingType:      models.RECEIVEING_TYPE_SALES,
529
 	}
531
 	}
530
 
532
 
531
 	err = s.dao.SaveCustomerCoupon(&customerCoupon)
533
 	err = s.dao.SaveCustomerCoupon(&customerCoupon)
588
 		EndDate:            coupon.EndDate,
590
 		EndDate:            coupon.EndDate,
589
 		CaseId:             coupon.CaseId,
591
 		CaseId:             coupon.CaseId,
590
 		OrgId:              coupon.OrgId,
592
 		OrgId:              coupon.OrgId,
593
+		ReceivingType:      models.RECEIVEING_TYPE_CHANNEL,
591
 	}
594
 	}
592
 
595
 
593
 	err = s.dao.SaveCustomerCoupon(&customerCoupon)
596
 	err = s.dao.SaveCustomerCoupon(&customerCoupon)

+ 3
- 2
service/gymcard/gymcard.go View File

181
 		return nil, errors.New("发送游泳健身卡给客户失败")
181
 		return nil, errors.New("发送游泳健身卡给客户失败")
182
 	}
182
 	}
183
 	gymCard.SentCount = gymCard.SentCount + 1
183
 	gymCard.SentCount = gymCard.SentCount + 1
184
-	customerGym, err = s.dao.SendGymcardToCustomer(&gymCard.TaGymCard, customer.CustomerId, sysuserId, sysuser.RealName)
184
+
185
+	customerGym, err = s.dao.SendGymcardToCustomer(&gymCard.TaGymCard, customer.CustomerId, sysuserId, sysuser.RealName, models.RECEIVEING_TYPE_SALES)
185
 	if err != nil {
186
 	if err != nil {
186
 		utils.LogError("发送游泳健身卡给客户失败" + err.Error())
187
 		utils.LogError("发送游泳健身卡给客户失败" + err.Error())
187
 		return nil, errors.New("发送游泳健身卡给客户失败")
188
 		return nil, errors.New("发送游泳健身卡给客户失败")
296
 	}
297
 	}
297
 
298
 
298
 	for _, uid := range arrUID {
299
 	for _, uid := range arrUID {
299
-		_, err := s.dao.SendGymcardToCustomer(&gymCard.TaGymCard, uid, "", "")
300
+		_, err := s.dao.SendGymcardToCustomer(&gymCard.TaGymCard, uid, "", "", models.RECEIVEING_TYPE_GIVE)
300
 		if err != nil {
301
 		if err != nil {
301
 			utils.LogError("发送游泳健身卡给客户失败" + err.Error())
302
 			utils.LogError("发送游泳健身卡给客户失败" + err.Error())
302
 			return errors.New("发送游泳健身卡给客户失败")
303
 			return errors.New("发送游泳健身卡给客户失败")