Merge branch 'release'

This commit is contained in:
liuyanfeng 2025-06-14 10:58:37 +08:00
commit 1266022412
11 changed files with 190 additions and 72 deletions

View File

@ -60,13 +60,19 @@ variables:
.setup_fastlane_android:
extends: .build_rule
before_script:
- export PUB_HOSTED_URL=https://pub.flutter-io.cn
- export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
- ls -li
- export NEXT_VERSION="$(cat app_new.version)"
# - flutter pub get
# - flutter pub get
- export PATH="/opt/homebrew/bin:$PATH"
- eval "$(rbenv init -)"
- bundle config mirror.https://rubygems.org https://gems.ruby-china.com
- bundle install --gemfile android/Gemfile --quiet
- rbenv global 2.6.10 # 你实际用的 Ruby 版本
- ruby -v
- which ruby
- gem env
- bundle config mirror.https://rubygems.org https://mirrors.aliyun.com/rubygems/
- bundle install --gemfile android/Gemfile --path vendor/bundle_android --quiet
cache:
paths:
- app_new.version
@ -74,13 +80,19 @@ variables:
.setup_fastlane_ios:
extends: .build_rule
before_script:
- export PUB_HOSTED_URL=https://pub.flutter-io.cn
- export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
- ls -li
- export NEXT_VERSION="$(cat app_new.version)"
# - flutter pub get
- flutter pub get
- export PATH="/opt/homebrew/bin:$PATH"
- eval "$(rbenv init -)"
- bundle config mirror.https://rubygems.org https://gems.ruby-china.com
- bundle install --gemfile ios/Gemfile --quiet
- rbenv global 2.6.10 # 你实际用的 Ruby 版本
- ruby -v
- which ruby
- gem env
- bundle config mirror.https://rubygems.org https://mirrors.aliyun.com/rubygems/
- bundle install --gemfile ios/Gemfile --path vendor/bundle_ios --quiet
cache:
paths:
- app_new.version
@ -99,7 +111,6 @@ generate_git_tag:
extends: .generate_tag_rule
before_script:
- bash pre_build.sh xhj
- bash pre_build.sh sky
- project_url=$(echo $CI_PROJECT_URL | sed 's/http:\/\///')
- echo "project_url:$project_url"
- echo "CI_SERVER_FQDN:$CI_SERVER_FQDN/CI_PROJECT_ROOT_NAMESPACE:$CI_PROJECT_ROOT_NAMESPACE/CI_PROJECT_NAME:$CI_PROJECT_NAME"

View File

@ -13,20 +13,14 @@ if [[ "${ENV_BUILD_BRANCH}" == "canary_release" ]]; then
echo "===build canary_release: ${NEXT_VERSION}"
export ENV_BUILD_TAG=${NEXT_VERSION}
bundle exec fastlane release_apk flavor:xhj --verbose
bundle exec fastlane release_apk flavor:sky --verbose
elif [[ $ENV_BUILD_TAG =~ $regex ]]; then
echo "===build release===$ENV_BUILD_TAG"
bundle exec fastlane release_apk flavor:xhj --verbose
bundle exec fastlane release_apk flavor:sky --verbose
bundle exec fastlane release_bundle flavor:xhj_bundle --verbose
bundle exec fastlane release_bundle flavor:sky --verbose
elif [[ "${ENV_BUILD_BRANCH}" == "develop" ]]; then
echo "===build dev===${NEXT_VERSION}"
bundle exec fastlane beta flavor:xhj env:dev --verbose
bundle exec fastlane beta flavor:sky env:dev --verbose
elif [[ "${ENV_BUILD_BRANCH}" == "release" ]] || [[ "${ENV_BUILD_BRANCH}" == "feat_devops" ]] ; then
echo "===build pre===${NEXT_VERSION}"
bundle exec fastlane beta flavor:xhj env:pre --verbose
bundle exec fastlane beta flavor:sky env:pre --verbose
fi
exit 0

View File

