Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 8, 2025

The WeChat Enterprise API response for getCropCheckinOption() includes a "late_rule" field within the "checkindate" object, but the current WxCpCropCheckinOption class could not deserialize this field because several fields were missing from the data model classes.

Problem

When calling getOaService().getCropCheckinOption(), the API returns JSON with "late_rule" data, but the response object WxCpCropCheckinOption could not access this information due to missing field definitions.

Example API response structure that was failing:

{
  "checkindate": [{
    "late_rule": {
      "offwork_after_time": 3600,
      "onwork_flex_time": 3600,
      "allow_offwork_after_time": true,
      "timerules": [...]
    },
    "allow_flex": false,
    "max_allow_arrive_early": 0,
    "max_allow_arrive_late": 0
  }]
}

Solution

Added missing field definitions to properly deserialize the WeChat API response:

CheckinDate class:

  • allow_flex (Boolean)
  • late_rule (LateRule object)
  • max_allow_arrive_early (Integer)
  • max_allow_arrive_late (Integer)

CheckinTime class:

  • time_id, earliest_work_sec, latest_work_sec, earliest_off_work_sec, latest_off_work_sec
  • rest_begin_time, rest_end_time, allow_rest
  • no_need_checkon, no_need_checkoff

LateRule class:

  • offwork_after_time (Integer)
  • onwork_flex_time (Integer)

Testing

Added comprehensive tests to verify:

  • JSON deserialization works correctly with the new fields
  • The exact JSON from the issue report can be parsed successfully
  • No regressions in existing functionality

The changes are minimal and surgical - only adding missing field definitions without modifying any existing behavior.

Fixes #3323.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor Author

Copilot AI commented Aug 8, 2025

@binarywang 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI changed the title [WIP] 获取企业所有打卡规则WxCpCropCheckinOption无法获取“late_rule”数据 Fix missing "late_rule" field in WxCpCropCheckinOption deserialization Aug 8, 2025
Copilot AI requested a review from binarywang August 8, 2025 09:51
@binarywang binarywang marked this pull request as ready for review August 8, 2025 10:19
@binarywang binarywang merged commit 0424d75 into develop Aug 8, 2025
1 check passed
@binarywang binarywang added this to the 4.7.8 milestone Aug 8, 2025
@binarywang binarywang deleted the copilot/fix-3323 branch August 8, 2025 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

获取企业所有打卡规则WxCpCropCheckinOption无法获取“late_rule”数据

2 participants