Эх сурвалжийг харах

易董提交用户报名审核

xingzai 2 жил өмнө
parent
commit
e0e7c89290

+ 66 - 0
controllers/yidong.go

@@ -0,0 +1,66 @@
+package controllers
+
+import (
+	"encoding/json"
+	"hongze/hongze_open_api/models/request/yidong"
+	cygxActivity "hongze/hongze_open_api/models/tables/cygx_activity"
+	"hongze/hongze_open_api/services/alarm_msg"
+	"hongze/hongze_open_api/utils"
+)
+
+// 易董
+type YiDongController struct {
+	BaseAuth
+}
+
+// YiDongController
+// @Title 易董提交报名用户审核接口
+// @Description 易董提交报名用户审核接口
+// @Param	request	body yidong.ActivityExamineReq true "type json string"
+// @Success 200 创建成功
+// @router /activity/examine [post]
+func (c *YiDongController) ActivityExamine() {
+
+	var req yidong.ActivityExamineReq
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		c.FailWithMessage("参数解析异常")
+		return
+	}
+	//appid权限校验
+	activityIdYiDong := req.ActivityId
+	activityInfo, err := cygxActivity.GetAddActivityInfoById(activityIdYiDong)
+	if err != nil {
+		c.FailWithMessage("会议id异常:" + activityIdYiDong)
+		return
+	}
+	activityId := activityInfo.ActivityId
+	var items []*cygxActivity.ExamineStatusReq
+	list := req.List
+	for _, v := range list {
+		item := new(cygxActivity.ExamineStatusReq)
+		//encryptMobile := string(utils.DesBase64Encrypt([]byte(v.Mobile)))
+		//fmt.Println(encryptMobile)
+		//continue
+		//encryptMobile := string(utils.DesBase64Encrypt([]byte(v.Mobile)))
+		var dateTxt = []byte(v.Mobile)
+		resultDe := utils.DesBase64Decrypt(dateTxt)
+		deMobile := string(resultDe)
+		if deMobile == "" {
+			c.FailWithMessage("加密手机号解密失败:" + v.Mobile)
+			go alarm_msg.SendAlarmMsg("加密手机号解密失败:"+v.Mobile, 3)
+			return
+		}
+		item.ActivityId = activityId
+		item.Mobile = deMobile
+		item.ExamineStatus = v.ExamineStatus
+		items = append(items, item)
+	}
+	err = cygxActivity.UpdateActivitySignupNumMulti(items)
+	if err != nil {
+		c.FailWithMessage("修改活动审核状态失败:" + activityIdYiDong)
+		go alarm_msg.SendAlarmMsg("修改活动审核状态失败:"+err.Error()+"活动ID"+activityIdYiDong, 3)
+		return
+	}
+	c.OkWithMessage("操作成功")
+}

+ 12 - 0
models/request/yidong/yidong.go

@@ -0,0 +1,12 @@
+package yidong
+
+// ActivityExamineReq 用户报名审核结构体
+type ActivityExamineReq struct {
+	ActivityId string             `description:"文章ID" json:"activity_id"`
+	List       []ExamineStatusReq `description:"审核结果" json:"list"`
+}
+
+type ExamineStatusReq struct {
+	Mobile        string `description:"手机号" json:"mobile"`
+	ExamineStatus int    `description:"审核状态 1,通过、2:未通过" json:"examine_status"`
+}

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

