chore: release client-v1.0.57
Deploy Client / build-windows (push) Failing after 21s
Deploy Client / build-client-web (push) Successful in 42s
Deploy Client / build-macos (push) Successful in 2m8s
Deploy Client / build-android (push) Successful in 1m25s
Deploy Client / build-ios (push) Successful in 2m47s
Deploy Client / release-deploy-client (push) Has been skipped
Deploy Client / build-windows (push) Failing after 21s
Deploy Client / build-client-web (push) Successful in 42s
Deploy Client / build-macos (push) Successful in 2m8s
Deploy Client / build-android (push) Successful in 1m25s
Deploy Client / build-ios (push) Successful in 2m47s
Deploy Client / release-deploy-client (push) Has been skipped
设备/状态管理屏(查看本店在线设备/会话,管理员可强制下线)、登录携带设备信息、 会话心跳(/auth/ping)、被踢下线/会话失效提示、顶栏精简 + 用户名移至左侧栏底部。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import '../core/api/api_client.dart';
|
||||
import '../core/auth/auth_state.dart';
|
||||
import '../core/device/device_id.dart';
|
||||
|
||||
typedef AuthLoginFn = Future<AuthUser> Function({
|
||||
required String shopCode,
|
||||
@@ -37,10 +38,15 @@ class AuthRepository {
|
||||
);
|
||||
}
|
||||
try {
|
||||
final deviceId = await DeviceId.get();
|
||||
final platform = DeviceId.platformName;
|
||||
final resp = await PublicApiClient.post('/auth/login', data: {
|
||||
'shop_code': shopCode,
|
||||
'username': username,
|
||||
'password': password,
|
||||
'device_id': deviceId,
|
||||
'device_name': platform,
|
||||
'platform': platform,
|
||||
});
|
||||
|
||||
final data = resp.data['data'] as Map<String, dynamic>;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import '../core/api/api_client.dart';
|
||||
import '../models/session.dart';
|
||||
|
||||
class SessionRepository {
|
||||
final ApiClient _client;
|
||||
SessionRepository(this._client);
|
||||
|
||||
/// GET /api/v1/sessions —— 本店在线会话(所有登录用户只读)
|
||||
Future<List<DeviceSession>> list() async {
|
||||
final resp = await _client.get('/sessions');
|
||||
final data = (resp.data['data'] as List?) ?? [];
|
||||
return data
|
||||
.map((e) => DeviceSession.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
/// DELETE /api/v1/sessions/:id —— 强制下线(仅 admin/superadmin)
|
||||
Future<void> forceLogout(int id) async {
|
||||
await _client.delete('/sessions/$id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user