@ -14,18 +14,14 @@ if [[ "${ENV_BUILD_BRANCH}" == "canary_release" ]]; then
echo "===build canary_release: ${NEXT_VERSION}"
export ENV_BUILD_TAG=${NEXT_VERSION}
bundle exec fastlane release_ipa flavor:xhj --verbose
bundle exec fastlane release_ipa flavor:sky --verbose
elif [[ $ENV_BUILD_TAG =~ $regex ]]; then
echo "===build release===$ENV_BUILD_TAG"
bundle exec fastlane release_ipa flavor:xhj --verbose
bundle exec fastlane release_ipa flavor:sky --verbose
elif [[ "${ENV_BUILD_BRANCH}" == "develop" ]]; then
echo "===build dev===${NEXT_VERSION}"
bundle exec fastlane beta flavor:xhj env:Dev --verbose
bundle exec fastlane beta flavor:sky env:Dev --verbose
elif [[ "${ENV_BUILD_BRANCH}" == "release" ]] || [[ "${ENV_BUILD_BRANCH}" == "feat_devops" ]] ; then
echo "===build pre===${NEXT_VERSION}"
bundle exec fastlane beta flavor:xhj env:Pre --verbose
bundle exec fastlane beta flavor:sky env:Pre --verbose
fi
exit 0

View File

