初始
This commit is contained in:
94
third/ws/business.go
Normal file
94
third/ws/business.go
Normal file
@ -0,0 +1,94 @@
|
||||
// Package ws
|
||||
// @Author 铁憨憨[cory] 2025/2/12 15:45:00
|
||||
package ws
|
||||
|
||||
/*
|
||||
TheSenderInformationOfTheAssemblyPersonnel 组装下发人员信息
|
||||
*/
|
||||
func TheSenderInformationOfTheAssemblyPersonnel(sn string, userId string, name string, face string) (err error) {
|
||||
sUuid := GenerateUUIDWithSixRandomDigits()
|
||||
people := PeopleInformation{
|
||||
Cmd: "to_device",
|
||||
From: sUuid,
|
||||
To: sn,
|
||||
Data: PeopleInData{
|
||||
Cmd: "addUser",
|
||||
UserID: userId,
|
||||
Name: name,
|
||||
FaceTemplate: face,
|
||||
IDValid: "",
|
||||
},
|
||||
}
|
||||
_, err = SendRequestAndWaitResponse(sn, sUuid, people)
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
SelectUserAll 获取打卡设备所有人员
|
||||
*/
|
||||
func SelectUserAll(sn string) (CommonResponse, error) {
|
||||
sUuid := GenerateUUIDWithSixRandomDigits()
|
||||
people := PersonnelInformationAcquisition{
|
||||
Cmd: "to_device",
|
||||
From: sUuid,
|
||||
To: sn,
|
||||
Data: PersonnelInformationAcquisitionTwo{
|
||||
Cmd: "getUserInfo",
|
||||
Value: 1,
|
||||
},
|
||||
}
|
||||
return SendRequestAndWaitResponse(sn, sUuid, people)
|
||||
}
|
||||
|
||||
/*
|
||||
DelByUserId 删除指定人员
|
||||
*/
|
||||
func DelByUserId(sn string, userId string) (CommonResponse, error) {
|
||||
sUuid := GenerateUUIDWithSixRandomDigits()
|
||||
people := DeletionOfPersonnel{
|
||||
Cmd: "to_device",
|
||||
From: sUuid,
|
||||
To: sn,
|
||||
Data: DeletionOfPersonnelData{
|
||||
Cmd: "delUser",
|
||||
UserID: userId,
|
||||
UserType: 0,
|
||||
},
|
||||
}
|
||||
return SendRequestAndWaitResponse(sn, sUuid, people)
|
||||
}
|
||||
|
||||
/*
|
||||
BatchDelete 批量删除指定人员
|
||||
*/
|
||||
func BatchDelete(sn string, userIds []string) (CommonResponse, error) {
|
||||
sUuid := GenerateUUIDWithSixRandomDigits()
|
||||
people := BatchDeletion{
|
||||
Cmd: "to_device",
|
||||
From: sUuid,
|
||||
To: sn,
|
||||
Data: BatchDeletionData{
|
||||
Cmd: "delMultiUser",
|
||||
UserIds: userIds,
|
||||
UserType: 0,
|
||||
},
|
||||
}
|
||||
return SendRequestAndWaitResponse(sn, sUuid, people)
|
||||
}
|
||||
|
||||
/*
|
||||
DelAll 删除指定考勤机全部人员
|
||||
*/
|
||||
func DelAll(sn string) (CommonResponse, error) {
|
||||
sUuid := GenerateUUIDWithSixRandomDigits()
|
||||
people := DeletionALlOfPersonnel{
|
||||
Cmd: "to_device",
|
||||
From: sUuid,
|
||||
To: sn,
|
||||
Data: DeletionALlOfPersonnelData{
|
||||
Cmd: "delAllUser",
|
||||
UserType: 0,
|
||||
},
|
||||
}
|
||||
return SendRequestAndWaitResponse(sn, sUuid, people)
|
||||
}
|
Reference in New Issue
Block a user