Sync app branding and fix order list decode for referral_order payloads.

Align display name, icon, and launch screen with suixinkan_ios_new, and tolerate nested sale_user and empty travel objects in listv2 responses.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-06 17:07:50 +08:00
parent 31d2b6094b
commit 75d0cb1f9a
8 changed files with 247 additions and 7 deletions

View File

@ -82,4 +82,88 @@ final class OrderListViewModelTests: XCTestCase {
XCTAssertEqual(order.photoTravel?.orderPhotoNum, 10)
XCTAssertEqual(order.photoTravel?.needCheckIn, true)
}
func testOrderListDecodesRealAPIResponseShape() throws {
let json = """
{
"code": 100000,
"msg": "success",
"data": {
"total": 3,
"list": [
{
"actual_pay_amount": "0.01",
"created_at": "2026-06-25 17:12:24",
"is_refined": 1,
"multi_travel": {},
"order_number": "260625128009",
"order_status": 30,
"order_status_name": "",
"order_type": 14,
"order_type_label": "线",
"phone": "13222319413",
"photo_travel": {},
"project_name": "线",
"referral_order": {
"bind_order_number": "260625128009",
"created_at": "2026-06-25 17:13:51",
"display_text": "1234567 19281871413",
"id": 53,
"order_no": "LD202606250008",
"sale_user": {
"display_name": "1234567",
"name": "1234567",
"photog_remark_name": "1234567",
"sale_user_id": 6,
"saler_name": "1234567"
},
"sale_user_id": 6,
"saler_name": "1234567",
"saler_phone": "19281871413",
"source_type": 2,
"source_type_label": "线",
"status": 2,
"status_label": "",
"user_mobile": "13333333331"
},
"user_id": 141943
},
{
"actual_pay_amount": "0.01",
"created_at": "2026-06-17 14:08:37",
"is_refined": 2,
"multi_travel": {},
"order_number": "260617128001",
"order_status": 50,
"order_status_name": "退",
"order_type": 11,
"phone": "18651857230",
"photo_travel": {
"can_cancel_order": false,
"can_gift_retouch": false,
"need_check_in": true,
"order_photo_num": 6,
"order_video_num": 0,
"retouch_gift_photo_num": 2,
"retouch_gift_time": "2026-06-23 11:29:33",
"retouch_gift_video_num": 0
},
"project_name": " - 便",
"user_id": 143089
}
]
}
}
""".data(using: .utf8)!
let envelope = try JSONDecoder().decode(APIEnvelope<OrderListResponse<OrderEntity>>.self, from: json)
let list = try XCTUnwrap(envelope.data?.list)
XCTAssertEqual(list.count, 2)
XCTAssertNil(list[0].photoTravel)
XCTAssertNil(list[0].multiTravel)
XCTAssertEqual(list[0].referralOrder?.orderNo, "LD202606250008")
XCTAssertEqual(list[0].referralOrder?.photogRemarkName, "管铜彬1234567")
XCTAssertEqual(list[1].photoTravel?.orderPhotoNum, 6)
XCTAssertEqual(list[1].photoTravel?.needCheckIn, true)
}
}