fix apply ower detail

This commit is contained in:
xuecong 2021-11-24 15:01:12 +08:00
parent c2f6adf3fd
commit 7aff1a022d
3 changed files with 21 additions and 6 deletions

View File

@ -96,7 +96,8 @@ async function accessMethod(params: AccessParams, entranceInfo: EjyyIotEntrance,
}
if (reuslt.type === VISTOR_ACCESS_CODE) {
const vistorInfo = await model.from('ejyy_vistor')
const vistorInfo = await model
.from('ejyy_vistor')
.where('id', reuslt.id)
.first();

View File

@ -64,7 +64,11 @@ const MpVistorCreateAction = <Action>{
{
name: 'expire',
regex: /^\d{13}$/,
validator: val => Date.now() < moment(val).endOf('day').valueOf(),
validator: val =>
Date.now() <
moment(val)
.endOf('day')
.valueOf(),
required: true
}
]

View File

@ -12,6 +12,7 @@
import { Action } from '~/types/action';
import { SUCCESS, QUERY_ILLEFAL } from '~/constant/code';
import { FALSE } from '~/constant/status';
import * as ROLE from '~/constant/role_access';
interface RequestBody {
@ -96,10 +97,19 @@ const PcOwerDetailAction = <Action>{
);
if (buildings.length === 0) {
return (ctx.body = {
code: QUERY_ILLEFAL,
message: '非法获取用户信息'
});
const existApply = await ctx.model
.from('ejyy_ower_apply')
.where('community_id', community_id)
.andWhere('wechat_mp_user_id', id)
.andWhere('success', FALSE)
.first();
if (!existApply) {
return (ctx.body = {
code: QUERY_ILLEFAL,
message: '非法获取用户信息'
});
}
}
const cars = await ctx.model