# benefit-platform **Repository Path**: chengdufirst/benefit-platform ## Basic Information - **Project Name**: benefit-platform - **Description**: 蓝色兄弟权益平台 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-21 - **Last Updated**: 2026-09-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # benefit-platform Minimal Spring Boot service for frontend API interaction. ## Tech stack - Spring Boot 3.5.8 - Java 17 - Maven ## Endpoints - `GET /api/ping` - `GET /api/hello` - `POST /api/h5/orders` - `POST /api/h5/orders/{platformOrderNo}/fulfill` - `GET /api/h5/current-user/points` - `POST /api/bluebrother/orders/notify` - `GET /api/web/orders` ### Query recharge orders `GET /api/web/orders` is intended for the operations page. It is outside the H5 route and has no application-level login logic; protect it with Nginx Basic Auth. The response contains `records`, `total`, `pageNum` and `pageSize`. Supported query parameters are: ```text userMobile exact match rechargeAccount exact match productName partial match productType exact match, 直充 or 卡密 platformOrderNo exact match mhOrderNo exact match blueOrderNo exact match mhStatus exact match blueStatus exact match createdAtStart inclusive, ISO-8601 local datetime, e.g. 2026-08-01T00:00:00 createdAtEnd inclusive, ISO-8601 local datetime, e.g. 2026-08-31T23:59:59 pageNum 1-based page number, default 1 pageSize 1-100, default 20 ``` The static operations page is in `web-page/index.html`. Deploy it as `/usr/share/nginx/html/rights-web/index.html` and include `web-page/nginx/page.conf` in the Nginx server configuration. The page is available at `/rights-web/`; the Nginx routes protect both `/rights-web/` and the proxied `/api/web/` backend API with `/etc/nginx/.htpasswd`. ### Create Mh Life pre-order The pre-order endpoint requires an authenticated H5 request. Send the login token through `Authorization: Bearer ` and use the following JSON body: ```json { "productId": "CMBAPGEW3651", "isPoints": "1", "pointsMoney": 30.00, "totalMoney": 70.00 } ``` `pointsMoney + totalMoney` must equal the product `faceValue`. When `isPoints` is `1`, the service also queries the current user's Mh Life points and rejects the pre-order when `pointsMoney` exceeds `totalPoint`. When `isPoints` is `0`, `pointsMoney` must be zero. The response contains `platformOrderNo`, `payAmount`, `paymentRequired` and the `wxDataPackage` returned by Mh Life. After the frontend confirms that payment succeeded, call `POST /api/h5/orders/{platformOrderNo}/fulfill`. This second endpoint creates the Blue Brother order and is idempotent for repeated frontend requests. Before creating the Blue Brother order, the service queries Mh Life ICBC payment status and requires `returnCode=0` plus `pay_status=0`. Mh Life cancellation is an internal compensation action triggered automatically when Blue Brother order creation fails; it is not exposed as an H5 endpoint. The Blue Brother callback endpoint is public and does not use H5 login interception. It accepts the original `application/json` body and reads the callback signature from the `Authorization` request header. The service reads `mchId` and `secret` from the Blue Brother configuration and verifies the callback through the SDK before updating `blue_status`. `SUCCESS` becomes `SUCCESS`; `FAIL` becomes `FAILED` and triggers Mh Life cancellation. `GET /api/h5/current-user/points` requires no query parameters or request body. The service uses the authenticated user's token and openId plus the configured Mh Life activeId. Required runtime configuration: ```text MYSQL_URL=jdbc:mysql://127.0.0.1:3306/benefit_platform MYSQL_USERNAME=root MYSQL_PASSWORD=your-password MH_ORDER_BASE_URL=https://xmrc.mssmhsh.cn MH_ORDER_CREATE_PATH=/talent/order/saveByOrder MH_ORDER_CANCEL_PATH=/talent/order/cancel MH_PAYMENT_QUERY_PATH=/talent/order/query MH_ORDER_STATUS_QUERY_PATH=/talent/order/queryStatus MH_UNPAID_SCAN_FIXED_DELAY_MS=60000 MH_UNPAID_SCAN_INITIAL_DELAY_MS=60000 MH_USER_POINT_PATH=/talent/user/point/getUserInfo MH_ORDER_STORE_ID=your-store-id MH_ORDER_ACTIVE_ID=ylfwpt MH_ORDER_CALLBACK_AUTHORIZATION=server-side-token-for-callback-cancellation BLUEBROTHER_OPENAPI_ENDPOINT=117.175.169.61:17100 BLUEBROTHER_OPENAPI_SECRET=your-secret BLUEBROTHER_OPENAPI_MERCHANT_ID=23329 BLUEBROTHER_OPENAPI_NOTIFY_URL=https://your-domain.example/api/bluebrother/orders/notify ``` ## Run locally ```bash mvn spring-boot:run ``` ## Build ```bash mvn clean package ``` If the local Maven global config is broken on this machine, use: ```bash mvn -s .mvn/settings.xml -o clean package ``` ## Docker ```bash docker build -t benefit-platform . docker run --rm -p 8080:8080 benefit-platform ```