Browse Source

no message

xingzai 1 year ago
parent
commit
131fc34a73
3 changed files with 66 additions and 1 deletions
  1. 30 1
      controllers/activity_special.go
  2. 35 0
      models/activity_special_meeting_detail.go
  3. 1 0
      models/db.go

+ 30 - 1
controllers/activity_special.go

@@ -261,6 +261,16 @@ func (this *ActivitySpecialController) SpecialTripAdd() {
 			itemBill.RegisterPlatform = 1
 			itemBill.ChartPermissionId = activityInfo.ChartPermissionId
 
+			var itemMeeting = new(models.CygxActivitySpecialMeetingDetail)
+			itemMeeting.UserId = user.UserId
+			itemMeeting.ActivityId = activityId
+			itemMeeting.CreateTime = time.Now()
+			itemMeeting.Mobile = user.Mobile
+			itemMeeting.Email = user.Email
+			itemMeeting.CompanyId = user.CompanyId
+			itemMeeting.CompanyName = user.CompanyName
+			itemMeeting.RealName = user.RealName
+
 			go services.ActivitySpecialUserRmind(user, activityId, 2)
 			//判断是删除还是添加
 			if total == 0 {
@@ -324,7 +334,20 @@ func (this *ActivitySpecialController) SpecialTripAdd() {
 					itemBill.BillDetailed = 0 //48小时之内,取消报名之后二次报名,不扣除流水记录
 				}
 			}
-			go models.AddCygxActivitySpecialTripBill(itemBill)
+			//添加流水记录
+			err = models.AddCygxActivitySpecialTripBill(itemBill)
+			if err != nil {
+				br.Msg = "报名失败,"
+				br.ErrMsg = "AddCygxActivitySpecialTripBill,Err:" + err.Error()
+				return
+			}
+			//添加数据到会信息
+			err = models.AddCygxActivitySpecialMeetingDetail(itemMeeting)
+			if err != nil {
+				br.Msg = "报名失败,"
+				br.ErrMsg = "AddCygxActivitySpecialMeetingDetail,Err:" + err.Error()
+				return
+			}
 		}
 	} else {
 		hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermission(user)
@@ -411,6 +434,12 @@ func (this *ActivitySpecialController) Tripcancel() {
 		br.ErrMsg = "CancelActivitySpecialTrip,Err:" + err.Error()
 		return
 	}
+	err = models.CancelCygxActivitySpecialMeetingDetail(uid, activityId)
+	if err != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "CancelCygxActivitySpecialMeetingDetail,Err:" + err.Error()
+		return
+	}
 	go models.AddCygxActivitySpecialTripBill(itemBill)
 
 	br.Ret = 200

+ 35 - 0
models/activity_special_meeting_detail.go

@@ -0,0 +1,35 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxActivitySpecialMeetingDetail struct {
+	Id          int       `orm:"column(id);pk"`
+	UserId      int       `description:"用户id"`
+	ActivityId  int       `description:"活动ID"`
+	CreateTime  time.Time `description:"创建时间"`
+	Mobile      string    `description:"手机号"`
+	Email       string    `description:"邮箱号"`
+	CompanyId   int       `description:"公司ID"`
+	CompanyName string    `description:"公司名称"`
+	IsMeeting   int       `description:"是否到会  1.是 ,0否"`
+	IsAirborne  int       `description:"是否属于空降  1.是 ,0否"`
+	RealName    string    `description:"真实姓名"`
+}
+
+// 添加
+func AddCygxActivitySpecialMeetingDetail(item *CygxActivitySpecialMeetingDetail) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+// 取消
+func CancelCygxActivitySpecialMeetingDetail(uid, activityId int) (err error) {
+	o := orm.NewOrm()
+	sql := `DELETE  FROM cygx_activity_special_meeting_detail   WHERE user_id=?  AND activity_id=? `
+	_, err = o.Raw(sql, uid, activityId).Exec()
+	return
+}

+ 1 - 0
models/db.go

@@ -75,6 +75,7 @@ func init() {
 		new(CygxInviteCompany),
 		new(CygxApplyRecord),
 		new(CygxTagHistory),
+		new(CygxActivitySpecialMeetingDetail),
 	)
 	// 记录ORM查询日志
 	orm.Debug = true