Commit 679a6948 by Administrator

关于obs的文件上传,优化处理规则

1 parent ee39088f
...@@ -14,7 +14,7 @@ flutter run -d 00008140-001068C93AB8801C --release ...@@ -14,7 +14,7 @@ flutter run -d 00008140-001068C93AB8801C --release
gao 00008130-0010788A2E01001C gao 00008130-0010788A2E01001C
yongosng 00008110-000A284C2178801E yongosng 00008110-000A284C2178801E
flutter build ios --build-number=2511061 flutter build ios --build-number=2511061
flutter build ipa --export-method ad-hoc flutter build ipa --export-method ad-hoc
......
...@@ -27,6 +27,21 @@ class Constant { ...@@ -27,6 +27,21 @@ class Constant {
/// obs文件上传的逻辑前缀 /// obs文件上传的逻辑前缀
static const String obsLogicPrefix = EnvConfig.env == 'dev' ? 'd2/pridel/user/' : 'p2/unpridel/user/'; static const String obsLogicPrefix = EnvConfig.env == 'dev' ? 'd2/pridel/user/' : 'p2/unpridel/user/';
// 定义obs存储业务上的关键业务类型,属于这种类型的业务,在存储上区分其分属于何种删除规则
static const List<String> obsPridelFileConfigs = ['homework',
'clockin',
'clock',
'clazzclock',
'clockinQcard',
'recite',
'aloud',
'hurdle',
'tbx',
'txbb',
'dictation',
'xegd',
'kouyu'];
/// 版本相关 /// 版本相关
/// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// ///
......
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:appframe/config/evn_config.dart';
import 'package:appframe/config/constant.dart'; import 'package:appframe/config/constant.dart';
import 'package:appframe/config/locator.dart'; import 'package:appframe/config/locator.dart';
import 'package:appframe/services/api_service.dart'; import 'package:appframe/services/api_service.dart';
...@@ -307,14 +308,28 @@ class UploadFileHandler extends MessageHandler { ...@@ -307,14 +308,28 @@ class UploadFileHandler extends MessageHandler {
} }
String _getLoginPrefix(String busi, String subBusi) { String _getLoginPrefix(String busi, String subBusi) {
var now = DateTime.now(); var now = DateTime.now();
var year = now.year; var year = now.year;
var month = now.month; var month = now.month;
var day = now.day; var day = now.day;
String userCode = getIt.get<SharedPreferences>().getString('auth_userCode') ?? 'unknown'; String userCode = getIt.get<SharedPreferences>().getString('auth_userCode') ?? 'na';
String classCode = getIt.get<SharedPreferences>().getString('auth_classCode') ?? 'nac';
return '${Constant.obsLogicPrefix}$year$month$day/app/$userCode/${busi}_$subBusi'; String obsLogicPrefix = "d2";
if (EnvConfig.env == 'pro'){
obsLogicPrefix = "p2";
}
String busiCode = '${busi}_$subBusi';
// 属于该特定业务范围的素材,都被看作日后运维可以优先删除的文件,规则:http://wiki.zbuku.cn/confluence/pages/viewpage.action?pageId=137172780
if (Constant.obsPridelFileConfigs.contains(busiCode)){
obsLogicPrefix = '$obsLogicPrefix/pridel/user/';
}else{
obsLogicPrefix = '$obsLogicPrefix/unpridel/user/';
}
return '$obsLogicPrefix$year$month$day/app/$classCode/${busi}_$subBusi/$userCode';
} }
String _addPreUrl(String location) { String _addPreUrl(String location) {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!