模块化 AppStore 并完善素材管理与个人空间设置。

将会话、权限、位置、收款与排队存储拆分为独立模块,同步更新各 ViewModel 与单元测试,并补充素材管理 UI 与个人空间设置交互。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-13 11:01:08 +08:00
parent ceca780ab3
commit 005349f8e6
128 changed files with 2953 additions and 1123 deletions

View File

@ -102,7 +102,7 @@ final class DepositOrderListViewModel {
onShowMessage?("核销码内容不完整")
return
}
let storeId = AppStore.shared.currentStoreId
let storeId = AppStore.shared.session.currentStoreId
guard storeId > 0 else {
onShowMessage?("店铺信息异常,请先选择店铺")
return
@ -125,7 +125,7 @@ final class DepositOrderListViewModel {
refundReason: String,
api: OrderAPI
) async {
let storeId = AppStore.shared.currentStoreId
let storeId = AppStore.shared.session.currentStoreId
guard storeId > 0 else {
onShowMessage?("店铺信息异常")
return
@ -166,7 +166,7 @@ final class DepositOrderListViewModel {
let phone = searchText.trimmingCharacters(in: .whitespacesAndNewlines)
let isPhoneSearch = !phone.isEmpty && Self.isValidPhone(phone)
let storeId = AppStore.shared.currentStoreId
let storeId = AppStore.shared.session.currentStoreId
if storeId <= 0 {
finishLoading()
orderList = []

View File

@ -122,7 +122,7 @@ final class OrderListViewModel {
}()
var isScenicAdminReadOnly: Bool {
AppStore.shared.currentAppRole == .scenicAdmin
AppStore.shared.session.currentAppRole == .scenicAdmin
}
var listAPIPath: String {
@ -359,7 +359,7 @@ final class OrderListViewModel {
isLoadingOrderSourcePeople = false
notifyStateChange()
}
let storeId = AppStore.shared.currentStoreId
let storeId = AppStore.shared.session.currentStoreId
let storeIdParam = storeId > 0 ? String(storeId) : nil
do {
let response = try await api.cooperativeSalers(storeId: storeIdParam)
@ -402,7 +402,7 @@ final class OrderListViewModel {
}
private func loadOrderList(api: OrderAPI, append: Bool) async {
let scenicId = AppStore.shared.currentScenicId
let scenicId = AppStore.shared.session.currentScenicId
guard scenicId > 0 else {
finishLoading()
onShowMessage?("当前景区信息缺失")
@ -479,7 +479,7 @@ final class OrderListViewModel {
var json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else {
return nil
}
json["scenic_id"] = String(AppStore.shared.currentScenicId)
json["scenic_id"] = String(AppStore.shared.session.currentScenicId)
guard let updated = try? JSONSerialization.data(withJSONObject: json),
let string = String(data: updated, encoding: .utf8) else {
return nil