From 0-1: Gym personal trainer appointment applet development notes

Development background

Driven by the contemporary "slimming craze", the number of people going to gyms to exercise and lose weight is also increasing, which makes gym management more difficult to a certain extent. Therefore, developing a small program for gym reservations can be useful at this time. use

Outline design

This project is divided into three components: user end, coach end, and backend end:

  • Backend: You can add and set the coach’s basic information, account number, login password, etc.
  • Coach terminal: You can edit your personal information (avatar, introduction, star rating, etc.), set the reservation time schedule (reservable time periods, limited number of people in each time period), and cancel the user's reservation code on site.
  • User terminal: Select the coach and time period you need, place an order and make a reservation. After the reservation is successful, go to the gym and show the reservation code to the coach or staff for verification.

Technology selection

  • This project is developed using the WeChat mini program platform.
  • Using Tencent's specialized small program cloud development technology, cloud resources include cloud functions, databases, bandwidth, storage space, timers, etc. Resource quotas are low-priced and can be built without domain names and servers.
  • The mini program itself is ready to use, suitable for use scenarios of gadgets, and also suitable for rapid development and iteration.
  • Cloud development technology uses Tencent's internal links, so there is no risk of being attacked by hackers, no DDOS attacks, saving firewall costs, high security and maintenance-free. Resource carrying capacity can be flexibly expanded at any time according to business development needs.

Database Design

`MeetModel.DB_STRUCTURE = { _pid: 'string|true', MEET_ID: 'string|true', MEET_ADMIN_ID: 'string|true|comment=Added Administrator', MEET_TITLE: 'string|true|comment=Title',

MEET_JOIN_FORMS: 'array|true|default=[]|comment=表单字段设置',
MEET_DAYS: 'array|true|default=[]|comment=最近一次修改保存的可用日期',

MEET_CATE_ID: 'string|true|comment=分类编号',
MEET_CATE_NAME: 'string|true|comment=分类冗余', 

MEET_FORMS: 'array|true|default=[]',
MEET_OBJ: 'object|true|default={}',  

MEET_CANCEL_SET: 'int|true|default=1|comment=取消设置 0=不允,1=允许,2=仅开始前可取消',

MEET_STATUS: 'int|true|default=1|comment=状态 0=未启用,1=使用中,9=停止预约,10=已关闭',
MEET_ORDER: 'int|true|default=9999',
MEET_VOUCH: 'int|true|default=0',

MEET_QR: 'string|false',

MEET_PHONE: 'string|false|comment=登录手机',
MEET_PASSWORD: 'string|false|comment=登录密码',
MEET_TOKEN: 'string|false|comment=当前登录token',
MEET_TOKEN_TIME: 'int|true|default=0|comment=当前登录token time',
MEET_MINI_OPENID: 'string|false|comment=小程序openid',
MEET_LOGIN_CNT: 'int|true|default=0|comment=登陆次数',
MEET_LOGIN_TIME: 'int|false|comment=最近登录时间',


MEET_ADD_TIME: 'int|true',
MEET_EDIT_TIME: 'int|true',
MEET_ADD_IP: 'string|false',
MEET_EDIT_IP: 'string|false',

};`

Technical Difficulties

`// User reservation logic async join(userId, meetId, timeMark, formsList) { // Whether the reservation period exists let meetWhere = { _id: meetId }; let day = this.getDayByTimeMark(timeMark); let meet = await this.getMeetOneDay (meetId, day, meetWhere);

	if (!meet) {
		this.AppError('预约时段选择错误1,请重新选择');
	}

	let daySet = this.getDaySetByTimeMark(meet, timeMark);
	if (!daySet)
		this.AppError('预约时段选择错误2,请重新选择');

	let timeSet = this.getTimeSetByTimeMark(meet, timeMark);
	if (!timeSet)
		this.AppError('预约时段选择错误3,请重新选择');

	// 规则校验
	await this.checkMeetRules(userId, meetId, timeMark, formsList);


	let data = {};

	data.JOIN_USER_ID = userId;
	data.JOIN_MEET_ID = meetId;
	data.JOIN_MEET_CATE_ID = meet.MEET_CATE_ID;
	data.JOIN_MEET_CATE_NAME = meet.MEET_CATE_NAME;
	data.JOIN_MEET_TITLE = meet.MEET_TITLE;
	data.JOIN_MEET_DAY = daySet.day;
	data.JOIN_MEET_TIME_START = timeSet.start;
	data.JOIN_MEET_TIME_END = timeSet.end;
	data.JOIN_MEET_TIME_MARK = timeMark;
	data.JOIN_START_TIME = timeUtil.time2Timestamp(daySet.day + ' ' + timeSet.start + ':00');
	data.JOIN_STATUS = JoinModel.STATUS.SUCC;
	data.JOIN_COMPLETE_END_TIME = daySet.day + ' ' + timeSet.end;

	// 入库
	for (let k = 0; k < formsList.length; k++) {
		let forms = formsList[k];
		data.JOIN_FORMS = forms;
		data.JOIN_OBJ = dataUtil.dbForms2Obj(forms);
		data.JOIN_CODE = dataUtil.genRandomIntString(15);
		await JoinModel.insert(data);
	}


	// 统计
	this.statJoinCnt(meetId, timeMark);

	return {
		result: 'ok',
	}
}`

UI design (user side)

UI design (coach end)

git code

Linus took it upon himself to prevent kernel developers from replacing tabs with spaces. His father is one of the few leaders who can write code, his second son is the director of the open source technology department, and his youngest son is an open source core contributor. Robin Li: Natural language will become a new universal programming language. The open source model will fall further and further behind Huawei: It will take 1 year to fully migrate 5,000 commonly used mobile applications to Hongmeng. Java is the language most prone to third-party vulnerabilities. Rich text editor Quill 2.0 has been released with features, reliability and developers. The experience has been greatly improved. Ma Huateng and Zhou Hongyi shook hands to "eliminate grudges." Meta Llama 3 is officially released. Although the open source of Laoxiangji is not the code, the reasons behind it are very heart-warming. Google announced a large-scale restructuring
{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/u/3808186/blog/7364443