@@ -0,0 +1,94 @@
+package cygx_activity
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+//活动详情
+type CygxActivity struct {
+	ActivityId           int       `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
+	ActivityTypeId       int       `description:"活动类型id"`
+	ActivityTypeName     string    `description:"活动类型名称"`
+	ChartPermissionId    int       `description:"行业id"`
+	ChartPermissionName  string    `description:"行业名称"`
+	ChartPermissionNames string    `description:"行业名称辅助字段,区分研选子分类"`
+	Body                 string    `description:"内容"`
+	CreateTime           time.Time `description:"创建时间"`
+	IsLimitPeople        int       `description:"是否限制人数 1是,0否"`
+	LimitPeopleNum       int       `description:"限制的人数数量"`
+	CustomerTypeIds      string    `description:"活动可见的客户类型,多个ID用 , 隔开"`
+	PublishStatus        int       `description:"发布状态 1已发布,0未发布"`
+	LastUpdatedTime      time.Time `description:"更新时间"`
+	ActivityTime         string    `description:"活动时间"`
+	ActivityTimeText     string    `description:"活动时间带文字"`
+	DistinguishedGuest   string    `description:"嘉宾"`
+	Host                 string    `description:"主持人"`
+	MainlandTell         string    `description:"大陆拨入号"`
+	HongKongTell         string    `description:"香港拨入号"`
+	TaiwanTell           string    `description:"台湾拨入号"`
+	AmericaTell          string    `description:"美国拨入号"`
+	ParticipationCode    string    `description:"参会密码"`
+	Theme                string    `description:"主题"`
+	Expert               string    `description:"专家"`
+	ActivityName         string    `description:"活动名称"`
+	ActivityNameTask     string    `description:"活动名称定时任务同步的时候使用"`
+	OnlineParticipation  string    `description:"网络参会"`
+	ReportLink           string    `description:"报告链接"`
+	City                 string    `description:"城市"`
+	Address              string    `description:"活动地址"`
+	Highlights           string    `description:"活动亮点"`
+	Remarks              string    `description:"备注"`
+	Speaker              string    `description:"主讲人"`
+	ArticleId            int       `description:"关联报告id"`
+	Label                string    `description:"标签"`
+	LinkParticipants     string    `description:"链接参会"`
+	AppAttendance        string    `description:"App参会"`
+	ConferencePassword   string    `description:"会议密码"`
+	TemporaryLabel       string    `description:"临时标签"`
+	IsMakerShow          int       `description:"是否仅决策人可见 0,否 、1,是"`
+	VisibleRange         int       `description:"可见范围 1,仅本组可见 、2,全部客户可见"`
+	Scale                string    `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
+	IsShowSubjectName    int       `description:"小程序内是否展示标的名称 1是 ,0 否 默认0 "`
+	IsHideAppointment    int       `description:"是否隐藏预约纪要按钮 1是 ,0 否 默认0 "`
+	AdminId              int       `description:"销售/管理员ID"`
+	AdminName            string    `description:"销售/管理员姓名"`
+}
+
+//通过纪要ID获取活动详情
+func GetAddActivityInfoById(activityIdYiDong string) (item *CygxActivity, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			a.*
+		FROM
+			cygx_activity  as a
+		WHERE
+			yidong_activity_id =?`
+	err = o.Raw(sql, activityIdYiDong).QueryRow(&item)
+	return
+}
+
+type ExamineStatusReq struct {
+	ActivityId    int    `description:"活动ID"`
+	Mobile        string `description:"手机号" json:"mobile"`
+	ExamineStatus int    `description:"审核状态 1,通过、2:未通过" json:"examine_status"`
+}
+
+// UpdateActivitySignupNumMulti 批量修改易董报名用户审核状态
+func UpdateActivitySignupNumMulti(items []*ExamineStatusReq) (err error) {
+	o := orm.NewOrm()
+	p, err := o.Raw("UPDATE cygx_activity_signup SET yidong_examine_status = ? WHERE mobile = ? AND activity_id = ? ").Prepare()
+	if err != nil {
+		return
+	}
+	defer func() {
+		_ = p.Close() // 别忘记关闭 statement
+	}()
+	for _, v := range items {
+		_, err = p.Exec(v.ExamineStatus, v.Mobile, v.ActivityId)
+		if err != nil {
+			return
+		}
+	}
+	return
+}

+ 9 - 0
routers/commentsRouter.go

@@ -124,4 +124,13 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_open_api/controllers:YiDongController"] = append(beego.GlobalControllerRouter["hongze/hongze_open_api/controllers:YiDongController"],
+        beego.ControllerComments{
+            Method: "ActivityExamine",
+            Router: `/activity/examine`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
 }

+ 5 - 0
routers/router.go

@@ -46,6 +46,11 @@ func init() {
 				&controllers.QuanShiControllerCommon{},
 			),
 		),
+		web.NSNamespace("/yidong",
+			web.NSInclude(
+				&controllers.YiDongController{},
+			),
+		),
 	)
 	web.AddNamespace(ns)
 }

+ 66 - 10
swagger/swagger.json

@@ -465,6 +465,31 @@
                     }
                 }
             }
+        },
+        "/yidong/activity/examine": {
+            "post": {
+                "tags": [
+                    "yidong"
+                ],
+                "description": "易董提交报名用户审核接口\n\u003cbr\u003e",
+                "operationId": "YiDongController.易董提交报名用户审核接口",
+                "parameters": [
+                    {
+                        "in": "body",
+                        "name": "request",
+                        "description": "type json string",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/yidong.ActivityExamineReq"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "创建成功"
+                    }
+                }
+            }
         }
     },
     "definitions": {
@@ -528,16 +553,6 @@
                     "description": "父级分类id",
                     "type": "integer",
                     "format": "int64"
-                },
-                "ShowType": {
-                    "description": "展示类型:1-列表 2-专栏",
-                    "type": "integer",
-                    "format": "int64"
-                },
-                "Sort": {
-                    "description": "排序",
-                    "type": "integer",
-                    "format": "int64"
                 }
             }
         },
@@ -1108,6 +1123,11 @@
                 "http_url": {
                     "description": "跳转地址",
                     "type": "string"
+                },
+                "stage": {
+                    "description": "期数",
+                    "type": "integer",
+                    "format": "int64"
                 }
             }
         },
@@ -1400,6 +1420,38 @@
                     "format": "int64"
                 }
             }
+        },
+        "yidong.ActivityExamineReq": {
+            "title": "ActivityExamineReq",
+            "type": "object",
+            "properties": {
+                "activity_id": {
+                    "description": "文章ID",
+                    "type": "string"
+                },
+                "list": {
+                    "description": "审核结果",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/yidong.ExamineStatusReq"
+                    }
+                }
+            }
+        },
+        "yidong.ExamineStatusReq": {
+            "title": "ExamineStatusReq",
+            "type": "object",
+            "properties": {
+                "examine_status": {
+                    "description": "审核状态 1,通过、2:未通过",
+                    "type": "integer",
+                    "format": "int64"
+                },
+                "mobile": {
+                    "description": "手机号",
+                    "type": "string"
+                }
+            }
         }
     },
     "tags": [
@@ -1422,6 +1474,10 @@
         {
             "name": "quanshi",
             "description": "QuanShiControllerCommon 报告模块\n"
+        },
+        {
+            "name": "yidong",
+            "description": "易董\n"
         }
     ]
 }

+ 48 - 8
swagger/swagger.yml

@@ -342,6 +342,24 @@ paths:
       responses:
         "200":
           description: 创建成功
+  /yidong/activity/examine:
+    post:
+      tags:
+      - yidong
+      description: |-
+        易董提交报名用户审核接口
+        <br>
+      operationId: YiDongController.易董提交报名用户审核接口
+      parameters:
+      - in: body
+        name: request
+        description: type json string
+        required: true
+        schema:
+          $ref: '#/definitions/yidong.ActivityExamineReq'
+      responses:
+        "200":
+          description: 创建成功
 definitions:
   admin.CreateUserReq:
     title: CreateUserReq
@@ -389,14 +407,6 @@ definitions:
         description: 父级分类id
         type: integer
         format: int64
-      ShowType:
-        description: 展示类型:1-列表 2-专栏
-        type: integer
-        format: int64
-      Sort:
-        description: 排序
-        type: integer
-        format: int64
   company_report_permission.ResearchReportTypeContent:
     title: ResearchReportTypeContent
     type: object
@@ -816,6 +826,10 @@ definitions:
       http_url:
         description: 跳转地址
         type: string
+      stage:
+        description: 期数
+        type: integer
+        format: int64
   report.ReportListResp:
     title: ReportListResp
     type: object
@@ -1028,6 +1042,29 @@ definitions:
         description: 总数据量
         type: integer
         format: int64
+  yidong.ActivityExamineReq:
+    title: ActivityExamineReq
+    type: object
+    properties:
+      activity_id:
+        description: 文章ID
+        type: string
+      list:
+        description: 审核结果
+        type: array
+        items:
+          $ref: '#/definitions/yidong.ExamineStatusReq'
+  yidong.ExamineStatusReq:
+    title: ExamineStatusReq
+    type: object
+    properties:
+      examine_status:
+        description: 审核状态 1,通过、2:未通过
+        type: integer
+        format: int64
+      mobile:
+        description: 手机号
+        type: string
 tags:
 - name: company_user
   description: |
@@ -1046,3 +1083,6 @@ tags:
 - name: quanshi
   description: |
     QuanShiControllerCommon 报告模块
+- name: yidong
+  description: |
+    易董