概要设计
会员登记注册与缴费小程序:新会员可通过手机轻松填写个人信息,涵盖姓名、联系方式、性别、年龄、职业等必填项,还可根据机构需求添加兴趣爱好等选填项,确保信息全面且精准。 会员可以在线缴费,并获得会员卡。并可以按各种维度检索其他会员信息,拓展自己的人脉圈子。
后台管理功能:管理员可审核会员提交的信息,快速处理注册申请。 可以看到每个会员的缴费记录,并且灵活设置会员缴费有效周期。
详细设计
数据字典
UserLogModel.DB_STRUCTURE = {
_pid: 'string|true',
USER_LOG_ID: 'string|true',
USER_LOG_USER_ID: 'string|true|comment=用户ID',
USER_LOG_DESC: 'string|false|comment=描述',
USER_LOG_CANCEL_TIME: 'int|true|default=0|comment=取消时间',
USER_LOG_FEE: 'int|true|default=0|comment=需支付费用 分',
USER_LOG_STATUS: 'int|true|default=1|comment=状态 0=待购买 1=购买成功, 98=自己取消,99=系统取消',
USER_LOG_PAY_TRADE_NO: 'string|false|comment=商家订单号 32位',
USER_LOG_PAY_STATUS: 'int|true|default=0|comment=支付状态 0=未支付 1=已支付 8=已退款 99=无需支付',
USER_LOG_PAY_FEE: 'int|true|default=0|comment=已支付费用 分',
USER_LOG_PAY_TIME: 'int|true|default=0|comment=支付时间',
USER_LOG_ADD_TIME: 'int|true',
USER_LOG_EDIT_TIME: 'int|true',
USER_LOG_ADD_IP: 'string|false',
USER_LOG_EDIT_IP: 'string|false',
};
核心实现
class VipSerivce extends BaseProjectService {
async minuteJob() {
console.log('### minuteJob >>>>>');
}
/** 取得我的支付分页列表 */
async getMyUserLogList(userId, {
search, // 搜索条件
sortType, // 搜索菜单
sortVal, // 搜索菜单
orderBy, // 排序
whereEx, //附加查询条件
page,
size,
oldTotal = 0
}) {
await this.fixUserUserLogPayAll(userId);
orderBy = orderBy || {
USER_LOG_ADD_TIME: 'desc'
};
let fields = '*';
let where = {};
where.and = {
USER_LOG_USER_ID: userId,
_pid: this.getProjectId() //复杂的查询在此处标注PID
};
if (util.isDefined(search) && search) {
} else if (sortType && util.isDefined(sortVal)) {
// 搜索菜单
switch (sortType) {
case 'status':
where.and.USER_LOG_STATUS = Number(sortVal);
break;
case 'sort': {
orderBy = this.fmtOrderBySort(sortVal, 'USER_LOG_ADD_TIME');
break;
}
}
}
return await UserLogModel.getList(where, fields, orderBy, page, size, true, oldTotal, false);
}
}
/** 浏览资讯信息 */
async viewUser(id) {
let fields = '*';
let where = {
_id: id,
USER_STATUS: 1
}
let user = await UserModel.getOne(where, fields);
if (!user) return null;
return user;
}
/** 取得分页列表 */
async getUserList({
cateId,
query,
search, // 搜索条件
sortType, // 搜索菜单
sortVal, // 搜索菜单
orderBy, // 排序
page,
size,
isTotal = true,
oldTotal
}) {
orderBy = orderBy || {
'USER_ORDER': 'asc',
'USER_ADD_TIME': 'desc'
};
let fields = '*';
let where = {};
where.and = {
_pid: this.getProjectId() //复杂的查询在此处标注PID
};
where.and.USER_STATUS = 1; // 状态
if (query && query.city && query.city.length > 0) {
where.and['USER_OBJ.city'] = ['in', query.city];
}
if (query && query.trade && query.trade.length > 0) {
where.and['USER_OBJ.trade'] = ['in', query.trade];
}
if (query && query.xingqu && query.xingqu.length > 0) {
where.and['USER_OBJ.xingqu'] = ['in', query.xingqu];
}
let birthMin = timeUtil.timestamp2Time(timeUtil.time() - Number(query.birthmin) * 86400 * 365 * 1000, 'Y-M-D');
let birthMax = timeUtil.timestamp2Time(timeUtil.time() - Number(query.birthmax) * 86400 * 365 * 1000, 'Y-M-D');
if (birthMin && birthMax)
where.and['USER_OBJ.birth'] = ['between', birthMax, birthMin];
if (cateId && cateId !== '0') where.and.USER_CATE_ID = cateId;
if (util.isDefined(search) && search) {
where.or = [
{ USER_NAME: ['like', search] },
{ 'USER_OBJ.college': ['like', search] },
{ 'USER_OBJ.city': ['like', search] },
{ 'USER_OBJ.trade': ['like', search] },
{ 'USER_OBJ.gzdw': ['like', search] },
{ 'USER_OBJ.duty': ['like', search] },
{ 'USER_OBJ.phone': ['like', search] },
{ 'USER_OBJ.wx': ['like', search] },
];
} else if (sortType && util.isDefined(sortVal)) {
// 搜索菜单
switch (sortType) {
case 'sort': {
orderBy = this.fmtOrderBySort(sortVal, 'USER_ADD_TIME');
break;
}
case 'cateId': {
if (sortVal) where.and.USER_CATE_ID = String(sortVal);
break;
}
}
}
return await UserModel.getList(where, fields, orderBy, page, size, isTotal, oldTotal);
}
}
UI设计
admin UI