@ -1,9 +1,9 @@
import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
import '../../../../../blue/blue_manage.dart';
import '../../../../../blue/io_protocol/io_changeAdministratorPassword.dart';
@ -18,14 +18,16 @@ import '../../../../../tools/eventBusEventManage.dart';
import '../../../../../tools/storage.dart';
import 'adminOpenLockPassword_state.dart';
class AdminOpenLockPasswordLogic extends BaseGetXController{
class AdminOpenLockPasswordLogic extends BaseGetXController {
final AdminOpenLockPasswordState state = AdminOpenLockPasswordState();
//
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if (reply is ChangeAdministratorPasswordReply && state.ifCurrentScreen.value == true) {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if (reply is ChangeAdministratorPasswordReply &&
state.ifCurrentScreen.value == true) {
_replyChangeAdministratorPassword(reply);
}
@ -49,11 +51,14 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
break;
case 0x06:
//
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
final List<String>? signKey =
await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<int> token = reply.data.sublist(5, 9);
final List<String> saveStrList = changeIntListToStringList(token);
@ -63,7 +68,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
pwdNo: state.lockBasicInfo.value.lockUserNo!,
pwd:state.changePwdController.text,
pwd: state.changePwdController.text,
useCountLimit: 0xffff,
startTime: 0,
endTime: 0,
@ -179,23 +184,27 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
// (//5)
Future<void> changeAdministratorPasswordCommand() async {
if(state.sureBtnState.value == 1){
if (state.sureBtnState.value == 1) {
return;
}
state.sureBtnState.value = 1;
showEasyLoading();
showBlueConnetctToastTimer(action: (){
showBlueConnetctToastTimer(action: () {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
final List<String>? signKey =
await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
@ -204,7 +213,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
pwdNo: state.lockBasicInfo.value.lockUserNo!,
pwd:state.changePwdController.text,
pwd: state.changePwdController.text,
useCountLimit: 0xffff,
startTime: 0,
endTime: 0,
@ -213,11 +222,12 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
signKey: signKeyDataList,
privateKey: getPrivateKeyList,
token: getTokenList);
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
} else if (deviceConnectionState ==
BluetoothConnectionState.disconnected) {
state.sureBtnState.value = 0;
dismissEasyLoading();
cancelBlueConnetctToastTimer();
if(state.ifCurrentScreen.value == true){
if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast();
}
}
@ -226,25 +236,62 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
//
Future<void> addLockAdminPassword(bool isChange) async {
final GetServerDatetimeEntity entity = await ApiRepository.to.setAdminPasswordData(
final GetServerDatetimeEntity entity =
await ApiRepository.to.setAdminPasswordData(
lockId: state.lockSetInfoData.value.lockBasicInfo!.lockId!,
adminPwd: state.adminPwd.value,
);
if (entity.errorCode!.codeIsSuccessful) {
if(isChange == true){
showToast('修改成功'.tr, something: (){
if (isChange == true) {
showToast('修改成功'.tr, something: () {
state.lockBasicInfo.value.adminPwd = state.adminPwd.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire(
PassCurrentLockInformationEvent(state.lockSetInfoData.value));
});
}else{
showToast('上传成功'.tr, something: (){
} else {
showToast('上传成功'.tr, something: () {
state.lockBasicInfo.value.adminPwd = state.adminPwd.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire(
PassCurrentLockInformationEvent(state.lockSetInfoData.value));
});
}
}
}
///
///
/// :
/// - true: 使
/// - false: 使
Future<bool> checkPassword() async {
try {
if (state.lockSetInfoData.value.lockBasicInfo?.lockId == null) {
showToast('锁ID不能为空'.tr);
return false;
}
if (state.adminPwd.value.isEmpty) {
showToast('密码不能为空'.tr);
return false;
}
final PasswordKeyEntity entity = await ApiRepository.to.checkAdminPwd(
lockId: state.lockSetInfoData.value.lockBasicInfo!.lockId!,
adminPwd: state.changePwdController.text,
);
if (entity.errorCode!.codeIsSuccessful) {
return true;
} else {
showToast(entity.errorMsg ?? '已存在相同的密码,请更换。');
return false;
}
} catch (e) {
showToast('检查密码失败'.tr);
return false;
}
}
@override
void onReady() {
super.onReady();
@ -257,5 +304,4 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
super.onClose();
_replySubscription.cancel();
}
}

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
@ -16,12 +15,16 @@ class AdminOpenLockPasswordPage extends StatefulWidget {
const AdminOpenLockPasswordPage({Key? key}) : super(key: key);
@override
State<AdminOpenLockPasswordPage> createState() => _AdminOpenLockPasswordPageState();
State<AdminOpenLockPasswordPage> createState() =>
_AdminOpenLockPasswordPageState();
}
class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> with RouteAware {
final AdminOpenLockPasswordLogic logic = Get.put(AdminOpenLockPasswordLogic());
final AdminOpenLockPasswordState state = Get.find<AdminOpenLockPasswordLogic>().state;
class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage>
with RouteAware {
final AdminOpenLockPasswordLogic logic =
Get.put(AdminOpenLockPasswordLogic());
final AdminOpenLockPasswordState state =
Get.find<AdminOpenLockPasswordLogic>().state;
@override
Widget build(BuildContext context) {
@ -95,20 +98,29 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
LengthLimitingTextInputFormatter(9),
],
controller: state.changePwdController,
sureClick: () {
if(state.changePwdController.text.length < 6){
sureClick: () async {
if (state.changePwdController.text.length < 6) {
logic.showToast('请输入6-9位管理员密码'.tr);
return;
}
if(state.changePwdController.text == state.lockBasicInfo.value.adminPwd!){
if (state.changePwdController.text ==
state.lockBasicInfo.value.adminPwd!) {
logic.showToast('请输入新的管理员密码'.tr);
return;
}
//
final bool isPasswordAvailable = await logic.checkPassword();
if (!isPasswordAvailable) {
state.changePwdController.clear();
return; //
}
Get.back();
logic.changeAdministratorPasswordCommand();
},
cancelClick: () {
state.changePwdController.clear();
Get.back();
},
);

View File

@ -133,20 +133,20 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
}
});
})),
Obx(() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1,
child: CommonItem(
leftTitel: '管理员开锁密码'.tr,
rightTitle: state.lockBasicInfo.value.adminPwd,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.adminOpenLockPasswordPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}),
)),
// Obx(() => Visibility(
// visible: state.lockBasicInfo.value.isLockOwner == 1,
// child: CommonItem(
// leftTitel: '管理员开锁密码'.tr,
// rightTitle: state.lockBasicInfo.value.adminPwd,
// isHaveLine: true,
// isHaveDirection: true,
// action: () {
// Get.toNamed(Routers.adminOpenLockPasswordPage,
// arguments: <String, LockSetInfoData>{
// 'lockSetInfoData': state.lockSetInfoData.value
// });
// }),
// )),
Obx(() => Visibility(
visible: (state.lockBasicInfo.value.lockName ?? '')
.contains('T9A'),

View File

@ -99,7 +99,7 @@ class _LockSetPageState extends State<LockSetPage>
CommonItem(
leftTitel: '基本信息'.tr,
rightTitle: '',
isHaveLine: false,
isHaveLine: state.lockBasicInfo.value.isLockOwner == 1,
isHaveDirection: true,
action: () {
if (!state.lockSetInfoData.value.isValid()) {
@ -111,6 +111,25 @@ class _LockSetPageState extends State<LockSetPage>
'lockSetInfoData': state.lockSetInfoData.value
});
}),
//
Obx(() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1,
child: CommonItem(
leftTitel: '管理员开锁密码'.tr,
rightTitle: state.lockBasicInfo.value.adminPwd,
isHaveLine: false,
isHaveDirection: true,
action: () {
if (!state.lockSetInfoData.value.isValid()) {
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr);
return;
}
Get.toNamed(Routers.adminOpenLockPasswordPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}),
)),
SizedBox(height: 10.h),
//
Obx(() => Visibility(
@ -201,7 +220,7 @@ class _LockSetPageState extends State<LockSetPage>
CommonItem(
leftTitel: '基本信息'.tr,
rightTitle: '',
isHaveLine: false,
isHaveLine: state.lockBasicInfo.value.isLockOwner == 1,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.basicInformationPage,
@ -209,6 +228,25 @@ class _LockSetPageState extends State<LockSetPage>
'lockSetInfoData': state.lockSetInfoData.value
});
}),
//
Obx(() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1,
child: CommonItem(
leftTitel: '管理员开锁密码'.tr,
rightTitle: state.lockBasicInfo.value.adminPwd,
isHaveLine: true,
isHaveDirection: true,
action: () {
if (!state.lockSetInfoData.value.isValid()) {
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr);
return;
}
Get.toNamed(Routers.adminOpenLockPasswordPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}),
)),
SizedBox(height: 10.h),
//by DaisyWu
//

View File

@ -49,6 +49,8 @@ abstract class Api {
final String passwordKeyAddURL = '/keyboardPwd/add'; //
final String passwordKeyCheckKeyboardpwdNameURL =
'/keyboardPwd/checkKeyboardpwdName'; //
final String adminPwdCheckKeyboardPwdURL =
'/keyboardPwd/checkKeyboardPwd'; //
final String updatePasswordKeyURL = '/keyboardPwd/update'; //
final String updatePWDNumberURL = '/keyboardPwd/updatePwdUserNo'; //
final String clearOperationRecordURL = '/lockRecords/clear'; //

View File

@ -562,6 +562,14 @@ class ApiProvider extends BaseProvider {
'keyboardPwd': keyboardPwd,
}));
//
Future<Response> checkAdminPwd(int lockId, String keyboardPwd) => post(
adminPwdCheckKeyboardPwdURL.toUrl,
jsonEncode({
'lockId': lockId,
'keyboardPwd': keyboardPwd,
}));
Future<Response> updateKeyboardPwd(
int lockId,
String keyboardPwdId,

View File

@ -579,6 +579,13 @@ class ApiRepository {
return PasswordKeyEntity.fromJson(res.body);
}
//
Future<PasswordKeyEntity> checkAdminPwd(
{required int lockId, required String adminPwd}) async {
final res = await apiProvider.checkAdminPwd(lockId, adminPwd);
return PasswordKeyEntity.fromJson(res.body);
}
//
Future<PasswordKeyEntity> updatePasswordKey(
{required int lockId,

View File

@ -10,17 +10,21 @@ echo "PRIVATE-TOKEN: $TOKEN $URL/projects/$PROJECT_ID/repository/tags"
tags_json=$(curl -H "Content-Type: application/json" -H "PRIVATE-TOKEN: $TOKEN" "$URL/projects/$PROJECT_ID/repository/tags")
#echo "tags_json:$tags_json\n"
tags=$(echo "$tags_json" | jq -r '.[].name')
# 只保留不带 _sky 后缀的 tag 作为最新 tag
plain_tags=$(echo "$tags" | grep -v '_sky$')
latest_tag=$(echo "$plain_tags" | head -n 1)
tags_length=$(echo "$tags_json" | jq -r 'length')
if [ "$tags_length" -lt 1 ]; then
next_tag="v1.0.0"
else
newest_tag=$(echo "$tags" | head -n 1)
IFS='.' read -r major minor patch <<< "$newest_tag"
IFS='.' read -r major minor patch <<< "$latest_tag"
major="${major#v}"
compare_json=""
if [[ "$1" == "generate_tag" ]];then
echo "generate_tag:$newest_tag-to-master\n"
compare_json=$(curl -s --header "PRIVATE-TOKEN: $TOKEN" "$URL/projects/$PROJECT_ID/repository/compare?from=$newest_tag&to=master")
echo "generate_tag:$latest_tag-to-master\n"
compare_json=$(curl -s --header "PRIVATE-TOKEN: $TOKEN" "$URL/projects/$PROJECT_ID/repository/compare?from=$latest_tag&to=master")
elif [[ "$1" == "generate_version" ]]; then
echo "generate_version:master-to-$CI_COMMIT_BRANCH\n"
compare_json=$(curl -s --header "PRIVATE-TOKEN: $TOKEN" "$URL/projects/$PROJECT_ID/repository/compare?from=master&to=$CI_COMMIT_BRANCH")
@ -45,9 +49,9 @@ else
done < <(echo "$compare_json" | jq -c '.commits[] | {id: .id, message: .message}')
next_tag="v$major.$new_minor.$new_patch"
fi
echo "New Tag:$newest_tag;New version: $next_tag;command: $1"
echo "New Tag:$latest_tag;New version: $next_tag;command: $1"
if [[ "$1" == "generate_tag" ]];then
if [ "$next_tag" == "$newest_tag" ]; then
if [ "$next_tag" == "$latest_tag" ]; then
echo "no change from master,skip to generate tag"
exit 0
fi