【无标题】

2023-12-13 13:13:13

const {
authorizeType,
dogType,
createdAt,
validDate,
dogShellNumber,
authorizeVersion,
authorizeModules
} = this.model
let data = {}
const authorTime =
parse(
format(parseISO(createdAt), ‘yyyy-MM-dd HH:mm:ss’),
‘yyyy-MM-dd HH:mm:ss’,
new Date()
).getTime() / 1000
let validDays = 0
if (!validDate.includes(‘2122-12-30’)) {
const startDate = parse(
format(parseISO(createdAt), ‘yyyy-MM-dd’),
‘yyyy-MM-dd’,
new Date()
)
const endDate = parse(
format(parseISO(validDate), ‘yyyy-MM-dd’),
‘yyyy-MM-dd’,
new Date()
)
validDays = differenceInDays(endDate, startDate)
}
const dataToHash = ${authorTime}${dogShellNumber}${validDays}Hollic-ags
const md5 = CryptoJS.MD5(dataToHash).toString()
// 普通授权
if (authorizeType === ‘common’) {
// 普通授权-授权狗
if (dogType === 1) {
const filterItem = filter(authorizeModules, item => {
return item.total > 0
})
const item = map(filterItem, item => {
const { soft, total } = item
let obj = {
soft,
total,
authorCount: 0
}
if (soft === ‘AGS’) {
obj.modeId = [
{
count: total,
id: 1
},
{
count: total,
id: 2
},
{
count: total,
id: 4
}
]
}
return obj
})
data = {
authorType: authorizeType,
dogType,
appendedList: [md5],
authorTime,
validDays,
shellNumber: dogShellNumber,
version: authorizeVersion,
item
}
} else {
// 普通授权-控制狗
data = {
authorType: authorizeType,
dogType,
shellNumber: dogShellNumber,
version: authorizeVersion,
authorTime
}
}
} else {
// 软授权
const filterItem = filter(authorizeModules, [‘checked’, true])
const item = map(filterItem, item => {
const { soft } = item
let obj = {
soft
}
if (soft === ‘AGS’) {
obj.modeId = [
{
id: 1
},
{
id: 2
},
{
id: 4
}
]
}
return obj
})
data = {
authorType: authorizeType,
dogType,
authorTime,
validDays,
shellNumber: dogShellNumber,
version: authorizeVersion,
machineID: [this.model.machineCode],
item
}
}

文章来源:https://blog.csdn.net/hj17629030978/article/details/134967984
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。