共计 3188 个字符,预计需要花费 8 分钟才能阅读完成。
背景
在日常生活中,大家也常常有组织流动,比方体育、才艺较量报名,户外、聚餐、出游报名,休闲小聚,会议报名,守业团聚,校友团聚,公益活动,培训报名等需要。如果一个个收集就十分费时间和人力老本,这个时候只须要一款在线报名小程序就能够疾速搞定,报名、签到、流动收集零打碎敲!
概要设计
包含布告告诉,流动分类,流动列表,流动报名,流动评估,我的流动报名,后盾流动项目管理,后盾报名记录治理,后盾报名审核,后盾报名数据导出等性能,组织方能够自定义要填写的内容,比方姓名、性别、年龄,身份证、手机号等
数据库设计
ActivityJoinModel.DB_STRUCTURE = {
_pid: 'string|true',
ACTIVITY_JOIN_ID: 'string|true',
ACTIVITY_JOIN_ACTIVITY_ID: 'string|true|comment= 报名 PK',
ACTIVITY_JOIN_IS_ADMIN: 'int|true|default=0|comment= 是否管理员增加 0/1',
ACTIVITY_JOIN_CODE: 'string|true|comment= 核验码 15 位',
ACTIVITY_JOIN_IS_CHECKIN: 'int|true|default=0|comment= 是否签到 0/1',
ACTIVITY_JOIN_CHECKIN_TIME: 'int|false|default=0| 签到工夫',
ACTIVITY_JOIN_USER_ID: 'string|true|comment= 用户 ID',
ACTIVITY_JOIN_FORMS: 'array|true|default=[]|comment= 表单',
ACTIVITY_JOIN_OBJ: 'object|true|default={}',
ACTIVITY_JOIN_STATUS: 'int|true|default=1|comment= 状态 0= 待审核 1= 报名胜利, 99= 审核未过',
ACTIVITY_JOIN_REASON: 'string|false|comment= 审核回绝或者勾销理由',
ACTIVITY_JOIN_ADD_TIME: 'int|true',
ACTIVITY_JOIN_EDIT_TIME: 'int|true',
ACTIVITY_JOIN_ADD_IP: 'string|false',
ACTIVITY_JOIN_EDIT_IP: 'string|false',
};
外围实现
async statActivityJoin(id) {
let where = {
ACTIVITY_JOIN_ACTIVITY_ID: id,
ACTIVITY_JOIN_STATUS: ['in', [ActivityJoinModel.STATUS.WAIT, ActivityJoinModel.STATUS.SUCC]]
}
let cnt = await ActivityJoinModel.count(where);
where = {
ACTIVITY_JOIN_ACTIVITY_ID: id,
ACTIVITY_JOIN_STATUS: ActivityJoinModel.STATUS.SUCC
}
let joinParams = {
from: UserModel.CL,
localField: 'ACTIVITY_JOIN_USER_ID',
foreignField: 'USER_MINI_OPENID',
as: 'user',
};
let orderBy = {ACTIVITY_JOIN_ADD_TIME: 'desc'}
let list = await ActivityJoinModel.getListJoin(joinParams, where, 'ACTIVITY_JOIN_ADD_TIME,user.USER_MINI_OPENID,user.USER_NAME,user.USER_PIC', orderBy, 1, 6, false, 0);
list = list.list;
for (let k = 0; k < list.length; k++) {list[k] = list[k].user;
}
await ActivityModel.edit(id, { ACTIVITY_JOIN_CNT: cnt, ACTIVITY_USER_LIST: list});
}
/** 报名前获取要害信息 */
async detailForActivityJoin(userId, activityId) {
let fields = 'ACTIVITY_JOIN_FORMS, ACTIVITY_TITLE';
let where = {
_id: activityId,
ACTIVITY_STATUS: ActivityModel.STATUS.COMM
}
let activity = await ActivityModel.getOne(where, fields);
if (!activity)
this.AppError('该流动不存在');
// 取出自己最近一次的填写表单
let whereMy = {ACTIVITY_JOIN_USER_ID: userId,}
let orderByMy = {ACTIVITY_JOIN_ADD_TIME: 'desc'}
let joinMy = await ActivityJoinModel.getOne(whereMy, 'ACTIVITY_JOIN_FORMS', orderByMy);
let myForms = joinMy ? joinMy.ACTIVITY_JOIN_FORMS : [];
activity.myForms = myForms;
return activity;
}
/** 勾销我的报名 只有胜利和待审核能够勾销 勾销即为删除记录 */
async cancelMyActivityJoin(userId, activityJoinId) {
let where = {
ACTIVITY_JOIN_USER_ID: userId,
_id: activityJoinId,
ACTIVITY_JOIN_STATUS: ['in', [ActivityJoinModel.STATUS.WAIT, ActivityJoinModel.STATUS.SUCC]]
};
let activityJoin = await ActivityJoinModel.getOne(where);
if (!activityJoin) {this.AppError('未找到可勾销的报名记录');
}
if (activityJoin.ACTIVITY_JOIN_IS_CHECKIN == 1)
this.AppError('该流动曾经签到,无奈勾销');
let activity = await ActivityModel.getOne(activityJoin.ACTIVITY_JOIN_ACTIVITY_ID);
if (!activity)
this.AppError('该流动不存在');
if (activity.ACTIVITY_END <= this._timestamp)
this.AppError('该流动曾经完结,无奈勾销');
if (activity.ACTIVITY_CANCEL_SET == 0)
this.AppError('该流动不能取消');
if (activity.ACTIVITY_CANCEL_SET == 2 && activity.ACTIVITY_STOP < this._timestamp)
this.AppError('该流动曾经截止报名,不能取消');
await ActivityJoinModel.del(where);
// 统计
await this.statActivityJoin(activityJoin.ACTIVITY_JOIN_ACTIVITY_ID);
}
UI 设计
后盾设计
代码 git
git 代码
正文完