背景分析
书籍是人类进步的阶梯,在信息高度发达而浮躁的当下,静下心来读书成为都市人群的新趋势, 很多读书社团应运而生,那么通过设计一款小程序,把读书会搬到手机上,通过小程序了解最热门的书单和作家,可以每天组织阅读打卡和评比;书友会时常组织书友进行线下活动,那么通过小程序可以方便的搞定报名、签到、活动信息收集,活动结束后还可以进行评价。
功能规划
数据库设计
EnrollModel.DB_STRUCTURE = {
_pid: 'string|true',
ENROLL_ID: 'string|true',
ENROLL_TITLE: 'string|true|comment=标题',
ENROLL_STATUS: 'int|true|default=1|comment=状态 0=未启用,1=使用中',
ENROLL_CATE_ID: 'string|true|default=0|comment=分类',
ENROLL_CATE_NAME: 'string|false|comment=分类冗余',
ENROLL_START: 'int|false|comment=开始时间',
ENROLL_END: 'int|false|comment=结束时间',
ENROLL_DAY_CNT: 'int|false|comment=持续天数',
ENROLL_ORDER: 'int|true|default=9999',
ENROLL_VOUCH: 'int|true|default=0',
ENROLL_FORMS: 'array|true|default=[]',
ENROLL_OBJ: 'object|true|default={}',
ENROLL_JOIN_FORMS: 'array|true|default=[]',
ENROLL_DAYS: 'array|true|default=[]',
ENROLL_QR: 'string|false',
ENROLL_VIEW_CNT: 'int|true|default=0',
ENROLL_JOIN_CNT: 'int|true|default=0',
ENROLL_USER_CNT: 'int|true|default=0',
ENROLL_USER_LIST: 'array|true|default=[]|comment={name,id,pic}',
ENROLL_ADD_TIME: 'int|true',
ENROLL_EDIT_TIME: 'int|true',
ENROLL_ADD_IP: 'string|false',
ENROLL_EDIT_IP: 'string|false',
};
EnrollJoinModel.DB_STRUCTURE = {
_pid: 'string|true',
ENROLL_JOIN_ID: 'string|true',
ENROLL_JOIN_ENROLL_ID: 'string|true|comment=打卡PK',
ENROLL_JOIN_USER_ID: 'string|true|comment=用户ID',
ENROLL_JOIN_DAY: 'string|true|comment=日期',
ENROLL_JOIN_FORMS: 'array|true|default=[]|comment=表单',
ENROLL_JOIN_STATUS: 'int|true|default=1|comment=状态 1=成功',
ENROLL_JOIN_ADD_TIME: 'int|true',
ENROLL_JOIN_EDIT_TIME: 'int|true',
ENROLL_JOIN_ADD_IP: 'string|false',
ENROLL_JOIN_EDIT_IP: 'string|false',
};
核心实现
class EnrollService extends BaseProjectService {
// 获取当前打卡状态
getJoinStatusDesc(enroll) {
let timestamp = this._timestamp;
if (enroll.ENROLL_STATUS == 0)
return '已停止';
else if (enroll.ENROLL_START > timestamp)
return '未开始';
else if (enroll.ENROLL_END ', timestamp];
break;
}
case 'over': {
where['enroll.ENROLL_END'] = ['', timestamp];
break;
}
}
}
let joinParams = {
from: EnrollModel.CL,
localField: 'ENROLL_USER_ENROLL_ID',
foreignField: '_id',
as: 'enroll',
};
let result = await EnrollUserModel.getListJoin(joinParams, where, fields, orderBy, page, size, isTotal, oldTotal);
let list = result.list;
for (let k = 0; k 3)
userList.splice(userList.length - 1, 1);
return userList;
}
// 打卡
async enrollJoin(userId, enrollId, forms) {
let user = await UserModel.getOne({ USER_MINI_OPENID: userId, USER_STATUS: UserModel.STATUS.COMM });
if (!user) this.AppError('用户不存在');
// 打卡是否结束
let whereEnroll = {
_id: enrollId,
ENROLL_STATUS: EnrollModel.STATUS.COMM
}
let enroll = await EnrollModel.getOne(whereEnroll);
if (!enroll)
this.AppError('该打卡活动不存在或者已经停止');
// 是否打卡开始
if (enroll.ENROLL_START > this._timestamp)
this.AppError('该打卡活动尚未开始');
// 是否过了打卡结束期
if (enroll.ENROLL_END
UI设计
后端UI设计
代码
git代码地址
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
引言: 在数字时代,数据被认为是新的石油,而大数据则是数据世界的燃料。大数据分析正在改变我们的生活方式、业务运营和决策制定。本文将深入探讨大数据的概念、应用、技术和挑战,以及它对不同领域的影响。 1. 什么是大数据? 大数据是指规模庞大、多样性、高速度和复杂性…