wangfei 6 years ago
parent
commit
ab42d48f5d

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

@@ -263,7 +263,7 @@ func (m *GymcardDAO) EditGymcardShare(gymcardId, cardShareInfo, cardUseRule, car
263 263
 }
264 264
 
265 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 267
 	var customerGym model.TaCustomerGym
268 268
 	customerGym.CustomerGymId = utils.GetGUID()
269 269
 	customerGym.CaseId = gymcard.CaseId
@@ -279,6 +279,7 @@ func (m *GymcardDAO) SendGymcardToCustomer(gymcard *model.TaGymCard, customerId,
279 279
 	customerGym.SalesId = salesId
280 280
 	customerGym.SalesName = salesName
281 281
 	customerGym.CardStatus = models.CARD_COUPON_RECEIVED
282
+	customerGym.ReceivingType = receivingtype
282 283
 	_, err := m.db.Insert(customerGym)
283 284
 	return &customerGym, err
284 285
 }

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

@@ -16,4 +16,7 @@ type TaCustomerCourseDetail struct {
16 16
 	VerifyUser       string    `xorm:"VARCHAR(64)"`
17 17
 	CaseId           string    `xorm:"VARCHAR(64)"`
18 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,6 +291,7 @@ func (s *CouponServ) GiveCouponTo(from *model.SysUser, to *model.TaCustomer, cp
291 291
 		ReceiveDate:        now,
292 292
 		CaseId:             cp.CaseId,
293 293
 		OrgId:              cp.OrgId,
294
+		ReceivingType:      models.RECEIVEING_TYPE_GIVE,
294 295
 	}
295 296
 
296 297
 	// 放入赠送记录
@@ -526,6 +527,7 @@ func (s *CouponServ) ReceiveCoupon(id, saleid, serialcode string) error {
526 527
 		CaseId:             coupon.CaseId,
527 528
 		OrgId:              coupon.OrgId,
528 529
 		SerialCode:         serialcode,
530
+		ReceivingType:      models.RECEIVEING_TYPE_SALES,
529 531
 	}
530 532
 
531 533
 	err = s.dao.SaveCustomerCoupon(&customerCoupon)
@@ -588,6 +590,7 @@ func (s *CouponServ) ChannelReceiveCoupon(id string) error {
588 590
 		EndDate:            coupon.EndDate,
589 591
 		CaseId:             coupon.CaseId,
590 592
 		OrgId:              coupon.OrgId,
593
+		ReceivingType:      models.RECEIVEING_TYPE_CHANNEL,
591 594
 	}
592 595
 
593 596
 	err = s.dao.SaveCustomerCoupon(&customerCoupon)

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

@@ -181,7 +181,8 @@ func (s *GymcardServ) SendGymCardToUser(gymcardId, sysuserId string) (*model.TaC
181 181
 		return nil, errors.New("发送游泳健身卡给客户失败")
182 182
 	}
183 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 186
 	if err != nil {
186 187
 		utils.LogError("发送游泳健身卡给客户失败" + err.Error())
187 188
 		return nil, errors.New("发送游泳健身卡给客户失败")
@@ -296,7 +297,7 @@ func (s *GymcardServ) GiveCardToCustomer(gymcardId, uids string) error {
296 297
 	}
297 298
 
298 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 301
 		if err != nil {
301 302
 			utils.LogError("发送游泳健身卡给客户失败" + err.Error())
302 303
 			return errors.New("发送游泳健身卡给客户失败")