feat: 完善登录流程、UI适配及协议文档更新
本次提交包含以下修改: 1. 新增微信登录相关服务及页面逻辑,实现首次微信绑定手机号流程 2. 优化产品匹配卡片 UI,移除不必要状态显示 3. 调整首页 scroll-view 属性及 banner 背景样式 4. 完善积分规则校验逻辑,增加时区及策略格式验证 5. 更新协议草案文档,补充资料清单及功能说明 6. 修复分析结果路由路径,适配新的匹配结果页面 7. 调整品牌 Logo 安卓端字体对齐样式
This commit is contained in:
+17
-4
@@ -74,12 +74,25 @@ export async function fetchPointsSummary(): Promise<PointsSummary> {
|
||||
export async function fetchPointsRules(): Promise<PointsRules> {
|
||||
ensureSession()
|
||||
const data = await requestJson('/points/rules', 'GET', {})
|
||||
const status = ensureStatus(text(data, 'status'))
|
||||
const ruleVersion = nullableText(data, 'ruleVersion')
|
||||
const checkInReward = nullableInteger(data, 'checkInReward')
|
||||
const timezone = text(data, 'timezone')
|
||||
const published = data['publishedRules']
|
||||
return {
|
||||
status: ensureStatus(text(data, 'status')), ruleVersion: nullableText(data, 'ruleVersion'),
|
||||
checkInReward: nullableInteger(data, 'checkInReward'), timezone: text(data, 'timezone'),
|
||||
publishedRules: published != null && typeof published == 'object' ? published as UTSJSONObject : null
|
||||
if (timezone != 'Asia/Shanghai') throw new Error('积分规则时区无效')
|
||||
if (status == 'draft') {
|
||||
if (data['ruleVersion'] !== null || data['checkInReward'] !== null || published !== null) throw new Error('积分规则状态不一致')
|
||||
return { status, ruleVersion: null, checkInReward: null, timezone, publishedRules: null }
|
||||
}
|
||||
if (ruleVersion == null || !/^[a-z][a-z0-9-]{1,63}$/.test(ruleVersion) || checkInReward == null
|
||||
|| published == null || typeof published != 'object' || Array.isArray(published)) throw new Error('积分规则格式无效')
|
||||
const policy = published as UTSJSONObject
|
||||
// 展示的权益必须与服务端已实现的策略一致,未知策略不能套用一期说明。
|
||||
if (policy.getNumber('dailyLimit') != 1 || policy.getBoolean('makeUpAllowed') != false
|
||||
|| policy.getBoolean('consecutiveBonusEnabled') != false || policy.getBoolean('profileRewardEnabled') != false
|
||||
|| policy.getBoolean('invitationRewardEnabled') != false || policy.getString('expiryPolicy') != 'none'
|
||||
|| policy.getString('levelPolicy') != 'unchanged' || policy.getString('benefitsPolicy') != 'none') throw new Error('积分规则暂不支持,请稍后重试')
|
||||
return { status, ruleVersion, checkInReward, timezone, publishedRules: policy }
|
||||
}
|
||||
|
||||
function ledgerFrom(data: UTSJSONObject): PointsLedgerItem {
|
||||
|
||||
Reference in New Issue
Block a user