Merge commit '1f5140c0fe350e6325f6962b17ddf55b770c2524'
This commit is contained in:
0
service/callback/base.py
Normal file
0
service/callback/base.py
Normal file
28
service/wecom/modules/card.py
Normal file
28
service/wecom/modules/card.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
from service.wecom.exceptions.general import SDKException
|
||||||
|
from service.wecom.modules.base import WecomBaseClient
|
||||||
|
from service.wecom.schemas.card import (
|
||||||
|
GetCardRecord,
|
||||||
|
GetCardRecordsRequest,
|
||||||
|
GetCardRecordsResponse,
|
||||||
|
)
|
||||||
|
from service.wecom.utils.requests import HttpxRequest
|
||||||
|
|
||||||
|
|
||||||
|
class WecomCardClient(WecomBaseClient):
|
||||||
|
async def get_card_records(
|
||||||
|
self, data: GetCardRecordsRequest
|
||||||
|
) -> list[GetCardRecord]:
|
||||||
|
"""
|
||||||
|
获取打卡记录数据
|
||||||
|
@param data: 获取打卡记录数据的参数
|
||||||
|
"""
|
||||||
|
url = self.BASE_URL + "/checkin/getcheckindata"
|
||||||
|
params = {"access_token": await self.access_token}
|
||||||
|
resp = GetCardRecordsResponse(
|
||||||
|
**await HttpxRequest.post(url=url, params=params, json=data.model_dump())
|
||||||
|
)
|
||||||
|
|
||||||
|
if resp.errcode == 0:
|
||||||
|
return resp.checkindata
|
||||||
|
else:
|
||||||
|
raise SDKException(resp.errcode, resp.errmsg)
|
||||||
@@ -1,10 +1,15 @@
|
|||||||
from service.wecom.modules.base import WecomBaseClient
|
from service.wecom.modules.base import WecomBaseClient
|
||||||
|
from service.wecom.modules.card import WecomCardClient
|
||||||
from service.wecom.modules.department import WecomDepartmentClient
|
from service.wecom.modules.department import WecomDepartmentClient
|
||||||
from service.wecom.modules.message import WecomMessageClient
|
from service.wecom.modules.message import WecomMessageClient
|
||||||
from service.wecom.modules.users import WecomUsersClient
|
from service.wecom.modules.users import WecomUsersClient
|
||||||
|
|
||||||
|
|
||||||
class Wecom(
|
class Wecom(
|
||||||
WecomDepartmentClient, WecomUsersClient, WecomMessageClient, WecomBaseClient
|
WecomDepartmentClient,
|
||||||
|
WecomUsersClient,
|
||||||
|
WecomMessageClient,
|
||||||
|
WecomCardClient,
|
||||||
|
WecomBaseClient,
|
||||||
):
|
):
|
||||||
pass
|
pass
|
||||||
|
|||||||
44
service/wecom/schemas/card.py
Normal file
44
service/wecom/schemas/card.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import datetime
|
||||||
|
|
||||||
|
from service.wecom.schemas.base import BaseSchema
|
||||||
|
|
||||||
|
|
||||||
|
class CheckinType:
|
||||||
|
"""打卡类型"""
|
||||||
|
|
||||||
|
ON_OFF_DUTY = 1 # 上下班打卡
|
||||||
|
OUTING = 2 # 外出打卡
|
||||||
|
ALL = 3 # 全部打卡
|
||||||
|
|
||||||
|
|
||||||
|
class GetCardRecordsRequest(BaseSchema):
|
||||||
|
"""获取打卡记录请求"""
|
||||||
|
|
||||||
|
opencheckindatatype: CheckinType
|
||||||
|
starttime: datetime.datetime
|
||||||
|
endtime: datetime.datetime
|
||||||
|
useridlist: list[str]
|
||||||
|
|
||||||
|
|
||||||
|
class GetCardRecord(BaseSchema):
|
||||||
|
userid: str
|
||||||
|
groupname: str
|
||||||
|
checkin_type: str
|
||||||
|
exception_type: str
|
||||||
|
checkin_time: datetime.datetime
|
||||||
|
location_title: str
|
||||||
|
location_detail: str
|
||||||
|
wifiname: str
|
||||||
|
notes: str
|
||||||
|
wifimac: str
|
||||||
|
mediaids: list[str]
|
||||||
|
sch_checkin_time: datetime.datetime
|
||||||
|
groupid: int
|
||||||
|
schedule_id: int
|
||||||
|
timeline_id: int
|
||||||
|
|
||||||
|
|
||||||
|
class GetCardRecordsResponse(BaseSchema):
|
||||||
|
errcode: int
|
||||||
|
errmsg: str
|
||||||
|
checkindata: list[GetCardRecord]
|
||||||
Reference in New Issue
Block a user