Backend Development 10 min read

Lottery System Risk Management and SDK Integration

Xianyu mitigated lottery‑related financial loss by centralizing rights management, decoupling UI from business logic, and providing a unified SDK with simple draw APIs, while adding real‑time log backflow, comprehensive accounting and monitoring, cutting configuration time by over 50 % and eliminating UI‑only risk.

Xianyu Technology
Xianyu Technology
Xianyu Technology
Lottery System Risk Management and SDK Integration

Background – Lottery activities bring significant business growth but also expose the platform to financial loss ("资损") due to incorrect operations or vulnerable code. Xianyu’s existing lottery framework has accumulated technical debt, increasing the risk of asset loss for developers, testers, and operators.

Risk Scenarios

Development risk – Multiple lottery modules (e.g., wheel, scratch card) duplicate rights‑related logic, leading to copy‑paste code that can easily introduce bugs and financial loss.

Operation risk – Rights configuration on the platform is tightly coupled with UI settings. Any UI change (button color, layout, copy) may unintentionally modify rights data, causing potential loss.

Testing risk – Lack of a visual debugging interface forces testers to rely on end‑result verification, making fault localization time‑consuming.

Runtime risk – No comprehensive accounting or monitoring leads to delayed detection of anomalies and higher user complaints.

Solution

Eliminate redundancy by centralizing rights management in a dedicated platform. Front‑end pages only reference a rights ID, decoupling UI from business logic. Strict permission controls ensure only creators can modify rights, while others have view‑only access. Changes are first applied to a pre‑release environment for verification.

Lottery SDK – A unified SDK abstracts the underlying rights service, offering a simple API compatible with H5 and Weex:

isDrawing – check if a draw is in progress

canIDraw – verify user eligibility

draw – execute the draw (returns a Promise)

mockDrawData – simulate draw data

mockDrawFail – simulate draw failure

Developers can integrate the SDK with a single call, removing the need to handle rights logic directly.

Real‑time Log Backflow – QR‑code scanning in the rights management console displays granular logs for each user action, highlighting failures automatically.

Accounting & Monitoring – New monitoring points and alerting mechanisms notify responsible personnel instantly, and dashboards provide visibility into online lottery health.

Results

Configuration time reduced by >50%

Zero risk for UI‑only changes

Testing cycle shortened from 0.5 person‑day to 0

24‑hour online accounting and monitoring

SDK reduces front‑end code size and simplifies integration

Conclusion – By isolating rights logic, providing a unified SDK, and adding real‑time logging and monitoring, Xianyu has built a stable, low‑risk lottery platform that can be extended to other Alibaba services.

Backendfrontendlottery systemmonitoringRisk Managementsdk
Xianyu Technology
Written by

Xianyu Technology

Official account of the Xianyu technology team

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.