Pārlūkot izejas kodu

取消报名接口

xingzai 2 gadi atpakaļ
vecāks
revīzija
a518afb78c

+ 36 - 4
controllers/yidong.go

@@ -67,7 +67,8 @@ func (c *YiDongController) ActivityExamine() {
 	activityId := activityInfo.ActivityId
 
 	var examineMobile string
-	var delMyMobile string //审核不通过需要删除日程的手机号
+	var delMyMobile string     //审核不通过需要删除日程的手机号
+	var delSignupMobile string //取消活动需要删除报名信息的手机号
 	var itemsLog []*cygxActivity.CygxYidongActivityExamineStatus
 	for _, v := range list {
 		var dateTxt = []byte(v.Mobile)
@@ -78,6 +79,7 @@ func (c *YiDongController) ActivityExamine() {
 			c.FailWithMessage("加密手机号解密失败:" + v.Mobile)
 			return
 		}
+
 		examineMobile += "'" + deMobile + "'" + ","
 		itemlog := new(cygxActivity.CygxYidongActivityExamineStatus)
 		//记录日志
@@ -89,6 +91,7 @@ func (c *YiDongController) ActivityExamine() {
 		itemlog.YidongExamineStatus = v.ExamineStatus
 		itemsLog = append(itemsLog, itemlog)
 	}
+
 	//记录日志
 	err = cygxActivity.AddActivityItemsLogNumMulti(itemsLog)
 	if err != nil {
@@ -199,6 +202,9 @@ func (c *YiDongController) ActivityExamine() {
 			if v.ExamineStatus != 1 {
 				delMyMobile += "'" + deMobile + "'" + ","
 			}
+			if v.ExamineStatus == 3 {
+				delSignupMobile += "'" + deMobile + "'" + ","
+			}
 		} else {
 			if mapMySchedule[deMobile] != nil {
 				itemsMyAdd = append(itemsMyAdd, mapMySchedule[deMobile])
@@ -206,6 +212,10 @@ func (c *YiDongController) ActivityExamine() {
 		}
 	}
 
+	fmt.Println(delSignupMobile)
+
+	//return
+
 	//处理要删除的日程
 	delMyMobile = strings.TrimRight(delMyMobile, ",")
 	if delMyMobile != "" {
@@ -216,6 +226,16 @@ func (c *YiDongController) ActivityExamine() {
 		}
 	}
 
+	//处理要删除的报名信息
+	delSignupMobile = strings.TrimRight(delSignupMobile, ",")
+	if delSignupMobile != "" {
+		fmt.Println("处理要删除的报名信息")
+		err = cygxActivity.DelCygxcActivitySignup(delMyMobile, activityId)
+		if err != nil {
+			go alarm_msg.SendAlarmMsg("处理要删除的报名信息失败 DelCygxMyScheduleList:"+err.Error()+"活动ID"+activityIdYiDong, 3)
+		}
+	}
+
 	//修改审核状态
 	err = cygxActivity.UpdateActivitySignupNumMulti(items)
 	if err != nil {
@@ -240,7 +260,7 @@ func (c *YiDongController) ActivityExamine() {
 	c.OkWithMessage("操作成功")
 }
 
-func init23() {
+func init2342() {
 	//allow 59.46.229.165;
 	//allow 123.185.222.0/24;
 	//allow 123.185.223.0/24;
@@ -248,11 +268,23 @@ func init23() {
 	//allow 120.86.187.82;
 	//202.105.122.162
 
+	//	@张怀民 您好,不好意思,刚才发错了,我们这边生产IP是个地址池,
+	//生产:
+	//	49.4.0.0/16
+	//	119.3.0.0/16
+	//	117.78.0.0/16
+	//	43.254.0.0/16
+	//allow 59.36.22.17;
+	//allow 120.86.187.82;
+	//测试:
+	//	121.36.45.174
+	//	麻烦帮忙配置一下白名单
+
 	var ipstr string
 	var ipstrs string
-	ipstr = "123.185.223."
+	ipstr = "43.254.0.0."
 
-	for i := 0; i <= 24; i++ {
+	for i := 0; i <= 16; i++ {
 		fmt.Println(i)
 		ipstrs += ipstr + strconv.Itoa(i) + ","
 		//ipstr += ipstr + strconv.Itoa(i)

+ 1 - 1
models/request/yidong/yidong.go

@@ -12,7 +12,7 @@ type ActivityExamineReq struct {
 type ExamineStatusReq struct {
 	Mobile        string `description:"手机号" json:"mobile"`
 	CreateTime    string `description:"报名时间" json:"create_time"`
-	ExamineStatus int    `description:"审核状态 1,通过、2:未通过" json:"examine_status"`
+	ExamineStatus int    `description:"审核状态 1,通过、2:未通过、3:取消报名" json:"examine_status"`
 }
 
 // ActivityExamineReq 用户报名审核结构体

+ 8 - 0
models/tables/cygx_activity/cygx_activity.go

@@ -245,3 +245,11 @@ func DelCygxMyScheduleList(mobile string, activityId int) (err error) {
 	_, err = o.Raw(sql, activityId).Exec()
 	return
 }
+
+//DelCygxcActivitySignup 删除我的报名信息
+func DelCygxcActivitySignup(mobile string, activityId int) (err error) {
+	o := orm.NewOrm()
+	sql := ` DELETE  FROM cygx_activity_signup   WHERE mobile IN (` + mobile + `)  AND activity_id=?`
+	_, err = o.Raw(sql, activityId).Exec()
+	return
+}