chore: commit all changes (2025-11-04)
This commit is contained in:
@@ -1,6 +1,64 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env bash
|
||||||
# Docker deployment script
|
# Docker deployment script with safety checks
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
|
prompt_yes_no() {
|
||||||
|
local prompt="$1"
|
||||||
|
local default_no_text="${2:-[y/N]}"
|
||||||
|
local answer
|
||||||
|
read -r -p "$prompt $default_no_text " answer || true
|
||||||
|
answer="${answer:-}"; answer="${answer,,}"
|
||||||
|
[[ "$answer" == "y" || "$answer" == "yes" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "=== 部署前检查开始 ==="
|
||||||
|
|
||||||
|
if ! git -C "$SCRIPT_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||||
|
echo "错误: 当前目录不在 Git 仓库内,无法继续。"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CURRENT_BRANCH=$(git -C "$SCRIPT_DIR" rev-parse --abbrev-ref HEAD)
|
||||||
|
if [[ "$CURRENT_BRANCH" != "master" ]]; then
|
||||||
|
echo "错误: 当前分支为 '$CURRENT_BRANCH'。仅允许在 master 分支上部署。"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! prompt_yes_no "你跑测试了吗?要不要我帮你跑?"; then
|
||||||
|
echo "跳过测试执行。"
|
||||||
|
else
|
||||||
|
echo "开始执行测试: mvn test"
|
||||||
|
if ! mvn test; then
|
||||||
|
echo "测试未通过,部署流程终止。"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "测试通过。"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! prompt_yes_no "你备份数据库了吗?确认已备份请输入 y"; then
|
||||||
|
echo "请先完成数据库备份,再运行部署脚本。"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! prompt_yes_no "你 commit 了吗?确认已提交请输入 y"; then
|
||||||
|
echo "请在提交后再运行部署脚本。"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git -C "$SCRIPT_DIR" diff --quiet; then
|
||||||
|
echo "错误: 检测到未暂存的本地修改,请处理后再试。"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git -C "$SCRIPT_DIR" diff --cached --quiet; then
|
||||||
|
echo "错误: 检测到未提交的暂存修改,请提交后再试。"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "部署前检查通过。"
|
||||||
|
|
||||||
# Get current time and format it
|
# Get current time and format it
|
||||||
current_time=$(date +"%Y-%m-%d %H:%M:%S")
|
current_time=$(date +"%Y-%m-%d %H:%M:%S")
|
||||||
|
|||||||
@@ -55,4 +55,7 @@ public class PlayClerkLevelAddVo {
|
|||||||
@ApiModelProperty(value = "非首次随机单比例", example = "65", notes = "非首次随机单提成比例,范围0-100%")
|
@ApiModelProperty(value = "非首次随机单比例", example = "65", notes = "非首次随机单提成比例,范围0-100%")
|
||||||
private Integer notFirstRandomRadio;
|
private Integer notFirstRandomRadio;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序号", example = "1", notes = "越小的等级在列表越靠前")
|
||||||
|
private Long orderNumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,9 @@ public class PlayClerkLevelInfoServiceImpl extends ServiceImpl<PlayClerkLevelInf
|
|||||||
}
|
}
|
||||||
playClerkLevelInfo.setCreatedTime(new Date());
|
playClerkLevelInfo.setCreatedTime(new Date());
|
||||||
playClerkLevelInfo.setStyleType(playClerkLevelInfo.getLevel());
|
playClerkLevelInfo.setStyleType(playClerkLevelInfo.getLevel());
|
||||||
|
if (playClerkLevelInfo.getOrderNumber() == null) {
|
||||||
|
playClerkLevelInfo.setOrderNumber(playClerkLevelInfo.getLevel().longValue());
|
||||||
|
}
|
||||||
return save(playClerkLevelInfo);
|
return save(playClerkLevelInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,7 @@
|
|||||||
SET @column_exists := (
|
ALTER TABLE `play_clerk_level_info`
|
||||||
SELECT COUNT(*)
|
ADD COLUMN `order_number` BIGINT NULL COMMENT '等级排序号'
|
||||||
FROM information_schema.COLUMNS
|
AFTER `style_image_url`;
|
||||||
WHERE TABLE_SCHEMA = DATABASE()
|
|
||||||
AND TABLE_NAME = 'play_clerk_level_info'
|
|
||||||
AND COLUMN_NAME = 'order_number'
|
|
||||||
);
|
|
||||||
|
|
||||||
SET @ddl := IF(
|
|
||||||
@column_exists = 0,
|
|
||||||
'ALTER TABLE `play_clerk_level_info` ADD COLUMN `order_number` bigint NULL COMMENT ''等级排序号''',
|
|
||||||
'SELECT 1'
|
|
||||||
);
|
|
||||||
|
|
||||||
PREPARE stmt FROM @ddl;
|
|
||||||
EXECUTE stmt;
|
|
||||||
DEALLOCATE PREPARE stmt;
|
|
||||||
|
|
||||||
UPDATE `play_clerk_level_info`
|
UPDATE `play_clerk_level_info`
|
||||||
SET `order_number` = COALESCE(`order_number`, `level`);
|
SET `order_number` = `level`
|
||||||
|
WHERE `order_number` IS NULL;
|
||||||
Reference in New Issue
Block a user