Compare commits
25 Commits
8e51ca8930
...
master-v2
| Author | SHA1 | Date | |
|---|---|---|---|
| 68092759d3 | |||
| 8702cb0571 | |||
| ca620eb536 | |||
| 8684fdc9f0 | |||
| d72868eb76 | |||
| 6ff65afcb5 | |||
| b689a40595 | |||
| f9f8a1e169 | |||
| 3dbd68829a | |||
| 333e85f7d9 | |||
| db0e420a8f | |||
| f63616e735 | |||
| bdf50e61f5 | |||
| e7b8f4cae9 | |||
| d4cf708bc1 | |||
| eb8123c7b3 | |||
| 683bd5d97a | |||
| 150d31eac5 | |||
| 1892c7bcb7 | |||
| 5b5e923a0b | |||
| f6b4fb99f0 | |||
| 216d3ac8fe | |||
| c790f74905 | |||
| 4a7397ce04 | |||
| 861d5c49b3 |
272
API对接文档.md
Normal file
272
API对接文档.md
Normal file
@@ -0,0 +1,272 @@
|
||||
# 大富翁-摇色子 对接文档
|
||||
|
||||
本文覆盖**平台侧对接接口**(`/api/v1/*`,使用 `auth-token` 鉴权)以及(可选)**玩家侧接口**(`/api/*`,使用 `token` 鉴权)。
|
||||
|
||||
---
|
||||
|
||||
## 1. 基本约定
|
||||
|
||||
### 1.1 服务地址(Base URL)
|
||||
|
||||
由部署方提供:
|
||||
|
||||
- 测试环境:`https://dice-api.yuliao666.top`
|
||||
|
||||
下文所有路径均为相对路径,如:`/api/v1/getGameUrl`。
|
||||
|
||||
### 1.2 请求方式与编码
|
||||
|
||||
- **请求方法**:项目路由多数使用 `Route::any`,对接建议统一使用 **POST**(便于 body 传参);个别接口文档中标注了 GET 参数。
|
||||
- **编码**:`UTF-8`
|
||||
- **Content-Type**:建议 `application/x-www-form-urlencoded` 或 `application/json`(以平台实际实现为准)
|
||||
|
||||
### 1.3 统一返回结构
|
||||
|
||||
所有接口统一返回 JSON:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": {}
|
||||
}
|
||||
```
|
||||
|
||||
- `code`:业务状态码(见“返回 code 对照表”)
|
||||
- `message`:提示信息(可根据请求头 `lang` 返回中英文)
|
||||
- `data`:成功时返回数据;失败时通常不返回该字段
|
||||
|
||||
### 1.4 多语言(lang)
|
||||
|
||||
服务端会根据请求头 `lang` 翻译 `message`(以及部分接口字段):
|
||||
|
||||
- `lang: zh`(默认)
|
||||
- `lang: en`
|
||||
|
||||
> 注意:平台 v1 接口的 `getGameUrl` 还支持 body 参数 `lang`(`zh/en`),用于拼接游戏地址语言参数。
|
||||
|
||||
---
|
||||
|
||||
## 2. 鉴权与对接流程(平台侧 /api/v1)
|
||||
|
||||
平台侧接口分两步:
|
||||
|
||||
1. **获取 `auth-token`**
|
||||
2. **携带 `auth-token` 调用 `/api/v1/*` 业务接口**
|
||||
|
||||
### 2.1 获取 auth-token
|
||||
|
||||
- **路径**:`/api/v1/authToken`
|
||||
- **方法**:GET / POST 均可(建议 GET,参数放 query)
|
||||
- **说明**:用于平台调用 v1 业务接口的授权 token(JWT)
|
||||
|
||||
#### 请求参数(query/body)
|
||||
|
||||
| 参数名 | 必填 | 类型 | 说明 |
|
||||
| --- | --- | --- |---------------------------------------------------|
|
||||
| agent_id | 是 | string | 平台/代理标识(后台查看对应管理员agent_id) |
|
||||
| secret | 是 | string | 双方约定的密钥(服务端配置 `xF75oK91TQj13s0UmNIr1NBWMWGfflNO`) |
|
||||
| time | 是 | int/string | Unix 时间戳(秒),服务端会做时间容忍校验 |
|
||||
| signature | 是 | string | 签名:`md5(agent_id + secret + time)` |
|
||||
- **agent_id**:通过后台获取系统管理-用户管理-代理ID
|
||||
- **secret**:xF75oK91TQj13s0UmNIr1NBWMWGfflNO(服务器配置)
|
||||
- **后台地址**:https://dice.yuliao666.top 账号: zhuguan 密码:123456
|
||||
#### 签名规则
|
||||
|
||||
- **签名字符串**:直接拼接 `agent_id.secret.time`(无分隔符)
|
||||
- **算法**:MD5(32 位小写/大写均可,按实现一致即可)
|
||||
|
||||
示例(伪代码):
|
||||
|
||||
```text
|
||||
signature = md5(agent_id + secret + time)
|
||||
```
|
||||
|
||||
#### 响应示例
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": {
|
||||
"authtoken": "xxxx.yyyy.zzzz"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 失败场景
|
||||
|
||||
- 缺少参数:`code=400`
|
||||
- 密钥错误/签名错误/时间戳无效:`code=403`
|
||||
- 服务端未配置密钥或生成失败:`code=500`
|
||||
|
||||
### 2.2 调用 v1 业务接口(携带 auth-token)
|
||||
|
||||
除 `/api/v1/authToken` 外,其余 `/api/v1/*` 接口需要在请求头携带:
|
||||
|
||||
- `auth-token: <authtoken>`
|
||||
|
||||
当 `auth-token` 过期或失效,返回 `code=402`,需要重新调用 `/api/v1/authToken` 获取新 token。
|
||||
|
||||
---
|
||||
|
||||
## 3. 平台 v1 业务接口清单(/api/v1)
|
||||
|
||||
### 3.1 获取游戏地址
|
||||
|
||||
- **路径**:`/api/v1/getGameUrl`
|
||||
- **方法**:POST
|
||||
- **请求头**:`auth-token`
|
||||
- **说明**:根据平台用户名创建/登录玩家并生成登录 JWT,返回可直接打开的游戏地址。
|
||||
|
||||
#### 请求参数(body)
|
||||
|
||||
| 参数名 | 必填 | 类型 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| username | 是 | string | 玩家唯一账号(平台侧用户名) |
|
||||
| password | 否 | string | 默认 `123456` |
|
||||
| time | 否 | int/string | 默认当前时间戳 |
|
||||
| lang | 否 | string | `zh` / `en`,默认 `zh` |
|
||||
|
||||
#### 响应示例
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": {
|
||||
"url": "https://dice-game.yuliao666.top/?token=...&lang=zh"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3.2 获取用户信息
|
||||
|
||||
- **路径**:`/api/v1/getPlayerInfo`
|
||||
- **方法**:POST
|
||||
- **请求头**:`auth-token`
|
||||
|
||||
#### 请求参数
|
||||
|
||||
| 参数名 | 必填 | 类型 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| username | 是 | string | 玩家账号 |
|
||||
|
||||
#### 响应说明
|
||||
|
||||
返回玩家基础信息(已隐藏敏感字段,如 `password` 等)。
|
||||
|
||||
### 3.3 获取游戏记录
|
||||
|
||||
- **路径**:`/api/v1/getPlayerGameRecord`
|
||||
- **方法**:POST
|
||||
- **请求头**:`auth-token`
|
||||
|
||||
#### 请求参数
|
||||
|
||||
| 参数名 | 必填 | 类型 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| username | 否 | string | 不传则查询全量(按时间/分页) |
|
||||
| start_create_time | 否 | string | 开始时间(与数据库存储格式一致) |
|
||||
| end_create_time | 否 | string | 结束时间(与数据库存储格式一致) |
|
||||
| page | 否 | int | 默认 1 |
|
||||
| limit | 否 | int | 默认 20,最大 100 |
|
||||
|
||||
#### 响应说明
|
||||
|
||||
返回游玩记录列表,并附带 `dice_player`(包含 `id/username/phone`)。
|
||||
|
||||
### 3.4 获取钱包流水
|
||||
|
||||
- **路径**:`/api/v1/getPlayerWalletRecord`
|
||||
- **方法**:POST
|
||||
- **请求头**:`auth-token`
|
||||
|
||||
参数与分页规则同 3.3,返回钱包流水列表(附带 `dice_player`)。
|
||||
|
||||
### 3.5 获取中奖券获取记录
|
||||
|
||||
- **路径**:`/api/v1/getPlayerTicketRecord`
|
||||
- **方法**:POST
|
||||
- **请求头**:`auth-token`
|
||||
|
||||
参数与分页规则同 3.3,返回中奖券记录列表(附带 `dice_player`)。
|
||||
|
||||
### 3.6 平台钱包转入/转出
|
||||
|
||||
- **路径**:`/api/v1/setPlayerWallet`
|
||||
- **方法**:POST
|
||||
- **请求头**:`auth-token`
|
||||
- **说明**:平台为玩家加币/扣币,生成钱包流水。
|
||||
|
||||
#### 请求参数
|
||||
|
||||
| 参数名 | 必填 | 类型 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| username | 是 | string | 玩家账号 |
|
||||
| coin | 是 | number | 转入:`>0`;转出:`<0`;不允许为 0 |
|
||||
|
||||
#### 业务规则
|
||||
|
||||
- 当 `coin < 0` 且余额不足时:`code=422`,`message=余额不足,无法转出`
|
||||
|
||||
---
|
||||
|
||||
## 4. 玩家侧接口(可选 /api)
|
||||
|
||||
若甲方平台需要在**服务端**直接调用“购买抽奖券/开局”等接口,可按本节对接(此类接口需要 `token`,与 `auth-token` 不同)。
|
||||
|
||||
### 4.1 获取 token(玩家登录)
|
||||
|
||||
- **路径**:`/api/user/Login`
|
||||
- **方法**:POST
|
||||
- **说明**:创建/登录玩家并返回登录 token 以及游戏地址。
|
||||
|
||||
请求参数:`username`、`password`(必填),`lang/coin/time`(可选)。
|
||||
|
||||
响应 `data.token` 可用于后续 `/api/*` 请求头 `token` 或 `Authorization: Bearer <token>`。
|
||||
|
||||
### 4.2 需要 token 的接口
|
||||
|
||||
请求头携带(任选一种):
|
||||
|
||||
- `token: <token>`
|
||||
- `Authorization: Bearer <token>`
|
||||
|
||||
接口列表:
|
||||
|
||||
- `/api/user/logout`
|
||||
- `/api/user/info`
|
||||
- `/api/user/balance`
|
||||
- `/api/user/walletRecord`
|
||||
- `/api/user/playGameRecord`
|
||||
- `/api/game/config`
|
||||
- `/api/game/buyLotteryTickets`
|
||||
- `/api/game/lotteryPool`
|
||||
- `/api/game/playStart`
|
||||
|
||||
---
|
||||
|
||||
## 5. 返回 code 对照表
|
||||
|
||||
项目定义的统一状态码如下(与 HTTP 语义对齐):
|
||||
|
||||
| code | 含义 | 常见场景 |
|
||||
| --- | --- | --- |
|
||||
| 200 | 成功 | 请求成功 |
|
||||
| 400 | 请求参数错误 | 缺参、参数格式不合法、范围错误 |
|
||||
| 401 | 未授权 | 未携带 `auth-token` 或 `token` |
|
||||
| 402 | token 无效或已过期 | `auth-token/token` 过期、签名错误、被挤下线等 |
|
||||
| 403 | 鉴权失败 | `secret` 错误、签名验证失败、时间戳无效等 |
|
||||
| 404 | 资源不存在 | 用户不存在等 |
|
||||
| 422 | 业务逻辑错误 | 余额不足、业务校验失败等 |
|
||||
| 500 | 服务器内部错误 | 服务端异常或配置缺失 |
|
||||
|
||||
---
|
||||
|
||||
## 6. 联调建议
|
||||
|
||||
- **时间戳校验**:`/api/v1/authToken` 会校验 `time` 与服务器时间差(默认容忍 300 秒),请确保平台服务器时间同步。
|
||||
- **token 失效处理**:当 `code=402` 时,按业务类型重新获取 `auth-token` 或重新登录获取 `token`。
|
||||
- **语言**:如需英文提示,请在请求头带 `lang: en`。
|
||||
|
||||
@@ -117,7 +117,8 @@
|
||||
right: 0,
|
||||
left: 0,
|
||||
bottom: 0, // 增加底部间距
|
||||
containLabel: true
|
||||
outerBoundsMode: 'same' as const,
|
||||
outerBoundsContain: 'axisLabel' as const
|
||||
}
|
||||
|
||||
const options: EChartsOption = {
|
||||
|
||||
@@ -75,7 +75,8 @@
|
||||
right: 20,
|
||||
bottom: props.showDataZoom ? 80 : 20,
|
||||
left: 20,
|
||||
containLabel: true
|
||||
outerBoundsMode: 'same',
|
||||
outerBoundsContain: 'axisLabel'
|
||||
},
|
||||
tooltip: getTooltipStyle('axis', {
|
||||
axisPointer: {
|
||||
|
||||
@@ -64,7 +64,8 @@
|
||||
right: 20,
|
||||
bottom: 20,
|
||||
left: 20,
|
||||
containLabel: true
|
||||
outerBoundsMode: 'same',
|
||||
outerBoundsContain: 'axisLabel'
|
||||
},
|
||||
tooltip: props.showTooltip
|
||||
? getTooltipStyle('item', {
|
||||
|
||||
@@ -178,6 +178,7 @@
|
||||
import { useMenuStore } from '@/store/modules/menu'
|
||||
import AppConfig from '@/config'
|
||||
import { languageOptions } from '@/locales'
|
||||
import { invalidatePageLocaleCache, loadPageLocale } from '@/locales/pageLocaleLoader'
|
||||
import { mittBus } from '@/utils/sys'
|
||||
import { themeAnimation } from '@/utils/ui/animation'
|
||||
import { useCommon } from '@/hooks/core/useCommon'
|
||||
@@ -284,11 +285,12 @@
|
||||
* 切换系统语言
|
||||
* @param {LanguageEnum} lang - 目标语言类型
|
||||
*/
|
||||
const changeLanguage = (lang: LanguageEnum): void => {
|
||||
const changeLanguage = async (lang: LanguageEnum): Promise<void> => {
|
||||
if (locale.value === lang) return
|
||||
locale.value = lang
|
||||
userStore.setLanguage(lang)
|
||||
reload(50)
|
||||
invalidatePageLocaleCache()
|
||||
await loadPageLocale(router.currentRoute.value.path)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</li>
|
||||
<li class="btn-item" @click="clearCache()">
|
||||
<ArtSvgIcon icon="ri:eraser-line" />
|
||||
<span>清除缓存</span>
|
||||
<span>{{ $t('topBar.user.clearCache') }}</span>
|
||||
</li>
|
||||
<li class="btn-item" @click="lockScreen()">
|
||||
<ArtSvgIcon icon="ri:lock-line" />
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
:disabled="item.disabled"
|
||||
class="flex-1 min-w-0 [&_.el-checkbox__label]:overflow-hidden [&_.el-checkbox__label]:text-ellipsis [&_.el-checkbox__label]:whitespace-nowrap"
|
||||
>{{
|
||||
item.label || (item.type === 'selection' ? t('table.selection') : '')
|
||||
getColumnDisplayLabel(item.label, item.type)
|
||||
}}</ElCheckbox
|
||||
>
|
||||
</div>
|
||||
@@ -173,6 +173,15 @@
|
||||
(e: 'update:showSearchBar', value: boolean): void
|
||||
}>()
|
||||
|
||||
/** 列标题显示:table./page. 开头的 key 用 t() 翻译,随语言切换更新 */
|
||||
const getColumnDisplayLabel = (label: unknown, type?: string): string => {
|
||||
if (type === 'selection') return t('table.selection')
|
||||
if (label && typeof label === 'string' && (label.startsWith('table.') || label.startsWith('page.'))) {
|
||||
return t(label)
|
||||
}
|
||||
return (label as string) || ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列的显示状态
|
||||
* 优先使用 visible 字段,如果不存在则使用 checked 字段
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
v-bind="{ ...$attrs, ...props, height, stripe, border, size, headerCellStyle }"
|
||||
@sort-change="handleSortChange"
|
||||
>
|
||||
<template v-for="col in columns" :key="col.prop || col.type">
|
||||
<template v-for="col in displayColumns" :key="col.prop || col.type">
|
||||
<!-- 渲染全局序号列 -->
|
||||
<ElTableColumn v-if="col.type === 'globalIndex'" v-bind="{ ...col }">
|
||||
<template #default="{ $index }">
|
||||
@@ -138,6 +138,7 @@
|
||||
import { useCommon } from '@/hooks/core/useCommon'
|
||||
import { useTableHeight } from '@/hooks/core/useTableHeight'
|
||||
import { useResizeObserver, useWindowSize } from '@vueuse/core'
|
||||
import i18n, { $t } from '@/locales'
|
||||
|
||||
defineOptions({ name: 'ArtTable' })
|
||||
|
||||
@@ -307,6 +308,21 @@
|
||||
// 是否显示分页器
|
||||
const showPagination = computed(() => props.pagination && !isEmpty.value)
|
||||
|
||||
/** 表头 label 为 table. 或 page. 开头的 i18n key 时自动翻译,切换语言后表头随动 */
|
||||
const displayColumns = computed(() => {
|
||||
const list = props.columns || []
|
||||
const localeRef = i18n.global.locale as { value?: string }
|
||||
const currentLocale = localeRef && typeof localeRef === 'object' && 'value' in localeRef ? localeRef.value : (i18n.global.locale as string)
|
||||
void currentLocale
|
||||
return list.map((col) => {
|
||||
const label = col.label
|
||||
if (label && typeof label === 'string' && (label.startsWith('table.') || label.startsWith('page.'))) {
|
||||
return { ...col, label: $t(label) }
|
||||
}
|
||||
return col
|
||||
})
|
||||
})
|
||||
|
||||
// 清理列属性,移除插槽相关的自定义属性,确保它们不会被 ElTableColumn 错误解释
|
||||
const cleanColumnProps = (col: ColumnOption) => {
|
||||
const columnProps = { ...col }
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
defineOptions({ name: 'SaCheckbox', inheritAttrs: false })
|
||||
|
||||
@@ -69,6 +70,7 @@
|
||||
const modelValue = defineModel<(string | number)[]>()
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const { t, te, locale } = useI18n()
|
||||
|
||||
const canConvertToNumberStrict = (value: any) => {
|
||||
if (value == null) return false
|
||||
@@ -81,9 +83,20 @@
|
||||
}
|
||||
|
||||
const options = computed(() => {
|
||||
// 让字典选项在切换语言时可响应更新
|
||||
locale.value
|
||||
|
||||
const list = dictStore.getByCode(props.dict) || []
|
||||
|
||||
if (!props.valueType) return list
|
||||
if (!props.valueType) {
|
||||
return list.map((item) => {
|
||||
const key = `dict.${props.dict}.${item.value}`
|
||||
return {
|
||||
...item,
|
||||
label: te(key) ? t(key) : item.label
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return list.map((item) => {
|
||||
let newValue = item.value
|
||||
@@ -101,7 +114,11 @@
|
||||
|
||||
return {
|
||||
...item,
|
||||
value: newValue
|
||||
value: newValue,
|
||||
label: (() => {
|
||||
const key = `dict.${props.dict}.${newValue}`
|
||||
return te(key) ? t(key) : item.label
|
||||
})()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
:round="round"
|
||||
class="mr-1 last:mr-0"
|
||||
>
|
||||
{{ getData(item)?.label || item }}
|
||||
{{ getDisplayLabel(item) }}
|
||||
</ElTag>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span v-for="(item, index) in normalizedValues" :key="index">
|
||||
{{ getData(item)?.label || item }}{{ index < normalizedValues.length - 1 ? '、' : '' }}
|
||||
{{ getDisplayLabel(item) }}{{ index < normalizedValues.length - 1 ? '、' : '' }}
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
defineOptions({ name: 'SaDict' })
|
||||
|
||||
@@ -50,6 +51,7 @@
|
||||
})
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const { t, te, locale } = useI18n()
|
||||
|
||||
// 统一处理 value,转换为数组格式
|
||||
const normalizedValues = computed(() => {
|
||||
@@ -64,6 +66,16 @@
|
||||
// 根据值获取字典数据
|
||||
const getData = (value: string) => dictStore.getDataByValue(props.dict, value)
|
||||
|
||||
const getDisplayLabel = (value: string) => {
|
||||
// 让显示在切换语言时可响应更新
|
||||
locale.value
|
||||
|
||||
const key = `dict.${props.dict}.${value}`
|
||||
if (te(key)) return t(key)
|
||||
|
||||
return getData(value)?.label || value
|
||||
}
|
||||
|
||||
const getColor = (color: string | undefined, type: 'bg' | 'border' | 'text') => {
|
||||
// 如果没有指定颜色,使用默认主色调
|
||||
if (!color) {
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
defineOptions({ name: 'SaRadio', inheritAttrs: false })
|
||||
|
||||
@@ -82,6 +83,7 @@
|
||||
const modelValue = defineModel<string | number | undefined>()
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const { t, te, locale } = useI18n()
|
||||
|
||||
// 判断能否转成数字
|
||||
const canConvertToNumberStrict = (value: any) => {
|
||||
@@ -97,10 +99,21 @@
|
||||
|
||||
// 核心逻辑:在 computed 中处理数据类型转换
|
||||
const options = computed(() => {
|
||||
// 让字典选项在切换语言时可响应更新
|
||||
locale.value
|
||||
|
||||
const list = dictStore.getByCode(props.dict) || []
|
||||
|
||||
// 如果没有指定 valueType,直接返回原始字典
|
||||
if (!props.valueType) return list
|
||||
if (!props.valueType) {
|
||||
return list.map((item) => {
|
||||
const key = `dict.${props.dict}.${item.value}`
|
||||
return {
|
||||
...item,
|
||||
label: te(key) ? t(key) : item.label
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 如果指定了类型,进行映射转换
|
||||
return list.map((item) => {
|
||||
@@ -119,7 +132,11 @@
|
||||
|
||||
return {
|
||||
...item,
|
||||
value: newValue
|
||||
value: newValue,
|
||||
label: (() => {
|
||||
const key = `dict.${props.dict}.${newValue}`
|
||||
return te(key) ? t(key) : item.label
|
||||
})()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
defineOptions({ name: 'SaSelect', inheritAttrs: false })
|
||||
|
||||
@@ -75,6 +76,7 @@
|
||||
const modelValue = defineModel<string | number | Array<string | number>>()
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const { t, te, locale } = useI18n()
|
||||
|
||||
// 判断能否转成数字
|
||||
const canConvertToNumberStrict = (value: any) => {
|
||||
@@ -90,10 +92,21 @@
|
||||
|
||||
// 计算属性:获取字典数据并处理类型转换
|
||||
const options = computed(() => {
|
||||
// 让字典选项在切换语言时可响应更新
|
||||
locale.value
|
||||
|
||||
const list = dictStore.getByCode(props.dict) || []
|
||||
|
||||
// 1. 如果没有指定 valueType,直接返回
|
||||
if (!props.valueType) return list
|
||||
if (!props.valueType) {
|
||||
return list.map((item) => {
|
||||
const key = `dict.${props.dict}.${item.value}`
|
||||
return {
|
||||
...item,
|
||||
label: te(key) ? t(key) : item.label
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 2. 如果指定了类型,进行映射转换
|
||||
return list.map((item) => {
|
||||
@@ -111,7 +124,11 @@
|
||||
|
||||
return {
|
||||
...item,
|
||||
value: newValue
|
||||
value: newValue,
|
||||
label: (() => {
|
||||
const key = `dict.${props.dict}.${newValue}`
|
||||
return te(key) ? t(key) : item.label
|
||||
})()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -345,7 +345,9 @@ export function useChart(options: UseChartOptions = {}) {
|
||||
right: 15,
|
||||
bottom: 8,
|
||||
left: 0,
|
||||
containLabel: true,
|
||||
// ECharts 6:替代已弃用的 containLabel(需配合 outerBounds 布局,避免控制台告警)
|
||||
outerBoundsMode: 'same' as const,
|
||||
outerBoundsContain: 'axisLabel' as const,
|
||||
...baseGrid
|
||||
}
|
||||
|
||||
|
||||
42
saiadmin-artd/src/locales/langs/README.md
Normal file
42
saiadmin-artd/src/locales/langs/README.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# 多语言文件说明
|
||||
|
||||
## 全局翻译(所有页面共用)
|
||||
|
||||
- `zh.json`、`en.json`:放在 `langs/` 根目录,包含菜单、公共表格操作(删除/添加/选择/操作/刷新等)、公共搜索栏(查询/重置/展开/收起、请输入/请选择、全部/启用/禁用等)、以及非页面级的文案(httpMsg、topBar、common、setting、login 等)。
|
||||
|
||||
## 页面级翻译(按路由加载)
|
||||
|
||||
路径规则:`langs/{语言}/{目录名}/{菜单名}.json`
|
||||
|
||||
示例:路由 `/dice/lottery_pool_config/index` 对应:
|
||||
|
||||
- 中文:`langs/zh/dice/lottery_pool_config.json`
|
||||
- 英文:`langs/en/dice/lottery_pool_config.json`
|
||||
|
||||
### 单文件结构
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "名称",
|
||||
"search": {
|
||||
"字段或占位 key": "中文文案"
|
||||
},
|
||||
"table": {
|
||||
"列 key": "表头中文文案"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- 顶层字段(如 `name`):该页面用到的通用字段标签,在搜索或表格中通过 `$t('page.name')` 使用。
|
||||
- `search`:搜索栏专用,如 `$t('page.search.poolType')`、`$t('page.search.placeholderName')`。
|
||||
- `table`:表格列头专用,如 `$t('page.table.poolType')`;列配置里 `label: 'page.table.xxx'` 会由表格组件自动翻译。
|
||||
|
||||
### 使用方式
|
||||
|
||||
- 搜索栏:`$t('page.name')`、`$t('page.search.xxx')`。
|
||||
- 表格列:`label: 'page.table.xxx'`(art-table 会自动对 `page.` 开头的 label 做 `$t`)。
|
||||
- 公共操作(删除、新增、操作等):继续使用 `$t('table.actions.xxx')`,来自全局 `zh.json` / `en.json`。
|
||||
|
||||
### 加载逻辑
|
||||
|
||||
- 进入某路由时,`pageLocaleLoader` 根据 path 解析出 `目录名/菜单名`,动态加载对应语言的 json 并合并到 i18n 的 `page` 命名空间;切换语言会清空缓存,下次进入或刷新后加载新语言文件。
|
||||
@@ -22,6 +22,7 @@
|
||||
"userCenter": "User center",
|
||||
"docs": "Document",
|
||||
"github": "Github",
|
||||
"clearCache": "clear Cache",
|
||||
"lockScreen": "Lock screen",
|
||||
"logout": "Log out"
|
||||
},
|
||||
@@ -38,6 +39,25 @@
|
||||
"confirm": "Confirm",
|
||||
"logOutTips": "Do you want to log out?"
|
||||
},
|
||||
"form": {
|
||||
"placeholderInput": "Please enter",
|
||||
"placeholderSelect": "Please select",
|
||||
"labelRemark": "Remark",
|
||||
"labelStatus": "Status",
|
||||
"labelName": "Name",
|
||||
"close": "Close"
|
||||
},
|
||||
"dict": {
|
||||
"data_status": {
|
||||
"1": "Normal",
|
||||
"2": "Disabled"
|
||||
},
|
||||
"gender": {
|
||||
"1": "Male",
|
||||
"2": "Female",
|
||||
"3": "Unknown"
|
||||
}
|
||||
},
|
||||
"search": {
|
||||
"placeholder": "Search page",
|
||||
"historyTitle": "Search history",
|
||||
@@ -230,6 +250,56 @@
|
||||
"500": "Sorry, there was an error on the server",
|
||||
"gohome": "Go Home"
|
||||
},
|
||||
"console": {
|
||||
"card": {
|
||||
"playerRegister": "Player Register",
|
||||
"playerCharge": "Player Charge",
|
||||
"playerWithdraw": "Player Withdraw",
|
||||
"playerPlayCount": "Player Play Count",
|
||||
"vsLastWeek": "vs Last Week"
|
||||
},
|
||||
"newPlayer": {
|
||||
"title": "New Players",
|
||||
"subtitle": "Latest 50 new player records",
|
||||
"player": "Player",
|
||||
"balance": "Balance",
|
||||
"ticket": "Tickets"
|
||||
},
|
||||
"walletRecord": {
|
||||
"title": "Player Charge Records",
|
||||
"subtitle": "Latest 50 charge records",
|
||||
"player": "Player",
|
||||
"chargeAmount": "Amount",
|
||||
"chargeTime": "Charge Time"
|
||||
},
|
||||
"salesOverview": {
|
||||
"title": "Recent Player Charge Stats"
|
||||
},
|
||||
"activeUser": {
|
||||
"title": "Monthly Player Charge Summary"
|
||||
},
|
||||
"todo": {
|
||||
"title": "To Do",
|
||||
"pending": "Pending"
|
||||
},
|
||||
"newUser": {
|
||||
"title": "New Users",
|
||||
"growth": "Growth this month",
|
||||
"thisMonth": "This Month",
|
||||
"lastMonth": "Last Month",
|
||||
"thisYear": "This Year",
|
||||
"avatar": "Avatar",
|
||||
"region": "Region",
|
||||
"gender": "Gender",
|
||||
"progress": "Progress",
|
||||
"male": "Male",
|
||||
"female": "Female"
|
||||
},
|
||||
"dynamic": {
|
||||
"title": "Activity",
|
||||
"newCount": "New"
|
||||
}
|
||||
},
|
||||
"menus": {
|
||||
"login": {
|
||||
"title": "Login"
|
||||
@@ -313,7 +383,54 @@
|
||||
"expand": "Expand",
|
||||
"collapse": "Collapse",
|
||||
"searchInputPlaceholder": "Please enter",
|
||||
"searchSelectPlaceholder": "Please select"
|
||||
"searchSelectPlaceholder": "Please select",
|
||||
"all": "All",
|
||||
"min": "Min",
|
||||
"max": "Max",
|
||||
"startTime": "Start Time",
|
||||
"endTime": "End Time",
|
||||
"placeholderUsername": "Username",
|
||||
"placeholderNickname": "Nickname",
|
||||
"placeholderPhone": "Phone",
|
||||
"placeholderPhoneFuzzy": "Phone (fuzzy)",
|
||||
"placeholderName": "Name",
|
||||
"placeholderGroup": "Group",
|
||||
"placeholderTitle": "Title",
|
||||
"placeholderConfigName": "Config Name",
|
||||
"placeholderTaskName": "Task Name",
|
||||
"placeholderTableName": "Table Name",
|
||||
"placeholderDataSource": "Data Source",
|
||||
"placeholderDeptName": "Dept Name",
|
||||
"placeholderDeptCode": "Dept Code",
|
||||
"placeholderRoleName": "Role Name",
|
||||
"placeholderRoleCode": "Role Code",
|
||||
"placeholderPostName": "Post Name",
|
||||
"placeholderPostCode": "Post Code",
|
||||
"placeholderMenuName": "Menu Name",
|
||||
"placeholderMenuRoute": "Menu Route",
|
||||
"placeholderOperator": "Operator",
|
||||
"placeholderOperRouter": "Route",
|
||||
"placeholderOperIp": "IP",
|
||||
"placeholderLoginUser": "Login User",
|
||||
"placeholderLoginIp": "Login IP",
|
||||
"placeholderLoginStatus": "Login Status",
|
||||
"labelFrom": "From",
|
||||
"labelTo": "To",
|
||||
"placeholderFrom": "From",
|
||||
"placeholderTo": "To",
|
||||
"placeholderSendStatus": "Send Status",
|
||||
"placeholderPoolType": "Pool Type",
|
||||
"usernameFuzzy": "Username (fuzzy)",
|
||||
"nameFuzzy": "Name (fuzzy)",
|
||||
"uiTextFuzzy": "UI Text (fuzzy)",
|
||||
"fuzzyQuery": "Fuzzy",
|
||||
"byUsername": "Search by username",
|
||||
"exactSearch": "Exact",
|
||||
"enable": "Enable",
|
||||
"disable": "Disable",
|
||||
"rangeSeparator": "To",
|
||||
"success": "Success",
|
||||
"failure": "Failure"
|
||||
},
|
||||
"selection": "Select",
|
||||
"sizeOptions": {
|
||||
@@ -326,6 +443,184 @@
|
||||
"expand": "Expand",
|
||||
"index": "Index"
|
||||
},
|
||||
"actions": {
|
||||
"add": "Add",
|
||||
"delete": "Delete",
|
||||
"edit": "Edit",
|
||||
"operation": "Operation",
|
||||
"refresh": "Refresh",
|
||||
"export": "Export",
|
||||
"import": "Import"
|
||||
},
|
||||
"columns": {
|
||||
"common": {
|
||||
"id": "ID",
|
||||
"status": "Status",
|
||||
"createTime": "Create Time",
|
||||
"updateTime": "Update Time",
|
||||
"operation": "Operation",
|
||||
"remark": "Remark",
|
||||
"sort": "Sort",
|
||||
"name": "Name",
|
||||
"no": "No.",
|
||||
"description": "Description",
|
||||
"select": "Select"
|
||||
},
|
||||
"system": {
|
||||
"username": "Username",
|
||||
"phone": "Phone",
|
||||
"dept": "Department",
|
||||
"dashboard": "Dashboard",
|
||||
"loginTime": "Last Login",
|
||||
"agentId": "Agent ID",
|
||||
"postName": "Post Name",
|
||||
"postCode": "Post Code",
|
||||
"deptName": "Dept Name",
|
||||
"deptCode": "Dept Code",
|
||||
"leader": "Leader",
|
||||
"roleName": "Role Name",
|
||||
"roleCode": "Role Code",
|
||||
"level": "Level",
|
||||
"roleRemark": "Role Description",
|
||||
"menuName": "Menu Name",
|
||||
"menuType": "Menu Type",
|
||||
"icon": "Icon",
|
||||
"component": "Component",
|
||||
"route": "Route",
|
||||
"auth": "Auth",
|
||||
"configKey": "Config Key",
|
||||
"configTitle": "Config Title",
|
||||
"inputType": "Input Type",
|
||||
"configName": "Config Name",
|
||||
"group": "Group",
|
||||
"title": "Title",
|
||||
"titleEn": "Title (EN)",
|
||||
"value": "Value",
|
||||
"valueEn": "Value (EN)",
|
||||
"noParentDept": "No Parent Dept",
|
||||
"noParentMenu": "No Parent Menu",
|
||||
"input": "Input",
|
||||
"textarea": "Textarea",
|
||||
"select": "Select",
|
||||
"radio": "Radio",
|
||||
"uploadImage": "Image Upload",
|
||||
"uploadFile": "File Upload",
|
||||
"wangEditor": "Rich Editor",
|
||||
"createDate": "Create Date",
|
||||
"updateDate": "Update Date"
|
||||
},
|
||||
"safeguard": {
|
||||
"operator": "Operator",
|
||||
"serviceName": "Service",
|
||||
"router": "Route",
|
||||
"operIp": "IP",
|
||||
"operLocation": "Location",
|
||||
"operTime": "Time",
|
||||
"loginUser": "Login User",
|
||||
"loginStatus": "Login Status",
|
||||
"loginIp": "Login IP",
|
||||
"loginLocation": "Location",
|
||||
"os": "OS",
|
||||
"browser": "Browser",
|
||||
"tableName": "Table Name",
|
||||
"tableComment": "Table Comment",
|
||||
"engine": "Engine",
|
||||
"tableEngine": "Table Engine",
|
||||
"totalRows": "Total Rows",
|
||||
"fragmentSize": "Fragment Size",
|
||||
"dataSize": "Data Size",
|
||||
"collation": "Collation",
|
||||
"dictName": "Dict Name",
|
||||
"dictCode": "Dict Code",
|
||||
"dictLabel": "Dict Label",
|
||||
"dictValue": "Dict Value",
|
||||
"color": "Color",
|
||||
"preview": "Preview",
|
||||
"fileName": "File Name",
|
||||
"storageMode": "Storage",
|
||||
"fileType": "File Type",
|
||||
"fileSize": "File Size",
|
||||
"uploadTime": "Upload Time",
|
||||
"deleteTime": "Delete Time",
|
||||
"dataDetail": "Data Detail",
|
||||
"executeTime": "Execute Time",
|
||||
"target": "Target",
|
||||
"parameter": "Parameter",
|
||||
"executeStatus": "Status",
|
||||
"loginMessage": "Login Message",
|
||||
"loginTime": "Login Time",
|
||||
"gateway": "Gateway",
|
||||
"emailFrom": "From",
|
||||
"emailTo": "To",
|
||||
"emailCode": "Code",
|
||||
"emailResponse": "Response",
|
||||
"sendTime": "Send Time",
|
||||
"sendStatus": "Send Status"
|
||||
},
|
||||
"tool": {
|
||||
"taskName": "Task Name",
|
||||
"taskType": "Task Type",
|
||||
"rule": "Rule",
|
||||
"updateDate": "Update Date",
|
||||
"tableDesc": "Table Desc",
|
||||
"template": "Template",
|
||||
"namespace": "Namespace",
|
||||
"stub": "Stub",
|
||||
"tplCategory": "Gen Type",
|
||||
"topMenu": "Top Menu"
|
||||
},
|
||||
"dice": {
|
||||
"player": "Player",
|
||||
"lotteryPoolConfig": "Lottery Pool Config",
|
||||
"drawType": "Draw Type",
|
||||
"isBigWin": "Is Big Win",
|
||||
"winCoin": "Win Coin",
|
||||
"superWinCoin": "Super Win Coin",
|
||||
"rewardWinCoin": "Reward Win Coin",
|
||||
"direction": "Direction",
|
||||
"startIndex": "Start Index",
|
||||
"targetIndex": "Target Index",
|
||||
"rollArray": "Roll Array",
|
||||
"rollNumber": "Roll Number",
|
||||
"rewardConfig": "Reward Config",
|
||||
"user": "User",
|
||||
"coinChange": "Coin Change",
|
||||
"type": "Type",
|
||||
"operator": "Operator",
|
||||
"walletBefore": "Wallet Before",
|
||||
"walletAfter": "Wallet After",
|
||||
"totalDrawCount": "Total Draw Count",
|
||||
"paidDrawCount": "Paid Draw Count",
|
||||
"freeDrawCount": "Free Draw Count",
|
||||
"paidDraw": "Paid Draw",
|
||||
"freeDraw": "Free Draw",
|
||||
"platformProfit": "Platform Profit",
|
||||
"createdBy": "Created By",
|
||||
"rewardTier": "Reward Tier",
|
||||
"poolType": "Pool Type",
|
||||
"safetyLine": "Safety Line",
|
||||
"t1PoolWeight": "T1 Pool Weight",
|
||||
"t2PoolWeight": "T2 Pool Weight",
|
||||
"t3PoolWeight": "T3 Pool Weight",
|
||||
"t4PoolWeight": "T4 Pool Weight",
|
||||
"t5PoolWeight": "T5 Pool Weight",
|
||||
"endIndex": "End Index",
|
||||
"tier": "Tier",
|
||||
"dicePoints": "Dice Points",
|
||||
"displayText": "Display Text",
|
||||
"realEv": "Real EV",
|
||||
"weight": "Weight",
|
||||
"nickname": "Nickname",
|
||||
"coin": "Coin",
|
||||
"t1Weight": "T1 Weight",
|
||||
"t2Weight": "T2 Weight",
|
||||
"t3Weight": "T3 Weight",
|
||||
"t4Weight": "T4 Weight",
|
||||
"t5Weight": "T5 Weight",
|
||||
"playerUsername": "Player Username",
|
||||
"useCoins": "Use Coins"
|
||||
}
|
||||
},
|
||||
"zebra": "Zebra",
|
||||
"border": "Border",
|
||||
"headerBackground": "Header BG"
|
||||
|
||||
41
saiadmin-artd/src/locales/langs/en/dice/config.json
Normal file
41
saiadmin-artd/src/locales/langs/en/dice/config.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"form": {
|
||||
"dialogTitleAdd": "Add Dice Config",
|
||||
"dialogTitleEdit": "Edit Dice Config",
|
||||
"group": "Group",
|
||||
"placeholderGroup": "Please enter group",
|
||||
"title": "Title",
|
||||
"placeholderTitleZh": "Please enter title (ZH)",
|
||||
"titleEn": "Title (EN)",
|
||||
"placeholderTitleEn": "Please enter title (EN)",
|
||||
"configName": "Config Name",
|
||||
"placeholderConfigName": "Please enter config name",
|
||||
"value": "Value",
|
||||
"placeholderValueZh": "Please enter value (ZH)",
|
||||
"valueEn": "Value (EN)",
|
||||
"placeholderValueEn": "Please enter value (EN)",
|
||||
"ruleGroupRequired": "Group is required",
|
||||
"ruleTitleRequired": "Title is required",
|
||||
"ruleTitleEnMax": "Title (EN) max 255 characters",
|
||||
"ruleConfigNameRequired": "Config name is required",
|
||||
"ruleValueRequired": "Value is required",
|
||||
"saveSuccess": "Added",
|
||||
"updateSuccess": "Updated"
|
||||
},
|
||||
"search": {
|
||||
"group": "Group",
|
||||
"title": "Title",
|
||||
"configName": "Config Name",
|
||||
"placeholderGroup": "Please enter group",
|
||||
"placeholderTitle": "Please enter title",
|
||||
"placeholderConfigName": "Please enter config name"
|
||||
},
|
||||
"table": {
|
||||
"group": "Group",
|
||||
"title": "Title",
|
||||
"titleEn": "Title (EN)",
|
||||
"configName": "Config Name",
|
||||
"value": "Value",
|
||||
"valueEn": "Value (EN)"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "Name",
|
||||
"form": {
|
||||
"dialogTitleAdd": "Add Lottery Pool Config",
|
||||
"dialogTitleEdit": "Edit Lottery Pool Config",
|
||||
"placeholderName": "Please enter name",
|
||||
"placeholderRemark": "Please enter remark",
|
||||
"poolType": "Pool Type",
|
||||
"placeholderPoolType": "Please select pool type",
|
||||
"poolTypeNormal": "Normal",
|
||||
"poolTypeKill": "Kill",
|
||||
"poolTypeT1": "T1 High",
|
||||
"safetyLine": "Safety Line",
|
||||
"t1Weight": "T1 Pool Weight (%)",
|
||||
"t2Weight": "T2 Pool Weight (%)",
|
||||
"t3Weight": "T3 Pool Weight (%)",
|
||||
"t4Weight": "T4 Pool Weight (%)",
|
||||
"t5Weight": "T5 Pool Weight (%)",
|
||||
"weightsSumHint": "Total pool weights: ",
|
||||
"weightsSumUnit": "% / 100% (must equal 100%)",
|
||||
"currentPoolTitle": "Current Lottery Pool",
|
||||
"loading": "Loading...",
|
||||
"poolName": "Pool Name",
|
||||
"playerProfit": "Player Total Profit (profit_amount):",
|
||||
"realtime": "Live",
|
||||
"profitCalcHint": "Sum of (win amount including BIGWIN minus 100 ticket cost) per round; refreshes every 2s while open.",
|
||||
"tierRuleTitle": "Tier Rule",
|
||||
"tierRuleContent": "When player profit in this pool is below safety line, use player T*_weight; when above or equal, use pool T*_weight (kill).",
|
||||
"killScoreWeights": "Kill weights",
|
||||
"killWeightNote": "(Kill weights from pool config type=1; edit in list.)",
|
||||
"btnResetProfit": "Reset Player Total Profit",
|
||||
"btnSaveSafetyLine": "Save Safety Line",
|
||||
"ruleSafetyLineRequired": "Please enter safety line",
|
||||
"msgGetPoolFailed": "Failed to get lottery pool",
|
||||
"msgSaveSuccess": "Save Success",
|
||||
"msgResetProfitSuccess": "Player total profit reset to 0",
|
||||
"msgResetFailed": "Reset failed",
|
||||
"ruleNameRequired": "Name is required",
|
||||
"rulePoolTypeRequired": "Please select pool type",
|
||||
"ruleT1Required": "T1 weight is required",
|
||||
"ruleT2Required": "T2 weight is required",
|
||||
"ruleT3Required": "T3 weight is required",
|
||||
"ruleT4Required": "T4 weight is required",
|
||||
"ruleT5Required": "T5 weight is required",
|
||||
"msgWeightsMust100": "Total pool weights must equal 100%",
|
||||
"msgAddSuccess": "Added",
|
||||
"msgUpdateSuccess": "Updated"
|
||||
},
|
||||
"toolbar": {
|
||||
"viewCurrentPool": "View Current Pool"
|
||||
},
|
||||
"search": {
|
||||
"poolType": "Pool Type",
|
||||
"placeholderName": "Please enter name",
|
||||
"placeholderPoolType": "Please select pool type",
|
||||
"poolTypeNormal": "Normal",
|
||||
"poolTypeKill": "Force Kill",
|
||||
"poolTypeT1": "T1 High Rate"
|
||||
},
|
||||
"table": {
|
||||
"name": "Name",
|
||||
"poolType": "Pool Type",
|
||||
"safetyLine": "Safety Line",
|
||||
"t1PoolWeight": "T1 Pool Weight",
|
||||
"t2PoolWeight": "T2 Pool Weight",
|
||||
"t3PoolWeight": "T3 Pool Weight",
|
||||
"t4PoolWeight": "T4 Pool Weight",
|
||||
"t5PoolWeight": "T5 Pool Weight"
|
||||
}
|
||||
}
|
||||
80
saiadmin-artd/src/locales/langs/en/dice/play_record.json
Normal file
80
saiadmin-artd/src/locales/langs/en/dice/play_record.json
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"form": {
|
||||
"dialogTitleAdd": "Add Play Record",
|
||||
"dialogTitleEdit": "Edit Play Record",
|
||||
"player": "Player",
|
||||
"placeholderPlayer": "Select player (by username)",
|
||||
"lotteryPoolConfig": "Lottery Pool Config",
|
||||
"placeholderLotteryPool": "Select lottery pool config",
|
||||
"drawType": "Draw Type",
|
||||
"paid": "Paid",
|
||||
"free": "Free",
|
||||
"isBigWin": "Big Win",
|
||||
"noBigWin": "No",
|
||||
"bigWin": "Big Win",
|
||||
"winCoin": "Win Coin",
|
||||
"placeholderWinCoin": "= Super + Reward",
|
||||
"superWinCoin": "Super Win Coin",
|
||||
"placeholderSuperWinCoin": "On BIGWIN",
|
||||
"rewardWinCoin": "Reward Win Coin",
|
||||
"placeholderRewardWinCoin": "Dice reward",
|
||||
"direction": "Direction",
|
||||
"placeholderDirection": "Select direction",
|
||||
"clockwise": "Clockwise",
|
||||
"anticlockwise": "Anticlockwise",
|
||||
"startIndex": "Start Index",
|
||||
"placeholderStartIndex": "Start index",
|
||||
"targetIndex": "Target Index",
|
||||
"placeholderTargetIndex": "Target index",
|
||||
"rollArray": "Roll Array",
|
||||
"rollArrayHint": "5 numbers, each 1–6",
|
||||
"rollNumber": "Roll Sum",
|
||||
"placeholderRollNumber": "Sum of 5 dice (5–30)",
|
||||
"rewardConfig": "Reward Config",
|
||||
"placeholderRewardConfig": "Select reward config (by UI text)",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully",
|
||||
"validateFailed": "Validation failed, please check required fields and format"
|
||||
},
|
||||
"toolbar": {
|
||||
"platformTotalProfit": "Platform Total Profit"
|
||||
},
|
||||
"search": {
|
||||
"player": "Player",
|
||||
"lotteryPoolConfig": "Lottery Pool Config",
|
||||
"drawType": "Draw Type",
|
||||
"isBigWin": "Is Big Win",
|
||||
"direction": "Direction",
|
||||
"winCoin": "Win Coin",
|
||||
"rollNumber": "Roll Number",
|
||||
"rewardConfig": "Reward Config",
|
||||
"rewardTier": "Reward Tier",
|
||||
"usernameFuzzy": "Username (fuzzy)",
|
||||
"nameFuzzy": "Name (fuzzy)",
|
||||
"uiTextFuzzy": "UI Text (fuzzy)",
|
||||
"paid": "Paid",
|
||||
"free": "Free",
|
||||
"noBigWin": "No",
|
||||
"bigWin": "Big Win",
|
||||
"clockwise": "Clockwise",
|
||||
"anticlockwise": "Anticlockwise"
|
||||
},
|
||||
"table": {
|
||||
"id": "ID",
|
||||
"player": "Player",
|
||||
"lotteryPoolConfig": "Lottery Pool Config",
|
||||
"drawType": "Draw Type",
|
||||
"isBigWin": "Is Big Win",
|
||||
"winCoin": "Win Coin",
|
||||
"superWinCoin": "Super Win Coin",
|
||||
"rewardWinCoin": "Reward Win Coin",
|
||||
"direction": "Direction",
|
||||
"startIndex": "Start Index",
|
||||
"targetIndex": "Target Index",
|
||||
"rollArray": "Roll Array",
|
||||
"rollNumber": "Roll Number",
|
||||
"rewardConfig": "Reward Config",
|
||||
"createTime": "Create Time",
|
||||
"updateTime": "Update Time"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"toolbar": {
|
||||
"clearAllData": "Clear All Data",
|
||||
"platformTotalProfit": "Platform Total Profit"
|
||||
},
|
||||
"search": {
|
||||
"drawType": "Draw Type",
|
||||
"direction": "Direction",
|
||||
"isBigWin": "Is Big Win",
|
||||
"winCoin": "Win Coin",
|
||||
"rewardTier": "Reward Tier",
|
||||
"rollNumber": "Roll Number",
|
||||
"paid": "Paid",
|
||||
"free": "Free",
|
||||
"clockwise": "Clockwise",
|
||||
"anticlockwise": "Anticlockwise",
|
||||
"noBigWin": "No",
|
||||
"bigWin": "Big Win"
|
||||
},
|
||||
"table": {
|
||||
"id": "ID",
|
||||
"player": "Player",
|
||||
"lotteryPoolConfig": "Lottery Pool Config",
|
||||
"drawType": "Draw Type",
|
||||
"isBigWin": "Is Big Win",
|
||||
"winCoin": "Win Coin",
|
||||
"superWinCoin": "Super Win Coin",
|
||||
"rewardWinCoin": "Reward Win Coin",
|
||||
"direction": "Direction",
|
||||
"startIndex": "Start Index",
|
||||
"targetIndex": "Target Index",
|
||||
"rollArray": "Roll Array",
|
||||
"rollNumber": "Roll Number",
|
||||
"rewardConfig": "Reward Config",
|
||||
"createTime": "Create Time"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "Add Player Draw Record (Test)",
|
||||
"titleEdit": "Edit Player Draw Record (Test)",
|
||||
"labelLotteryConfigId": "Lottery Config ID",
|
||||
"placeholderLotteryConfigId": "Please enter lottery config id",
|
||||
"placeholderWinCoin": "Win coin",
|
||||
"placeholderRewardTier": "Please select tier (will auto fill reward config id)",
|
||||
"rewardConfigId": "Reward Config ID",
|
||||
"placeholderRewardConfigId": "Auto fill by tier or enter manually",
|
||||
"placeholderStartIndex": "Please enter start index",
|
||||
"labelTargetIndex": "Target Index",
|
||||
"placeholderTargetIndex": "Please enter target index",
|
||||
"placeholderRollNumber": "Please enter roll number",
|
||||
"labelRollArray": "Roll Array [1,2,3,4,5,6]",
|
||||
"placeholderRollArray": "Please enter roll array [1,2,3,4,5,6]",
|
||||
"labelStatus": "Status (0=fail, 1=success)",
|
||||
"placeholderSuperWinCoin": "Please enter super win coin",
|
||||
"placeholderRewardWinCoin": "Please enter reward win coin",
|
||||
"labelAdminId": "Admin ID",
|
||||
"placeholderAdminId": "Please enter admin id",
|
||||
"ruleLotteryConfigIdRequired": "Lottery config id is required",
|
||||
"ruleDrawTypeRequired": "Draw type is required",
|
||||
"ruleIsBigWinRequired": "Is big win is required",
|
||||
"ruleDirectionRequired": "Direction is required",
|
||||
"ruleRewardConfigIdRequired": "Reward config id is required",
|
||||
"ruleStatusRequired": "Status is required",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
}
|
||||
}
|
||||
80
saiadmin-artd/src/locales/langs/en/dice/player.json
Normal file
80
saiadmin-artd/src/locales/langs/en/dice/player.json
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "Name",
|
||||
"form": {
|
||||
"dialogTitleAdd": "Add Dice Player",
|
||||
"dialogTitleEdit": "Edit Dice Player",
|
||||
"username": "Username",
|
||||
"placeholderUsername": "Please enter username",
|
||||
"nickname": "Nickname",
|
||||
"placeholderNickname": "Please enter nickname",
|
||||
"phone": "Phone",
|
||||
"placeholderPhone": "Please enter phone",
|
||||
"password": "Password",
|
||||
"placeholderPasswordEdit": "Leave blank to keep unchanged",
|
||||
"status": "Status",
|
||||
"adminId": "Admin",
|
||||
"placeholderAdmin": "Select admin (optional)",
|
||||
"coin": "Coin",
|
||||
"placeholderCoinAdd": "Default 0 on create, read-only",
|
||||
"lotteryPoolConfig": "Lottery Pool Config",
|
||||
"placeholderLotteryPool": "Leave empty for custom weights below, or select pool",
|
||||
"currentConfig": "Current Config",
|
||||
"configLabelName": "Name",
|
||||
"configLabelType": "Type",
|
||||
"configLabelWeights": "T1–T5 Weights",
|
||||
"configLabelRemark": "Remark",
|
||||
"t1Weight": "T1 Pool Weight (%)",
|
||||
"t2Weight": "T2 Pool Weight (%)",
|
||||
"t3Weight": "T3 Pool Weight (%)",
|
||||
"t4Weight": "T4 Pool Weight (%)",
|
||||
"t5Weight": "T5 Pool Weight (%)",
|
||||
"weightsSumHint": "Total pool weights: ",
|
||||
"weightsSumUnit": "% / 100% (must equal 100%)",
|
||||
"ruleWeightsSumMustBe100": "Total pool weights must equal 100%",
|
||||
"walletTitle": "Player Wallet Operation",
|
||||
"walletPlayer": "Player",
|
||||
"walletBalance": "Balance",
|
||||
"operationType": "Operation Type",
|
||||
"typeAdd": "Add",
|
||||
"typeSub": "Deduct",
|
||||
"coinChange": "Coin Change",
|
||||
"placeholderCoinChange": "Positive; deduct cannot exceed balance",
|
||||
"placeholderRemarkOptional": "Optional",
|
||||
"ruleSelectType": "Please select operation type",
|
||||
"ruleEnterCoin": "Please enter coin change",
|
||||
"ruleCoinPositive": "Coin change must be greater than 0",
|
||||
"ruleDeductExceed": "Deduct cannot exceed current balance",
|
||||
"operateSuccess": "Success"
|
||||
},
|
||||
"search": {
|
||||
"username": "Username",
|
||||
"nickname": "Nickname",
|
||||
"phone": "Phone",
|
||||
"status": "Status",
|
||||
"coin": "Coin",
|
||||
"lotteryPoolConfig": "Lottery Pool Config",
|
||||
"placeholderUsername": "Please enter username",
|
||||
"placeholderNickname": "Please enter nickname",
|
||||
"placeholderPhoneFuzzy": "Phone (fuzzy)",
|
||||
"placeholderAll": "All",
|
||||
"exactSearch": "Exact"
|
||||
},
|
||||
"table": {
|
||||
"username": "Username",
|
||||
"phone": "Phone",
|
||||
"nickname": "Nickname",
|
||||
"status": "Status",
|
||||
"coin": "Coin",
|
||||
"lotteryPoolConfig": "Lottery Pool Config",
|
||||
"t1Weight": "T1 Weight",
|
||||
"t2Weight": "T2 Weight",
|
||||
"t3Weight": "T3 Weight",
|
||||
"t4Weight": "T4 Weight",
|
||||
"t5Weight": "T5 Weight",
|
||||
"totalDrawCount": "Total Draw Count",
|
||||
"paidDrawCount": "Paid Draw Count",
|
||||
"freeDrawCount": "Free Draw Count",
|
||||
"createTime": "Create Time",
|
||||
"updateTime": "Update Time"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"form": {
|
||||
"dialogTitleAdd": "Add Ticket Record",
|
||||
"dialogTitleEdit": "Edit Ticket Record",
|
||||
"player": "Player",
|
||||
"placeholderPlayer": "Select player (by username)",
|
||||
"useCoins": "Use Coins",
|
||||
"placeholderUseCoins": "Please enter use coins",
|
||||
"paidDrawCount": "Paid Draw Count",
|
||||
"placeholderPaidDrawCount": "Please enter paid draw count",
|
||||
"freeDrawCount": "Free Draw Count",
|
||||
"placeholderFreeDrawCount": "Please enter free draw count",
|
||||
"totalDrawCount": "Total Draw Count",
|
||||
"placeholderTotalDrawCount": "Auto sum",
|
||||
"placeholderRemark": "Remark (required)",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
},
|
||||
"search": {
|
||||
"player": "Player",
|
||||
"useCoins": "Use Coins",
|
||||
"totalDrawCount": "Total Draw Count",
|
||||
"paidDrawCount": "Paid Draw Count",
|
||||
"freeDrawCount": "Free Draw Count",
|
||||
"createTime": "Create Time",
|
||||
"byUsername": "By username"
|
||||
},
|
||||
"table": {
|
||||
"id": "ID",
|
||||
"playerUsername": "Player Username",
|
||||
"useCoins": "Use Coins",
|
||||
"totalDrawCount": "Total Draw Count",
|
||||
"paidDrawCount": "Paid Draw Count",
|
||||
"freeDrawCount": "Free Draw Count",
|
||||
"remark": "Remark",
|
||||
"createTime": "Create Time"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"form": {
|
||||
"dialogTitleAdd": "Add Wallet Record",
|
||||
"dialogTitleEdit": "Edit Wallet Record",
|
||||
"user": "User",
|
||||
"placeholderUser": "Select user (by username)",
|
||||
"type": "Type",
|
||||
"placeholderType": "Please select type",
|
||||
"typeRecharge": "Recharge",
|
||||
"typeWithdraw": "Withdraw",
|
||||
"typeBuyTicket": "Buy Tickets",
|
||||
"typeAdminAdd": "Admin Add",
|
||||
"typeAdminSub": "Admin Deduct",
|
||||
"coinChange": "Coin Change",
|
||||
"placeholderCoinChange": "Positive add, negative subtract",
|
||||
"walletBefore": "Before",
|
||||
"placeholderWalletBefore": "Auto from selected user",
|
||||
"walletAfter": "After",
|
||||
"placeholderWalletAfter": "Auto calculated",
|
||||
"placeholderRemark": "Optional",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
},
|
||||
"search": {
|
||||
"type": "Type",
|
||||
"user": "User",
|
||||
"coin": "Coin",
|
||||
"createTime": "Create Time",
|
||||
"typeRecharge": "Recharge",
|
||||
"typeWithdraw": "Withdraw",
|
||||
"typeBuyTicket": "Buy Draw",
|
||||
"typeAdminAdd": "Admin Add",
|
||||
"typeAdminSub": "Admin Deduct",
|
||||
"byUsername": "By username"
|
||||
},
|
||||
"table": {
|
||||
"id": "ID",
|
||||
"user": "User",
|
||||
"coinChange": "Coin Change",
|
||||
"type": "Type",
|
||||
"operator": "Operator",
|
||||
"walletBefore": "Wallet Before",
|
||||
"walletAfter": "Wallet After",
|
||||
"remark": "Remark",
|
||||
"totalDrawCount": "Total Draw Count",
|
||||
"paidDrawCount": "Paid Draw Count",
|
||||
"freeDrawCount": "Free Draw Count",
|
||||
"createTime": "Create Time",
|
||||
"typeDraw": "Draw"
|
||||
}
|
||||
}
|
||||
84
saiadmin-artd/src/locales/langs/en/dice/reward.json
Normal file
84
saiadmin-artd/src/locales/langs/en/dice/reward.json
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"toolbar": {
|
||||
"weightRatio": "Weight Ratio",
|
||||
"weightTest": "Test Weights"
|
||||
},
|
||||
"search": {
|
||||
"tier": "Tier",
|
||||
"clockwise": "Clockwise",
|
||||
"anticlockwise": "Counter-clockwise",
|
||||
"optionBigwin": "BIGWIN"
|
||||
},
|
||||
"table": {
|
||||
"startIndex": "Start Index",
|
||||
"endIndex": "End Index",
|
||||
"tier": "Tier",
|
||||
"dicePoints": "Dice Points",
|
||||
"displayText": "Display Text",
|
||||
"realEv": "Real EV",
|
||||
"remark": "Remark",
|
||||
"weight": "Weight"
|
||||
},
|
||||
"weightShared": {
|
||||
"xAxisEndIndex": "End Index",
|
||||
"xAxisGridNumber": "Points",
|
||||
"emptyTier": "No data for this tier",
|
||||
"sumLineDual": "Tier weight sum (clockwise): {cw}; counter-clockwise: {ccw} (each row 1–10000, ratio draw within tier, sum not limited)",
|
||||
"sumLineSingle": "Tier weight sum: {sum} (each row 1–10000, ratio draw within tier, sum not limited)",
|
||||
"t4t5NoteSingle": "T4 and T5 have a single outcome; no weight configuration.",
|
||||
"t4t5NoteDual": "T4 and T5 have a single outcome when hit; no weight configuration.",
|
||||
"colEndIndexId": "End Index (id)",
|
||||
"colGridNumber": "Points (grid_number)",
|
||||
"colDicePoints": "Dice Points",
|
||||
"colRealEv": "Real EV",
|
||||
"colUiText": "Display Text",
|
||||
"colRemark": "Remark",
|
||||
"colWeightCwDir": "Clockwise weight (direction=0)",
|
||||
"colWeightCcwDir": "Counter-clockwise weight (direction=1)",
|
||||
"weightColSuffix": "Weight (1-10000)",
|
||||
"fetchFail": "Failed to load weight data",
|
||||
"nothingToSubmit": "Nothing to submit",
|
||||
"submitFail": "Save failed",
|
||||
"btnCancel": "Cancel",
|
||||
"btnSubmit": "Submit",
|
||||
"saveSuccess": "Saved successfully"
|
||||
},
|
||||
"weightEdit": {
|
||||
"title": "Dice Reward (dice_reward) Weight Ratio",
|
||||
"globalTip": "You are editing weights on dice_reward (DiceReward), split by end_index into clockwise and counter-clockwise; the draw uses the set for the current direction."
|
||||
},
|
||||
"weightRatio": {
|
||||
"title": "Weight Ratio",
|
||||
"globalTip": "Configure dice_reward weights: first by direction (clockwise / counter-clockwise), then by tier (T1–T5); each row weight 1–10000, ratio draw within tier.",
|
||||
"tabClockwise": "Clockwise",
|
||||
"tabCounterclockwise": "Counter-clockwise"
|
||||
},
|
||||
"weightTest": {
|
||||
"title": "One-Click Weight Test",
|
||||
"alertTitle": "Bonus pool logic",
|
||||
"alertBody": "Same as playStart draw: uses name=default safety line and kill switch; when profit is below the line, paid tickets use player tier weights (custom below), free tickets use killScore; when profit reaches the line and kill is on, both use killScore.",
|
||||
"stepPaid": "Paid ticket",
|
||||
"stepFree": "Free ticket",
|
||||
"labelLotteryTypePaid": "Test pool type",
|
||||
"labelLotteryTypeFree": "Test pool type",
|
||||
"placeholderPaidPool": "Leave empty for custom tier odds below (default: default)",
|
||||
"placeholderFreePool": "Leave empty for custom tier odds below (default: killScore)",
|
||||
"tierProbHint": "Custom tier odds (T1–T5), each 0–100%, sum of five must not exceed 100%",
|
||||
"tierFieldLabel": "Tier {tier} (%)",
|
||||
"tierSumError": "Current sum of five tiers is {sum}%, cannot exceed 100%",
|
||||
"labelCwCount": "Clockwise spins",
|
||||
"labelCcwCount": "Counter-clockwise spins",
|
||||
"placeholderSelect": "Please select",
|
||||
"btnPrev": "Back",
|
||||
"btnNext": "Next",
|
||||
"btnStart": "Start test",
|
||||
"btnCancel": "Cancel",
|
||||
"warnTotalSpins": "At least one of paid/free direction spin counts must be greater than 0",
|
||||
"warnPaidTierSumPositive": "When no paid pool is selected, T1–T5 odds sum must be greater than 0",
|
||||
"warnPaidTierSumMax": "Paid T1–T5 odds sum cannot exceed 100%",
|
||||
"warnFreeTierSumPositive": "When no free pool is selected, T1–T5 odds sum must be greater than 0",
|
||||
"warnFreeTierSumMax": "Free T1–T5 odds sum cannot exceed 100%",
|
||||
"successCreated": "Test job created and will run in background. Check player draw records (test data) for results.",
|
||||
"failCreate": "Failed to create test job"
|
||||
}
|
||||
}
|
||||
119
saiadmin-artd/src/locales/langs/en/dice/reward_config.json
Normal file
119
saiadmin-artd/src/locales/langs/en/dice/reward_config.json
Normal file
@@ -0,0 +1,119 @@
|
||||
{
|
||||
"toolbar": {
|
||||
"gameRewardConfig": "Game Reward Config",
|
||||
"createRewardRef": "Create Reward Reference",
|
||||
"createRewardRefTitle": "Rule: start_index=config(grid_number).id; clockwise end_index=(start_index+grid_number)%26; counter-clockwise end_index=start_index-grid_number>=0?start_index-grid_number:26+start_index-grid_number"
|
||||
},
|
||||
"configPage": {
|
||||
"tabIndex": "Reward Index",
|
||||
"tabBigwin": "Big Win Weights",
|
||||
"tipIndex": "Dice points must be between 5 and 30 and unique in this table.",
|
||||
"tipBigwin": "Left to right: big-win points (read-only), display text, real EV, remark, weight (0~10000). Points 5 and 30 are fixed at 100%. This tab saves big-win weights only.",
|
||||
"colId": "Index (id)",
|
||||
"colDicePoints": "Dice Points",
|
||||
"colDisplayText": "Display Text",
|
||||
"colDisplayTextEn": "Display Text (EN)",
|
||||
"colRealEv": "Real Settlement",
|
||||
"colTier": "Tier",
|
||||
"colRemark": "Remark",
|
||||
"placeholderTierSelect": "Tier",
|
||||
"placeholderDisplayZh": "Display text (Chinese)",
|
||||
"placeholderDisplayEn": "Display text (English)",
|
||||
"placeholderRemark": "Remark",
|
||||
"btnSave": "Save",
|
||||
"btnReset": "Reset",
|
||||
"colBigwinPoints": "Big-Win Points",
|
||||
"colDisplayInfo": "Display Info",
|
||||
"colDisplayInfoEn": "Display Info (EN)",
|
||||
"colRealPrize": "Real Prize",
|
||||
"colWeightRange": "Weight (0-10000)",
|
||||
"placeholderDisplayInfoZh": "Display info (Chinese)",
|
||||
"placeholderDisplayInfoEn": "Display info (English)",
|
||||
"weightFixedTip": "Points 5 and 30 are fixed at 100%",
|
||||
"emptyBigwin": "No BIGWIN tier rows. Set tier to BIGWIN in the Reward Index tab first.",
|
||||
"confirmCreateRefTitle": "Create Reward Reference",
|
||||
"confirmCreateRefMsg": "Create reward reference by rule: start_index is the id of the cell for grid_number in reward config; clockwise end_index=(start_index+roll)%26; counter-clockwise end_index=start_index-roll if >=0 else 26+start_index-roll. Existing data will be cleared, then 26 points (5–30) for both directions will be generated. Continue?",
|
||||
"confirmCreateRefOk": "Create",
|
||||
"confirmCreateRefCancel": "Cancel",
|
||||
"createRefSuccess": "Created for 26 dice points (5–30), clockwise + counter-clockwise: clockwise added {cwNew}, counter-clockwise added {ccwNew}; clockwise updated {cwUp}, counter-clockwise updated {ccwUp}{skippedPart}",
|
||||
"createRefSuccessSkipped": "; {n} point(s) used fallback start index",
|
||||
"createRefSuccessSimple": "Created successfully",
|
||||
"createRefFail": "Failed to create reward reference",
|
||||
"loadIndexFail": "Failed to load reward index config",
|
||||
"saveSuccess": "Saved successfully",
|
||||
"saveFail": "Save failed",
|
||||
"resetIndexReloaded": "Reward index reloaded from server",
|
||||
"resetBigwinReloaded": "Big win weights reloaded from server",
|
||||
"warnNoIndexToSave": "No reward index rows to save",
|
||||
"warnGridRange": "Dice points must be between {min} and {max}",
|
||||
"dupJoiner": ", ",
|
||||
"warnDupGrid": "Duplicate dice points in this table: {list}",
|
||||
"warnNoBigwinToSave": "No BIGWIN rows to save",
|
||||
"warnBigwinDupGrid": "Duplicate big-win points in this table: {list}",
|
||||
"infoNoBigwin": "No BIGWIN rows. Set tier to BIGWIN in the Reward Index tab first."
|
||||
},
|
||||
"weightRatio": {
|
||||
"title": "T1–T5 Weight Ratio (Clockwise / Counter-clockwise)",
|
||||
"globalTip": "Weights come from dice_reward, split by end index (DiceRewardConfig.id) into clockwise and counter-clockwise; draw uses the weight set for the current direction.",
|
||||
"xAxisEndIndex": "End Index",
|
||||
"emptyTier": "No data for this tier",
|
||||
"sumLine": "Tier weight sum (clockwise): {cw}; counter-clockwise: {ccw} (each row 1–10000, ratio draw within tier, sum not limited)",
|
||||
"t4t5Note": "T4 and T5 have a single outcome; no weight configuration.",
|
||||
"colEndIndexId": "End Index (id)",
|
||||
"colDicePoints": "Dice Points",
|
||||
"colRealEv": "Real EV",
|
||||
"colUiText": "Display Text",
|
||||
"colWeightCw": "Clockwise weight (1-10000)",
|
||||
"colWeightCcw": "Counter-clockwise weight (1-10000)",
|
||||
"fetchFail": "Failed to load weight ratio data",
|
||||
"nothingToSubmit": "Nothing to submit",
|
||||
"submitFail": "Save failed",
|
||||
"saveSuccess": "Saved successfully"
|
||||
},
|
||||
"search": {
|
||||
"dicePoints": "Dice Points",
|
||||
"displayText": "Display Text",
|
||||
"realEv": "Real EV",
|
||||
"tier": "Tier",
|
||||
"fuzzyQuery": "Fuzzy"
|
||||
},
|
||||
"table": {
|
||||
"startIndex": "Start Index",
|
||||
"endIndex": "End Index",
|
||||
"tier": "Tier",
|
||||
"dicePoints": "Dice Points",
|
||||
"displayText": "Display Text",
|
||||
"realEv": "Real EV",
|
||||
"remark": "Remark",
|
||||
"weight": "Weight"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "Add Reward Config",
|
||||
"titleEdit": "Edit Reward Config",
|
||||
"labelDicePoints": "Dice Points",
|
||||
"placeholderDicePoints": "Please enter dice points",
|
||||
"labelUiText": "Display Text",
|
||||
"placeholderUiText": "Please enter display text (Chinese)",
|
||||
"labelUiTextEn": "Display Text (EN)",
|
||||
"placeholderUiTextEn": "Please enter display text (English)",
|
||||
"labelRealEv": "Real EV",
|
||||
"placeholderRealEv": "Please enter real EV",
|
||||
"labelTier": "Tier",
|
||||
"placeholderTier": "Please select tier",
|
||||
"tierBigWin": "BIGWIN (Super Prize)",
|
||||
"labelBigWinWeight": "Big Win Weight",
|
||||
"placeholderBigWinWeight": "0~10000, 10000=100% win",
|
||||
"bigWinWeightDisabledTip": "For points 5 and 30, big win is guaranteed. Weight is fixed to 10000.",
|
||||
"bigWinWeightTip": "10000=100% win, 0=0% win; only effective for points 10/15/20/25",
|
||||
"labelRemark": "Remark",
|
||||
"placeholderRemark": "Please enter remark",
|
||||
"ruleDicePointsRequired": "Dice points is required",
|
||||
"ruleUiTextRequired": "Display text is required",
|
||||
"ruleUiTextEnMax": "Display text (EN) must be less than 255 characters",
|
||||
"ruleRealEvRequired": "Real EV is required",
|
||||
"ruleTierRequired": "Tier is required",
|
||||
"ruleBigWinWeightRange": "Big win weight must be between 0 and 10000",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"toolbar": {
|
||||
"viewDetail": "View Detail"
|
||||
},
|
||||
"table": {
|
||||
"id": "ID",
|
||||
"clockwiseAbbr": "CW",
|
||||
"counterclockwiseAbbr": "CCW",
|
||||
"status": "Status",
|
||||
"paidDraw": "Paid Draw",
|
||||
"freeDraw": "Free Draw",
|
||||
"platformProfit": "Platform Profit",
|
||||
"totalDrawCount": "Total Draw Count",
|
||||
"createdBy": "Created By",
|
||||
"createTime": "Create Time",
|
||||
"statusFail": "Failed",
|
||||
"statusDone": "Done",
|
||||
"statusTesting": "Testing"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "Add Reward Config Weight Test Record",
|
||||
"titleEdit": "Edit Reward Config Weight Test Record",
|
||||
"labelTestCount": "Test Count: 100/500/1000",
|
||||
"placeholderTestCount": "Please enter test count: 100/500/1000",
|
||||
"labelWeightSnapshot": "Weight Snapshot: save id,grid_number,tier,weight by tier",
|
||||
"placeholderWeightSnapshot": "Please enter weight snapshot: id,grid_number,tier,weight by tier",
|
||||
"labelResultCounts": "Result Counts: grid_number => count",
|
||||
"placeholderResultCounts": "Please enter result counts: grid_number => count",
|
||||
"ruleTestCountRequired": "Test count is required",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Test Record Detail",
|
||||
"sectionBasic": "Basic Info",
|
||||
"recordId": "Record ID",
|
||||
"testCount": "Test count",
|
||||
"testCountSuffix": " runs",
|
||||
"createTime": "Created at",
|
||||
"admin": "Operator",
|
||||
"paidPoolId": "Paid lottery pool config ID",
|
||||
"freePoolId": "Free lottery pool config ID",
|
||||
"bigwinSnapshot": "BIGWIN weight snapshot",
|
||||
"sectionPaidTier": "Paid draw tier odds (T1–T5, used in test)",
|
||||
"sectionFreeTier": "Free draw tier odds (T1–T5, used in test)",
|
||||
"colTier": "Tier",
|
||||
"colWeight": "Weight",
|
||||
"colPercent": "Share",
|
||||
"emptyPaidTier": "No paid tier data (legacy records may only have tier_weights_snapshot)",
|
||||
"emptyFreeTier": "No free tier data",
|
||||
"sectionSnapshot": "Weight snapshot (T1–T5 / BIGWIN used in test)",
|
||||
"subCw": "Clockwise (non-BIGWIN)",
|
||||
"subCcw": "Counter-clockwise (non-BIGWIN)",
|
||||
"colGridNumber": "Dice points",
|
||||
"emptyCw": "No clockwise data",
|
||||
"emptyCcw": "No counter-clockwise data",
|
||||
"subBigwin": "BIGWIN (DiceRewardConfig snapshot)",
|
||||
"emptyBigwinTable": "No BIGWIN data",
|
||||
"sectionResult": "Landing stats (count per grid_number)",
|
||||
"chartXAxis": "Dice points (grid_number)",
|
||||
"emptyResult": "No landing data",
|
||||
"resultTotal": "Total landings: {n}",
|
||||
"btnImport": "Import to current config",
|
||||
"importTitle": "Import to production config",
|
||||
"importDesc": "Import this test record into DiceReward (cell weights), DiceRewardConfig (BIGWIN weight), and DiceLotteryPoolConfig (paid/free T1–T5 odds). Select target pools.",
|
||||
"importPaidLabel": "Import paid tier odds to pool",
|
||||
"importPaidPlaceholder": "Select a pool (paid pool recommended)",
|
||||
"importPaidTip": "If empty, uses paid pool ID saved on this record",
|
||||
"importFreeLabel": "Import free tier odds to pool",
|
||||
"importFreePlaceholder": "Select a pool (free pool recommended)",
|
||||
"importFreeTip": "If empty, uses free pool ID saved on this record",
|
||||
"btnConfirmImport": "Confirm import",
|
||||
"importSuccess": "Imported. DiceReward, DiceRewardConfig (BIGWIN), and pool config refreshed.",
|
||||
"importFail": "Import failed",
|
||||
"dash": "—",
|
||||
"dirCw": "Clockwise",
|
||||
"dirCcw": "Counter-clockwise"
|
||||
}
|
||||
}
|
||||
26
saiadmin-artd/src/locales/langs/en/safeguard/attachment.json
Normal file
26
saiadmin-artd/src/locales/langs/en/safeguard/attachment.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"search": {
|
||||
"username": "Username",
|
||||
"phone": "Phone",
|
||||
"status": "Status",
|
||||
"placeholderUsername": "Please enter username",
|
||||
"placeholderPhone": "Please enter phone",
|
||||
"searchSelectPlaceholder": "Please select"
|
||||
},
|
||||
"table": {
|
||||
"preview": "Preview",
|
||||
"fileName": "File Name",
|
||||
"storageMode": "Storage",
|
||||
"fileType": "File Type",
|
||||
"fileSize": "File Size",
|
||||
"uploadTime": "Upload Time"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "Add File",
|
||||
"titleEdit": "Edit File",
|
||||
"labelFileName": "File Name",
|
||||
"placeholderFileName": "Please enter file name",
|
||||
"ruleFileNameRequired": "Please enter file name",
|
||||
"editSuccess": "Updated successfully"
|
||||
}
|
||||
}
|
||||
19
saiadmin-artd/src/locales/langs/en/safeguard/database.json
Normal file
19
saiadmin-artd/src/locales/langs/en/safeguard/database.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"search": {
|
||||
"tableName": "Table Name",
|
||||
"placeholderTableName": "Please enter table name"
|
||||
},
|
||||
"table": {
|
||||
"tableName": "Table Name",
|
||||
"tableComment": "Table Comment",
|
||||
"tableEngine": "Table Engine",
|
||||
"updateTime": "Update Time",
|
||||
"totalRows": "Total Rows",
|
||||
"fragmentSize": "Fragment Size",
|
||||
"dataSize": "Data Size",
|
||||
"collation": "Collation",
|
||||
"createTime": "Create Time",
|
||||
"deleteTime": "Delete Time",
|
||||
"dataDetail": "Data Detail"
|
||||
}
|
||||
}
|
||||
12
saiadmin-artd/src/locales/langs/en/safeguard/dict.json
Normal file
12
saiadmin-artd/src/locales/langs/en/safeguard/dict.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"table": {
|
||||
"select": "Select",
|
||||
"dictName": "Dict Name",
|
||||
"dictCode": "Dict Code",
|
||||
"dictLabel": "Dict Label",
|
||||
"dictValue": "Dict Value",
|
||||
"color": "Color",
|
||||
"sort": "Sort",
|
||||
"status": "Status"
|
||||
}
|
||||
}
|
||||
22
saiadmin-artd/src/locales/langs/en/safeguard/login-log.json
Normal file
22
saiadmin-artd/src/locales/langs/en/safeguard/login-log.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"search": {
|
||||
"loginUser": "Login User",
|
||||
"loginIp": "Login IP",
|
||||
"loginStatus": "Login Status",
|
||||
"operTime": "Time",
|
||||
"placeholderLoginUser": "Please enter login user",
|
||||
"placeholderLoginIp": "Please enter login IP",
|
||||
"placeholderLoginStatus": "Please select login status"
|
||||
},
|
||||
"table": {
|
||||
"no": "No.",
|
||||
"loginUser": "Login User",
|
||||
"loginStatus": "Login Status",
|
||||
"loginIp": "Login IP",
|
||||
"operLocation": "Location",
|
||||
"os": "OS",
|
||||
"browser": "Browser",
|
||||
"loginMessage": "Login Message",
|
||||
"loginTime": "Login Time"
|
||||
}
|
||||
}
|
||||
20
saiadmin-artd/src/locales/langs/en/safeguard/oper-log.json
Normal file
20
saiadmin-artd/src/locales/langs/en/safeguard/oper-log.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"search": {
|
||||
"operator": "Operator",
|
||||
"router": "Route",
|
||||
"operIp": "IP",
|
||||
"operTime": "Time",
|
||||
"placeholderOperator": "Please enter operator",
|
||||
"placeholderOperRouter": "Please enter route",
|
||||
"placeholderOperIp": "Please enter IP"
|
||||
},
|
||||
"table": {
|
||||
"no": "No.",
|
||||
"operator": "Operator",
|
||||
"serviceName": "Service",
|
||||
"router": "Route",
|
||||
"operIp": "IP",
|
||||
"operLocation": "Location",
|
||||
"operTime": "Time"
|
||||
}
|
||||
}
|
||||
15
saiadmin-artd/src/locales/langs/en/system/config.json
Normal file
15
saiadmin-artd/src/locales/langs/en/system/config.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"search": {
|
||||
"group": "Group",
|
||||
"title": "Title",
|
||||
"configName": "Config Name",
|
||||
"placeholderGroup": "Please enter group",
|
||||
"placeholderTitle": "Please enter title",
|
||||
"placeholderConfigName": "Please enter config name"
|
||||
},
|
||||
"table": {
|
||||
"select": "Select",
|
||||
"configName": "Config Name",
|
||||
"configKey": "Config Key"
|
||||
}
|
||||
}
|
||||
39
saiadmin-artd/src/locales/langs/en/system/dept.json
Normal file
39
saiadmin-artd/src/locales/langs/en/system/dept.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"search": {
|
||||
"deptName": "channel(Department) Name",
|
||||
"deptCode": "Dept Code",
|
||||
"status": "Status",
|
||||
"placeholderDeptName": "Please enter dept name",
|
||||
"placeholderDeptCode": "Please enter dept code",
|
||||
"searchSelectPlaceholder": "Please select"
|
||||
},
|
||||
"table": {
|
||||
"deptName": "channel(Department) Name",
|
||||
"deptCode": "Dept Code",
|
||||
"leader": "Leader",
|
||||
"sort": "Sort",
|
||||
"status": "Status",
|
||||
"createTime": "Create Time"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "Add Department",
|
||||
"titleEdit": "Edit Department",
|
||||
"labelParentDept": "Parent Department",
|
||||
"labelDeptName": "Dept Name",
|
||||
"labelDeptCode": "Dept Code",
|
||||
"labelLeader": "Leader",
|
||||
"labelRemark": "Description",
|
||||
"labelSort": "Sort",
|
||||
"labelStatus": "Enabled",
|
||||
"placeholderDeptName": "Please enter dept name",
|
||||
"placeholderDeptCode": "Please enter dept code",
|
||||
"placeholderRemark": "Please enter description",
|
||||
"placeholderSort": "Please enter sort",
|
||||
"noParentDept": "No parent department",
|
||||
"ruleParentDeptRequired": "Please select parent department",
|
||||
"ruleDeptNameRequired": "Please enter dept name",
|
||||
"ruleDeptCodeRequired": "Please enter dept code",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
}
|
||||
}
|
||||
65
saiadmin-artd/src/locales/langs/en/system/menu.json
Normal file
65
saiadmin-artd/src/locales/langs/en/system/menu.json
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"search": {
|
||||
"menuName": "Menu Name",
|
||||
"route": "Route",
|
||||
"status": "Status",
|
||||
"placeholderMenuName": "Please enter menu name",
|
||||
"placeholderMenuRoute": "Please enter menu route",
|
||||
"searchSelectPlaceholder": "Please select"
|
||||
},
|
||||
"table": {
|
||||
"menuName": "Menu Name",
|
||||
"menuType": "Menu Type",
|
||||
"icon": "Icon",
|
||||
"route": "Route",
|
||||
"component": "Component",
|
||||
"auth": "Auth",
|
||||
"sort": "Sort",
|
||||
"status": "Status",
|
||||
"createTime": "Create Time"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "Add Menu",
|
||||
"titleEdit": "Edit Menu",
|
||||
"labelMenuType": "Menu Type",
|
||||
"labelParentMenu": "Parent Menu",
|
||||
"labelMenuName": "Menu Name",
|
||||
"labelRoutePath": "Route Path",
|
||||
"labelRoutePathTip": "Top-level: absolute path starting with / (e.g. /dashboard). Sub-level: relative path (e.g. console, user).",
|
||||
"placeholderRoutePath": "e.g. /dashboard or console",
|
||||
"labelComponentName": "Component Name",
|
||||
"placeholderComponentName": "e.g. User",
|
||||
"labelComponentPath": "Component Path",
|
||||
"labelComponentPathTip": "Fill component path under views. For directory menu, leave empty.",
|
||||
"placeholderComponentPath": "e.g. /system/user or leave empty",
|
||||
"labelMenuIcon": "Menu Icon",
|
||||
"labelPermSlug": "Permission Slug",
|
||||
"placeholderPermSlug": "Please enter permission slug",
|
||||
"labelLinkUrl": "External Link",
|
||||
"placeholderLinkUrl": "e.g. https://saithink.top",
|
||||
"labelSort": "Sort",
|
||||
"labelSortTip": "Larger number comes first",
|
||||
"placeholderSort": "Please enter sort",
|
||||
"labelStatus": "Status",
|
||||
"labelStatusTip": "After disabled, this menu item will be unavailable",
|
||||
"labelIsIframe": "Embedded",
|
||||
"labelIsIframeTip": "Only effective in external link mode",
|
||||
"labelIsKeepAlive": "Keep Alive",
|
||||
"labelIsKeepAliveTip": "Switching tabs won't refresh",
|
||||
"labelIsHidden": "Hidden",
|
||||
"labelIsHiddenTip": "Hidden in menu but accessible via route",
|
||||
"labelIsFixedTab": "Fixed Tab",
|
||||
"labelIsFixedTabTip": "Fixed in tabs bar",
|
||||
"labelIsFullPage": "Full Page",
|
||||
"labelIsFullPageTip": "Do not inherit side menu and top bar",
|
||||
"noParentMenu": "No parent menu",
|
||||
"ruleParentMenuRequired": "Please select parent menu",
|
||||
"ruleMenuNameRequired": "Please enter menu name",
|
||||
"ruleRoutePathRequired": "Please enter route path",
|
||||
"ruleComponentNameRequired": "Please enter component name",
|
||||
"rulePermSlugRequired": "Please enter permission slug",
|
||||
"ruleLinkUrlRequired": "Please enter external link",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
}
|
||||
}
|
||||
34
saiadmin-artd/src/locales/langs/en/system/post.json
Normal file
34
saiadmin-artd/src/locales/langs/en/system/post.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"search": {
|
||||
"postName": "Post Name",
|
||||
"postCode": "Post Code",
|
||||
"status": "Status",
|
||||
"placeholderPostName": "Please enter post name",
|
||||
"placeholderPostCode": "Please enter post code",
|
||||
"searchSelectPlaceholder": "Please select"
|
||||
},
|
||||
"table": {
|
||||
"postName": "Post Name",
|
||||
"postCode": "Post Code",
|
||||
"sort": "Sort",
|
||||
"status": "Status",
|
||||
"createTime": "Create Time"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "Add Post",
|
||||
"titleEdit": "Edit Post",
|
||||
"labelName": "Post Name",
|
||||
"labelCode": "Post Code",
|
||||
"labelRemark": "Description",
|
||||
"labelSort": "Sort",
|
||||
"labelStatus": "Enabled",
|
||||
"placeholderName": "Please enter post name",
|
||||
"placeholderCode": "Please enter post code",
|
||||
"placeholderRemark": "Please enter description",
|
||||
"placeholderSort": "Please enter sort",
|
||||
"ruleNameRequired": "Please enter post name",
|
||||
"ruleCodeRequired": "Please enter post code",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
}
|
||||
}
|
||||
38
saiadmin-artd/src/locales/langs/en/system/role.json
Normal file
38
saiadmin-artd/src/locales/langs/en/system/role.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"search": {
|
||||
"roleName": "Role Name",
|
||||
"roleCode": "Role Code",
|
||||
"status": "Status",
|
||||
"placeholderRoleName": "Please enter role name",
|
||||
"placeholderRoleCode": "Please enter role code",
|
||||
"searchSelectPlaceholder": "Please select"
|
||||
},
|
||||
"table": {
|
||||
"roleName": "Role Name",
|
||||
"roleCode": "Role Code",
|
||||
"level": "Level",
|
||||
"roleRemark": "Role Description",
|
||||
"status": "Status",
|
||||
"createTime": "Create Time"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "Add Role",
|
||||
"titleEdit": "Edit Role",
|
||||
"labelName": "Role Name",
|
||||
"labelCode": "Role Code",
|
||||
"labelLevel": "Role Level",
|
||||
"levelTip": "Controls role permission level, cannot operate roles with higher level than your own",
|
||||
"labelRemark": "Description",
|
||||
"labelSort": "Sort",
|
||||
"labelStatus": "Enabled",
|
||||
"placeholderName": "Please enter role name",
|
||||
"placeholderCode": "Please enter role code",
|
||||
"placeholderRemark": "Please enter role description",
|
||||
"placeholderSort": "Please enter sort",
|
||||
"ruleNameRequired": "Please enter role name",
|
||||
"ruleCodeRequired": "Please enter role code",
|
||||
"ruleLevelRequired": "Please enter role level",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
}
|
||||
}
|
||||
51
saiadmin-artd/src/locales/langs/en/system/user.json
Normal file
51
saiadmin-artd/src/locales/langs/en/system/user.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"search": {
|
||||
"username": "Username",
|
||||
"phone": "Phone",
|
||||
"status": "Status",
|
||||
"placeholderUsername": "Please enter username",
|
||||
"placeholderPhone": "Please enter phone",
|
||||
"searchSelectPlaceholder": "Please select"
|
||||
},
|
||||
"table": {
|
||||
"username": "Username",
|
||||
"phone": "Phone",
|
||||
"dept": "Department",
|
||||
"dashboard": "Dashboard",
|
||||
"loginTime": "Last Login",
|
||||
"agentId": "Agent ID",
|
||||
"status": "Status",
|
||||
"createTime": "Create Time",
|
||||
"updateTime": "Update Time"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "Add User",
|
||||
"titleEdit": "Edit User",
|
||||
"labelAvatar": "Avatar",
|
||||
"labelUsername": "Username",
|
||||
"labelRealname": "Real Name",
|
||||
"labelPassword": "Password",
|
||||
"labelPasswordConfirm": "Confirm Password",
|
||||
"labelEmail": "Email",
|
||||
"labelPhone": "Phone",
|
||||
"labelDept": "Department",
|
||||
"labelRole": "Role",
|
||||
"labelPost": "Post",
|
||||
"labelGender": "Gender",
|
||||
"labelStatus": "Status",
|
||||
"labelRemark": "Remark",
|
||||
"placeholderEmail": "Please enter email",
|
||||
"placeholderPhone": "Please enter phone",
|
||||
"placeholderRemark": "Please enter remark",
|
||||
"rulePasswordNotMatch": "Passwords do not match",
|
||||
"ruleUsernameRequired": "Please enter username",
|
||||
"ruleUsernameLength": "Length must be between 2 and 20 characters",
|
||||
"rulePasswordRequired": "Please enter password",
|
||||
"rulePasswordLength": "Length must be between 6 and 20 characters",
|
||||
"rulePasswordConfirmRequired": "Please enter confirm password",
|
||||
"ruleDeptRequired": "Please select department",
|
||||
"ruleRoleRequired": "Please select role",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
}
|
||||
}
|
||||
20
saiadmin-artd/src/locales/langs/en/tool/code.json
Normal file
20
saiadmin-artd/src/locales/langs/en/tool/code.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"search": {
|
||||
"tableName": "Table Name",
|
||||
"placeholderTableName": "Please enter table name",
|
||||
"placeholderDataSource": "Please enter data source"
|
||||
},
|
||||
"table": {
|
||||
"tableName": "Table Name",
|
||||
"tableDesc": "Table Desc",
|
||||
"tableComment": "Table Comment",
|
||||
"engine": "Engine",
|
||||
"collation": "Collation",
|
||||
"template": "Template",
|
||||
"namespace": "Namespace",
|
||||
"stub": "Stub",
|
||||
"tplCategory": "Gen Type",
|
||||
"updateTime": "Update Time",
|
||||
"createTime": "Create Time"
|
||||
}
|
||||
}
|
||||
62
saiadmin-artd/src/locales/langs/en/tool/crontab.json
Normal file
62
saiadmin-artd/src/locales/langs/en/tool/crontab.json
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"search": {
|
||||
"taskName": "Task Name",
|
||||
"taskType": "Task Type",
|
||||
"status": "Status",
|
||||
"placeholderTaskName": "Please enter task name",
|
||||
"searchSelectPlaceholder": "Please select"
|
||||
},
|
||||
"table": {
|
||||
"no": "No.",
|
||||
"taskName": "Task Name",
|
||||
"taskType": "Task Type",
|
||||
"rule": "Rule",
|
||||
"target": "Target",
|
||||
"status": "Status",
|
||||
"updateDate": "Update Date",
|
||||
"executeTime": "Execute Time",
|
||||
"parameter": "Parameter",
|
||||
"executeStatus": "Status"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "Add Scheduled Task",
|
||||
"titleEdit": "Edit Scheduled Task",
|
||||
"labelName": "Task Name",
|
||||
"labelType": "Task Type",
|
||||
"labelTaskStyle": "Schedule Rule",
|
||||
"labelTarget": "Target",
|
||||
"labelParams": "Parameters",
|
||||
"labelStatus": "Status",
|
||||
"labelRemark": "Remark",
|
||||
"placeholderName": "Please enter task name",
|
||||
"placeholderTarget": "Please enter target",
|
||||
"placeholderParams": "Please enter parameters",
|
||||
"placeholderRemark": "Please enter remark",
|
||||
"taskStyleEveryDay": "Every day",
|
||||
"taskStyleEveryHour": "Every hour",
|
||||
"taskStyleNHours": "N hours",
|
||||
"taskStyleNMinutes": "N minutes",
|
||||
"taskStyleNSeconds": "N seconds",
|
||||
"taskStyleEveryWeek": "Every week",
|
||||
"taskStyleEveryMonth": "Every month",
|
||||
"taskStyleEveryYear": "Every year",
|
||||
"weekMon": "Mon",
|
||||
"weekTue": "Tue",
|
||||
"weekWed": "Wed",
|
||||
"weekThu": "Thu",
|
||||
"weekFri": "Fri",
|
||||
"weekSat": "Sat",
|
||||
"weekSun": "Sun",
|
||||
"unitMonth": "Month",
|
||||
"unitDay": "Day",
|
||||
"unitHour": "Hour",
|
||||
"unitMinute": "Minute",
|
||||
"unitSecond": "Second",
|
||||
"ruleNameRequired": "Task name is required",
|
||||
"ruleTypeRequired": "Task type is required",
|
||||
"ruleTaskStyleRequired": "Schedule rule is required",
|
||||
"ruleTargetRequired": "Target is required",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@
|
||||
"userCenter": "个人中心",
|
||||
"docs": "使用文档",
|
||||
"github": "Github",
|
||||
"clearCache": "清除缓存",
|
||||
"lockScreen": "锁定屏幕",
|
||||
"logout": "退出登录"
|
||||
},
|
||||
@@ -38,6 +39,25 @@
|
||||
"confirm": "确定",
|
||||
"logOutTips": "您是否要退出登录?"
|
||||
},
|
||||
"form": {
|
||||
"placeholderInput": "请输入",
|
||||
"placeholderSelect": "请选择",
|
||||
"labelRemark": "备注",
|
||||
"labelStatus": "状态",
|
||||
"labelName": "名称",
|
||||
"close": "关闭"
|
||||
},
|
||||
"dict": {
|
||||
"data_status": {
|
||||
"1": "正常",
|
||||
"2": "停用"
|
||||
},
|
||||
"gender": {
|
||||
"1": "男",
|
||||
"2": "女",
|
||||
"3": "未知"
|
||||
}
|
||||
},
|
||||
"search": {
|
||||
"placeholder": "搜索页面",
|
||||
"historyTitle": "搜索历史",
|
||||
@@ -230,6 +250,56 @@
|
||||
"500": "抱歉,服务器出错了",
|
||||
"gohome": "返回首页"
|
||||
},
|
||||
"console": {
|
||||
"card": {
|
||||
"playerRegister": "玩家注册",
|
||||
"playerCharge": "玩家充值",
|
||||
"playerWithdraw": "玩家提现",
|
||||
"playerPlayCount": "玩家游玩次数",
|
||||
"vsLastWeek": "较上周"
|
||||
},
|
||||
"newPlayer": {
|
||||
"title": "新增玩家",
|
||||
"subtitle": "最新50条新增玩家记录",
|
||||
"player": "玩家",
|
||||
"balance": "余额",
|
||||
"ticket": "抽奖券"
|
||||
},
|
||||
"walletRecord": {
|
||||
"title": "玩家充值记录",
|
||||
"subtitle": "最新50条充值记录",
|
||||
"player": "玩家",
|
||||
"chargeAmount": "充值金额",
|
||||
"chargeTime": "充值时间"
|
||||
},
|
||||
"salesOverview": {
|
||||
"title": "近期玩家充值统计"
|
||||
},
|
||||
"activeUser": {
|
||||
"title": "月度玩家充值汇总"
|
||||
},
|
||||
"todo": {
|
||||
"title": "代办事项",
|
||||
"pending": "待处理"
|
||||
},
|
||||
"newUser": {
|
||||
"title": "新用户",
|
||||
"growth": "这个月增长",
|
||||
"thisMonth": "本月",
|
||||
"lastMonth": "上月",
|
||||
"thisYear": "今年",
|
||||
"avatar": "头像",
|
||||
"region": "地区",
|
||||
"gender": "性别",
|
||||
"progress": "进度",
|
||||
"male": "男",
|
||||
"female": "女"
|
||||
},
|
||||
"dynamic": {
|
||||
"title": "动态",
|
||||
"newCount": "新增"
|
||||
}
|
||||
},
|
||||
"menus": {
|
||||
"login": {
|
||||
"title": "登录"
|
||||
@@ -263,7 +333,39 @@
|
||||
"user": "用户管理",
|
||||
"role": "角色管理",
|
||||
"userCenter": "个人中心",
|
||||
"menu": "菜单管理"
|
||||
"menu": "菜单管理",
|
||||
"dept": "渠道(部门)管理",
|
||||
"post": "岗位管理",
|
||||
"config": "系统配置"
|
||||
},
|
||||
"safeguard": {
|
||||
"title": "运维管理",
|
||||
"dict": "数据字典",
|
||||
"server": "服务监控",
|
||||
"operLog": "操作日志",
|
||||
"loginLog": "登录日志",
|
||||
"emailLog": "邮件日志",
|
||||
"database": "数据库",
|
||||
"cache": "缓存管理",
|
||||
"attachment": "附件管理"
|
||||
},
|
||||
"tool": {
|
||||
"title": "开发工具",
|
||||
"crontab": "定时任务",
|
||||
"code": "代码生成"
|
||||
},
|
||||
"dice": {
|
||||
"title": "大富翁-色子游戏",
|
||||
"lotteryPoolConfig": "彩金池配置",
|
||||
"player": "玩家管理",
|
||||
"playerWalletRecord": "玩家钱包记录",
|
||||
"playRecord": "玩家抽奖记录",
|
||||
"playerTicketRecord": "玩家票券记录",
|
||||
"rewardConfig": "奖励配置",
|
||||
"reward": "色子奖励权重",
|
||||
"rewardConfigRecord": "权重测试记录",
|
||||
"playRecordTest": "抽奖记录(测试权重)",
|
||||
"config": "游戏配置"
|
||||
}
|
||||
},
|
||||
"table": {
|
||||
@@ -277,7 +379,54 @@
|
||||
"expand": "展开",
|
||||
"collapse": "收起",
|
||||
"searchInputPlaceholder": "请输入",
|
||||
"searchSelectPlaceholder": "请选择"
|
||||
"searchSelectPlaceholder": "请选择",
|
||||
"all": "全部",
|
||||
"min": "最小",
|
||||
"max": "最大",
|
||||
"startTime": "开始时间",
|
||||
"endTime": "结束时间",
|
||||
"placeholderUsername": "请输入用户名",
|
||||
"placeholderNickname": "请输入昵称",
|
||||
"placeholderPhone": "请输入手机号",
|
||||
"placeholderPhoneFuzzy": "手机号模糊查询",
|
||||
"placeholderName": "请输入名称",
|
||||
"placeholderGroup": "请输入分组",
|
||||
"placeholderTitle": "请输入标题",
|
||||
"placeholderConfigName": "请输入配置名称",
|
||||
"placeholderTaskName": "请输入任务名称",
|
||||
"placeholderTableName": "请输入数据表名称",
|
||||
"placeholderDataSource": "请输入数据源名称",
|
||||
"placeholderDeptName": "请输入部门名称",
|
||||
"placeholderDeptCode": "请输入部门编码",
|
||||
"placeholderRoleName": "请输入角色名称",
|
||||
"placeholderRoleCode": "请输入角色编码",
|
||||
"placeholderPostName": "请输入岗位名称",
|
||||
"placeholderPostCode": "请输入岗位编码",
|
||||
"placeholderMenuName": "请输入菜单名称",
|
||||
"placeholderMenuRoute": "请输入菜单路由",
|
||||
"placeholderOperator": "请输入操作用户",
|
||||
"placeholderOperRouter": "请输入操作路由",
|
||||
"placeholderOperIp": "请输入操作IP",
|
||||
"placeholderLoginUser": "请输入登录用户",
|
||||
"placeholderLoginIp": "请输入登录IP",
|
||||
"placeholderLoginStatus": "请选择登录状态",
|
||||
"labelFrom": "发件人",
|
||||
"labelTo": "收件人",
|
||||
"placeholderFrom": "请输入发件人",
|
||||
"placeholderTo": "请输入收件人",
|
||||
"placeholderSendStatus": "请选择发送状态",
|
||||
"placeholderPoolType": "请选择奖池类型",
|
||||
"usernameFuzzy": "用户名模糊",
|
||||
"nameFuzzy": "名称模糊",
|
||||
"uiTextFuzzy": "前端显示文本模糊",
|
||||
"fuzzyQuery": "模糊查询",
|
||||
"byUsername": "按用户名搜索",
|
||||
"exactSearch": "精确搜索",
|
||||
"enable": "启用",
|
||||
"disable": "禁用",
|
||||
"rangeSeparator": "至",
|
||||
"success": "成功",
|
||||
"failure": "失败"
|
||||
},
|
||||
"selection": "选择",
|
||||
"sizeOptions": {
|
||||
@@ -290,6 +439,184 @@
|
||||
"expand": "展开",
|
||||
"index": "序号"
|
||||
},
|
||||
"actions": {
|
||||
"add": "新增",
|
||||
"delete": "删除",
|
||||
"edit": "编辑",
|
||||
"operation": "操作",
|
||||
"refresh": "刷新",
|
||||
"export": "导出",
|
||||
"import": "导入"
|
||||
},
|
||||
"columns": {
|
||||
"common": {
|
||||
"id": "ID",
|
||||
"status": "状态",
|
||||
"createTime": "创建时间",
|
||||
"updateTime": "更新时间",
|
||||
"operation": "操作",
|
||||
"remark": "备注",
|
||||
"sort": "排序",
|
||||
"name": "名称",
|
||||
"no": "编号",
|
||||
"description": "描述",
|
||||
"select": "选中"
|
||||
},
|
||||
"system": {
|
||||
"username": "用户名",
|
||||
"phone": "手机号",
|
||||
"dept": "部门",
|
||||
"dashboard": "首页",
|
||||
"loginTime": "上次登录",
|
||||
"agentId": "代理ID",
|
||||
"postName": "岗位名称",
|
||||
"postCode": "岗位编码",
|
||||
"deptName": "部门名称",
|
||||
"deptCode": "部门编码",
|
||||
"leader": "部门领导",
|
||||
"roleName": "角色名称",
|
||||
"roleCode": "角色编码",
|
||||
"level": "角色级别",
|
||||
"roleRemark": "角色描述",
|
||||
"menuName": "菜单名称",
|
||||
"menuType": "菜单类型",
|
||||
"icon": "图标",
|
||||
"component": "组件名称",
|
||||
"route": "路由",
|
||||
"auth": "权限标识",
|
||||
"configKey": "配置标识",
|
||||
"configTitle": "配置标题",
|
||||
"inputType": "组件类型",
|
||||
"configName": "配置名称",
|
||||
"group": "分组",
|
||||
"title": "标题",
|
||||
"titleEn": "标题(英文)",
|
||||
"value": "值",
|
||||
"valueEn": "值(英文)",
|
||||
"noParentDept": "无上级部门",
|
||||
"noParentMenu": "无上级菜单",
|
||||
"input": "文本框",
|
||||
"textarea": "文本域",
|
||||
"select": "下拉选择框",
|
||||
"radio": "单选框",
|
||||
"uploadImage": "图片上传",
|
||||
"uploadFile": "文件上传",
|
||||
"wangEditor": "富文本编辑器",
|
||||
"createDate": "创建日期",
|
||||
"updateDate": "更新日期"
|
||||
},
|
||||
"safeguard": {
|
||||
"operator": "操作用户",
|
||||
"serviceName": "业务名称",
|
||||
"router": "路由",
|
||||
"operIp": "操作IP",
|
||||
"operLocation": "操作地点",
|
||||
"operTime": "操作时间",
|
||||
"loginUser": "登录用户",
|
||||
"loginStatus": "登录状态",
|
||||
"loginIp": "登录IP",
|
||||
"loginLocation": "登录地点",
|
||||
"os": "操作系统",
|
||||
"browser": "浏览器",
|
||||
"tableName": "表名称",
|
||||
"tableComment": "表注释",
|
||||
"engine": "引擎",
|
||||
"tableEngine": "表引擎",
|
||||
"totalRows": "总行数",
|
||||
"fragmentSize": "碎片大小",
|
||||
"dataSize": "数据大小",
|
||||
"collation": "编码",
|
||||
"dictName": "字典名称",
|
||||
"dictCode": "字典标识",
|
||||
"dictLabel": "字典标签",
|
||||
"dictValue": "字典键值",
|
||||
"color": "颜色",
|
||||
"preview": "预览",
|
||||
"fileName": "文件名称",
|
||||
"storageMode": "存储模式",
|
||||
"fileType": "文件类型",
|
||||
"fileSize": "文件大小",
|
||||
"uploadTime": "上传时间",
|
||||
"deleteTime": "删除时间",
|
||||
"dataDetail": "数据详情",
|
||||
"executeTime": "执行时间",
|
||||
"target": "调用目标",
|
||||
"parameter": "任务参数",
|
||||
"executeStatus": "执行状态",
|
||||
"loginMessage": "登录信息",
|
||||
"loginTime": "登录时间",
|
||||
"gateway": "服务Host",
|
||||
"emailFrom": "发件人",
|
||||
"emailTo": "收件人",
|
||||
"emailCode": "验证码",
|
||||
"emailResponse": "发送结果",
|
||||
"sendTime": "发送时间",
|
||||
"sendStatus": "发送状态"
|
||||
},
|
||||
"tool": {
|
||||
"taskName": "任务名称",
|
||||
"taskType": "任务类型",
|
||||
"rule": "定时规则",
|
||||
"updateDate": "更新日期",
|
||||
"tableDesc": "表描述",
|
||||
"template": "应用类型",
|
||||
"namespace": "应用名称",
|
||||
"stub": "模板类型",
|
||||
"tplCategory": "生成类型",
|
||||
"topMenu": "顶级菜单"
|
||||
},
|
||||
"dice": {
|
||||
"player": "玩家",
|
||||
"lotteryPoolConfig": "彩金池配置",
|
||||
"drawType": "抽奖类型",
|
||||
"isBigWin": "是否中大奖",
|
||||
"winCoin": "赢取平台币",
|
||||
"superWinCoin": "中大奖平台币",
|
||||
"rewardWinCoin": "摇色子中奖平台币",
|
||||
"direction": "方向",
|
||||
"startIndex": "起始索引",
|
||||
"targetIndex": "终点索引",
|
||||
"rollArray": "摇取点数",
|
||||
"rollNumber": "摇取点数和",
|
||||
"rewardConfig": "奖励配置",
|
||||
"user": "用户",
|
||||
"coinChange": "平台币变化",
|
||||
"type": "类型",
|
||||
"operator": "操作人",
|
||||
"walletBefore": "钱包操作前",
|
||||
"walletAfter": "钱包操作后",
|
||||
"totalDrawCount": "总抽奖次数",
|
||||
"paidDrawCount": "购买抽奖次数",
|
||||
"freeDrawCount": "赠送抽奖次数",
|
||||
"paidDraw": "付费抽取",
|
||||
"freeDraw": "免费抽取",
|
||||
"platformProfit": "平台赚取金额",
|
||||
"createdBy": "创建管理员",
|
||||
"rewardTier": "奖励档位",
|
||||
"poolType": "奖池类型",
|
||||
"safetyLine": "安全线",
|
||||
"t1PoolWeight": "T1池权重",
|
||||
"t2PoolWeight": "T2池权重",
|
||||
"t3PoolWeight": "T3池权重",
|
||||
"t4PoolWeight": "T4池权重",
|
||||
"t5PoolWeight": "T5池权重",
|
||||
"endIndex": "结束索引(end_index)",
|
||||
"tier": "档位",
|
||||
"dicePoints": "色子点数(摇取5-30)",
|
||||
"displayText": "显示文本",
|
||||
"realEv": "实际中奖金额",
|
||||
"weight": "权重(1-10000)",
|
||||
"nickname": "昵称",
|
||||
"coin": "平台币",
|
||||
"t1Weight": "T1权重",
|
||||
"t2Weight": "T2权重",
|
||||
"t3Weight": "T3权重",
|
||||
"t4Weight": "T4权重",
|
||||
"t5Weight": "T5权重",
|
||||
"playerUsername": "玩家用户名",
|
||||
"useCoins": "消耗硬币"
|
||||
}
|
||||
},
|
||||
"zebra": "斑马纹",
|
||||
"border": "边框",
|
||||
"headerBackground": "表头背景"
|
||||
|
||||
41
saiadmin-artd/src/locales/langs/zh/dice/config.json
Normal file
41
saiadmin-artd/src/locales/langs/zh/dice/config.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"form": {
|
||||
"dialogTitleAdd": "新增摇色子配置",
|
||||
"dialogTitleEdit": "编辑摇色子配置",
|
||||
"group": "分组",
|
||||
"placeholderGroup": "请输入分组",
|
||||
"title": "标题",
|
||||
"placeholderTitleZh": "请输入标题(中文)",
|
||||
"titleEn": "标题(英文)",
|
||||
"placeholderTitleEn": "请输入标题(英文)",
|
||||
"configName": "配置名称",
|
||||
"placeholderConfigName": "请输入配置名称",
|
||||
"value": "值",
|
||||
"placeholderValueZh": "请输入值(中文)",
|
||||
"valueEn": "值(英文)",
|
||||
"placeholderValueEn": "请输入值(英文)",
|
||||
"ruleGroupRequired": "分组必需填写",
|
||||
"ruleTitleRequired": "标题必需填写",
|
||||
"ruleTitleEnMax": "英文标题长度需小于 255 字符",
|
||||
"ruleConfigNameRequired": "配置名称必需填写",
|
||||
"ruleValueRequired": "值必需填写",
|
||||
"saveSuccess": "新增成功",
|
||||
"updateSuccess": "修改成功"
|
||||
},
|
||||
"search": {
|
||||
"group": "分组",
|
||||
"title": "标题",
|
||||
"configName": "配置名称",
|
||||
"placeholderGroup": "请输入分组",
|
||||
"placeholderTitle": "请输入标题",
|
||||
"placeholderConfigName": "请输入配置名称"
|
||||
},
|
||||
"table": {
|
||||
"group": "分组",
|
||||
"title": "标题",
|
||||
"titleEn": "标题(英文)",
|
||||
"configName": "配置名称",
|
||||
"value": "值",
|
||||
"valueEn": "值(英文)"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "名称",
|
||||
"form": {
|
||||
"dialogTitleAdd": "新增色子奖池配置",
|
||||
"dialogTitleEdit": "编辑色子奖池配置",
|
||||
"placeholderName": "请输入名称",
|
||||
"placeholderRemark": "请输入备注",
|
||||
"poolType": "奖池类型",
|
||||
"placeholderPoolType": "请选择奖池类型",
|
||||
"poolTypeNormal": "正常",
|
||||
"poolTypeKill": "强制杀猪",
|
||||
"poolTypeT1": "T1高倍率",
|
||||
"safetyLine": "安全线",
|
||||
"t1Weight": "T1池权重(%)",
|
||||
"t2Weight": "T2池权重(%)",
|
||||
"t3Weight": "T3池权重(%)",
|
||||
"t4Weight": "T4池权重(%)",
|
||||
"t5Weight": "T5池权重(%)",
|
||||
"weightsSumHint": "五个池权重总和:",
|
||||
"weightsSumUnit": "% / 100%(必须为100%)",
|
||||
"currentPoolTitle": "当前彩金池",
|
||||
"loading": "加载中...",
|
||||
"poolName": "池子名称",
|
||||
"playerProfit": "玩家累计盈利(profit_amount):",
|
||||
"realtime": "实时",
|
||||
"profitCalcHint": "计算方式:每局按“当前中奖金额(含超级大奖 BIGWIN)减去抽奖券费用 100”累加,弹窗打开期间每 2 秒自动刷新",
|
||||
"tierRuleTitle": "抽奖档位规则",
|
||||
"tierRuleContent": "当玩家在当前彩金池的累计盈利 低于安全线 时,按 玩家 的 T*_weight 权重抽取档位;当累计盈利 高于或等于安全线 时,按 当前彩金池 的 T*_weight 权重抽取档位(杀分)。",
|
||||
"killScoreWeights": "杀分权重",
|
||||
"killWeightNote": "(杀分权重来自奖池配置,请在列表中编辑对应记录)",
|
||||
"btnResetProfit": "重置玩家累计盈利",
|
||||
"btnSaveSafetyLine": "保存安全线",
|
||||
"ruleSafetyLineRequired": "请输入安全线",
|
||||
"msgGetPoolFailed": "获取彩金池失败",
|
||||
"msgSaveSuccess": "保存成功",
|
||||
"msgResetProfitSuccess": "玩家累计盈利已重置为 0",
|
||||
"msgResetFailed": "重置失败",
|
||||
"ruleNameRequired": "名称必需填写",
|
||||
"rulePoolTypeRequired": "请选择奖池类型",
|
||||
"ruleT1Required": "T1池权重必需填写",
|
||||
"ruleT2Required": "T2池权重必需填写",
|
||||
"ruleT3Required": "T3池权重必需填写",
|
||||
"ruleT4Required": "T4池权重必需填写",
|
||||
"ruleT5Required": "T5池权重必需填写",
|
||||
"msgWeightsMust100": "五个池权重总和必须为100%",
|
||||
"msgAddSuccess": "新增成功",
|
||||
"msgUpdateSuccess": "修改成功"
|
||||
},
|
||||
"toolbar": {
|
||||
"viewCurrentPool": "查看当前彩金池"
|
||||
},
|
||||
"search": {
|
||||
"poolType": "奖池类型",
|
||||
"placeholderName": "请输入名称",
|
||||
"placeholderPoolType": "请选择奖池类型",
|
||||
"poolTypeNormal": "正常",
|
||||
"poolTypeKill": "强制杀猪",
|
||||
"poolTypeT1": "T1高倍率"
|
||||
},
|
||||
"table": {
|
||||
"name": "名称",
|
||||
"poolType": "奖池类型",
|
||||
"safetyLine": "安全线",
|
||||
"t1PoolWeight": "T1池权重",
|
||||
"t2PoolWeight": "T2池权重",
|
||||
"t3PoolWeight": "T3池权重",
|
||||
"t4PoolWeight": "T4池权重",
|
||||
"t5PoolWeight": "T5池权重"
|
||||
}
|
||||
}
|
||||
80
saiadmin-artd/src/locales/langs/zh/dice/play_record.json
Normal file
80
saiadmin-artd/src/locales/langs/zh/dice/play_record.json
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"form": {
|
||||
"dialogTitleAdd": "新增玩家抽奖记录",
|
||||
"dialogTitleEdit": "编辑玩家抽奖记录",
|
||||
"player": "玩家",
|
||||
"placeholderPlayer": "请选择玩家(显示用户名)",
|
||||
"lotteryPoolConfig": "彩金池配置",
|
||||
"placeholderLotteryPool": "请选择彩金池配置",
|
||||
"drawType": "抽奖类型",
|
||||
"paid": "付费",
|
||||
"free": "赠送",
|
||||
"isBigWin": "是否中大奖",
|
||||
"noBigWin": "无",
|
||||
"bigWin": "中大奖",
|
||||
"winCoin": "赢取平台币",
|
||||
"placeholderWinCoin": "= 中大奖 + 摇色子中奖",
|
||||
"superWinCoin": "中大奖平台币",
|
||||
"placeholderSuperWinCoin": "豹子时发放",
|
||||
"rewardWinCoin": "摇色子中奖平台币",
|
||||
"placeholderRewardWinCoin": "摇色子中奖",
|
||||
"direction": "方向",
|
||||
"placeholderDirection": "请选择方向",
|
||||
"clockwise": "顺时针",
|
||||
"anticlockwise": "逆时针",
|
||||
"startIndex": "起始索引",
|
||||
"placeholderStartIndex": "起始索引",
|
||||
"targetIndex": "终点索引",
|
||||
"placeholderTargetIndex": "终点索引",
|
||||
"rollArray": "摇取点数",
|
||||
"rollArrayHint": "固定 5 个数,每个 1~6",
|
||||
"rollNumber": "摇取点数和",
|
||||
"placeholderRollNumber": "5 个色子点数之和(5~30)",
|
||||
"rewardConfig": "奖励配置",
|
||||
"placeholderRewardConfig": "请选择奖励配置(显示前端文本)",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功",
|
||||
"validateFailed": "表单验证失败,请检查必填项与格式"
|
||||
},
|
||||
"toolbar": {
|
||||
"platformTotalProfit": "平台总盈利"
|
||||
},
|
||||
"search": {
|
||||
"player": "玩家",
|
||||
"lotteryPoolConfig": "彩金池配置",
|
||||
"drawType": "抽奖类型",
|
||||
"isBigWin": "是否中大奖",
|
||||
"direction": "方向",
|
||||
"winCoin": "赢取平台币",
|
||||
"rollNumber": "摇取点数和",
|
||||
"rewardConfig": "奖励配置",
|
||||
"rewardTier": "奖励档位",
|
||||
"usernameFuzzy": "用户名模糊",
|
||||
"nameFuzzy": "名称模糊",
|
||||
"uiTextFuzzy": "前端显示文本模糊",
|
||||
"paid": "付费",
|
||||
"free": "赠送",
|
||||
"noBigWin": "无",
|
||||
"bigWin": "中大奖",
|
||||
"clockwise": "顺时针",
|
||||
"anticlockwise": "逆时针"
|
||||
},
|
||||
"table": {
|
||||
"id": "ID",
|
||||
"player": "玩家",
|
||||
"lotteryPoolConfig": "彩金池配置",
|
||||
"drawType": "抽奖类型",
|
||||
"isBigWin": "是否中大奖",
|
||||
"winCoin": "赢取平台币",
|
||||
"superWinCoin": "中大奖平台币",
|
||||
"rewardWinCoin": "摇色子中奖平台币",
|
||||
"direction": "方向",
|
||||
"startIndex": "起始索引",
|
||||
"targetIndex": "终点索引",
|
||||
"rollArray": "摇取点数",
|
||||
"rollNumber": "摇取点数和",
|
||||
"rewardConfig": "奖励配置",
|
||||
"createTime": "创建时间",
|
||||
"updateTime": "更新时间"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"toolbar": {
|
||||
"clearAllData": "一键删除所有数据",
|
||||
"platformTotalProfit": "平台总盈利"
|
||||
},
|
||||
"search": {
|
||||
"drawType": "抽奖类型",
|
||||
"direction": "方向",
|
||||
"isBigWin": "是否中大奖",
|
||||
"winCoin": "赢取平台币",
|
||||
"rewardTier": "奖励档位",
|
||||
"rollNumber": "摇取点数和",
|
||||
"paid": "付费",
|
||||
"free": "赠送",
|
||||
"clockwise": "顺时针",
|
||||
"anticlockwise": "逆时针",
|
||||
"noBigWin": "无",
|
||||
"bigWin": "中大奖"
|
||||
},
|
||||
"table": {
|
||||
"id": "ID",
|
||||
"player": "玩家",
|
||||
"lotteryPoolConfig": "彩金池配置",
|
||||
"drawType": "抽奖类型",
|
||||
"isBigWin": "是否中大奖",
|
||||
"winCoin": "赢取平台币",
|
||||
"superWinCoin": "中大奖平台币",
|
||||
"rewardWinCoin": "摇色子中奖平台币",
|
||||
"direction": "方向",
|
||||
"startIndex": "起始索引",
|
||||
"targetIndex": "终点索引",
|
||||
"rollArray": "摇取点数",
|
||||
"rollNumber": "摇取点数和",
|
||||
"rewardConfig": "奖励配置",
|
||||
"createTime": "创建时间"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "新增玩家抽奖记录(测试数据)",
|
||||
"titleEdit": "编辑玩家抽奖记录(测试数据)",
|
||||
"labelLotteryConfigId": "彩金池配置id",
|
||||
"placeholderLotteryConfigId": "请输入彩金池配置id",
|
||||
"placeholderWinCoin": "赢取平台币",
|
||||
"placeholderRewardTier": "请选择档位(选后自动带出奖励配置ID)",
|
||||
"rewardConfigId": "奖励配置id",
|
||||
"placeholderRewardConfigId": "可选中奖档位自动带出或手动输入",
|
||||
"placeholderStartIndex": "请输入起始索引",
|
||||
"labelTargetIndex": "结束索引",
|
||||
"placeholderTargetIndex": "请输入结束索引",
|
||||
"placeholderRollNumber": "请输入摇取点数和",
|
||||
"labelRollArray": "摇取点数:[1,2,3,4,5,6]",
|
||||
"placeholderRollArray": "请输入摇取点数:[1,2,3,4,5,6]",
|
||||
"labelStatus": "状态:0=失败,1=成功",
|
||||
"placeholderSuperWinCoin": "请输入中大奖平台币",
|
||||
"placeholderRewardWinCoin": "请输入摇色子中奖平台币",
|
||||
"labelAdminId": "所属管理员",
|
||||
"placeholderAdminId": "请输入所属管理员",
|
||||
"ruleLotteryConfigIdRequired": "彩金池配置id必需填写",
|
||||
"ruleDrawTypeRequired": "抽奖类型必需填写",
|
||||
"ruleIsBigWinRequired": "是否中大奖必需填写",
|
||||
"ruleDirectionRequired": "方向必需填写",
|
||||
"ruleRewardConfigIdRequired": "奖励配置id必需填写",
|
||||
"ruleStatusRequired": "状态必需填写",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
}
|
||||
}
|
||||
80
saiadmin-artd/src/locales/langs/zh/dice/player.json
Normal file
80
saiadmin-artd/src/locales/langs/zh/dice/player.json
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "名称",
|
||||
"form": {
|
||||
"dialogTitleAdd": "新增大富翁-玩家",
|
||||
"dialogTitleEdit": "编辑大富翁-玩家",
|
||||
"username": "用户名",
|
||||
"placeholderUsername": "请输入用户名",
|
||||
"nickname": "昵称",
|
||||
"placeholderNickname": "请输入昵称",
|
||||
"phone": "手机号",
|
||||
"placeholderPhone": "请输入手机号",
|
||||
"password": "密码",
|
||||
"placeholderPasswordEdit": "编辑留空则不修改",
|
||||
"status": "状态",
|
||||
"adminId": "所属管理员",
|
||||
"placeholderAdmin": "选择后台管理员(可选)",
|
||||
"coin": "平台币",
|
||||
"placeholderCoinAdd": "创建时默认0,不可改",
|
||||
"lotteryPoolConfig": "彩金池配置",
|
||||
"placeholderLotteryPool": "留空则使用下方自定义权重,或选择彩金池",
|
||||
"currentConfig": "当前配置",
|
||||
"configLabelName": "名称",
|
||||
"configLabelType": "类型",
|
||||
"configLabelWeights": "T1~T5 权重",
|
||||
"configLabelRemark": "备注",
|
||||
"t1Weight": "T1池权重(%)",
|
||||
"t2Weight": "T2池权重(%)",
|
||||
"t3Weight": "T3池权重(%)",
|
||||
"t4Weight": "T4池权重(%)",
|
||||
"t5Weight": "T5池权重(%)",
|
||||
"weightsSumHint": "五个池权重总和:",
|
||||
"weightsSumUnit": "% / 100%(必须为100%)",
|
||||
"ruleWeightsSumMustBe100": "五个池权重总和必须为100%",
|
||||
"walletTitle": "玩家钱包操作",
|
||||
"walletPlayer": "玩家",
|
||||
"walletBalance": "钱包余额",
|
||||
"operationType": "操作类型",
|
||||
"typeAdd": "加点",
|
||||
"typeSub": "扣点",
|
||||
"coinChange": "平台币变动",
|
||||
"placeholderCoinChange": "正数,扣点时不能超过余额",
|
||||
"placeholderRemarkOptional": "选填,不填则按类型自动填写",
|
||||
"ruleSelectType": "请选择操作类型",
|
||||
"ruleEnterCoin": "请输入平台币变动",
|
||||
"ruleCoinPositive": "平台币变动必须大于 0",
|
||||
"ruleDeductExceed": "扣点不能超过当前余额",
|
||||
"operateSuccess": "操作成功"
|
||||
},
|
||||
"search": {
|
||||
"username": "用户名",
|
||||
"nickname": "昵称",
|
||||
"phone": "手机号",
|
||||
"status": "状态",
|
||||
"coin": "平台币",
|
||||
"lotteryPoolConfig": "彩金池配置",
|
||||
"placeholderUsername": "请输入用户名",
|
||||
"placeholderNickname": "请输入昵称",
|
||||
"placeholderPhoneFuzzy": "手机号模糊查询",
|
||||
"placeholderAll": "全部",
|
||||
"exactSearch": "精确搜索"
|
||||
},
|
||||
"table": {
|
||||
"username": "用户名",
|
||||
"phone": "手机号",
|
||||
"nickname": "昵称",
|
||||
"status": "状态",
|
||||
"coin": "平台币",
|
||||
"lotteryPoolConfig": "彩金池配置",
|
||||
"t1Weight": "T1权重",
|
||||
"t2Weight": "T2权重",
|
||||
"t3Weight": "T3权重",
|
||||
"t4Weight": "T4权重",
|
||||
"t5Weight": "T5权重",
|
||||
"totalDrawCount": "总抽奖次数",
|
||||
"paidDrawCount": "购买抽奖次数",
|
||||
"freeDrawCount": "赠送抽奖次数",
|
||||
"createTime": "创建时间",
|
||||
"updateTime": "更新时间"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"form": {
|
||||
"dialogTitleAdd": "新增抽奖券获取记录",
|
||||
"dialogTitleEdit": "编辑抽奖券获取记录",
|
||||
"player": "玩家",
|
||||
"placeholderPlayer": "请选择玩家(显示用户名)",
|
||||
"useCoins": "消耗硬币",
|
||||
"placeholderUseCoins": "请输入消耗硬币",
|
||||
"paidDrawCount": "购买抽奖次数",
|
||||
"placeholderPaidDrawCount": "请输入购买抽奖次数",
|
||||
"freeDrawCount": "赠送抽奖次数",
|
||||
"placeholderFreeDrawCount": "请输入赠送抽奖次数",
|
||||
"totalDrawCount": "总抽奖次数",
|
||||
"placeholderTotalDrawCount": "自动求和",
|
||||
"placeholderRemark": "请输入备注(必填)",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
},
|
||||
"search": {
|
||||
"player": "玩家",
|
||||
"useCoins": "消耗硬币",
|
||||
"totalDrawCount": "总抽奖次数",
|
||||
"paidDrawCount": "购买抽奖次数",
|
||||
"freeDrawCount": "赠送抽奖次数",
|
||||
"createTime": "创建时间",
|
||||
"byUsername": "按用户名搜索"
|
||||
},
|
||||
"table": {
|
||||
"id": "ID",
|
||||
"playerUsername": "玩家用户名",
|
||||
"useCoins": "消耗硬币",
|
||||
"totalDrawCount": "总抽奖次数",
|
||||
"paidDrawCount": "购买抽奖次数",
|
||||
"freeDrawCount": "赠送抽奖次数",
|
||||
"remark": "备注",
|
||||
"createTime": "创建时间"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"form": {
|
||||
"dialogTitleAdd": "新增玩家钱包流水",
|
||||
"dialogTitleEdit": "编辑玩家钱包流水",
|
||||
"user": "用户",
|
||||
"placeholderUser": "请选择用户(显示用户名)",
|
||||
"type": "类型",
|
||||
"placeholderType": "请选择类型",
|
||||
"typeRecharge": "充值",
|
||||
"typeWithdraw": "提现",
|
||||
"typeBuyTicket": "购买抽奖次数",
|
||||
"typeAdminAdd": "管理员加点",
|
||||
"typeAdminSub": "管理员扣点",
|
||||
"coinChange": "平台币变化",
|
||||
"placeholderCoinChange": "正数增加、负数减少",
|
||||
"walletBefore": "钱包操作前",
|
||||
"placeholderWalletBefore": "选择用户后自动带出当前平台币",
|
||||
"walletAfter": "钱包操作后",
|
||||
"placeholderWalletAfter": "根据平台币变化自动计算",
|
||||
"placeholderRemark": "选填",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
},
|
||||
"search": {
|
||||
"type": "类型",
|
||||
"user": "用户",
|
||||
"coin": "平台币",
|
||||
"createTime": "创建时间",
|
||||
"typeRecharge": "充值",
|
||||
"typeWithdraw": "提现",
|
||||
"typeBuyTicket": "购买抽奖次数",
|
||||
"typeAdminAdd": "管理员加点",
|
||||
"typeAdminSub": "管理员扣点",
|
||||
"byUsername": "按用户名搜索"
|
||||
},
|
||||
"table": {
|
||||
"id": "ID",
|
||||
"user": "用户",
|
||||
"coinChange": "平台币变化",
|
||||
"type": "类型",
|
||||
"operator": "操作人",
|
||||
"walletBefore": "钱包操作前",
|
||||
"walletAfter": "钱包操作后",
|
||||
"remark": "备注",
|
||||
"totalDrawCount": "总抽奖次数",
|
||||
"paidDrawCount": "购买抽奖次数",
|
||||
"freeDrawCount": "赠送抽奖次数",
|
||||
"createTime": "创建时间",
|
||||
"typeDraw": "抽奖"
|
||||
}
|
||||
}
|
||||
84
saiadmin-artd/src/locales/langs/zh/dice/reward.json
Normal file
84
saiadmin-artd/src/locales/langs/zh/dice/reward.json
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"toolbar": {
|
||||
"weightRatio": "权重配比",
|
||||
"weightTest": "一键测试权重"
|
||||
},
|
||||
"search": {
|
||||
"tier": "档位",
|
||||
"clockwise": "顺时针",
|
||||
"anticlockwise": "逆时针",
|
||||
"optionBigwin": "BIGWIN"
|
||||
},
|
||||
"table": {
|
||||
"startIndex": "起始索引",
|
||||
"endIndex": "结束索引(end_index)",
|
||||
"tier": "档位",
|
||||
"dicePoints": "色子点数(摇取5-30)",
|
||||
"displayText": "显示文本",
|
||||
"realEv": "实际中奖金额",
|
||||
"remark": "备注",
|
||||
"weight": "权重(1-10000)"
|
||||
},
|
||||
"weightShared": {
|
||||
"xAxisEndIndex": "结束索引",
|
||||
"xAxisGridNumber": "点数",
|
||||
"emptyTier": "该档位暂无配置数据",
|
||||
"sumLineDual": "当前档位权重合计(顺时针):{cw};逆时针:{ccw}(各条 1-10000,档位内按权重比抽取,和不限制)",
|
||||
"sumLineSingle": "当前档位权重合计:{sum}(各条 1-10000,档位内按权重比抽取,和不限制)",
|
||||
"t4t5NoteSingle": "T4、T5 仅单一结果,无需配置权重。",
|
||||
"t4t5NoteDual": "T4、T5 档位抽中时仅有一个结果,无需配置权重。",
|
||||
"colEndIndexId": "结束索引(id)",
|
||||
"colGridNumber": "点数(grid_number)",
|
||||
"colDicePoints": "色子点数",
|
||||
"colRealEv": "实际中奖金额",
|
||||
"colUiText": "显示文本",
|
||||
"colRemark": "备注",
|
||||
"colWeightCwDir": "顺时针权重(direction=0)",
|
||||
"colWeightCcwDir": "逆时针权重(direction=1)",
|
||||
"weightColSuffix": "权重(1-10000)",
|
||||
"fetchFail": "获取权重数据失败",
|
||||
"nothingToSubmit": "没有可提交的配置",
|
||||
"submitFail": "保存失败",
|
||||
"btnCancel": "取消",
|
||||
"btnSubmit": "提交",
|
||||
"saveSuccess": "保存成功"
|
||||
},
|
||||
"weightEdit": {
|
||||
"title": "奖励对照表(dice_reward)权重配比",
|
||||
"globalTip": "编辑的是奖励对照表(dice_reward / DiceReward 模型)的权重,按结束索引(end_index)区分顺时针与逆时针两套权重;抽奖时按当前方向取对应权重。"
|
||||
},
|
||||
"weightRatio": {
|
||||
"title": "权重配比",
|
||||
"globalTip": "配置奖励对照表(dice_reward)的权重,一级按方向(顺时针/逆时针),二级按档位(T1-T5);各条权重 1-10000,档位内按权重比抽取。",
|
||||
"tabClockwise": "顺时针",
|
||||
"tabCounterclockwise": "逆时针"
|
||||
},
|
||||
"weightTest": {
|
||||
"title": "一键测试权重",
|
||||
"alertTitle": "彩金池逻辑说明",
|
||||
"alertBody": "与 playStart 抽奖逻辑一致:使用 name=default 的安全线、杀分开关;盈利未达安全线时,付费抽奖券使用玩家自身权重(下方自定义档位),免费抽奖券使用 killScore 配置;盈利达到安全线且杀分开启时,付费/免费均使用 killScore 配置。",
|
||||
"stepPaid": "付费抽奖券",
|
||||
"stepFree": "免费抽奖券",
|
||||
"labelLotteryTypePaid": "测试数据档位类型",
|
||||
"labelLotteryTypeFree": "测试数据档位类型",
|
||||
"placeholderPaidPool": "不选则下方自定义档位概率(默认 default)",
|
||||
"placeholderFreePool": "不选则下方自定义档位概率(默认 killScore)",
|
||||
"tierProbHint": "自定义档位概率(T1~T5),每档 0-100%,五档之和不能超过 100%",
|
||||
"tierFieldLabel": "档位 {tier}(%)",
|
||||
"tierSumError": "当前五档之和为 {sum}%,不能超过 100%",
|
||||
"labelCwCount": "顺时针次数",
|
||||
"labelCcwCount": "逆时针次数",
|
||||
"placeholderSelect": "请选择",
|
||||
"btnPrev": "上一步",
|
||||
"btnNext": "下一步",
|
||||
"btnStart": "开始测试",
|
||||
"btnCancel": "取消",
|
||||
"warnTotalSpins": "付费或免费至少一种方向次数之和大于 0",
|
||||
"warnPaidTierSumPositive": "付费未选奖池时,T1~T5 档位概率之和需大于 0",
|
||||
"warnPaidTierSumMax": "付费档位概率 T1~T5 之和不能超过 100%",
|
||||
"warnFreeTierSumPositive": "免费未选奖池时,T1~T5 档位概率之和需大于 0",
|
||||
"warnFreeTierSumMax": "免费档位概率 T1~T5 之和不能超过 100%",
|
||||
"successCreated": "测试任务已创建,后台将自动执行。请在【玩家抽奖记录(测试数据)】中查看生成的测试数据",
|
||||
"failCreate": "创建测试任务失败"
|
||||
}
|
||||
}
|
||||
119
saiadmin-artd/src/locales/langs/zh/dice/reward_config.json
Normal file
119
saiadmin-artd/src/locales/langs/zh/dice/reward_config.json
Normal file
@@ -0,0 +1,119 @@
|
||||
{
|
||||
"toolbar": {
|
||||
"gameRewardConfig": "游戏奖励配置",
|
||||
"createRewardRef": "创建奖励对照",
|
||||
"createRewardRefTitle": "按规则:start_index=config(grid_number).id;顺时针 end_index=(start_index+grid_number)%26;逆时针 end_index=start_index-grid_number≥0?start_index-grid_number:26+start_index-grid_number"
|
||||
},
|
||||
"configPage": {
|
||||
"tabIndex": "奖励索引",
|
||||
"tabBigwin": "大奖权重",
|
||||
"tipIndex": "色子点数须在 5~30 之间且本表内不重复。",
|
||||
"tipBigwin": "从左至右:中大奖点数(不可改)、显示信息、实际中奖、备注、权重(0~10000)。点数 5、30 权重固定 100%。本表单独立提交,仅提交大奖权重。",
|
||||
"colId": "索引(id)",
|
||||
"colDicePoints": "色子点数",
|
||||
"colDisplayText": "显示文本",
|
||||
"colDisplayTextEn": "显示文本(英文)",
|
||||
"colRealEv": "真实结算",
|
||||
"colTier": "所属档位",
|
||||
"colRemark": "备注",
|
||||
"placeholderTierSelect": "档位",
|
||||
"placeholderDisplayZh": "显示文本(中文)",
|
||||
"placeholderDisplayEn": "显示文本(英文)",
|
||||
"placeholderRemark": "备注",
|
||||
"btnSave": "保存",
|
||||
"btnReset": "重置",
|
||||
"colBigwinPoints": "中大奖点数",
|
||||
"colDisplayInfo": "显示信息",
|
||||
"colDisplayInfoEn": "显示信息(英文)",
|
||||
"colRealPrize": "实际中奖",
|
||||
"colWeightRange": "权重(0-10000)",
|
||||
"placeholderDisplayInfoZh": "显示信息(中文)",
|
||||
"placeholderDisplayInfoEn": "显示信息(英文)",
|
||||
"weightFixedTip": "点数 5、30 固定 100%",
|
||||
"emptyBigwin": "暂无 BIGWIN 档位配置,请在「奖励索引」中设置 tier 为 BIGWIN。",
|
||||
"confirmCreateRefTitle": "创建奖励对照",
|
||||
"confirmCreateRefMsg": "按规则创建奖励对照:起始索引 start_index=奖励配置中 grid_number 对应格位的 id;顺时针 end_index=(start_index+摇取点数)%26;逆时针 end_index=start_index-摇取点数≥0 则取该值,否则 26+start_index-摇取点数。先清空现有数据再为 5-30 共 26 个点数、顺/逆时针分别生成。是否继续?",
|
||||
"confirmCreateRefOk": "确定创建",
|
||||
"confirmCreateRefCancel": "取消",
|
||||
"createRefSuccess": "已按 5-30 共 26 个点数、顺时针+逆时针创建:顺时针新增 {cwNew} 条、逆时针新增 {ccwNew} 条;顺时针更新 {cwUp} 条、逆时针更新 {ccwUp} 条{skippedPart}",
|
||||
"createRefSuccessSkipped": ";{n} 个点数使用兜底起始索引",
|
||||
"createRefSuccessSimple": "创建成功",
|
||||
"createRefFail": "创建奖励对照失败",
|
||||
"loadIndexFail": "获取奖励索引配置失败",
|
||||
"saveSuccess": "保存成功",
|
||||
"saveFail": "保存失败",
|
||||
"resetIndexReloaded": "已重新加载奖励索引,恢复为服务器最新数据",
|
||||
"resetBigwinReloaded": "已重新加载,大奖权重恢复为服务器最新数据",
|
||||
"warnNoIndexToSave": "暂无奖励索引数据可保存",
|
||||
"warnGridRange": "色子点数必须在 {min}~{max} 之间",
|
||||
"dupJoiner": "、",
|
||||
"warnDupGrid": "色子点数在本表内不能重复,重复的点数为:{list}",
|
||||
"warnNoBigwinToSave": "暂无 BIGWIN 档位配置可保存",
|
||||
"warnBigwinDupGrid": "大奖权重本表内点数不能重复,重复的点数为:{list}",
|
||||
"infoNoBigwin": "暂无 BIGWIN 档位配置,请先在「奖励索引」中设置 tier 为 BIGWIN"
|
||||
},
|
||||
"weightRatio": {
|
||||
"title": "T1-T5 权重配比(顺时针/逆时针)",
|
||||
"globalTip": "权重来自奖励对照表(dice_reward),按结束索引(DiceRewardConfig.id)区分顺时针与逆时针两套权重;抽奖时按当前方向取对应权重。",
|
||||
"xAxisEndIndex": "结束索引",
|
||||
"emptyTier": "该档位暂无配置数据",
|
||||
"sumLine": "当前档位权重合计(顺时针):{cw};逆时针:{ccw}(各条 1-10000,档位内按权重比抽取,和不限制)",
|
||||
"t4t5Note": "T4、T5 档位抽中时仅有一个结果,无需配置权重。",
|
||||
"colEndIndexId": "结束索引(id)",
|
||||
"colDicePoints": "色子点数",
|
||||
"colRealEv": "实际中奖金额",
|
||||
"colUiText": "显示文本",
|
||||
"colWeightCw": "顺时针权重(1-10000)",
|
||||
"colWeightCcw": "逆时针权重(1-10000)",
|
||||
"fetchFail": "获取权重配比数据失败",
|
||||
"nothingToSubmit": "没有可提交的配置",
|
||||
"submitFail": "保存失败",
|
||||
"saveSuccess": "保存成功"
|
||||
},
|
||||
"search": {
|
||||
"dicePoints": "色子点数(摇取5-30)",
|
||||
"displayText": "显示文本",
|
||||
"realEv": "实际中奖金额",
|
||||
"tier": "档位",
|
||||
"fuzzyQuery": "模糊查询"
|
||||
},
|
||||
"table": {
|
||||
"startIndex": "起始索引",
|
||||
"endIndex": "结束索引(end_index)",
|
||||
"tier": "档位",
|
||||
"dicePoints": "色子点数(摇取5-30)",
|
||||
"displayText": "显示文本",
|
||||
"realEv": "实际中奖金额",
|
||||
"remark": "备注",
|
||||
"weight": "权重(1-10000)"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "新增奖励配置",
|
||||
"titleEdit": "编辑奖励配置",
|
||||
"labelDicePoints": "色子点数",
|
||||
"placeholderDicePoints": "请输入色子点数",
|
||||
"labelUiText": "前端显示文本",
|
||||
"placeholderUiText": "请输入前端显示文本(中文)",
|
||||
"labelUiTextEn": "前端显示文本(英文)",
|
||||
"placeholderUiTextEn": "请输入前端显示文本(英文)",
|
||||
"labelRealEv": "真实资金结算",
|
||||
"placeholderRealEv": "请输入真实资金结算",
|
||||
"labelTier": "所属档位",
|
||||
"placeholderTier": "请选择所属档位",
|
||||
"tierBigWin": "BIGWIN(超级大奖)",
|
||||
"labelBigWinWeight": "大奖权重",
|
||||
"placeholderBigWinWeight": "0~10000,10000=100%中奖",
|
||||
"bigWinWeightDisabledTip": "点数 5、30 摇到必中大奖,权重固定 10000",
|
||||
"bigWinWeightTip": "10000=100% 中奖,0=0% 中奖;仅对点数 10/15/20/25 生效",
|
||||
"labelRemark": "备注",
|
||||
"placeholderRemark": "请输入备注",
|
||||
"ruleDicePointsRequired": "色子点数必需填写",
|
||||
"ruleUiTextRequired": "前端显示文本必需填写",
|
||||
"ruleUiTextEnMax": "前端显示文本(英文)长度需小于 255 字符",
|
||||
"ruleRealEvRequired": "真实资金结算必需填写",
|
||||
"ruleTierRequired": "所属档位必需填写",
|
||||
"ruleBigWinWeightRange": "大奖权重 0~10000",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"toolbar": {
|
||||
"viewDetail": "查看详情"
|
||||
},
|
||||
"table": {
|
||||
"id": "ID",
|
||||
"clockwiseAbbr": "顺",
|
||||
"counterclockwiseAbbr": "逆",
|
||||
"status": "状态",
|
||||
"paidDraw": "付费抽取",
|
||||
"freeDraw": "免费抽取",
|
||||
"platformProfit": "平台赚取金额",
|
||||
"totalDrawCount": "总抽奖次数",
|
||||
"createdBy": "创建管理员",
|
||||
"createTime": "创建时间",
|
||||
"statusFail": "失败",
|
||||
"statusDone": "完成",
|
||||
"statusTesting": "测试中"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "新增奖励配置权重测试记录",
|
||||
"titleEdit": "编辑奖励配置权重测试记录",
|
||||
"labelTestCount": "测试次数:100/500/1000",
|
||||
"placeholderTestCount": "请输入测试次数:100/500/1000",
|
||||
"labelWeightSnapshot": "测试时权重配比快照:按档位保存 id,grid_number,tier,weight",
|
||||
"placeholderWeightSnapshot": "请输入测试时权重配比快照:按档位保存 id,grid_number,tier,weight",
|
||||
"labelResultCounts": "落点统计:grid_number=>出现次数",
|
||||
"placeholderResultCounts": "请输入落点统计:grid_number=>出现次数",
|
||||
"ruleTestCountRequired": "测试次数:100/500/1000必需填写",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
},
|
||||
"detail": {
|
||||
"title": "测试记录详情",
|
||||
"sectionBasic": "基本信息",
|
||||
"recordId": "记录ID",
|
||||
"testCount": "测试次数",
|
||||
"testCountSuffix": "次",
|
||||
"createTime": "创建时间",
|
||||
"admin": "执行管理员",
|
||||
"paidPoolId": "付费奖池配置ID",
|
||||
"freePoolId": "免费奖池配置ID",
|
||||
"bigwinSnapshot": "BIGWIN 权重快照",
|
||||
"sectionPaidTier": "付费抽奖档位概率(T1-T5,测试时使用)",
|
||||
"sectionFreeTier": "免费抽奖档位概率(T1-T5,测试时使用)",
|
||||
"colTier": "档位",
|
||||
"colWeight": "权重",
|
||||
"colPercent": "占比",
|
||||
"emptyPaidTier": "暂无付费档位数据(旧记录可能仅保存 tier_weights_snapshot)",
|
||||
"emptyFreeTier": "暂无免费档位数据",
|
||||
"sectionSnapshot": "权重配比快照(测试时使用的 T1-T5/BIGWIN 配置)",
|
||||
"subCw": "顺时针(非 BIGWIN)",
|
||||
"subCcw": "逆时针(非 BIGWIN)",
|
||||
"colGridNumber": "色子点数",
|
||||
"emptyCw": "暂无顺时针数据",
|
||||
"emptyCcw": "暂无逆时针数据",
|
||||
"subBigwin": "BIGWIN(按 DiceRewardConfig 配置快照)",
|
||||
"emptyBigwinTable": "暂无 BIGWIN 数据",
|
||||
"sectionResult": "落点统计(各 grid_number 出现次数)",
|
||||
"chartXAxis": "色子点数 (grid_number)",
|
||||
"emptyResult": "暂无落点数据",
|
||||
"resultTotal": "总落点次数:{n}",
|
||||
"btnImport": "导入到当前配置",
|
||||
"importTitle": "导入到正式配置",
|
||||
"importDesc": "将本测试记录导入:DiceReward(格子权重)、DiceRewardConfig(BIGWIN weight)、DiceLotteryPoolConfig(付费/免费 T1-T5 档位概率)。请选择要写入的奖池。",
|
||||
"importPaidLabel": "导入付费档位概率到奖池",
|
||||
"importPaidPlaceholder": "选择任意奖池(建议付费池)",
|
||||
"importPaidTip": "不选则使用本记录保存时的付费奖池配置 ID",
|
||||
"importFreeLabel": "导入免费档位概率到奖池",
|
||||
"importFreePlaceholder": "选择任意奖池(建议免费池)",
|
||||
"importFreeTip": "不选则使用本记录保存时的免费奖池配置 ID",
|
||||
"btnConfirmImport": "确认导入",
|
||||
"importSuccess": "导入成功,已刷新 DiceReward、DiceRewardConfig(BIGWIN)、奖池配置",
|
||||
"importFail": "导入失败",
|
||||
"dash": "—",
|
||||
"dirCw": "顺时针",
|
||||
"dirCcw": "逆时针"
|
||||
}
|
||||
}
|
||||
26
saiadmin-artd/src/locales/langs/zh/safeguard/attachment.json
Normal file
26
saiadmin-artd/src/locales/langs/zh/safeguard/attachment.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"search": {
|
||||
"username": "用户名",
|
||||
"phone": "手机号",
|
||||
"status": "状态",
|
||||
"placeholderUsername": "请输入用户名",
|
||||
"placeholderPhone": "请输入手机号",
|
||||
"searchSelectPlaceholder": "请选择"
|
||||
},
|
||||
"table": {
|
||||
"preview": "预览",
|
||||
"fileName": "文件名称",
|
||||
"storageMode": "存储模式",
|
||||
"fileType": "文件类型",
|
||||
"fileSize": "文件大小",
|
||||
"uploadTime": "上传时间"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "新增文件",
|
||||
"titleEdit": "编辑文件",
|
||||
"labelFileName": "文件名称",
|
||||
"placeholderFileName": "请输入文件名称",
|
||||
"ruleFileNameRequired": "请输入文件名称",
|
||||
"editSuccess": "修改成功"
|
||||
}
|
||||
}
|
||||
19
saiadmin-artd/src/locales/langs/zh/safeguard/database.json
Normal file
19
saiadmin-artd/src/locales/langs/zh/safeguard/database.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"search": {
|
||||
"tableName": "表名称",
|
||||
"placeholderTableName": "请输入数据表名称"
|
||||
},
|
||||
"table": {
|
||||
"tableName": "表名称",
|
||||
"tableComment": "表注释",
|
||||
"tableEngine": "表引擎",
|
||||
"updateTime": "更新时间",
|
||||
"totalRows": "总行数",
|
||||
"fragmentSize": "碎片大小",
|
||||
"dataSize": "数据大小",
|
||||
"collation": "编码",
|
||||
"createTime": "创建时间",
|
||||
"deleteTime": "删除时间",
|
||||
"dataDetail": "数据详情"
|
||||
}
|
||||
}
|
||||
12
saiadmin-artd/src/locales/langs/zh/safeguard/dict.json
Normal file
12
saiadmin-artd/src/locales/langs/zh/safeguard/dict.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"table": {
|
||||
"select": "选中",
|
||||
"dictName": "字典名称",
|
||||
"dictCode": "字典标识",
|
||||
"dictLabel": "字典标签",
|
||||
"dictValue": "字典键值",
|
||||
"color": "颜色",
|
||||
"sort": "排序",
|
||||
"status": "状态"
|
||||
}
|
||||
}
|
||||
20
saiadmin-artd/src/locales/langs/zh/safeguard/email-log.json
Normal file
20
saiadmin-artd/src/locales/langs/zh/safeguard/email-log.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"search": {
|
||||
"labelFrom": "发件人",
|
||||
"labelTo": "收件人",
|
||||
"placeholderSendStatus": "请选择发送状态",
|
||||
"placeholderFrom": "请输入发件人",
|
||||
"placeholderTo": "请输入收件人",
|
||||
"operTime": "发送时间"
|
||||
},
|
||||
"table": {
|
||||
"no": "编号",
|
||||
"gateway": "服务Host",
|
||||
"emailFrom": "发件人",
|
||||
"emailTo": "收件人",
|
||||
"emailCode": "验证码",
|
||||
"sendStatus": "发送状态",
|
||||
"emailResponse": "发送结果",
|
||||
"sendTime": "发送时间"
|
||||
}
|
||||
}
|
||||
22
saiadmin-artd/src/locales/langs/zh/safeguard/login-log.json
Normal file
22
saiadmin-artd/src/locales/langs/zh/safeguard/login-log.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"search": {
|
||||
"loginUser": "登录用户",
|
||||
"loginIp": "登录IP",
|
||||
"loginStatus": "登录状态",
|
||||
"operTime": "操作时间",
|
||||
"placeholderLoginUser": "请输入登录用户",
|
||||
"placeholderLoginIp": "请输入登录IP",
|
||||
"placeholderLoginStatus": "请选择登录状态"
|
||||
},
|
||||
"table": {
|
||||
"no": "编号",
|
||||
"loginUser": "登录用户",
|
||||
"loginStatus": "登录状态",
|
||||
"loginIp": "登录IP",
|
||||
"operLocation": "操作地点",
|
||||
"os": "操作系统",
|
||||
"browser": "浏览器",
|
||||
"loginMessage": "登录信息",
|
||||
"loginTime": "登录时间"
|
||||
}
|
||||
}
|
||||
20
saiadmin-artd/src/locales/langs/zh/safeguard/oper-log.json
Normal file
20
saiadmin-artd/src/locales/langs/zh/safeguard/oper-log.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"search": {
|
||||
"operator": "操作用户",
|
||||
"router": "路由",
|
||||
"operIp": "操作IP",
|
||||
"operTime": "操作时间",
|
||||
"placeholderOperator": "请输入操作用户",
|
||||
"placeholderOperRouter": "请输入操作路由",
|
||||
"placeholderOperIp": "请输入操作IP"
|
||||
},
|
||||
"table": {
|
||||
"no": "编号",
|
||||
"operator": "操作用户",
|
||||
"serviceName": "业务名称",
|
||||
"router": "路由",
|
||||
"operIp": "操作IP",
|
||||
"operLocation": "操作地点",
|
||||
"operTime": "操作时间"
|
||||
}
|
||||
}
|
||||
15
saiadmin-artd/src/locales/langs/zh/system/config.json
Normal file
15
saiadmin-artd/src/locales/langs/zh/system/config.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"search": {
|
||||
"group": "分组",
|
||||
"title": "标题",
|
||||
"configName": "配置名称",
|
||||
"placeholderGroup": "请输入分组",
|
||||
"placeholderTitle": "请输入标题",
|
||||
"placeholderConfigName": "请输入配置名称"
|
||||
},
|
||||
"table": {
|
||||
"select": "选中",
|
||||
"configName": "配置名称",
|
||||
"configKey": "配置标识"
|
||||
}
|
||||
}
|
||||
39
saiadmin-artd/src/locales/langs/zh/system/dept.json
Normal file
39
saiadmin-artd/src/locales/langs/zh/system/dept.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"search": {
|
||||
"deptName": "渠道(部门)名称",
|
||||
"deptCode": "部门编码",
|
||||
"status": "状态",
|
||||
"placeholderDeptName": "请输入部门名称",
|
||||
"placeholderDeptCode": "请输入部门编码",
|
||||
"searchSelectPlaceholder": "请选择"
|
||||
},
|
||||
"table": {
|
||||
"deptName": "渠道(部门)名称",
|
||||
"deptCode": "部门编码",
|
||||
"leader": "部门领导",
|
||||
"sort": "排序",
|
||||
"status": "状态",
|
||||
"createTime": "创建时间"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "新增部门",
|
||||
"titleEdit": "编辑部门",
|
||||
"labelParentDept": "上级部门",
|
||||
"labelDeptName": "部门名称",
|
||||
"labelDeptCode": "部门编码",
|
||||
"labelLeader": "部门领导",
|
||||
"labelRemark": "描述",
|
||||
"labelSort": "排序",
|
||||
"labelStatus": "启用",
|
||||
"placeholderDeptName": "请输入部门名称",
|
||||
"placeholderDeptCode": "请输入部门编码",
|
||||
"placeholderRemark": "请输入部门描述",
|
||||
"placeholderSort": "请输入排序",
|
||||
"noParentDept": "无上级部门",
|
||||
"ruleParentDeptRequired": "请选择上级部门",
|
||||
"ruleDeptNameRequired": "请输入部门名称",
|
||||
"ruleDeptCodeRequired": "请输入部门编码",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
}
|
||||
}
|
||||
65
saiadmin-artd/src/locales/langs/zh/system/menu.json
Normal file
65
saiadmin-artd/src/locales/langs/zh/system/menu.json
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"search": {
|
||||
"menuName": "菜单名称",
|
||||
"route": "路由",
|
||||
"status": "状态",
|
||||
"placeholderMenuName": "请输入菜单名称",
|
||||
"placeholderMenuRoute": "请输入菜单路由",
|
||||
"searchSelectPlaceholder": "请选择"
|
||||
},
|
||||
"table": {
|
||||
"menuName": "菜单名称",
|
||||
"menuType": "菜单类型",
|
||||
"icon": "图标",
|
||||
"route": "路由",
|
||||
"component": "组件名称",
|
||||
"auth": "权限标识",
|
||||
"sort": "排序",
|
||||
"status": "状态",
|
||||
"createTime": "创建时间"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "新增菜单",
|
||||
"titleEdit": "编辑菜单",
|
||||
"labelMenuType": "菜单类型",
|
||||
"labelParentMenu": "上级菜单",
|
||||
"labelMenuName": "菜单名称",
|
||||
"labelRoutePath": "路由地址",
|
||||
"labelRoutePathTip": "一级菜单:以 / 开头的绝对路径(如 /dashboard) 二级及以下:相对路径(如 console、user)",
|
||||
"placeholderRoutePath": "如:/dashboard 或 console",
|
||||
"labelComponentName": "组件名称",
|
||||
"placeholderComponentName": "如: User",
|
||||
"labelComponentPath": "组件路径",
|
||||
"labelComponentPathTip": "填写组件路径(views目录下) 目录菜单:留空",
|
||||
"placeholderComponentPath": "如:/system/user 或留空",
|
||||
"labelMenuIcon": "菜单图标",
|
||||
"labelPermSlug": "权限标识",
|
||||
"placeholderPermSlug": "请输入权限标识",
|
||||
"labelLinkUrl": "外链地址",
|
||||
"placeholderLinkUrl": "如:https://saithink.top",
|
||||
"labelSort": "排序",
|
||||
"labelSortTip": "数字越大越靠前",
|
||||
"placeholderSort": "请输入排序",
|
||||
"labelStatus": "状态",
|
||||
"labelStatusTip": "禁用后,该菜单项将不可用",
|
||||
"labelIsIframe": "是否内嵌",
|
||||
"labelIsIframeTip": "外链模式下有效",
|
||||
"labelIsKeepAlive": "是否缓存",
|
||||
"labelIsKeepAliveTip": "切换tabs不刷新",
|
||||
"labelIsHidden": "是否隐藏",
|
||||
"labelIsHiddenTip": "不在菜单栏显示,但是可以通过路由访问",
|
||||
"labelIsFixedTab": "是否固定",
|
||||
"labelIsFixedTabTip": "固定在tabs导航栏",
|
||||
"labelIsFullPage": "是否全屏",
|
||||
"labelIsFullPageTip": "不继承左侧菜单和顶部导航栏",
|
||||
"noParentMenu": "无上级菜单",
|
||||
"ruleParentMenuRequired": "请选择上级菜单",
|
||||
"ruleMenuNameRequired": "请输入菜单名称",
|
||||
"ruleRoutePathRequired": "请输入路由地址",
|
||||
"ruleComponentNameRequired": "请输入组件名称",
|
||||
"rulePermSlugRequired": "请输入权限标识",
|
||||
"ruleLinkUrlRequired": "请输入外链地址",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
}
|
||||
}
|
||||
34
saiadmin-artd/src/locales/langs/zh/system/post.json
Normal file
34
saiadmin-artd/src/locales/langs/zh/system/post.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"search": {
|
||||
"postName": "岗位名称",
|
||||
"postCode": "岗位编码",
|
||||
"status": "状态",
|
||||
"placeholderPostName": "请输入岗位名称",
|
||||
"placeholderPostCode": "请输入岗位编码",
|
||||
"searchSelectPlaceholder": "请选择"
|
||||
},
|
||||
"table": {
|
||||
"postName": "岗位名称",
|
||||
"postCode": "岗位编码",
|
||||
"sort": "排序",
|
||||
"status": "状态",
|
||||
"createTime": "创建时间"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "新增岗位",
|
||||
"titleEdit": "编辑岗位",
|
||||
"labelName": "岗位名称",
|
||||
"labelCode": "岗位编码",
|
||||
"labelRemark": "描述",
|
||||
"labelSort": "排序",
|
||||
"labelStatus": "启用",
|
||||
"placeholderName": "请输入岗位名称",
|
||||
"placeholderCode": "请输入岗位编码",
|
||||
"placeholderRemark": "请输入岗位描述",
|
||||
"placeholderSort": "请输入排序",
|
||||
"ruleNameRequired": "请输入岗位名称",
|
||||
"ruleCodeRequired": "请输入岗位编码",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
}
|
||||
}
|
||||
38
saiadmin-artd/src/locales/langs/zh/system/role.json
Normal file
38
saiadmin-artd/src/locales/langs/zh/system/role.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"search": {
|
||||
"roleName": "角色名称",
|
||||
"roleCode": "角色编码",
|
||||
"status": "状态",
|
||||
"placeholderRoleName": "请输入角色名称",
|
||||
"placeholderRoleCode": "请输入角色编码",
|
||||
"searchSelectPlaceholder": "请选择"
|
||||
},
|
||||
"table": {
|
||||
"roleName": "角色名称",
|
||||
"roleCode": "角色编码",
|
||||
"level": "角色级别",
|
||||
"roleRemark": "角色描述",
|
||||
"status": "状态",
|
||||
"createTime": "创建时间"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "新增角色",
|
||||
"titleEdit": "编辑角色",
|
||||
"labelName": "角色名称",
|
||||
"labelCode": "角色标识",
|
||||
"labelLevel": "角色级别",
|
||||
"levelTip": "控制角色的权限层级, 不能操作职级高于自己的角色",
|
||||
"labelRemark": "描述",
|
||||
"labelSort": "排序",
|
||||
"labelStatus": "启用",
|
||||
"placeholderName": "请输入角色名称",
|
||||
"placeholderCode": "请输入角色编码",
|
||||
"placeholderRemark": "请输入角色描述",
|
||||
"placeholderSort": "请输入排序",
|
||||
"ruleNameRequired": "请输入角色名称",
|
||||
"ruleCodeRequired": "请输入角色编码",
|
||||
"ruleLevelRequired": "请输入角色级别",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
}
|
||||
}
|
||||
51
saiadmin-artd/src/locales/langs/zh/system/user.json
Normal file
51
saiadmin-artd/src/locales/langs/zh/system/user.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"search": {
|
||||
"username": "用户名",
|
||||
"phone": "手机号",
|
||||
"status": "状态",
|
||||
"placeholderUsername": "请输入用户名",
|
||||
"placeholderPhone": "请输入手机号",
|
||||
"searchSelectPlaceholder": "请选择"
|
||||
},
|
||||
"table": {
|
||||
"username": "用户名",
|
||||
"phone": "手机号",
|
||||
"dept": "部门",
|
||||
"dashboard": "首页",
|
||||
"loginTime": "上次登录",
|
||||
"agentId": "代理ID",
|
||||
"status": "状态",
|
||||
"createTime": "创建时间",
|
||||
"updateTime": "更新时间"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "新增用户",
|
||||
"titleEdit": "编辑用户",
|
||||
"labelAvatar": "头像",
|
||||
"labelUsername": "用户名",
|
||||
"labelRealname": "真实姓名",
|
||||
"labelPassword": "密码",
|
||||
"labelPasswordConfirm": "确认密码",
|
||||
"labelEmail": "邮箱",
|
||||
"labelPhone": "手机号",
|
||||
"labelDept": "部门",
|
||||
"labelRole": "角色",
|
||||
"labelPost": "岗位",
|
||||
"labelGender": "性别",
|
||||
"labelStatus": "状态",
|
||||
"labelRemark": "备注",
|
||||
"placeholderEmail": "请输入邮箱",
|
||||
"placeholderPhone": "请输入手机号",
|
||||
"placeholderRemark": "请输入备注",
|
||||
"rulePasswordNotMatch": "两次输入的密码不一致",
|
||||
"ruleUsernameRequired": "请输入用户名",
|
||||
"ruleUsernameLength": "长度在 2 到 20 个字符",
|
||||
"rulePasswordRequired": "请输入密码",
|
||||
"rulePasswordLength": "长度在 6 到 20 个字符",
|
||||
"rulePasswordConfirmRequired": "请输入确认密码",
|
||||
"ruleDeptRequired": "请选择部门",
|
||||
"ruleRoleRequired": "请选择角色",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
}
|
||||
}
|
||||
20
saiadmin-artd/src/locales/langs/zh/tool/code.json
Normal file
20
saiadmin-artd/src/locales/langs/zh/tool/code.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"search": {
|
||||
"tableName": "表名称",
|
||||
"placeholderTableName": "请输入数据表名称",
|
||||
"placeholderDataSource": "请输入数据源名称"
|
||||
},
|
||||
"table": {
|
||||
"tableName": "表名称",
|
||||
"tableDesc": "表描述",
|
||||
"tableComment": "表注释",
|
||||
"engine": "引擎",
|
||||
"collation": "编码",
|
||||
"template": "应用类型",
|
||||
"namespace": "应用名称",
|
||||
"stub": "模板类型",
|
||||
"tplCategory": "生成类型",
|
||||
"updateTime": "更新时间",
|
||||
"createTime": "创建时间"
|
||||
}
|
||||
}
|
||||
62
saiadmin-artd/src/locales/langs/zh/tool/crontab.json
Normal file
62
saiadmin-artd/src/locales/langs/zh/tool/crontab.json
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"search": {
|
||||
"taskName": "任务名称",
|
||||
"taskType": "任务类型",
|
||||
"status": "状态",
|
||||
"placeholderTaskName": "请输入任务名称",
|
||||
"searchSelectPlaceholder": "请选择"
|
||||
},
|
||||
"table": {
|
||||
"no": "编号",
|
||||
"taskName": "任务名称",
|
||||
"taskType": "任务类型",
|
||||
"rule": "定时规则",
|
||||
"target": "调用目标",
|
||||
"status": "状态",
|
||||
"updateDate": "更新日期",
|
||||
"executeTime": "执行时间",
|
||||
"parameter": "任务参数",
|
||||
"executeStatus": "执行状态"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "新增定时任务",
|
||||
"titleEdit": "编辑定时任务",
|
||||
"labelName": "任务名称",
|
||||
"labelType": "任务类型",
|
||||
"labelTaskStyle": "定时规则",
|
||||
"labelTarget": "调用目标",
|
||||
"labelParams": "任务参数",
|
||||
"labelStatus": "状态",
|
||||
"labelRemark": "备注",
|
||||
"placeholderName": "请输入任务名称",
|
||||
"placeholderTarget": "请输入调用目标",
|
||||
"placeholderParams": "请输入任务参数",
|
||||
"placeholderRemark": "请输入备注",
|
||||
"taskStyleEveryDay": "每天",
|
||||
"taskStyleEveryHour": "每小时",
|
||||
"taskStyleNHours": "N小时",
|
||||
"taskStyleNMinutes": "N分钟",
|
||||
"taskStyleNSeconds": "N秒",
|
||||
"taskStyleEveryWeek": "每周",
|
||||
"taskStyleEveryMonth": "每月",
|
||||
"taskStyleEveryYear": "每年",
|
||||
"weekMon": "周一",
|
||||
"weekTue": "周二",
|
||||
"weekWed": "周三",
|
||||
"weekThu": "周四",
|
||||
"weekFri": "周五",
|
||||
"weekSat": "周六",
|
||||
"weekSun": "周日",
|
||||
"unitMonth": "月",
|
||||
"unitDay": "日",
|
||||
"unitHour": "时",
|
||||
"unitMinute": "分",
|
||||
"unitSecond": "秒",
|
||||
"ruleNameRequired": "任务名称不能为空",
|
||||
"ruleTypeRequired": "任务类型不能为空",
|
||||
"ruleTaskStyleRequired": "定时规则不能为空",
|
||||
"ruleTargetRequired": "调用目标不能为空",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
}
|
||||
}
|
||||
109
saiadmin-artd/src/locales/pageLocaleLoader.ts
Normal file
109
saiadmin-artd/src/locales/pageLocaleLoader.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* 按路由加载页面级翻译到 page 命名空间
|
||||
* 路由 /dice/lottery_pool_config/index -> 加载 langs/{locale}/dice/lottery_pool_config.json
|
||||
*/
|
||||
import i18n from '@/locales'
|
||||
import { LanguageEnum } from '@/enums/appEnum'
|
||||
|
||||
/** 路由 path 到 locale 文件路径的映射(无前导斜杠、无 /index) */
|
||||
export function getPageLocalePath(routePath: string): string | null {
|
||||
if (!routePath || routePath === '/') return null
|
||||
const normalized = routePath.replace(/\?.*$/, '').replace(/#.*$/, '').replace(/\/$/, '')
|
||||
const withoutIndex = normalized.replace(/\/index$/i, '') || '/'
|
||||
const path = withoutIndex.replace(/^\//, '') || ''
|
||||
if (!path) return null
|
||||
return path
|
||||
}
|
||||
|
||||
type PageLocaleModule = { default: Record<string, unknown> }
|
||||
|
||||
const enModules = import.meta.glob<PageLocaleModule>('./langs/en/**/*.json')
|
||||
const zhModules = import.meta.glob<PageLocaleModule>('./langs/zh/**/*.json')
|
||||
|
||||
function getModuleKey(locale: string, path: string): string {
|
||||
return `./langs/${locale}/${path}.json`
|
||||
}
|
||||
|
||||
let lastLoadedPath: string | null = null
|
||||
let lastLoadedLocale: string | null = null
|
||||
|
||||
/** 获取当前语言(locale 可能是 string 或 Ref) */
|
||||
function getCurrentLocale(): string {
|
||||
const loc = i18n.global.locale
|
||||
return typeof loc === 'string' ? loc : (loc as { value: string }).value
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载并合并页面翻译到 i18n 的 page 命名空间
|
||||
*/
|
||||
export async function loadPageLocale(routePath: string): Promise<void> {
|
||||
const path = getPageLocalePath(routePath)
|
||||
if (!path) {
|
||||
clearPageLocale()
|
||||
return
|
||||
}
|
||||
const locale = getCurrentLocale()
|
||||
const modules = locale === LanguageEnum.EN ? enModules : zhModules
|
||||
|
||||
const tryPaths: string[] = [path]
|
||||
// 兼容别名路由:例如 /user 实际页面为 /system/user
|
||||
if (!path.includes('/')) {
|
||||
tryPaths.push(`system/${path}`)
|
||||
}
|
||||
if (path === 'user') {
|
||||
tryPaths.push('system/user')
|
||||
}
|
||||
|
||||
let matchedPath: string | null = null
|
||||
let loader: (() => Promise<PageLocaleModule>) | undefined
|
||||
for (const p of tryPaths) {
|
||||
const key = getModuleKey(locale, p)
|
||||
const l = modules[key]
|
||||
if (l) {
|
||||
matchedPath = p
|
||||
loader = l
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!loader) {
|
||||
clearPageLocale()
|
||||
return
|
||||
}
|
||||
if (lastLoadedPath === matchedPath && lastLoadedLocale === locale) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const mod = await loader()
|
||||
const message = mod?.default
|
||||
if (message && typeof message === 'object') {
|
||||
i18n.global.mergeLocaleMessage(locale, { page: message })
|
||||
lastLoadedPath = matchedPath
|
||||
lastLoadedLocale = locale
|
||||
}
|
||||
} catch {
|
||||
clearPageLocale()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除 page 命名空间(进入无页面翻译的路由时调用)
|
||||
*/
|
||||
export function clearPageLocale(): void {
|
||||
const locale = getCurrentLocale()
|
||||
const messages = i18n.global.getLocaleMessage(locale) as Record<string, unknown>
|
||||
if (messages && 'page' in messages) {
|
||||
const next = { ...messages }
|
||||
delete next.page
|
||||
i18n.global.setLocaleMessage(locale, next)
|
||||
}
|
||||
lastLoadedPath = null
|
||||
lastLoadedLocale = null
|
||||
}
|
||||
|
||||
/**
|
||||
* 语言切换时清空缓存,下次进入页面会重新加载
|
||||
*/
|
||||
export function invalidatePageLocaleCache(): void {
|
||||
lastLoadedPath = null
|
||||
lastLoadedLocale = null
|
||||
}
|
||||
@@ -44,6 +44,7 @@ import { useMenuStore } from '@/store/modules/menu'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { setWorktab } from '@/utils/navigation'
|
||||
import { setPageTitle } from '@/utils/router'
|
||||
import { loadPageLocale } from '@/locales/pageLocaleLoader'
|
||||
import { RoutesAlias } from '../routesAlias'
|
||||
import { staticRoutes } from '../routes/staticRoutes'
|
||||
import { loadingService } from '@/utils/ui'
|
||||
@@ -190,6 +191,7 @@ async function handleRouteGuard(
|
||||
if (to.matched.length > 0) {
|
||||
setWorktab(to)
|
||||
setPageTitle(to)
|
||||
await loadPageLocale(to.path)
|
||||
next()
|
||||
return
|
||||
}
|
||||
@@ -207,8 +209,23 @@ function handleLoginStatus(
|
||||
userStore: ReturnType<typeof useUserStore>,
|
||||
next: NavigationGuardNext
|
||||
): boolean {
|
||||
// 已登录或访问登录页或静态路由,直接放行
|
||||
if (userStore.isLogin || to.path === RoutesAlias.Login || isStaticRoute(to.path)) {
|
||||
// 已登录或访问登录页,直接放行
|
||||
if (userStore.isLogin || to.path === RoutesAlias.Login) {
|
||||
return true
|
||||
}
|
||||
|
||||
// 未登录时访问根路径(首页),重定向到登录页
|
||||
if (to.path === '/') {
|
||||
userStore.logOut()
|
||||
next({
|
||||
name: 'Login',
|
||||
query: { redirect: to.fullPath }
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
// 其他静态路由(注册、忘记密码、错误页等)放行
|
||||
if (isStaticRoute(to.path)) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -16,11 +16,19 @@
|
||||
|
||||
import axios, { AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import i18n from '@/locales'
|
||||
import { ApiStatus } from './status'
|
||||
import { HttpError, handleError, showError, showSuccess } from './error'
|
||||
import { $t } from '@/locales'
|
||||
import { BaseResponse } from '@/types'
|
||||
|
||||
/** 当前语言(zh/en),供请求头 lang 使用,无 header 时后端按后台语言回包 */
|
||||
function getRequestLang(): string {
|
||||
const locale = i18n.global.locale as string | { value: string }
|
||||
const lang = typeof locale === 'string' ? locale : (locale && 'value' in locale ? locale.value : 'zh')
|
||||
return lang === 'en' ? 'en' : 'zh'
|
||||
}
|
||||
|
||||
/** 请求配置常量(超时时间 30s) */
|
||||
const REQUEST_TIMEOUT = 30000
|
||||
const LOGOUT_DELAY = 500
|
||||
@@ -66,6 +74,7 @@ axiosInstance.interceptors.request.use(
|
||||
(request: InternalAxiosRequestConfig) => {
|
||||
const { accessToken } = useUserStore()
|
||||
if (accessToken) request.headers.set('Authorization', `Bearer ` + accessToken)
|
||||
request.headers.set('lang', getRequestLang())
|
||||
|
||||
if (request.data && !(request.data instanceof FormData) && !request.headers['Content-Type']) {
|
||||
request.headers.set('Content-Type', 'application/json')
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="art-card h-105 p-4 box-border mb-5 max-sm:mb-4">
|
||||
<div class="art-card-header">
|
||||
<div class="title">
|
||||
<h4>月度玩家充值汇总</h4>
|
||||
<h4>{{ $t('console.activeUser.title') }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
<ArtBarChart
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<ElRow :gutter="20" class="flex">
|
||||
<ElCol :sm="12" :md="6" :lg="6">
|
||||
<div class="art-card relative flex flex-col justify-center h-35 px-5 mb-5 max-sm:mb-4">
|
||||
<span class="text-g-700 text-sm">玩家注册</span>
|
||||
<span class="text-g-700 text-sm">{{ $t('console.card.playerRegister') }}</span>
|
||||
<ArtCountTo class="text-[26px] font-medium mt-2" :target="statData.player_count" :duration="1300" />
|
||||
<div class="flex-c mt-1">
|
||||
<span class="text-xs text-g-600">较上周</span>
|
||||
<span class="text-xs text-g-600">{{ $t('console.card.vsLastWeek') }}</span>
|
||||
<span
|
||||
class="ml-1 text-xs font-semibold"
|
||||
:class="changeClass(statData.player_count_change)"
|
||||
@@ -22,7 +22,7 @@
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="6" :lg="6">
|
||||
<div class="art-card relative flex flex-col justify-center h-35 px-5 mb-5 max-sm:mb-4">
|
||||
<span class="text-g-700 text-sm">玩家充值</span>
|
||||
<span class="text-g-700 text-sm">{{ $t('console.card.playerCharge') }}</span>
|
||||
<ArtCountTo
|
||||
class="text-[26px] font-medium mt-2"
|
||||
:target="statData.charge_amount"
|
||||
@@ -30,7 +30,7 @@
|
||||
:decimals="2"
|
||||
/>
|
||||
<div class="flex-c mt-1">
|
||||
<span class="text-xs text-g-600">较上周</span>
|
||||
<span class="text-xs text-g-600">{{ $t('console.card.vsLastWeek') }}</span>
|
||||
<span
|
||||
class="ml-1 text-xs font-semibold"
|
||||
:class="changeClass(statData.charge_amount_change)"
|
||||
@@ -47,7 +47,7 @@
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="6" :lg="6">
|
||||
<div class="art-card relative flex flex-col justify-center h-35 px-5 mb-5 max-sm:mb-4">
|
||||
<span class="text-g-700 text-sm">玩家提现</span>
|
||||
<span class="text-g-700 text-sm">{{ $t('console.card.playerWithdraw') }}</span>
|
||||
<ArtCountTo
|
||||
class="text-[26px] font-medium mt-2"
|
||||
:target="statData.withdraw_amount"
|
||||
@@ -55,7 +55,7 @@
|
||||
:decimals="2"
|
||||
/>
|
||||
<div class="flex-c mt-1">
|
||||
<span class="text-xs text-g-600">较上周</span>
|
||||
<span class="text-xs text-g-600">{{ $t('console.card.vsLastWeek') }}</span>
|
||||
<span
|
||||
class="ml-1 text-xs font-semibold"
|
||||
:class="changeClass(statData.withdraw_amount_change)"
|
||||
@@ -72,14 +72,14 @@
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="6" :lg="6">
|
||||
<div class="art-card relative flex flex-col justify-center h-35 px-5 mb-5 max-sm:mb-4">
|
||||
<span class="text-g-700 text-sm">玩家游玩次数</span>
|
||||
<span class="text-g-700 text-sm">{{ $t('console.card.playerPlayCount') }}</span>
|
||||
<ArtCountTo
|
||||
class="text-[26px] font-medium mt-2"
|
||||
:target="statData.play_count"
|
||||
:duration="1300"
|
||||
/>
|
||||
<div class="flex-c mt-1">
|
||||
<span class="text-xs text-g-600">较上周</span>
|
||||
<span class="text-xs text-g-600">{{ $t('console.card.vsLastWeek') }}</span>
|
||||
<span
|
||||
class="ml-1 text-xs font-semibold"
|
||||
:class="changeClass(statData.play_count_change)"
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<div class="art-card h-128 p-5 mb-5 max-sm:mb-4">
|
||||
<div class="art-card-header">
|
||||
<div class="title">
|
||||
<h4>动态</h4>
|
||||
<p>新增<span class="text-success">+6</span></p>
|
||||
<h4>{{ $t('console.dynamic.title') }}</h4>
|
||||
<p>{{ $t('console.dynamic.newCount') }}<span class="text-success">+6</span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<div class="art-card p-5 overflow-hidden mb-5 max-sm:mb-4">
|
||||
<div class="art-card-header mb-4">
|
||||
<div class="title">
|
||||
<h4>新增玩家</h4>
|
||||
<p class="text-g-600 text-sm mt-1">最新50条新增玩家记录</p>
|
||||
<h4>{{ $t('console.newPlayer.title') }}</h4>
|
||||
<p class="text-g-600 text-sm mt-1">{{ $t('console.newPlayer.subtitle') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<ArtTable
|
||||
@@ -16,13 +16,13 @@
|
||||
:header-cell-style="{ background: 'transparent' }"
|
||||
>
|
||||
<template #default>
|
||||
<ElTableColumn label="玩家" prop="name" min-width="120" />
|
||||
<ElTableColumn label="余额" prop="coin" min-width="120" align="right">
|
||||
<ElTableColumn :label="$t('console.newPlayer.player')" prop="name" min-width="120" align="center" />
|
||||
<ElTableColumn :label="$t('console.newPlayer.balance')" prop="coin" min-width="120" align="center">
|
||||
<template #default="scope">
|
||||
{{ formatCoin(scope.row.coin) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="抽奖券" prop="total_ticket_count" min-width="100" align="right" />
|
||||
<ElTableColumn :label="$t('console.newPlayer.ticket')" prop="total_ticket_count" min-width="100" align="center" />
|
||||
</template>
|
||||
</ArtTable>
|
||||
</div>
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
<div class="art-card p-5 h-128 overflow-hidden mb-5 max-sm:mb-4">
|
||||
<div class="art-card-header">
|
||||
<div class="title">
|
||||
<h4>新用户</h4>
|
||||
<p>这个月增长<span class="text-success">+20%</span></p>
|
||||
<h4>{{ $t('console.newUser.title') }}</h4>
|
||||
<p>{{ $t('console.newUser.growth') }}<span class="text-success">+20%</span></p>
|
||||
</div>
|
||||
<ElRadioGroup v-model="radio2">
|
||||
<ElRadioButton value="本月" label="本月"></ElRadioButton>
|
||||
<ElRadioButton value="上月" label="上月"></ElRadioButton>
|
||||
<ElRadioButton value="今年" label="今年"></ElRadioButton>
|
||||
<ElRadioButton label="thisMonth">{{ $t('console.newUser.thisMonth') }}</ElRadioButton>
|
||||
<ElRadioButton label="lastMonth">{{ $t('console.newUser.lastMonth') }}</ElRadioButton>
|
||||
<ElRadioButton label="thisYear">{{ $t('console.newUser.thisYear') }}</ElRadioButton>
|
||||
</ElRadioGroup>
|
||||
</div>
|
||||
<ArtTable
|
||||
@@ -21,7 +21,7 @@
|
||||
:header-cell-style="{ background: 'transparent' }"
|
||||
>
|
||||
<template #default>
|
||||
<ElTableColumn label="头像" prop="avatar" width="150px">
|
||||
<ElTableColumn :label="$t('console.newUser.avatar')" prop="avatar" width="150px">
|
||||
<template #default="scope">
|
||||
<div style="display: flex; align-items: center">
|
||||
<img class="size-9 rounded-lg" :src="scope.row.avatar" alt="avatar" />
|
||||
@@ -29,15 +29,15 @@
|
||||
</div>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="地区" prop="province" />
|
||||
<ElTableColumn label="性别" prop="avatar">
|
||||
<ElTableColumn :label="$t('console.newUser.region')" prop="province" />
|
||||
<ElTableColumn :label="$t('console.newUser.gender')" prop="avatar">
|
||||
<template #default="scope">
|
||||
<div style="display: flex; align-items: center">
|
||||
<span style="margin-left: 10px">{{ scope.row.sex === 1 ? '男' : '女' }}</span>
|
||||
<span style="margin-left: 10px">{{ scope.row.sex === 1 ? $t('console.newUser.male') : $t('console.newUser.female') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="进度" width="240">
|
||||
<ElTableColumn :label="$t('console.newUser.progress')" width="240">
|
||||
<template #default="scope">
|
||||
<ElProgress
|
||||
:percentage="scope.row.pro"
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
const ANIMATION_DELAY = 100
|
||||
|
||||
const radio2 = ref('本月')
|
||||
const radio2 = ref('thisMonth')
|
||||
|
||||
/**
|
||||
* 新用户表格数据
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="art-card h-105 p-5 mb-5 max-sm:mb-4">
|
||||
<div class="art-card-header">
|
||||
<div class="title">
|
||||
<h4>近期玩家充值统计</h4>
|
||||
<h4>{{ $t('console.salesOverview.title') }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
<ArtLineChart
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<div class="art-card h-128 p-5 mb-5 max-sm:mb-4">
|
||||
<div class="art-card-header">
|
||||
<div class="title">
|
||||
<h4>代办事项</h4>
|
||||
<p>待处理<span class="text-danger">3</span></p>
|
||||
<h4>{{ $t('console.todo.title') }}</h4>
|
||||
<p>{{ $t('console.todo.pending') }}<span class="text-danger">3</span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<div class="art-card p-5 overflow-hidden mb-5 max-sm:mb-4">
|
||||
<div class="art-card-header mb-4">
|
||||
<div class="title">
|
||||
<h4>玩家充值记录</h4>
|
||||
<p class="text-g-600 text-sm mt-1">最新50条充值记录</p>
|
||||
<h4>{{ $t('console.walletRecord.title') }}</h4>
|
||||
<p class="text-g-600 text-sm mt-1">{{ $t('console.walletRecord.subtitle') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<ArtTable
|
||||
@@ -16,13 +16,13 @@
|
||||
:header-cell-style="{ background: 'transparent' }"
|
||||
>
|
||||
<template #default>
|
||||
<ElTableColumn label="玩家" prop="player_name" min-width="120" />
|
||||
<ElTableColumn label="充值金额" prop="coin" min-width="120" align="right">
|
||||
<ElTableColumn :label="$t('console.walletRecord.player')" prop="player_name" min-width="120" align="center" />
|
||||
<ElTableColumn :label="$t('console.walletRecord.chargeAmount')" prop="coin" min-width="120" align="center">
|
||||
<template #default="scope">
|
||||
{{ formatCoin(scope.row.coin) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="充值时间" prop="create_time" min-width="170" />
|
||||
<ElTableColumn :label="$t('console.walletRecord.chargeTime')" prop="create_time" min-width="170" align="center" />
|
||||
</template>
|
||||
</ArtTable>
|
||||
</div>
|
||||
|
||||
@@ -17,14 +17,13 @@ export default {
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取 DiceLotteryPoolConfig 列表数据,含 id、name、type、t1_weight~t5_weight,用于一键测试权重档位类型下拉
|
||||
* type:0=付费抽奖券,1=免费抽奖券;付费默认选 type=0,免费默认选 type=1
|
||||
* 获取 DiceLotteryPoolConfig 列表数据,含 id、name、t1_weight~t5_weight,用于一键测试权重档位类型下拉
|
||||
* name 映射:default=原 type=0,killScore=原 type=1,up=原 type=2
|
||||
*/
|
||||
async getOptions(): Promise<
|
||||
Array<{
|
||||
id: number
|
||||
name: string
|
||||
type: number
|
||||
t1_weight: number
|
||||
t2_weight: number
|
||||
t3_weight: number
|
||||
@@ -40,7 +39,6 @@ export default {
|
||||
return rows.map((r: any) => ({
|
||||
id: Number(r.id),
|
||||
name: String(r.name ?? r.id ?? ''),
|
||||
type: Number(r.type ?? 0),
|
||||
t1_weight: Number(r.t1_weight ?? 0),
|
||||
t2_weight: Number(r.t2_weight ?? 0),
|
||||
t3_weight: Number(r.t3_weight ?? 0),
|
||||
@@ -104,6 +102,7 @@ export default {
|
||||
id: number
|
||||
name: string
|
||||
safety_line: number
|
||||
kill_enabled: number
|
||||
t1_weight: number
|
||||
t2_weight: number
|
||||
t3_weight: number
|
||||
@@ -118,14 +117,7 @@ export default {
|
||||
/**
|
||||
* 更新当前彩金池:仅 safety_line、t1_weight~t5_weight,不可改 profit_amount
|
||||
*/
|
||||
updateCurrentPool(params: {
|
||||
safety_line?: number
|
||||
t1_weight?: number
|
||||
t2_weight?: number
|
||||
t3_weight?: number
|
||||
t4_weight?: number
|
||||
t5_weight?: number
|
||||
}) {
|
||||
updateCurrentPool(params: { safety_line?: number; kill_enabled?: number }) {
|
||||
return request.post<any>({
|
||||
url: '/core/dice/lottery_pool_config/DiceLotteryPoolConfig/updateCurrentPool',
|
||||
data: params
|
||||
|
||||
@@ -109,15 +109,15 @@
|
||||
apiFn: api.list,
|
||||
columnsFactory: () => [
|
||||
// { type: 'selection' },
|
||||
{ prop: 'group', label: '分组', minWidth: 140, align: 'center' },
|
||||
{ prop: 'title', label: '标题', minWidth: 160, align: 'center' },
|
||||
{ prop: 'title_en', label: '标题(英文)', minWidth: 160, align: 'center' },
|
||||
{ prop: 'name', label: '配置名称', align: 'center' },
|
||||
{ prop: 'value', label: '值', minWidth: 240, align: 'center' },
|
||||
{ prop: 'value_en', label: '值(英文)', minWidth: 240, align: 'center' },
|
||||
{ prop: 'group', label: 'page.table.group', minWidth: 140, align: 'center' },
|
||||
{ prop: 'title', label: 'page.table.title', minWidth: 160, align: 'center' },
|
||||
{ prop: 'title_en', label: 'page.table.titleEn', minWidth: 160, align: 'center' },
|
||||
{ prop: 'name', label: 'page.table.configName', align: 'center' },
|
||||
{ prop: 'value', label: 'page.table.value', minWidth: 240, align: 'center' },
|
||||
{ prop: 'value_en', label: 'page.table.valueEn', minWidth: 240, align: 'center' },
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
label: 'table.actions.operation',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增摇色子配置' : '编辑摇色子配置'"
|
||||
:title="dialogType === 'add' ? $t('page.form.dialogTitleAdd') : $t('page.form.dialogTitleEdit')"
|
||||
width="600px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="分组" prop="group">
|
||||
<el-form-item :label="$t('page.form.group')" prop="group">
|
||||
<el-input
|
||||
v-model="formData.group"
|
||||
placeholder="请输入分组"
|
||||
:placeholder="$t('page.form.placeholderGroup')"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="formData.title" placeholder="请输入标题(中文)" />
|
||||
<el-form-item :label="$t('page.form.title')" prop="title">
|
||||
<el-input v-model="formData.title" :placeholder="$t('page.form.placeholderTitleZh')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标题(英文)" prop="title_en">
|
||||
<el-input v-model="formData.title_en" placeholder="请输入标题(英文)" />
|
||||
<el-form-item :label="$t('page.form.titleEn')" prop="title_en">
|
||||
<el-input v-model="formData.title_en" :placeholder="$t('page.form.placeholderTitleEn')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="配置名称" prop="name">
|
||||
<el-form-item :label="$t('page.form.configName')" prop="name">
|
||||
<el-input
|
||||
v-model="formData.name"
|
||||
placeholder="请输入配置名称"
|
||||
:placeholder="$t('page.form.placeholderConfigName')"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="值" prop="value">
|
||||
<el-input v-model="formData.value" type="textarea" :rows="5" placeholder="请输入值(中文)" />
|
||||
<el-form-item :label="$t('page.form.value')" prop="value">
|
||||
<el-input v-model="formData.value" type="textarea" :rows="5" :placeholder="$t('page.form.placeholderValueZh')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="值(英文)" prop="value_en">
|
||||
<el-input v-model="formData.value_en" type="textarea" :rows="5" placeholder="请输入值(英文)" />
|
||||
<el-form-item :label="$t('page.form.valueEn')" prop="value_en">
|
||||
<el-input v-model="formData.value_en" type="textarea" :rows="5" :placeholder="$t('page.form.placeholderValueEn')" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -46,6 +46,9 @@
|
||||
import api from '../../../api/config/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -79,13 +82,13 @@
|
||||
/**
|
||||
* 表单验证规则
|
||||
*/
|
||||
const rules = reactive<FormRules>({
|
||||
group: [{ required: true, message: '分组必需填写', trigger: 'blur' }],
|
||||
title: [{ required: true, message: '标题必需填写', trigger: 'blur' }],
|
||||
title_en: [{ max: 255, message: '英文标题长度需小于 255 字符', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '配置名称必需填写', trigger: 'blur' }],
|
||||
value: [{ required: true, message: '值必需填写', trigger: 'blur' }]
|
||||
})
|
||||
const rules = computed<FormRules>(() => ({
|
||||
group: [{ required: true, message: t('page.form.ruleGroupRequired'), trigger: 'blur' }],
|
||||
title: [{ required: true, message: t('page.form.ruleTitleRequired'), trigger: 'blur' }],
|
||||
title_en: [{ max: 255, message: t('page.form.ruleTitleEnMax'), trigger: 'blur' }],
|
||||
name: [{ required: true, message: t('page.form.ruleConfigNameRequired'), trigger: 'blur' }],
|
||||
value: [{ required: true, message: t('page.form.ruleValueRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
/**
|
||||
* 初始数据
|
||||
@@ -160,10 +163,10 @@
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.saveSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.updateSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="分组" prop="group">
|
||||
<el-input v-model="formData.group" placeholder="请输入分组" clearable />
|
||||
<el-form-item :label="$t('page.search.group')" prop="group">
|
||||
<el-input v-model="formData.group" :placeholder="$t('page.search.placeholderGroup')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="formData.title" placeholder="请输入标题" clearable />
|
||||
<el-form-item :label="$t('page.search.title')" prop="title">
|
||||
<el-input v-model="formData.title" :placeholder="$t('page.search.placeholderTitle')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="配置名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入配置名称" clearable />
|
||||
<el-form-item :label="$t('page.search.configName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.search.placeholderConfigName')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</sa-search-bar>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
type="primary"
|
||||
@click="showCurrentPoolDialog"
|
||||
>
|
||||
查看当前彩金池
|
||||
{{ $t('page.toolbar.viewCurrentPool') }}
|
||||
</ElButton>
|
||||
</template>
|
||||
</ArtTableHeader>
|
||||
@@ -61,17 +61,19 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useTable } from '@/hooks/core/useTable'
|
||||
import { useSaiAdmin } from '@/composables/useSaiAdmin'
|
||||
import api from '../../api/lottery_pool_config/index'
|
||||
import TableSearch from './modules/table-search.vue'
|
||||
import EditDialog from './modules/edit-dialog.vue'
|
||||
import CurrentPoolDialog from './modules/current-pool-dialog.vue'
|
||||
const { t } = useI18n()
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = ref({
|
||||
name: undefined,
|
||||
type: undefined
|
||||
// type 字段已移除,改用 name 区分:default/killScore/up
|
||||
})
|
||||
|
||||
// 搜索处理
|
||||
@@ -80,9 +82,14 @@
|
||||
getData()
|
||||
}
|
||||
|
||||
// 奖池类型展示:0=正常 1=强制杀猪 2=T1高倍率
|
||||
const typeFormatter = (row: Record<string, unknown>) =>
|
||||
row.type === 0 ? '正常' : row.type === 1 ? '强制杀猪' : row.type === 2 ? 'T1高倍率' : '-'
|
||||
// 奖池类型展示:按 name 映射
|
||||
const typeFormatter = (row: Record<string, unknown>) => {
|
||||
const n = String(row.name ?? '')
|
||||
if (n === 'default') return t('page.search.poolTypeNormal')
|
||||
if (n === 'killScore') return t('page.search.poolTypeKill')
|
||||
if (n === 'up') return t('page.search.poolTypeT1')
|
||||
return n || '-'
|
||||
}
|
||||
|
||||
// 权重列带 %
|
||||
const weightFormatter = (prop: string) => (row: Record<string, unknown>) => {
|
||||
@@ -108,47 +115,47 @@
|
||||
core: {
|
||||
apiFn: api.list,
|
||||
columnsFactory: () => [
|
||||
{ prop: 'name', label: '名称', align: 'center' },
|
||||
{ prop: 'type', label: '奖池类型', width: 100, align: 'center', formatter: typeFormatter },
|
||||
{ prop: 'safety_line', label: '安全线', align: 'center' },
|
||||
{ prop: 'name', label: 'page.table.name', align: 'center' },
|
||||
{ prop: 'name', label: 'page.table.poolType', width: 100, align: 'center', formatter: typeFormatter },
|
||||
{ prop: 'safety_line', label: 'page.table.safetyLine', align: 'center' },
|
||||
{
|
||||
prop: 't1_weight',
|
||||
label: 'T1池权重',
|
||||
label: 'page.table.t1PoolWeight',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
formatter: weightFormatter('t1_weight')
|
||||
},
|
||||
{
|
||||
prop: 't2_weight',
|
||||
label: 'T2池权重',
|
||||
label: 'page.table.t2PoolWeight',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
formatter: weightFormatter('t2_weight')
|
||||
},
|
||||
{
|
||||
prop: 't3_weight',
|
||||
label: 'T3池权重',
|
||||
label: 'page.table.t3PoolWeight',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
formatter: weightFormatter('t3_weight')
|
||||
},
|
||||
{
|
||||
prop: 't4_weight',
|
||||
label: 'T4池权重',
|
||||
label: 'page.table.t4PoolWeight',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
formatter: weightFormatter('t4_weight')
|
||||
},
|
||||
{
|
||||
prop: 't5_weight',
|
||||
label: 'T5池权重',
|
||||
label: 'page.table.t5PoolWeight',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
formatter: weightFormatter('t5_weight')
|
||||
},
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
label: 'table.actions.operation',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
|
||||
@@ -1,41 +1,40 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="当前彩金池"
|
||||
:title="$t('page.form.currentPoolTitle')"
|
||||
width="560px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<div v-if="loading && !pool" class="flex justify-center py-8">加载中...</div>
|
||||
<div v-if="loading && !pool" class="flex justify-center py-8">{{ $t('page.form.loading') }}</div>
|
||||
<template v-else-if="pool">
|
||||
<div class="pool-info mb-4">
|
||||
<div class="flex items-center gap-2 mb-3">
|
||||
<span class="text-gray-500">池子名称:</span>
|
||||
<span class="text-gray-500">{{ $t('page.form.poolName') }}:</span>
|
||||
<span>{{ pool.name }}</span>
|
||||
</div>
|
||||
<div class="profit-row mb-3">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-gray-500">玩家累计盈利(profit_amount):</span>
|
||||
<span class="text-gray-500">{{ $t('page.form.playerProfit') }}</span>
|
||||
<span class="font-mono text-lg" :class="profitAmountClass">{{
|
||||
displayProfitAmount
|
||||
}}</span>
|
||||
<span class="realtime-badge">实时</span>
|
||||
<span class="realtime-badge">{{ $t('page.form.realtime') }}</span>
|
||||
</div>
|
||||
<div class="profit-calc-hint">
|
||||
计算方式:每局按“当前中奖金额(含超级大奖 BIGWIN)减去抽奖券费用 100”累加,弹窗打开期间每 2 秒自动刷新
|
||||
{{ $t('page.form.profitCalcHint') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tip-block">
|
||||
<div class="tip-title">抽奖档位规则</div>
|
||||
<div class="tip-title">{{ $t('page.form.tierRuleTitle') }}</div>
|
||||
<div class="tip-content">
|
||||
当玩家在当前彩金池的累计盈利 <strong>低于安全线</strong> 时,按<strong>玩家</strong>的 T*_weight 权重抽取档位;
|
||||
当累计盈利 <strong>高于或等于安全线</strong> 时,按<strong>当前彩金池</strong>的 T*_weight 权重抽取档位(杀分)。
|
||||
{{ $t('page.form.tierRuleContent') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="安全线" prop="safety_line">
|
||||
<el-form-item :label="$t('page.form.safetyLine')" prop="safety_line">
|
||||
<el-input-number
|
||||
v-model="formData.safety_line"
|
||||
:min="0"
|
||||
@@ -43,38 +42,39 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="T1池权重(%)" prop="t1_weight">
|
||||
<el-slider v-model="formData.t1_weight" :min="0" :max="100" :step="1" show-input />
|
||||
<el-form-item label="开启杀分">
|
||||
<el-switch v-model="formData.kill_enabled" :active-value="1" :inactive-value="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="T2池权重(%)" prop="t2_weight">
|
||||
<el-slider v-model="formData.t2_weight" :min="0" :max="100" :step="1" show-input />
|
||||
</el-form-item>
|
||||
<el-form-item label="T3池权重(%)" prop="t3_weight">
|
||||
<el-slider v-model="formData.t3_weight" :min="0" :max="100" :step="1" show-input />
|
||||
</el-form-item>
|
||||
<el-form-item label="T4池权重(%)" prop="t4_weight">
|
||||
<el-slider v-model="formData.t4_weight" :min="0" :max="100" :step="1" show-input />
|
||||
</el-form-item>
|
||||
<el-form-item label="T5池权重(%)" prop="t5_weight">
|
||||
<el-slider v-model="formData.t5_weight" :min="0" :max="100" :step="1" show-input />
|
||||
<el-form-item :label="$t('page.form.killScoreWeights')">
|
||||
<div class="text-gray-500 text-sm">
|
||||
T1: {{ pool.t1_weight }}% / T2: {{ pool.t2_weight }}% / T3: {{ pool.t3_weight }}% / T4: {{ pool.t4_weight }}% / T5: {{ pool.t5_weight }}%
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="text-gray-500 text-sm">
|
||||
五个池权重总和:<span :class="weightsSum !== 100 ? 'text-red-500' : ''">{{
|
||||
weightsSum
|
||||
}}</span
|
||||
>% / 100%(须为100%)
|
||||
{{ $t('page.form.killWeightNote') }}
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">关闭</el-button>
|
||||
<el-button :loading="resetting" :disabled="!pool" @click="handleResetProfit">
|
||||
重置玩家累计盈利
|
||||
<el-button @click="handleClose">{{ $t('form.close') }}</el-button>
|
||||
<el-button
|
||||
v-permission="'dice:lottery_pool_config:index:resetProfitAmount'"
|
||||
:loading="resetting"
|
||||
:disabled="!pool"
|
||||
@click="handleResetProfit"
|
||||
>
|
||||
{{ $t('page.form.btnResetProfit') }}
|
||||
</el-button>
|
||||
<el-button type="primary" :loading="saving" :disabled="!pool" @click="handleSubmit">
|
||||
保存权重与安全线
|
||||
<el-button
|
||||
v-permission="'dice:lottery_pool_config:index:updateCurrentPool'"
|
||||
type="primary"
|
||||
:loading="saving"
|
||||
:disabled="!pool"
|
||||
@click="handleSubmit"
|
||||
>
|
||||
{{ $t('page.form.btnSaveSafetyLine') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -84,11 +84,15 @@
|
||||
import api from '../../../api/lottery_pool_config/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
interface PoolData {
|
||||
id: number
|
||||
name: string
|
||||
safety_line: number
|
||||
kill_enabled: number
|
||||
t1_weight: number
|
||||
t2_weight: number
|
||||
t3_weight: number
|
||||
@@ -113,30 +117,18 @@
|
||||
|
||||
const formData = reactive({
|
||||
safety_line: 0,
|
||||
t1_weight: 0,
|
||||
t2_weight: 0,
|
||||
t3_weight: 0,
|
||||
t4_weight: 0,
|
||||
t5_weight: 0
|
||||
kill_enabled: 1
|
||||
})
|
||||
|
||||
const rules: FormRules = {
|
||||
safety_line: [{ required: true, message: '请输入安全线', trigger: 'blur' }],
|
||||
t1_weight: [{ required: true, message: '请输入T1权重', trigger: 'blur' }],
|
||||
t2_weight: [{ required: true, message: '请输入T2权重', trigger: 'blur' }],
|
||||
t3_weight: [{ required: true, message: '请输入T3权重', trigger: 'blur' }],
|
||||
t4_weight: [{ required: true, message: '请输入T4权重', trigger: 'blur' }],
|
||||
t5_weight: [{ required: true, message: '请输入T5权重', trigger: 'blur' }]
|
||||
}
|
||||
const rules = computed<FormRules>(() => ({
|
||||
safety_line: [{ required: true, message: t('page.form.ruleSafetyLineRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
const weightsSum = computed(
|
||||
() =>
|
||||
formData.t1_weight +
|
||||
formData.t2_weight +
|
||||
formData.t3_weight +
|
||||
formData.t4_weight +
|
||||
formData.t5_weight
|
||||
)
|
||||
const weightsSum = computed(() => {
|
||||
const p = pool.value
|
||||
if (!p) return 0
|
||||
return (p.t1_weight ?? 0) + (p.t2_weight ?? 0) + (p.t3_weight ?? 0) + (p.t4_weight ?? 0) + (p.t5_weight ?? 0)
|
||||
})
|
||||
|
||||
const displayProfitAmount = computed(() => {
|
||||
const v = pool.value?.profit_amount
|
||||
@@ -164,14 +156,10 @@
|
||||
if (data && typeof data === 'object') {
|
||||
pool.value = data
|
||||
formData.safety_line = data.safety_line ?? 0
|
||||
formData.t1_weight = data.t1_weight ?? 0
|
||||
formData.t2_weight = data.t2_weight ?? 0
|
||||
formData.t3_weight = data.t3_weight ?? 0
|
||||
formData.t4_weight = data.t4_weight ?? 0
|
||||
formData.t5_weight = data.t5_weight ?? 0
|
||||
formData.kill_enabled = (data.kill_enabled ?? 1) === 1 ? 1 : 0
|
||||
}
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message ?? '获取彩金池失败')
|
||||
ElMessage.error(e?.message ?? t('page.form.msgGetPoolFailed'))
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -201,23 +189,15 @@
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
if (!formRef.value || !pool.value) return
|
||||
if (weightsSum.value !== 100) {
|
||||
ElMessage.warning('T1~T5 权重合计须为 100%')
|
||||
return
|
||||
}
|
||||
if (!pool.value) return
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
await formRef.value?.validate?.()
|
||||
saving.value = true
|
||||
await api.updateCurrentPool({
|
||||
safety_line: formData.safety_line,
|
||||
t1_weight: formData.t1_weight,
|
||||
t2_weight: formData.t2_weight,
|
||||
t3_weight: formData.t3_weight,
|
||||
t4_weight: formData.t4_weight,
|
||||
t5_weight: formData.t5_weight
|
||||
kill_enabled: formData.kill_enabled
|
||||
})
|
||||
ElMessage.success('保存成功')
|
||||
ElMessage.success(t('page.form.msgSaveSuccess'))
|
||||
await loadPool()
|
||||
emit('success')
|
||||
} catch (e: any) {
|
||||
@@ -232,11 +212,11 @@
|
||||
try {
|
||||
resetting.value = true
|
||||
await api.resetProfitAmount()
|
||||
ElMessage.success('玩家累计盈利已重置为 0')
|
||||
ElMessage.success(t('page.form.msgResetProfitSuccess'))
|
||||
await loadPool()
|
||||
emit('success')
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message ?? '重置失败')
|
||||
ElMessage.error(e?.message ?? t('page.form.msgResetFailed'))
|
||||
} finally {
|
||||
resetting.value = false
|
||||
}
|
||||
|
||||
@@ -1,44 +1,32 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增色子奖池配置' : '编辑色子奖池配置'"
|
||||
:title="dialogType === 'add' ? $t('page.form.dialogTitleAdd') : $t('page.form.dialogTitleEdit')"
|
||||
width="600px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-form-item :label="$t('form.labelName')" prop="name">
|
||||
<el-input
|
||||
v-model="formData.name"
|
||||
placeholder="请输入名称"
|
||||
:placeholder="$t('page.form.placeholderName')"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-form-item :label="$t('form.labelRemark')" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入备注"
|
||||
:placeholder="$t('page.form.placeholderRemark')"
|
||||
maxlength="500"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="奖池类型" prop="type">
|
||||
<el-select
|
||||
v-model="formData.type"
|
||||
placeholder="请选择奖池类型"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
:disabled="dialogType === 'edit'"
|
||||
>
|
||||
<el-option label="正常" :value="0" />
|
||||
<el-option label="强制杀猪" :value="1" />
|
||||
<el-option label="T1高倍率" :value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="安全线" prop="safety_line">
|
||||
<!-- dice_lottery_pool_config 已移除 type 字段,按 name 区分 default/killScore/up;name 在新增时填写,编辑时禁用 -->
|
||||
<el-form-item :label="$t('page.form.safetyLine')" prop="safety_line">
|
||||
<el-input-number
|
||||
v-model="formData.safety_line"
|
||||
:min="0"
|
||||
@@ -46,33 +34,33 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="T1池权重(%)" prop="t1_weight">
|
||||
<el-form-item :label="$t('page.form.t1Weight')" prop="t1_weight">
|
||||
<el-slider v-model="formData.t1_weight" :min="0" :max="100" :step="0.01" show-input />
|
||||
</el-form-item>
|
||||
<el-form-item label="T2池权重(%)" prop="t2_weight">
|
||||
<el-form-item :label="$t('page.form.t2Weight')" prop="t2_weight">
|
||||
<el-slider v-model="formData.t2_weight" :min="0" :max="100" :step="0.01" show-input />
|
||||
</el-form-item>
|
||||
<el-form-item label="T3池权重(%)" prop="t3_weight">
|
||||
<el-form-item :label="$t('page.form.t3Weight')" prop="t3_weight">
|
||||
<el-slider v-model="formData.t3_weight" :min="0" :max="100" :step="0.01" show-input />
|
||||
</el-form-item>
|
||||
<el-form-item label="T4池权重(%)" prop="t4_weight">
|
||||
<el-form-item :label="$t('page.form.t4Weight')" prop="t4_weight">
|
||||
<el-slider v-model="formData.t4_weight" :min="0" :max="100" :step="0.01" show-input />
|
||||
</el-form-item>
|
||||
<el-form-item label="T5池权重(%)" prop="t5_weight">
|
||||
<el-form-item :label="$t('page.form.t5Weight')" prop="t5_weight">
|
||||
<el-slider v-model="formData.t5_weight" :min="0" :max="100" :step="0.01" show-input />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="text-gray-500 text-sm">
|
||||
五个池权重总和:<span :class="Math.abs(weightsSum - 100) > 0.01 ? 'text-red-500' : ''">{{
|
||||
{{ $t('page.form.weightsSumHint') }}<span :class="Math.abs(weightsSum - 100) > 0.01 ? 'text-red-500' : ''">{{
|
||||
weightsSum
|
||||
}}</span
|
||||
>% / 100%(必须为100%)
|
||||
>{{ $t('page.form.weightsSumUnit') }}
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -81,6 +69,9 @@
|
||||
import api from '../../../api/lottery_pool_config/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -122,15 +113,14 @@
|
||||
/**
|
||||
* 表单验证规则
|
||||
*/
|
||||
const rules = reactive<FormRules>({
|
||||
name: [{ required: true, message: '名称必需填写', trigger: 'blur' }],
|
||||
type: [{ required: true, message: '请选择奖池类型', trigger: 'change' }],
|
||||
t1_weight: [{ required: true, message: 'T1池权重必需填写', trigger: 'blur' }],
|
||||
t2_weight: [{ required: true, message: 'T2池权重必需填写', trigger: 'blur' }],
|
||||
t3_weight: [{ required: true, message: 'T3池权重必需填写', trigger: 'blur' }],
|
||||
t4_weight: [{ required: true, message: 'T4池权重必需填写', trigger: 'blur' }],
|
||||
t5_weight: [{ required: true, message: 'T5池权重必需填写', trigger: 'blur' }]
|
||||
})
|
||||
const rules = computed<FormRules>(() => ({
|
||||
name: [{ required: true, message: t('page.form.ruleNameRequired'), trigger: 'blur' }],
|
||||
t1_weight: [{ required: true, message: t('page.form.ruleT1Required'), trigger: 'blur' }],
|
||||
t2_weight: [{ required: true, message: t('page.form.ruleT2Required'), trigger: 'blur' }],
|
||||
t3_weight: [{ required: true, message: t('page.form.ruleT3Required'), trigger: 'blur' }],
|
||||
t4_weight: [{ required: true, message: t('page.form.ruleT4Required'), trigger: 'blur' }],
|
||||
t5_weight: [{ required: true, message: t('page.form.ruleT5Required'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
/**
|
||||
* 初始数据(权重为数字便于输入与校验)
|
||||
@@ -139,7 +129,6 @@
|
||||
id: null as number | null,
|
||||
name: '',
|
||||
remark: '',
|
||||
type: null as number | null,
|
||||
safety_line: 0 as number,
|
||||
t1_weight: 0 as number,
|
||||
t2_weight: 0 as number,
|
||||
@@ -185,7 +174,6 @@
|
||||
if (!props.data) return
|
||||
const numKeys = [
|
||||
'id',
|
||||
'type',
|
||||
'safety_line',
|
||||
't1_weight',
|
||||
't2_weight',
|
||||
@@ -221,15 +209,15 @@
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
if (Math.abs(weightsSum.value - 100) > 0.01) {
|
||||
ElMessage.warning('五个池权重总和必须为100%')
|
||||
ElMessage.warning(t('page.form.msgWeightsMust100'))
|
||||
return
|
||||
}
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.msgAddSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.msgUpdateSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,24 +9,16 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入名称" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="奖池类型" prop="type">
|
||||
<el-select
|
||||
v-model="formData.type"
|
||||
:options="typeOptions"
|
||||
placeholder="请选择奖池类型"
|
||||
clearable
|
||||
/>
|
||||
<el-form-item :label="$t('page.name')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.search.placeholderName')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- dice_lottery_pool_config 已移除 type 字段,按 name 区分 default/killScore/up -->
|
||||
</sa-search-bar>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
interface Props {
|
||||
modelValue: Record<string, any>
|
||||
}
|
||||
@@ -40,11 +32,8 @@
|
||||
// 展开/收起
|
||||
const isExpanded = ref<boolean>(false)
|
||||
|
||||
const typeOptions = [
|
||||
{ name: '0', value: '正常' },
|
||||
{ name: '1', value: '强制杀猪' },
|
||||
{ name: '2', value: 'T1高倍率' }
|
||||
]
|
||||
const { t } = useI18n()
|
||||
// type 字段已移除
|
||||
// 表单数据双向绑定
|
||||
const searchBarRef = ref()
|
||||
const formData = computed({
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
<!-- 表格头部 -->
|
||||
<ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData">
|
||||
<template #left>
|
||||
<span v-if="totalWinCoin !== null" class="table-summary-inline">
|
||||
{{ $t('page.toolbar.platformTotalProfit') }}:<strong>{{ totalWinCoin }}</strong>
|
||||
</span>
|
||||
<!-- <ElSpace wrap>-->
|
||||
<!-- <ElButton-->
|
||||
<!-- v-permission="'dice:play_record:index:save'"-->
|
||||
@@ -53,19 +56,19 @@
|
||||
<!-- 抽奖类型 tag -->
|
||||
<template #lottery_type="{ row }">
|
||||
<ElTag size="small" :type="row.lottery_type === 0 ? 'warning' : 'success'">
|
||||
{{ row.lottery_type === 0 ? '付费' : row.lottery_type === 1 ? '赠送' : '-' }}
|
||||
{{ row.lottery_type === 0 ? t('page.search.paid') : row.lottery_type === 1 ? t('page.search.free') : '-' }}
|
||||
</ElTag>
|
||||
</template>
|
||||
<!-- 是否中大奖 tag -->
|
||||
<template #is_win="{ row }">
|
||||
<ElTag size="small" :type="row.is_win === 1 ? 'success' : 'info'">
|
||||
{{ row.is_win === 0 ? '无' : row.is_win === 1 ? '中大奖' : '-' }}
|
||||
{{ row.is_win === 0 ? t('page.search.noBigWin') : row.is_win === 1 ? t('page.search.bigWin') : '-' }}
|
||||
</ElTag>
|
||||
</template>
|
||||
<!-- 方向 tag -->
|
||||
<template #direction="{ row }">
|
||||
<ElTag size="small" :type="row.direction === 0 ? 'primary' : 'warning'">
|
||||
{{ row.direction === 0 ? '顺时针' : row.direction === 1 ? '逆时针' : '-' }}
|
||||
{{ row.direction === 0 ? t('page.search.clockwise') : row.direction === 1 ? t('page.search.anticlockwise') : '-' }}
|
||||
</ElTag>
|
||||
</template>
|
||||
<!-- 摇取点数 tag -->
|
||||
@@ -103,11 +106,13 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useTable } from '@/hooks/core/useTable'
|
||||
import { useSaiAdmin } from '@/composables/useSaiAdmin'
|
||||
import api from '../../api/play_record/index'
|
||||
import TableSearch from './modules/table-search.vue'
|
||||
import EditDialog from './modules/edit-dialog.vue'
|
||||
const { t } = useI18n()
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = ref<Record<string, unknown>>({
|
||||
@@ -124,6 +129,15 @@
|
||||
direction: undefined
|
||||
})
|
||||
|
||||
/** 当前筛选下平台总盈利(付费抽奖次数×100 - 玩家总收益) */
|
||||
const totalWinCoin = ref<number | null>(null)
|
||||
|
||||
const listApi = async (params: Record<string, any>) => {
|
||||
const res = await api.list(params)
|
||||
totalWinCoin.value = (res as any)?.total_win_coin ?? null
|
||||
return res
|
||||
}
|
||||
|
||||
// 搜索处理
|
||||
const handleSearch = (params: Record<string, any>) => {
|
||||
Object.assign(searchParams, params)
|
||||
@@ -168,39 +182,40 @@
|
||||
refreshData
|
||||
} = useTable({
|
||||
core: {
|
||||
apiFn: api.list,
|
||||
apiFn: listApi,
|
||||
apiParams: { limit: 100 },
|
||||
columnsFactory: () => [
|
||||
// { type: 'selection' },
|
||||
{ prop: 'id', label: 'ID', width: 80 },
|
||||
{ prop: 'id', label: 'page.table.id', width: 80 },
|
||||
{
|
||||
prop: 'player_id',
|
||||
label: '玩家',
|
||||
label: 'page.table.player',
|
||||
formatter: (row: Record<string, any>) => usernameFormatter(row)
|
||||
},
|
||||
{
|
||||
prop: 'lottery_config_id',
|
||||
label: '彩金池配置',
|
||||
label: 'page.table.lotteryPoolConfig',
|
||||
width: 120,
|
||||
useSlot: true
|
||||
},
|
||||
{ prop: 'lottery_type', label: '抽奖类型', width: 100, useSlot: true },
|
||||
{ prop: 'is_win', label: '是否中大奖', width: 100, useSlot: true },
|
||||
{ prop: 'win_coin', label: '赢取平台币', width: 110 },
|
||||
{ prop: 'super_win_coin', label: '中大奖平台币', width: 120 },
|
||||
{ prop: 'reward_win_coin', label: '摇色子中奖平台币', width: 140 },
|
||||
{ prop: 'direction', label: '方向', width: 90, useSlot: true },
|
||||
{ prop: 'start_index', label: '起始索引', width: 90 },
|
||||
{ prop: 'target_index', label: '终点索引', width: 90 },
|
||||
{ prop: 'roll_array', label: '摇取点数', width: 140, useSlot: true },
|
||||
{ prop: 'roll_number', label: '摇取点数和', width: 110, sortable: true },
|
||||
{ prop: 'lottery_type', label: 'page.table.drawType', width: 100, useSlot: true },
|
||||
{ prop: 'is_win', label: 'page.table.isBigWin', width: 100, useSlot: true },
|
||||
{ prop: 'win_coin', label: 'page.table.winCoin', width: 110 },
|
||||
{ prop: 'super_win_coin', label: 'page.table.superWinCoin', width: 120 },
|
||||
{ prop: 'reward_win_coin', label: 'page.table.rewardWinCoin', width: 140 },
|
||||
{ prop: 'direction', label: 'page.table.direction', width: 90, useSlot: true },
|
||||
{ prop: 'start_index', label: 'page.table.startIndex', width: 90 },
|
||||
{ prop: 'target_index', label: 'page.table.targetIndex', width: 90 },
|
||||
{ prop: 'roll_array', label: 'page.table.rollArray', width: 140, useSlot: true },
|
||||
{ prop: 'roll_number', label: 'page.table.rollNumber', width: 110, sortable: true },
|
||||
{
|
||||
prop: 'reward_config_id',
|
||||
label: '奖励配置',
|
||||
label: 'page.table.rewardConfig',
|
||||
formatter: (row: Record<string, any>) => rewardTierFormatter(row)
|
||||
},
|
||||
{ prop: 'create_time', label: '创建时间', width: 170 },
|
||||
{ prop: 'update_time', label: '修改时间', width: 170 },
|
||||
{ prop: 'operation', label: '操作', width: 100, fixed: 'right', useSlot: true }
|
||||
{ prop: 'create_time', label: 'page.table.createTime', width: 170 },
|
||||
{ prop: 'update_time', label: 'page.table.updateTime', width: 170 },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 100, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
@@ -217,3 +232,15 @@
|
||||
// selectedRows
|
||||
} = useSaiAdmin()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.table-summary-inline {
|
||||
margin-right: 12px;
|
||||
font-size: 14px;
|
||||
color: var(--el-text-color-regular);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-summary-inline strong {
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增玩家抽奖记录' : '编辑玩家抽奖记录'"
|
||||
:title="dialogType === 'add' ? $t('page.form.dialogTitleAdd') : $t('page.form.dialogTitleEdit')"
|
||||
width="600px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="玩家" prop="player_id">
|
||||
<el-form-item :label="$t('page.form.player')" prop="player_id">
|
||||
<el-select
|
||||
v-model="formData.player_id"
|
||||
placeholder="请选择玩家(显示用户名)"
|
||||
:placeholder="$t('page.form.placeholderPlayer')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@@ -25,10 +25,10 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="彩金池配置" prop="lottery_config_id">
|
||||
<el-form-item :label="$t('page.form.lotteryPoolConfig')" prop="lottery_config_id">
|
||||
<el-select
|
||||
v-model="formData.lottery_config_id"
|
||||
placeholder="请选择彩金池配置"
|
||||
:placeholder="$t('page.form.placeholderLotteryPool')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@@ -42,90 +42,90 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="抽奖类型" prop="lottery_type">
|
||||
<el-form-item :label="$t('page.form.drawType')" prop="lottery_type">
|
||||
<el-select
|
||||
v-model="formData.lottery_type"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('form.placeholderSelect')"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
:disabled="dialogType === 'edit'"
|
||||
>
|
||||
<el-option label="付费" :value="0" />
|
||||
<el-option label="赠送" :value="1" />
|
||||
<el-option :label="$t('page.form.paid')" :value="0" />
|
||||
<el-option :label="$t('page.form.free')" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否中大奖" prop="is_win">
|
||||
<el-form-item :label="$t('page.form.isBigWin')" prop="is_win">
|
||||
<el-select
|
||||
v-model="formData.is_win"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('form.placeholderSelect')"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
:disabled="dialogType === 'edit'"
|
||||
>
|
||||
<el-option label="无" :value="0" />
|
||||
<el-option label="中大奖" :value="1" />
|
||||
<el-option :label="$t('page.form.noBigWin')" :value="0" />
|
||||
<el-option :label="$t('page.form.bigWin')" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="赢取平台币" prop="win_coin">
|
||||
<el-form-item :label="$t('page.form.winCoin')" prop="win_coin">
|
||||
<el-input-number
|
||||
v-model="formData.win_coin"
|
||||
placeholder="= 中大奖 + 摇色子中奖"
|
||||
:placeholder="$t('page.form.placeholderWinCoin')"
|
||||
:precision="2"
|
||||
style="width: 100%"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="中大奖平台币" prop="super_win_coin">
|
||||
<el-form-item :label="$t('page.form.superWinCoin')" prop="super_win_coin">
|
||||
<el-input-number
|
||||
v-model="formData.super_win_coin"
|
||||
placeholder="豹子时发放"
|
||||
:placeholder="$t('page.form.placeholderSuperWinCoin')"
|
||||
:precision="2"
|
||||
:min="0"
|
||||
style="width: 100%"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="摇色子中奖平台币" prop="reward_win_coin">
|
||||
<el-form-item :label="$t('page.form.rewardWinCoin')" prop="reward_win_coin">
|
||||
<el-input-number
|
||||
v-model="formData.reward_win_coin"
|
||||
placeholder="摇色子中奖"
|
||||
:placeholder="$t('page.form.placeholderRewardWinCoin')"
|
||||
:precision="2"
|
||||
:min="0"
|
||||
style="width: 100%"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="方向" prop="direction">
|
||||
<el-form-item :label="$t('page.form.direction')" prop="direction">
|
||||
<el-select
|
||||
v-model="formData.direction"
|
||||
placeholder="请选择方向"
|
||||
:placeholder="$t('page.form.placeholderDirection')"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
:disabled="dialogType === 'edit'"
|
||||
>
|
||||
<el-option label="顺时针" :value="0" />
|
||||
<el-option label="逆时针" :value="1" />
|
||||
<el-option :label="$t('page.form.clockwise')" :value="0" />
|
||||
<el-option :label="$t('page.form.anticlockwise')" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="起始索引" prop="start_index">
|
||||
<el-form-item :label="$t('page.form.startIndex')" prop="start_index">
|
||||
<el-input-number
|
||||
v-model="formData.start_index"
|
||||
placeholder="起始索引"
|
||||
:placeholder="$t('page.form.placeholderStartIndex')"
|
||||
:min="0"
|
||||
style="width: 100%"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="终点索引" prop="target_index">
|
||||
<el-form-item :label="$t('page.form.targetIndex')" prop="target_index">
|
||||
<el-input-number
|
||||
v-model="formData.target_index"
|
||||
placeholder="终点索引"
|
||||
:placeholder="$t('page.form.placeholderTargetIndex')"
|
||||
:min="0"
|
||||
style="width: 100%"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="摇取点数" prop="rollArrayItems">
|
||||
<el-form-item :label="$t('page.form.rollArray')" prop="rollArrayItems">
|
||||
<div class="roll-array-wrap">
|
||||
<el-input-number
|
||||
v-for="(_, i) in 5"
|
||||
@@ -140,12 +140,12 @@
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</div>
|
||||
<div class="roll-array-hint">固定 5 个数,每个 1~6</div>
|
||||
<div class="roll-array-hint">{{ $t('page.form.rollArrayHint') }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="摇取点数和" prop="roll_number">
|
||||
<el-form-item :label="$t('page.form.rollNumber')" prop="roll_number">
|
||||
<el-input-number
|
||||
v-model="formData.roll_number"
|
||||
placeholder="5 个色子点数之和(5~30)"
|
||||
:placeholder="$t('page.form.placeholderRollNumber')"
|
||||
:min="5"
|
||||
:max="30"
|
||||
:precision="0"
|
||||
@@ -153,10 +153,10 @@
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="奖励配置" prop="reward_config_id">
|
||||
<el-form-item :label="$t('page.form.rewardConfig')" prop="reward_config_id">
|
||||
<el-select
|
||||
v-model="formData.reward_config_id"
|
||||
placeholder="请选择奖励配置(显示前端文本)"
|
||||
:placeholder="$t('page.form.placeholderRewardConfig')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@@ -176,17 +176,20 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">{{ dialogType === 'edit' ? '关闭' : '取消' }}</el-button>
|
||||
<el-button v-if="dialogType === 'add'" type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ dialogType === 'edit' ? $t('form.close') : $t('common.cancel') }}</el-button>
|
||||
<el-button v-if="dialogType === 'add'" type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import api from '../../../api/play_record/index'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
dialogType: string
|
||||
@@ -399,15 +402,15 @@
|
||||
if (props.dialogType === 'add') {
|
||||
delete payload.id
|
||||
await api.save(payload)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(payload)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
} catch (error: any) {
|
||||
let msg = '表单验证失败,请检查必填项与格式'
|
||||
let msg = t('page.form.validateFailed')
|
||||
if (error?.message) {
|
||||
msg = error.message
|
||||
} else if (typeof error === 'string') {
|
||||
|
||||
@@ -9,53 +9,53 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="玩家" prop="username">
|
||||
<el-input v-model="formData.username" placeholder="用户名模糊" clearable />
|
||||
<el-form-item :label="$t('page.search.player')" prop="username">
|
||||
<el-input v-model="formData.username" :placeholder="$t('page.search.usernameFuzzy')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="彩金池配置" prop="lottery_config_name">
|
||||
<el-input v-model="formData.lottery_config_name" placeholder="名称模糊" clearable />
|
||||
<el-form-item :label="$t('page.search.lotteryPoolConfig')" prop="lottery_config_name">
|
||||
<el-input v-model="formData.lottery_config_name" :placeholder="$t('page.search.nameFuzzy')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="抽奖类型" prop="lottery_type">
|
||||
<el-select v-model="formData.lottery_type" placeholder="全部" clearable style="width: 100%">
|
||||
<el-option label="付费" :value="0" />
|
||||
<el-option label="赠送" :value="1" />
|
||||
<el-form-item :label="$t('page.search.drawType')" prop="lottery_type">
|
||||
<el-select v-model="formData.lottery_type" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
<el-option :label="$t('page.search.paid')" :value="0" />
|
||||
<el-option :label="$t('page.search.free')" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="是否中大奖" prop="is_win">
|
||||
<el-select v-model="formData.is_win" placeholder="全部" clearable style="width: 100%">
|
||||
<el-option label="无" :value="0" />
|
||||
<el-option label="中大奖" :value="1" />
|
||||
<el-form-item :label="$t('page.search.isBigWin')" prop="is_win">
|
||||
<el-select v-model="formData.is_win" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
<el-option :label="$t('page.search.noBigWin')" :value="0" />
|
||||
<el-option :label="$t('page.search.bigWin')" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="方向" prop="direction">
|
||||
<el-select v-model="formData.direction" placeholder="全部" clearable style="width: 100%">
|
||||
<el-option label="顺时针" :value="0" />
|
||||
<el-option label="逆时针" :value="1" />
|
||||
<el-form-item :label="$t('page.search.direction')" prop="direction">
|
||||
<el-select v-model="formData.direction" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
<el-option :label="$t('page.search.clockwise')" :value="0" />
|
||||
<el-option :label="$t('page.search.anticlockwise')" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="赢取平台币" prop="win_coin_min">
|
||||
<el-form-item :label="$t('page.search.winCoin')" prop="win_coin_min">
|
||||
<div class="range-wrap">
|
||||
<el-input-number
|
||||
v-model="formData.win_coin_min"
|
||||
placeholder="最小"
|
||||
:placeholder="$t('table.searchBar.min')"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
/>
|
||||
<span class="range-sep">至</span>
|
||||
<span class="range-sep">{{ $t('table.searchBar.rangeSeparator') }}</span>
|
||||
<el-input-number
|
||||
v-model="formData.win_coin_max"
|
||||
placeholder="最大"
|
||||
:placeholder="$t('table.searchBar.max')"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
@@ -64,21 +64,21 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="摇取点数和" prop="roll_number_min">
|
||||
<el-form-item :label="$t('page.search.rollNumber')" prop="roll_number_min">
|
||||
<div class="range-wrap">
|
||||
<el-input-number
|
||||
v-model="formData.roll_number_min"
|
||||
placeholder="最小"
|
||||
:placeholder="$t('table.searchBar.min')"
|
||||
:min="5"
|
||||
:max="30"
|
||||
:precision="0"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
/>
|
||||
<span class="range-sep">至</span>
|
||||
<span class="range-sep">{{ $t('table.searchBar.rangeSeparator') }}</span>
|
||||
<el-input-number
|
||||
v-model="formData.roll_number_max"
|
||||
placeholder="最大"
|
||||
:placeholder="$t('table.searchBar.max')"
|
||||
:min="5"
|
||||
:max="30"
|
||||
:precision="0"
|
||||
@@ -89,13 +89,13 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="奖励配置" prop="reward_ui_text">
|
||||
<el-input v-model="formData.reward_ui_text" placeholder="前端显示文本模糊" clearable />
|
||||
<el-form-item :label="$t('page.search.rewardConfig')" prop="reward_ui_text">
|
||||
<el-input v-model="formData.reward_ui_text" :placeholder="$t('page.search.uiTextFuzzy')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="中奖名(档位)" prop="reward_tier">
|
||||
<el-select v-model="formData.reward_tier" placeholder="全部" clearable style="width: 100%">
|
||||
<el-form-item :label="$t('page.search.rewardTier')" prop="reward_tier">
|
||||
<el-select v-model="formData.reward_tier" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
<el-option label="T1" value="T1" />
|
||||
<el-option label="T2" value="T2" />
|
||||
<el-option label="T3" value="T3" />
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData">
|
||||
<template #left>
|
||||
<span v-if="totalWinCoin !== null" class="table-summary-inline">
|
||||
平台总盈利:<strong>{{ totalWinCoin }}</strong>
|
||||
{{ $t('page.toolbar.platformTotalProfit') }}:<strong>{{ totalWinCoin }}</strong>
|
||||
</span>
|
||||
<ElSpace wrap class="table-toolbar-buttons">
|
||||
<ElButton
|
||||
@@ -20,10 +20,10 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:delete-bin-5-line" />
|
||||
</template>
|
||||
删除
|
||||
{{ $t('table.actions.delete') }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-permission="'dice:play_record_test:index:destroy'"
|
||||
v-permission="'dice:play_record_test:index:clearAll'"
|
||||
type="danger"
|
||||
plain
|
||||
@click="handleClearAll"
|
||||
@@ -32,7 +32,7 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:delete-bin-2-line" />
|
||||
</template>
|
||||
一键删除所有数据
|
||||
{{ $t('page.toolbar.clearAllData') }}
|
||||
</ElButton>
|
||||
</ElSpace>
|
||||
</template>
|
||||
@@ -58,19 +58,19 @@
|
||||
<!-- 抽奖类型 -->
|
||||
<template #lottery_type="{ row }">
|
||||
<ElTag size="small" :type="row.lottery_type === 0 ? 'warning' : 'success'">
|
||||
{{ row.lottery_type === 0 ? '付费' : row.lottery_type === 1 ? '赠送' : '-' }}
|
||||
{{ row.lottery_type === 0 ? t('page.search.paid') : row.lottery_type === 1 ? t('page.search.free') : '-' }}
|
||||
</ElTag>
|
||||
</template>
|
||||
<!-- 是否中大奖 -->
|
||||
<template #is_win="{ row }">
|
||||
<ElTag size="small" :type="row.is_win === 1 ? 'success' : 'info'">
|
||||
{{ row.is_win === 0 ? '无' : row.is_win === 1 ? '中大奖' : '-' }}
|
||||
{{ row.is_win === 0 ? t('page.search.noBigWin') : row.is_win === 1 ? t('page.search.bigWin') : '-' }}
|
||||
</ElTag>
|
||||
</template>
|
||||
<!-- 方向 -->
|
||||
<template #direction="{ row }">
|
||||
<ElTag size="small" :type="row.direction === 0 ? 'primary' : 'warning'">
|
||||
{{ row.direction === 0 ? '顺时针' : row.direction === 1 ? '逆时针' : '-' }}
|
||||
{{ row.direction === 0 ? t('page.search.clockwise') : row.direction === 1 ? t('page.search.anticlockwise') : '-' }}
|
||||
</ElTag>
|
||||
</template>
|
||||
<!-- 摇取点数 -->
|
||||
@@ -86,7 +86,7 @@
|
||||
<!-- 状态 -->
|
||||
<template #status="{ row }">
|
||||
<ElTag size="small" :type="row.status === 1 ? 'success' : 'info'">
|
||||
{{ row.status === 1 ? '成功' : '失败' }}
|
||||
{{ row.status === 1 ? t('table.searchBar.success') : t('table.searchBar.failure') }}
|
||||
</ElTag>
|
||||
</template>
|
||||
<!-- 操作列 -->
|
||||
@@ -118,12 +118,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useTable } from '@/hooks/core/useTable'
|
||||
import { useSaiAdmin } from '@/composables/useSaiAdmin'
|
||||
import api from '../../api/play_record_test/index'
|
||||
import TableSearch from './modules/table-search.vue'
|
||||
import EditDialog from './modules/edit-dialog.vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
const { t } = useI18n()
|
||||
|
||||
// 搜索表单(与 play_record 对齐:方向、赢取平台币范围、是否中大奖、中奖档位、点数和)
|
||||
const searchForm = ref<Record<string, unknown>>({
|
||||
@@ -205,22 +207,22 @@
|
||||
apiFn: listApi,
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'id', label: 'ID', width: 80 },
|
||||
{ prop: 'lottery_config_id', label: '彩金池配置', width: 120, useSlot: true },
|
||||
{ prop: 'lottery_type', label: '抽奖类型', width: 100, useSlot: true },
|
||||
{ prop: 'is_win', label: '是否中大奖', width: 100, useSlot: true },
|
||||
{ prop: 'win_coin', label: '赢取平台币', width: 110 },
|
||||
{ prop: 'super_win_coin', label: '中大奖平台币', width: 120 },
|
||||
{ prop: 'reward_win_coin', label: '摇色子中奖平台币', width: 140 },
|
||||
{ prop: 'direction', label: '方向', width: 90, useSlot: true },
|
||||
{ prop: 'start_index', label: '起始索引', width: 90 },
|
||||
{ prop: 'target_index', label: '终点索引', width: 90 },
|
||||
{ prop: 'roll_array', label: '摇取点数', width: 140, useSlot: true },
|
||||
{ prop: 'roll_number', label: '摇取点数和', width: 110, sortable: true },
|
||||
{ prop: 'reward_config_id', label: '奖励档位', width: 100, useSlot: true },
|
||||
{ prop: 'status', label: '状态', width: 80, useSlot: true },
|
||||
{ prop: 'create_time', label: '创建时间', width: 170 },
|
||||
{ prop: 'operation', label: '操作', width: 100, fixed: 'right', useSlot: true }
|
||||
{ prop: 'id', label: 'page.table.id', width: 80 },
|
||||
{ prop: 'lottery_config_id', label: 'page.table.lotteryPoolConfig', width: 120, useSlot: true },
|
||||
{ prop: 'lottery_type', label: 'page.table.drawType', width: 100, useSlot: true },
|
||||
{ prop: 'is_win', label: 'page.table.isBigWin', width: 100, useSlot: true },
|
||||
{ prop: 'win_coin', label: 'page.table.winCoin', width: 110 },
|
||||
{ prop: 'super_win_coin', label: 'page.table.superWinCoin', width: 120 },
|
||||
{ prop: 'reward_win_coin', label: 'page.table.rewardWinCoin', width: 140 },
|
||||
{ prop: 'direction', label: 'page.table.direction', width: 90, useSlot: true },
|
||||
{ prop: 'start_index', label: 'page.table.startIndex', width: 90 },
|
||||
{ prop: 'target_index', label: 'page.table.targetIndex', width: 90 },
|
||||
{ prop: 'roll_array', label: 'page.table.rollArray', width: 140, useSlot: true },
|
||||
{ prop: 'roll_number', label: 'page.table.rollNumber', width: 110, sortable: true },
|
||||
{ prop: 'reward_config_id', label: 'page.table.rewardConfig', width: 100, useSlot: true },
|
||||
{ prop: 'status', label: 'page.table.status', width: 80, useSlot: true },
|
||||
{ prop: 'create_time', label: 'page.table.createTime', width: 170 },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 100, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增玩家抽奖记录(测试数据)' : '编辑玩家抽奖记录(测试数据)'"
|
||||
:title="dialogType === 'add' ? $t('page.form.titleAdd') : $t('page.form.titleEdit')"
|
||||
width="600px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="彩金池配置id" prop="lottery_config_id">
|
||||
<el-input v-model="formData.lottery_config_id" placeholder="请输入彩金池配置id" />
|
||||
<el-form-item :label="$t('page.form.labelLotteryConfigId')" prop="lottery_config_id">
|
||||
<el-input v-model="formData.lottery_config_id" :placeholder="$t('page.form.placeholderLotteryConfigId')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="抽奖类型" prop="lottery_type">
|
||||
<el-form-item :label="$t('page.form.drawType')" prop="lottery_type">
|
||||
<el-select
|
||||
v-model="formData.lottery_type"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('form.placeholderSelect')"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option label="付费" :value="0" />
|
||||
<el-option label="赠送" :value="1" />
|
||||
<el-option :label="$t('page.search.paid')" :value="0" />
|
||||
<el-option :label="$t('page.search.free')" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="方向" prop="direction">
|
||||
<el-select v-model="formData.direction" placeholder="请选择" clearable style="width: 100%">
|
||||
<el-option label="顺时针" :value="0" />
|
||||
<el-option label="逆时针" :value="1" />
|
||||
<el-form-item :label="$t('page.search.direction')" prop="direction">
|
||||
<el-select v-model="formData.direction" :placeholder="$t('form.placeholderSelect')" clearable style="width: 100%">
|
||||
<el-option :label="$t('page.search.clockwise')" :value="0" />
|
||||
<el-option :label="$t('page.search.anticlockwise')" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否中大奖" prop="is_win">
|
||||
<el-select v-model="formData.is_win" placeholder="请选择" clearable style="width: 100%">
|
||||
<el-option label="无" :value="0" />
|
||||
<el-option label="中大奖" :value="1" />
|
||||
<el-form-item :label="$t('page.search.isBigWin')" prop="is_win">
|
||||
<el-select v-model="formData.is_win" :placeholder="$t('form.placeholderSelect')" clearable style="width: 100%">
|
||||
<el-option :label="$t('page.search.noBigWin')" :value="0" />
|
||||
<el-option :label="$t('page.search.bigWin')" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="赢取平台币" prop="win_coin">
|
||||
<el-form-item :label="$t('page.search.winCoin')" prop="win_coin">
|
||||
<el-input-number
|
||||
v-model="formData.win_coin"
|
||||
placeholder="赢取平台币"
|
||||
:placeholder="$t('page.form.placeholderWinCoin')"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="中奖档位" prop="reward_tier">
|
||||
<el-form-item :label="$t('page.search.rewardTier')" prop="reward_tier">
|
||||
<el-select
|
||||
v-model="formData.reward_tier"
|
||||
placeholder="请选择档位(选后自动带出奖励配置ID)"
|
||||
:placeholder="$t('page.form.placeholderRewardTier')"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
@change="onRewardTierChange"
|
||||
@@ -58,40 +58,40 @@
|
||||
<el-option label="T5" value="T5" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="奖励配置id" prop="reward_config_id">
|
||||
<el-form-item :label="$t('page.form.rewardConfigId')" prop="reward_config_id">
|
||||
<el-input
|
||||
v-model="formData.reward_config_id"
|
||||
placeholder="可选中奖档位自动带出或手动输入"
|
||||
:placeholder="$t('page.form.placeholderRewardConfigId')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="起始索引" prop="start_index">
|
||||
<el-input v-model="formData.start_index" placeholder="请输入起始索引" />
|
||||
<el-form-item :label="$t('page.table.startIndex')" prop="start_index">
|
||||
<el-input v-model="formData.start_index" :placeholder="$t('page.form.placeholderStartIndex')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="结束索引" prop="target_index">
|
||||
<el-input v-model="formData.target_index" placeholder="请输入结束索引" />
|
||||
<el-form-item :label="$t('page.form.labelTargetIndex')" prop="target_index">
|
||||
<el-input v-model="formData.target_index" :placeholder="$t('page.form.placeholderTargetIndex')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="摇取点数和" prop="roll_number">
|
||||
<el-input v-model="formData.roll_number" placeholder="请输入摇取点数和" />
|
||||
<el-form-item :label="$t('page.search.rollNumber')" prop="roll_number">
|
||||
<el-input v-model="formData.roll_number" :placeholder="$t('page.form.placeholderRollNumber')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="摇取点数:[1,2,3,4,5,6]" prop="roll_array">
|
||||
<el-input v-model="formData.roll_array" placeholder="请输入摇取点数:[1,2,3,4,5,6]" />
|
||||
<el-form-item :label="$t('page.form.labelRollArray')" prop="roll_array">
|
||||
<el-input v-model="formData.roll_array" :placeholder="$t('page.form.placeholderRollArray')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态:0=失败,1=成功" prop="status">
|
||||
<el-form-item :label="$t('page.form.labelStatus')" prop="status">
|
||||
<sa-radio v-model="formData.status" dict="data_status" />
|
||||
</el-form-item>
|
||||
<el-form-item label="中大奖平台币" prop="super_win_coin">
|
||||
<el-input v-model="formData.super_win_coin" placeholder="请输入中大奖平台币" />
|
||||
<el-form-item :label="$t('page.table.superWinCoin')" prop="super_win_coin">
|
||||
<el-input v-model="formData.super_win_coin" :placeholder="$t('page.form.placeholderSuperWinCoin')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="摇色子中奖平台币" prop="reward_win_coin">
|
||||
<el-input v-model="formData.reward_win_coin" placeholder="请输入摇色子中奖平台币" />
|
||||
<el-form-item :label="$t('page.table.rewardWinCoin')" prop="reward_win_coin">
|
||||
<el-input v-model="formData.reward_win_coin" :placeholder="$t('page.form.placeholderRewardWinCoin')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属管理员" prop="admin_id">
|
||||
<el-input v-model="formData.admin_id" placeholder="请输入所属管理员" />
|
||||
<el-form-item :label="$t('page.form.labelAdminId')" prop="admin_id">
|
||||
<el-input v-model="formData.admin_id" :placeholder="$t('page.form.placeholderAdminId')" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -101,6 +101,7 @@
|
||||
import rewardConfigApi from '../../../api/reward_config/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -120,6 +121,7 @@
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
@@ -134,14 +136,14 @@
|
||||
/**
|
||||
* 表单验证规则
|
||||
*/
|
||||
const rules = reactive<FormRules>({
|
||||
lottery_config_id: [{ required: true, message: '彩金池配置id必需填写', trigger: 'blur' }],
|
||||
lottery_type: [{ required: true, message: '抽奖类型:0=付费,1=赠送必需填写', trigger: 'blur' }],
|
||||
is_win: [{ required: true, message: '中大奖:0=无,1=中奖必需填写', trigger: 'blur' }],
|
||||
direction: [{ required: true, message: '方向:0=顺时针,1=逆时针必需填写', trigger: 'blur' }],
|
||||
reward_config_id: [{ required: true, message: '奖励配置id必需填写', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '状态:0=失败,1=成功必需填写', trigger: 'blur' }]
|
||||
})
|
||||
const rules = computed<FormRules>(() => ({
|
||||
lottery_config_id: [{ required: true, message: t('page.form.ruleLotteryConfigIdRequired'), trigger: 'blur' }],
|
||||
lottery_type: [{ required: true, message: t('page.form.ruleDrawTypeRequired'), trigger: 'blur' }],
|
||||
is_win: [{ required: true, message: t('page.form.ruleIsBigWinRequired'), trigger: 'blur' }],
|
||||
direction: [{ required: true, message: t('page.form.ruleDirectionRequired'), trigger: 'blur' }],
|
||||
reward_config_id: [{ required: true, message: t('page.form.ruleRewardConfigIdRequired'), trigger: 'blur' }],
|
||||
status: [{ required: true, message: t('page.form.ruleStatusRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
/**
|
||||
* 初始数据
|
||||
@@ -256,10 +258,10 @@
|
||||
delete (payload as Record<string, unknown>).reward_tier
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(payload)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(payload)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,43 +9,43 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="抽奖类型" prop="lottery_type">
|
||||
<el-select v-model="formData.lottery_type" placeholder="全部" clearable style="width: 100%">
|
||||
<el-option label="付费" :value="0" />
|
||||
<el-option label="赠送" :value="1" />
|
||||
<el-form-item :label="$t('page.search.drawType')" prop="lottery_type">
|
||||
<el-select v-model="formData.lottery_type" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
<el-option :label="$t('page.search.paid')" :value="0" />
|
||||
<el-option :label="$t('page.search.free')" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="方向" prop="direction">
|
||||
<el-select v-model="formData.direction" placeholder="全部" clearable style="width: 100%">
|
||||
<el-option label="顺时针" :value="0" />
|
||||
<el-option label="逆时针" :value="1" />
|
||||
<el-form-item :label="$t('page.search.direction')" prop="direction">
|
||||
<el-select v-model="formData.direction" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
<el-option :label="$t('page.search.clockwise')" :value="0" />
|
||||
<el-option :label="$t('page.search.anticlockwise')" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="是否中大奖" prop="is_win">
|
||||
<el-select v-model="formData.is_win" placeholder="全部" clearable style="width: 100%">
|
||||
<el-option label="无" :value="0" />
|
||||
<el-option label="中大奖" :value="1" />
|
||||
<el-form-item :label="$t('page.search.isBigWin')" prop="is_win">
|
||||
<el-select v-model="formData.is_win" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
<el-option :label="$t('page.search.noBigWin')" :value="0" />
|
||||
<el-option :label="$t('page.search.bigWin')" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="赢取平台币" prop="win_coin_min">
|
||||
<el-form-item :label="$t('page.search.winCoin')" prop="win_coin_min">
|
||||
<div class="range-wrap">
|
||||
<el-input-number
|
||||
v-model="formData.win_coin_min"
|
||||
placeholder="最小"
|
||||
:placeholder="$t('table.searchBar.min')"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
/>
|
||||
<span class="range-sep">至</span>
|
||||
<span class="range-sep">{{ $t('table.searchBar.rangeSeparator') }}</span>
|
||||
<el-input-number
|
||||
v-model="formData.win_coin_max"
|
||||
placeholder="最大"
|
||||
:placeholder="$t('table.searchBar.max')"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
@@ -54,8 +54,8 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="中奖档位" prop="reward_tier">
|
||||
<el-select v-model="formData.reward_tier" placeholder="全部" clearable style="width: 100%">
|
||||
<el-form-item :label="$t('page.search.rewardTier')" prop="reward_tier">
|
||||
<el-select v-model="formData.reward_tier" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
<el-option label="T1" value="T1" />
|
||||
<el-option label="T2" value="T2" />
|
||||
<el-option label="T3" value="T3" />
|
||||
@@ -65,10 +65,10 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="点数和" prop="roll_number">
|
||||
<el-form-item :label="$t('page.search.rollNumber')" prop="roll_number">
|
||||
<el-select
|
||||
v-model="formData.roll_number"
|
||||
placeholder="全部"
|
||||
:placeholder="$t('table.searchBar.all')"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:add-fill" />
|
||||
</template>
|
||||
新增
|
||||
{{ $t('table.actions.add') }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-permission="'dice:player:index:destroy'"
|
||||
@@ -23,7 +23,7 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:delete-bin-5-line" />
|
||||
</template>
|
||||
删除
|
||||
{{ $t('table.actions.delete') }}
|
||||
</ElButton>
|
||||
</ElSpace>
|
||||
</template>
|
||||
@@ -150,73 +150,73 @@
|
||||
apiFn: api.list,
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'username', label: '用户名', align: 'center' },
|
||||
{ prop: 'phone', label: '手机号', align: 'center' },
|
||||
{ prop: 'name', label: '昵称', align: 'center' },
|
||||
{ prop: 'username', label: 'page.table.username', align: 'center' },
|
||||
{ prop: 'phone', label: 'page.table.phone', align: 'center' },
|
||||
{ prop: 'name', label: 'page.table.nickname', align: 'center' },
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
label: 'page.table.status',
|
||||
width: 88,
|
||||
align: 'center',
|
||||
useSlot: true
|
||||
},
|
||||
{
|
||||
prop: 'coin',
|
||||
label: '平台币',
|
||||
label: 'page.table.coin',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
useSlot: true
|
||||
},
|
||||
{
|
||||
prop: 'lottery_config_id',
|
||||
label: '彩金池配置',
|
||||
label: 'page.table.lotteryPoolConfig',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
formatter: (row: any) => lotteryConfigNameFormatter(row)
|
||||
},
|
||||
{
|
||||
prop: 't1_weight',
|
||||
label: 'T1权重',
|
||||
label: 'page.table.t1Weight',
|
||||
width: 80,
|
||||
align: 'center',
|
||||
formatter: weightFormatter('t1_weight')
|
||||
},
|
||||
{
|
||||
prop: 't2_weight',
|
||||
label: 'T2权重',
|
||||
label: 'page.table.t2Weight',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
formatter: weightFormatter('t2_weight')
|
||||
},
|
||||
{
|
||||
prop: 't3_weight',
|
||||
label: 'T3权重',
|
||||
label: 'page.table.t3Weight',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
formatter: weightFormatter('t3_weight')
|
||||
},
|
||||
{
|
||||
prop: 't4_weight',
|
||||
label: 'T4权重',
|
||||
label: 'page.table.t4Weight',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
formatter: weightFormatter('t4_weight')
|
||||
},
|
||||
{
|
||||
prop: 't5_weight',
|
||||
label: 'T5权重',
|
||||
label: 'page.table.t5Weight',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
formatter: weightFormatter('t5_weight')
|
||||
},
|
||||
{ prop: 'total_ticket_count', label: '总抽奖次数', align: 'center' },
|
||||
{ prop: 'paid_ticket_count', label: '购买抽奖次数', align: 'center' },
|
||||
{ prop: 'free_ticket_count', label: '赠送抽奖次数', align: 'center' },
|
||||
{ prop: 'create_time', label: '创建时间', align: 'center' },
|
||||
{ prop: 'update_time', label: '更新时间', align: 'center' },
|
||||
{ prop: 'total_ticket_count', label: 'page.table.totalDrawCount', align: 'center' },
|
||||
{ prop: 'paid_ticket_count', label: 'page.table.paidDrawCount', align: 'center' },
|
||||
{ prop: 'free_ticket_count', label: 'page.table.freeDrawCount', align: 'center' },
|
||||
{ prop: 'create_time', label: 'page.table.createTime', align: 'center' },
|
||||
{ prop: 'update_time', label: 'page.table.updateTime', align: 'center' },
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
label: 'table.actions.operation',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="玩家钱包操作"
|
||||
:title="$t('page.form.walletTitle')"
|
||||
width="480px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="100px">
|
||||
<el-form-item label="玩家">
|
||||
<el-form-item :label="$t('page.form.walletPlayer')">
|
||||
<el-input :model-value="player?.username" disabled placeholder="-" />
|
||||
</el-form-item>
|
||||
<el-form-item label="钱包余额">
|
||||
<el-form-item :label="$t('page.form.walletBalance')">
|
||||
<el-input-number
|
||||
:model-value="walletBalance"
|
||||
disabled
|
||||
@@ -20,36 +20,36 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作类型" prop="type">
|
||||
<el-select v-model="formData.type" placeholder="请选择" clearable style="width: 100%">
|
||||
<el-option label="加点" :value="3" />
|
||||
<el-option label="扣点" :value="4" />
|
||||
<el-form-item :label="$t('page.form.operationType')" prop="type">
|
||||
<el-select v-model="formData.type" :placeholder="$t('form.placeholderSelect')" clearable style="width: 100%">
|
||||
<el-option :label="$t('page.form.typeAdd')" :value="3" />
|
||||
<el-option :label="$t('page.form.typeSub')" :value="4" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="平台币变动" prop="coin">
|
||||
<el-form-item :label="$t('page.form.coinChange')" prop="coin">
|
||||
<el-input-number
|
||||
v-model="formData.coin"
|
||||
:min="0.01"
|
||||
:precision="2"
|
||||
placeholder="正数,扣点时不能超过余额"
|
||||
:placeholder="$t('page.form.placeholderCoinChange')"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-form-item :label="$t('form.labelRemark')" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
placeholder="选填,不填则按类型自动填写"
|
||||
:placeholder="$t('page.form.placeholderRemarkOptional')"
|
||||
maxlength="500"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSubmit">确定</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSubmit">{{ $t('common.confirm') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -58,6 +58,9 @@
|
||||
import walletRecordApi from '../../../api/player_wallet_record/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
interface PlayerRow {
|
||||
id: number
|
||||
@@ -95,19 +98,19 @@
|
||||
return c != null ? Number(c) : 0
|
||||
})
|
||||
|
||||
const rules = reactive<FormRules>({
|
||||
type: [{ required: true, message: '请选择操作类型', trigger: 'change' }],
|
||||
const rules = computed<FormRules>(() => ({
|
||||
type: [{ required: true, message: t('page.form.ruleSelectType'), trigger: 'change' }],
|
||||
coin: [
|
||||
{ required: true, message: '请输入平台币变动', trigger: 'blur' },
|
||||
{ required: true, message: t('page.form.ruleEnterCoin'), trigger: 'blur' },
|
||||
{
|
||||
validator: (_rule, value, callback) => {
|
||||
const n = Number(value)
|
||||
if (Number.isNaN(n) || n <= 0) {
|
||||
callback(new Error('平台币变动必须大于 0'))
|
||||
callback(new Error(t('page.form.ruleCoinPositive')))
|
||||
return
|
||||
}
|
||||
if (formData.type === 4 && n > walletBalance.value) {
|
||||
callback(new Error('扣点不能超过当前余额'))
|
||||
callback(new Error(t('page.form.ruleDeductExceed')))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
@@ -115,7 +118,7 @@
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
})
|
||||
}))
|
||||
|
||||
const initialFormData = {
|
||||
type: null as 3 | 4 | null,
|
||||
@@ -146,11 +149,11 @@
|
||||
await formRef.value.validate()
|
||||
const coin = Number(formData.coin) || 0
|
||||
if (coin <= 0) {
|
||||
ElMessage.warning('平台币变动必须大于 0')
|
||||
ElMessage.warning(t('page.form.ruleCoinPositive'))
|
||||
return
|
||||
}
|
||||
if (formData.type === 4 && coin > walletBalance.value) {
|
||||
ElMessage.warning('扣点不能超过当前余额')
|
||||
ElMessage.warning(t('page.form.ruleDeductExceed'))
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
@@ -160,7 +163,7 @@
|
||||
coin,
|
||||
remark: formData.remark?.trim() || undefined
|
||||
})
|
||||
ElMessage.success('操作成功')
|
||||
ElMessage.success(t('page.form.operateSuccess'))
|
||||
emit('success')
|
||||
handleClose()
|
||||
} catch (e) {
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增大富翁-玩家' : '编辑大富翁-玩家'"
|
||||
:title="dialogType === 'add' ? $t('page.form.dialogTitleAdd') : $t('page.form.dialogTitleEdit')"
|
||||
width="600px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model="formData.username" placeholder="请输入用户名" />
|
||||
<el-form-item :label="$t('page.form.username')" prop="username">
|
||||
<el-input v-model="formData.username" :placeholder="$t('page.form.placeholderUsername')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入昵称" />
|
||||
<el-form-item :label="$t('page.form.nickname')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.form.placeholderNickname')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-form-item :label="$t('page.form.phone')" prop="phone">
|
||||
<el-input
|
||||
v-model="formData.phone"
|
||||
placeholder="请输入手机号"
|
||||
:placeholder="$t('page.form.placeholderPhone')"
|
||||
clearable
|
||||
maxlength="20"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password" :rules="passwordRules">
|
||||
<el-form-item :label="$t('page.form.password')" prop="password" :rules="passwordRules">
|
||||
<el-input
|
||||
v-model="formData.password"
|
||||
type="password"
|
||||
placeholder="编辑留空则不修改"
|
||||
:placeholder="$t('page.form.placeholderPasswordEdit')"
|
||||
show-password
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-form-item :label="$t('page.form.status')" prop="status">
|
||||
<sa-switch v-model="formData.status" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属管理员" prop="admin_id">
|
||||
<el-form-item :label="$t('page.form.adminId')" prop="admin_id">
|
||||
<el-select
|
||||
v-model="formData.admin_id"
|
||||
placeholder="选择后台管理员(可选)"
|
||||
:placeholder="$t('page.form.placeholderAdmin')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@@ -51,21 +51,21 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="平台币" prop="coin">
|
||||
<el-form-item :label="$t('page.form.coin')" prop="coin">
|
||||
<el-input-number
|
||||
v-model="formData.coin"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:disabled="dialogType === 'add'"
|
||||
placeholder="创建时默认0,不可改"
|
||||
:placeholder="$t('page.form.placeholderCoinAdd')"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- lottery_config_id:空 = 自定义权重,否则 = DiceLotteryConfig.id;选择后该配置的五个 weight 会写入下方 player.*_weight -->
|
||||
<el-form-item label="彩金池配置" prop="lottery_config_id">
|
||||
<el-form-item :label="$t('page.form.lotteryPoolConfig')" prop="lottery_config_id">
|
||||
<el-select
|
||||
v-model="formData.lottery_config_id"
|
||||
placeholder="留空则使用下方自定义权重,或选择彩金池"
|
||||
:placeholder="$t('page.form.placeholderLotteryPool')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@@ -81,28 +81,28 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- 当前选中的 DiceLotteryConfig 数据展示 -->
|
||||
<el-form-item v-if="currentLotteryConfig" label="当前配置" class="current-config-block">
|
||||
<el-form-item v-if="currentLotteryConfig" :label="$t('page.form.currentConfig')" class="current-config-block">
|
||||
<div class="current-lottery-config">
|
||||
<div class="config-row">
|
||||
<span class="config-label">名称:</span>
|
||||
<span class="config-label">{{ $t('page.form.configLabelName') }}:</span>
|
||||
<span>{{ currentLotteryConfig.name ?? '-' }}</span>
|
||||
</div>
|
||||
<div class="config-row">
|
||||
<span class="config-label">类型:</span>
|
||||
<span>{{ lotteryConfigTypeText(currentLotteryConfig.type) }}</span>
|
||||
<span class="config-label">{{ $t('page.form.configLabelType') }}:</span>
|
||||
<span>{{ lotteryConfigTypeText(currentLotteryConfig.name) }}</span>
|
||||
</div>
|
||||
<div class="config-row">
|
||||
<span class="config-label">T1~T5 权重:</span>
|
||||
<span class="config-label">{{ $t('page.form.configLabelWeights') }}:</span>
|
||||
<span>{{ currentLotteryConfigWeightsText }}</span>
|
||||
</div>
|
||||
<div v-if="currentLotteryConfig.remark" class="config-row">
|
||||
<span class="config-label">备注:</span>
|
||||
<span class="config-label">{{ $t('page.form.configLabelRemark') }}:</span>
|
||||
<span>{{ currentLotteryConfig.remark }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- lottery_config_id 为空时自定义权重可编辑;有值时来自所选 DiceLotteryConfig,仅展示不可编辑 -->
|
||||
<el-form-item label="T1池权重(%)" prop="t1_weight">
|
||||
<el-form-item :label="$t('page.form.t1Weight')" prop="t1_weight">
|
||||
<el-slider
|
||||
v-model="formData.t1_weight"
|
||||
:min="0"
|
||||
@@ -112,7 +112,7 @@
|
||||
:disabled="!isLotteryConfigEmpty()"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="T2池权重(%)" prop="t2_weight">
|
||||
<el-form-item :label="$t('page.form.t2Weight')" prop="t2_weight">
|
||||
<el-slider
|
||||
v-model="formData.t2_weight"
|
||||
:min="0"
|
||||
@@ -122,7 +122,7 @@
|
||||
:disabled="!isLotteryConfigEmpty()"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="T3池权重(%)" prop="t3_weight">
|
||||
<el-form-item :label="$t('page.form.t3Weight')" prop="t3_weight">
|
||||
<el-slider
|
||||
v-model="formData.t3_weight"
|
||||
:min="0"
|
||||
@@ -132,7 +132,7 @@
|
||||
:disabled="!isLotteryConfigEmpty()"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="T4池权重(%)" prop="t4_weight">
|
||||
<el-form-item :label="$t('page.form.t4Weight')" prop="t4_weight">
|
||||
<el-slider
|
||||
v-model="formData.t4_weight"
|
||||
:min="0"
|
||||
@@ -142,7 +142,7 @@
|
||||
:disabled="!isLotteryConfigEmpty()"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="T5池权重(%)" prop="t5_weight">
|
||||
<el-form-item :label="$t('page.form.t5Weight')" prop="t5_weight">
|
||||
<el-slider
|
||||
v-model="formData.t5_weight"
|
||||
:min="0"
|
||||
@@ -154,16 +154,16 @@
|
||||
</el-form-item>
|
||||
<el-form-item v-if="isLotteryConfigEmpty()">
|
||||
<div class="text-gray-500 text-sm">
|
||||
五个池权重总和:<span :class="Math.abs(weightsSum - 100) > 0.01 ? 'text-red-500' : ''">{{
|
||||
{{ $t('page.form.weightsSumHint') }}<span :class="Math.abs(weightsSum - 100) > 0.01 ? 'text-red-500' : ''">{{
|
||||
weightsSum
|
||||
}}</span
|
||||
>% / 100%(必须为100%)
|
||||
>{{ $t('page.form.weightsSumUnit') }}
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -171,9 +171,11 @@
|
||||
<script setup lang="ts">
|
||||
import api from '../../../api/player/index'
|
||||
import lotteryConfigApi from '../../../api/lottery_pool_config/index'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
|
||||
const { t } = useI18n()
|
||||
const WEIGHT_FIELDS = ['t1_weight', 't2_weight', 't3_weight', 't4_weight', 't5_weight'] as const
|
||||
|
||||
interface Props {
|
||||
@@ -265,11 +267,12 @@
|
||||
/** 当前选中的 DiceLotteryConfig 完整数据(用于展示) */
|
||||
const currentLotteryConfig = ref<Record<string, any> | null>(null)
|
||||
|
||||
function lotteryConfigTypeText(type: unknown): string {
|
||||
const t = Number(type)
|
||||
if (t === 0) return '付费'
|
||||
if (t === 1) return '赠送'
|
||||
return t ? `类型${t}` : '-'
|
||||
function lotteryConfigTypeText(name: unknown): string {
|
||||
const n = String(name ?? '')
|
||||
if (n === 'default') return '默认'
|
||||
if (n === 'killScore') return '杀分'
|
||||
if (n === 'up') return '上分'
|
||||
return n || '-'
|
||||
}
|
||||
|
||||
/** 是否为空/自定义权重(未选彩金池或选 0) */
|
||||
@@ -415,7 +418,7 @@
|
||||
await formRef.value.validate()
|
||||
const useCustomWeights = isLotteryConfigEmpty()
|
||||
if (useCustomWeights && Math.abs(weightsSum.value - 100) > 0.01) {
|
||||
ElMessage.warning('五个池权重总和必须为100%')
|
||||
ElMessage.warning(t('page.form.ruleWeightsSumMustBe100'))
|
||||
return
|
||||
}
|
||||
const payload = { ...formData }
|
||||
@@ -427,10 +430,10 @@
|
||||
}
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(payload)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(payload)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,45 +9,45 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model="formData.username" placeholder="请输入用户名" clearable />
|
||||
<el-form-item :label="$t('page.search.username')" prop="username">
|
||||
<el-input v-model="formData.username" :placeholder="$t('page.search.placeholderUsername')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="昵称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入昵称" clearable />
|
||||
<el-form-item :label="$t('page.search.nickname')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.search.placeholderNickname')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="formData.phone" placeholder="手机号模糊查询" clearable />
|
||||
<el-form-item :label="$t('page.search.phone')" prop="phone">
|
||||
<el-input v-model="formData.phone" :placeholder="$t('page.search.placeholderPhoneFuzzy')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="formData.status" placeholder="全部" clearable style="width: 100%">
|
||||
<el-option label="启用" :value="1" />
|
||||
<el-option label="禁用" :value="0" />
|
||||
<el-form-item :label="$t('page.search.status')" prop="status">
|
||||
<el-select v-model="formData.status" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
<el-option :label="$t('table.searchBar.enable')" :value="1" />
|
||||
<el-option :label="$t('table.searchBar.disable')" :value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="平台币" prop="coin">
|
||||
<el-form-item :label="$t('page.search.coin')" prop="coin">
|
||||
<el-input-number
|
||||
v-model="formData.coin"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
placeholder="精确搜索"
|
||||
:placeholder="$t('page.search.exactSearch')"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="彩金池配置" prop="lottery_config_id">
|
||||
<el-form-item :label="$t('page.search.lotteryPoolConfig')" prop="lottery_config_id">
|
||||
<el-select
|
||||
v-model="formData.lottery_config_id"
|
||||
placeholder="全部"
|
||||
:placeholder="$t('page.search.placeholderAll')"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
|
||||
@@ -122,27 +122,28 @@
|
||||
} = useTable({
|
||||
core: {
|
||||
apiFn: api.list,
|
||||
apiParams: { limit: 100 },
|
||||
columnsFactory: () => {
|
||||
const usernameFormatter = (row: Record<string, any>) =>
|
||||
row?.dicePlayer?.username ?? row?.player_id ?? '-'
|
||||
return [
|
||||
// { type: 'selection' },
|
||||
{ prop: 'id', label: 'ID', width: 80, align: 'center' },
|
||||
{ prop: 'id', label: 'page.table.id', width: 80, align: 'center' },
|
||||
{
|
||||
prop: 'player_id',
|
||||
label: '玩家用户名',
|
||||
label: 'page.table.playerUsername',
|
||||
align: 'center',
|
||||
formatter: (row: Record<string, any>) => usernameFormatter(row)
|
||||
},
|
||||
{ prop: 'use_coins', label: '消耗硬币', align: 'center' },
|
||||
{ prop: 'total_ticket_count', label: '总抽奖次数', align: 'center' },
|
||||
{ prop: 'paid_ticket_count', label: '购买抽奖次数', align: 'center' },
|
||||
{ prop: 'free_ticket_count', label: '赠送抽奖次数', align: 'center' },
|
||||
{ prop: 'remark', label: '备注', width: 100, align: 'center', showOverflowTooltip: true },
|
||||
{ prop: 'create_time', label: '创建时间', width: 170, align: 'center' },
|
||||
{ prop: 'use_coins', label: 'page.table.useCoins', align: 'center' },
|
||||
{ prop: 'total_ticket_count', label: 'page.table.totalDrawCount', align: 'center' },
|
||||
{ prop: 'paid_ticket_count', label: 'page.table.paidDrawCount', align: 'center' },
|
||||
{ prop: 'free_ticket_count', label: 'page.table.freeDrawCount', align: 'center' },
|
||||
{ prop: 'remark', label: 'page.table.remark', width: 100, align: 'center', showOverflowTooltip: true },
|
||||
{ prop: 'create_time', label: 'page.table.createTime', width: 170, align: 'center' },
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
label: 'table.actions.operation',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增抽奖券获取记录' : '编辑抽奖券获取记录'"
|
||||
:title="dialogType === 'add' ? $t('page.form.dialogTitleAdd') : $t('page.form.dialogTitleEdit')"
|
||||
width="600px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="玩家" prop="player_id">
|
||||
<el-form-item :label="$t('page.form.player')" prop="player_id">
|
||||
<el-select
|
||||
v-model="formData.player_id"
|
||||
placeholder="请选择玩家(显示用户名)"
|
||||
:placeholder="$t('page.form.placeholderPlayer')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@@ -25,46 +25,46 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="消耗硬币" prop="use_coins">
|
||||
<el-form-item :label="$t('page.form.useCoins')" prop="use_coins">
|
||||
<el-input-number
|
||||
v-model="formData.use_coins"
|
||||
placeholder="请输入消耗硬币"
|
||||
:placeholder="$t('page.form.placeholderUseCoins')"
|
||||
:min="0"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="购买抽奖次数" prop="paid_ticket_count">
|
||||
<el-form-item :label="$t('page.form.paidDrawCount')" prop="paid_ticket_count">
|
||||
<el-input-number
|
||||
v-model="formData.paid_ticket_count"
|
||||
placeholder="请输入购买抽奖次数"
|
||||
:placeholder="$t('page.form.placeholderPaidDrawCount')"
|
||||
:min="0"
|
||||
@change="onTicketCountChange"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="赠送抽奖次数" prop="free_ticket_count">
|
||||
<el-form-item :label="$t('page.form.freeDrawCount')" prop="free_ticket_count">
|
||||
<el-input-number
|
||||
v-model="formData.free_ticket_count"
|
||||
placeholder="请输入赠送抽奖次数"
|
||||
:placeholder="$t('page.form.placeholderFreeDrawCount')"
|
||||
:min="0"
|
||||
@change="onTicketCountChange"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="总抽奖次数" prop="total_ticket_count">
|
||||
<el-form-item :label="$t('page.form.totalDrawCount')" prop="total_ticket_count">
|
||||
<el-input-number
|
||||
:model-value="totalTicketCountComputed"
|
||||
placeholder="自动求和"
|
||||
:placeholder="$t('page.form.placeholderTotalDrawCount')"
|
||||
:min="0"
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-form-item :label="$t('form.labelRemark')" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入备注(必填)"
|
||||
:placeholder="$t('page.form.placeholderRemark')"
|
||||
maxlength="500"
|
||||
show-word-limit
|
||||
style="width: 100%"
|
||||
@@ -73,17 +73,20 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import api from '../../../api/player_ticket_record/index'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
dialogType: string
|
||||
@@ -230,10 +233,10 @@
|
||||
const rest = { ...formData } as Record<string, unknown>
|
||||
delete rest.id
|
||||
await api.save(rest)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,24 +9,24 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="玩家(用户名)" prop="username">
|
||||
<el-input v-model="formData.username" placeholder="按用户名搜索" clearable />
|
||||
<el-form-item :label="$t('page.search.player')" prop="username">
|
||||
<el-input v-model="formData.username" :placeholder="$t('page.search.byUsername')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="消耗硬币" prop="use_coins_min">
|
||||
<el-form-item :label="$t('page.search.useCoins')" prop="use_coins_min">
|
||||
<div class="range-wrap">
|
||||
<el-input-number
|
||||
v-model="formData.use_coins_min"
|
||||
placeholder="最小"
|
||||
:placeholder="$t('table.searchBar.min')"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
/>
|
||||
<span class="range-sep">至</span>
|
||||
<span class="range-sep">{{ $t('table.searchBar.rangeSeparator') }}</span>
|
||||
<el-input-number
|
||||
v-model="formData.use_coins_max"
|
||||
placeholder="最大"
|
||||
:placeholder="$t('table.searchBar.max')"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
@@ -35,19 +35,19 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="总抽奖次数" prop="total_ticket_count_min">
|
||||
<el-form-item :label="$t('page.search.totalDrawCount')" prop="total_ticket_count_min">
|
||||
<div class="range-wrap">
|
||||
<el-input-number
|
||||
v-model="formData.total_ticket_count_min"
|
||||
placeholder="最小"
|
||||
:placeholder="$t('table.searchBar.min')"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
/>
|
||||
<span class="range-sep">至</span>
|
||||
<span class="range-sep">{{ $t('table.searchBar.rangeSeparator') }}</span>
|
||||
<el-input-number
|
||||
v-model="formData.total_ticket_count_max"
|
||||
placeholder="最大"
|
||||
:placeholder="$t('table.searchBar.max')"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
@@ -56,19 +56,19 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="购买抽奖次数" prop="paid_ticket_count_min">
|
||||
<el-form-item :label="$t('page.search.paidDrawCount')" prop="paid_ticket_count_min">
|
||||
<div class="range-wrap">
|
||||
<el-input-number
|
||||
v-model="formData.paid_ticket_count_min"
|
||||
placeholder="最小"
|
||||
:placeholder="$t('table.searchBar.min')"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
/>
|
||||
<span class="range-sep">至</span>
|
||||
<span class="range-sep">{{ $t('table.searchBar.rangeSeparator') }}</span>
|
||||
<el-input-number
|
||||
v-model="formData.paid_ticket_count_max"
|
||||
placeholder="最大"
|
||||
:placeholder="$t('table.searchBar.max')"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
@@ -77,19 +77,19 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="赠送抽奖次数" prop="free_ticket_count_min">
|
||||
<el-form-item :label="$t('page.search.freeDrawCount')" prop="free_ticket_count_min">
|
||||
<div class="range-wrap">
|
||||
<el-input-number
|
||||
v-model="formData.free_ticket_count_min"
|
||||
placeholder="最小"
|
||||
:placeholder="$t('table.searchBar.min')"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
/>
|
||||
<span class="range-sep">至</span>
|
||||
<span class="range-sep">{{ $t('table.searchBar.rangeSeparator') }}</span>
|
||||
<el-input-number
|
||||
v-model="formData.free_ticket_count_max"
|
||||
placeholder="最大"
|
||||
:placeholder="$t('table.searchBar.max')"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
@@ -98,13 +98,13 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(8)">
|
||||
<el-form-item label="创建时间" prop="create_time_min">
|
||||
<el-form-item :label="$t('page.search.createTime')" prop="create_time_min">
|
||||
<el-date-picker
|
||||
v-model="formData.create_time"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
:range-separator="$t('table.searchBar.rangeSeparator')"
|
||||
:start-placeholder="$t('table.searchBar.startTime')"
|
||||
:end-placeholder="$t('table.searchBar.endTime')"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useTable } from '@/hooks/core/useTable'
|
||||
import { useSaiAdmin } from '@/composables/useSaiAdmin'
|
||||
import api from '../../api/player_wallet_record/index'
|
||||
@@ -108,15 +109,16 @@
|
||||
getData()
|
||||
}
|
||||
|
||||
const { t } = useI18n()
|
||||
// 类型展示:0=充值 1=提现 2=购买抽奖次数 3=管理员加点 4=管理员扣点 5=抽奖
|
||||
const typeFormatter = (row: Record<string, unknown>) => {
|
||||
const t = row.type
|
||||
if (t === 0) return '充值'
|
||||
if (t === 1) return '提现'
|
||||
if (t === 2) return '购买抽奖次数'
|
||||
if (t === 3) return '管理员加点'
|
||||
if (t === 4) return '管理员扣点'
|
||||
if (t === 5) return '抽奖'
|
||||
const ty = row.type
|
||||
if (ty === 0) return t('page.search.typeRecharge')
|
||||
if (ty === 1) return t('page.search.typeWithdraw')
|
||||
if (ty === 2) return t('page.search.typeBuyTicket')
|
||||
if (ty === 3) return t('page.search.typeAdminAdd')
|
||||
if (ty === 4) return t('page.search.typeAdminSub')
|
||||
if (ty === 5) return t('page.table.typeDraw')
|
||||
return '-'
|
||||
}
|
||||
|
||||
@@ -161,20 +163,21 @@
|
||||
} = useTable({
|
||||
core: {
|
||||
apiFn: api.list,
|
||||
apiParams: { limit: 100 },
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection', align: 'center' },
|
||||
{ prop: 'id', label: 'ID', width: 80, align: 'center' },
|
||||
{ prop: 'id', label: 'page.table.id', width: 80, align: 'center' },
|
||||
{
|
||||
prop: 'player_id',
|
||||
label: '用户',
|
||||
label: 'page.table.user',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
formatter: usernameFormatter
|
||||
},
|
||||
{ prop: 'coin', label: '平台币变化', width: 110, align: 'center' },
|
||||
{ prop: 'coin', label: 'page.table.coinChange', width: 110, align: 'center' },
|
||||
{
|
||||
prop: 'type',
|
||||
label: '类型',
|
||||
label: 'page.table.type',
|
||||
width: 140,
|
||||
align: 'center',
|
||||
useSlot: true,
|
||||
@@ -182,27 +185,27 @@
|
||||
},
|
||||
{
|
||||
prop: 'user_id',
|
||||
label: '操作人',
|
||||
label: 'page.table.operator',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
formatter: operatorFormatter
|
||||
},
|
||||
{ prop: 'wallet_before', label: '钱包操作前', width: 110, align: 'center' },
|
||||
{ prop: 'wallet_after', label: '钱包操作后', width: 110, align: 'center' },
|
||||
{ prop: 'wallet_before', label: 'page.table.walletBefore', width: 110, align: 'center' },
|
||||
{ prop: 'wallet_after', label: 'page.table.walletAfter', width: 110, align: 'center' },
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
label: 'page.table.remark',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{ prop: 'total_ticket_count', label: '总抽奖次数', align: 'center' },
|
||||
{ prop: 'paid_ticket_count', label: '购买抽奖次数', align: 'center' },
|
||||
{ prop: 'free_ticket_count', label: '赠送抽奖次数', align: 'center' },
|
||||
{ prop: 'create_time', label: '创建时间', width: 170, align: 'center' },
|
||||
{ prop: 'total_ticket_count', label: 'page.table.totalDrawCount', align: 'center' },
|
||||
{ prop: 'paid_ticket_count', label: 'page.table.paidDrawCount', align: 'center' },
|
||||
{ prop: 'free_ticket_count', label: 'page.table.freeDrawCount', align: 'center' },
|
||||
{ prop: 'create_time', label: 'page.table.createTime', width: 170, align: 'center' },
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
label: 'table.actions.operation',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增玩家钱包流水' : '编辑玩家钱包流水'"
|
||||
:title="dialogType === 'add' ? $t('page.form.dialogTitleAdd') : $t('page.form.dialogTitleEdit')"
|
||||
width="600px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="用户" prop="player_id">
|
||||
<el-form-item :label="$t('page.form.user')" prop="player_id">
|
||||
<el-select
|
||||
v-model="formData.player_id"
|
||||
placeholder="请选择用户(显示用户名)"
|
||||
:placeholder="$t('page.form.placeholderUser')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@@ -26,55 +26,55 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-form-item :label="$t('page.form.type')" prop="type">
|
||||
<el-select
|
||||
v-model="formData.type"
|
||||
placeholder="请选择类型"
|
||||
:placeholder="$t('page.form.placeholderType')"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
:disabled="dialogType === 'edit'"
|
||||
>
|
||||
<el-option label="充值" :value="0" />
|
||||
<el-option label="提现" :value="1" />
|
||||
<el-option label="购买抽奖次数" :value="2" />
|
||||
<el-option label="管理员加点" :value="3" />
|
||||
<el-option label="管理员扣点" :value="4" />
|
||||
<el-option :label="$t('page.form.typeRecharge')" :value="0" />
|
||||
<el-option :label="$t('page.form.typeWithdraw')" :value="1" />
|
||||
<el-option :label="$t('page.form.typeBuyTicket')" :value="2" />
|
||||
<el-option :label="$t('page.form.typeAdminAdd')" :value="3" />
|
||||
<el-option :label="$t('page.form.typeAdminSub')" :value="4" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="平台币变化" prop="coin">
|
||||
<el-form-item :label="$t('page.form.coinChange')" prop="coin">
|
||||
<el-input-number
|
||||
v-model="formData.coin"
|
||||
placeholder="正数增加、负数减少"
|
||||
:placeholder="$t('page.form.placeholderCoinChange')"
|
||||
:precision="2"
|
||||
style="width: 100%"
|
||||
@change="onCoinChange"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="钱包操作前" prop="wallet_before">
|
||||
<el-form-item :label="$t('page.form.walletBefore')" prop="wallet_before">
|
||||
<el-input-number
|
||||
v-model="formData.wallet_before"
|
||||
placeholder="选择用户后自动带出当前平台币"
|
||||
:placeholder="$t('page.form.placeholderWalletBefore')"
|
||||
:precision="2"
|
||||
disabled
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="钱包操作后" prop="wallet_after">
|
||||
<el-form-item :label="$t('page.form.walletAfter')" prop="wallet_after">
|
||||
<el-input-number
|
||||
v-model="formData.wallet_after"
|
||||
placeholder="根据平台币变化自动计算"
|
||||
:placeholder="$t('page.form.placeholderWalletAfter')"
|
||||
:precision="2"
|
||||
disabled
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-form-item :label="$t('form.labelRemark')" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
placeholder="选填"
|
||||
:placeholder="$t('page.form.placeholderRemark')"
|
||||
maxlength="500"
|
||||
show-word-limit
|
||||
:disabled="dialogType === 'edit'"
|
||||
@@ -82,17 +82,20 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import api from '../../../api/player_wallet_record/index'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
dialogType: string
|
||||
@@ -225,10 +228,10 @@
|
||||
const payload = { ...formData }
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(payload)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(payload)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,35 +9,35 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(5)">
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select v-model="formData.type" placeholder="全部" clearable style="width: 100%">
|
||||
<el-option label="充值" :value="0" />
|
||||
<el-option label="提现" :value="1" />
|
||||
<el-option label="购买抽奖次数" :value="2" />
|
||||
<el-option label="管理员加点" :value="3" />
|
||||
<el-option label="管理员扣点" :value="4" />
|
||||
<el-form-item :label="$t('page.search.type')" prop="type">
|
||||
<el-select v-model="formData.type" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
<el-option :label="$t('page.search.typeRecharge')" :value="0" />
|
||||
<el-option :label="$t('page.search.typeWithdraw')" :value="1" />
|
||||
<el-option :label="$t('page.search.typeBuyTicket')" :value="2" />
|
||||
<el-option :label="$t('page.search.typeAdminAdd')" :value="3" />
|
||||
<el-option :label="$t('page.search.typeAdminSub')" :value="4" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(5)">
|
||||
<el-form-item label="用户(用户名)" prop="username">
|
||||
<el-input v-model="formData.username" placeholder="按用户名搜索" clearable />
|
||||
<el-form-item :label="$t('page.search.user')" prop="username">
|
||||
<el-input v-model="formData.username" :placeholder="$t('page.search.byUsername')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(8)">
|
||||
<el-form-item label="平台币" prop="coin_min">
|
||||
<el-form-item :label="$t('page.search.coin')" prop="coin_min">
|
||||
<div class="coin-range-wrap">
|
||||
<el-input-number
|
||||
v-model="formData.coin_min"
|
||||
placeholder="最小"
|
||||
:placeholder="$t('table.searchBar.min')"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
class="coin-range-input"
|
||||
/>
|
||||
<span class="coin-range-sep">至</span>
|
||||
<span class="coin-range-sep">{{ $t('table.searchBar.rangeSeparator') }}</span>
|
||||
<el-input-number
|
||||
v-model="formData.coin_max"
|
||||
placeholder="最大"
|
||||
:placeholder="$t('table.searchBar.max')"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
class="coin-range-input"
|
||||
@@ -46,13 +46,13 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(8)">
|
||||
<el-form-item label="创建时间" prop="create_time">
|
||||
<el-form-item :label="$t('page.search.createTime')" prop="create_time">
|
||||
<el-date-picker
|
||||
v-model="formData.create_time"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
:range-separator="$t('table.searchBar.rangeSeparator')"
|
||||
:start-placeholder="$t('table.searchBar.startTime')"
|
||||
:end-placeholder="$t('table.searchBar.endTime')"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
style="width: 100%"
|
||||
/>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<!-- 方向切换 + 搜索 -->
|
||||
<div class="direction-bar">
|
||||
<el-radio-group v-model="currentDirection" size="default" @change="onDirectionChange">
|
||||
<el-radio-button :value="0">顺时针</el-radio-button>
|
||||
<el-radio-button :value="1">逆时针</el-radio-button>
|
||||
<el-radio-button :value="0">{{ $t('page.search.clockwise') }}</el-radio-button>
|
||||
<el-radio-button :value="1">{{ $t('page.search.anticlockwise') }}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<TableSearch v-model="searchForm" @search="handleSearch" @reset="resetSearchParams" />
|
||||
@@ -14,19 +14,19 @@
|
||||
<template #left>
|
||||
<ElSpace wrap>
|
||||
<ElButton
|
||||
v-permission="'dice:reward:index:update'"
|
||||
v-permission="'dice:reward:index:batchUpdateWeights'"
|
||||
type="primary"
|
||||
@click="weightRatioVisible = true"
|
||||
v-ripple
|
||||
>
|
||||
权重配比
|
||||
{{ $t('page.toolbar.weightRatio') }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-permission="'dice:reward:index:index'"
|
||||
v-permission="'dice:reward:index:startWeightTest'"
|
||||
@click="weightTestVisible = true"
|
||||
v-ripple
|
||||
>
|
||||
一键测试权重
|
||||
{{ $t('page.toolbar.weightTest') }}
|
||||
</ElButton>
|
||||
</ElSpace>
|
||||
</template>
|
||||
@@ -99,12 +99,12 @@
|
||||
apiFn: listApi,
|
||||
apiParams: { direction: 0, limit: 100 },
|
||||
columnsFactory: () => [
|
||||
{ prop: 'start_index', label: '起始索引', width: 100, align: 'center' },
|
||||
{ prop: 'end_index', label: '结束索引(end_index)', width: 110, align: 'center' },
|
||||
{ prop: 'tier', label: '档位', width: 90, align: 'center', sortable: true },
|
||||
{ prop: 'start_index', label: 'page.table.startIndex', width: 100, align: 'center' },
|
||||
{ prop: 'end_index', label: 'page.table.endIndex', width: 110, align: 'center' },
|
||||
{ prop: 'tier', label: 'page.table.tier', width: 90, align: 'center', sortable: true },
|
||||
{
|
||||
prop: 'grid_number',
|
||||
label: '色子点数(摇取5-30)',
|
||||
label: 'page.table.dicePoints',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
sortable: true,
|
||||
@@ -112,14 +112,14 @@
|
||||
},
|
||||
{
|
||||
prop: 'ui_text',
|
||||
label: '显示文本',
|
||||
label: 'page.table.displayText',
|
||||
minWidth: 100,
|
||||
align: 'center',
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{ prop: 'real_ev', label: '实际中奖金额', width: 110, align: 'center' },
|
||||
{ prop: 'remark', label: '备注', minWidth: 80, align: 'center', showOverflowTooltip: true },
|
||||
{ prop: 'weight', label: '权重(1-10000)', width: 110, align: 'center' }
|
||||
{ prop: 'real_ev', label: 'page.table.realEv', width: 110, align: 'center' },
|
||||
{ prop: 'remark', label: 'page.table.remark', minWidth: 80, align: 'center', showOverflowTooltip: true },
|
||||
{ prop: 'weight', label: 'page.table.weight', width: 110, align: 'center' }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
@search="handleSearch"
|
||||
>
|
||||
<el-col v-bind="setSpan(8)">
|
||||
<el-form-item label="档位" prop="tier">
|
||||
<el-select v-model="formData.tier" placeholder="全部" clearable style="width: 100%">
|
||||
<el-form-item :label="$t('page.search.tier')" prop="tier">
|
||||
<el-select v-model="formData.tier" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
<el-option label="T1" value="T1" />
|
||||
<el-option label="T2" value="T2" />
|
||||
<el-option label="T3" value="T3" />
|
||||
<el-option label="T4" value="T4" />
|
||||
<el-option label="T5" value="T5" />
|
||||
<el-option label="BIGWIN" value="BIGWIN" />
|
||||
<el-option :label="$t('page.search.optionBigwin')" value="BIGWIN" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
@@ -1,32 +1,30 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="奖励对照表(dice_reward)权重配比"
|
||||
:title="$t('page.weightEdit.title')"
|
||||
width="900px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<div class="global-tip">
|
||||
编辑的是<strong>奖励对照表(dice_reward / DiceReward 模型)</strong
|
||||
>的权重,按<strong>结束索引(end_index)</strong>区分
|
||||
<strong>顺时针</strong>与<strong>逆时针</strong>两套权重;抽奖时按当前方向取对应权重。
|
||||
{{ $t('page.weightEdit.globalTip') }}
|
||||
</div>
|
||||
<div v-loading="loading" class="dialog-body">
|
||||
<el-tabs v-model="activeTier" type="card">
|
||||
<el-tab-pane v-for="t in tierKeys" :key="t" :label="t" :name="t">
|
||||
<div v-if="getTierItems(t).length === 0" class="empty-tip">该档位暂无配置数据</div>
|
||||
<div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightShared.emptyTier') }}</div>
|
||||
<template v-else>
|
||||
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
|
||||
<div class="chart-row">
|
||||
<ArtBarChart
|
||||
x-axis-name="结束索引"
|
||||
:x-axis-name="$t('page.weightShared.xAxisEndIndex')"
|
||||
:x-axis-data="getTierChartLabels(t)"
|
||||
:data="getTierChartData(t, 'clockwise')"
|
||||
height="180px"
|
||||
/>
|
||||
<ArtBarChart
|
||||
x-axis-name="结束索引"
|
||||
:x-axis-name="$t('page.weightShared.xAxisEndIndex')"
|
||||
:x-axis-data="getTierChartLabels(t)"
|
||||
:data="getTierChartData(t, 'counterclockwise')"
|
||||
height="180px"
|
||||
@@ -34,42 +32,50 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
|
||||
当前档位权重合计(顺时针):<strong>{{ getTierSum(t, 'clockwise') }}</strong>
|
||||
;逆时针:<strong>{{ getTierSum(t, 'counterclockwise') }}</strong>
|
||||
(各条 1-10000,和不限制)
|
||||
{{
|
||||
$t('page.weightShared.sumLineDual', {
|
||||
cw: getTierSum(t, 'clockwise'),
|
||||
ccw: getTierSum(t, 'counterclockwise')
|
||||
})
|
||||
}}
|
||||
</div>
|
||||
<div class="weight-sum weight-sum-t4t5" v-else>T4、T5 仅单一结果,无需配置权重。</div>
|
||||
<div class="weight-sum weight-sum-t4t5" v-else>{{ $t('page.weightShared.t4t5NoteSingle') }}</div>
|
||||
<el-table :data="getTierItems(t)" border size="small" class="weight-table">
|
||||
<el-table-column
|
||||
label="结束索引(id)"
|
||||
:label="$t('page.weightShared.colEndIndexId')"
|
||||
prop="id"
|
||||
width="90"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="色子点数" prop="grid_number" width="80" align="center" />
|
||||
<el-table-column
|
||||
label="实际中奖金额"
|
||||
:label="$t('page.weightShared.colDicePoints')"
|
||||
prop="grid_number"
|
||||
width="80"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
:label="$t('page.weightShared.colRealEv')"
|
||||
prop="real_ev"
|
||||
width="90"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="显示文本"
|
||||
:label="$t('page.weightShared.colUiText')"
|
||||
prop="ui_text"
|
||||
min-width="70"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="备注"
|
||||
:label="$t('page.weightShared.colRemark')"
|
||||
prop="remark"
|
||||
min-width="70"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="顺时针权重(direction=0)" min-width="160" align="center">
|
||||
<el-table-column :label="$t('page.weightShared.colWeightCwDir')" min-width="160" align="center">
|
||||
<template #default="{ row }">
|
||||
<div class="weight-cell-vertical">
|
||||
<div class="weight-slider-wrap">
|
||||
@@ -146,7 +152,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="逆时针权重(direction=1)" min-width="160" align="center">
|
||||
<el-table-column :label="$t('page.weightShared.colWeightCcwDir')" min-width="160" align="center">
|
||||
<template #default="{ row }">
|
||||
<div class="weight-cell-vertical">
|
||||
<div class="weight-slider-wrap">
|
||||
@@ -232,8 +238,10 @@
|
||||
</el-tabs>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('page.weightShared.btnCancel') }}</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSubmit">{{
|
||||
$t('page.weightShared.btnSubmit')
|
||||
}}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -242,6 +250,9 @@
|
||||
import api from '../../../api/reward/index'
|
||||
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
|
||||
/** 供模板 v-for 使用 */
|
||||
@@ -430,7 +441,7 @@
|
||||
grouped.value = parsePayload(res)
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage.error('获取权重数据失败')
|
||||
ElMessage.error(t('page.weightShared.fetchFail'))
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
@@ -456,19 +467,19 @@
|
||||
function handleSubmit() {
|
||||
const items = collectItems()
|
||||
if (items.length === 0) {
|
||||
ElMessage.info('没有可提交的配置')
|
||||
ElMessage.info(t('page.weightShared.nothingToSubmit'))
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
api
|
||||
.batchUpdateWeights(items)
|
||||
.then(() => {
|
||||
ElMessage.success('保存成功')
|
||||
ElMessage.success(t('page.weightShared.saveSuccess'))
|
||||
emit('success')
|
||||
handleClose()
|
||||
})
|
||||
.catch((e: { message?: string }) => {
|
||||
ElMessage.error(e?.message ?? '保存失败')
|
||||
ElMessage.error(e?.message ?? t('page.weightShared.submitFail'))
|
||||
})
|
||||
.finally(() => {
|
||||
submitting.value = false
|
||||
|
||||
@@ -1,78 +1,76 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="权重配比"
|
||||
:title="$t('page.weightRatio.title')"
|
||||
width="900px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<div class="global-tip">
|
||||
配置<strong>奖励对照表(dice_reward)</strong>的权重,一级按<strong>方向</strong>(顺时针/逆时针),二级按<strong>档位</strong>(T1-T5);各条权重
|
||||
1-10000,档位内按权重比抽取。
|
||||
{{ $t('page.weightRatio.globalTip') }}
|
||||
</div>
|
||||
<div v-loading="loading" class="dialog-body">
|
||||
<!-- 一级:方向(懒加载避免逆时针柱状图在隐藏容器内初始化导致不显示);二级档位 -->
|
||||
<el-tabs v-model="activeDirection" type="card" class="direction-tabs" :lazy="true">
|
||||
<el-tab-pane label="顺时针" name="0">
|
||||
<el-tab-pane :label="$t('page.weightRatio.tabClockwise')" name="0">
|
||||
<el-tabs v-model="activeTier" type="card" class="tier-tabs">
|
||||
<el-tab-pane v-for="t in tierKeys" :key="'cw-' + t" :label="t" :name="t">
|
||||
<div v-if="getTierItems(t).length === 0" class="empty-tip">该档位暂无配置数据</div>
|
||||
<div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightShared.emptyTier') }}</div>
|
||||
<template v-else>
|
||||
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
|
||||
<ArtBarChart
|
||||
:key="'cw-' + activeDirection + '-' + t"
|
||||
x-axis-name="点数"
|
||||
:x-axis-name="$t('page.weightShared.xAxisGridNumber')"
|
||||
:x-axis-data="getTierChartLabels(t)"
|
||||
:data="getTierChartDataForCurrentDirection(t)"
|
||||
height="180px"
|
||||
/>
|
||||
</div>
|
||||
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
|
||||
当前档位权重合计:<strong>{{ getTierSumForCurrentDirection(t) }}</strong>
|
||||
(各条 1-10000,档位内按权重比抽取,和不限制)
|
||||
{{
|
||||
$t('page.weightShared.sumLineSingle', { sum: getTierSumForCurrentDirection(t) })
|
||||
}}
|
||||
</div>
|
||||
<div class="weight-sum weight-sum-t4t5" v-else
|
||||
>T4、T5 仅单一结果,无需配置权重。</div
|
||||
>
|
||||
<div class="weight-sum weight-sum-t4t5" v-else>{{ $t('page.weightShared.t4t5NoteSingle') }}</div>
|
||||
<el-table :data="getTierItems(t)" border size="small" class="weight-table">
|
||||
<el-table-column
|
||||
label="点数(grid_number)"
|
||||
:label="$t('page.weightShared.colGridNumber')"
|
||||
prop="grid_number"
|
||||
width="110"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="结束索引(id)"
|
||||
:label="$t('page.weightShared.colEndIndexId')"
|
||||
prop="id"
|
||||
width="90"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="实际中奖金额"
|
||||
:label="$t('page.weightShared.colRealEv')"
|
||||
prop="real_ev"
|
||||
width="90"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="显示文本"
|
||||
:label="$t('page.weightShared.colUiText')"
|
||||
prop="ui_text"
|
||||
min-width="70"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="备注"
|
||||
:label="$t('page.weightShared.colRemark')"
|
||||
prop="remark"
|
||||
min-width="70"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
:label="currentDirectionLabel + ' 权重(1-10000)'"
|
||||
:label="currentWeightColumnLabel"
|
||||
min-width="200"
|
||||
align="center"
|
||||
>
|
||||
@@ -156,65 +154,64 @@
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="逆时针" name="1">
|
||||
<el-tab-pane :label="$t('page.weightRatio.tabCounterclockwise')" name="1">
|
||||
<el-tabs v-model="activeTier" type="card" class="tier-tabs">
|
||||
<el-tab-pane v-for="t in tierKeys" :key="'ccw-' + t" :label="t" :name="t">
|
||||
<div v-if="getTierItems(t).length === 0" class="empty-tip">该档位暂无配置数据</div>
|
||||
<div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightShared.emptyTier') }}</div>
|
||||
<template v-else>
|
||||
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
|
||||
<ArtBarChart
|
||||
:key="'ccw-' + activeDirection + '-' + t"
|
||||
x-axis-name="点数"
|
||||
:x-axis-name="$t('page.weightShared.xAxisGridNumber')"
|
||||
:x-axis-data="getTierChartLabels(t)"
|
||||
:data="getTierChartDataForCurrentDirection(t)"
|
||||
height="180px"
|
||||
/>
|
||||
</div>
|
||||
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
|
||||
当前档位权重合计:<strong>{{ getTierSumForCurrentDirection(t) }}</strong>
|
||||
(各条 1-10000,档位内按权重比抽取,和不限制)
|
||||
{{
|
||||
$t('page.weightShared.sumLineSingle', { sum: getTierSumForCurrentDirection(t) })
|
||||
}}
|
||||
</div>
|
||||
<div class="weight-sum weight-sum-t4t5" v-else
|
||||
>T4、T5 仅单一结果,无需配置权重。</div
|
||||
>
|
||||
<div class="weight-sum weight-sum-t4t5" v-else>{{ $t('page.weightShared.t4t5NoteSingle') }}</div>
|
||||
<el-table :data="getTierItems(t)" border size="small" class="weight-table">
|
||||
<el-table-column
|
||||
label="点数(grid_number)"
|
||||
:label="$t('page.weightShared.colGridNumber')"
|
||||
prop="grid_number"
|
||||
width="110"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="结束索引(id)"
|
||||
:label="$t('page.weightShared.colEndIndexId')"
|
||||
prop="id"
|
||||
width="90"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="实际中奖金额"
|
||||
:label="$t('page.weightShared.colRealEv')"
|
||||
prop="real_ev"
|
||||
width="90"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="显示文本"
|
||||
:label="$t('page.weightShared.colUiText')"
|
||||
prop="ui_text"
|
||||
min-width="70"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="备注"
|
||||
:label="$t('page.weightShared.colRemark')"
|
||||
prop="remark"
|
||||
min-width="70"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
:label="currentDirectionLabel + ' 权重(1-10000)'"
|
||||
:label="currentWeightColumnLabel"
|
||||
min-width="200"
|
||||
align="center"
|
||||
>
|
||||
@@ -301,8 +298,14 @@
|
||||
</el-tabs>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('page.weightShared.btnCancel') }}</el-button>
|
||||
<el-button
|
||||
v-permission="'dice:reward:index:batchUpdateWeights'"
|
||||
type="primary"
|
||||
:loading="submitting"
|
||||
@click="handleSubmit"
|
||||
>{{ $t('page.weightShared.btnSubmit') }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -311,6 +314,9 @@
|
||||
import api from '../../../api/reward/index'
|
||||
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
|
||||
const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
|
||||
type DirectionKey = 'clockwise' | 'counterclockwise'
|
||||
@@ -361,9 +367,14 @@
|
||||
T5: { '0': [], '1': [] }
|
||||
})
|
||||
|
||||
const currentDirectionLabel = computed(() =>
|
||||
activeDirection.value === '0' ? '顺时针' : '逆时针'
|
||||
)
|
||||
const currentWeightColumnLabel = computed(() => {
|
||||
locale.value
|
||||
const dirLabel =
|
||||
activeDirection.value === '0'
|
||||
? t('page.weightRatio.tabClockwise')
|
||||
: t('page.weightRatio.tabCounterclockwise')
|
||||
return `${dirLabel} ${t('page.weightShared.weightColSuffix')}`
|
||||
})
|
||||
|
||||
const tierKeys = TIER_KEYS
|
||||
|
||||
@@ -465,7 +476,7 @@
|
||||
grouped.value = parsePayload(res)
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage.error('获取权重数据失败')
|
||||
ElMessage.error(t('page.weightShared.fetchFail'))
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
@@ -494,19 +505,19 @@
|
||||
function handleSubmit() {
|
||||
const items = collectItems()
|
||||
if (items.length === 0) {
|
||||
ElMessage.info('没有可提交的配置')
|
||||
ElMessage.info(t('page.weightShared.nothingToSubmit'))
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
api
|
||||
.batchUpdateWeights(items)
|
||||
.then(() => {
|
||||
ElMessage.success('保存成功')
|
||||
ElMessage.success(t('page.weightShared.saveSuccess'))
|
||||
emit('success')
|
||||
handleClose()
|
||||
})
|
||||
.catch((e: { message?: string }) => {
|
||||
ElMessage.error(e?.message ?? '保存失败')
|
||||
ElMessage.error(e?.message ?? t('page.weightShared.submitFail'))
|
||||
})
|
||||
.finally(() => {
|
||||
submitting.value = false
|
||||
|
||||
@@ -1,24 +1,31 @@
|
||||
<template>
|
||||
<ElDialog
|
||||
v-model="visible"
|
||||
title="一键测试权重"
|
||||
:title="$t('page.weightTest.title')"
|
||||
width="560px"
|
||||
:close-on-click-modal="false"
|
||||
destroy-on-close
|
||||
@close="onClose"
|
||||
>
|
||||
<ElAlert type="info" :closable="false" show-icon class="weight-test-tip">
|
||||
<template #title>{{ $t('page.weightTest.alertTitle') }}</template>
|
||||
{{ $t('page.weightTest.alertBody') }}
|
||||
</ElAlert>
|
||||
<ElForm ref="formRef" :model="form" label-width="140px">
|
||||
<ElSteps :active="currentStep" finish-status="success" simple class="steps-wrap">
|
||||
<ElStep title="付费抽奖券" />
|
||||
<ElStep title="免费抽奖券" />
|
||||
<ElStep :title="$t('page.weightTest.stepPaid')" />
|
||||
<ElStep :title="$t('page.weightTest.stepFree')" />
|
||||
</ElSteps>
|
||||
|
||||
<!-- 第一页:付费抽奖券 -->
|
||||
<div v-show="currentStep === 0" class="step-panel">
|
||||
<ElFormItem label="测试数据档位类型" prop="paid_lottery_config_id">
|
||||
<ElFormItem
|
||||
:label="$t('page.weightTest.labelLotteryTypePaid')"
|
||||
prop="paid_lottery_config_id"
|
||||
>
|
||||
<ElSelect
|
||||
v-model="form.paid_lottery_config_id"
|
||||
placeholder="不选则下方自定义档位概率(默认 type=0)"
|
||||
:placeholder="$t('page.weightTest.placeholderPaidPool')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@@ -32,11 +39,13 @@
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<template v-if="form.paid_lottery_config_id == null">
|
||||
<div class="tier-label">自定义档位概率(T1~T5),每档 0-100%,五档之和不能超过 100%</div>
|
||||
<div class="tier-label">{{ $t('page.weightTest.tierProbHint') }}</div>
|
||||
<ElRow :gutter="12" class="tier-row">
|
||||
<ElCol v-for="t in tierKeys" :key="'paid-' + t" :span="8">
|
||||
<div class="tier-field">
|
||||
<label class="tier-field-label">档位 {{ t }}(%)</label>
|
||||
<label class="tier-field-label">{{
|
||||
$t('page.weightTest.tierFieldLabel', { tier: t })
|
||||
}}</label>
|
||||
<input
|
||||
type="number"
|
||||
:value="getPaidTier(t)"
|
||||
@@ -49,17 +58,25 @@
|
||||
</div>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
<div v-if="paidTierSum > 100" class="tier-error"
|
||||
>当前五档之和为 {{ paidTierSum }}%,不能超过 100%</div
|
||||
>
|
||||
<div v-if="paidTierSum > 100" class="tier-error">{{
|
||||
$t('page.weightTest.tierSumError', { sum: paidTierSum })
|
||||
}}</div>
|
||||
</template>
|
||||
<ElFormItem label="顺时针次数" prop="paid_s_count" required>
|
||||
<ElSelect v-model="form.paid_s_count" placeholder="请选择" style="width: 100%">
|
||||
<ElFormItem :label="$t('page.weightTest.labelCwCount')" prop="paid_s_count" required>
|
||||
<ElSelect
|
||||
v-model="form.paid_s_count"
|
||||
:placeholder="$t('page.weightTest.placeholderSelect')"
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="逆时针次数" prop="paid_n_count" required>
|
||||
<ElSelect v-model="form.paid_n_count" placeholder="请选择" style="width: 100%">
|
||||
<ElFormItem :label="$t('page.weightTest.labelCcwCount')" prop="paid_n_count" required>
|
||||
<ElSelect
|
||||
v-model="form.paid_n_count"
|
||||
:placeholder="$t('page.weightTest.placeholderSelect')"
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
@@ -67,10 +84,13 @@
|
||||
|
||||
<!-- 第二页:免费抽奖券 -->
|
||||
<div v-show="currentStep === 1" class="step-panel">
|
||||
<ElFormItem label="测试数据档位类型" prop="free_lottery_config_id">
|
||||
<ElFormItem
|
||||
:label="$t('page.weightTest.labelLotteryTypeFree')"
|
||||
prop="free_lottery_config_id"
|
||||
>
|
||||
<ElSelect
|
||||
v-model="form.free_lottery_config_id"
|
||||
placeholder="不选则下方自定义档位概率(默认 type=1)"
|
||||
:placeholder="$t('page.weightTest.placeholderFreePool')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@@ -84,11 +104,13 @@
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<template v-if="form.free_lottery_config_id == null">
|
||||
<div class="tier-label">自定义档位概率(T1~T5),每档 0-100%,五档之和不能超过 100%</div>
|
||||
<div class="tier-label">{{ $t('page.weightTest.tierProbHint') }}</div>
|
||||
<ElRow :gutter="12" class="tier-row">
|
||||
<ElCol v-for="t in tierKeys" :key="'free-' + t" :span="8">
|
||||
<div class="tier-field">
|
||||
<label class="tier-field-label">档位 {{ t }}(%)</label>
|
||||
<label class="tier-field-label">{{
|
||||
$t('page.weightTest.tierFieldLabel', { tier: t })
|
||||
}}</label>
|
||||
<input
|
||||
type="number"
|
||||
:value="getFreeTier(t)"
|
||||
@@ -101,17 +123,25 @@
|
||||
</div>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
<div v-if="freeTierSum > 100" class="tier-error"
|
||||
>当前五档之和为 {{ freeTierSum }}%,不能超过 100%</div
|
||||
>
|
||||
<div v-if="freeTierSum > 100" class="tier-error">{{
|
||||
$t('page.weightTest.tierSumError', { sum: freeTierSum })
|
||||
}}</div>
|
||||
</template>
|
||||
<ElFormItem label="顺时针次数" prop="free_s_count" required>
|
||||
<ElSelect v-model="form.free_s_count" placeholder="请选择" style="width: 100%">
|
||||
<ElFormItem :label="$t('page.weightTest.labelCwCount')" prop="free_s_count" required>
|
||||
<ElSelect
|
||||
v-model="form.free_s_count"
|
||||
:placeholder="$t('page.weightTest.placeholderSelect')"
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="逆时针次数" prop="free_n_count" required>
|
||||
<ElSelect v-model="form.free_n_count" placeholder="请选择" style="width: 100%">
|
||||
<ElFormItem :label="$t('page.weightTest.labelCcwCount')" prop="free_n_count" required>
|
||||
<ElSelect
|
||||
v-model="form.free_n_count"
|
||||
:placeholder="$t('page.weightTest.placeholderSelect')"
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
@@ -119,14 +149,23 @@
|
||||
</ElForm>
|
||||
|
||||
<template #footer>
|
||||
<ElButton v-if="currentStep > 0" :disabled="running" @click="currentStep--">上一步</ElButton>
|
||||
<ElButton v-if="currentStep < 1" type="primary" :disabled="running" @click="currentStep++"
|
||||
>下一步</ElButton
|
||||
<ElButton v-if="currentStep > 0" :disabled="running" @click="currentStep--">{{
|
||||
$t('page.weightTest.btnPrev')
|
||||
}}</ElButton>
|
||||
<ElButton v-if="currentStep < 1" type="primary" :disabled="running" @click="currentStep++">{{
|
||||
$t('page.weightTest.btnNext')
|
||||
}}</ElButton>
|
||||
<ElButton
|
||||
v-if="currentStep === 1"
|
||||
v-permission="'dice:reward:index:startWeightTest'"
|
||||
type="primary"
|
||||
:loading="running"
|
||||
@click="handleStart"
|
||||
>{{ $t('page.weightTest.btnStart') }}</ElButton
|
||||
>
|
||||
<ElButton v-if="currentStep === 1" type="primary" :loading="running" @click="handleStart"
|
||||
>开始测试</ElButton
|
||||
>
|
||||
<ElButton :disabled="running" @click="visible = false">取消</ElButton>
|
||||
<ElButton :disabled="running" @click="visible = false">{{
|
||||
$t('page.weightTest.btnCancel')
|
||||
}}</ElButton>
|
||||
</template>
|
||||
</ElDialog>
|
||||
</template>
|
||||
@@ -134,6 +173,10 @@
|
||||
<script setup lang="ts">
|
||||
import api from '../../../api/reward/index'
|
||||
import lotteryPoolApi from '../../../api/lottery_pool_config/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const countOptions = [0, 100, 500, 1000, 5000]
|
||||
const tierKeys = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
|
||||
@@ -153,22 +196,15 @@
|
||||
free_s_count: 100,
|
||||
free_n_count: 100
|
||||
})
|
||||
const lotteryOptions = ref<Array<{ id: number; name: string; type: number }>>([])
|
||||
/** 将 type 转为数字(接口可能返回字符串 "0"/"1") */
|
||||
function tierTypeNum(r: { type?: number | string }): number {
|
||||
const t = r.type ?? 0
|
||||
return typeof t === 'number' ? t : Number(t) || 0
|
||||
}
|
||||
/** 付费抽奖券可选档位:type=0 */
|
||||
const lotteryOptions = ref<Array<{ id: number; name: string }>>([])
|
||||
/** 付费抽奖券可选档位:name=default */
|
||||
const paidLotteryOptions = computed(() =>
|
||||
lotteryOptions.value.filter((r) => tierTypeNum(r) === 0)
|
||||
lotteryOptions.value.filter((r) => r.name === 'default')
|
||||
)
|
||||
/**
|
||||
* 免费抽奖券可选档位:优先 type=1(DiceLotteryPoolConfig.type=1),若无则显示全部以便下拉有选项
|
||||
*/
|
||||
/** 免费抽奖券可选档位:优先 name=killScore,若无则显示全部以便下拉有选项 */
|
||||
const freeLotteryOptions = computed(() => {
|
||||
const type1List = lotteryOptions.value.filter((r) => tierTypeNum(r) === 1)
|
||||
return type1List.length > 0 ? type1List : lotteryOptions.value
|
||||
const list = lotteryOptions.value.filter((r) => r.name === 'killScore')
|
||||
return list.length > 0 ? list : lotteryOptions.value
|
||||
})
|
||||
const running = ref(false)
|
||||
|
||||
@@ -211,26 +247,23 @@
|
||||
async function loadLotteryOptions() {
|
||||
try {
|
||||
const list = await lotteryPoolApi.getOptions()
|
||||
lotteryOptions.value = list.map(
|
||||
(r: { id: number; name: string; type?: number | string }) => ({
|
||||
id: r.id,
|
||||
name: r.name,
|
||||
type: tierTypeNum(r)
|
||||
})
|
||||
)
|
||||
// 付费抽奖券默认使用 type=0 的档位类型
|
||||
const type0 = list.find((r: { type?: number | string }) => tierTypeNum(r) === 0)
|
||||
if (type0) {
|
||||
form.paid_lottery_config_id = type0.id
|
||||
lotteryOptions.value = list.map((r: { id: number; name: string }) => ({
|
||||
id: r.id,
|
||||
name: r.name
|
||||
}))
|
||||
// 付费抽奖券默认使用 name=default
|
||||
const normal = list.find((r: { name?: string }) => r.name === 'default')
|
||||
if (normal) {
|
||||
form.paid_lottery_config_id = normal.id
|
||||
}
|
||||
// 免费抽奖券默认使用 type=1 的档位类型(DiceLotteryPoolConfig.type=1);若无 type=1 则默认选第一项
|
||||
const type1 = list.find((r: { type?: number | string }) => tierTypeNum(r) === 1)
|
||||
if (type1) {
|
||||
form.free_lottery_config_id = type1.id
|
||||
// 免费抽奖券默认使用 name=killScore;若无则默认选第一项
|
||||
const kill = list.find((r: { name?: string }) => r.name === 'killScore')
|
||||
if (kill) {
|
||||
form.free_lottery_config_id = kill.id
|
||||
} else if (list.length > 0) {
|
||||
form.free_lottery_config_id = list[0].id
|
||||
}
|
||||
} catch (_) {
|
||||
} catch {
|
||||
lotteryOptions.value = []
|
||||
}
|
||||
}
|
||||
@@ -257,7 +290,7 @@
|
||||
|
||||
function validateForm(): boolean {
|
||||
if (form.paid_s_count + form.paid_n_count + form.free_s_count + form.free_n_count <= 0) {
|
||||
ElMessage.warning('付费或免费至少一种方向次数之和大于 0')
|
||||
ElMessage.warning(t('page.weightTest.warnTotalSpins'))
|
||||
return false
|
||||
}
|
||||
const needPaidTier = form.paid_lottery_config_id == null
|
||||
@@ -265,22 +298,22 @@
|
||||
if (needPaidTier) {
|
||||
const sum = paidTierSum.value
|
||||
if (sum <= 0) {
|
||||
ElMessage.warning('付费未选奖池时,T1~T5 档位概率之和需大于 0')
|
||||
ElMessage.warning(t('page.weightTest.warnPaidTierSumPositive'))
|
||||
return false
|
||||
}
|
||||
if (sum > 100) {
|
||||
ElMessage.warning('付费档位概率 T1~T5 之和不能超过 100%')
|
||||
ElMessage.warning(t('page.weightTest.warnPaidTierSumMax'))
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (needFreeTier) {
|
||||
const sum = freeTierSum.value
|
||||
if (sum <= 0) {
|
||||
ElMessage.warning('免费未选奖池时,T1~T5 档位概率之和需大于 0')
|
||||
ElMessage.warning(t('page.weightTest.warnFreeTierSumPositive'))
|
||||
return false
|
||||
}
|
||||
if (sum > 100) {
|
||||
ElMessage.warning('免费档位概率 T1~T5 之和不能超过 100%')
|
||||
ElMessage.warning(t('page.weightTest.warnFreeTierSumMax'))
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -292,13 +325,11 @@
|
||||
running.value = true
|
||||
try {
|
||||
await api.startWeightTest(buildPayload())
|
||||
ElMessage.success(
|
||||
'测试任务已创建,后台将自动执行。请在【玩家抽奖记录(测试数据)】中查看生成的测试数据'
|
||||
)
|
||||
ElMessage.success(t('page.weightTest.successCreated'))
|
||||
visible.value = false
|
||||
emit('success')
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '创建测试任务失败')
|
||||
ElMessage.error(e?.message || t('page.weightTest.failCreate'))
|
||||
} finally {
|
||||
running.value = false
|
||||
}
|
||||
@@ -312,7 +343,7 @@
|
||||
}
|
||||
})
|
||||
|
||||
// 切换到免费步骤时,若当前选中 id 不在免费档位列表中,则重置为第一个 type=1 的选项,避免显示错误
|
||||
// 切换到免费步骤时,若当前选中 id 不在免费档位列表中,则重置为第一个 killScore 的选项,避免显示错误
|
||||
watch(currentStep, (step) => {
|
||||
if (step === 1) {
|
||||
const freeOpts = freeLotteryOptions.value
|
||||
@@ -325,6 +356,9 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.weight-test-tip {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.steps-wrap {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
@@ -3,24 +3,24 @@
|
||||
<ElCard shadow="never" class="form-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>游戏奖励配置</span>
|
||||
<span>{{ $t('page.toolbar.gameRewardConfig') }}</span>
|
||||
<ElButton
|
||||
v-permission="'dice:reward_config:index:update'"
|
||||
v-permission="'dice:reward_config:index:createRewardReference'"
|
||||
type="warning"
|
||||
:loading="createRewardLoading"
|
||||
@click="handleCreateRewardReference"
|
||||
v-ripple
|
||||
title="按规则:start_index=config(grid_number).id;顺时针 end_index=(start_index+grid_number)%26;逆时针 end_index=start_index-grid_number≥0?start_index-grid_number:26+start_index-grid_number"
|
||||
:title="$t('page.toolbar.createRewardRefTitle')"
|
||||
>
|
||||
创建奖励对照
|
||||
{{ $t('page.toolbar.createRewardRef') }}
|
||||
</ElButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<ElTabs v-model="activeTab" type="card" class="top-tabs">
|
||||
<ElTabPane label="奖励索引" name="index">
|
||||
<ElTabPane :label="$t('page.configPage.tabIndex')" name="index">
|
||||
<div class="tab-panel">
|
||||
<div class="panel-tip">色子点数须在 5~30 之间且本表内不重复。</div>
|
||||
<div class="panel-tip">{{ $t('page.configPage.tipIndex') }}</div>
|
||||
<div class="table-scroll-wrap">
|
||||
<ElTable
|
||||
v-loading="loading"
|
||||
@@ -29,12 +29,12 @@
|
||||
size="default"
|
||||
class="config-table"
|
||||
>
|
||||
<ElTableColumn label="索引(id)" prop="id" width="60" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colId')" prop="id" width="60" align="center">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.id }}</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="色子点数" min-width="100" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colDicePoints')" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<ElInputNumber
|
||||
v-model="row.grid_number"
|
||||
@@ -46,17 +46,25 @@
|
||||
/>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="显示文本" min-width="100" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colDisplayText')" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<ElInput v-model="row.ui_text" size="small" placeholder="显示文本(中文)" />
|
||||
<ElInput
|
||||
v-model="row.ui_text"
|
||||
size="small"
|
||||
:placeholder="$t('page.configPage.placeholderDisplayZh')"
|
||||
/>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="显示文本(英文)" min-width="120" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colDisplayTextEn')" min-width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
<ElInput v-model="row.ui_text_en" size="small" placeholder="显示文本(英文)" />
|
||||
<ElInput
|
||||
v-model="row.ui_text_en"
|
||||
size="small"
|
||||
:placeholder="$t('page.configPage.placeholderDisplayEn')"
|
||||
/>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="真实结算" min-width="110" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colRealEv')" min-width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<ElInputNumber
|
||||
v-model="row.real_ev"
|
||||
@@ -66,11 +74,11 @@
|
||||
/>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="所属档位" width="100" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colTier')" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<ElSelect
|
||||
v-model="row.tier"
|
||||
placeholder="档位"
|
||||
:placeholder="$t('page.configPage.placeholderTierSelect')"
|
||||
clearable
|
||||
size="small"
|
||||
class="full-width"
|
||||
@@ -83,27 +91,32 @@
|
||||
</ElSelect>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="备注" min-width="140" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colRemark')" min-width="140" align="center">
|
||||
<template #default="{ row }">
|
||||
<ElInput v-model="row.remark" size="small" placeholder="备注" />
|
||||
<ElInput
|
||||
v-model="row.remark"
|
||||
size="small"
|
||||
:placeholder="$t('page.configPage.placeholderRemark')"
|
||||
/>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
<div class="tab-footer">
|
||||
<ElButton type="primary" :loading="savingIndex" @click="handleSaveIndex"
|
||||
>保存</ElButton
|
||||
<ElButton
|
||||
v-permission="'dice:reward_config:index:batchUpdate'"
|
||||
type="primary"
|
||||
:loading="savingIndex"
|
||||
@click="handleSaveIndex"
|
||||
>{{ $t('page.configPage.btnSave') }}</ElButton
|
||||
>
|
||||
<ElButton @click="handleResetIndex">重置</ElButton>
|
||||
<ElButton @click="handleResetIndex">{{ $t('page.configPage.btnReset') }}</ElButton>
|
||||
</div>
|
||||
</div>
|
||||
</ElTabPane>
|
||||
<ElTabPane label="大奖权重" name="bigwin">
|
||||
<ElTabPane :label="$t('page.configPage.tabBigwin')" name="bigwin">
|
||||
<div class="tab-panel">
|
||||
<div class="panel-tip"
|
||||
>从左至右:中大奖点数(不可改)、显示信息、实际中奖、备注、权重(0~10000)。点数 5、30
|
||||
权重固定 100%。本表单独立提交,仅提交大奖权重。</div
|
||||
>
|
||||
<div class="panel-tip">{{ $t('page.configPage.tipBigwin') }}</div>
|
||||
<div class="table-scroll-wrap">
|
||||
<ElTable
|
||||
v-loading="loading"
|
||||
@@ -112,22 +125,30 @@
|
||||
size="default"
|
||||
class="config-table bigwin-table"
|
||||
>
|
||||
<ElTableColumn label="中大奖点数" width="100" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colBigwinPoints')" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<span class="readonly-value">{{ row.grid_number }}</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="显示信息" min-width="140" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colDisplayInfo')" min-width="140" align="center">
|
||||
<template #default="{ row }">
|
||||
<ElInput v-model="row.ui_text" size="small" placeholder="显示信息(中文)" />
|
||||
<ElInput
|
||||
v-model="row.ui_text"
|
||||
size="small"
|
||||
:placeholder="$t('page.configPage.placeholderDisplayInfoZh')"
|
||||
/>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="显示信息(英文)" min-width="160" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colDisplayInfoEn')" min-width="160" align="center">
|
||||
<template #default="{ row }">
|
||||
<ElInput v-model="row.ui_text_en" size="small" placeholder="显示信息(英文)" />
|
||||
<ElInput
|
||||
v-model="row.ui_text_en"
|
||||
size="small"
|
||||
:placeholder="$t('page.configPage.placeholderDisplayInfoEn')"
|
||||
/>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="实际中奖" min-width="120" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colRealPrize')" min-width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
<ElInputNumber
|
||||
v-model="row.real_ev"
|
||||
@@ -137,12 +158,16 @@
|
||||
/>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="备注" min-width="140" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colRemark')" min-width="140" align="center">
|
||||
<template #default="{ row }">
|
||||
<ElInput v-model="row.remark" size="small" placeholder="备注" />
|
||||
<ElInput
|
||||
v-model="row.remark"
|
||||
size="small"
|
||||
:placeholder="$t('page.configPage.placeholderRemark')"
|
||||
/>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="权重(0-10000)" min-width="220" align="center">
|
||||
<ElTableColumn :label="$t('page.configPage.colWeightRange')" min-width="220" align="center">
|
||||
<template #default="{ row }">
|
||||
<div class="weight-cell">
|
||||
<ElSlider
|
||||
@@ -163,21 +188,25 @@
|
||||
class="weight-input"
|
||||
/>
|
||||
</div>
|
||||
<span v-if="isBigwinWeightDisabled(row)" class="weight-tip"
|
||||
>点数 5、30 固定 100%</span
|
||||
>
|
||||
<span v-if="isBigwinWeightDisabled(row)" class="weight-tip">{{
|
||||
$t('page.configPage.weightFixedTip')
|
||||
}}</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
<div v-if="bigwinRows.length === 0 && !loading" class="empty-tip">
|
||||
暂无 BIGWIN 档位配置,请在「奖励索引」中设置 tier 为 BIGWIN。
|
||||
{{ $t('page.configPage.emptyBigwin') }}
|
||||
</div>
|
||||
<div class="tab-footer">
|
||||
<ElButton type="primary" :loading="savingBigwin" @click="handleSaveBigwin"
|
||||
>保存</ElButton
|
||||
<ElButton
|
||||
v-permission="'dice:reward_config:index:saveBigwinWeightsByGrid'"
|
||||
type="primary"
|
||||
:loading="savingBigwin"
|
||||
@click="handleSaveBigwin"
|
||||
>{{ $t('page.configPage.btnSave') }}</ElButton
|
||||
>
|
||||
<ElButton @click="handleResetBigwin">重置</ElButton>
|
||||
<ElButton @click="handleResetBigwin">{{ $t('page.configPage.btnReset') }}</ElButton>
|
||||
</div>
|
||||
</div>
|
||||
</ElTabPane>
|
||||
@@ -188,8 +217,11 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import api from '../../api/reward_config/index'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
/** 第一页:奖励索引行(来自 DiceRewardConfig 表) */
|
||||
interface IndexRow {
|
||||
id: number
|
||||
@@ -239,11 +271,11 @@
|
||||
async function handleCreateRewardReference() {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
'按规则创建奖励对照:起始索引 start_index=奖励配置中 grid_number 对应格位的 id;顺时针 end_index=(start_index+摇取点数)%26;逆时针 end_index=start_index-摇取点数≥0 则取该值,否则 26+start_index-摇取点数。先清空现有数据再为 5-30 共 26 个点数、顺/逆时针分别生成。是否继续?',
|
||||
'创建奖励对照',
|
||||
t('page.configPage.confirmCreateRefMsg'),
|
||||
t('page.configPage.confirmCreateRefTitle'),
|
||||
{
|
||||
confirmButtonText: '确定创建',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonText: t('page.configPage.confirmCreateRefOk'),
|
||||
cancelButtonText: t('page.configPage.confirmCreateRefCancel'),
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
@@ -254,14 +286,23 @@
|
||||
try {
|
||||
const res: any = await api.createRewardReference()
|
||||
const data = res?.data ?? res
|
||||
const msg =
|
||||
typeof data === 'object' && data !== null
|
||||
? `已按 5-30 共26个点数、顺时针+逆时针创建:顺时针新增 ${data.created_clockwise ?? 0} 条、逆时针新增 ${data.created_counterclockwise ?? 0} 条;顺时针更新 ${data.updated_clockwise ?? 0} 条、逆时针更新 ${data.updated_counterclockwise ?? 0} 条${(data.skipped ?? 0) > 0 ? `;${data.skipped} 个点数使用兜底起始索引` : ''}`
|
||||
: '创建成功'
|
||||
let msg = t('page.configPage.createRefSuccessSimple')
|
||||
if (typeof data === 'object' && data !== null) {
|
||||
const skipped = Number(data.skipped ?? 0)
|
||||
const skippedPart =
|
||||
skipped > 0 ? t('page.configPage.createRefSuccessSkipped', { n: skipped }) : ''
|
||||
msg = t('page.configPage.createRefSuccess', {
|
||||
cwNew: data.created_clockwise ?? 0,
|
||||
ccwNew: data.created_counterclockwise ?? 0,
|
||||
cwUp: data.updated_clockwise ?? 0,
|
||||
ccwUp: data.updated_counterclockwise ?? 0,
|
||||
skippedPart
|
||||
})
|
||||
}
|
||||
ElMessage.success(msg)
|
||||
loadIndexList()
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message ?? '创建奖励对照失败')
|
||||
ElMessage.error(e?.message ?? t('page.configPage.createRefFail'))
|
||||
} finally {
|
||||
createRewardLoading.value = false
|
||||
}
|
||||
@@ -280,7 +321,7 @@
|
||||
indexRowsSnapshot = rows.map((r) => ({ ...r }))
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage.error('获取奖励索引配置失败')
|
||||
ElMessage.error(t('page.configPage.loadIndexFail'))
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
@@ -311,18 +352,20 @@
|
||||
function validateIndexFormForSave(): string | null {
|
||||
const toSave = indexRows.value.filter((r) => r.tier !== 'BIGWIN')
|
||||
if (toSave.length === 0) {
|
||||
return '暂无奖励索引数据可保存'
|
||||
return t('page.configPage.warnNoIndexToSave')
|
||||
}
|
||||
const nums = toSave.map((r) => Number(r.grid_number))
|
||||
const outOfRange = nums.filter(
|
||||
(n) => Number.isNaN(n) || n < GRID_NUMBER_MIN || n > GRID_NUMBER_MAX
|
||||
)
|
||||
if (outOfRange.length > 0) {
|
||||
return `色子点数必须在 ${GRID_NUMBER_MIN}~${GRID_NUMBER_MAX} 之间`
|
||||
return t('page.configPage.warnGridRange', { min: GRID_NUMBER_MIN, max: GRID_NUMBER_MAX })
|
||||
}
|
||||
const duplicates = findDuplicateValues(nums)
|
||||
if (duplicates.length > 0) {
|
||||
return `色子点数在本表内不能重复,重复的点数为:${duplicates.join('、')}`
|
||||
return t('page.configPage.warnDupGrid', {
|
||||
list: duplicates.join(t('page.configPage.dupJoiner'))
|
||||
})
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -347,10 +390,10 @@
|
||||
remark: r.remark
|
||||
}))
|
||||
await api.batchUpdate(indexPayload)
|
||||
ElMessage.success('保存成功')
|
||||
ElMessage.success(t('page.configPage.saveSuccess'))
|
||||
indexRowsSnapshot = indexRows.value.map((r) => ({ ...r }))
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message ?? '保存失败')
|
||||
ElMessage.error(e?.message ?? t('page.configPage.saveFail'))
|
||||
} finally {
|
||||
savingIndex.value = false
|
||||
}
|
||||
@@ -359,25 +402,27 @@
|
||||
/** 奖励索引页:重置为本页数据(重新拉取列表) */
|
||||
function handleResetIndex() {
|
||||
loadIndexList()
|
||||
ElMessage.info('已重新加载奖励索引,恢复为服务器最新数据')
|
||||
ElMessage.info(t('page.configPage.resetIndexReloaded'))
|
||||
}
|
||||
|
||||
/** 大奖权重表单校验:点数在本表内不重复 */
|
||||
function validateBigwinFormForSave(): string | null {
|
||||
const rows = bigwinRows.value
|
||||
if (rows.length === 0) {
|
||||
return '暂无 BIGWIN 档位配置可保存'
|
||||
return t('page.configPage.warnNoBigwinToSave')
|
||||
}
|
||||
const nums = rows.map((r) => Number(r.grid_number))
|
||||
const outOfRange = nums.filter(
|
||||
(n) => Number.isNaN(n) || n < GRID_NUMBER_MIN || n > GRID_NUMBER_MAX
|
||||
)
|
||||
if (outOfRange.length > 0) {
|
||||
return `色子点数必须在 ${GRID_NUMBER_MIN}~${GRID_NUMBER_MAX} 之间`
|
||||
return t('page.configPage.warnGridRange', { min: GRID_NUMBER_MIN, max: GRID_NUMBER_MAX })
|
||||
}
|
||||
const duplicates = findDuplicateValues(nums)
|
||||
if (duplicates.length > 0) {
|
||||
return `大奖权重本表内点数不能重复,重复的点数为:${duplicates.join('、')}`
|
||||
return t('page.configPage.warnBigwinDupGrid', {
|
||||
list: duplicates.join(t('page.configPage.dupJoiner'))
|
||||
})
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -386,7 +431,7 @@
|
||||
async function handleSaveBigwin() {
|
||||
const rows = bigwinRows.value
|
||||
if (rows.length === 0) {
|
||||
ElMessage.info('暂无 BIGWIN 档位配置,请先在「奖励索引」中设置 tier 为 BIGWIN')
|
||||
ElMessage.info(t('page.configPage.infoNoBigwin'))
|
||||
return
|
||||
}
|
||||
const err = validateBigwinFormForSave()
|
||||
@@ -413,10 +458,10 @@
|
||||
: Math.max(0, Math.min(10000, Math.floor(r.weight)))
|
||||
}))
|
||||
await api.saveBigwinWeightsByGrid(weightItems)
|
||||
ElMessage.success('保存成功')
|
||||
ElMessage.success(t('page.configPage.saveSuccess'))
|
||||
loadIndexList()
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message ?? '保存失败')
|
||||
ElMessage.error(e?.message ?? t('page.configPage.saveFail'))
|
||||
} finally {
|
||||
savingBigwin.value = false
|
||||
}
|
||||
@@ -425,7 +470,7 @@
|
||||
/** 大奖权重页:重置(重新拉取列表,BIGWIN 数据随之更新) */
|
||||
function handleResetBigwin() {
|
||||
loadIndexList()
|
||||
ElMessage.info('已重新加载,大奖权重恢复为服务器最新数据')
|
||||
ElMessage.info(t('page.configPage.resetBigwinReloaded'))
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增奖励配置' : '编辑奖励配置'"
|
||||
:title="dialogType === 'add' ? $t('page.form.titleAdd') : $t('page.form.titleEdit')"
|
||||
width="600px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="色子点数" prop="grid_number">
|
||||
<el-form-item :label="$t('page.form.labelDicePoints')" prop="grid_number">
|
||||
<el-input-number
|
||||
v-model="formData.grid_number"
|
||||
placeholder="请输入色子点数"
|
||||
:placeholder="$t('page.form.placeholderDicePoints')"
|
||||
:disabled="dialogType === 'edit'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="前端显示文本" prop="ui_text">
|
||||
<el-input v-model="formData.ui_text" placeholder="请输入前端显示文本(中文)" />
|
||||
<el-form-item :label="$t('page.form.labelUiText')" prop="ui_text">
|
||||
<el-input v-model="formData.ui_text" :placeholder="$t('page.form.placeholderUiText')"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="前端显示文本(英文)" prop="ui_text_en">
|
||||
<el-input v-model="formData.ui_text_en" placeholder="请输入前端显示文本(英文)" />
|
||||
<el-form-item :label="$t('page.form.labelUiTextEn')" prop="ui_text_en">
|
||||
<el-input v-model="formData.ui_text_en" :placeholder="$t('page.form.placeholderUiTextEn')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="真实资金结算" prop="real_ev">
|
||||
<el-input-number v-model="formData.real_ev" placeholder="请输入真实资金结算" />
|
||||
<el-form-item :label="$t('page.form.labelRealEv')" prop="real_ev">
|
||||
<el-input-number v-model="formData.real_ev" :placeholder="$t('page.form.placeholderRealEv')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属档位" prop="tier">
|
||||
<el-form-item :label="$t('page.form.labelTier')" prop="tier">
|
||||
<el-select
|
||||
v-model="formData.tier"
|
||||
placeholder="请选择所属档位"
|
||||
:placeholder="$t('page.form.placeholderTier')"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
:disabled="dialogType === 'edit'"
|
||||
@@ -37,39 +37,39 @@
|
||||
<el-option label="T3" value="T3" />
|
||||
<el-option label="T4" value="T4" />
|
||||
<el-option label="T5" value="T5" />
|
||||
<el-option label="BIGWIN(超级大奖)" value="BIGWIN" />
|
||||
<el-option :label="$t('page.form.tierBigWin')" value="BIGWIN" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- BIGWIN 时可编辑权重:10000=100% 中奖,0=0% 中奖;点数 5、30 固定 100% 不可改 -->
|
||||
<el-form-item v-if="formData.tier === 'BIGWIN'" label="大奖权重" prop="weight">
|
||||
<el-form-item v-if="formData.tier === 'BIGWIN'" :label="$t('page.form.labelBigWinWeight')" prop="weight">
|
||||
<el-input-number
|
||||
v-model="formData.weight"
|
||||
:min="0"
|
||||
:max="10000"
|
||||
:step="100"
|
||||
placeholder="0~10000,10000=100%中奖"
|
||||
:placeholder="$t('page.form.placeholderBigWinWeight')"
|
||||
:disabled="isBigwinWeightDisabled"
|
||||
/>
|
||||
<div v-if="isBigwinWeightDisabled" class="form-tip">
|
||||
点数 5、30 摇到必中大奖,权重固定 10000
|
||||
{{ $t('page.form.bigWinWeightDisabledTip') }}
|
||||
</div>
|
||||
<div v-else class="form-tip">10000=100% 中奖,0=0% 中奖;仅对点数 10/15/20/25 生效</div>
|
||||
<div v-else class="form-tip">{{ $t('page.form.bigWinWeightTip') }}</div>
|
||||
</el-form-item>
|
||||
<!-- 权重已迁移至「T1-T5 与 BIGWIN 权重配比」弹窗(dice_reward 表);BIGWIN 时本弹窗可编辑 weight;起始索引已迁移至 dice_reward.start_index -->
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-form-item :label="$t('page.form.labelRemark')" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入备注"
|
||||
:placeholder="$t('page.form.placeholderRemark')"
|
||||
maxlength="500"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -78,6 +78,7 @@
|
||||
import api from '../../../api/reward_config/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -97,6 +98,7 @@
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
@@ -111,14 +113,16 @@
|
||||
/**
|
||||
* 表单验证规则(权重已迁移至权重配比弹窗)
|
||||
*/
|
||||
const rules = reactive<FormRules>({
|
||||
grid_number: [{ required: true, message: '色子点数必需填写', trigger: 'blur' }],
|
||||
ui_text: [{ required: true, message: '前端显示文本必需填写', trigger: 'blur' }],
|
||||
ui_text_en: [{ max: 255, message: '前端显示文本(英文)长度需小于 255 字符', trigger: 'blur' }],
|
||||
real_ev: [{ required: true, message: '真实资金结算必需填写', trigger: 'blur' }],
|
||||
tier: [{ required: true, message: '所属档位必需填写', trigger: 'blur' }],
|
||||
weight: [{ type: 'number', min: 0, max: 10000, message: '大奖权重 0~10000', trigger: 'blur' }]
|
||||
})
|
||||
const rules = computed<FormRules>(() => ({
|
||||
grid_number: [{ required: true, message: t('page.form.ruleDicePointsRequired'), trigger: 'blur' }],
|
||||
ui_text: [{ required: true, message: t('page.form.ruleUiTextRequired'), trigger: 'blur' }],
|
||||
ui_text_en: [{ max: 255, message: t('page.form.ruleUiTextEnMax'), trigger: 'blur' }],
|
||||
real_ev: [{ required: true, message: t('page.form.ruleRealEvRequired'), trigger: 'blur' }],
|
||||
tier: [{ required: true, message: t('page.form.ruleTierRequired'), trigger: 'blur' }],
|
||||
weight: [
|
||||
{ type: 'number', min: 0, max: 10000, message: t('page.form.ruleBigWinWeightRange'), trigger: 'blur' }
|
||||
]
|
||||
}))
|
||||
|
||||
/** 点数 5、30 固定 100% 中大奖,权重不可改 */
|
||||
const isBigwinWeightDisabled = computed(
|
||||
@@ -222,10 +226,10 @@
|
||||
}
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(payload)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(payload)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="色子点数" prop="grid_number_min">
|
||||
<el-form-item :label="$t('page.search.dicePoints')" prop="grid_number_min">
|
||||
<div class="range-wrap">
|
||||
<el-input-number
|
||||
v-model="formData.grid_number_min"
|
||||
placeholder="最小"
|
||||
:placeholder="$t('table.searchBar.min')"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
/>
|
||||
<span class="range-sep">至</span>
|
||||
<span class="range-sep">{{ $t('table.searchBar.rangeSeparator') }}</span>
|
||||
<el-input-number
|
||||
v-model="formData.grid_number_max"
|
||||
placeholder="最大"
|
||||
:placeholder="$t('table.searchBar.max')"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
/>
|
||||
@@ -28,24 +28,24 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="前端显示文本" prop="ui_text">
|
||||
<el-input v-model="formData.ui_text" placeholder="模糊查询" clearable />
|
||||
<el-form-item :label="$t('page.search.displayText')" prop="ui_text">
|
||||
<el-input v-model="formData.ui_text" :placeholder="$t('page.search.fuzzyQuery')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="真实资金结算" prop="real_ev_min">
|
||||
<el-form-item :label="$t('page.search.realEv')" prop="real_ev_min">
|
||||
<div class="range-wrap">
|
||||
<el-input-number
|
||||
v-model="formData.real_ev_min"
|
||||
placeholder="最小"
|
||||
:placeholder="$t('table.searchBar.min')"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
/>
|
||||
<span class="range-sep">至</span>
|
||||
<span class="range-sep">{{ $t('table.searchBar.rangeSeparator') }}</span>
|
||||
<el-input-number
|
||||
v-model="formData.real_ev_max"
|
||||
placeholder="最大"
|
||||
:placeholder="$t('table.searchBar.max')"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
class="range-input"
|
||||
@@ -54,8 +54,8 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="所属档位" prop="tier">
|
||||
<el-select v-model="formData.tier" placeholder="全部" clearable style="width: 100%">
|
||||
<el-form-item :label="$t('page.search.tier')" prop="tier">
|
||||
<el-select v-model="formData.tier" :placeholder="$t('table.searchBar.all')" clearable style="width: 100%">
|
||||
<el-option label="T1" value="T1" />
|
||||
<el-option label="T2" value="T2" />
|
||||
<el-option label="T3" value="T3" />
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="T1-T5 权重配比(顺时针/逆时针)"
|
||||
:title="$t('page.weightRatio.title')"
|
||||
width="900px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<div class="global-tip">
|
||||
权重来自<strong>奖励对照表(dice_reward)</strong>,按<strong>结束索引(DiceRewardConfig.id)</strong>区分<strong>顺时针</strong>与<strong>逆时针</strong>两套权重;抽奖时按当前方向取对应权重。
|
||||
{{ $t('page.weightRatio.globalTip') }}
|
||||
</div>
|
||||
<el-tabs v-model="activeTier" type="card">
|
||||
<el-tab-pane v-for="t in tierKeys" :key="t" :label="t" :name="t">
|
||||
<div v-if="getTierItems(t).length === 0" class="empty-tip"> 该档位暂无配置数据 </div>
|
||||
<div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightRatio.emptyTier') }}</div>
|
||||
<template v-else>
|
||||
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
|
||||
<div class="chart-row">
|
||||
<ArtBarChart
|
||||
x-axis-name="结束索引"
|
||||
:x-axis-name="$t('page.weightRatio.xAxisEndIndex')"
|
||||
:x-axis-data="getTierChartLabels(t)"
|
||||
:data="getTierChartData(t, 'clockwise')"
|
||||
height="180px"
|
||||
/>
|
||||
<ArtBarChart
|
||||
x-axis-name="结束索引"
|
||||
:x-axis-name="$t('page.weightRatio.xAxisEndIndex')"
|
||||
:x-axis-data="getTierChartLabels(t)"
|
||||
:data="getTierChartData(t, 'counterclockwise')"
|
||||
height="180px"
|
||||
@@ -31,20 +31,41 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
|
||||
当前档位权重合计(顺时针):<strong>{{ getTierSumForValidation(t, 'clockwise') }}</strong>
|
||||
;逆时针:<strong>{{ getTierSumForValidation(t, 'counterclockwise') }}</strong>
|
||||
(各条 1-10000,档位内按权重比抽取,和不限制)
|
||||
{{
|
||||
$t('page.weightRatio.sumLine', {
|
||||
cw: getTierSumForValidation(t, 'clockwise'),
|
||||
ccw: getTierSumForValidation(t, 'counterclockwise')
|
||||
})
|
||||
}}
|
||||
</div>
|
||||
<div class="weight-sum weight-sum-t4t5" v-else>
|
||||
T4、T5 档位抽中时仅有一个结果,无需配置权重。
|
||||
{{ $t('page.weightRatio.t4t5Note') }}
|
||||
</div>
|
||||
<el-table :data="getTierItems(t)" border size="small" class="weight-table">
|
||||
<el-table-column label="结束索引(id)" prop="id" width="90" align="center" show-overflow-tooltip />
|
||||
<el-table-column label="色子点数" prop="grid_number" width="80" align="center" />
|
||||
<el-table-column label="实际中奖金额" prop="real_ev" width="90" align="center" show-overflow-tooltip />
|
||||
<el-table-column label="显示文本" prop="ui_text" min-width="70" align="center" show-overflow-tooltip />
|
||||
<el-table-column label="备注" prop="remark" min-width="70" align="center" show-overflow-tooltip />
|
||||
<el-table-column label="顺时针权重(1-10000)" min-width="160" align="center">
|
||||
<el-table-column
|
||||
:label="$t('page.weightRatio.colEndIndexId')"
|
||||
prop="id"
|
||||
width="90"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column :label="$t('page.weightRatio.colDicePoints')" prop="grid_number" width="80" align="center" />
|
||||
<el-table-column
|
||||
:label="$t('page.weightRatio.colRealEv')"
|
||||
prop="real_ev"
|
||||
width="90"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
:label="$t('page.weightRatio.colUiText')"
|
||||
prop="ui_text"
|
||||
min-width="70"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column :label="$t('page.table.remark')" prop="remark" min-width="70" align="center" show-overflow-tooltip />
|
||||
<el-table-column :label="$t('page.weightRatio.colWeightCw')" min-width="160" align="center">
|
||||
<template #default="{ row }">
|
||||
<div class="weight-cell-vertical">
|
||||
<div class="weight-slider-wrap">
|
||||
@@ -87,7 +108,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="逆时针权重(1-10000)" min-width="160" align="center">
|
||||
<el-table-column :label="$t('page.weightRatio.colWeightCcw')" min-width="160" align="center">
|
||||
<template #default="{ row }">
|
||||
<div class="weight-cell-vertical">
|
||||
<div class="weight-slider-wrap">
|
||||
@@ -135,8 +156,14 @@
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button
|
||||
v-permission="'dice:reward_config:index:batchUpdateWeights'"
|
||||
type="primary"
|
||||
:loading="submitting"
|
||||
@click="handleSubmit"
|
||||
>{{ $t('table.form.submit') }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -145,6 +172,9 @@
|
||||
import api from '../../../api/reward_config/index'
|
||||
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
|
||||
type DirectionKey = 'clockwise' | 'counterclockwise'
|
||||
@@ -335,7 +365,7 @@
|
||||
grouped.value = parseWeightRatioPayload(res)
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage.error('获取权重配比数据失败')
|
||||
ElMessage.error(t('page.weightRatio.fetchFail'))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -358,19 +388,19 @@
|
||||
function handleSubmit() {
|
||||
const items = collectItems()
|
||||
if (items.length === 0) {
|
||||
ElMessage.info('没有可提交的配置')
|
||||
ElMessage.info(t('page.weightRatio.nothingToSubmit'))
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
api
|
||||
.batchUpdateWeights(items)
|
||||
.then(() => {
|
||||
ElMessage.success('保存成功')
|
||||
ElMessage.success(t('page.weightRatio.saveSuccess'))
|
||||
emit('success')
|
||||
handleClose()
|
||||
})
|
||||
.catch((e: { message?: string }) => {
|
||||
ElMessage.error(e?.message ?? '保存失败')
|
||||
ElMessage.error(e?.message ?? t('page.weightRatio.submitFail'))
|
||||
})
|
||||
.finally(() => {
|
||||
submitting.value = false
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:delete-bin-5-line" />
|
||||
</template>
|
||||
删除
|
||||
{{ $t('table.actions.delete') }}
|
||||
</ElButton>
|
||||
</ElSpace>
|
||||
</template>
|
||||
@@ -42,11 +42,17 @@
|
||||
</template>
|
||||
<!-- 付费抽取:顺时针、逆时针抽取次数(兼容旧数据用 s_count/n_count) -->
|
||||
<template #paid_draw="{ row }">
|
||||
<span>顺 {{ getPaidS(row) }} / 逆 {{ getPaidN(row) }}</span>
|
||||
<span
|
||||
>{{ $t('page.table.clockwiseAbbr') }} {{ getPaidS(row) }} /
|
||||
{{ $t('page.table.counterclockwiseAbbr') }} {{ getPaidN(row) }}</span
|
||||
>
|
||||
</template>
|
||||
<!-- 免费抽取:顺时针、逆时针抽取次数 -->
|
||||
<template #free_draw="{ row }">
|
||||
<span>顺 {{ row.free_s_count ?? 0 }} / 逆 {{ row.free_n_count ?? 0 }}</span>
|
||||
<span
|
||||
>{{ $t('page.table.clockwiseAbbr') }} {{ row.free_s_count ?? 0 }} /
|
||||
{{ $t('page.table.counterclockwiseAbbr') }} {{ row.free_n_count ?? 0 }}</span
|
||||
>
|
||||
</template>
|
||||
<!-- 平台赚取金额 -->
|
||||
<template #platform_profit="{ row }">
|
||||
@@ -58,7 +64,7 @@
|
||||
<SaButton
|
||||
v-permission="'dice:reward_config_record:index:read'"
|
||||
type="success"
|
||||
toolTip="查看详情"
|
||||
:toolTip="$t('page.toolbar.viewDetail')"
|
||||
@click="openDetail(row)"
|
||||
/>
|
||||
<SaButton
|
||||
@@ -84,6 +90,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useTable } from '@/hooks/core/useTable'
|
||||
import { useSaiAdmin } from '@/composables/useSaiAdmin'
|
||||
import api from '../../api/reward_config_record/index'
|
||||
@@ -119,13 +126,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
const { t } = useI18n()
|
||||
// 状态文案:-1失败 0测试中 1完成(2=执行中也显示测试中)
|
||||
function formatStatus(status: unknown): string {
|
||||
const s = Number(status)
|
||||
if (s === -1) return '失败'
|
||||
if (s === 1) return '完成'
|
||||
if (s === 0 || s === 2) return '测试中'
|
||||
return '—'
|
||||
if (s === -1) return t('page.table.statusFail')
|
||||
if (s === 1) return t('page.table.statusDone')
|
||||
if (s === 0 || s === 2) return t('page.table.statusTesting')
|
||||
return t('page.detail.dash')
|
||||
}
|
||||
|
||||
// 付费抽取次数(兼容旧数据:无 paid_s_count 时用 s_count)
|
||||
@@ -142,9 +150,10 @@
|
||||
|
||||
// 平台赚取金额展示(未完成或空显示 —)
|
||||
function formatPlatformProfit(v: unknown): string {
|
||||
if (v === null || v === undefined || v === '') return '—'
|
||||
const dash = t('page.detail.dash')
|
||||
if (v === null || v === undefined || v === '') return dash
|
||||
const n = Number(v)
|
||||
if (Number.isNaN(n)) return '—'
|
||||
if (Number.isNaN(n)) return dash
|
||||
return String(n)
|
||||
}
|
||||
|
||||
@@ -168,47 +177,47 @@
|
||||
apiParams: { limit: 100 },
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'id', label: 'ID', width: 80, align: 'center' },
|
||||
{ prop: 'id', label: 'page.table.id', width: 80, align: 'center' },
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
label: 'page.table.status',
|
||||
width: 90,
|
||||
align: 'center',
|
||||
useSlot: true
|
||||
},
|
||||
{
|
||||
prop: 'paid_draw',
|
||||
label: '付费抽取',
|
||||
label: 'page.table.paidDraw',
|
||||
width: 160,
|
||||
align: 'center',
|
||||
useSlot: true
|
||||
},
|
||||
{
|
||||
prop: 'free_draw',
|
||||
label: '免费抽取',
|
||||
label: 'page.table.freeDraw',
|
||||
width: 160,
|
||||
align: 'center',
|
||||
useSlot: true
|
||||
},
|
||||
{
|
||||
prop: 'platform_profit',
|
||||
label: '平台赚取金额',
|
||||
label: 'page.table.platformProfit',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
useSlot: true
|
||||
},
|
||||
{ prop: 'total_play_count', label: '总抽奖次数', width: 110, align: 'center' },
|
||||
{ prop: 'total_play_count', label: 'page.table.totalDrawCount', width: 110, align: 'center' },
|
||||
{
|
||||
prop: 'admin_name',
|
||||
label: '创建管理员',
|
||||
label: 'page.table.createdBy',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{ prop: 'create_time', label: '创建时间', width: 170, align: 'center' },
|
||||
{ prop: 'create_time', label: 'page.table.createTime', width: 170, align: 'center' },
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
label: 'table.actions.operation',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-drawer
|
||||
v-model="visible"
|
||||
title="测试记录详情"
|
||||
:title="$t('page.detail.title')"
|
||||
:size="drawerSize"
|
||||
direction="rtl"
|
||||
destroy-on-close
|
||||
@@ -9,37 +9,39 @@
|
||||
>
|
||||
<template v-if="record">
|
||||
<div class="detail-section">
|
||||
<div class="section-title">基本信息</div>
|
||||
<div class="section-title">{{ $t('page.detail.sectionBasic') }}</div>
|
||||
<el-descriptions :column="2" border size="small">
|
||||
<el-descriptions-item label="记录ID">
|
||||
<el-descriptions-item :label="$t('page.detail.recordId')">
|
||||
{{ record.id }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="测试次数">{{ record.test_count }} 次</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ record.create_time || '—' }}
|
||||
<el-descriptions-item :label="$t('page.detail.testCount')"
|
||||
>{{ record.test_count }}{{ $t('page.detail.testCountSuffix') }}</el-descriptions-item
|
||||
>
|
||||
<el-descriptions-item :label="$t('page.detail.createTime')">
|
||||
{{ record.create_time || $t('page.detail.dash') }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="执行管理员">
|
||||
{{ record.admin_name ?? record.admin_id ?? '—' }}
|
||||
<el-descriptions-item :label="$t('page.detail.admin')">
|
||||
{{ record.admin_name ?? record.admin_id ?? $t('page.detail.dash') }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="付费奖池配置ID">
|
||||
{{ record.paid_lottery_config_id ?? record.lottery_config_id ?? '—' }}
|
||||
<el-descriptions-item :label="$t('page.detail.paidPoolId')">
|
||||
{{ record.paid_lottery_config_id ?? record.lottery_config_id ?? $t('page.detail.dash') }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="免费奖池配置ID">
|
||||
{{ record.free_lottery_config_id ?? '—' }}
|
||||
<el-descriptions-item :label="$t('page.detail.freePoolId')">
|
||||
{{ record.free_lottery_config_id ?? $t('page.detail.dash') }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="BIGWIN 权重快照">
|
||||
<el-descriptions-item :label="$t('page.detail.bigwinSnapshot')">
|
||||
<template v-if="bigwinWeightDisplay.length">
|
||||
<span v-for="item in bigwinWeightDisplay" :key="item.grid" class="mr-2">
|
||||
{{ item.grid }}:{{ item.weight }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-else>—</template>
|
||||
<template v-else>{{ $t('page.detail.dash') }}</template>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
|
||||
<div class="detail-section">
|
||||
<div class="section-title">付费抽奖档位概率(T1-T5,测试时使用)</div>
|
||||
<div class="section-title">{{ $t('page.detail.sectionPaidTier') }}</div>
|
||||
<el-table
|
||||
v-if="paidTierTableData.length"
|
||||
:data="paidTierTableData"
|
||||
@@ -48,17 +50,17 @@
|
||||
class="tier-weights-table"
|
||||
max-height="160"
|
||||
>
|
||||
<el-table-column prop="tier" label="档位" width="80" align="center" />
|
||||
<el-table-column prop="weight" label="权重" width="100" align="center" />
|
||||
<el-table-column prop="percent" label="占比" width="100" align="center" />
|
||||
<el-table-column prop="tier" :label="$t('page.detail.colTier')" width="80" align="center" />
|
||||
<el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="100" align="center" />
|
||||
<el-table-column prop="percent" :label="$t('page.detail.colPercent')" width="100" align="center" />
|
||||
</el-table>
|
||||
<div v-else class="empty-tip">
|
||||
暂无付费档位数据(旧记录可能仅保存 tier_weights_snapshot)
|
||||
{{ $t('page.detail.emptyPaidTier') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-section">
|
||||
<div class="section-title">免费抽奖档位概率(T1-T5,测试时使用)</div>
|
||||
<div class="section-title">{{ $t('page.detail.sectionFreeTier') }}</div>
|
||||
<el-table
|
||||
v-if="freeTierTableData.length"
|
||||
:data="freeTierTableData"
|
||||
@@ -67,18 +69,18 @@
|
||||
class="tier-weights-table"
|
||||
max-height="160"
|
||||
>
|
||||
<el-table-column prop="tier" label="档位" width="80" align="center" />
|
||||
<el-table-column prop="weight" label="权重" width="100" align="center" />
|
||||
<el-table-column prop="percent" label="占比" width="100" align="center" />
|
||||
<el-table-column prop="tier" :label="$t('page.detail.colTier')" width="80" align="center" />
|
||||
<el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="100" align="center" />
|
||||
<el-table-column prop="percent" :label="$t('page.detail.colPercent')" width="100" align="center" />
|
||||
</el-table>
|
||||
<div v-else class="empty-tip">暂无免费档位数据</div>
|
||||
<div v-else class="empty-tip">{{ $t('page.detail.emptyFreeTier') }}</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-section">
|
||||
<div class="section-title">权重配比快照(测试时使用的 T1-T5/BIGWIN 配置)</div>
|
||||
<div class="section-title">{{ $t('page.detail.sectionSnapshot') }}</div>
|
||||
|
||||
<div class="snapshot-group">
|
||||
<div class="snapshot-subtitle">顺时针(非 BIGWIN)</div>
|
||||
<div class="snapshot-subtitle">{{ $t('page.detail.subCw') }}</div>
|
||||
<el-table
|
||||
:data="snapshotClockwise"
|
||||
border
|
||||
@@ -86,15 +88,15 @@
|
||||
max-height="180"
|
||||
class="snapshot-table"
|
||||
>
|
||||
<el-table-column prop="tier" label="档位" width="80" align="center" />
|
||||
<el-table-column prop="grid_number" label="色子点数" width="100" align="center" />
|
||||
<el-table-column prop="weight" label="权重" width="90" align="center" />
|
||||
<el-table-column prop="tier" :label="$t('page.detail.colTier')" width="80" align="center" />
|
||||
<el-table-column prop="grid_number" :label="$t('page.detail.colGridNumber')" width="100" align="center" />
|
||||
<el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="90" align="center" />
|
||||
</el-table>
|
||||
<div v-if="!snapshotClockwise.length" class="empty-tip">暂无顺时针数据</div>
|
||||
<div v-if="!snapshotClockwise.length" class="empty-tip">{{ $t('page.detail.emptyCw') }}</div>
|
||||
</div>
|
||||
|
||||
<div class="snapshot-group">
|
||||
<div class="snapshot-subtitle">逆时针(非 BIGWIN)</div>
|
||||
<div class="snapshot-subtitle">{{ $t('page.detail.subCcw') }}</div>
|
||||
<el-table
|
||||
:data="snapshotCounterclockwise"
|
||||
border
|
||||
@@ -102,15 +104,15 @@
|
||||
max-height="180"
|
||||
class="snapshot-table"
|
||||
>
|
||||
<el-table-column prop="tier" label="档位" width="80" align="center" />
|
||||
<el-table-column prop="grid_number" label="色子点数" width="100" align="center" />
|
||||
<el-table-column prop="weight" label="权重" width="90" align="center" />
|
||||
<el-table-column prop="tier" :label="$t('page.detail.colTier')" width="80" align="center" />
|
||||
<el-table-column prop="grid_number" :label="$t('page.detail.colGridNumber')" width="100" align="center" />
|
||||
<el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="90" align="center" />
|
||||
</el-table>
|
||||
<div v-if="!snapshotCounterclockwise.length" class="empty-tip">暂无逆时针数据</div>
|
||||
<div v-if="!snapshotCounterclockwise.length" class="empty-tip">{{ $t('page.detail.emptyCcw') }}</div>
|
||||
</div>
|
||||
|
||||
<div class="snapshot-group">
|
||||
<div class="snapshot-subtitle">BIGWIN(按 DiceRewardConfig 配置快照)</div>
|
||||
<div class="snapshot-subtitle">{{ $t('page.detail.subBigwin') }}</div>
|
||||
<el-table
|
||||
:data="bigwinTableData"
|
||||
border
|
||||
@@ -118,30 +120,35 @@
|
||||
max-height="180"
|
||||
class="snapshot-table"
|
||||
>
|
||||
<el-table-column prop="grid_number" label="色子点数" width="100" align="center" />
|
||||
<el-table-column prop="weight" label="权重" width="90" align="center" />
|
||||
<el-table-column prop="grid_number" :label="$t('page.detail.colGridNumber')" width="100" align="center" />
|
||||
<el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="90" align="center" />
|
||||
</el-table>
|
||||
<div v-if="!bigwinTableData.length" class="empty-tip">暂无 BIGWIN 数据</div>
|
||||
<div v-if="!bigwinTableData.length" class="empty-tip">{{ $t('page.detail.emptyBigwinTable') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-section">
|
||||
<div class="section-title">落点统计(各 grid_number 出现次数)</div>
|
||||
<div class="section-title">{{ $t('page.detail.sectionResult') }}</div>
|
||||
<div class="chart-wrap">
|
||||
<ArtBarChart
|
||||
x-axis-name="色子点数 (grid_number)"
|
||||
:x-axis-name="$t('page.detail.chartXAxis')"
|
||||
:x-axis-data="chartLabels"
|
||||
:data="chartData"
|
||||
height="280px"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="resultTotal === 0" class="empty-tip">暂无落点数据</div>
|
||||
<div v-else class="result-summary">总落点次数:{{ resultTotal }}</div>
|
||||
<div v-if="resultTotal === 0" class="empty-tip">{{ $t('page.detail.emptyResult') }}</div>
|
||||
<div v-else class="result-summary">{{ $t('page.detail.resultTotal', { n: resultTotal }) }}</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-section footer-actions">
|
||||
<el-button type="primary" :loading="importing" @click="openImport">
|
||||
导入到当前配置
|
||||
<el-button
|
||||
v-permission="'dice:reward_config_record:index:importFromRecord'"
|
||||
type="primary"
|
||||
:loading="importing"
|
||||
@click="openImport"
|
||||
>
|
||||
{{ $t('page.detail.btnImport') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -149,21 +156,19 @@
|
||||
<!-- 导入弹窗 -->
|
||||
<el-dialog
|
||||
v-model="importVisible"
|
||||
title="导入到正式配置"
|
||||
:title="$t('page.detail.importTitle')"
|
||||
width="520px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<p class="import-desc">
|
||||
将本测试记录导入:<strong>DiceReward</strong>(格子权重)、
|
||||
<strong>DiceRewardConfig</strong>(BIGWIN weight)、
|
||||
<strong>DiceLotteryPoolConfig</strong>(付费/免费 T1-T5 档位概率)。请选择要写入的奖池。
|
||||
{{ $t('page.detail.importDesc') }}
|
||||
</p>
|
||||
<el-form label-width="160px">
|
||||
<el-form-item label="导入付费档位概率到奖池">
|
||||
<el-form-item :label="$t('page.detail.importPaidLabel')">
|
||||
<el-select
|
||||
v-model="importPaidLotteryConfigId"
|
||||
placeholder="选择任意奖池(建议付费池)"
|
||||
:placeholder="$t('page.detail.importPaidPlaceholder')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@@ -175,12 +180,12 @@
|
||||
:value="opt.id"
|
||||
/>
|
||||
</el-select>
|
||||
<div class="form-tip">不选则使用本记录保存时的付费奖池配置 ID</div>
|
||||
<div class="form-tip">{{ $t('page.detail.importPaidTip') }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="导入免费档位概率到奖池">
|
||||
<el-form-item :label="$t('page.detail.importFreeLabel')">
|
||||
<el-select
|
||||
v-model="importFreeLotteryConfigId"
|
||||
placeholder="选择任意奖池(建议免费池)"
|
||||
:placeholder="$t('page.detail.importFreePlaceholder')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@@ -192,12 +197,18 @@
|
||||
:value="opt.id"
|
||||
/>
|
||||
</el-select>
|
||||
<div class="form-tip">不选则使用本记录保存时的免费奖池配置 ID</div>
|
||||
<div class="form-tip">{{ $t('page.detail.importFreeTip') }}</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="importVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="importing" @click="confirmImport">确认导入</el-button>
|
||||
<el-button @click="importVisible = false">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button
|
||||
v-permission="'dice:reward_config_record:index:importFromRecord'"
|
||||
type="primary"
|
||||
:loading="importing"
|
||||
@click="confirmImport"
|
||||
>{{ $t('page.detail.btnConfirmImport') }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-drawer>
|
||||
@@ -208,6 +219,9 @@
|
||||
import recordApi from '../../../api/reward_config_record/index'
|
||||
import lotteryConfigApi from '../../../api/lottery_pool_config/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
|
||||
const GRID_NUMBERS = [
|
||||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
@@ -266,24 +280,26 @@
|
||||
const importing = ref(false)
|
||||
const importPaidLotteryConfigId = ref<number | null>(null)
|
||||
const importFreeLotteryConfigId = ref<number | null>(null)
|
||||
const lotteryConfigOptions = ref<Array<{ id: number; name: string; type: number }>>([])
|
||||
const lotteryConfigOptions = ref<Array<{ id: number; name: string }>>([])
|
||||
|
||||
function tierWeightsToTableData(t: Record<string, number> | null | undefined) {
|
||||
if (!t || typeof t !== 'object') return []
|
||||
function tierWeightsToTableData(weightsMap: Record<string, number> | null | undefined) {
|
||||
const dash = t('page.detail.dash')
|
||||
if (!weightsMap || typeof weightsMap !== 'object') return []
|
||||
const tiers = ['T1', 'T2', 'T3', 'T4', 'T5']
|
||||
const rows = tiers.map((tier) => {
|
||||
const w = t[tier] ?? t[tier.toLowerCase()] ?? 0
|
||||
const w = weightsMap[tier] ?? weightsMap[tier.toLowerCase()] ?? 0
|
||||
return { tier, weight: w }
|
||||
})
|
||||
const total = rows.reduce((sum, r) => sum + r.weight, 0)
|
||||
return rows.map((r) => ({
|
||||
tier: r.tier,
|
||||
weight: r.weight,
|
||||
percent: total > 0 ? `${((r.weight / total) * 100).toFixed(1)}%` : '—'
|
||||
percent: total > 0 ? `${((r.weight / total) * 100).toFixed(1)}%` : dash
|
||||
}))
|
||||
}
|
||||
|
||||
const paidTierTableData = computed(() => {
|
||||
locale.value
|
||||
const r = props.record
|
||||
const paidFromRecord = r?.paid_tier_weights
|
||||
const snapshot = r?.tier_weights_snapshot
|
||||
@@ -305,6 +321,7 @@
|
||||
})
|
||||
|
||||
const freeTierTableData = computed(() => {
|
||||
locale.value
|
||||
const r = props.record
|
||||
const freeFromRecord = r?.free_tier_weights
|
||||
const snapshot = r?.tier_weights_snapshot
|
||||
@@ -352,6 +369,8 @@
|
||||
})
|
||||
|
||||
const snapshotTableData = computed(() => {
|
||||
locale.value
|
||||
const dash = t('page.detail.dash')
|
||||
const snapshot = props.record?.weight_config_snapshot as
|
||||
| Array<{
|
||||
tier?: string
|
||||
@@ -364,11 +383,12 @@
|
||||
return snapshot.map((item) => {
|
||||
const dir = item.direction
|
||||
return {
|
||||
tier: item.tier ?? '—',
|
||||
tier: item.tier ?? dash,
|
||||
direction: dir,
|
||||
direction_label: dir === 0 ? '顺时针' : dir === 1 ? '逆时针' : '—',
|
||||
grid_number: item.grid_number ?? '—',
|
||||
weight: item.weight ?? '—'
|
||||
direction_label:
|
||||
dir === 0 ? t('page.detail.dirCw') : dir === 1 ? t('page.detail.dirCcw') : dash,
|
||||
grid_number: item.grid_number ?? dash,
|
||||
weight: item.weight ?? dash
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -458,11 +478,11 @@
|
||||
paid_lottery_config_id: importPaidLotteryConfigId.value ?? undefined,
|
||||
free_lottery_config_id: importFreeLotteryConfigId.value ?? undefined
|
||||
})
|
||||
ElMessage.success('导入成功,已刷新 DiceReward、DiceRewardConfig(BIGWIN)、奖池配置')
|
||||
ElMessage.success(t('page.detail.importSuccess'))
|
||||
importVisible.value = false
|
||||
emit('import-done')
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message ?? '导入失败')
|
||||
ElMessage.error(e?.message ?? t('page.detail.importFail'))
|
||||
} finally {
|
||||
importing.value = false
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增奖励配置权重测试记录' : '编辑奖励配置权重测试记录'"
|
||||
:title="dialogType === 'add' ? $t('page.form.titleAdd') : $t('page.form.titleEdit')"
|
||||
width="600px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="测试次数:100/500/1000" prop="test_count">
|
||||
<el-input v-model="formData.test_count" placeholder="请输入测试次数:100/500/1000" />
|
||||
<el-form-item :label="$t('page.form.labelTestCount')" prop="test_count">
|
||||
<el-input v-model="formData.test_count" :placeholder="$t('page.form.placeholderTestCount')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="测试时权重配比快照:按档位保存 id,grid_number,tier,weight" prop="weight_config_snapshot">
|
||||
<el-input v-model="formData.weight_config_snapshot" placeholder="请输入测试时权重配比快照:按档位保存 id,grid_number,tier,weight" />
|
||||
<el-form-item :label="$t('page.form.labelWeightSnapshot')" prop="weight_config_snapshot">
|
||||
<el-input v-model="formData.weight_config_snapshot" :placeholder="$t('page.form.placeholderWeightSnapshot')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="落点统计:grid_number=>出现次数" prop="result_counts">
|
||||
<el-input v-model="formData.result_counts" placeholder="请输入落点统计:grid_number=>出现次数" />
|
||||
<el-form-item :label="$t('page.form.labelResultCounts')" prop="result_counts">
|
||||
<el-input v-model="formData.result_counts" :placeholder="$t('page.form.placeholderResultCounts')" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -29,6 +29,7 @@
|
||||
import api from '../../../api/reward_config_record/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -48,6 +49,7 @@
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
@@ -62,9 +64,9 @@
|
||||
/**
|
||||
* 表单验证规则
|
||||
*/
|
||||
const rules = reactive<FormRules>({
|
||||
test_count: [{ required: true, message: '测试次数:100/500/1000必需填写', trigger: 'blur' }],
|
||||
})
|
||||
const rules = computed<FormRules>(() => ({
|
||||
test_count: [{ required: true, message: t('page.form.ruleTestCountRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
/**
|
||||
* 初始数据
|
||||
@@ -136,10 +138,10 @@
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -244,19 +244,19 @@
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'url', label: '预览', saiType: 'image', width: 80 },
|
||||
{ prop: 'origin_name', label: '文件名称', minWidth: 160, showOverflowTooltip: true },
|
||||
{ prop: 'url', label: 'page.table.preview', saiType: 'image', width: 80 },
|
||||
{ prop: 'origin_name', label: 'page.table.fileName', minWidth: 160, showOverflowTooltip: true },
|
||||
{
|
||||
prop: 'storage_mode',
|
||||
label: '存储模式',
|
||||
label: 'page.table.storageMode',
|
||||
width: 100,
|
||||
saiType: 'dict',
|
||||
saiDict: 'upload_mode'
|
||||
},
|
||||
{ prop: 'mime_type', label: '文件类型', width: 160, showOverflowTooltip: true },
|
||||
{ prop: 'size_info', label: '文件大小', width: 100 },
|
||||
{ prop: 'create_time', label: '上传时间', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: '操作', width: 100, fixed: 'right', useSlot: true }
|
||||
{ prop: 'mime_type', label: 'page.table.fileType', width: 160, showOverflowTooltip: true },
|
||||
{ prop: 'size_info', label: 'page.table.fileSize', width: 100 },
|
||||
{ prop: 'create_time', label: 'page.table.uploadTime', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 100, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增文件' : '编辑文件'"
|
||||
:title="dialogType === 'add' ? $t('page.form.titleAdd') : $t('page.form.titleEdit')"
|
||||
width="800px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="100px">
|
||||
<el-form-item label="文件名称" prop="origin_name">
|
||||
<el-input v-model="formData.origin_name" placeholder="请输入文件名称" />
|
||||
<el-form-item :label="$t('page.form.labelFileName')" prop="origin_name">
|
||||
<el-input v-model="formData.origin_name" :placeholder="$t('page.form.placeholderFileName')" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -24,6 +24,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import api from '@/api/safeguard/attachment'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -43,6 +45,7 @@
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
@@ -55,9 +58,9 @@
|
||||
})
|
||||
|
||||
// 表单验证规则
|
||||
const rules: FormRules = {
|
||||
origin_name: [{ required: true, message: '请输入文件名称', trigger: 'blur' }]
|
||||
}
|
||||
const rules = computed<FormRules>(() => ({
|
||||
origin_name: [{ required: true, message: t('page.form.ruleFileNameRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
// 初始表单数据
|
||||
const initialFormData = {
|
||||
@@ -123,7 +126,7 @@
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'edit') {
|
||||
await api.update(formData)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model="formData.username" placeholder="请输入用户名" clearable />
|
||||
<el-form-item :label="$t('page.search.username')" prop="username">
|
||||
<el-input v-model="formData.username" :placeholder="$t('page.search.placeholderUsername')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="formData.phone" placeholder="请输入手机号" clearable />
|
||||
<el-form-item :label="$t('page.search.phone')" prop="phone">
|
||||
<el-input v-model="formData.phone" :placeholder="$t('page.search.placeholderPhone')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" clearable />
|
||||
<el-form-item :label="$t('page.search.status')" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" :placeholder="$t('page.search.searchSelectPlaceholder')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</sa-search-bar>
|
||||
|
||||
@@ -125,16 +125,16 @@
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'name', label: '表名称', minWidth: 200 },
|
||||
{ prop: 'comment', label: '表注释', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'engine', label: '表引擎', width: 120 },
|
||||
{ prop: 'update_time', label: '更新时间', width: 180, sortable: true },
|
||||
{ prop: 'rows', label: '总行数', width: 120 },
|
||||
{ prop: 'data_free', label: '碎片大小', width: 120 },
|
||||
{ prop: 'data_length', label: '数据大小', width: 120 },
|
||||
{ prop: 'collation', label: '字符集', width: 180 },
|
||||
{ prop: 'create_time', label: '创建时间', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: '操作', width: 100, fixed: 'right', useSlot: true }
|
||||
{ prop: 'name', label: 'page.table.tableName', minWidth: 200 },
|
||||
{ prop: 'comment', label: 'page.table.tableComment', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'engine', label: 'page.table.tableEngine', width: 120 },
|
||||
{ prop: 'update_time', label: 'page.table.updateTime', width: 180, sortable: true },
|
||||
{ prop: 'rows', label: 'page.table.totalRows', width: 120 },
|
||||
{ prop: 'data_free', label: 'page.table.fragmentSize', width: 120 },
|
||||
{ prop: 'data_length', label: 'page.table.dataSize', width: 120 },
|
||||
{ prop: 'collation', label: 'page.table.collation', width: 180 },
|
||||
{ prop: 'create_time', label: 'page.table.createTime', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 100, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -140,8 +140,8 @@
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'delete_time', label: '删除时间', width: 180 },
|
||||
{ prop: 'json_data', label: '数据详情', useSlot: true, showOverflowTooltip: true }
|
||||
{ prop: 'delete_time', label: 'page.table.deleteTime', width: 180 },
|
||||
{ prop: 'json_data', label: 'page.table.dataDetail', useSlot: true, showOverflowTooltip: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="表名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入表名称" clearable />
|
||||
<el-form-item :label="$t('page.search.tableName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.search.placeholderTableName')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</sa-search-bar>
|
||||
|
||||
@@ -268,10 +268,10 @@
|
||||
...typeSearch.value
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ prop: 'id', label: '选中', width: 80, align: 'center', useSlot: true },
|
||||
{ prop: 'name', label: '字典名称', useHeaderSlot: true, width: 150 },
|
||||
{ prop: 'code', label: '字典标识', useHeaderSlot: true, width: 150 },
|
||||
{ prop: 'status', label: '状态', saiType: 'dict', saiDict: 'data_status', width: 100 }
|
||||
{ prop: 'id', label: 'page.table.select', width: 80, align: 'center', useSlot: true },
|
||||
{ prop: 'name', label: 'page.table.dictName', useHeaderSlot: true, width: 150 },
|
||||
{ prop: 'code', label: 'page.table.dictCode', useHeaderSlot: true, width: 150 },
|
||||
{ prop: 'status', label: 'page.table.status', saiType: 'dict', saiDict: 'data_status', width: 100 }
|
||||
]
|
||||
}
|
||||
})
|
||||
@@ -312,12 +312,12 @@
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'label', label: '字典标签', useSlot: true },
|
||||
{ prop: 'value', label: '字典键值' },
|
||||
{ prop: 'color', label: '颜色' },
|
||||
{ prop: 'sort', label: '排序' },
|
||||
{ prop: 'status', label: '状态', saiType: 'dict', saiDict: 'data_status' },
|
||||
{ prop: 'operation', label: '操作', useSlot: true, width: 120 }
|
||||
{ prop: 'label', label: 'page.table.dictLabel', useSlot: true },
|
||||
{ prop: 'value', label: 'page.table.dictValue' },
|
||||
{ prop: 'color', label: 'page.table.color' },
|
||||
{ prop: 'sort', label: 'page.table.sort' },
|
||||
{ prop: 'status', label: 'page.table.status', saiType: 'dict', saiDict: 'data_status' },
|
||||
{ prop: 'operation', label: 'table.actions.operation', useSlot: true, width: 120 }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -103,15 +103,15 @@
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'id', label: '编号', width: 100, align: 'center' },
|
||||
{ prop: 'gateway', label: '服务Host' },
|
||||
{ prop: 'from', label: '发件人', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'email', label: '收件人', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'code', label: '验证码' },
|
||||
{ prop: 'status', label: '发送状态', useSlot: true },
|
||||
{ prop: 'response', label: '发送结果', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'create_time', label: '发送时间', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: '操作', width: 80, fixed: 'right', useSlot: true }
|
||||
{ prop: 'id', label: 'page.table.no', width: 100, align: 'center' },
|
||||
{ prop: 'gateway', label: 'page.table.gateway' },
|
||||
{ prop: 'from', label: 'page.table.emailFrom', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'email', label: 'page.table.emailTo', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'code', label: 'page.table.emailCode' },
|
||||
{ prop: 'status', label: 'page.table.sendStatus', useSlot: true },
|
||||
{ prop: 'response', label: 'page.table.emailResponse', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'create_time', label: 'page.table.sendTime', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 80, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -9,31 +9,31 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="发件人" prop="from">
|
||||
<el-input v-model="formData.from" placeholder="请输入发件人" clearable />
|
||||
<el-form-item :label="$t('page.search.labelFrom')" prop="from">
|
||||
<el-input v-model="formData.from" :placeholder="$t('page.search.placeholderFrom')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="收件人" prop="email">
|
||||
<el-input v-model="formData.email" placeholder="请输入收件人" clearable />
|
||||
<el-form-item :label="$t('page.search.labelTo')" prop="email">
|
||||
<el-input v-model="formData.email" :placeholder="$t('page.search.placeholderTo')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="发送状态" prop="status">
|
||||
<el-select v-model="formData.status" placeholder="请选择发送状态" clearable>
|
||||
<el-option label="成功" value="success" />
|
||||
<el-option label="失败" value="failure" />
|
||||
<el-form-item :label="$t('page.search.placeholderSendStatus')" prop="status">
|
||||
<el-select v-model="formData.status" :placeholder="$t('page.search.placeholderSendStatus')" clearable>
|
||||
<el-option :label="$t('table.searchBar.success')" value="success" />
|
||||
<el-option :label="$t('table.searchBar.failure')" value="failure" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(12)" v-show="isExpanded">
|
||||
<el-form-item label="发送时间" prop="create_time">
|
||||
<el-form-item :label="$t('page.search.operTime')" prop="create_time">
|
||||
<el-date-picker
|
||||
v-model="formData.create_time"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
:range-separator="$t('table.searchBar.rangeSeparator')"
|
||||
:start-placeholder="$t('table.searchBar.startTime')"
|
||||
:end-placeholder="$t('table.searchBar.endTime')"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
clearable
|
||||
/>
|
||||
|
||||
@@ -103,16 +103,16 @@
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'id', label: '编号', width: 100, align: 'center' },
|
||||
{ prop: 'username', label: '登录用户' },
|
||||
{ prop: 'status', label: '登录状态', useSlot: true },
|
||||
{ prop: 'ip', label: '登录IP' },
|
||||
{ prop: 'ip_location', label: '登录地点' },
|
||||
{ prop: 'os', label: '操作系统' },
|
||||
{ prop: 'browser', label: '浏览器' },
|
||||
{ prop: 'message', label: '登录信息', showOverflowTooltip: true },
|
||||
{ prop: 'login_time', label: '登录时间', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: '操作', width: 80, fixed: 'right', useSlot: true }
|
||||
{ prop: 'id', label: 'page.table.no', width: 100, align: 'center' },
|
||||
{ prop: 'username', label: 'page.table.loginUser' },
|
||||
{ prop: 'status', label: 'page.table.loginStatus', useSlot: true },
|
||||
{ prop: 'ip', label: 'page.table.loginIp' },
|
||||
{ prop: 'ip_location', label: 'page.table.operLocation' },
|
||||
{ prop: 'os', label: 'page.table.os' },
|
||||
{ prop: 'browser', label: 'page.table.browser' },
|
||||
{ prop: 'message', label: 'page.table.loginMessage', showOverflowTooltip: true },
|
||||
{ prop: 'login_time', label: 'page.table.loginTime', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 80, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -9,31 +9,31 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="登录用户" prop="username">
|
||||
<el-input v-model="formData.username" placeholder="请输入登录用户" clearable />
|
||||
<el-form-item :label="$t('page.search.loginUser')" prop="username">
|
||||
<el-input v-model="formData.username" :placeholder="$t('page.search.placeholderLoginUser')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="登录IP" prop="ip">
|
||||
<el-input v-model="formData.ip" placeholder="请输入登录IP" clearable />
|
||||
<el-form-item :label="$t('page.search.loginIp')" prop="ip">
|
||||
<el-input v-model="formData.ip" :placeholder="$t('page.search.placeholderLoginIp')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="登录状态" prop="status">
|
||||
<el-select v-model="formData.status" placeholder="请选择登录状态" clearable>
|
||||
<el-option label="成功" value="1" />
|
||||
<el-option label="失败" value="0" />
|
||||
<el-form-item :label="$t('page.search.loginStatus')" prop="status">
|
||||
<el-select v-model="formData.status" :placeholder="$t('page.search.placeholderLoginStatus')" clearable>
|
||||
<el-option :label="$t('table.searchBar.success')" value="1" />
|
||||
<el-option :label="$t('table.searchBar.failure')" value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(12)" v-show="isExpanded">
|
||||
<el-form-item label="登录时间" prop="login_time">
|
||||
<el-form-item :label="$t('page.search.operTime')" prop="login_time">
|
||||
<el-date-picker
|
||||
v-model="formData.login_time"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
:range-separator="$t('table.searchBar.rangeSeparator')"
|
||||
:start-placeholder="$t('table.searchBar.startTime')"
|
||||
:end-placeholder="$t('table.searchBar.endTime')"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
clearable
|
||||
/>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:delete-bin-5-line" />
|
||||
</template>
|
||||
删除
|
||||
{{ $t('table.actions.delete') }}
|
||||
</ElButton>
|
||||
</ElSpace>
|
||||
</template>
|
||||
@@ -102,14 +102,14 @@
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'id', label: '编号', width: 100, align: 'center' },
|
||||
{ prop: 'username', label: '操作用户' },
|
||||
{ prop: 'service_name', label: '业务名称' },
|
||||
{ prop: 'router', label: '路由', minWidth: 180, showOverflowTooltip: true },
|
||||
{ prop: 'ip', label: '操作IP' },
|
||||
{ prop: 'ip_location', label: '操作地点' },
|
||||
{ prop: 'create_time', label: '操作时间', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: '操作', width: 100, fixed: 'right', useSlot: true }
|
||||
{ prop: 'id', label: 'page.table.no', width: 100, align: 'center' },
|
||||
{ prop: 'username', label: 'page.table.operator' },
|
||||
{ prop: 'service_name', label: 'page.table.serviceName' },
|
||||
{ prop: 'router', label: 'page.table.router', minWidth: 180, showOverflowTooltip: true },
|
||||
{ prop: 'ip', label: 'page.table.operIp' },
|
||||
{ prop: 'ip_location', label: 'page.table.operLocation' },
|
||||
{ prop: 'create_time', label: 'page.table.operTime', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 100, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -9,28 +9,28 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="操作用户" prop="username">
|
||||
<el-input v-model="formData.username" placeholder="请输入操作用户" clearable />
|
||||
<el-form-item :label="$t('page.search.operator')" prop="username">
|
||||
<el-input v-model="formData.username" :placeholder="$t('page.search.placeholderOperator')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="操作路由" prop="router">
|
||||
<el-input v-model="formData.router" placeholder="请输入操作路由" clearable />
|
||||
<el-form-item :label="$t('page.search.router')" prop="router">
|
||||
<el-input v-model="formData.router" :placeholder="$t('page.search.placeholderOperRouter')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="操作IP" prop="ip">
|
||||
<el-input v-model="formData.ip" placeholder="请输入操作IP" clearable />
|
||||
<el-form-item :label="$t('page.search.operIp')" prop="ip">
|
||||
<el-input v-model="formData.ip" :placeholder="$t('page.search.placeholderOperIp')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(12)" v-show="isExpanded">
|
||||
<el-form-item label="操作时间" prop="create_time">
|
||||
<el-form-item :label="$t('page.search.operTime')" prop="create_time">
|
||||
<el-date-picker
|
||||
v-model="formData.create_time"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
:range-separator="$t('table.searchBar.rangeSeparator')"
|
||||
:start-placeholder="$t('table.searchBar.startTime')"
|
||||
:end-placeholder="$t('table.searchBar.endTime')"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
clearable
|
||||
/>
|
||||
|
||||
@@ -300,9 +300,9 @@
|
||||
...configSearch.value
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ prop: 'id', label: '选中', width: 80, align: 'center', useSlot: true },
|
||||
{ prop: 'name', label: '配置名称', useHeaderSlot: true, width: 150 },
|
||||
{ prop: 'code', label: '配置标识', useHeaderSlot: true, width: 150 }
|
||||
{ prop: 'id', label: 'page.table.select', width: 80, align: 'center', useSlot: true },
|
||||
{ prop: 'name', label: 'page.table.configName', useHeaderSlot: true, width: 150 },
|
||||
{ prop: 'code', label: 'page.table.configKey', useHeaderSlot: true, width: 150 }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -160,12 +160,12 @@
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'key', label: '配置标识' },
|
||||
{ prop: 'name', label: '配置标题' },
|
||||
{ prop: 'input_type', label: '组件类型', width: 100 },
|
||||
{ prop: 'sort', label: '排序', width: 100, sortable: true },
|
||||
{ prop: 'remark', label: '备注' },
|
||||
{ prop: 'operation', label: '操作', useSlot: true, width: 100 }
|
||||
{ prop: 'key', label: 'table.columns.system.configKey' },
|
||||
{ prop: 'name', label: 'table.columns.system.configTitle' },
|
||||
{ prop: 'input_type', label: 'table.columns.system.inputType', width: 100 },
|
||||
{ prop: 'sort', label: 'table.columns.common.sort', width: 100, sortable: true },
|
||||
{ prop: 'remark', label: 'table.columns.common.remark' },
|
||||
{ prop: 'operation', label: 'table.actions.operation', useSlot: true, width: 100 }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:add-fill" />
|
||||
</template>
|
||||
新增
|
||||
{{ $t('table.actions.add') }}
|
||||
</ElButton>
|
||||
<ElButton @click="toggleExpand" v-ripple>
|
||||
<template #icon>
|
||||
<ArtSvgIcon v-if="isExpanded" icon="ri:collapse-diagonal-line" />
|
||||
<ArtSvgIcon v-else icon="ri:expand-diagonal-line" />
|
||||
</template>
|
||||
{{ isExpanded ? '收起' : '展开' }}
|
||||
{{ isExpanded ? $t('table.searchBar.collapse') : $t('table.searchBar.expand') }}
|
||||
</ElButton>
|
||||
</ElSpace>
|
||||
</template>
|
||||
@@ -106,14 +106,14 @@
|
||||
core: {
|
||||
apiFn: api.list,
|
||||
columnsFactory: () => [
|
||||
{ prop: 'name', label: '部门名称', minWidth: 200 },
|
||||
{ prop: 'code', label: '部门编码', minWidth: 120 },
|
||||
{ prop: 'leader.username', label: '部门领导', minWidth: 120 },
|
||||
{ prop: 'remark', label: '描述', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'sort', label: '排序', width: 100 },
|
||||
{ prop: 'status', label: '状态', saiType: 'dict', saiDict: 'data_status', width: 100 },
|
||||
{ prop: 'create_time', label: '创建日期', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: '操作', width: 100, fixed: 'right', useSlot: true }
|
||||
{ prop: 'name', label: 'page.table.deptName', minWidth: 200 },
|
||||
{ prop: 'code', label: 'page.table.deptCode', minWidth: 120 },
|
||||
{ prop: 'leader.username', label: 'page.table.leader', minWidth: 120 },
|
||||
{ prop: 'remark', label: 'table.columns.common.description', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'sort', label: 'page.table.sort', width: 100 },
|
||||
{ prop: 'status', label: 'page.table.status', saiType: 'dict', saiDict: 'data_status', width: 100 },
|
||||
{ prop: 'create_time', label: 'page.table.createTime', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 100, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增部门' : '编辑部门'"
|
||||
:title="dialogType === 'add' ? $t('page.form.titleAdd') : $t('page.form.titleEdit')"
|
||||
width="600px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="上级部门" prop="parent_id">
|
||||
<el-form-item :label="$t('page.form.labelParentDept')" prop="parent_id">
|
||||
<el-tree-select
|
||||
v-model="formData.parent_id"
|
||||
:data="optionData.treeData"
|
||||
@@ -17,33 +17,33 @@
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入部门名称" />
|
||||
<el-form-item :label="$t('page.form.labelDeptName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.form.placeholderDeptName')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门编码" prop="code">
|
||||
<el-input v-model="formData.code" placeholder="请输入部门编码" />
|
||||
<el-form-item :label="$t('page.form.labelDeptCode')" prop="code">
|
||||
<el-input v-model="formData.code" :placeholder="$t('page.form.placeholderDeptCode')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门领导">
|
||||
<el-form-item :label="$t('page.form.labelLeader')">
|
||||
<sa-user v-model="formData.leader_id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="remark">
|
||||
<el-form-item :label="$t('page.form.labelRemark')" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入部门描述"
|
||||
:placeholder="$t('page.form.placeholderRemark')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input-number v-model="formData.sort" placeholder="请输入排序" />
|
||||
<el-form-item :label="$t('page.form.labelSort')" prop="sort">
|
||||
<el-input-number v-model="formData.sort" :placeholder="$t('page.form.placeholderSort')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="启用" prop="status">
|
||||
<el-form-item :label="$t('page.form.labelStatus')" prop="status">
|
||||
<sa-radio v-model="formData.status" dict="data_status" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -52,6 +52,7 @@
|
||||
import api from '@/api/system/dept'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -71,6 +72,7 @@
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
const optionData = reactive({
|
||||
@@ -88,11 +90,13 @@
|
||||
/**
|
||||
* 表单验证规则
|
||||
*/
|
||||
const rules = reactive<FormRules>({
|
||||
parent_id: [{ required: true, message: '请选择上级部门', trigger: 'change' }],
|
||||
name: [{ required: true, message: '请输入部门名称', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '请输入部门编码', trigger: 'blur' }]
|
||||
})
|
||||
const rules = computed<FormRules>(() => ({
|
||||
parent_id: [
|
||||
{ required: true, message: t('page.form.ruleParentDeptRequired'), trigger: 'change' }
|
||||
],
|
||||
name: [{ required: true, message: t('page.form.ruleDeptNameRequired'), trigger: 'blur' }],
|
||||
code: [{ required: true, message: t('page.form.ruleDeptCodeRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
/**
|
||||
* 初始数据
|
||||
@@ -138,7 +142,7 @@
|
||||
{
|
||||
id: 0,
|
||||
value: 0,
|
||||
label: '无上级部门',
|
||||
label: t('page.form.noParentDept'),
|
||||
children: data
|
||||
}
|
||||
]
|
||||
@@ -180,10 +184,10 @@
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="部门名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入部门名称" clearable />
|
||||
<el-form-item :label="$t('page.search.deptName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.search.placeholderDeptName')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="部门编码" prop="code">
|
||||
<el-input v-model="formData.code" placeholder="请输入部门编码" clearable />
|
||||
<el-form-item :label="$t('page.search.deptCode')" prop="code">
|
||||
<el-input v-model="formData.code" :placeholder="$t('page.search.placeholderDeptCode')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" clearable />
|
||||
<el-form-item :label="$t('page.search.status')" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" :placeholder="$t('page.search.searchSelectPlaceholder')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</sa-search-bar>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:add-fill" />
|
||||
</template>
|
||||
新增
|
||||
{{ $t('table.actions.add') }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-permission="'core:menu:destroy'"
|
||||
@@ -27,7 +27,7 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:delete-bin-5-line" />
|
||||
</template>
|
||||
删除
|
||||
{{ $t('table.actions.delete') }}
|
||||
</ElButton>
|
||||
<ElButton @click="toggleExpand" v-ripple>
|
||||
<template #icon>
|
||||
@@ -129,10 +129,10 @@
|
||||
apiFn: api.list,
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'name', label: '菜单名称', minWidth: 150 },
|
||||
{ prop: 'name', label: 'page.table.menuName', minWidth: 150 },
|
||||
{
|
||||
prop: 'type',
|
||||
label: '菜单类型',
|
||||
label: 'page.table.menuType',
|
||||
align: 'center',
|
||||
saiType: 'dict',
|
||||
saiDict: 'menu_type',
|
||||
@@ -140,17 +140,17 @@
|
||||
},
|
||||
{
|
||||
prop: 'icon',
|
||||
label: '图标',
|
||||
label: 'page.table.icon',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
formatter: (row: any) => {
|
||||
return h(ArtSvgIcon, { icon: row.icon })
|
||||
}
|
||||
},
|
||||
{ prop: 'code', label: '组件名称' },
|
||||
{ prop: 'code', label: 'page.table.component' },
|
||||
{
|
||||
prop: 'path',
|
||||
label: '路由',
|
||||
label: 'page.table.route',
|
||||
formatter: (row: any) => {
|
||||
if (row.type === 3) return ''
|
||||
return row.path || ''
|
||||
@@ -158,7 +158,7 @@
|
||||
},
|
||||
{
|
||||
prop: 'slug',
|
||||
label: '权限标识',
|
||||
label: 'page.table.auth',
|
||||
minWidth: 160,
|
||||
formatter: (row: any) => {
|
||||
if (row.type === 2) {
|
||||
@@ -170,9 +170,9 @@
|
||||
return ''
|
||||
}
|
||||
},
|
||||
{ prop: 'sort', label: '排序', width: 100 },
|
||||
{ prop: 'status', label: '状态', saiType: 'dict', saiDict: 'data_status', width: 100 },
|
||||
{ prop: 'operation', label: '操作', width: 140, fixed: 'right', useSlot: true }
|
||||
{ prop: 'sort', label: 'page.table.sort', width: 100 },
|
||||
{ prop: 'status', label: 'page.table.status', saiType: 'dict', saiDict: 'data_status', width: 100 },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 140, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增菜单' : '编辑菜单'"
|
||||
:title="dialogType === 'add' ? $t('page.form.titleAdd') : $t('page.form.titleEdit')"
|
||||
width="820px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="菜单类型" prop="type">
|
||||
<el-form-item :label="$t('page.form.labelMenuType')" prop="type">
|
||||
<sa-radio v-model="formData.type" type="button" dict="menu_type"></sa-radio>
|
||||
</el-form-item>
|
||||
<el-form-item label="上级菜单" prop="parent_id">
|
||||
<el-form-item :label="$t('page.form.labelParentMenu')" prop="parent_id">
|
||||
<el-tree-select
|
||||
v-model="formData.parent_id"
|
||||
:data="optionData.treeData"
|
||||
@@ -22,63 +22,63 @@
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="菜单名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入菜单名称" />
|
||||
<el-form-item :label="$t('page.form.labelMenuName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.form.labelMenuName')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="formData.type < 3">
|
||||
<el-form-item prop="path">
|
||||
<template #label>
|
||||
<sa-label
|
||||
label="路由地址"
|
||||
tooltip="一级菜单:以 / 开头的绝对路径(如 /dashboard) 二级及以下:相对路径(如 console、user)"
|
||||
:label="$t('page.form.labelRoutePath')"
|
||||
:tooltip="$t('page.form.labelRoutePathTip')"
|
||||
/>
|
||||
</template>
|
||||
<el-input v-model="formData.path" placeholder="如:/dashboard 或 console" />
|
||||
<el-input v-model="formData.path" :placeholder="$t('page.form.placeholderRoutePath')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="formData.type != 3">
|
||||
<el-form-item label="组件名称" prop="code">
|
||||
<el-input v-model="formData.code" placeholder="如: User" />
|
||||
<el-form-item :label="$t('page.form.labelComponentName')" prop="code">
|
||||
<el-input v-model="formData.code" :placeholder="$t('page.form.placeholderComponentName')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="formData.type === 2">
|
||||
<el-form-item prop="component">
|
||||
<template #label>
|
||||
<sa-label label="组件路径" tooltip="填写组件路径(views目录下) 目录菜单:留空" />
|
||||
<sa-label :label="$t('page.form.labelComponentPath')" :tooltip="$t('page.form.labelComponentPathTip')" />
|
||||
</template>
|
||||
<el-autocomplete
|
||||
class="w-full"
|
||||
v-model="formData.component"
|
||||
:fetch-suggestions="querySearch"
|
||||
clearable
|
||||
placeholder="如:/system/user 或留空"
|
||||
:placeholder="$t('page.form.placeholderComponentPath')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="formData.type != 3">
|
||||
<el-form-item label="菜单图标" prop="icon">
|
||||
<el-form-item :label="$t('page.form.labelMenuIcon')" prop="icon">
|
||||
<sa-icon-picker v-model="formData.icon" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="formData.type === 3">
|
||||
<el-form-item label="权限标识" prop="slug">
|
||||
<el-input v-model="formData.slug" placeholder="请输入权限标识" />
|
||||
<el-form-item :label="$t('page.form.labelPermSlug')" prop="slug">
|
||||
<el-input v-model="formData.slug" :placeholder="$t('page.form.placeholderPermSlug')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="formData.type === 4">
|
||||
<el-form-item label="外链地址" prop="link_url">
|
||||
<el-input v-model="formData.link_url" placeholder="如:https://saithink.top" />
|
||||
<el-form-item :label="$t('page.form.labelLinkUrl')" prop="link_url">
|
||||
<el-input v-model="formData.link_url" :placeholder="$t('page.form.placeholderLinkUrl')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="sort">
|
||||
<template #label>
|
||||
<sa-label label="排序" tooltip="数字越大越靠前" />
|
||||
<sa-label :label="$t('page.form.labelSort')" :tooltip="$t('page.form.labelSortTip')" />
|
||||
</template>
|
||||
<el-input-number
|
||||
v-model="formData.sort"
|
||||
placeholder="请输入排序"
|
||||
:placeholder="$t('page.form.placeholderSort')"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -86,7 +86,7 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="status">
|
||||
<template #label>
|
||||
<sa-label label="状态" tooltip="禁用后,该菜单项将不可用" />
|
||||
<sa-label :label="$t('page.form.labelStatus')" :tooltip="$t('page.form.labelStatusTip')" />
|
||||
</template>
|
||||
<sa-radio v-model="formData.status" dict="data_status" />
|
||||
</el-form-item>
|
||||
@@ -94,7 +94,7 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="is_iframe">
|
||||
<template #label>
|
||||
<sa-label label="是否内嵌" tooltip="外链模式下有效" />
|
||||
<sa-label :label="$t('page.form.labelIsIframe')" :tooltip="$t('page.form.labelIsIframeTip')" />
|
||||
</template>
|
||||
<sa-switch v-model="formData.is_iframe" dict="yes_or_no" :showText="false" />
|
||||
</el-form-item>
|
||||
@@ -102,7 +102,7 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="is_keep_alive">
|
||||
<template #label>
|
||||
<sa-label label="是否缓存" tooltip="切换tabs不刷新" />
|
||||
<sa-label :label="$t('page.form.labelIsKeepAlive')" :tooltip="$t('page.form.labelIsKeepAliveTip')" />
|
||||
</template>
|
||||
<sa-switch v-model="formData.is_keep_alive" dict="yes_or_no" :showText="false" />
|
||||
</el-form-item>
|
||||
@@ -110,7 +110,7 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="is_hidden">
|
||||
<template #label>
|
||||
<sa-label label="是否隐藏" tooltip="不在菜单栏显示,但是可以通过路由访问" />
|
||||
<sa-label :label="$t('page.form.labelIsHidden')" :tooltip="$t('page.form.labelIsHiddenTip')" />
|
||||
</template>
|
||||
<sa-switch v-model="formData.is_hidden" dict="yes_or_no" :showText="false" />
|
||||
</el-form-item>
|
||||
@@ -118,7 +118,7 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="is_fixed_tab">
|
||||
<template #label>
|
||||
<sa-label label="是否固定" tooltip="固定在tabs导航栏" />
|
||||
<sa-label :label="$t('page.form.labelIsFixedTab')" :tooltip="$t('page.form.labelIsFixedTabTip')" />
|
||||
</template>
|
||||
<sa-switch v-model="formData.is_fixed_tab" dict="yes_or_no" :showText="false" />
|
||||
</el-form-item>
|
||||
@@ -126,7 +126,7 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="is_full_page">
|
||||
<template #label>
|
||||
<sa-label label="是否全屏" tooltip="不继承左侧菜单和顶部导航栏" />
|
||||
<sa-label :label="$t('page.form.labelIsFullPage')" :tooltip="$t('page.form.labelIsFullPageTip')" />
|
||||
</template>
|
||||
<sa-switch v-model="formData.is_full_page" dict="yes_or_no" :showText="false" />
|
||||
</el-form-item>
|
||||
@@ -134,8 +134,8 @@
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -144,6 +144,7 @@
|
||||
import api from '@/api/system/menu'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -163,6 +164,7 @@
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
const optionData = reactive({
|
||||
@@ -197,14 +199,14 @@
|
||||
/**
|
||||
* 表单验证规则
|
||||
*/
|
||||
const rules = reactive<FormRules>({
|
||||
parent_id: [{ required: true, message: '请选择上级菜单', trigger: 'change' }],
|
||||
name: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
|
||||
path: [{ required: true, message: '请输入路由地址', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '请输入组件名称', trigger: 'blur' }],
|
||||
slug: [{ required: true, message: '请输入权限标识', trigger: 'blur' }],
|
||||
link_url: [{ required: true, message: '请输入外链地址', trigger: 'blur' }]
|
||||
})
|
||||
const rules = computed<FormRules>(() => ({
|
||||
parent_id: [{ required: true, message: t('page.form.ruleParentMenuRequired'), trigger: 'change' }],
|
||||
name: [{ required: true, message: t('page.form.ruleMenuNameRequired'), trigger: 'blur' }],
|
||||
path: [{ required: true, message: t('page.form.ruleRoutePathRequired'), trigger: 'blur' }],
|
||||
code: [{ required: true, message: t('page.form.ruleComponentNameRequired'), trigger: 'blur' }],
|
||||
slug: [{ required: true, message: t('page.form.rulePermSlugRequired'), trigger: 'blur' }],
|
||||
link_url: [{ required: true, message: t('page.form.ruleLinkUrlRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
/**
|
||||
* 初始数据
|
||||
@@ -302,10 +304,10 @@
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="菜单名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入菜单名称" clearable />
|
||||
<el-form-item :label="$t('page.search.menuName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.search.placeholderMenuName')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="菜单路由" prop="path">
|
||||
<el-input v-model="formData.path" placeholder="请输入菜单路由" clearable />
|
||||
<el-form-item :label="$t('page.search.route')" prop="path">
|
||||
<el-input v-model="formData.path" :placeholder="$t('page.search.placeholderMenuRoute')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" clearable />
|
||||
<el-form-item :label="$t('page.search.status')" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" :placeholder="$t('page.search.searchSelectPlaceholder')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</sa-search-bar>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:add-fill" />
|
||||
</template>
|
||||
新增
|
||||
{{ $t('table.actions.add') }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-permission="'core:post:destroy'"
|
||||
@@ -23,7 +23,7 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:delete-bin-5-line" />
|
||||
</template>
|
||||
删除
|
||||
{{ $t('table.actions.delete') }}
|
||||
</ElButton>
|
||||
<SaImport
|
||||
v-permission="'core:post:import'"
|
||||
@@ -116,14 +116,14 @@
|
||||
apiFn: api.list,
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'id', label: '编号', width: 100, align: 'center' },
|
||||
{ prop: 'name', label: '岗位名称', minWidth: 120 },
|
||||
{ prop: 'code', label: '岗位编码', minWidth: 120 },
|
||||
{ prop: 'remark', label: '描述', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'sort', label: '排序', width: 100 },
|
||||
{ prop: 'status', label: '状态', saiType: 'dict', saiDict: 'data_status', width: 100 },
|
||||
{ prop: 'create_time', label: '创建日期', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: '操作', width: 100, fixed: 'right', useSlot: true }
|
||||
{ prop: 'id', label: 'table.columns.common.no', width: 100, align: 'center' },
|
||||
{ prop: 'name', label: 'page.table.postName', minWidth: 120 },
|
||||
{ prop: 'code', label: 'page.table.postCode', minWidth: 120 },
|
||||
{ prop: 'remark', label: 'table.columns.common.description', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'sort', label: 'page.table.sort', width: 100 },
|
||||
{ prop: 'status', label: 'page.table.status', saiType: 'dict', saiDict: 'data_status', width: 100 },
|
||||
{ prop: 'create_time', label: 'page.table.createTime', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 100, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增岗位' : '编辑岗位'"
|
||||
:title="dialogType === 'add' ? $t('page.form.titleAdd') : $t('page.form.titleEdit')"
|
||||
width="600px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="岗位名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入岗位名称" />
|
||||
<el-form-item :label="$t('page.form.labelName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.form.placeholderName')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="岗位编码" prop="code">
|
||||
<el-input v-model="formData.code" placeholder="请输入岗位编码" />
|
||||
<el-form-item :label="$t('page.form.labelCode')" prop="code">
|
||||
<el-input v-model="formData.code" :placeholder="$t('page.form.placeholderCode')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="remark">
|
||||
<el-form-item :label="$t('page.form.labelRemark')" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入岗位描述"
|
||||
:placeholder="$t('page.form.placeholderRemark')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input-number v-model="formData.sort" placeholder="请输入排序" />
|
||||
<el-form-item :label="$t('page.form.labelSort')" prop="sort">
|
||||
<el-input-number v-model="formData.sort" :placeholder="$t('page.form.placeholderSort')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="启用" prop="status">
|
||||
<el-form-item :label="$t('page.form.labelStatus')" prop="status">
|
||||
<sa-radio v-model="formData.status" dict="data_status" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -40,6 +40,7 @@
|
||||
import api from '@/api/system/post'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -59,6 +60,7 @@
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
@@ -73,10 +75,10 @@
|
||||
/**
|
||||
* 表单验证规则
|
||||
*/
|
||||
const rules = reactive<FormRules>({
|
||||
name: [{ required: true, message: '请输入岗位名称', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '请输入岗位编码', trigger: 'blur' }]
|
||||
})
|
||||
const rules = computed<FormRules>(() => ({
|
||||
name: [{ required: true, message: t('page.form.ruleNameRequired'), trigger: 'blur' }],
|
||||
code: [{ required: true, message: t('page.form.ruleCodeRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
/**
|
||||
* 初始数据
|
||||
@@ -150,10 +152,10 @@
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="岗位名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入岗位名称" clearable />
|
||||
<el-form-item :label="$t('page.search.postName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.search.placeholderPostName')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="岗位编码" prop="code">
|
||||
<el-input v-model="formData.code" placeholder="请输入岗位编码" clearable />
|
||||
<el-form-item :label="$t('page.search.postCode')" prop="code">
|
||||
<el-input v-model="formData.code" :placeholder="$t('page.search.placeholderPostCode')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" clearable />
|
||||
<el-form-item :label="$t('page.search.status')" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" :placeholder="$t('page.search.searchSelectPlaceholder')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</sa-search-bar>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:add-fill" />
|
||||
</template>
|
||||
新增
|
||||
{{ $t('table.actions.add') }}
|
||||
</ElButton>
|
||||
</ElSpace>
|
||||
</template>
|
||||
@@ -126,15 +126,15 @@
|
||||
core: {
|
||||
apiFn: api.list,
|
||||
columnsFactory: () => [
|
||||
{ prop: 'id', label: '编号', minWidth: 60, align: 'center' },
|
||||
{ prop: 'name', label: '角色名称', minWidth: 120 },
|
||||
{ prop: 'code', label: '角色编码', minWidth: 120 },
|
||||
{ prop: 'level', label: '角色级别', minWidth: 100, sortable: true },
|
||||
{ prop: 'remark', label: '角色描述', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'sort', label: '排序', minWidth: 100 },
|
||||
{ prop: 'status', label: '状态', saiType: 'dict', saiDict: 'data_status' },
|
||||
{ prop: 'create_time', label: '创建日期', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: '操作', width: 140, fixed: 'right', useSlot: true }
|
||||
{ prop: 'id', label: 'table.columns.common.no', minWidth: 60, align: 'center' },
|
||||
{ prop: 'name', label: 'page.table.roleName', minWidth: 120 },
|
||||
{ prop: 'code', label: 'page.table.roleCode', minWidth: 120 },
|
||||
{ prop: 'level', label: 'page.table.level', minWidth: 100, sortable: true },
|
||||
{ prop: 'remark', label: 'page.table.roleRemark', minWidth: 150, showOverflowTooltip: true },
|
||||
{ prop: 'sort', label: 'table.columns.common.sort', minWidth: 100 },
|
||||
{ prop: 'status', label: 'page.table.status', saiType: 'dict', saiDict: 'data_status' },
|
||||
{ prop: 'create_time', label: 'page.table.createTime', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 140, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,42 +1,40 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增角色' : '编辑角色'"
|
||||
:title="dialogType === 'add' ? $t('page.form.titleAdd') : $t('page.form.titleEdit')"
|
||||
width="600px"
|
||||
align-center
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="角色名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入角色名称" />
|
||||
<el-form-item :label="$t('page.form.labelName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.form.placeholderName')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="角色标识" prop="code">
|
||||
<el-input v-model="formData.code" placeholder="请输入角色编码" />
|
||||
<el-form-item :label="$t('page.form.labelCode')" prop="code">
|
||||
<el-input v-model="formData.code" :placeholder="$t('page.form.placeholderCode')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="角色级别" prop="level">
|
||||
<el-input-number v-model="formData.level" placeholder="角色级别" :max="99" :min="1" />
|
||||
<el-form-item :label="$t('page.form.labelLevel')" prop="level">
|
||||
<el-input-number v-model="formData.level" :placeholder="$t('page.form.labelLevel')" :max="99" :min="1" />
|
||||
</el-form-item>
|
||||
<div class="text-xs text-gray-400 pl-32 pb-4"
|
||||
>控制角色的权限层级, 不能操作职级高于自己的角色</div
|
||||
>
|
||||
<el-form-item label="描述" prop="remark">
|
||||
<div class="text-xs text-gray-400 pl-32 pb-4">{{ $t('page.form.levelTip') }}</div>
|
||||
<el-form-item :label="$t('page.form.labelRemark')" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入角色描述"
|
||||
:placeholder="$t('page.form.placeholderRemark')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input-number v-model="formData.sort" placeholder="请输入排序" />
|
||||
<el-form-item :label="$t('page.form.labelSort')" prop="sort">
|
||||
<el-input-number v-model="formData.sort" :placeholder="$t('page.form.placeholderSort')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="启用" prop="status">
|
||||
<el-form-item :label="$t('page.form.labelStatus')" prop="status">
|
||||
<sa-radio v-model="formData.status" dict="data_status" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -45,6 +43,7 @@
|
||||
import api from '@/api/system/role'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -64,6 +63,7 @@
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
@@ -78,11 +78,11 @@
|
||||
/**
|
||||
* 表单验证规则
|
||||
*/
|
||||
const rules = reactive<FormRules>({
|
||||
name: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '请输入角色编码', trigger: 'blur' }],
|
||||
level: [{ required: true, message: '请输入角色级别', trigger: 'blur' }]
|
||||
})
|
||||
const rules = computed<FormRules>(() => ({
|
||||
name: [{ required: true, message: t('page.form.ruleNameRequired'), trigger: 'blur' }],
|
||||
code: [{ required: true, message: t('page.form.ruleCodeRequired'), trigger: 'blur' }],
|
||||
level: [{ required: true, message: t('page.form.ruleLevelRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
/**
|
||||
* 初始数据
|
||||
@@ -157,10 +157,10 @@
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="角色名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入角色名称" clearable />
|
||||
<el-form-item :label="$t('page.search.roleName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.search.placeholderRoleName')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="角色编码" prop="code">
|
||||
<el-input v-model="formData.code" placeholder="请输入角色编码" clearable />
|
||||
<el-form-item :label="$t('page.search.roleCode')" prop="code">
|
||||
<el-input v-model="formData.code" :placeholder="$t('page.search.placeholderRoleCode')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" clearable />
|
||||
<el-form-item :label="$t('page.search.status')" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" :placeholder="$t('page.search.searchSelectPlaceholder')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</sa-search-bar>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:add-fill" />
|
||||
</template>
|
||||
新增
|
||||
{{ $t('table.actions.add') }}
|
||||
</ElButton>
|
||||
</ElSpace>
|
||||
</template>
|
||||
@@ -180,30 +180,30 @@
|
||||
...searchForm.value
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ type: 'index', width: 60, label: '序号' },
|
||||
{ type: 'index', width: 60, label: 'table.column.index' },
|
||||
{
|
||||
prop: 'avatar',
|
||||
label: '用户名',
|
||||
label: 'page.table.username',
|
||||
minWidth: 200,
|
||||
saiType: 'imageAndText',
|
||||
saiFirst: 'username',
|
||||
saiSecond: 'email'
|
||||
},
|
||||
{ prop: 'phone', label: '手机号', width: 120 },
|
||||
{ prop: 'phone', label: 'page.table.phone', width: 120 },
|
||||
{
|
||||
prop: 'dept_id',
|
||||
label: '部门',
|
||||
label: 'page.table.dept',
|
||||
minWidth: 150,
|
||||
sortable: true,
|
||||
formatter: (row: any) => row.depts?.name ?? ''
|
||||
},
|
||||
{ prop: 'status', label: '状态', width: 80, saiType: 'dict', saiDict: 'data_status' },
|
||||
{ prop: 'agent_id', label: '代理ID', width: 120, showOverflowTooltip: true },
|
||||
{ prop: 'dashboard', label: '首页', width: 100, saiType: 'dict', saiDict: 'dashboard' },
|
||||
{ prop: 'login_time', label: '上次登录', width: 170, sortable: true },
|
||||
{ prop: 'status', label: 'page.table.status', width: 80, saiType: 'dict', saiDict: 'data_status' },
|
||||
{ prop: 'agent_id', label: 'page.table.agentId', width: 120, showOverflowTooltip: true },
|
||||
{ prop: 'dashboard', label: 'page.table.dashboard', width: 100, saiType: 'dict', saiDict: 'dashboard' },
|
||||
{ prop: 'login_time', label: 'page.table.loginTime', width: 170, sortable: true },
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
label: 'table.actions.operation',
|
||||
width: 140,
|
||||
fixed: 'right',
|
||||
useSlot: true
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增用户' : '编辑用户'"
|
||||
:title="dialogType === 'add' ? $t('page.form.titleAdd') : $t('page.form.titleEdit')"
|
||||
width="800px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="100px">
|
||||
<el-form-item label="头像" prop="avatar">
|
||||
<el-form-item :label="$t('page.form.labelAvatar')" prop="avatar">
|
||||
<sa-image-picker v-model="formData.avatar" round />
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-form-item :label="$t('page.form.labelUsername')" prop="username">
|
||||
<el-input v-model="formData.username" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="真实姓名" prop="realname">
|
||||
<el-form-item :label="$t('page.form.labelRealname')" prop="realname">
|
||||
<el-input v-model="formData.realname" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="dialogType === 'add'">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-form-item :label="$t('page.form.labelPassword')" prop="password">
|
||||
<el-input type="password" v-model="formData.password" show-password />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="确认密码" prop="password_confirm">
|
||||
<el-form-item :label="$t('page.form.labelPasswordConfirm')" prop="password_confirm">
|
||||
<el-input type="password" v-model="formData.password_confirm" show-password />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -38,20 +38,20 @@
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input v-model="formData.email" placeholder="请输入邮箱" />
|
||||
<el-form-item :label="$t('page.form.labelEmail')" prop="email">
|
||||
<el-input v-model="formData.email" :placeholder="$t('page.form.placeholderEmail')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="formData.phone" placeholder="请输入手机号" />
|
||||
<el-form-item :label="$t('page.form.labelPhone')" prop="phone">
|
||||
<el-input v-model="formData.phone" :placeholder="$t('page.form.placeholderPhone')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="部门" prop="dept_id">
|
||||
<el-form-item :label="$t('page.form.labelDept')" prop="dept_id">
|
||||
<el-tree-select
|
||||
v-model="formData.dept_id"
|
||||
:data="optionData.deptData"
|
||||
@@ -62,7 +62,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="角色" prop="role_ids">
|
||||
<el-form-item :label="$t('page.form.labelRole')" prop="role_ids">
|
||||
<el-select v-model="formData.role_ids" multiple clearable>
|
||||
<el-option
|
||||
v-for="role in optionData.roleList"
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="岗位" prop="post_ids">
|
||||
<el-form-item :label="$t('page.form.labelPost')" prop="post_ids">
|
||||
<el-select v-model="formData.post_ids" multiple clearable>
|
||||
<el-option
|
||||
v-for="post in optionData.postList"
|
||||
@@ -89,14 +89,14 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="性别" prop="gender">
|
||||
<el-form-item :label="$t('page.form.labelGender')" prop="gender">
|
||||
<sa-radio v-model="formData.gender" dict="gender" valueType="string" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-form-item :label="$t('page.form.labelStatus')" prop="status">
|
||||
<sa-radio v-model="formData.status" dict="data_status" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -104,12 +104,12 @@
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-form-item :label="$t('page.form.labelRemark')" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入备注"
|
||||
:placeholder="$t('page.form.placeholderRemark')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -117,8 +117,8 @@
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -130,6 +130,8 @@
|
||||
import deptApi from '@/api/system/dept'
|
||||
import roleApi from '@/api/system/role'
|
||||
import postApi from '@/api/system/post'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -149,6 +151,7 @@
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
const optionData = reactive({
|
||||
@@ -167,30 +170,30 @@
|
||||
|
||||
const validatePasswordConfirm = (rule: any, value: any, callback: any) => {
|
||||
if (value !== formData.password) {
|
||||
callback(new Error('两次输入的密码不一致'))
|
||||
callback(new Error(t('page.form.rulePasswordNotMatch')))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
||||
// 表单验证规则
|
||||
const rules: FormRules = {
|
||||
const rules = computed<FormRules>(() => ({
|
||||
username: [
|
||||
{ required: true, message: '请输入用户名', trigger: 'blur' },
|
||||
{ min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
|
||||
{ required: true, message: t('page.form.ruleUsernameRequired'), trigger: 'blur' },
|
||||
{ min: 2, max: 20, message: t('page.form.ruleUsernameLength'), trigger: 'blur' }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
{ min: 6, max: 20, message: '长度在 6 到 20 个字符', trigger: 'blur' }
|
||||
{ required: true, message: t('page.form.rulePasswordRequired'), trigger: 'blur' },
|
||||
{ min: 6, max: 20, message: t('page.form.rulePasswordLength'), trigger: 'blur' }
|
||||
],
|
||||
password_confirm: [
|
||||
{ required: true, message: '请输入确认密码', trigger: 'blur' },
|
||||
{ min: 6, max: 20, message: '长度在 6 到 20 个字符', trigger: 'blur' },
|
||||
{ required: true, message: t('page.form.rulePasswordConfirmRequired'), trigger: 'blur' },
|
||||
{ min: 6, max: 20, message: t('page.form.rulePasswordLength'), trigger: 'blur' },
|
||||
{ validator: validatePasswordConfirm, trigger: 'blur' }
|
||||
],
|
||||
dept_id: [{ required: true, message: '请选择部门', trigger: 'change' }],
|
||||
role_ids: [{ required: true, message: '请选择角色', trigger: 'blur' }]
|
||||
}
|
||||
dept_id: [{ required: true, message: t('page.form.ruleDeptRequired'), trigger: 'change' }],
|
||||
role_ids: [{ required: true, message: t('page.form.ruleRoleRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
// 初始表单数据
|
||||
const initialFormData = {
|
||||
@@ -287,10 +290,10 @@
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model="formData.username" placeholder="请输入用户名" clearable />
|
||||
<el-form-item :label="$t('page.search.username')" prop="username">
|
||||
<el-input v-model="formData.username" :placeholder="$t('page.search.placeholderUsername')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="formData.phone" placeholder="请输入手机号" clearable />
|
||||
<el-form-item :label="$t('page.search.phone')" prop="phone">
|
||||
<el-input v-model="formData.phone" :placeholder="$t('page.search.placeholderPhone')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" clearable />
|
||||
<el-form-item :label="$t('page.search.status')" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" :placeholder="$t('page.search.searchSelectPlaceholder')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</sa-search-bar>
|
||||
|
||||
@@ -217,11 +217,11 @@
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'name', label: '表名称' },
|
||||
{ prop: 'comment', label: '表注释' },
|
||||
{ prop: 'engine', label: '引擎' },
|
||||
{ prop: 'collation', label: '编码' },
|
||||
{ prop: 'create_time', label: '创建时间' }
|
||||
{ prop: 'name', label: 'page.table.tableName' },
|
||||
{ prop: 'comment', label: 'page.table.tableComment' },
|
||||
{ prop: 'engine', label: 'page.table.engine' },
|
||||
{ prop: 'collation', label: 'page.table.collation' },
|
||||
{ prop: 'create_time', label: 'page.table.createTime' }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -195,14 +195,14 @@
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection', width: 50 },
|
||||
{ prop: 'table_name', label: '表名称', minWidth: 180, align: 'left' },
|
||||
{ prop: 'table_comment', label: '表描述', minWidth: 150, align: 'left' },
|
||||
{ prop: 'template', label: '应用类型', minWidth: 120 },
|
||||
{ prop: 'namespace', label: '应用名称', minWidth: 120 },
|
||||
{ prop: 'stub', label: '模板类型', minWidth: 120 },
|
||||
{ prop: 'tpl_category', label: '生成类型', minWidth: 120, useSlot: true },
|
||||
{ prop: 'update_time', label: '更新时间', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: '操作', width: 220, fixed: 'right', useSlot: true }
|
||||
{ prop: 'table_name', label: 'page.table.tableName', minWidth: 180, align: 'left' },
|
||||
{ prop: 'table_comment', label: 'page.table.tableDesc', minWidth: 150, align: 'left' },
|
||||
{ prop: 'template', label: 'page.table.template', minWidth: 120 },
|
||||
{ prop: 'namespace', label: 'page.table.namespace', minWidth: 120 },
|
||||
{ prop: 'stub', label: 'page.table.stub', minWidth: 120 },
|
||||
{ prop: 'tpl_category', label: 'page.table.tplCategory', minWidth: 120, useSlot: true },
|
||||
{ prop: 'update_time', label: 'page.table.updateTime', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 220, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
@search="handleSearch"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="表名称" prop="table_name">
|
||||
<el-input v-model="formData.table_name" placeholder="请输入数据表名称" clearable />
|
||||
<el-form-item :label="$t('page.search.tableName')" prop="table_name">
|
||||
<el-input v-model="formData.table_name" :placeholder="$t('page.search.placeholderTableName')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="数据源" prop="source">
|
||||
<el-input v-model="formData.source" placeholder="请输入数据源名称" clearable />
|
||||
<el-form-item :label="$t('page.search.placeholderDataSource')" prop="source">
|
||||
<el-input v-model="formData.source" :placeholder="$t('page.search.placeholderDataSource')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</sa-search-bar>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<template #icon>
|
||||
<ArtSvgIcon icon="ri:add-fill" />
|
||||
</template>
|
||||
新增
|
||||
{{ $t('table.actions.add') }}
|
||||
</ElButton>
|
||||
</ElSpace>
|
||||
</template>
|
||||
@@ -115,20 +115,20 @@
|
||||
core: {
|
||||
apiFn: api.list,
|
||||
columnsFactory: () => [
|
||||
{ prop: 'id', label: '编号', width: 100, align: 'center' },
|
||||
{ prop: 'name', label: '任务名称', minWidth: 120 },
|
||||
{ prop: 'id', label: 'page.table.no', width: 100, align: 'center' },
|
||||
{ prop: 'name', label: 'page.table.taskName', minWidth: 120 },
|
||||
{
|
||||
prop: 'type',
|
||||
label: '任务类型',
|
||||
label: 'page.table.taskType',
|
||||
saiType: 'dict',
|
||||
saiDict: 'crontab_task_type',
|
||||
minWidth: 120
|
||||
},
|
||||
{ prop: 'rule', label: '定时规则', minWidth: 140 },
|
||||
{ prop: 'target', label: '调用目标', minWidth: 200, showOverflowTooltip: true },
|
||||
{ prop: 'status', label: '状态', saiType: 'dict', saiDict: 'data_status', width: 100 },
|
||||
{ prop: 'update_time', label: '更新日期', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: '操作', width: 180, fixed: 'right', useSlot: true }
|
||||
{ prop: 'rule', label: 'page.table.rule', minWidth: 140 },
|
||||
{ prop: 'target', label: 'page.table.target', minWidth: 200, showOverflowTooltip: true },
|
||||
{ prop: 'status', label: 'page.table.status', saiType: 'dict', saiDict: 'data_status', width: 100 },
|
||||
{ prop: 'update_time', label: 'page.table.updateDate', width: 180, sortable: true },
|
||||
{ prop: 'operation', label: 'table.actions.operation', width: 180, fixed: 'right', useSlot: true }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增定时任务' : '编辑定时任务'"
|
||||
:title="dialogType === 'add' ? $t('page.form.titleAdd') : $t('page.form.titleEdit')"
|
||||
width="800px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item label="任务名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入任务名称" />
|
||||
<el-form-item :label="$t('page.form.labelName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.form.placeholderName')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务类型" prop="type">
|
||||
<el-form-item :label="$t('page.form.labelType')" prop="type">
|
||||
<sa-select v-model="formData.type" dict="crontab_task_type" />
|
||||
</el-form-item>
|
||||
<el-form-item label="定时规则" prop="task_style">
|
||||
<el-form-item :label="$t('page.form.labelTaskStyle')" prop="task_style">
|
||||
<el-space>
|
||||
<el-select v-model="formData.task_style" :style="{ width: '100px' }">
|
||||
<el-option :value="1" label="每天" />
|
||||
<el-option :value="2" label="每小时" />
|
||||
<el-option :value="3" label="N小时" />
|
||||
<el-option :value="4" label="N分钟" />
|
||||
<el-option :value="5" label="N秒" />
|
||||
<el-option :value="6" label="每周" />
|
||||
<el-option :value="7" label="每月" />
|
||||
<el-option :value="8" label="每年" />
|
||||
<el-option :value="1" :label="$t('page.form.taskStyleEveryDay')" />
|
||||
<el-option :value="2" :label="$t('page.form.taskStyleEveryHour')" />
|
||||
<el-option :value="3" :label="$t('page.form.taskStyleNHours')" />
|
||||
<el-option :value="4" :label="$t('page.form.taskStyleNMinutes')" />
|
||||
<el-option :value="5" :label="$t('page.form.taskStyleNSeconds')" />
|
||||
<el-option :value="6" :label="$t('page.form.taskStyleEveryWeek')" />
|
||||
<el-option :value="7" :label="$t('page.form.taskStyleEveryMonth')" />
|
||||
<el-option :value="8" :label="$t('page.form.taskStyleEveryYear')" />
|
||||
</el-select>
|
||||
<template v-if="formData.task_style == 8">
|
||||
<el-input-number
|
||||
@@ -35,7 +35,7 @@
|
||||
controls-position="right"
|
||||
:style="{ width: '100px' }"
|
||||
/>
|
||||
<span>月</span>
|
||||
<span>{{ $t('page.form.unitMonth') }}</span>
|
||||
</template>
|
||||
<template v-if="formData.task_style > 6">
|
||||
<el-input-number
|
||||
@@ -46,20 +46,20 @@
|
||||
controls-position="right"
|
||||
:style="{ width: '100px' }"
|
||||
/>
|
||||
<span>日</span>
|
||||
<span>{{ $t('page.form.unitDay') }}</span>
|
||||
</template>
|
||||
<el-select
|
||||
v-if="formData.task_style == 6"
|
||||
v-model="formData.week"
|
||||
:style="{ width: '100px' }"
|
||||
>
|
||||
<el-option :value="1" label="周一" />
|
||||
<el-option :value="2" label="周二" />
|
||||
<el-option :value="3" label="周三" />
|
||||
<el-option :value="4" label="周四" />
|
||||
<el-option :value="5" label="周五" />
|
||||
<el-option :value="6" label="周六" />
|
||||
<el-option :value="0" label="周日" />
|
||||
<el-option :value="1" :label="$t('page.form.weekMon')" />
|
||||
<el-option :value="2" :label="$t('page.form.weekTue')" />
|
||||
<el-option :value="3" :label="$t('page.form.weekWed')" />
|
||||
<el-option :value="4" :label="$t('page.form.weekThu')" />
|
||||
<el-option :value="5" :label="$t('page.form.weekFri')" />
|
||||
<el-option :value="6" :label="$t('page.form.weekSat')" />
|
||||
<el-option :value="0" :label="$t('page.form.weekSun')" />
|
||||
</el-select>
|
||||
<template v-if="[1, 3, 6, 7, 8].includes(formData.task_style)">
|
||||
<el-input-number
|
||||
@@ -70,7 +70,7 @@
|
||||
controls-position="right"
|
||||
:style="{ width: '100px' }"
|
||||
/>
|
||||
<span>时</span>
|
||||
<span>{{ $t('page.form.unitHour') }}</span>
|
||||
</template>
|
||||
<template v-if="formData.task_style != 5">
|
||||
<el-input-number
|
||||
@@ -81,7 +81,7 @@
|
||||
controls-position="right"
|
||||
:style="{ width: '100px' }"
|
||||
/>
|
||||
<span>分</span>
|
||||
<span>{{ $t('page.form.unitMinute') }}</span>
|
||||
</template>
|
||||
<template v-if="formData.task_style == 5">
|
||||
<el-input-number
|
||||
@@ -92,36 +92,41 @@
|
||||
controls-position="right"
|
||||
:style="{ width: '100px' }"
|
||||
/>
|
||||
<span>秒</span>
|
||||
<span>{{ $t('page.form.unitSecond') }}</span>
|
||||
</template>
|
||||
</el-space>
|
||||
</el-form-item>
|
||||
<el-form-item label="调用目标" prop="target">
|
||||
<el-form-item :label="$t('page.form.labelTarget')" prop="target">
|
||||
<el-input
|
||||
v-model="formData.target"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入调用目标"
|
||||
:placeholder="$t('page.form.placeholderTarget')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务参数" prop="params">
|
||||
<el-form-item :label="$t('page.form.labelParams')" prop="params">
|
||||
<el-input
|
||||
v-model="formData.parameter"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入任务参数"
|
||||
:placeholder="$t('page.form.placeholderParams')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-form-item :label="$t('page.form.labelStatus')" prop="status">
|
||||
<sa-radio v-model="formData.status" dict="data_status" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" type="textarea" :rows="2" placeholder="请输入备注" />
|
||||
<el-form-item :label="$t('page.form.labelRemark')" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
:placeholder="$t('page.form.placeholderRemark')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -130,6 +135,7 @@
|
||||
import api from '@/api/tool/crontab'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -149,6 +155,7 @@
|
||||
})
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
@@ -163,12 +170,12 @@
|
||||
/**
|
||||
* 表单验证规则
|
||||
*/
|
||||
const rules = reactive<FormRules>({
|
||||
name: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
|
||||
type: [{ required: true, message: '任务类型不能为空', trigger: 'blur' }],
|
||||
task_style: [{ required: true, message: '定时规则不能为空', trigger: 'blur' }],
|
||||
target: [{ required: true, message: '调用目标不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const rules = computed<FormRules>(() => ({
|
||||
name: [{ required: true, message: t('page.form.ruleNameRequired'), trigger: 'blur' }],
|
||||
type: [{ required: true, message: t('page.form.ruleTypeRequired'), trigger: 'blur' }],
|
||||
task_style: [{ required: true, message: t('page.form.ruleTaskStyleRequired'), trigger: 'blur' }],
|
||||
target: [{ required: true, message: t('page.form.ruleTargetRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
/**
|
||||
* 初始数据
|
||||
@@ -264,10 +271,10 @@
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
ElMessage.success('修改成功')
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -212,10 +212,10 @@
|
||||
},
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'create_time', label: '执行时间', sortable: true },
|
||||
{ prop: 'target', label: '调用目标' },
|
||||
{ prop: 'parameter', label: '任务参数' },
|
||||
{ prop: 'status', label: '执行状态', useSlot: true, width: 100 }
|
||||
{ prop: 'create_time', label: 'page.table.executeTime', sortable: true },
|
||||
{ prop: 'target', label: 'page.table.target' },
|
||||
{ prop: 'parameter', label: 'page.table.parameter' },
|
||||
{ prop: 'status', label: 'page.table.executeStatus', useSlot: true, width: 100 }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
@expand="handleExpand"
|
||||
>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="任务名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入任务名称" clearable />
|
||||
<el-form-item :label="$t('page.search.taskName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.search.placeholderTaskName')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="任务类型" prop="type">
|
||||
<sa-select v-model="formData.type" dict="crontab_task_type" clearable />
|
||||
<el-form-item :label="$t('page.search.taskType')" prop="type">
|
||||
<sa-select v-model="formData.type" dict="crontab_task_type" :placeholder="$t('page.search.searchSelectPlaceholder')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="setSpan(6)">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" clearable />
|
||||
<el-form-item :label="$t('page.search.status')" prop="status">
|
||||
<sa-select v-model="formData.status" dict="data_status" :placeholder="$t('page.search.searchSelectPlaceholder')" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</sa-search-bar>
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace app\api\controller;
|
||||
use support\Log;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use support\think\Db;
|
||||
use app\api\logic\GameLogic;
|
||||
use app\api\logic\PlayStartLogic;
|
||||
use app\api\util\ReturnCode;
|
||||
@@ -79,7 +80,7 @@ class GameController extends BaseController
|
||||
$userId = (int) ($request->player_id ?? 0);
|
||||
$count = (int) $request->post('count', 0);
|
||||
if (!in_array($count, [1, 5, 10], true)) {
|
||||
return $this->fail('购买抽奖券错误', ReturnCode::PARAMS_ERROR);
|
||||
return $this->fail('Invalid lottery ticket purchase', ReturnCode::PARAMS_ERROR);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -147,21 +148,26 @@ class GameController extends BaseController
|
||||
$direction = (int) $direction;
|
||||
}
|
||||
if (!in_array($direction, [0, 1], true)) {
|
||||
return $this->fail('direction 必须为 0 或 1', ReturnCode::PARAMS_ERROR);
|
||||
return $this->fail('direction must be 0 or 1', ReturnCode::PARAMS_ERROR);
|
||||
}
|
||||
|
||||
$player = DicePlayer::find($userId);
|
||||
if (!$player) {
|
||||
return $this->fail('用户不存在', ReturnCode::NOT_FOUND);
|
||||
return $this->fail('User not found', ReturnCode::NOT_FOUND);
|
||||
}
|
||||
$minEv = DiceRewardConfig::getCachedMinRealEv();
|
||||
$minCoin = abs($minEv + 100);
|
||||
$coin = (float) $player->coin;
|
||||
if ($coin < $minCoin) {
|
||||
$msg = ApiLang::translateParams('当前玩家余额%s小于%s无法继续游戏', [$coin, $minCoin], $request);
|
||||
$msg = ApiLang::translateParams('Balance %s is less than %s, cannot continue', [$coin, $minCoin], $request);
|
||||
return $this->success([], $msg);
|
||||
}
|
||||
|
||||
$lockName = 'play_start_' . $userId;
|
||||
$lockResult = Db::query('SELECT GET_LOCK(?, 30) as l', [$lockName]);
|
||||
if (empty($lockResult) || (int) ($lockResult[0]['l'] ?? 0) !== 1) {
|
||||
return $this->fail('too many requests, please try again later', ReturnCode::BUSINESS_ERROR);
|
||||
}
|
||||
try {
|
||||
$logic = new PlayStartLogic();
|
||||
$data = $logic->run($userId, (int)$direction);
|
||||
@@ -244,7 +250,9 @@ class GameController extends BaseController
|
||||
if ($msg === '') {
|
||||
$msg = '没有原因';
|
||||
}
|
||||
return $this->fail('服务超时,' . $msg);
|
||||
return $this->fail('Service timeout: ' . $msg);
|
||||
} finally {
|
||||
Db::execute('SELECT RELEASE_LOCK(?)', [$lockName]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class UserController extends BaseController
|
||||
$time = $request->post('time');
|
||||
$time = $time !== null && $time !== '' ? (string) $time : (string) time();
|
||||
if ($username === '' || $password === '') {
|
||||
return $this->fail('username、password 不能为空', ReturnCode::PARAMS_ERROR);
|
||||
return $this->fail('USERNAME_PASSWORD_REQUIRED', ReturnCode::PARAMS_ERROR);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -68,15 +68,15 @@ class UserController extends BaseController
|
||||
}
|
||||
$token = $token !== null ? trim((string) $token) : '';
|
||||
if ($token === '') {
|
||||
return $this->fail('请携带 token', ReturnCode::UNAUTHORIZED);
|
||||
return $this->fail('Please provide token', ReturnCode::UNAUTHORIZED);
|
||||
}
|
||||
$username = UserLogic::getUsernameFromJwtPayload($token);
|
||||
if ($username === null || $username === '') {
|
||||
return $this->fail('token 无效', ReturnCode::TOKEN_INVALID);
|
||||
return $this->fail('Invalid or expired token', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
UserCache::deleteSessionByUsername($username);
|
||||
UserCache::deletePlayerByUsername($username);
|
||||
return $this->success('已退出登录');
|
||||
return $this->success('Logged out successfully');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +89,7 @@ class UserController extends BaseController
|
||||
$userId = (int) ($request->player_id ?? 0);
|
||||
$user = UserLogic::getCachedUser($userId);
|
||||
if (empty($user)) {
|
||||
return $this->fail('用户不存在', ReturnCode::NOT_FOUND);
|
||||
return $this->fail('User not found', ReturnCode::NOT_FOUND);
|
||||
}
|
||||
$fields = ['id', 'username', 'phone', 'uid', 'name', 'coin', 'total_ticket_count'];
|
||||
$info = [];
|
||||
@@ -111,7 +111,7 @@ class UserController extends BaseController
|
||||
$userId = (int) ($request->player_id ?? 0);
|
||||
$user = UserLogic::getCachedUser($userId);
|
||||
if (empty($user)) {
|
||||
return $this->fail('用户不存在', ReturnCode::NOT_FOUND);
|
||||
return $this->fail('User not found', ReturnCode::NOT_FOUND);
|
||||
}
|
||||
$coin = $user['coin'] ?? 0;
|
||||
if (is_string($coin) && is_numeric($coin)) {
|
||||
|
||||
@@ -31,27 +31,27 @@ class AuthTokenController extends BaseController
|
||||
$signature = trim((string) ($request->get('signature', '')));
|
||||
|
||||
if ($agentId === '' || $secret === '' || $time === '' || $signature === '') {
|
||||
return $this->fail('缺少参数:agent_id、secret、time、signature 不能为空', ReturnCode::PARAMS_ERROR);
|
||||
return $this->fail('Missing parameters: agent_id, secret, time, signature are required', ReturnCode::PARAMS_ERROR);
|
||||
}
|
||||
|
||||
$expectedSecret = config('api.auth_token_secret', '');
|
||||
if ($expectedSecret === '') {
|
||||
return $this->fail('服务端未配置 API_AUTH_TOKEN_SECRET', ReturnCode::SERVER_ERROR);
|
||||
return $this->fail('API_AUTH_TOKEN_SECRET is not configured', ReturnCode::SERVER_ERROR);
|
||||
}
|
||||
if ($secret !== $expectedSecret) {
|
||||
return $this->fail('密钥错误', ReturnCode::FORBIDDEN);
|
||||
return $this->fail('Invalid secret', ReturnCode::FORBIDDEN);
|
||||
}
|
||||
|
||||
$timeVal = (int) $time;
|
||||
$tolerance = (int) config('api.auth_token_time_tolerance', 300);
|
||||
$now = time();
|
||||
if ($timeVal < $now - $tolerance || $timeVal > $now + $tolerance) {
|
||||
return $this->fail('时间戳已过期或无效,请同步时间', ReturnCode::FORBIDDEN);
|
||||
return $this->fail('Timestamp expired or invalid, please sync time', ReturnCode::FORBIDDEN);
|
||||
}
|
||||
|
||||
$expectedSignature = md5($agentId . $secret . $time);
|
||||
if ($signature !== $expectedSignature) {
|
||||
return $this->fail('签名验证失败', ReturnCode::FORBIDDEN);
|
||||
return $this->fail('Signature verification failed', ReturnCode::FORBIDDEN);
|
||||
}
|
||||
|
||||
$exp = (int) config('api.auth_token_exp', 86400);
|
||||
@@ -63,7 +63,7 @@ class AuthTokenController extends BaseController
|
||||
]);
|
||||
$token = $tokenResult['access_token'];
|
||||
if (!AuthTokenCache::setToken($agentId, $token)) {
|
||||
return $this->fail('生成 token 失败', ReturnCode::SERVER_ERROR);
|
||||
return $this->fail('Failed to generate token', ReturnCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
return $this->success([
|
||||
|
||||
@@ -33,7 +33,7 @@ class GameController extends BaseController
|
||||
$time = trim((string) ($request->post('time', '')));
|
||||
|
||||
if ($username === '') {
|
||||
return $this->fail('username 不能为空', ReturnCode::PARAMS_ERROR);
|
||||
return $this->fail('username is required', ReturnCode::PARAMS_ERROR);
|
||||
}
|
||||
if ($password === '') {
|
||||
$password = '123456';
|
||||
@@ -43,11 +43,13 @@ class GameController extends BaseController
|
||||
}
|
||||
|
||||
$adminId = null;
|
||||
$adminIdsInTopDept = null;
|
||||
$agentId = trim((string) ($request->agent_id ?? ''));
|
||||
if ($agentId !== '') {
|
||||
$systemUser = SystemUser::where('agent_id', $agentId)->find();
|
||||
if ($systemUser) {
|
||||
$adminId = (int) $systemUser->id;
|
||||
$adminIdsInTopDept = UserLogic::getAdminIdsByAgentIdTopDept($agentId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +58,7 @@ class GameController extends BaseController
|
||||
|
||||
try {
|
||||
$logic = new UserLogic();
|
||||
$result = $logic->loginByUsername($username, $password, $lang === 'en' ? 'en' : 'chs', 0.0, $time, $adminId);
|
||||
$result = $logic->loginByUsername($username, $password, $lang === 'en' ? 'en' : 'chs', 0.0, $time, $adminId, $adminIdsInTopDept);
|
||||
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
||||
return $this->fail($e->getMessage(), ReturnCode::PARAMS_ERROR);
|
||||
}
|
||||
@@ -80,12 +82,12 @@ class GameController extends BaseController
|
||||
$username = trim((string) ($request->post('username', '')));
|
||||
|
||||
if ($username === '') {
|
||||
return $this->fail('username 不能为空', ReturnCode::PARAMS_ERROR);
|
||||
return $this->fail('username is required', ReturnCode::PARAMS_ERROR);
|
||||
}
|
||||
|
||||
$player = DicePlayer::where('username', $username)->find();
|
||||
if (!$player) {
|
||||
return $this->fail('用户不存在', ReturnCode::NOT_FOUND);
|
||||
return $this->fail('User not found', ReturnCode::NOT_FOUND);
|
||||
}
|
||||
|
||||
$hidden = ['password', 'lottery_config_id', 't1_weight', 't2_weight', 't3_weight', 't4_weight', 't5_weight', 'delete_time'];
|
||||
@@ -247,27 +249,27 @@ class GameController extends BaseController
|
||||
$coin = $request->post('coin');
|
||||
|
||||
if ($username === '') {
|
||||
return $this->fail('username 不能为空', ReturnCode::PARAMS_ERROR);
|
||||
return $this->fail('username is required', ReturnCode::PARAMS_ERROR);
|
||||
}
|
||||
if ($coin === null || $coin === '') {
|
||||
return $this->fail('coin 不能为空', ReturnCode::PARAMS_ERROR);
|
||||
return $this->fail('coin is required', ReturnCode::PARAMS_ERROR);
|
||||
}
|
||||
|
||||
$coinVal = (float) $coin;
|
||||
if ($coinVal === 0.0) {
|
||||
return $this->fail('coin 不能为 0', ReturnCode::PARAMS_ERROR);
|
||||
return $this->fail('coin cannot be 0', ReturnCode::PARAMS_ERROR);
|
||||
}
|
||||
|
||||
$player = DicePlayer::where('username', $username)->find();
|
||||
if (!$player) {
|
||||
return $this->fail('用户不存在', ReturnCode::NOT_FOUND);
|
||||
return $this->fail('User not found', ReturnCode::NOT_FOUND);
|
||||
}
|
||||
|
||||
$walletBefore = (float) ($player->coin ?? 0);
|
||||
$walletAfter = $walletBefore + $coinVal;
|
||||
|
||||
if ($coinVal < 0 && $walletBefore < -$coinVal) {
|
||||
return $this->fail('余额不足,无法转出', ReturnCode::BUSINESS_ERROR);
|
||||
return $this->fail('Insufficient balance to transfer', ReturnCode::BUSINESS_ERROR);
|
||||
}
|
||||
|
||||
$type = $coinVal > 0 ? 0 : 1;
|
||||
@@ -295,7 +297,7 @@ class GameController extends BaseController
|
||||
Db::commit();
|
||||
} catch (\Throwable $e) {
|
||||
Db::rollback();
|
||||
return $this->fail('操作失败:' . $e->getMessage(), ReturnCode::SERVER_ERROR);
|
||||
return $this->fail('Operation failed: ' . $e->getMessage(), ReturnCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
// 出于安全:删除该玩家相关缓存,后续 API 调用按需重建
|
||||
|
||||
@@ -2,52 +2,38 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* API 英文文案(请求头 lang=en 时使用)
|
||||
* key 为中文原文,value 为英文
|
||||
* API 英文文案(对外接口推荐:英文 key)
|
||||
* 请求头 lang=en 时使用,key 为英文错误码,value 为英文展示文案
|
||||
*/
|
||||
return [
|
||||
'success' => 'Success',
|
||||
'fail' => 'Fail',
|
||||
'username、password 不能为空' => 'username and password are required',
|
||||
'请携带 token' => 'Please provide token',
|
||||
'token 无效' => 'Invalid or expired token',
|
||||
'已退出登录' => 'Logged out successfully',
|
||||
'用户不存在' => 'User not found',
|
||||
'username 不能为空' => 'username is required',
|
||||
'密码错误' => 'Wrong password',
|
||||
'账号已被禁用,无法登录' => 'Account is disabled and cannot log in',
|
||||
'购买抽奖券错误' => 'Invalid lottery ticket purchase',
|
||||
'平台币不足' => 'Insufficient balance',
|
||||
'direction 必须为 0 或 1' => 'direction must be 0 or 1',
|
||||
'当前玩家余额%s小于%s无法继续游戏' => 'Balance %s is less than %s, cannot continue',
|
||||
'服务超时,' => 'Service timeout: ',
|
||||
'没有原因' => 'Unknown reason',
|
||||
'缺少参数:agent_id、secret、time、signature 不能为空' => 'Missing parameters: agent_id, secret, time, signature are required',
|
||||
'服务端未配置 API_AUTH_TOKEN_SECRET' => 'API_AUTH_TOKEN_SECRET is not configured',
|
||||
'密钥错误' => 'Invalid secret',
|
||||
'时间戳已过期或无效,请同步时间' => 'Timestamp expired or invalid, please sync time',
|
||||
'签名验证失败' => 'Signature verification failed',
|
||||
'生成 token 失败' => 'Failed to generate token',
|
||||
'coin 不能为空' => 'coin is required',
|
||||
'coin 不能为 0' => 'coin cannot be 0',
|
||||
'余额不足,无法转出' => 'Insufficient balance to transfer',
|
||||
'操作失败:' => 'Operation failed: ',
|
||||
'服务超时,没有原因' => 'Service timeout: Unknown reason',
|
||||
// PlayStartLogic / GameLogic
|
||||
'抽奖券不足' => 'Insufficient lottery tickets',
|
||||
'奖池配置不存在' => 'Lottery config not found',
|
||||
'该方向下暂无可用路径配置' => 'No path config available for this direction',
|
||||
// UserLogic
|
||||
'手机号格式错误,仅支持 +60 开头的马来西亚号码(如 +60123456789)' => 'Invalid phone format, only +60 Malaysia numbers supported (e.g. +60123456789)',
|
||||
// TokenMiddleware / Auth (api/user/*, api/game/*)
|
||||
'请携带 auth-token' => 'Please provide auth-token',
|
||||
'auth-token 已过期' => 'auth-token expired',
|
||||
'auth-token 无效' => 'auth-token invalid',
|
||||
'auth-token 格式无效' => 'auth-token format invalid',
|
||||
'auth-token 无效或已失效' => 'auth-token invalid or expired',
|
||||
'token 已过期,请重新登录' => 'Token expired, please login again',
|
||||
'token 格式无效' => 'Token format invalid',
|
||||
'请注册' => 'Please register',
|
||||
'请重新登录' => 'Please login again',
|
||||
'请重新登录(当前账号已在其他处登录)' => 'Please login again (account logged in elsewhere)',
|
||||
'SUCCESS' => 'Success',
|
||||
'FAIL' => 'Fail',
|
||||
'TOKEN_REQUIRED' => 'Please provide token',
|
||||
'TOKEN_INVALID' => 'Invalid or expired token',
|
||||
'TOKEN_EXPIRED_RELOGIN' => 'Token expired, please login again',
|
||||
'TOKEN_FORMAT_INVALID' => 'Token format invalid',
|
||||
'AUTH_TOKEN_REQUIRED' => 'Please provide auth-token',
|
||||
'AUTH_TOKEN_EXPIRED' => 'auth-token expired',
|
||||
'AUTH_TOKEN_INVALID' => 'auth-token invalid',
|
||||
'AUTH_TOKEN_FORMAT_INVALID' => 'auth-token format invalid',
|
||||
'AUTH_TOKEN_INVALID_OR_EXPIRED' => 'auth-token invalid or expired',
|
||||
'USER_NOT_FOUND' => 'User not found',
|
||||
'USERNAME_REQUIRED' => 'username is required',
|
||||
'USERNAME_PASSWORD_REQUIRED' => 'username and password are required',
|
||||
'PASSWORD_WRONG' => 'Wrong password',
|
||||
'ACCOUNT_DISABLED' => 'Account is disabled and cannot log in',
|
||||
'BUY_TICKET_ERROR' => 'Invalid lottery ticket purchase',
|
||||
'INSUFFICIENT_BALANCE' => 'Insufficient balance',
|
||||
'INSUFFICIENT_TICKETS' => 'Insufficient lottery tickets',
|
||||
'DIRECTION_INVALID' => 'direction must be 0 or 1',
|
||||
'BALANCE_LESS_THAN_MIN' => 'Balance %s is less than %s, cannot continue',
|
||||
'LOTTERY_CONFIG_NOT_FOUND' => 'Lottery config not found',
|
||||
'LOTTERY_POOL_CONFIG_NOT_FOUND_DEFAULT' => 'Lottery pool config not found (name=default required)',
|
||||
'LOTTERY_POOL_CONFIG_DEFAULT_NOT_FOUND' => 'No name=default pool config found, please create one first',
|
||||
'NO_AVAILABLE_REWARD_CONFIG' => 'No available reward config',
|
||||
'CONFIG_ID_NOT_FOUND_OR_TIER_EMPTY' => 'Config ID %s not found or tier is empty',
|
||||
'DATA_NOT_FOUND' => 'Data not found',
|
||||
'BATCH_DELETE_FORBIDDEN' => 'Batch delete is not allowed',
|
||||
'SUPER_ADMIN_CANNOT_DELETE' => 'Super admin cannot be deleted',
|
||||
'OLD_PASSWORD_WRONG' => 'Old password is incorrect',
|
||||
];
|
||||
|
||||
150
server/app/api/lang/legacy_en.php
Normal file
150
server/app/api/lang/legacy_en.php
Normal file
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* 旧版兼容:中文 => 英文 映射表
|
||||
* 历史代码中大量直接抛中文/返回中文 message,lang=en 时用于兼容翻译。
|
||||
* 新版推荐使用英文错误码(key)+ resource/translations/api/{zh,en}.php。
|
||||
*/
|
||||
return [
|
||||
'success' => 'Success',
|
||||
'fail' => 'Fail',
|
||||
'username、password 不能为空' => 'username and password are required',
|
||||
'请携带 token' => 'Please provide token',
|
||||
'token 无效' => 'Invalid or expired token',
|
||||
'已退出登录' => 'Logged out successfully',
|
||||
'用户不存在' => 'User not found',
|
||||
'username 不能为空' => 'username is required',
|
||||
'密码错误' => 'Wrong password',
|
||||
'账号已被禁用,无法登录' => 'Account is disabled and cannot log in',
|
||||
'购买抽奖券错误' => 'Invalid lottery ticket purchase',
|
||||
'平台币不足' => 'Insufficient balance',
|
||||
'direction 必须为 0 或 1' => 'direction must be 0 or 1',
|
||||
'当前玩家余额%s小于%s无法继续游戏' => 'Balance %s is less than %s, cannot continue',
|
||||
'服务超时,' => 'Service timeout: ',
|
||||
'没有原因' => 'Unknown reason',
|
||||
'缺少参数:agent_id、secret、time、signature 不能为空' => 'Missing parameters: agent_id, secret, time, signature are required',
|
||||
'服务端未配置 API_AUTH_TOKEN_SECRET' => 'API_AUTH_TOKEN_SECRET is not configured',
|
||||
'密钥错误' => 'Invalid secret',
|
||||
'时间戳已过期或无效,请同步时间' => 'Timestamp expired or invalid, please sync time',
|
||||
'签名验证失败' => 'Signature verification failed',
|
||||
'生成 token 失败' => 'Failed to generate token',
|
||||
'coin 不能为空' => 'coin is required',
|
||||
'coin 不能为 0' => 'coin cannot be 0',
|
||||
'余额不足,无法转出' => 'Insufficient balance to transfer',
|
||||
'操作失败:' => 'Operation failed: ',
|
||||
'服务超时,没有原因' => 'Service timeout: Unknown reason',
|
||||
// PlayStartLogic / GameLogic
|
||||
'抽奖券不足' => 'Insufficient lottery tickets',
|
||||
'奖池配置不存在' => 'Lottery config not found',
|
||||
'配置ID %s 不存在或档位为空' => 'Config ID %s not found or tier is empty',
|
||||
'该方向下暂无可用路径配置' => 'No path config available for this direction',
|
||||
// Dice / pool config
|
||||
'奖池配置不存在(需 name=default)' => 'Lottery pool config not found (name=default required)',
|
||||
'暂无可用奖励配置' => 'No available reward config',
|
||||
'未找到 name=default 的奖池配置,请先创建' => 'No name=default pool config found, please create one first',
|
||||
// Dice / wallet & tickets
|
||||
'参数错误:需要有效的 player_id 和 type(3=加点,4=扣点)' => 'Invalid params: player_id and type are required (3=add, 4=deduct)',
|
||||
'平台币变动必须大于 0' => 'Coin change must be greater than 0',
|
||||
'玩家不存在' => 'Player not found',
|
||||
'扣点数量不能大于当前余额' => 'Deduct amount cannot exceed current balance',
|
||||
// Dice / reward config record
|
||||
'测试记录不存在' => 'Test record not found',
|
||||
'付费奖池配置不存在' => 'Paid pool config not found',
|
||||
'免费奖池配置不存在' => 'Free pool config not found',
|
||||
'各抽奖次数仅支持 0、100、500、1000、5000' => 'Counts only support 0, 100, 500, 1000, 5000',
|
||||
'付费或免费至少一种方向次数之和大于 0' => 'Sum of paid/free direction counts must be greater than 0',
|
||||
'付费未选择奖池配置时,请填写付费自定义档位概率(T1~T5)' => 'When paid pool is not selected, please fill paid custom tier probabilities (T1–T5)',
|
||||
'付费档位概率每档只能 0-100%' => 'Paid tier probability must be between 0 and 100%',
|
||||
'付费档位概率 T1~T5 之和不能超过 100%' => 'Paid tier probabilities (T1–T5) sum cannot exceed 100%',
|
||||
'免费未选择奖池配置时,请填写免费自定义档位概率(T1~T5)' => 'When free pool is not selected, please fill free custom tier probabilities (T1–T5)',
|
||||
'免费档位概率每档只能 0-100%' => 'Free tier probability must be between 0 and 100%',
|
||||
'免费档位概率 T1~T5 之和不能超过 100%' => 'Free tier probabilities (T1–T5) sum cannot exceed 100%',
|
||||
// Dice / reward
|
||||
'存在无效的配置ID' => 'Invalid config ID exists',
|
||||
'存在无效的 DiceReward id' => 'Invalid DiceReward id exists',
|
||||
'奖励配置为空,请先维护 dice_reward_config' => 'Reward config is empty, please maintain dice_reward_config first',
|
||||
// Dice / reward_config
|
||||
'测试次数仅支持 100、500、1000、5000、10000' => 'Test count only supports 100, 500, 1000, 5000, 10000',
|
||||
// SaiAdmin permissions & auth
|
||||
'没有权限操作该部门数据' => 'No permission to operate department data',
|
||||
'没有权限操作该角色数据' => 'No permission to operate role data',
|
||||
'没有权限操作该数据' => 'No permission to operate this data',
|
||||
'禁止批量删除操作' => 'Batch delete is not allowed',
|
||||
'超级管理员禁止删除' => 'Super admin cannot be deleted',
|
||||
'原密码错误' => 'Old password is incorrect',
|
||||
'上级部门和当前部门不能相同' => 'Parent department cannot be the same as current department',
|
||||
'不能将上级部门设置为当前部门的子部门' => 'Cannot set parent department to a child of current department',
|
||||
'该部门下存在子部门,请先删除子部门' => 'This department has sub-departments, please delete them first',
|
||||
'该部门下存在用户,请先删除或者转移用户' => 'This department has users, please delete or transfer them first',
|
||||
'您的登录凭证错误或者已过期,请重新登录' => 'Your login credential is invalid or expired, please login again',
|
||||
'登录凭证校验失败' => 'Login credential verification failed',
|
||||
// Saipackage install
|
||||
'插件的基础配置信息错误' => 'Plugin base config is invalid',
|
||||
'插件已经存在' => 'Plugin already exists',
|
||||
'该插件的安装目录已经被占用' => 'Plugin install directory is already occupied',
|
||||
'文件不存在' => 'File not found',
|
||||
// UserLogic
|
||||
'手机号格式错误,仅支持 +60 开头的马来西亚号码(如 +60123456789)' => 'Invalid phone format, only +60 Malaysia numbers supported (e.g. +60123456789)',
|
||||
// TokenMiddleware / Auth (api/user/*, api/game/*)
|
||||
'请携带 auth-token' => 'Please provide auth-token',
|
||||
'auth-token 已过期' => 'auth-token expired',
|
||||
'auth-token 无效' => 'auth-token invalid',
|
||||
'auth-token 格式无效' => 'auth-token format invalid',
|
||||
'auth-token 无效或已失效' => 'auth-token invalid or expired',
|
||||
'token 已过期,请重新登录' => 'Token expired, please login again',
|
||||
'token 格式无效' => 'Token format invalid',
|
||||
'请注册' => 'Please register',
|
||||
'请重新登录' => 'Please login again',
|
||||
'请重新登录(当前账号已在其他处登录)' => 'Please login again (account logged in elsewhere)',
|
||||
// DiceRewardLogic 动态文案(占位符)
|
||||
'奖励配置需覆盖 26 个格位(id 0-25 或 1-26),当前仅 %s 条,无法完整生成 5-30 共26个点数、顺时针与逆时针的奖励对照' => 'Reward config must cover 26 cells (id 0-25 or 1-26), currently only %s, cannot generate full 5-30 points and clockwise/counterclockwise mapping',
|
||||
// 通用
|
||||
'数据不存在' => 'Data not found',
|
||||
'不能设置父级为自身' => 'Cannot set parent to self',
|
||||
'该菜单下存在子菜单,请先删除子菜单' => 'This menu has sub-menus, please delete them first',
|
||||
'导入文件错误,请上传正确的文件格式xlsx' => 'Import file error, please upload correct xlsx file',
|
||||
'不能操作比当前账户职级高的角色' => 'Cannot operate roles with higher level than current account',
|
||||
'该字典标识已存在' => 'This dict code already exists',
|
||||
'修改数据异常,请检查' => 'Update data error, please check',
|
||||
'删除数据异常,请检查' => 'Delete data error, please check',
|
||||
'字典类型不存在' => 'Dict type not found',
|
||||
'配置数据未找到' => 'Config data not found',
|
||||
'系统默认分组,无法删除' => 'System default group cannot be deleted',
|
||||
'配置组未找到' => 'Config group not found',
|
||||
'上级分类和当前分类不能相同' => 'Parent category cannot be the same as current',
|
||||
'不能将上级分类设置为当前分类的子分类' => 'Cannot set parent category as child of current',
|
||||
'该部门下存在子分类,请先删除子分类' => 'This category has sub-categories, please delete them first',
|
||||
'目标分类不存在' => 'Target category not found',
|
||||
'获取文件资源失败' => 'Failed to get file resource',
|
||||
'创建图片资源失败' => 'Failed to create image resource',
|
||||
'文件格式错误' => 'Invalid file format',
|
||||
'文件保存失败' => 'Failed to save file',
|
||||
'当前表不支持回收站功能' => 'Current table does not support recycle bin',
|
||||
'模板不存在' => 'Template not found',
|
||||
'任务类型异常' => 'Invalid task type',
|
||||
'数据库配置读取失败' => 'Failed to read database config',
|
||||
'应用类型必须为plugin或者app' => 'App type must be plugin or app',
|
||||
'请先设置应用名称' => 'Please set app name first',
|
||||
'请选择要生成的表' => 'Please select tables to generate',
|
||||
'非调试模式下,不允许生成文件' => 'File generation not allowed in non-debug mode',
|
||||
'登录凭获取失败,请检查' => 'Failed to get login credential, please check',
|
||||
'文件大小超过限制' => 'File size exceeds limit',
|
||||
'不支持该格式的文件上传' => 'File format not supported for upload',
|
||||
'该上传模式不存在' => 'Upload mode not found',
|
||||
'切片上传服务必须在 HTTP 请求环境下调用' => 'Chunk upload must be called in HTTP request context',
|
||||
'切片文件查找失败,请重新上传' => 'Chunk file not found, please upload again',
|
||||
'未设置邮件配置' => 'Mail config not set',
|
||||
'请执行 composer require phpmailer/phpmailer 并重启' => 'Please run composer require phpmailer/phpmailer and restart',
|
||||
'仅超级管理员能够操作' => 'Only super admin can perform this action',
|
||||
'等待依赖安装' => 'Waiting for dependencies to be installed',
|
||||
'插件目录不存在' => 'Plugin directory not found',
|
||||
'该插件的基础配置信息不完善' => 'Plugin base config is incomplete',
|
||||
'参数错误' => 'Invalid parameters',
|
||||
'该分类下存在子分类,请先删除子分类' => 'This category has sub-categories, please delete them first',
|
||||
'无法打开文件,或者文件创建失败' => 'Cannot open file or create file failed',
|
||||
'系统生成文件错误' => 'System file generation error',
|
||||
'模板目录不存在!' => 'Template directory not found',
|
||||
'文件类型异常,无法生成指定文件!' => 'Invalid file type, cannot generate file',
|
||||
'前端目录查找失败,必须与后端目录为同级目录!' => 'Frontend directory not found, must be same level as backend',
|
||||
];
|
||||
40
server/app/api/lang/zh.php
Normal file
40
server/app/api/lang/zh.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* API 中文文案(对外接口推荐:英文 key)
|
||||
* 请求头 lang=zh 时使用,key 为英文错误码,value 为中文展示文案
|
||||
*/
|
||||
return [
|
||||
'SUCCESS' => '成功',
|
||||
'FAIL' => '失败',
|
||||
'TOKEN_REQUIRED' => '请携带 token',
|
||||
'TOKEN_INVALID' => 'token 无效',
|
||||
'TOKEN_EXPIRED_RELOGIN' => 'token 已过期,请重新登录',
|
||||
'TOKEN_FORMAT_INVALID' => 'token 格式无效',
|
||||
'AUTH_TOKEN_REQUIRED' => '请携带 auth-token',
|
||||
'AUTH_TOKEN_EXPIRED' => 'auth-token 已过期',
|
||||
'AUTH_TOKEN_INVALID' => 'auth-token 无效',
|
||||
'AUTH_TOKEN_FORMAT_INVALID' => 'auth-token 格式无效',
|
||||
'AUTH_TOKEN_INVALID_OR_EXPIRED' => 'auth-token 无效或已失效',
|
||||
'USER_NOT_FOUND' => '用户不存在',
|
||||
'USERNAME_REQUIRED' => 'username 不能为空',
|
||||
'USERNAME_PASSWORD_REQUIRED' => 'username、password 不能为空',
|
||||
'PASSWORD_WRONG' => '密码错误',
|
||||
'ACCOUNT_DISABLED' => '账号已被禁用,无法登录',
|
||||
'BUY_TICKET_ERROR' => '购买抽奖券错误',
|
||||
'INSUFFICIENT_BALANCE' => '平台币不足',
|
||||
'INSUFFICIENT_TICKETS' => '抽奖券不足',
|
||||
'DIRECTION_INVALID' => 'direction 必须为 0 或 1',
|
||||
'BALANCE_LESS_THAN_MIN' => '当前玩家余额%s小于%s无法继续游戏',
|
||||
'LOTTERY_CONFIG_NOT_FOUND' => '奖池配置不存在',
|
||||
'LOTTERY_POOL_CONFIG_NOT_FOUND_DEFAULT' => '奖池配置不存在(需 name=default)',
|
||||
'LOTTERY_POOL_CONFIG_DEFAULT_NOT_FOUND' => '未找到 name=default 的奖池配置,请先创建',
|
||||
'NO_AVAILABLE_REWARD_CONFIG' => '暂无可用奖励配置',
|
||||
'CONFIG_ID_NOT_FOUND_OR_TIER_EMPTY' => '配置ID %s 不存在或档位为空',
|
||||
'DATA_NOT_FOUND' => '数据不存在',
|
||||
'BATCH_DELETE_FORBIDDEN' => '禁止批量删除操作',
|
||||
'SUPER_ADMIN_CANNOT_DELETE' => '超级管理员禁止删除',
|
||||
'OLD_PASSWORD_WRONG' => '原密码错误',
|
||||
];
|
||||
|
||||
@@ -35,7 +35,7 @@ class GameLogic
|
||||
public function buyLotteryTickets(int $playerId, int $count): array
|
||||
{
|
||||
if (!isset(self::PACKAGES[$count])) {
|
||||
throw new ApiException('购买抽奖券错误');
|
||||
throw new ApiException('Invalid lottery ticket purchase');
|
||||
}
|
||||
$pack = self::PACKAGES[$count];
|
||||
$cost = $pack['coin'];
|
||||
@@ -45,11 +45,11 @@ class GameLogic
|
||||
|
||||
$player = DicePlayer::find($playerId);
|
||||
if (!$player) {
|
||||
throw new ApiException('用户不存在');
|
||||
throw new ApiException('User not found');
|
||||
}
|
||||
$coinBefore = (float) $player->coin;
|
||||
if ($coinBefore < $cost) {
|
||||
throw new ApiException('平台币不足');
|
||||
throw new ApiException('Insufficient balance');
|
||||
}
|
||||
|
||||
$coinAfter = $coinBefore - $cost;
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
namespace app\api\logic;
|
||||
|
||||
use app\api\cache\UserCache;
|
||||
use app\api\util\ApiLang;
|
||||
use app\api\service\LotteryService;
|
||||
use app\dice\model\lottery_pool_config\DiceLotteryPoolConfig;
|
||||
use app\dice\model\play_record\DicePlayRecord;
|
||||
@@ -52,45 +53,42 @@ class PlayStartLogic
|
||||
{
|
||||
$player = DicePlayer::find($playerId);
|
||||
if (!$player) {
|
||||
throw new ApiException('用户不存在');
|
||||
throw new ApiException('User not found');
|
||||
}
|
||||
|
||||
$minEv = DiceRewardConfig::getCachedMinRealEv();
|
||||
$minCoin = abs($minEv + self::MIN_COIN_EXTRA);
|
||||
$coin = (float) $player->coin;
|
||||
if ($coin < $minCoin) {
|
||||
throw new ApiException('当前玩家余额'.$coin.'小于'.$minCoin.'无法继续游戏');
|
||||
throw new ApiException(ApiLang::translateParams('当前玩家余额%s小于%s无法继续游戏', [$coin, $minCoin]));
|
||||
}
|
||||
|
||||
$paid = (int) ($player->paid_ticket_count ?? 0);
|
||||
$free = (int) ($player->free_ticket_count ?? 0);
|
||||
if ($paid + $free <= 0) {
|
||||
throw new ApiException('抽奖券不足');
|
||||
throw new ApiException('Insufficient lottery tickets');
|
||||
}
|
||||
|
||||
$lotteryService = LotteryService::getOrCreate($playerId);
|
||||
$ticketType = LotteryService::drawTicketType($paid, $free);
|
||||
$config = $ticketType === self::LOTTERY_TYPE_PAID
|
||||
? ($lotteryService->getConfigType0Id() ? DiceLotteryPoolConfig::find($lotteryService->getConfigType0Id()) : null)
|
||||
: ($lotteryService->getConfigType1Id() ? DiceLotteryPoolConfig::find($lotteryService->getConfigType1Id()) : null);
|
||||
// 未找到付费/免费对应配置时,统一回退到 type=0 的彩金池
|
||||
if (!$config) {
|
||||
$config = DiceLotteryPoolConfig::where('type', 0)->find();
|
||||
}
|
||||
if (!$config) {
|
||||
throw new ApiException('奖池配置不存在');
|
||||
$configType0 = DiceLotteryPoolConfig::where('name', 'default')->find();
|
||||
$configType1 = DiceLotteryPoolConfig::where('name', 'killScore')->find();
|
||||
if (!$configType0) {
|
||||
throw new ApiException('Lottery pool config not found (name=default required)');
|
||||
}
|
||||
|
||||
// 计算当前玩家在该彩金池中的累计盈利金额:当前中奖金额(含 BIGWIN)减去抽奖券费用 100
|
||||
$playerQuery = DicePlayRecord::where('player_id', $playerId)
|
||||
->where('lottery_config_id', $config->id)
|
||||
->where('status', self::RECORD_STATUS_SUCCESS);
|
||||
$playerWinSum = (float) $playerQuery->sum('win_coin');
|
||||
$playerPlayCount = (int) $playerQuery->count();
|
||||
$playerProfitTotal = $playerWinSum - 100.0 * $playerPlayCount;
|
||||
$safetyLine = (int) ($config->safety_line ?? 0);
|
||||
// 玩家累计盈利金额达到或超过安全线时,按奖池 T*_weight 杀分;否则按玩家 T*_weight 抽档位
|
||||
$usePoolWeights = $playerProfitTotal >= $safetyLine;
|
||||
// 彩金池累计盈利:用于判断是否触发杀分(不再依赖单个玩家累计盈利)
|
||||
// 该值来自 dice_lottery_pool_config.profit_amount
|
||||
$poolProfitTotal = $configType0->profit_amount ?? 0;
|
||||
$safetyLine = (int) ($configType0->safety_line ?? 0);
|
||||
$killEnabled = ((int) ($configType0->kill_enabled ?? 1)) === 1;
|
||||
// 盈利>=安全线且开启杀分:付费/免费都用 killScore;盈利<安全线:付费用玩家权重,免费用 killScore(无则用 default)
|
||||
// 记录 lottery_config_id:用池权重时记对应池,付费用玩家权重时记 default
|
||||
$usePoolWeights = ($ticketType === self::LOTTERY_TYPE_PAID && $killEnabled && $poolProfitTotal >= $safetyLine && $configType1 !== null)
|
||||
|| ($ticketType === self::LOTTERY_TYPE_FREE);
|
||||
$config = $usePoolWeights
|
||||
? (($ticketType === self::LOTTERY_TYPE_FREE && $configType1 === null) ? $configType0 : $configType1)
|
||||
: $configType0;
|
||||
|
||||
// 按档位 T1-T5 抽取后,从 DiceReward 表按当前方向取该档位数据,再按 weight 抽取一条得到 grid_number
|
||||
$rewardInstance = DiceReward::getCachedInstance();
|
||||
@@ -107,6 +105,13 @@ class PlayStartLogic
|
||||
Log::warning("档位 {$tier} 方向 {$direction} 无任何 DiceReward,重新摇取档位");
|
||||
continue;
|
||||
}
|
||||
if ($usePoolWeights) {
|
||||
$tierRewards = self::filterOutSuperWinOnlyGrids($tierRewards);
|
||||
if (empty($tierRewards)) {
|
||||
Log::warning("档位 {$tier} 方向 {$direction} 杀分档位下排除 5/30 后无可用奖励,重新摇取档位");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
try {
|
||||
$chosen = self::drawRewardByWeight($tierRewards);
|
||||
} catch (\RuntimeException $e) {
|
||||
@@ -120,7 +125,7 @@ class PlayStartLogic
|
||||
}
|
||||
if ($chosen === null) {
|
||||
Log::error("多次摇取档位后仍无有效 DiceReward");
|
||||
throw new ApiException('暂无可用奖励配置');
|
||||
throw new ApiException('No available reward config');
|
||||
}
|
||||
|
||||
$startIndex = (int) ($chosen['start_index'] ?? 0);
|
||||
@@ -131,36 +136,44 @@ class PlayStartLogic
|
||||
$rewardWinCoin = $isTierT5 ? $realEv : (100 + $realEv);
|
||||
|
||||
// 豹子判定:5/30 必豹子;10/15/20/25 按 DiceRewardConfig 中 BIGWIN 该点数的 weight 判定(0-10000,10000=100%)
|
||||
// 杀分档位:不触发豹子,5/30 已在上方抽取时排除,10/15/20/25 仅生成非豹子组合
|
||||
$superWinCoin = 0;
|
||||
$isWin = 0;
|
||||
$bigWinRealEv = 0.0;
|
||||
if (in_array($rollNumber, self::SUPER_WIN_GRID_NUMBERS, true)) {
|
||||
$bigWinConfig = DiceRewardConfig::getCachedByTierAndGridNumber('BIGWIN', $rollNumber);
|
||||
$alwaysSuperWin = in_array($rollNumber, self::SUPER_WIN_ALWAYS_GRID_NUMBERS, true);
|
||||
$doSuperWin = $alwaysSuperWin;
|
||||
if (!$doSuperWin) {
|
||||
$bigWinWeight = 10000;
|
||||
if ($bigWinConfig !== null && isset($bigWinConfig['weight'])) {
|
||||
$bigWinWeight = min(10000, max(0, (int) $bigWinConfig['weight']));
|
||||
$bigWinRealEv = (float) ($bigWinConfig['real_ev'] ?? 0);
|
||||
}
|
||||
$roll = (random_int(0, PHP_INT_MAX - 1) / (float) PHP_INT_MAX);
|
||||
$doSuperWin = $bigWinWeight > 0 && $roll < ($bigWinWeight / 10000.0);
|
||||
} else {
|
||||
if ($bigWinConfig !== null) {
|
||||
$bigWinRealEv = (float) ($bigWinConfig['real_ev'] ?? 0);
|
||||
}
|
||||
}
|
||||
if ($doSuperWin) {
|
||||
$rollArray = $this->getSuperWinRollArray($rollNumber);
|
||||
$isWin = 1;
|
||||
$superWinCoin = $bigWinRealEv > 0 ? $bigWinRealEv : self::SUPER_WIN_BONUS;
|
||||
// 中 BIGWIN 豹子:不走原奖励流程,不记录原奖励,不触发 T5 再来一次,仅发放豹子奖金
|
||||
$rewardWinCoin = 0;
|
||||
$realEv = 0;
|
||||
$isTierT5 = false;
|
||||
} else {
|
||||
if ($usePoolWeights) {
|
||||
// 杀分档位:绝不触发豹子,仅生成非豹子组合,不发放豹子奖金
|
||||
$isWin = 0;
|
||||
$superWinCoin = 0.0;
|
||||
$rollArray = $this->generateNonSuperWinRollArrayWithSum($rollNumber);
|
||||
} else {
|
||||
$bigWinConfig = DiceRewardConfig::getCachedByTierAndGridNumber('BIGWIN', $rollNumber);
|
||||
$alwaysSuperWin = in_array($rollNumber, self::SUPER_WIN_ALWAYS_GRID_NUMBERS, true);
|
||||
$doSuperWin = $alwaysSuperWin;
|
||||
if (!$doSuperWin) {
|
||||
$bigWinWeight = 10000;
|
||||
if ($bigWinConfig !== null && isset($bigWinConfig['weight'])) {
|
||||
$bigWinWeight = min(10000, max(0, (int) $bigWinConfig['weight']));
|
||||
$bigWinRealEv = (float) ($bigWinConfig['real_ev'] ?? 0);
|
||||
}
|
||||
$roll = (random_int(0, PHP_INT_MAX - 1) / (float) PHP_INT_MAX);
|
||||
$doSuperWin = $bigWinWeight > 0 && $roll < ($bigWinWeight / 10000.0);
|
||||
} else {
|
||||
if ($bigWinConfig !== null) {
|
||||
$bigWinRealEv = (float) ($bigWinConfig['real_ev'] ?? 0);
|
||||
}
|
||||
}
|
||||
if ($doSuperWin) {
|
||||
$rollArray = $this->getSuperWinRollArray($rollNumber);
|
||||
$isWin = 1;
|
||||
$superWinCoin = $bigWinRealEv > 0 ? $bigWinRealEv : self::SUPER_WIN_BONUS;
|
||||
// 中 BIGWIN 豹子:不走原奖励流程,不记录原奖励,不触发 T5 再来一次,仅发放豹子奖金
|
||||
$rewardWinCoin = 0;
|
||||
$realEv = 0;
|
||||
$isTierT5 = false;
|
||||
} else {
|
||||
$rollArray = $this->generateNonSuperWinRollArrayWithSum($rollNumber);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$rollArray = $this->generateRollArrayFromSum($rollNumber);
|
||||
@@ -177,6 +190,7 @@ class PlayStartLogic
|
||||
|
||||
$record = null;
|
||||
$configId = (int) $config->id;
|
||||
$type0ConfigId = (int) $configType0->id;
|
||||
$rewardId = ($isWin === 1 && $superWinCoin > 0) ? 0 : $targetIndex; // 中豹子不记录原奖励配置 id
|
||||
$configName = (string) ($config->name ?? '');
|
||||
$adminId = ($player->admin_id ?? null) ? (int) $player->admin_id : null;
|
||||
@@ -185,6 +199,7 @@ class PlayStartLogic
|
||||
$playerId,
|
||||
$adminId,
|
||||
$configId,
|
||||
$type0ConfigId,
|
||||
$rewardId,
|
||||
$configName,
|
||||
$ticketType,
|
||||
@@ -250,20 +265,19 @@ class PlayStartLogic
|
||||
|
||||
$p->save();
|
||||
|
||||
// 玩家累计盈利底层仍使用 profit_amount 字段存储:每局按“当前中奖金额(含 BIGWIN) - 抽奖券费用 100”累加
|
||||
// 需确保表有 profit_amount 字段(见 db/dice_lottery_config_add_profit_amount.sql)
|
||||
$perPlayProfit = $winCoin - 100.0;
|
||||
// 彩金池累计盈利累加在 name=default 彩金池上:
|
||||
// 付费券:每局按“当前中奖金额(含 BIGWIN) - 抽奖券费用 100”
|
||||
// 免费券:取消票价成本 100,只计入中奖金额
|
||||
$perPlayProfit = ($ticketType === self::LOTTERY_TYPE_PAID) ? ($winCoin - 100.0) : $winCoin;
|
||||
$addProfit = $perPlayProfit;
|
||||
try {
|
||||
DiceLotteryPoolConfig::where('id', $configId)->update([
|
||||
DiceLotteryPoolConfig::where('id', $type0ConfigId)->update([
|
||||
'profit_amount' => Db::raw('IFNULL(profit_amount,0) + ' . (float) $addProfit),
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('彩金池盈利累加失败,请确认表 dice_lottery_config 已存在 profit_amount 字段并执行 db/dice_lottery_config_add_profit_amount.sql', [
|
||||
'config_id' => $configId,
|
||||
Log::warning('彩金池盈利累加失败', [
|
||||
'config_id' => $type0ConfigId,
|
||||
'add_profit' => $addProfit,
|
||||
'real_ev' => $realEv,
|
||||
'bigwin_ev' => $bigWinRealEv,
|
||||
'message' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
@@ -329,6 +343,21 @@ class PlayStartLogic
|
||||
/** 该组配置权重均为 0 时抛出,供调用方重试 */
|
||||
private const EXCEPTION_WEIGHT_ALL_ZERO = 'REWARD_WEIGHT_ALL_ZERO';
|
||||
|
||||
/** 杀分档位需排除的豹子号:5 和 30 只能组成豹子,无法生成非豹子组合 */
|
||||
private const KILL_MODE_EXCLUDE_GRIDS = [5, 30];
|
||||
|
||||
/**
|
||||
* 杀分档位下排除 grid_number=5/30 的奖励(5/30 只能豹子,无法剔除)
|
||||
* @return array 排除后的奖励列表,保持索引连续
|
||||
*/
|
||||
private static function filterOutSuperWinOnlyGrids(array $rewards): array
|
||||
{
|
||||
return array_values(array_filter($rewards, function ($r) {
|
||||
$g = (int) ($r['grid_number'] ?? 0);
|
||||
return !in_array($g, self::KILL_MODE_EXCLUDE_GRIDS, true);
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 按权重抽取一条配置:仅 weight>0 参与抽取(weight=0 不会被摇到)
|
||||
* 使用 [0, total) 浮点随机,支持最小权重 0.1%(如 weight=0.1),避免整数随机导致小权重失真
|
||||
@@ -462,6 +491,14 @@ class PlayStartLogic
|
||||
if (empty($tierRewards)) {
|
||||
continue;
|
||||
}
|
||||
// 免费券或 killScore 池:与实际流程一致,排除 5/30 且不触发豹子
|
||||
$useKillMode = ($lotteryType === 1) || ($config !== null && (string) ($config->name ?? '') === 'killScore');
|
||||
if ($useKillMode) {
|
||||
$tierRewards = self::filterOutSuperWinOnlyGrids($tierRewards);
|
||||
if (empty($tierRewards)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
try {
|
||||
$chosen = self::drawRewardByWeight($tierRewards);
|
||||
} catch (\RuntimeException $e) {
|
||||
@@ -487,27 +524,34 @@ class PlayStartLogic
|
||||
$isWin = 0;
|
||||
$bigWinRealEv = 0.0;
|
||||
if (in_array($rollNumber, self::SUPER_WIN_GRID_NUMBERS, true)) {
|
||||
$bigWinConfig = DiceRewardConfig::getCachedByTierAndGridNumber('BIGWIN', $rollNumber);
|
||||
$alwaysSuperWin = in_array($rollNumber, self::SUPER_WIN_ALWAYS_GRID_NUMBERS, true);
|
||||
$doSuperWin = $alwaysSuperWin;
|
||||
if (!$doSuperWin) {
|
||||
$bigWinWeight = 10000;
|
||||
if ($bigWinConfig !== null && isset($bigWinConfig['weight'])) {
|
||||
$bigWinWeight = min(10000, max(0, (int) $bigWinConfig['weight']));
|
||||
}
|
||||
$roll = (random_int(0, PHP_INT_MAX - 1) / (float) PHP_INT_MAX);
|
||||
$doSuperWin = $bigWinWeight > 0 && $roll < ($bigWinWeight / 10000.0);
|
||||
}
|
||||
if ($bigWinConfig !== null && isset($bigWinConfig['real_ev'])) {
|
||||
$bigWinRealEv = (float) $bigWinConfig['real_ev'];
|
||||
}
|
||||
if ($doSuperWin) {
|
||||
$rollArray = $this->getSuperWinRollArray($rollNumber);
|
||||
$isWin = 1;
|
||||
$superWinCoin = $bigWinRealEv > 0 ? $bigWinRealEv : self::SUPER_WIN_BONUS;
|
||||
$rewardWinCoin = 0;
|
||||
} else {
|
||||
if ($useKillMode) {
|
||||
// 杀分档位:绝不触发豹子,仅生成非豹子组合,不发放豹子奖金
|
||||
$isWin = 0;
|
||||
$superWinCoin = 0.0;
|
||||
$rollArray = $this->generateNonSuperWinRollArrayWithSum($rollNumber);
|
||||
} else {
|
||||
$bigWinConfig = DiceRewardConfig::getCachedByTierAndGridNumber('BIGWIN', $rollNumber);
|
||||
$alwaysSuperWin = in_array($rollNumber, self::SUPER_WIN_ALWAYS_GRID_NUMBERS, true);
|
||||
$doSuperWin = $alwaysSuperWin;
|
||||
if (!$doSuperWin) {
|
||||
$bigWinWeight = 10000;
|
||||
if ($bigWinConfig !== null && isset($bigWinConfig['weight'])) {
|
||||
$bigWinWeight = min(10000, max(0, (int) $bigWinConfig['weight']));
|
||||
}
|
||||
$roll = (random_int(0, PHP_INT_MAX - 1) / (float) PHP_INT_MAX);
|
||||
$doSuperWin = $bigWinWeight > 0 && $roll < ($bigWinWeight / 10000.0);
|
||||
}
|
||||
if ($bigWinConfig !== null && isset($bigWinConfig['real_ev'])) {
|
||||
$bigWinRealEv = (float) $bigWinConfig['real_ev'];
|
||||
}
|
||||
if ($doSuperWin) {
|
||||
$rollArray = $this->getSuperWinRollArray($rollNumber);
|
||||
$isWin = 1;
|
||||
$superWinCoin = $bigWinRealEv > 0 ? $bigWinRealEv : self::SUPER_WIN_BONUS;
|
||||
$rewardWinCoin = 0;
|
||||
} else {
|
||||
$rollArray = $this->generateNonSuperWinRollArrayWithSum($rollNumber);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$rollArray = $this->generateRollArrayFromSum($rollNumber);
|
||||
|
||||
@@ -5,6 +5,8 @@ namespace app\api\logic;
|
||||
|
||||
use app\dice\model\player\DicePlayer;
|
||||
use app\api\cache\UserCache;
|
||||
use plugin\saiadmin\app\model\system\SystemDept;
|
||||
use plugin\saiadmin\app\model\system\SystemUser;
|
||||
use plugin\saiadmin\exception\ApiException;
|
||||
use Tinywan\Jwt\JwtToken;
|
||||
|
||||
@@ -29,7 +31,7 @@ class UserLogic
|
||||
public static function validatePhone(string $phone): void
|
||||
{
|
||||
if (!preg_match(self::PHONE_REGEX, $phone)) {
|
||||
throw new ApiException('手机号格式错误,仅支持 +60 开头的马来西亚号码(如 +60123456789)');
|
||||
throw new ApiException('Invalid phone format, only +60 Malaysia numbers supported (e.g. +60123456789)');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,28 +43,105 @@ class UserLogic
|
||||
return md5(self::PASSWORD_SALT . $password);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 parent_id 向上遍历找到顶级部门(parent_id=0)
|
||||
*/
|
||||
private static function getTopDeptIdByParentId(int $deptId): ?int
|
||||
{
|
||||
$currentId = $deptId;
|
||||
$visited = [];
|
||||
while ($currentId > 0 && !isset($visited[$currentId])) {
|
||||
$visited[$currentId] = true;
|
||||
$dept = SystemDept::find($currentId);
|
||||
if (!$dept) {
|
||||
return null;
|
||||
}
|
||||
$parentId = (int) ($dept->parent_id ?? 0);
|
||||
if ($parentId === 0) {
|
||||
return $currentId;
|
||||
}
|
||||
$currentId = $parentId;
|
||||
}
|
||||
return $currentId > 0 ? $currentId : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据顶级部门 id,递归获取其下所有部门 id(含自身),仅用 id 和 parent_id
|
||||
*/
|
||||
private static function getAllDeptIdsUnderTop(int $topId): array
|
||||
{
|
||||
$deptIds = [$topId];
|
||||
$prevCount = 0;
|
||||
while (count($deptIds) > $prevCount) {
|
||||
$prevCount = count($deptIds);
|
||||
$children = SystemDept::whereIn('parent_id', $deptIds)->column('id');
|
||||
$deptIds = array_unique(array_merge($deptIds, array_map('intval', $children)));
|
||||
}
|
||||
return array_values($deptIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 agent_id 获取当前管理员所在顶级部门下的所有管理员 ID 列表
|
||||
* 使用 SystemDept 的 id 和 parent_id 字段遍历:先向上找顶级部门(parent_id=0),再向下收集所有子部门
|
||||
* 用于 getGameUrl 接口判断 DicePlayer 是否属于该部门,同顶级部门下不重复创建玩家
|
||||
*
|
||||
* @param string $agentId 代理标识(sa_system_user.agent_id)
|
||||
* @return int[] 管理员 ID 列表,空数组表示未找到或无法解析
|
||||
*/
|
||||
public static function getAdminIdsByAgentIdTopDept(string $agentId): array
|
||||
{
|
||||
$agentId = trim($agentId);
|
||||
if ($agentId === '') {
|
||||
return [];
|
||||
}
|
||||
$admin = SystemUser::where('agent_id', $agentId)->find();
|
||||
if (!$admin) {
|
||||
return [];
|
||||
}
|
||||
$deptId = $admin->dept_id ?? null;
|
||||
if ($deptId === null || $deptId === '') {
|
||||
return [(int) $admin->id];
|
||||
}
|
||||
$deptId = (int) $deptId;
|
||||
$topId = self::getTopDeptIdByParentId($deptId);
|
||||
if ($topId === null) {
|
||||
return [(int) $admin->id];
|
||||
}
|
||||
$deptIds = self::getAllDeptIdsUnderTop($topId);
|
||||
if (empty($deptIds)) {
|
||||
$deptIds = [$deptId];
|
||||
}
|
||||
$adminIds = SystemUser::whereIn('dept_id', $deptIds)->column('id');
|
||||
return array_map('intval', $adminIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录(JSON:username, password, lang, coin, time)
|
||||
* 存在则校验密码并更新 coin(累加);不存在则创建用户并写入 coin。
|
||||
* 将会话写入 Redis,返回 token 与前端连接地址。
|
||||
*
|
||||
* @param int|null $adminId 创建新用户时关联的后台管理员ID(sa_system_user.id),可选
|
||||
* @param int[]|null $adminIdsInTopDept 当前管理员顶级部门下的所有管理员ID,用于按部门范围查找玩家;为空时退化为仅按 username 查找
|
||||
*/
|
||||
public function loginByUsername(string $username, string $password, string $lang, float $coin, string $time, ?int $adminId = null): array
|
||||
public function loginByUsername(string $username, string $password, string $lang, float $coin, string $time, ?int $adminId = null, ?array $adminIdsInTopDept = null): array
|
||||
{
|
||||
$username = trim($username);
|
||||
if ($username === '') {
|
||||
throw new ApiException('username 不能为空');
|
||||
throw new ApiException('username is required');
|
||||
}
|
||||
|
||||
$player = DicePlayer::where('username', $username)->find();
|
||||
$query = DicePlayer::where('username', $username);
|
||||
if ($adminIdsInTopDept !== null && !empty($adminIdsInTopDept)) {
|
||||
$query->whereIn('admin_id', $adminIdsInTopDept);
|
||||
}
|
||||
$player = $query->find();
|
||||
if ($player) {
|
||||
if ((int) ($player->status ?? 1) === 0) {
|
||||
throw new ApiException('账号已被禁用,无法登录');
|
||||
throw new ApiException('Account is disabled and cannot log in');
|
||||
}
|
||||
$hashed = $this->hashPassword($password);
|
||||
if ($player->password !== $hashed) {
|
||||
throw new ApiException('密码错误');
|
||||
throw new ApiException('Wrong password');
|
||||
}
|
||||
$currentCoin = (float) $player->coin;
|
||||
$player->coin = $currentCoin + $coin;
|
||||
|
||||
@@ -25,31 +25,31 @@ class AuthTokenMiddleware implements MiddlewareInterface
|
||||
$token = $request->header('auth-token');
|
||||
$token = $token !== null ? trim((string) $token) : '';
|
||||
if ($token === '') {
|
||||
throw new ApiException('请携带 auth-token', ReturnCode::UNAUTHORIZED);
|
||||
throw new ApiException('Please provide auth-token', ReturnCode::UNAUTHORIZED);
|
||||
}
|
||||
|
||||
try {
|
||||
$decoded = JwtToken::verify(1, $token);
|
||||
} catch (JwtTokenExpiredException $e) {
|
||||
throw new ApiException('auth-token 已过期', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('auth-token expired', ReturnCode::TOKEN_INVALID);
|
||||
} catch (JwtTokenException $e) {
|
||||
throw new ApiException('auth-token 无效', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('auth-token invalid', ReturnCode::TOKEN_INVALID);
|
||||
} catch (\Throwable $e) {
|
||||
throw new ApiException('auth-token 格式无效', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('auth-token format invalid', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
|
||||
$extend = $decoded['extend'] ?? [];
|
||||
if ((string) ($extend['plat'] ?? '') !== 'api_auth_token') {
|
||||
throw new ApiException('auth-token 无效', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('auth-token invalid', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
$agentId = trim((string) ($extend['agent_id'] ?? ''));
|
||||
if ($agentId === '') {
|
||||
throw new ApiException('auth-token 无效', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('auth-token invalid', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
|
||||
$currentToken = AuthTokenCache::getTokenByAgentId($agentId);
|
||||
if ($currentToken === null || $currentToken !== $token) {
|
||||
throw new ApiException('auth-token 无效或已失效', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('auth-token invalid or expired', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
|
||||
$request->agent_id = $agentId;
|
||||
|
||||
@@ -32,38 +32,38 @@ class TokenMiddleware implements MiddlewareInterface
|
||||
}
|
||||
$token = $token !== null ? trim((string) $token) : '';
|
||||
if ($token === '') {
|
||||
throw new ApiException('请携带 token', ReturnCode::UNAUTHORIZED);
|
||||
throw new ApiException('Please provide token', ReturnCode::UNAUTHORIZED);
|
||||
}
|
||||
|
||||
try {
|
||||
$decoded = JwtToken::verify(1, $token);
|
||||
} catch (JwtTokenExpiredException $e) {
|
||||
throw new ApiException('token 已过期,请重新登录', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('Token expired, please login again', ReturnCode::TOKEN_INVALID);
|
||||
} catch (JwtTokenException $e) {
|
||||
throw new ApiException('token 无效', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('Invalid or expired token', ReturnCode::TOKEN_INVALID);
|
||||
} catch (\Throwable $e) {
|
||||
throw new ApiException('token 格式无效', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('Token format invalid', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
|
||||
$extend = $decoded['extend'] ?? [];
|
||||
if ((string) ($extend['plat'] ?? '') !== 'api_login') {
|
||||
throw new ApiException('token 无效', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('Invalid or expired token', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
$username = trim((string) ($extend['username'] ?? ''));
|
||||
if ($username === '') {
|
||||
throw new ApiException('token 无效', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('Invalid or expired token', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
|
||||
$currentToken = UserCache::getSessionTokenByUsername($username);
|
||||
if ($currentToken === null || $currentToken === '') {
|
||||
$player = DicePlayer::where('username', $username)->find();
|
||||
if (!$player) {
|
||||
throw new ApiException('请注册', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('Please register', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
throw new ApiException('请重新登录', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('Please login again', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
if ($currentToken !== $token) {
|
||||
throw new ApiException('请重新登录(当前账号已在其他处登录)', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('Please login again (account logged in elsewhere)', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
|
||||
// 优先从 Redis 缓存取玩家,避免每次请求都查库
|
||||
@@ -76,7 +76,7 @@ class TokenMiddleware implements MiddlewareInterface
|
||||
$player = DicePlayer::where('username', $username)->find();
|
||||
if (!$player) {
|
||||
UserCache::deleteSessionByUsername($username);
|
||||
throw new ApiException('请重新登录', ReturnCode::TOKEN_INVALID);
|
||||
throw new ApiException('Please login again', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
UserCache::setPlayerByUsername($username, $player->hidden(['password'])->toArray());
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ class LotteryService
|
||||
if (!$player) {
|
||||
throw new \RuntimeException('玩家不存在');
|
||||
}
|
||||
$config0 = DiceLotteryPoolConfig::where('type', 0)->find();
|
||||
$config1 = DiceLotteryPoolConfig::where('type', 1)->find();
|
||||
$config0 = DiceLotteryPoolConfig::where('name', 'default')->find();
|
||||
$config1 = DiceLotteryPoolConfig::where('name', 'killScore')->find();
|
||||
$s = new self($playerId);
|
||||
$s->configType0Id = $config0 ? (int) $config0->id : null;
|
||||
$s->configType1Id = $config1 ? (int) $config1->id : null;
|
||||
|
||||
@@ -6,7 +6,9 @@ namespace app\api\util;
|
||||
use support\Request;
|
||||
|
||||
/**
|
||||
* API 多语言:根据请求头 lang(en=英文,zh=中文)翻译返回文案
|
||||
* API 多语言(兼容 Webman 多语言配置)
|
||||
* 根据请求头 lang(zh=中文,en=英文)返回对应文案;
|
||||
* 无 lang 请求头时使用 config('translation.locale') 推断(zh_CN/zh→中文,en→英文)
|
||||
*/
|
||||
class ApiLang
|
||||
{
|
||||
@@ -14,47 +16,96 @@ class ApiLang
|
||||
private const LANG_EN = 'en';
|
||||
private const LANG_ZH = 'zh';
|
||||
|
||||
/** @var array<string, string>|null */
|
||||
private static ?array $enMap = null;
|
||||
/** @var array<string, array<string, string>> lang => [ key => message ] */
|
||||
private static array $messages = [];
|
||||
|
||||
/**
|
||||
* 从请求中获取语言:lang 请求头 en=英文,zh=中文,默认 zh
|
||||
* 从请求中获取语言:优先读 header lang,否则按 Webman config('translation.locale') 推断
|
||||
*/
|
||||
public static function getLang(?Request $request = null): string
|
||||
{
|
||||
$request = $request ?? (function_exists('request') ? request() : null);
|
||||
if ($request === null) {
|
||||
return self::LANG_ZH;
|
||||
}
|
||||
$lang = $request->header(self::LANG_HEADER);
|
||||
if ($lang !== null && $lang !== '') {
|
||||
$lang = strtolower(trim((string) $lang));
|
||||
if ($lang === self::LANG_EN) {
|
||||
return self::LANG_EN;
|
||||
}
|
||||
if ($lang === self::LANG_ZH || $lang === 'chs') {
|
||||
return self::LANG_ZH;
|
||||
if ($request !== null) {
|
||||
$lang = $request->header(self::LANG_HEADER);
|
||||
if ($lang !== null && $lang !== '') {
|
||||
$lang = strtolower(trim((string) $lang));
|
||||
if ($lang === self::LANG_EN) {
|
||||
return self::LANG_EN;
|
||||
}
|
||||
if ($lang === self::LANG_ZH || $lang === 'chs') {
|
||||
return self::LANG_ZH;
|
||||
}
|
||||
}
|
||||
}
|
||||
return self::LANG_ZH;
|
||||
$locale = (string) (function_exists('config') ? config('translation.locale', 'zh_CN') : 'zh_CN');
|
||||
return stripos($locale, 'en') !== false ? self::LANG_EN : self::LANG_ZH;
|
||||
}
|
||||
|
||||
/**
|
||||
* 翻译文案:当前请求语言为 en 时返回英文,否则返回原文(中文)
|
||||
* @param string $message 中文或原文
|
||||
* @param Request|null $request 当前请求,不传则自动取 request()
|
||||
* 翻译文案(对外接口 message):
|
||||
* - 推荐:抛英文 key(如 USER_NOT_FOUND),根据 lang 返回对应语言
|
||||
* - 兼容:仍抛中文原文时,lang=en 按旧映射翻译,否则原样返回
|
||||
*
|
||||
* 语言文件优先从 Webman config('translation.path')/api/{lang}.php 加载
|
||||
*/
|
||||
public static function translate(string $message, ?Request $request = null): string
|
||||
{
|
||||
$lang = self::getLang($request);
|
||||
if ($lang !== self::LANG_EN) {
|
||||
return $message;
|
||||
$map = self::loadMessages($lang);
|
||||
if (isset($map[$message])) {
|
||||
return (string) $map[$message];
|
||||
}
|
||||
if (self::$enMap === null) {
|
||||
$path = dirname(__DIR__) . '/lang/en.php';
|
||||
self::$enMap = is_file($path) ? (require $path) : [];
|
||||
|
||||
// 若传入的是中文/原文,则按固定规则生成英文 key(MSG_XXXXXXXX)再翻译
|
||||
$key = self::toMsgKey($message);
|
||||
if ($key !== null && isset($map[$key])) {
|
||||
return (string) $map[$key];
|
||||
}
|
||||
return self::$enMap[$message] ?? $message;
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载某语言的 API 文案(推荐:key=英文,value=对应语言文案)
|
||||
*/
|
||||
private static function loadMessages(string $locale): array
|
||||
{
|
||||
if (isset(self::$messages[$locale])) {
|
||||
return self::$messages[$locale];
|
||||
}
|
||||
$path = null;
|
||||
if (function_exists('config')) {
|
||||
$base = rtrim((string) config('translation.path', ''), DIRECTORY_SEPARATOR);
|
||||
if ($base !== '') {
|
||||
$path = $base . DIRECTORY_SEPARATOR . 'api' . DIRECTORY_SEPARATOR . $locale . '.php';
|
||||
}
|
||||
}
|
||||
if ($path !== null && is_file($path)) {
|
||||
self::$messages[$locale] = require $path;
|
||||
return self::$messages[$locale];
|
||||
}
|
||||
|
||||
// 回退到 app/api/lang/{lang}.php(同样使用英文 key)
|
||||
$fallback = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . $locale . '.php';
|
||||
self::$messages[$locale] = is_file($fallback) ? (require $fallback) : [];
|
||||
return self::$messages[$locale];
|
||||
}
|
||||
|
||||
/**
|
||||
* 将原文转换为英文 key(只包含英文字符/数字/下划线):MSG_XXXXXXXX(crc32)
|
||||
* 若入参已经是英文 key,则返回 null(表示无需转换)
|
||||
*/
|
||||
private static function toMsgKey(string $message): ?string
|
||||
{
|
||||
$trim = trim($message);
|
||||
if ($trim === '') {
|
||||
return null;
|
||||
}
|
||||
// 已经是英文错误码 key(只允许 A-Z/0-9/_,且至少 3 位)
|
||||
if (preg_match('/^[A-Z0-9_]{3,}$/', $trim) === 1) {
|
||||
return null;
|
||||
}
|
||||
return 'MSG_' . strtoupper(sprintf('%08X', crc32($trim)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,7 +60,7 @@ class DiceConfigController extends BaseController
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
} else {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ class DiceConfigController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,9 +94,9 @@ class DiceConfigController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,13 +110,13 @@ class DiceConfigController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,22 +30,20 @@ class DiceLotteryPoolConfigController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 DiceLotteryPoolConfig 列表数据,用于 lottery_config_id 下拉(值为 id,显示为 name),并附带 type、T1-T5 档位权重
|
||||
* type:0=付费抽奖券,1=免费抽奖券;一键测试权重中付费默认选 type=0,免费默认选 type=1
|
||||
* 获取 DiceLotteryPoolConfig 列表数据,用于 lottery_config_id 下拉(值为 id,显示为 name),并附带 T1-T5 档位权重
|
||||
* @param Request $request
|
||||
* @return Response 返回 [ ['id' => int, 'name' => string, 'type' => int, 't1_weight' => int, ... 't5_weight' => int], ... ]
|
||||
* @return Response 返回 [ ['id' => int, 'name' => string, 't1_weight' => int, ... 't5_weight' => int], ... ]
|
||||
*/
|
||||
#[Permission('色子奖池配置列表', 'dice:lottery_pool_config:index:index')]
|
||||
public function getOptions(Request $request): Response
|
||||
{
|
||||
$list = DiceLotteryPoolConfig::field('id,name,type,t1_weight,t2_weight,t3_weight,t4_weight,t5_weight')
|
||||
$list = DiceLotteryPoolConfig::field('id,name,t1_weight,t2_weight,t3_weight,t4_weight,t5_weight')
|
||||
->order('id', 'asc')
|
||||
->select();
|
||||
$data = $list->map(function ($item) {
|
||||
return [
|
||||
'id' => (int) $item['id'],
|
||||
'name' => (string) ($item['name'] ?? ''),
|
||||
'type' => (int) ($item['type'] ?? 0),
|
||||
't1_weight' => (int) ($item['t1_weight'] ?? 0),
|
||||
't2_weight' => (int) ($item['t2_weight'] ?? 0),
|
||||
't3_weight' => (int) ($item['t3_weight'] ?? 0),
|
||||
@@ -87,7 +85,7 @@ class DiceLotteryPoolConfigController extends BaseController
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
} else {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,9 +101,9 @@ class DiceLotteryPoolConfigController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,9 +119,9 @@ class DiceLotteryPoolConfigController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,13 +135,13 @@ class DiceLotteryPoolConfigController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +149,7 @@ class DiceLotteryPoolConfigController extends BaseController
|
||||
* 获取当前彩金池(Redis 实例化,无则按 type=0 创建)
|
||||
* 返回含玩家累计盈利 profit_amount 实时值,供前端轮询展示
|
||||
*/
|
||||
#[Permission('色子奖池配置列表', 'dice:lottery_pool_config:index:index')]
|
||||
#[Permission('色子奖池配置列表', 'dice:lottery_pool_config:index:getCurrentPool')]
|
||||
public function getCurrentPool(Request $request): Response
|
||||
{
|
||||
$data = $this->logic->getCurrentPool();
|
||||
@@ -161,21 +159,21 @@ class DiceLotteryPoolConfigController extends BaseController
|
||||
/**
|
||||
* 更新当前彩金池:仅可修改 safety_line、t1_weight~t5_weight,不可修改 profit_amount
|
||||
*/
|
||||
#[Permission('色子奖池配置修改', 'dice:lottery_pool_config:index:update')]
|
||||
#[Permission('色子奖池配置修改', 'dice:lottery_pool_config:index:updateCurrentPool')]
|
||||
public function updateCurrentPool(Request $request): Response
|
||||
{
|
||||
$data = $request->post();
|
||||
$this->logic->updateCurrentPool($data);
|
||||
return $this->success('保存成功');
|
||||
return $this->success('save success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置当前彩金池的玩家累计盈利:将 profit_amount 置为 0
|
||||
*/
|
||||
#[Permission('色子奖池配置修改', 'dice:lottery_pool_config:index:update')]
|
||||
#[Permission('色子奖池配置修改', 'dice:lottery_pool_config:index:resetProfitAmount')]
|
||||
public function resetProfitAmount(Request $request): Response
|
||||
{
|
||||
$this->logic->resetProfitAmount();
|
||||
return $this->success('重置成功');
|
||||
return $this->success('reset success');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,16 @@ class DicePlayRecordController extends BaseController
|
||||
'diceRewardConfig',
|
||||
'diceLotteryPoolConfig',
|
||||
]);
|
||||
|
||||
// 按当前筛选条件统计:平台总盈利 = 付费抽奖(lottery_type=0)次数×100 - 玩家总收益(win_coin 求和)
|
||||
$sumQuery = clone $query;
|
||||
$playerTotalWin = (float) $sumQuery->sum('win_coin');
|
||||
$paidCountQuery = clone $query;
|
||||
$paidCount = (int) $paidCountQuery->where('lottery_type', 0)->count();
|
||||
$totalWinCoin = $paidCount * 100 - $playerTotalWin;
|
||||
|
||||
$data = $this->logic->getList($query);
|
||||
$data['total_win_coin'] = $totalWinCoin;
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
@@ -120,11 +129,11 @@ class DicePlayRecordController extends BaseController
|
||||
$id = $request->input('id', '');
|
||||
$model = $this->logic->read($id);
|
||||
if (!$model) {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
|
||||
if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) {
|
||||
return $this->fail('无权限查看该记录');
|
||||
return $this->fail('no permission to view this record');
|
||||
}
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
@@ -142,9 +151,9 @@ class DicePlayRecordController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,9 +169,9 @@ class DicePlayRecordController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,13 +185,13 @@ class DicePlayRecordController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class DicePlayRecordTestController extends BaseController
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
} else {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,9 +91,9 @@ class DicePlayRecordTestController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,9 +109,9 @@ class DicePlayRecordTestController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,13 +125,13 @@ class DicePlayRecordTestController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,15 +140,15 @@ class DicePlayRecordTestController extends BaseController
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
#[Permission('玩家抽奖记录(测试数据)删除', 'dice:play_record_test:index:destroy')]
|
||||
#[Permission('玩家抽奖记录(测试数据)删除', 'dice:play_record_test:index:clearAll')]
|
||||
public function clearAll(Request $request): Response
|
||||
{
|
||||
try {
|
||||
$table = (new \app\dice\model\play_record_test\DicePlayRecordTest())->getTable();
|
||||
Db::execute('TRUNCATE TABLE `' . $table . '`');
|
||||
return $this->success('已清空所有测试数据');
|
||||
return $this->success('all test data cleared');
|
||||
} catch (\Throwable $e) {
|
||||
return $this->fail('清空失败:' . $e->getMessage());
|
||||
return $this->fail('clear failed: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,11 +110,11 @@ class DicePlayerController extends BaseController
|
||||
$id = $request->input('id', '');
|
||||
$model = $this->logic->read($id);
|
||||
if (!$model) {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
|
||||
if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) {
|
||||
return $this->fail('无权限查看该记录');
|
||||
return $this->fail('no permission to view this record');
|
||||
}
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
@@ -142,9 +142,9 @@ class DicePlayerController extends BaseController
|
||||
if ($player && $player->username !== '') {
|
||||
UserCache::deletePlayerByUsername($player->username);
|
||||
}
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
}
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,7 +161,7 @@ class DicePlayerController extends BaseController
|
||||
if ($model) {
|
||||
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
|
||||
if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) {
|
||||
return $this->fail('无权限修改该记录');
|
||||
return $this->fail('no permission to update this record');
|
||||
}
|
||||
}
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
@@ -172,9 +172,9 @@ class DicePlayerController extends BaseController
|
||||
if ($player && $player->username !== '') {
|
||||
UserCache::deletePlayerByUsername($player->username);
|
||||
}
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
}
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,16 +188,16 @@ class DicePlayerController extends BaseController
|
||||
$id = $request->input('id');
|
||||
$status = $request->input('status');
|
||||
if ($id === null || $id === '') {
|
||||
return $this->fail('缺少参数 id');
|
||||
return $this->fail('missing parameter id');
|
||||
}
|
||||
if ($status === null || $status === '') {
|
||||
return $this->fail('缺少参数 status');
|
||||
return $this->fail('missing parameter status');
|
||||
}
|
||||
$model = $this->logic->read($id);
|
||||
if ($model) {
|
||||
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
|
||||
if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) {
|
||||
return $this->fail('无权限修改该记录');
|
||||
return $this->fail('no permission to update this record');
|
||||
}
|
||||
}
|
||||
$this->logic->edit($id, ['status' => (int) $status]);
|
||||
@@ -207,7 +207,7 @@ class DicePlayerController extends BaseController
|
||||
if ($player && $player->username !== '') {
|
||||
UserCache::deletePlayerByUsername($player->username);
|
||||
}
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,7 +220,7 @@ class DicePlayerController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string) $ids);
|
||||
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
|
||||
@@ -235,7 +235,7 @@ class DicePlayerController extends BaseController
|
||||
}
|
||||
$ids = $validIds;
|
||||
if (empty($ids)) {
|
||||
return $this->fail('无权限删除所选数据');
|
||||
return $this->fail('no permission to delete selected data');
|
||||
}
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
@@ -248,9 +248,9 @@ class DicePlayerController extends BaseController
|
||||
UserCache::deletePlayerByUsername($player->username);
|
||||
}
|
||||
}
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
}
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -88,11 +88,11 @@ class DicePlayerTicketRecordController extends BaseController
|
||||
$id = $request->input('id', '');
|
||||
$model = $this->logic->read($id);
|
||||
if (!$model) {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
|
||||
if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) {
|
||||
return $this->fail('无权限查看该记录');
|
||||
return $this->fail('no permission to view this record');
|
||||
}
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
@@ -110,9 +110,9 @@ class DicePlayerTicketRecordController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,9 +128,9 @@ class DicePlayerTicketRecordController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,13 +144,13 @@ class DicePlayerTicketRecordController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,15 +85,15 @@ class DicePlayerWalletRecordController extends BaseController
|
||||
{
|
||||
$playerId = $request->input('player_id');
|
||||
if ($playerId === null || $playerId === '') {
|
||||
return $this->fail('缺少 player_id');
|
||||
return $this->fail('missing player_id');
|
||||
}
|
||||
$player = DicePlayer::field('coin,admin_id')->where('id', $playerId)->find();
|
||||
if (!$player) {
|
||||
return $this->fail('玩家不存在');
|
||||
return $this->fail('Player not found');
|
||||
}
|
||||
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
|
||||
if ($allowedIds !== null && !in_array((int) ($player->admin_id ?? 0), $allowedIds, true)) {
|
||||
return $this->fail('无权限操作该玩家');
|
||||
return $this->fail('no permission to operate this player');
|
||||
}
|
||||
return $this->success(['wallet_before' => (float) $player['coin']]);
|
||||
}
|
||||
@@ -109,11 +109,11 @@ class DicePlayerWalletRecordController extends BaseController
|
||||
$id = $request->input('id', '');
|
||||
$model = $this->logic->read($id);
|
||||
if (!$model) {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
|
||||
if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) {
|
||||
return $this->fail('无权限查看该记录');
|
||||
return $this->fail('no permission to view this record');
|
||||
}
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
@@ -124,7 +124,7 @@ class DicePlayerWalletRecordController extends BaseController
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
#[Permission('玩家钱包流水添加', 'dice:player_wallet_record:index:save')]
|
||||
#[Permission('玩家钱包流水添加', 'dice:player_wallet_record:index:adminOperate')]
|
||||
public function adminOperate(Request $request): Response
|
||||
{
|
||||
$data = $request->post();
|
||||
@@ -133,13 +133,13 @@ class DicePlayerWalletRecordController extends BaseController
|
||||
$coin = isset($data['coin']) ? (float) $data['coin'] : null;
|
||||
|
||||
if ($playerId === null || $playerId === '') {
|
||||
return $this->fail('请选择玩家');
|
||||
return $this->fail('please select player');
|
||||
}
|
||||
if (!in_array($type, [3, 4], true)) {
|
||||
return $this->fail('操作类型必须为 3=加点 或 4=扣点');
|
||||
return $this->fail('operation type must be 3 (add) or 4 (deduct)');
|
||||
}
|
||||
if ($coin === null || $coin <= 0) {
|
||||
return $this->fail('平台币变动必须大于 0');
|
||||
return $this->fail('Coin change must be greater than 0');
|
||||
}
|
||||
|
||||
$data['player_id'] = $playerId;
|
||||
@@ -163,43 +163,25 @@ class DicePlayerWalletRecordController extends BaseController
|
||||
}
|
||||
}
|
||||
if ($adminId === null || $adminId <= 0) {
|
||||
return $this->fail('请先登录');
|
||||
return $this->fail('please login first');
|
||||
}
|
||||
|
||||
$player = DicePlayer::field('admin_id')->where('id', $playerId)->find();
|
||||
if ($player) {
|
||||
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
|
||||
if ($allowedIds !== null && !in_array((int) ($player->admin_id ?? 0), $allowedIds, true)) {
|
||||
return $this->fail('无权限操作该玩家');
|
||||
return $this->fail('no permission to operate this player');
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$this->logic->adminOperate($data, $adminId);
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
} catch (\Throwable $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
#[Permission('玩家钱包流水添加', 'dice:player_wallet_record:index:save')]
|
||||
public function save(Request $request): Response
|
||||
{
|
||||
$data = $request->post();
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据
|
||||
* @param Request $request
|
||||
@@ -212,30 +194,9 @@ class DicePlayerWalletRecordController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
#[Permission('玩家钱包流水删除', 'dice:player_wallet_record:index:destroy')]
|
||||
public function destroy(Request $request): Response
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ class DiceRewardController extends BaseController
|
||||
{
|
||||
$direction = $request->input('direction', null);
|
||||
if ($direction === null || $direction === '') {
|
||||
return $this->fail('请传入 direction(0=顺时针 1=逆时针)');
|
||||
return $this->fail('please provide direction (0=clockwise, 1=counterclockwise)');
|
||||
}
|
||||
$direction = (int) $direction;
|
||||
if (!in_array($direction, [DiceReward::DIRECTION_CLOCKWISE, DiceReward::DIRECTION_COUNTERCLOCKWISE], true)) {
|
||||
return $this->fail('direction 必须为 0(顺时针)或 1(逆时针)');
|
||||
return $this->fail('direction must be 0 (clockwise) or 1 (counterclockwise)');
|
||||
}
|
||||
$tier = $request->input('tier', '');
|
||||
$page = (int) $request->input('page', 1);
|
||||
@@ -85,7 +85,7 @@ class DiceRewardController extends BaseController
|
||||
* 参数:lottery_config_id 可选,不选则传 paid_tier_weights / free_tier_weights 自定义档位;
|
||||
* paid_s_count, paid_n_count, free_s_count, free_n_count;或兼容旧版 s_count, n_count
|
||||
*/
|
||||
#[Permission('奖励对照列表', 'dice:reward:index:index')]
|
||||
#[Permission('一键测试权重', 'dice:reward:index:startWeightTest')]
|
||||
public function startWeightTest(Request $request): Response
|
||||
{
|
||||
$post = is_array($request->post()) ? $request->post() : [];
|
||||
@@ -120,11 +120,11 @@ class DiceRewardController extends BaseController
|
||||
{
|
||||
$recordId = (int) $request->input('record_id', 0);
|
||||
if ($recordId <= 0) {
|
||||
return $this->fail('请传入 record_id');
|
||||
return $this->fail('please provide record_id');
|
||||
}
|
||||
$record = DiceRewardConfigRecord::find($recordId);
|
||||
if (!$record) {
|
||||
return $this->fail('记录不存在');
|
||||
return $this->fail('record not found');
|
||||
}
|
||||
$arr = $record->toArray();
|
||||
$data = [
|
||||
@@ -147,9 +147,9 @@ class DiceRewardController extends BaseController
|
||||
try {
|
||||
$table = (new DicePlayRecordTest())->getTable();
|
||||
Db::execute('TRUNCATE TABLE `' . $table . '`');
|
||||
return $this->success('已清空测试数据');
|
||||
return $this->success('test data cleared');
|
||||
} catch (\Throwable $e) {
|
||||
return $this->fail('清空失败:' . $e->getMessage());
|
||||
return $this->fail('clear failed: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,17 +157,17 @@ class DiceRewardController extends BaseController
|
||||
* 权重编辑弹窗:按方向+点数批量更新权重(写入 dice_reward)
|
||||
* 参数:items: [{ grid_number, weight_clockwise, weight_counterclockwise }, ...]
|
||||
*/
|
||||
#[Permission('奖励对照修改', 'dice:reward:index:update')]
|
||||
#[Permission('权重配比', 'dice:reward:index:batchUpdateWeights')]
|
||||
public function batchUpdateWeights(Request $request): Response
|
||||
{
|
||||
$items = $request->post('items', []);
|
||||
if (!is_array($items)) {
|
||||
return $this->fail('参数 items 必须为数组');
|
||||
return $this->fail('parameter items must be an array');
|
||||
}
|
||||
try {
|
||||
$logic = new DiceRewardLogic();
|
||||
$logic->batchUpdateWeights($items);
|
||||
return $this->success('保存成功');
|
||||
return $this->success('save success');
|
||||
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
@@ -182,16 +182,16 @@ class DiceRewardController extends BaseController
|
||||
{
|
||||
$direction = (int) $request->post('direction', 0);
|
||||
if (!in_array($direction, [DiceReward::DIRECTION_CLOCKWISE, DiceReward::DIRECTION_COUNTERCLOCKWISE], true)) {
|
||||
return $this->fail('direction 必须为 0(顺时针)或 1(逆时针)');
|
||||
return $this->fail('direction must be 0 (clockwise) or 1 (counterclockwise)');
|
||||
}
|
||||
$items = $request->post('items', []);
|
||||
if (!is_array($items)) {
|
||||
return $this->fail('参数 items 必须为数组');
|
||||
return $this->fail('parameter items must be an array');
|
||||
}
|
||||
try {
|
||||
$logic = new DiceRewardLogic();
|
||||
$logic->batchUpdateWeightsByDirection($direction, $items);
|
||||
return $this->success('保存成功');
|
||||
return $this->success('save success');
|
||||
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class DiceRewardConfigController extends BaseController
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
} else {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ class DiceRewardConfigController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ class DiceRewardConfigController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,12 +109,12 @@ class DiceRewardConfigController extends BaseController
|
||||
* @param Request $request items: [{ id, grid_number?, ui_text?, real_ev?, tier?, remark? }, ...]
|
||||
* @return Response
|
||||
*/
|
||||
#[Permission('奖励配置修改', 'dice:reward_config:index:update')]
|
||||
#[Permission('修改奖励索引', 'dice:reward_config:index:batchUpdate')]
|
||||
public function batchUpdate(Request $request): Response
|
||||
{
|
||||
$items = $request->post('items', []);
|
||||
if (! is_array($items)) {
|
||||
return $this->fail('参数 items 必须为数组');
|
||||
return $this->fail('parameter items must be an array');
|
||||
}
|
||||
$err = $this->logic->validateBatchUpdateItems($items);
|
||||
if ($err !== null) {
|
||||
@@ -124,7 +124,7 @@ class DiceRewardConfigController extends BaseController
|
||||
$this->validate('batch_update', array_merge($item, ['id' => $item['id']]));
|
||||
}
|
||||
$this->logic->batchUpdate($items);
|
||||
return $this->success('保存成功');
|
||||
return $this->success('save success');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,13 +137,13 @@ class DiceRewardConfigController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,17 +166,17 @@ class DiceRewardConfigController extends BaseController
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
#[Permission('奖励配置修改', 'dice:reward_config:index:update')]
|
||||
#[Permission('修改色子点数权重', 'dice:reward_config:index:batchUpdateWeights')]
|
||||
public function batchUpdateWeights(Request $request): Response
|
||||
{
|
||||
$items = $request->post('items', []);
|
||||
if (!is_array($items)) {
|
||||
return $this->fail('参数 items 必须为数组');
|
||||
return $this->fail('parameter items must be an array');
|
||||
}
|
||||
try {
|
||||
$rewardLogic = new DiceRewardLogic();
|
||||
$rewardLogic->batchUpdateWeights($items);
|
||||
return $this->success('保存成功');
|
||||
return $this->success('save success');
|
||||
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
@@ -188,19 +188,19 @@ class DiceRewardConfigController extends BaseController
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
#[Permission('奖励配置修改', 'dice:reward_config:index:update')]
|
||||
#[Permission('大奖权重修改', 'dice:reward_config:index:saveBigwinWeightsByGrid')]
|
||||
public function saveBigwinWeightsByGrid(Request $request): Response
|
||||
{
|
||||
$items = $request->post('items', []);
|
||||
if (! is_array($items)) {
|
||||
return $this->fail('参数 items 必须为数组');
|
||||
return $this->fail('parameter items must be an array');
|
||||
}
|
||||
$err = $this->logic->validateBigwinWeightItems($items);
|
||||
if ($err !== null) {
|
||||
return $this->fail($err);
|
||||
}
|
||||
$this->logic->batchUpdateBigwinWeight($items);
|
||||
return $this->success('保存成功');
|
||||
return $this->success('save success');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,13 +209,13 @@ class DiceRewardConfigController extends BaseController
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
#[Permission('奖励配置修改', 'dice:reward_config:index:update')]
|
||||
#[Permission('创建奖励对照', 'dice:reward_config:index:createRewardReference')]
|
||||
public function createRewardReference(Request $request): Response
|
||||
{
|
||||
try {
|
||||
$rewardLogic = new DiceRewardLogic();
|
||||
$result = $rewardLogic->createRewardReferenceFromConfig();
|
||||
return $this->success($result, '创建奖励对照成功');
|
||||
return $this->success($result, 'create reward mapping success');
|
||||
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class DiceRewardConfigRecordController extends BaseController
|
||||
$data['admin_name'] = $this->getAdminName((int) ($data['admin_id'] ?? 0));
|
||||
return $this->success($data);
|
||||
} else {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,9 +96,9 @@ class DiceRewardConfigRecordController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,9 +114,9 @@ class DiceRewardConfigRecordController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,13 +130,13 @@ class DiceRewardConfigRecordController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,12 +144,12 @@ class DiceRewardConfigRecordController extends BaseController
|
||||
* 导入:测试记录 → DiceReward、DiceRewardConfig(BIGWIN)、DiceLotteryPoolConfig(付费/免费 T1-T5)
|
||||
* @param Request $request record_id, paid_lottery_config_id(可选), free_lottery_config_id(可选), lottery_config_id(兼容旧版)
|
||||
*/
|
||||
#[Permission('奖励配置权重测试记录列表', 'dice:reward_config_record:index:index')]
|
||||
#[Permission('导入权重配置', 'dice:reward_config_record:index:importFromRecord')]
|
||||
public function importFromRecord(Request $request): Response
|
||||
{
|
||||
$recordId = (int) $request->post('record_id', 0);
|
||||
if ($recordId <= 0) {
|
||||
return $this->fail('请指定测试记录');
|
||||
return $this->fail('please specify test record');
|
||||
}
|
||||
$paidId = $request->post('paid_lottery_config_id', null);
|
||||
$freeId = $request->post('free_lottery_config_id', null);
|
||||
@@ -159,7 +159,7 @@ class DiceRewardConfigRecordController extends BaseController
|
||||
$lotteryConfigId = $legacyId !== null && $legacyId !== '' ? (int) $legacyId : null;
|
||||
try {
|
||||
$this->logic->importFromRecord($recordId, $paidLotteryConfigId, $freeLotteryConfigId, $lotteryConfigId);
|
||||
return $this->success('导入成功,已刷新 DiceReward、DiceRewardConfig(BIGWIN)、奖池配置');
|
||||
return $this->success('import success, refreshed DiceReward, DiceRewardConfig(BIGWIN), and pool config');
|
||||
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
|
||||
@@ -31,83 +31,59 @@ class DiceLotteryPoolConfigLogic extends BaseLogic
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前彩金池:从 Redis 读取实例,profit_amount 每次从 DB 实时读取(表示玩家在该池子的累计盈利)
|
||||
* 获取当前彩金池(type=0)+ 杀分权重为 type=1 的只读展示
|
||||
* profit_amount 每次从 DB 实时读取;t1_weight~t5_weight 来自 type=1(杀分权重,不可在弹窗内修改)
|
||||
*
|
||||
* @return array{id:int,name:string,safety_line:int,t1_weight:int,t2_weight:int,t3_weight:int,t4_weight:int,t5_weight:int,profit_amount:float}
|
||||
* @return array{id:int,name:string,safety_line:int,kill_enabled:int,t1_weight:int,...,t5_weight:int,profit_amount:float}
|
||||
*/
|
||||
public function getCurrentPool(): array
|
||||
{
|
||||
$cached = Cache::get(self::REDIS_KEY_CURRENT_POOL);
|
||||
if ($cached && is_string($cached)) {
|
||||
$data = json_decode($cached, true);
|
||||
if (is_array($data)) {
|
||||
$config = DiceLotteryPoolConfig::find($data['id'] ?? 0);
|
||||
$profit = 0.0;
|
||||
if ($config) {
|
||||
$profit = isset($config->profit_amount) ? (float) $config->profit_amount : (isset($config->ev) ? (float) $config->ev : 0.0);
|
||||
} else {
|
||||
$profit = (float) ($data['profit_amount'] ?? 0);
|
||||
}
|
||||
$data['profit_amount'] = $profit;
|
||||
return $data;
|
||||
}
|
||||
$configType0 = DiceLotteryPoolConfig::where('name', 'default')->find();
|
||||
if (!$configType0) {
|
||||
throw new ApiException('No name=default pool config found, please create one first');
|
||||
}
|
||||
$config = DiceLotteryPoolConfig::where('type', 0)->find();
|
||||
if (!$config) {
|
||||
throw new ApiException('未找到 type=0 的奖池配置,请先创建');
|
||||
}
|
||||
$row = $config->toArray();
|
||||
$profitAmount = isset($row['profit_amount']) ? (float) $row['profit_amount'] : (isset($row['ev']) ? (float) $row['ev'] : 0.0);
|
||||
$configType1 = DiceLotteryPoolConfig::where('name', 'killScore')->find();
|
||||
$row0 = $configType0->toArray();
|
||||
$profitAmount = isset($row0['profit_amount']) ? (float) $row0['profit_amount'] : (isset($row0['ev']) ? (float) $row0['ev'] : 0.0);
|
||||
$pool = [
|
||||
'id' => (int) $row['id'],
|
||||
'name' => (string) ($row['name'] ?? ''),
|
||||
'safety_line' => (int) ($row['safety_line'] ?? 0),
|
||||
't1_weight' => (int) ($row['t1_weight'] ?? 0),
|
||||
't2_weight' => (int) ($row['t2_weight'] ?? 0),
|
||||
't3_weight' => (int) ($row['t3_weight'] ?? 0),
|
||||
't4_weight' => (int) ($row['t4_weight'] ?? 0),
|
||||
't5_weight' => (int) ($row['t5_weight'] ?? 0),
|
||||
'id' => (int) $row0['id'],
|
||||
'name' => (string) ($row0['name'] ?? ''),
|
||||
'safety_line' => (int) ($row0['safety_line'] ?? 0),
|
||||
'kill_enabled' => (int) ($row0['kill_enabled'] ?? 1),
|
||||
'profit_amount' => $profitAmount,
|
||||
];
|
||||
Cache::set(self::REDIS_KEY_CURRENT_POOL, json_encode($pool), self::EXPIRE);
|
||||
$row1 = $configType1 ? $configType1->toArray() : [];
|
||||
$pool['t1_weight'] = (int) ($row1['t1_weight'] ?? 0);
|
||||
$pool['t2_weight'] = (int) ($row1['t2_weight'] ?? 0);
|
||||
$pool['t3_weight'] = (int) ($row1['t3_weight'] ?? 0);
|
||||
$pool['t4_weight'] = (int) ($row1['t4_weight'] ?? 0);
|
||||
$pool['t5_weight'] = (int) ($row1['t5_weight'] ?? 0);
|
||||
return $pool;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新当前彩金池:仅允许修改 safety_line、t1_weight~t5_weight,不修改 profit_amount
|
||||
* 同时更新 Redis 与 DB 中 type=0 的记录
|
||||
* 更新当前彩金池:仅允许修改 type=0 的 safety_line、kill_enabled(杀分权重来自 type=1,不可在此接口修改)
|
||||
*
|
||||
* @param array{safety_line?:int,t1_weight?:int,t2_weight?:int,t3_weight?:int,t4_weight?:int,t5_weight?:int} $data
|
||||
* @param array{safety_line?:int,kill_enabled?:int} $data
|
||||
*/
|
||||
public function updateCurrentPool(array $data): void
|
||||
{
|
||||
$pool = $this->getCurrentPool();
|
||||
$id = (int) $pool['id'];
|
||||
$config = DiceLotteryPoolConfig::find($id);
|
||||
if (!$config) {
|
||||
throw new ApiException('奖池配置不存在');
|
||||
if (!array_key_exists('safety_line', $data) && !array_key_exists('kill_enabled', $data)) {
|
||||
return;
|
||||
}
|
||||
$allow = ['safety_line', 't1_weight', 't2_weight', 't3_weight', 't4_weight', 't5_weight'];
|
||||
$update = [];
|
||||
foreach ($allow as $k) {
|
||||
if (array_key_exists($k, $data)) {
|
||||
if ($k === 'safety_line') {
|
||||
$update[$k] = (int) $data[$k];
|
||||
} else {
|
||||
$update[$k] = max(0, min(100, (int) $data[$k]));
|
||||
}
|
||||
}
|
||||
if (array_key_exists('safety_line', $data)) {
|
||||
$update['safety_line'] = (int) $data['safety_line'];
|
||||
}
|
||||
if (empty($update)) {
|
||||
if (array_key_exists('kill_enabled', $data)) {
|
||||
$update['kill_enabled'] = ((int) $data['kill_enabled']) === 1 ? 1 : 0;
|
||||
}
|
||||
if ($update === []) {
|
||||
return;
|
||||
}
|
||||
DiceLotteryPoolConfig::where('id', $id)->update($update);
|
||||
$pool = array_merge($pool, $update);
|
||||
$refreshed = DiceLotteryPoolConfig::find($id);
|
||||
$pool['profit_amount'] = $refreshed && (isset($refreshed->profit_amount) || isset($refreshed->ev))
|
||||
? (float) ($refreshed->profit_amount ?? $refreshed->ev)
|
||||
: (float) ($pool['profit_amount'] ?? 0);
|
||||
Cache::set(self::REDIS_KEY_CURRENT_POOL, json_encode($pool), self::EXPIRE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,8 @@ class DicePlayRecordLogic extends BaseLogic
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new DicePlayRecord();
|
||||
// 默认按主键倒序:最新数据优先展示
|
||||
$this->setOrderType('DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,8 @@ class DicePlayerTicketRecordLogic extends BaseLogic
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new DicePlayerTicketRecord();
|
||||
// 默认按主键倒序:最新数据优先展示
|
||||
$this->setOrderType('DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,6 +23,8 @@ class DicePlayerWalletRecordLogic extends BaseLogic
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new DicePlayerWalletRecord();
|
||||
// 默认按主键倒序:最新数据优先展示
|
||||
$this->setOrderType('DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,20 +52,20 @@ class DicePlayerWalletRecordLogic extends BaseLogic
|
||||
$coin = (float) ($data['coin'] ?? 0);
|
||||
|
||||
if ($playerId <= 0 || !in_array($type, [3, 4], true)) {
|
||||
throw new ApiException('参数错误:需要有效的 player_id 和 type(3=加点,4=扣点)');
|
||||
throw new ApiException('Invalid params: player_id and type are required (3=add, 4=deduct)');
|
||||
}
|
||||
if ($coin <= 0) {
|
||||
throw new ApiException('平台币变动必须大于 0');
|
||||
throw new ApiException('Coin change must be greater than 0');
|
||||
}
|
||||
|
||||
$player = DicePlayer::where('id', $playerId)->find();
|
||||
if (!$player) {
|
||||
throw new ApiException('玩家不存在');
|
||||
throw new ApiException('Player not found');
|
||||
}
|
||||
|
||||
$walletBefore = (float) ($player['coin'] ?? 0);
|
||||
if ($type === 4 && $walletBefore < $coin) {
|
||||
throw new ApiException('扣点数量不能大于当前余额');
|
||||
throw new ApiException('Deduct amount cannot exceed current balance');
|
||||
}
|
||||
|
||||
$walletAfter = $type === 3 ? $walletBefore + $coin : $walletBefore - $coin;
|
||||
|
||||
@@ -86,13 +86,13 @@ class DiceRewardLogic
|
||||
$id = isset($item['id']) ? (int) $item['id'] : 0;
|
||||
$weight = isset($item['weight']) ? (int) $item['weight'] : self::WEIGHT_MIN;
|
||||
if ($id <= 0) {
|
||||
throw new ApiException('存在无效的配置ID');
|
||||
throw new ApiException('Invalid config ID exists');
|
||||
}
|
||||
$weight = max(self::WEIGHT_MIN, min(self::WEIGHT_MAX, $weight));
|
||||
|
||||
$tier = DiceRewardConfig::where('id', $id)->value('tier');
|
||||
if ($tier === null || $tier === '') {
|
||||
throw new ApiException('配置ID ' . $id . ' 不存在或档位为空');
|
||||
throw new ApiException(\app\api\util\ApiLang::translateParams('配置ID %s 不存在或档位为空', [$id]));
|
||||
}
|
||||
$tier = (string) $tier;
|
||||
|
||||
@@ -199,7 +199,7 @@ class DiceRewardLogic
|
||||
$id = isset($item['reward_id']) ? (int) $item['reward_id'] : 0;
|
||||
}
|
||||
if ($id <= 0) {
|
||||
throw new ApiException('存在无效的 DiceReward id');
|
||||
throw new ApiException('Invalid DiceReward id exists');
|
||||
}
|
||||
$weight = isset($item['weight']) ? (int) $item['weight'] : self::WEIGHT_MIN;
|
||||
$weight = max(self::WEIGHT_MIN, min(self::WEIGHT_MAX, $weight));
|
||||
@@ -313,12 +313,15 @@ class DiceRewardLogic
|
||||
{
|
||||
$list = DiceRewardConfig::order('id', 'asc')->select()->toArray();
|
||||
if (empty($list)) {
|
||||
throw new ApiException('奖励配置为空,请先维护 dice_reward_config');
|
||||
throw new ApiException('Reward config is empty, please maintain dice_reward_config first');
|
||||
}
|
||||
$configCount = count($list);
|
||||
if ($configCount < self::BOARD_SIZE) {
|
||||
throw new ApiException(
|
||||
'奖励配置需覆盖 26 个格位(id 0-25 或 1-26),当前仅 ' . $configCount . ' 条,无法完整生成 5-30 共26个点数、顺时针与逆时针的奖励对照'
|
||||
\app\api\util\ApiLang::translateParams(
|
||||
'奖励配置需覆盖 26 个格位(id 0-25 或 1-26),当前仅 %s 条,无法完整生成 5-30 共26个点数、顺时针与逆时针的奖励对照',
|
||||
[$configCount]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -319,7 +319,7 @@ class DiceRewardConfigLogic extends BaseLogic
|
||||
{
|
||||
$allowedCounts = [100, 500, 1000, 5000, 10000];
|
||||
if (!in_array($testCount, $allowedCounts, true)) {
|
||||
throw new ApiException('测试次数仅支持 100、500、1000、5000、10000');
|
||||
throw new ApiException('Test count only supports 100, 500, 1000, 5000, 10000');
|
||||
}
|
||||
|
||||
$grouped = [];
|
||||
@@ -333,7 +333,7 @@ class DiceRewardConfigLogic extends BaseLogic
|
||||
$config = DiceLotteryPoolConfig::find($lotteryConfigId);
|
||||
}
|
||||
if (!$config) {
|
||||
$config = DiceLotteryPoolConfig::where('type', 0)->find();
|
||||
$config = DiceLotteryPoolConfig::where('name', 'default')->find();
|
||||
}
|
||||
if ($config) {
|
||||
$tierWeights = [
|
||||
|
||||
@@ -20,6 +20,8 @@ class DiceRewardConfigRecordLogic extends BaseLogic
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new DiceRewardConfigRecord();
|
||||
// 默认按主键倒序:最新数据优先展示
|
||||
$this->setOrderType('DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +83,7 @@ class DiceRewardConfigRecordLogic extends BaseLogic
|
||||
{
|
||||
$record = $this->model->find($recordId);
|
||||
if (!$record) {
|
||||
throw new ApiException('测试记录不存在');
|
||||
throw new ApiException('Test record not found');
|
||||
}
|
||||
$record = is_array($record) ? $record : $record->toArray();
|
||||
|
||||
@@ -195,7 +197,7 @@ class DiceRewardConfigRecordLogic extends BaseLogic
|
||||
if (is_array($paidData) && $paidTargetId > 0) {
|
||||
$pool = DiceLotteryPoolConfig::find($paidTargetId);
|
||||
if (!$pool) {
|
||||
throw new ApiException('付费奖池配置不存在');
|
||||
throw new ApiException('Paid pool config not found');
|
||||
}
|
||||
$update = [
|
||||
't1_weight' => (int) ($paidData['T1'] ?? $paidData['t1'] ?? 0),
|
||||
@@ -209,7 +211,7 @@ class DiceRewardConfigRecordLogic extends BaseLogic
|
||||
if (is_array($freeData) && $freeTargetId > 0) {
|
||||
$pool = DiceLotteryPoolConfig::find($freeTargetId);
|
||||
if (!$pool) {
|
||||
throw new ApiException('免费奖池配置不存在');
|
||||
throw new ApiException('Free pool config not found');
|
||||
}
|
||||
$update = [
|
||||
't1_weight' => (int) ($freeData['T1'] ?? $freeData['t1'] ?? 0),
|
||||
@@ -264,12 +266,12 @@ class DiceRewardConfigRecordLogic extends BaseLogic
|
||||
|
||||
foreach ([$paidS, $paidN, $freeS, $freeN] as $c) {
|
||||
if ($c !== 0 && !in_array($c, $allowed, true)) {
|
||||
throw new ApiException('各抽奖次数仅支持 0、100、500、1000、5000');
|
||||
throw new ApiException('Counts only support 0, 100, 500, 1000, 5000');
|
||||
}
|
||||
}
|
||||
$total = $paidS + $paidN + $freeS + $freeN;
|
||||
if ($total <= 0) {
|
||||
throw new ApiException('付费或免费至少一种方向次数之和大于 0');
|
||||
throw new ApiException('Sum of paid/free direction counts must be greater than 0');
|
||||
}
|
||||
|
||||
$snapshot = [];
|
||||
@@ -314,7 +316,7 @@ class DiceRewardConfigRecordLogic extends BaseLogic
|
||||
if ($paidConfigId > 0) {
|
||||
$config = DiceLotteryPoolConfig::find($paidConfigId);
|
||||
if (!$config) {
|
||||
throw new ApiException('付费奖池配置不存在');
|
||||
throw new ApiException('Paid pool config not found');
|
||||
}
|
||||
$tierWeightsSnapshot['paid'] = [
|
||||
'T1' => (int) ($config->t1_weight ?? 0),
|
||||
@@ -326,19 +328,19 @@ class DiceRewardConfigRecordLogic extends BaseLogic
|
||||
} else {
|
||||
$paidTierWeights = $params['paid_tier_weights'] ?? null;
|
||||
if (!is_array($paidTierWeights)) {
|
||||
throw new ApiException('付费未选择奖池配置时,请填写付费自定义档位概率(T1~T5)');
|
||||
throw new ApiException('When paid pool is not selected, please fill paid custom tier probabilities (T1–T5)');
|
||||
}
|
||||
$tiers = ['T1', 'T2', 'T3', 'T4', 'T5'];
|
||||
foreach ($tiers as $t) {
|
||||
$v = (int) ($paidTierWeights[$t] ?? 0);
|
||||
if ($v < 0 || $v > 100) {
|
||||
throw new ApiException('付费档位概率每档只能 0-100%');
|
||||
throw new ApiException('Paid tier probability must be between 0 and 100%');
|
||||
}
|
||||
$paidTierWeights[$t] = $v;
|
||||
}
|
||||
$paidSum = array_sum(array_intersect_key($paidTierWeights, array_flip($tiers)));
|
||||
if ($paidSum > 100) {
|
||||
throw new ApiException('付费档位概率 T1~T5 之和不能超过 100%');
|
||||
throw new ApiException('Paid tier probabilities (T1–T5) sum cannot exceed 100%');
|
||||
}
|
||||
$tierWeightsSnapshot['paid'] = $paidTierWeights;
|
||||
}
|
||||
@@ -346,7 +348,7 @@ class DiceRewardConfigRecordLogic extends BaseLogic
|
||||
if ($freeConfigId > 0) {
|
||||
$config = DiceLotteryPoolConfig::find($freeConfigId);
|
||||
if (!$config) {
|
||||
throw new ApiException('免费奖池配置不存在');
|
||||
throw new ApiException('Free pool config not found');
|
||||
}
|
||||
$tierWeightsSnapshot['free'] = [
|
||||
'T1' => (int) ($config->t1_weight ?? 0),
|
||||
@@ -358,19 +360,19 @@ class DiceRewardConfigRecordLogic extends BaseLogic
|
||||
} else {
|
||||
$freeTierWeights = $params['free_tier_weights'] ?? null;
|
||||
if (!is_array($freeTierWeights)) {
|
||||
throw new ApiException('免费未选择奖池配置时,请填写免费自定义档位概率(T1~T5)');
|
||||
throw new ApiException('When free pool is not selected, please fill free custom tier probabilities (T1–T5)');
|
||||
}
|
||||
$tiers = ['T1', 'T2', 'T3', 'T4', 'T5'];
|
||||
foreach ($tiers as $t) {
|
||||
$v = (int) ($freeTierWeights[$t] ?? 0);
|
||||
if ($v < 0 || $v > 100) {
|
||||
throw new ApiException('免费档位概率每档只能 0-100%');
|
||||
throw new ApiException('Free tier probability must be between 0 and 100%');
|
||||
}
|
||||
$freeTierWeights[$t] = $v;
|
||||
}
|
||||
$freeSum = array_sum(array_intersect_key($freeTierWeights, array_flip($tiers)));
|
||||
if ($freeSum > 100) {
|
||||
throw new ApiException('免费档位概率 T1~T5 之和不能超过 100%');
|
||||
throw new ApiException('Free tier probabilities (T1–T5) sum cannot exceed 100%');
|
||||
}
|
||||
$tierWeightsSnapshot['free'] = $freeTierWeights;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ use support\think\Db;
|
||||
|
||||
/**
|
||||
* 一键测试权重:单进程后台执行模拟摇色子,写入 dice_play_record_test 并更新 dice_reward_config_record 进度
|
||||
* 抽奖逻辑与 PlayStartLogic 一致:使用 name=default 的安全线、杀分开关;盈利<安全线时付费用玩家权重、免费用 killScore;盈利>=安全线且杀分开启时付费/免费均用 killScore
|
||||
*/
|
||||
class WeightTestRunner
|
||||
{
|
||||
@@ -21,7 +22,7 @@ class WeightTestRunner
|
||||
|
||||
/**
|
||||
* 执行指定测试记录:按付费/免费、顺/逆方向交替模拟(付费顺→付费逆→免费顺→免费逆),每 10 条写入一次测试表并更新进度
|
||||
* 支持:1)lottery_config_id 有值时用奖池配置档位权重;2)无值时用记录中的 paid_tier_weights / free_tier_weights
|
||||
* 使用与 playStart 相同的彩金池逻辑:name=default 的安全线/kill_enabled;付费用 paid_tier_weights(玩家权重)或 killScore;免费用 killScore
|
||||
* @param int $recordId dice_reward_config_record.id
|
||||
*/
|
||||
public function run(int $recordId): void
|
||||
@@ -50,48 +51,37 @@ class WeightTestRunner
|
||||
$total = $paidS + $paidN + $freeS + $freeN;
|
||||
}
|
||||
|
||||
$paidConfigId = (int) ($record->paid_lottery_config_id ?? 0);
|
||||
$freeConfigId = (int) ($record->free_lottery_config_id ?? 0);
|
||||
if ($paidConfigId <= 0) {
|
||||
$paidConfigId = (int) ($record->lottery_config_id ?? 0);
|
||||
}
|
||||
if ($freeConfigId <= 0) {
|
||||
$freeConfigId = (int) ($record->lottery_config_id ?? 0);
|
||||
}
|
||||
$paidConfig = $paidConfigId > 0 ? DiceLotteryPoolConfig::find($paidConfigId) : null;
|
||||
$freeConfig = $freeConfigId > 0 ? DiceLotteryPoolConfig::find($freeConfigId) : null;
|
||||
if ($paidConfigId > 0 && !$paidConfig) {
|
||||
$this->markFailed($recordId, '付费奖池配置不存在');
|
||||
return;
|
||||
}
|
||||
if ($freeConfigId > 0 && !$freeConfig) {
|
||||
$this->markFailed($recordId, '免费奖池配置不存在');
|
||||
$configType0 = DiceLotteryPoolConfig::where('name', 'default')->find();
|
||||
$configType1 = DiceLotteryPoolConfig::where('name', 'killScore')->find();
|
||||
if (!$configType0) {
|
||||
$this->markFailed($recordId, '彩金池配置 name=default 不存在');
|
||||
return;
|
||||
}
|
||||
$safetyLine = (int) ($configType0->safety_line ?? 0);
|
||||
$killEnabled = ((int) ($configType0->kill_enabled ?? 1)) === 1;
|
||||
|
||||
$paidTierWeights = (is_array($record->paid_tier_weights ?? null) && $record->paid_tier_weights !== [])
|
||||
? $record->paid_tier_weights
|
||||
: null;
|
||||
$freeTierWeights = (is_array($record->free_tier_weights ?? null) && $record->free_tier_weights !== [])
|
||||
? $record->free_tier_weights
|
||||
: null;
|
||||
if ($paidConfig === null && $paidTierWeights === null) {
|
||||
$this->markFailed($recordId, '付费未选奖池时需提供 paid_tier_weights');
|
||||
return;
|
||||
}
|
||||
if ($freeConfig === null && $freeTierWeights === null) {
|
||||
$this->markFailed($recordId, '免费未选奖池时需提供 free_tier_weights');
|
||||
: [
|
||||
'T1' => (int) ($configType0->t1_weight ?? 0),
|
||||
'T2' => (int) ($configType0->t2_weight ?? 0),
|
||||
'T3' => (int) ($configType0->t3_weight ?? 0),
|
||||
'T4' => (int) ($configType0->t4_weight ?? 0),
|
||||
'T5' => (int) ($configType0->t5_weight ?? 0),
|
||||
];
|
||||
if (array_sum($paidTierWeights) <= 0) {
|
||||
$this->markFailed($recordId, '需提供 paid_tier_weights(玩家权重,盈利未达安全线时付费抽奖使用)或选择 default 奖池');
|
||||
return;
|
||||
}
|
||||
|
||||
$freeConfig = $configType1 !== null ? $configType1 : $configType0;
|
||||
|
||||
// 每次测试开始前清空进程内静态缓存,强制从共享缓存读取最新 BIGWIN/奖励配置,与数据库一致
|
||||
DiceRewardConfig::clearRequestInstance();
|
||||
DiceReward::clearRequestInstance();
|
||||
|
||||
// 测试时按“单个虚拟玩家”累计中奖金额来判断是否触发杀分:达到 safety_line 前用自定义档位(玩家权重),达到后用奖池权重
|
||||
$paidSafetyLine = $paidConfig !== null ? (int) ($paidConfig->safety_line ?? 0) : 0;
|
||||
$freeSafetyLine = $freeConfig !== null ? (int) ($freeConfig->safety_line ?? 0) : 0;
|
||||
$paidPlayerWinTotal = 0.0;
|
||||
$freePlayerWinTotal = 0.0;
|
||||
// 彩金池累计盈利:用于判断是否触发杀分(不再依赖单个玩家累计盈利)
|
||||
$poolProfitTotal = $configType0->profit_amount ?? 0;
|
||||
|
||||
$playLogic = new PlayStartLogic();
|
||||
$resultCounts = [];
|
||||
@@ -101,40 +91,38 @@ class WeightTestRunner
|
||||
|
||||
try {
|
||||
for ($i = 0; $i < $paidS; $i++) {
|
||||
$usePoolWeights = $paidConfig !== null && $paidPlayerWinTotal >= $paidSafetyLine && $paidSafetyLine > 0;
|
||||
$usePoolWeights = $killEnabled && $poolProfitTotal >= $safetyLine && $configType1 !== null;
|
||||
$paidConfig = $usePoolWeights ? $configType1 : $configType0;
|
||||
$customWeights = $usePoolWeights ? null : $paidTierWeights;
|
||||
$row = $playLogic->simulateOnePlay($paidConfig, 0, 0, $customWeights);
|
||||
$this->accumulatePlayerWin($row, $paidPlayerWinTotal);
|
||||
$this->accumulateProfitForDefault($row, 0, $paidConfig, $configType0, $poolProfitTotal);
|
||||
$this->aggregate($row, $resultCounts, $tierCounts);
|
||||
$buffer[] = $this->rowForInsert($row, $recordId);
|
||||
$done++;
|
||||
$this->flushIfNeeded($buffer, $recordId, $done, $total, $resultCounts, $tierCounts);
|
||||
}
|
||||
for ($i = 0; $i < $paidN; $i++) {
|
||||
$usePoolWeights = $paidConfig !== null && $paidPlayerWinTotal >= $paidSafetyLine && $paidSafetyLine > 0;
|
||||
$usePoolWeights = $killEnabled && $poolProfitTotal >= $safetyLine && $configType1 !== null;
|
||||
$paidConfig = $usePoolWeights ? $configType1 : $configType0;
|
||||
$customWeights = $usePoolWeights ? null : $paidTierWeights;
|
||||
$row = $playLogic->simulateOnePlay($paidConfig, 1, 0, $customWeights);
|
||||
$this->accumulatePlayerWin($row, $paidPlayerWinTotal);
|
||||
$this->accumulateProfitForDefault($row, 0, $paidConfig, $configType0, $poolProfitTotal);
|
||||
$this->aggregate($row, $resultCounts, $tierCounts);
|
||||
$buffer[] = $this->rowForInsert($row, $recordId);
|
||||
$done++;
|
||||
$this->flushIfNeeded($buffer, $recordId, $done, $total, $resultCounts, $tierCounts);
|
||||
}
|
||||
for ($i = 0; $i < $freeS; $i++) {
|
||||
$usePoolWeights = $freeConfig !== null && $freePlayerWinTotal >= $freeSafetyLine && $freeSafetyLine > 0;
|
||||
$customWeights = $usePoolWeights ? null : $freeTierWeights;
|
||||
$row = $playLogic->simulateOnePlay($freeConfig, 0, 1, $customWeights);
|
||||
$this->accumulatePlayerWin($row, $freePlayerWinTotal);
|
||||
$row = $playLogic->simulateOnePlay($freeConfig, 0, 1, null);
|
||||
$this->accumulateProfitForDefault($row, 1, $freeConfig, $configType0, $poolProfitTotal);
|
||||
$this->aggregate($row, $resultCounts, $tierCounts);
|
||||
$buffer[] = $this->rowForInsert($row, $recordId);
|
||||
$done++;
|
||||
$this->flushIfNeeded($buffer, $recordId, $done, $total, $resultCounts, $tierCounts);
|
||||
}
|
||||
for ($i = 0; $i < $freeN; $i++) {
|
||||
$usePoolWeights = $freeConfig !== null && $freePlayerWinTotal >= $freeSafetyLine && $freeSafetyLine > 0;
|
||||
$customWeights = $usePoolWeights ? null : $freeTierWeights;
|
||||
$row = $playLogic->simulateOnePlay($freeConfig, 1, 1, $customWeights);
|
||||
$this->accumulatePlayerWin($row, $freePlayerWinTotal);
|
||||
$row = $playLogic->simulateOnePlay($freeConfig, 1, 1, null);
|
||||
$this->accumulateProfitForDefault($row, 1, $freeConfig, $configType0, $poolProfitTotal);
|
||||
$this->aggregate($row, $resultCounts, $tierCounts);
|
||||
$buffer[] = $this->rowForInsert($row, $recordId);
|
||||
$done++;
|
||||
@@ -152,13 +140,20 @@ class WeightTestRunner
|
||||
}
|
||||
}
|
||||
|
||||
/** 累加单个虚拟玩家在测试过程中的中奖金额(win_coin) */
|
||||
private function accumulatePlayerWin(array $row, float &$runningWinTotal): void
|
||||
/**
|
||||
* 累加彩金池累计盈利,用于触发杀分,与 PlayStartLogic 一致
|
||||
* @param int $lotteryType 0=付费券,1=免费券
|
||||
* @param object $usedConfig 本次使用的奖池配置(仅用于校验非空)
|
||||
* @param object $configType0 name=default 的彩金池
|
||||
* @param float $playerProfitTotal 实际为“彩金池累计盈利”滚动值
|
||||
*/
|
||||
private function accumulateProfitForDefault(array $row, int $lotteryType, $usedConfig, $configType0, float &$playerProfitTotal): void
|
||||
{
|
||||
if (!isset($row['win_coin'])) {
|
||||
if (($lotteryType !== 0 && $lotteryType !== 1) || $usedConfig === null || $configType0 === null || !isset($row['win_coin'])) {
|
||||
return;
|
||||
}
|
||||
$runningWinTotal += (float) $row['win_coin'];
|
||||
$winCoin = (float) $row['win_coin'];
|
||||
$playerProfitTotal += $lotteryType === 0 ? ($winCoin - 100.0) : $winCoin;
|
||||
}
|
||||
|
||||
private function aggregate(array $row, array &$resultCounts, array &$tierCounts): void
|
||||
|
||||
@@ -11,13 +11,13 @@ use plugin\saiadmin\basic\think\BaseModel;
|
||||
/**
|
||||
* 色子奖池配置模型
|
||||
*
|
||||
* dice_lottery_config 色子奖池配置
|
||||
* dice_lottery_pool_config 色子奖池配置
|
||||
*
|
||||
* @property $id ID
|
||||
* @property $name 名称
|
||||
* @property $remark 备注
|
||||
* @property $type 奖池类型
|
||||
* @property $safety_line 安全线
|
||||
* @property $kill_enabled 是否启用杀分:0=关闭 1=开启
|
||||
* @property $create_time 创建时间
|
||||
* @property $update_time 修改时间
|
||||
* @property $t1_weight T1池权重
|
||||
@@ -39,7 +39,7 @@ class DiceLotteryPoolConfig extends BaseModel
|
||||
* 数据库表名称
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'dice_lottery_config';
|
||||
protected $table = 'dice_lottery_pool_config';
|
||||
|
||||
/**
|
||||
* 名称 搜索
|
||||
@@ -49,13 +49,4 @@ class DiceLotteryPoolConfig extends BaseModel
|
||||
$query->where('name', 'like', '%'.$value.'%');
|
||||
}
|
||||
|
||||
/**
|
||||
* 奖池类型 搜索(type=0/1/2 等)
|
||||
*/
|
||||
public function searchTypeAttr($query, $value)
|
||||
{
|
||||
if ($value !== '' && $value !== null) {
|
||||
$query->where('type', '=', $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,26 +78,26 @@ class DicePlayer extends BaseModel
|
||||
if ($name === null || $name === '') {
|
||||
$model->setAttr('name', $uid);
|
||||
}
|
||||
// 创建玩家时:未指定则自动保存 lottery_config_id 为 DiceLotteryPoolConfig type=0 的 id,没有则为 0
|
||||
// 创建玩家时:未指定则自动保存 lottery_config_id 为 DiceLotteryPoolConfig name=default 的 id,没有则为 0
|
||||
try {
|
||||
$lotteryConfigId = $model->getAttr('lottery_config_id');
|
||||
} catch (\Throwable $e) {
|
||||
$lotteryConfigId = null;
|
||||
}
|
||||
if ($lotteryConfigId === null || $lotteryConfigId === '' || (int) $lotteryConfigId === 0) {
|
||||
$config = DiceLotteryPoolConfig::where('type', 0)->find();
|
||||
$config = DiceLotteryPoolConfig::where('name', 'default')->find();
|
||||
$model->setAttr('lottery_config_id', $config ? (int) $config->id : 0);
|
||||
}
|
||||
// 彩金池权重默认取 type=0 的奖池配置
|
||||
// 彩金池权重默认取 name=default 的奖池配置
|
||||
self::setDefaultWeightsFromLotteryConfig($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从 DiceLotteryPoolConfig type=0 取 t1_weight~t5_weight 作为玩家未设置时的默认值
|
||||
* 从 DiceLotteryPoolConfig name=default 取 t1_weight~t5_weight 作为玩家未设置时的默认值
|
||||
*/
|
||||
protected static function setDefaultWeightsFromLotteryConfig(DicePlayer $model): void
|
||||
{
|
||||
$config = DiceLotteryPoolConfig::where('type', 0)->find();
|
||||
$config = DiceLotteryPoolConfig::where('name', 'default')->find();
|
||||
if (!$config) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ class DiceLotteryPoolConfigValidate extends BaseValidate
|
||||
*/
|
||||
protected $rule = [
|
||||
'name' => 'require',
|
||||
'type' => 'require',
|
||||
't1_weight' => 'require',
|
||||
't2_weight' => 'require',
|
||||
't3_weight' => 'require',
|
||||
@@ -31,7 +30,6 @@ class DiceLotteryPoolConfigValidate extends BaseValidate
|
||||
*/
|
||||
protected $message = [
|
||||
'name' => '名称必须填写',
|
||||
'type' => '奖池类型必须填写',
|
||||
't1_weight' => 'T1池权重必须填写',
|
||||
't2_weight' => 'T2池权重必须填写',
|
||||
't3_weight' => 'T3池权重必须填写',
|
||||
@@ -45,7 +43,6 @@ class DiceLotteryPoolConfigValidate extends BaseValidate
|
||||
protected $scene = [
|
||||
'save' => [
|
||||
'name',
|
||||
'type',
|
||||
't1_weight',
|
||||
't2_weight',
|
||||
't3_weight',
|
||||
@@ -54,7 +51,6 @@ class DiceLotteryPoolConfigValidate extends BaseValidate
|
||||
],
|
||||
'update' => [
|
||||
'name',
|
||||
'type',
|
||||
't1_weight',
|
||||
't2_weight',
|
||||
't3_weight',
|
||||
|
||||
@@ -69,7 +69,7 @@ The exact implementation is in the dice game logic layer and related services. A
|
||||
|
||||
3. Get or create lottery pool:
|
||||
- `LotteryService::getOrCreate()`
|
||||
- Reads from Redis; if missing, reads from DB (for example, `DiceLotteryPoolConfig::where('type', 0/1)->find()`).
|
||||
- Reads from Redis; if missing, reads from DB (for example, `DiceLotteryPoolConfig::where('name','default/killScore')->find()`).
|
||||
|
||||
4. Load concrete pool config for this play:
|
||||
- `DiceLotteryPoolConfig::find($configId)`
|
||||
@@ -115,7 +115,7 @@ Goal: hot paths should hit Redis most of the time, and DB should primarily be fo
|
||||
- In `playStart`, ensure player is loaded once and reused (do not call `DicePlayer::find` multiple times per request).
|
||||
|
||||
3. EV update strategy:
|
||||
- Repeated `UPDATE dice_lottery_config SET ev = ev - ?` on a hot row causes lock contention.
|
||||
- Repeated `UPDATE dice_lottery_pool_config SET ev = ev - ?` on a hot row causes lock contention.
|
||||
- Better:
|
||||
- Accumulate EV deltas in Redis (per pool or per shard).
|
||||
- Periodic cron job to aggregate Redis deltas back into MySQL in batches.
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
3. **获取或创建奖池(LotteryService)**
|
||||
- 调用 `LotteryService::getOrCreate()`:
|
||||
- 优先从 Redis 中读取奖池信息;
|
||||
- 若缓存不存在,则从 DB 中加载:如 `DiceLotteryPoolConfig::where('type', 0/1)->find()`。
|
||||
- 若缓存不存在,则从 DB 中加载:如 `DiceLotteryPoolConfig::where('name','default/killScore')->find()`。
|
||||
|
||||
4. **根据本次玩法加载奖池配置**
|
||||
- 调用 `DiceLotteryPoolConfig::find($configId)`。
|
||||
@@ -113,7 +113,7 @@
|
||||
- 在 `playStart` 中,玩家信息应只查询一次:`$player = DicePlayer::find($playerId)`,后续逻辑统一使用 `$player`,避免重复 `find`。
|
||||
|
||||
3. **EV 更新策略**
|
||||
- 频繁在在线请求中执行 `UPDATE dice_lottery_config SET ev = ev - ?`,会造成该行热点锁竞争;
|
||||
- 频繁在在线请求中执行 `UPDATE dice_lottery_pool_config SET ev = ev - ?`,会造成该行热点锁竞争;
|
||||
- 建议:
|
||||
- 在线请求仅将 EV 变动累加到 Redis 计数器;
|
||||
- 通过定时任务批量同步 Redis 中的统计数据回 MySQL。
|
||||
|
||||
@@ -63,7 +63,7 @@ class InstallController extends OpenController
|
||||
|
||||
clearstatcache();
|
||||
if (is_file($env)) {
|
||||
return $this->fail('管理后台已经安装!如需重新安装,请删除根目录env配置文件并重启');
|
||||
return $this->fail('admin already installed, to reinstall please delete env file and restart');
|
||||
}
|
||||
|
||||
$user = $request->post('username');
|
||||
@@ -82,13 +82,13 @@ class InstallController extends OpenController
|
||||
} catch (\Throwable $e) {
|
||||
$message = $e->getMessage();
|
||||
if (stripos($message, 'Access denied for user')) {
|
||||
return $this->fail('数据库用户名或密码错误');
|
||||
return $this->fail('database username or password is incorrect');
|
||||
}
|
||||
if (stripos($message, 'Connection refused')) {
|
||||
return $this->fail('Connection refused. 请确认数据库IP端口是否正确,数据库已经启动');
|
||||
return $this->fail('connection refused, please check database ip/port and ensure database is running');
|
||||
}
|
||||
if (stripos($message, 'timed out')) {
|
||||
return $this->fail('数据库连接超时,请确认数据库IP端口是否正确,安全组及防火墙已经放行端口');
|
||||
return $this->fail('database connection timeout, please check ip/port and firewall/security group rules');
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ class InstallController extends OpenController
|
||||
$smt = $db->query("show tables like 'sa_system_menu';");
|
||||
$tables = $smt->fetchAll();
|
||||
if (count($tables) > 0) {
|
||||
return $this->fail('数据库已经安装,请勿重复安装');
|
||||
return $this->fail('database already installed, please do not install again');
|
||||
}
|
||||
|
||||
if ($dataType == 'demo') {
|
||||
@@ -108,7 +108,7 @@ class InstallController extends OpenController
|
||||
}
|
||||
|
||||
if (!is_file($sql_file)) {
|
||||
return $this->fail('数据库SQL文件不存在');
|
||||
return $this->fail('database SQL file not found');
|
||||
}
|
||||
|
||||
$sql_query = file_get_contents($sql_file);
|
||||
@@ -151,7 +151,7 @@ EOF;
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
return $this->success('安装成功');
|
||||
return $this->success('install success');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ class LoginController extends BaseController
|
||||
if ($captchaEnabled) {
|
||||
$captcha = new Captcha();
|
||||
if (!$captcha->checkCaptcha($uuid, $code)) {
|
||||
return $this->fail('验证码错误');
|
||||
return $this->fail('captcha error');
|
||||
}
|
||||
}
|
||||
$logic = new SystemUserLogic();
|
||||
|
||||
@@ -37,14 +37,14 @@ class SystemController extends BaseController
|
||||
if ($adminInfo === null || !is_array($adminInfo) || !isset($adminInfo['id'])) {
|
||||
$token = getCurrentInfo();
|
||||
if (!is_array($token) || empty($token['id'])) {
|
||||
return $this->fail('登录已过期或用户信息无效,请重新登录', 401);
|
||||
return $this->fail('login expired or invalid, please login again', 401);
|
||||
}
|
||||
$adminInfo = UserInfoCache::getUserInfo($token['id']);
|
||||
if (empty($adminInfo) || !isset($adminInfo['id'])) {
|
||||
$adminInfo = UserInfoCache::setUserInfo($token['id']);
|
||||
}
|
||||
if (empty($adminInfo) || !isset($adminInfo['id'])) {
|
||||
return $this->fail('登录已过期或用户信息无效,请重新登录', 401);
|
||||
return $this->fail('login expired or invalid, please login again', 401);
|
||||
}
|
||||
$this->adminInfo = $adminInfo;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class SystemController extends BaseController
|
||||
public function menu(): Response
|
||||
{
|
||||
if (!$this->ensureAdminInfo()) {
|
||||
return $this->fail('登录已过期或用户信息无效,请重新登录', 401);
|
||||
return $this->fail('login expired or invalid, please login again', 401);
|
||||
}
|
||||
$data = UserMenuCache::getUserMenu($this->adminInfo['id']);
|
||||
return $this->success($data);
|
||||
@@ -151,7 +151,7 @@ class SystemController extends BaseController
|
||||
$config = Storage::getConfig('local');
|
||||
$logic = new SystemAttachmentLogic();
|
||||
$data = $logic->saveNetworkImage($url, $config);
|
||||
return $this->success($data, '操作成功');
|
||||
return $this->success($data, 'operation success');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -228,7 +228,7 @@ class SystemController extends BaseController
|
||||
UserInfoCache::clearUserInfo($this->adminId);
|
||||
UserAuthCache::clearUserAuth($this->adminId);
|
||||
UserMenuCache::clearUserMenu($this->adminId);
|
||||
return $this->success([], '清除缓存成功!');
|
||||
return $this->success([], 'clear cache success');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,11 +78,11 @@ class DataBaseController extends BaseController
|
||||
if (!empty($ids)) {
|
||||
$result = $this->logic->delete($table, $ids);
|
||||
if (!$result) {
|
||||
return $this->fail('操作失败');
|
||||
return $this->fail('operation failed');
|
||||
}
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
} else {
|
||||
return $this->fail('参数错误,请检查');
|
||||
return $this->fail('invalid parameters, please check');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,11 +99,11 @@ class DataBaseController extends BaseController
|
||||
if (!empty($ids)) {
|
||||
$result = $this->logic->recovery($table, $ids);
|
||||
if (!$result) {
|
||||
return $this->fail('操作失败');
|
||||
return $this->fail('operation failed');
|
||||
}
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
} else {
|
||||
return $this->fail('参数错误,请检查');
|
||||
return $this->fail('invalid parameters, please check');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ class DataBaseController extends BaseController
|
||||
{
|
||||
$tables = $request->input('tables', []);
|
||||
$this->logic->optimizeTable($tables);
|
||||
return $this->success('优化成功');
|
||||
return $this->success('optimize success');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +141,7 @@ class DataBaseController extends BaseController
|
||||
{
|
||||
$tables = $request->input('tables', []);
|
||||
$this->logic->fragmentTable($tables);
|
||||
return $this->success('清理成功');
|
||||
return $this->success('clean success');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -57,9 +57,9 @@ class SystemAttachmentController extends BaseController
|
||||
$data = $request->post();
|
||||
$result = $this->logic->edit($data['id'], ['origin_name' => $data['origin_name']]);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,13 +73,13 @@ class SystemAttachmentController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,13 +94,13 @@ class SystemAttachmentController extends BaseController
|
||||
$category_id = $request->post('category_id', '');
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids) || empty($category_id)) {
|
||||
return $this->fail('参数错误,请检查参数');
|
||||
return $this->fail('invalid parameters, please check');
|
||||
}
|
||||
$result = $this->logic->move($category_id, $ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class SystemCategoryController extends BaseController
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
} else {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,9 +73,9 @@ class SystemCategoryController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,9 +91,9 @@ class SystemCategoryController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,13 +107,13 @@ class SystemCategoryController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@ class SystemConfigController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ class SystemConfigController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,13 +96,13 @@ class SystemConfigController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,10 +117,10 @@ class SystemConfigController extends BaseController
|
||||
$group_id = $request->post('group_id');
|
||||
$config = $request->post('config');
|
||||
if (empty($group_id) || empty($config)) {
|
||||
return $this->fail('参数错误');
|
||||
return $this->fail('Invalid parameters');
|
||||
}
|
||||
$this->logic->batchUpdate($group_id, $config);
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ class SystemConfigGroupController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ class SystemConfigGroupController extends BaseController
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
ConfigCache::clearConfig($data['code']);
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,13 +96,13 @@ class SystemConfigGroupController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ class SystemConfigGroupController extends BaseController
|
||||
{
|
||||
$email = $request->input('email', '');
|
||||
if (empty($email)) {
|
||||
return $this->fail('请输入邮箱');
|
||||
return $this->fail('please input email');
|
||||
}
|
||||
$subject = "测试邮件";
|
||||
$code = "9527";
|
||||
@@ -137,11 +137,11 @@ class SystemConfigGroupController extends BaseController
|
||||
$model->status = 'failure';
|
||||
$model->response = $result;
|
||||
$model->save();
|
||||
return $this->fail('发送失败,请查看日志');
|
||||
return $this->fail('send failed, please check logs');
|
||||
} else {
|
||||
$model->status = 'success';
|
||||
$model->save();
|
||||
return $this->success([], '发送成功');
|
||||
return $this->success([], 'send success');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$model->status = 'failure';
|
||||
|
||||
@@ -59,7 +59,7 @@ class SystemDeptController extends BaseController
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
} else {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ class SystemDeptController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,9 +93,9 @@ class SystemDeptController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,13 +109,13 @@ class SystemDeptController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,9 +63,9 @@ class SystemDictDataController extends BaseController
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
DictCache::clear();
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,9 +82,9 @@ class SystemDictDataController extends BaseController
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
DictCache::clear();
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,14 +98,14 @@ class SystemDictDataController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
DictCache::clear();
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@ class SystemDictTypeController extends BaseController
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
DictCache::clear();
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ class SystemDictTypeController extends BaseController
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
DictCache::clear();
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,14 +96,14 @@ class SystemDictTypeController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
DictCache::clear();
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,9 +51,9 @@ class SystemLogController extends BaseController
|
||||
$logic = new SystemLoginLogLogic();
|
||||
if (!empty($ids)) {
|
||||
$logic->destroy($ids);
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('参数错误,请检查');
|
||||
return $this->fail('invalid parameters, please check');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,9 +91,9 @@ class SystemLogController extends BaseController
|
||||
$logic = new SystemOperLogLogic();
|
||||
if (!empty($ids)) {
|
||||
$logic->destroy($ids);
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('参数错误,请检查');
|
||||
return $this->fail('invalid parameters, please check');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,13 +59,13 @@ class SystemMailController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class SystemMenuController extends BaseController
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
} else {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,9 +78,9 @@ class SystemMenuController extends BaseController
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
UserMenuCache::clearMenuCache();
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@ class SystemMenuController extends BaseController
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
UserMenuCache::clearMenuCache();
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,14 +113,14 @@ class SystemMenuController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
UserMenuCache::clearMenuCache();
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class SystemPostController extends BaseController
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
} else {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ class SystemPostController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,9 +94,9 @@ class SystemPostController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,13 +110,13 @@ class SystemPostController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,10 +130,10 @@ class SystemPostController extends BaseController
|
||||
{
|
||||
$file = current($request->file());
|
||||
if (!$file || !$file->isValid()) {
|
||||
return $this->fail('未找到上传文件');
|
||||
return $this->fail('uploaded file not found');
|
||||
}
|
||||
$this->logic->import($file);
|
||||
return $this->success('导入成功');
|
||||
return $this->success('import success');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -66,7 +66,7 @@ class SystemRoleController extends BaseController
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
} else {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,9 +82,9 @@ class SystemRoleController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,9 +100,9 @@ class SystemRoleController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,13 +116,13 @@ class SystemRoleController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ class SystemRoleController extends BaseController
|
||||
$id = $request->post('id');
|
||||
$menu_ids = $request->post('menu_ids');
|
||||
$this->logic->saveMenuPermission($id, $menu_ids);
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,11 +75,11 @@ class SystemServerController extends BaseController
|
||||
{
|
||||
$tag = $request->input('tag', '');
|
||||
if (empty($tag)) {
|
||||
return $this->fail('请选择要删除的缓存');
|
||||
return $this->fail('please select cache to delete');
|
||||
}
|
||||
Cache::tag($tag)->clear();
|
||||
Cache::delete($tag);
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class SystemUserController extends BaseController
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
} else {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,9 @@ class SystemUserController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,9 +99,9 @@ class SystemUserController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,9 +116,9 @@ class SystemUserController extends BaseController
|
||||
$ids = $request->input('ids', '');
|
||||
if (!empty($ids)) {
|
||||
$this->logic->destroy($ids);
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
} else {
|
||||
return $this->fail('参数错误,请检查');
|
||||
return $this->fail('invalid parameters, please check');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ class SystemUserController extends BaseController
|
||||
UserInfoCache::clearUserInfo($id);
|
||||
UserAuthCache::clearUserAuth($id);
|
||||
UserMenuCache::clearUserMenu($id);
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,12 +148,12 @@ class SystemUserController extends BaseController
|
||||
$id = $request->post('id', '');
|
||||
$password = $request->post('password', '');
|
||||
if ($id == 1) {
|
||||
return $this->fail('超级管理员不允许重置密码');
|
||||
return $this->fail('super admin cannot reset password');
|
||||
}
|
||||
$data = ['password' => password_hash($password, PASSWORD_DEFAULT)];
|
||||
$this->logic->authEdit($id, $data);
|
||||
UserInfoCache::clearUserInfo($id);
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,7 +169,7 @@ class SystemUserController extends BaseController
|
||||
$data = ['dashboard' => $dashboard];
|
||||
$this->logic->authEdit($id, $data);
|
||||
UserInfoCache::clearUserInfo($id);
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,9 +187,9 @@ class SystemUserController extends BaseController
|
||||
$result = $this->logic->updateInfo($this->adminId, $data);
|
||||
if ($result) {
|
||||
UserInfoCache::clearUserInfo($this->adminId);
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
} else {
|
||||
return $this->fail('操作失败');
|
||||
return $this->fail('operation failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,6 +205,6 @@ class SystemUserController extends BaseController
|
||||
$newPassword = $request->input('newPassword');
|
||||
$this->logic->modifyPassword($this->adminId, $oldPassword, $newPassword);
|
||||
UserInfoCache::clearUserInfo($this->adminId);
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ class CrontabController extends BaseController
|
||||
$this->validate('save', $data);
|
||||
$result = $this->logic->add($data);
|
||||
if ($result) {
|
||||
return $this->success('添加成功');
|
||||
return $this->success('add success');
|
||||
} else {
|
||||
return $this->fail('添加失败');
|
||||
return $this->fail('add failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,9 +79,9 @@ class CrontabController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,13 +95,13 @@ class CrontabController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,13 +116,13 @@ class CrontabController extends BaseController
|
||||
$id = $request->input('id', '');
|
||||
$status = $request->input('status', 1);
|
||||
if (empty($id)) {
|
||||
return $this->fail('参数错误,请检查');
|
||||
return $this->fail('invalid parameters, please check');
|
||||
}
|
||||
$result = $this->logic->changeStatus($id, $status);
|
||||
if ($result) {
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
} else {
|
||||
return $this->fail('操作失败');
|
||||
return $this->fail('operation failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,9 +137,9 @@ class CrontabController extends BaseController
|
||||
$id = $request->input('id', '');
|
||||
$result = $this->logic->run($id);
|
||||
if ($result) {
|
||||
return $this->success('执行成功');
|
||||
return $this->success('execute success');
|
||||
} else {
|
||||
return $this->fail('执行失败');
|
||||
return $this->fail('execution failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,9 +173,9 @@ class CrontabController extends BaseController
|
||||
if (!empty($ids)) {
|
||||
$logic = new CrontabLogLogic();
|
||||
$logic->destroy($ids);
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
} else {
|
||||
return $this->fail('参数错误,请检查');
|
||||
return $this->fail('invalid parameters, please check');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class GenerateTablesController extends BaseController
|
||||
$data = is_array($model) ? $model : $model->toArray();
|
||||
return $this->success($data);
|
||||
} else {
|
||||
return $this->fail('未查找到信息');
|
||||
return $this->fail('not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ class GenerateTablesController extends BaseController
|
||||
$this->validate('update', $data);
|
||||
$result = $this->logic->edit($data['id'], $data);
|
||||
if ($result) {
|
||||
return $this->success('修改成功');
|
||||
return $this->success('update success');
|
||||
} else {
|
||||
return $this->fail('修改失败');
|
||||
return $this->fail('update failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,13 +91,13 @@ class GenerateTablesController extends BaseController
|
||||
{
|
||||
$ids = $request->post('ids', '');
|
||||
if (empty($ids)) {
|
||||
return $this->fail('请选择要删除的数据');
|
||||
return $this->fail('please select data to delete');
|
||||
}
|
||||
$result = $this->logic->destroy($ids);
|
||||
if ($result) {
|
||||
return $this->success('删除成功');
|
||||
return $this->success('delete success');
|
||||
} else {
|
||||
return $this->fail('删除失败');
|
||||
return $this->fail('delete failed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ class GenerateTablesController extends BaseController
|
||||
$names = $request->input('names', []);
|
||||
$source = $request->input('source', '');
|
||||
$this->logic->loadTable($names, $source);
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +125,7 @@ class GenerateTablesController extends BaseController
|
||||
{
|
||||
$id = $request->input('id', '');
|
||||
$this->logic->sync($id);
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,7 +159,7 @@ class GenerateTablesController extends BaseController
|
||||
$id = $request->input('id', '');
|
||||
$this->logic->generateFile($id);
|
||||
UserMenuCache::clearMenuCache();
|
||||
return $this->success('操作成功');
|
||||
return $this->success('operation success');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,7 @@ if (!function_exists('downloadFile')) {
|
||||
if (file_exists($base_dir . DIRECTORY_SEPARATOR . $file_name)) {
|
||||
return response()->download($base_dir . DIRECTORY_SEPARATOR . $file_name, urlencode($file_name));
|
||||
} else {
|
||||
throw new ApiException('模板不存在');
|
||||
throw new ApiException('Template not found');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ class DatabaseLogic extends BaseLogic
|
||||
$isDeleteTime = true;
|
||||
}
|
||||
if (!$isDeleteTime) {
|
||||
throw new ApiException('当前表不支持回收站功能');
|
||||
throw new ApiException('Current table does not support recycle bin');
|
||||
}
|
||||
// 查询软删除数据
|
||||
$request = request();
|
||||
|
||||
@@ -38,7 +38,7 @@ class SystemAttachmentLogic extends BaseLogic
|
||||
{
|
||||
$category = SystemCategory::where('id', $category_id)->findOrEmpty();
|
||||
if ($category->isEmpty()) {
|
||||
throw new ApiException('目标分类不存在');
|
||||
throw new ApiException('Target category not found');
|
||||
}
|
||||
return $this->model->whereIn('id', $ids)->update(['category_id' => $category_id]);
|
||||
}
|
||||
@@ -54,11 +54,11 @@ class SystemAttachmentLogic extends BaseLogic
|
||||
{
|
||||
$image_data = file_get_contents($url);
|
||||
if ($image_data === false) {
|
||||
throw new ApiException('获取文件资源失败');
|
||||
throw new ApiException('Failed to get file resource');
|
||||
}
|
||||
$image_resource = imagecreatefromstring($image_data);
|
||||
if (!$image_resource) {
|
||||
throw new ApiException('创建图片资源失败');
|
||||
throw new ApiException('Failed to create image resource');
|
||||
}
|
||||
$filename = basename($url);
|
||||
$file_extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
@@ -84,11 +84,11 @@ class SystemAttachmentLogic extends BaseLogic
|
||||
break;
|
||||
default:
|
||||
imagedestroy($image_resource);
|
||||
throw new ApiException('文件格式错误');
|
||||
throw new ApiException('Invalid file format');
|
||||
}
|
||||
imagedestroy($image_resource);
|
||||
if (!$result) {
|
||||
throw new ApiException('文件保存失败');
|
||||
throw new ApiException('Failed to save file');
|
||||
}
|
||||
|
||||
$hash = md5_file($save_path);
|
||||
|
||||
@@ -41,14 +41,14 @@ class SystemCategoryLogic extends BaseLogic
|
||||
{
|
||||
$data = $this->handleData($data);
|
||||
if ($data['parent_id'] == $id) {
|
||||
throw new ApiException('上级分类和当前分类不能相同');
|
||||
throw new ApiException('Parent category cannot be the same as current');
|
||||
}
|
||||
if (in_array($id, explode(',', $data['level']))) {
|
||||
throw new ApiException('不能将上级分类设置为当前分类的子分类');
|
||||
throw new ApiException('Cannot set parent category as child of current');
|
||||
}
|
||||
$model = $this->model->findOrEmpty($id);
|
||||
if ($model->isEmpty()) {
|
||||
throw new ApiException('数据不存在');
|
||||
throw new ApiException('Data not found');
|
||||
}
|
||||
return $model->save($data);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class SystemCategoryLogic extends BaseLogic
|
||||
{
|
||||
$num = $this->model->where('parent_id', 'in', $ids)->count();
|
||||
if ($num > 0) {
|
||||
throw new ApiException('该部门下存在子分类,请先删除子分类');
|
||||
throw new ApiException('This category has sub-categories, please delete them first');
|
||||
} else {
|
||||
return $this->model->destroy($ids);
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ class SystemConfigGroupLogic extends BaseLogic
|
||||
$id = $ids[0];
|
||||
$model = $this->model->where('id', $id)->findOrEmpty();
|
||||
if ($model->isEmpty()) {
|
||||
throw new ApiException('配置数据未找到');
|
||||
throw new ApiException('Config data not found');
|
||||
}
|
||||
if (in_array(intval($id), [1, 2, 3])) {
|
||||
throw new ApiException('系统默认分组,无法删除');
|
||||
throw new ApiException('System default group cannot be deleted');
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
@@ -51,7 +51,7 @@ class SystemConfigGroupLogic extends BaseLogic
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
throw new ApiException('删除数据异常,请检查');
|
||||
throw new ApiException('Delete data error, please check');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class SystemConfigLogic extends BaseLogic
|
||||
{
|
||||
$group = SystemConfigGroup::find($group_id);
|
||||
if (!$group) {
|
||||
throw new ApiException('配置组未找到');
|
||||
throw new ApiException('Config group not found');
|
||||
}
|
||||
$saveData = [];
|
||||
foreach ($config as $key => $value) {
|
||||
|
||||
@@ -44,10 +44,10 @@ class SystemDeptLogic extends BaseLogic
|
||||
$oldLevel = $data['level'] . $id . ',';
|
||||
$data = $this->handleData($data);
|
||||
if ($data['parent_id'] == $id) {
|
||||
throw new ApiException('上级部门和当前部门不能相同');
|
||||
throw new ApiException('Parent department cannot be the same as current department');
|
||||
}
|
||||
if (in_array($id, explode(',', $data['level']))) {
|
||||
throw new ApiException('不能将上级部门设置为当前部门的子部门');
|
||||
throw new ApiException('Cannot set parent department to a child of current department');
|
||||
}
|
||||
$newLevel = $data['level'] . $id . ',';
|
||||
$deptIds = $this->model->where('level', 'like', $oldLevel . '%')->column('id');
|
||||
@@ -65,11 +65,11 @@ class SystemDeptLogic extends BaseLogic
|
||||
{
|
||||
$num = $this->model->where('parent_id', 'in', $ids)->count();
|
||||
if ($num > 0) {
|
||||
throw new ApiException('该部门下存在子部门,请先删除子部门');
|
||||
throw new ApiException('This department has sub-departments, please delete them first');
|
||||
} else {
|
||||
$count = SystemUser::where('dept_id', 'in', $ids)->count();
|
||||
if ($count > 0) {
|
||||
throw new ApiException('该部门下存在用户,请先删除或者转移用户');
|
||||
throw new ApiException('This department has users, please delete or transfer them first');
|
||||
}
|
||||
return $this->model->destroy($ids);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class SystemDictDataLogic extends BaseLogic
|
||||
{
|
||||
$type = SystemDictType::where('id', $data['type_id'])->findOrEmpty();
|
||||
if ($type->isEmpty()) {
|
||||
throw new ApiException('字典类型不存在');
|
||||
throw new ApiException('Dict type not found');
|
||||
}
|
||||
$data['code'] = $type->code;
|
||||
$model = $this->model->create($data);
|
||||
|
||||
@@ -32,7 +32,7 @@ class SystemDictTypeLogic extends BaseLogic
|
||||
{
|
||||
$model = $this->model->where('code', $data['code'])->findOrEmpty();
|
||||
if (!$model->isEmpty()) {
|
||||
throw new ApiException('该字典标识已存在');
|
||||
throw new ApiException('This dict code already exists');
|
||||
}
|
||||
return $this->model->save($data);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ class SystemDictTypeLogic extends BaseLogic
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
throw new ApiException('修改数据异常,请检查');
|
||||
throw new ApiException('Update data error, please check');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class SystemDictTypeLogic extends BaseLogic
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
throw new ApiException('删除数据异常,请检查');
|
||||
throw new ApiException('Delete data error, please check');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class SystemMenuLogic extends BaseLogic
|
||||
{
|
||||
$data = $this->handleData($data);
|
||||
if ($data['parent_id'] == $id) {
|
||||
throw new ApiException('不能设置父级为自身');
|
||||
throw new ApiException('Cannot set parent to self');
|
||||
}
|
||||
return $this->model->update($data, ['id' => $id]);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class SystemMenuLogic extends BaseLogic
|
||||
{
|
||||
$num = $this->model->where('parent_id', 'in', $ids)->count();
|
||||
if ($num > 0) {
|
||||
throw new ApiException('该菜单下存在子菜单,请先删除子菜单');
|
||||
throw new ApiException('This menu has sub-menus, please delete them first');
|
||||
} else {
|
||||
return $this->model->destroy($ids);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class SystemPostLogic extends BaseLogic
|
||||
}
|
||||
$this->saveAll($data);
|
||||
} catch (\Exception $e) {
|
||||
throw new ApiException('导入文件错误,请上传正确的文件格式xlsx');
|
||||
throw new ApiException('Import file error, please upload correct xlsx file');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class SystemRoleLogic extends BaseLogic
|
||||
{
|
||||
$model = $this->model->findOrEmpty($id);
|
||||
if ($model->isEmpty()) {
|
||||
throw new ApiException('数据不存在');
|
||||
throw new ApiException('Data not found');
|
||||
}
|
||||
$data = $this->handleData($data);
|
||||
return $model->save($data);
|
||||
@@ -60,7 +60,7 @@ class SystemRoleLogic extends BaseLogic
|
||||
|
||||
$num = SystemRole::where('level', '>=', $maxLevel)->whereIn('id', $ids)->count();
|
||||
if ($num > 0) {
|
||||
throw new ApiException('不能操作比当前账户职级高的角色');
|
||||
throw new ApiException('Cannot operate roles with higher level than current account');
|
||||
} else {
|
||||
return $this->model->destroy($ids);
|
||||
}
|
||||
@@ -75,7 +75,7 @@ class SystemRoleLogic extends BaseLogic
|
||||
$levelArr = array_column($this->adminInfo['roleList'], 'level');
|
||||
$maxLevel = max($levelArr);
|
||||
if ($data['level'] >= $maxLevel) {
|
||||
throw new ApiException('不能操作比当前账户职级高的角色');
|
||||
throw new ApiException('Cannot operate roles with higher level than current account');
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class SystemUserLogic extends BaseLogic
|
||||
if ($this->adminInfo['id'] > 1) {
|
||||
// 部门保护
|
||||
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
|
||||
throw new ApiException('没有权限操作该部门数据');
|
||||
throw new ApiException('No permission to operate department data');
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
@@ -105,11 +105,11 @@ class SystemUserLogic extends BaseLogic
|
||||
if ($this->adminInfo['id'] > 1) {
|
||||
// 部门保护
|
||||
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
|
||||
throw new ApiException('没有权限操作该部门数据');
|
||||
throw new ApiException('No permission to operate department data');
|
||||
}
|
||||
// 越权保护
|
||||
if (!$this->roleProtect($this->adminInfo['roleList'], $role_ids)) {
|
||||
throw new ApiException('没有权限操作该角色数据');
|
||||
throw new ApiException('No permission to operate role data');
|
||||
}
|
||||
}
|
||||
$user = SystemUser::create($data);
|
||||
@@ -142,16 +142,16 @@ class SystemUserLogic extends BaseLogic
|
||||
}
|
||||
$user = $query->findOrEmpty();
|
||||
if ($user->isEmpty()) {
|
||||
throw new ApiException('没有权限操作该数据');
|
||||
throw new ApiException('No permission to operate this data');
|
||||
}
|
||||
if ($this->adminInfo['id'] > 1) {
|
||||
// 部门保护
|
||||
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
|
||||
throw new ApiException('没有权限操作该部门数据');
|
||||
throw new ApiException('No permission to operate department data');
|
||||
}
|
||||
// 越权保护
|
||||
if (!$this->roleProtect($this->adminInfo['roleList'], $role_ids)) {
|
||||
throw new ApiException('没有权限操作该角色数据');
|
||||
throw new ApiException('No permission to operate role data');
|
||||
}
|
||||
}
|
||||
$result = parent::edit($id, $data);
|
||||
@@ -179,12 +179,12 @@ class SystemUserLogic extends BaseLogic
|
||||
{
|
||||
if (is_array($ids)) {
|
||||
if (count($ids) > 1) {
|
||||
throw new ApiException('禁止批量删除操作');
|
||||
throw new ApiException('Batch delete is not allowed');
|
||||
}
|
||||
$ids = $ids[0];
|
||||
}
|
||||
if ($ids == 1) {
|
||||
throw new ApiException('超级管理员禁止删除');
|
||||
throw new ApiException('Super admin cannot be deleted');
|
||||
}
|
||||
$query = $this->model->where('id', $ids);
|
||||
// 超级管理员可删除任意用户,普通管理员仅可删除当前部门和子部门的用户
|
||||
@@ -193,14 +193,14 @@ class SystemUserLogic extends BaseLogic
|
||||
}
|
||||
$user = $query->findOrEmpty();
|
||||
if ($user->isEmpty()) {
|
||||
throw new ApiException('没有权限操作该数据');
|
||||
throw new ApiException('No permission to operate this data');
|
||||
}
|
||||
if ($this->adminInfo['id'] > 1) {
|
||||
$role_ids = $user->roles->toArray() ?: [];
|
||||
if (!empty($role_ids)) {
|
||||
// 越权保护
|
||||
if (!$this->roleProtect($this->adminInfo['roleList'], array_column($role_ids, 'id'))) {
|
||||
throw new ApiException('没有权限操作该角色数据');
|
||||
throw new ApiException('No permission to operate role data');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,7 +283,7 @@ class SystemUserLogic extends BaseLogic
|
||||
$model->password = password_hash($newPassword, PASSWORD_DEFAULT);
|
||||
return $model->save();
|
||||
} else {
|
||||
throw new ApiException('原密码错误');
|
||||
throw new ApiException('Old password is incorrect');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ class SystemUserLogic extends BaseLogic
|
||||
$query->auth($this->adminInfo['deptList']);
|
||||
$user = $query->findOrEmpty();
|
||||
if ($user->isEmpty()) {
|
||||
throw new ApiException('没有权限操作该数据');
|
||||
throw new ApiException('No permission to operate this data');
|
||||
}
|
||||
}
|
||||
parent::edit($id, $data);
|
||||
|
||||
@@ -50,7 +50,7 @@ class CrontabLogic extends BaseLogic
|
||||
6 => "0 {$minute} {$hour} * * {$week}",
|
||||
7 => "0 {$minute} {$hour} {$day} * *",
|
||||
8 => "0 {$minute} {$hour} {$day} {$month} *",
|
||||
default => throw new ApiException("任务类型异常"),
|
||||
default => throw new ApiException('Invalid task type'),
|
||||
};
|
||||
|
||||
// 定时任务模型新增
|
||||
@@ -95,13 +95,13 @@ class CrontabLogic extends BaseLogic
|
||||
6 => "0 {$minute} {$hour} * * {$week}",
|
||||
7 => "0 {$minute} {$hour} {$day} * *",
|
||||
8 => "0 {$minute} {$hour} {$day} {$month} *",
|
||||
default => throw new ApiException("任务类型异常"),
|
||||
default => throw new ApiException('Invalid task type'),
|
||||
};
|
||||
|
||||
// 查询任务数据
|
||||
$model = $this->model->findOrEmpty($id);
|
||||
if ($model->isEmpty()) {
|
||||
throw new ApiException('数据不存在');
|
||||
throw new ApiException('Data not found');
|
||||
}
|
||||
|
||||
$result = $model->save([
|
||||
@@ -134,7 +134,7 @@ class CrontabLogic extends BaseLogic
|
||||
{
|
||||
if (is_array($ids)) {
|
||||
if (count($ids) > 1) {
|
||||
throw new ApiException('禁止批量删除操作');
|
||||
throw new ApiException('Batch delete is not allowed');
|
||||
}
|
||||
$ids = $ids[0];
|
||||
}
|
||||
@@ -157,7 +157,7 @@ class CrontabLogic extends BaseLogic
|
||||
{
|
||||
$model = $this->model->findOrEmpty($id);
|
||||
if ($model->isEmpty()) {
|
||||
throw new ApiException('数据不存在');
|
||||
throw new ApiException('Data not found');
|
||||
}
|
||||
$result = $model->save(['status' => $status]);
|
||||
if ($result) {
|
||||
|
||||
@@ -63,7 +63,7 @@ class GenerateTablesLogic extends BaseLogic
|
||||
$data = config('think-orm.connections');
|
||||
$config = $data[$source];
|
||||
if (!$config) {
|
||||
throw new ApiException('数据库配置读取失败');
|
||||
throw new ApiException('Failed to read database config');
|
||||
}
|
||||
|
||||
$prefix = $config['prefix'] ?? '';
|
||||
@@ -262,10 +262,10 @@ class GenerateTablesLogic extends BaseLogic
|
||||
{
|
||||
$table = $this->model->findOrEmpty($id);
|
||||
if (!in_array($table['template'], ["plugin", "app"])) {
|
||||
throw new ApiException('应用类型必须为plugin或者app');
|
||||
throw new ApiException('App type must be plugin or app');
|
||||
}
|
||||
if (empty($table['namespace'])) {
|
||||
throw new ApiException('请先设置应用名称');
|
||||
throw new ApiException('Please set app name first');
|
||||
}
|
||||
|
||||
$columns = $this->columnLogic->where('table_id', $id)
|
||||
@@ -320,11 +320,11 @@ class GenerateTablesLogic extends BaseLogic
|
||||
{
|
||||
$table = $this->model->where('id', $id)->findOrEmpty();
|
||||
if ($table->isEmpty()) {
|
||||
throw new ApiException('请选择要生成的表');
|
||||
throw new ApiException('Please select tables to generate');
|
||||
}
|
||||
$debug = config('app.debug', true);
|
||||
if (!$debug) {
|
||||
throw new ApiException('非调试模式下,不允许生成文件');
|
||||
throw new ApiException('File generation not allowed in non-debug mode');
|
||||
}
|
||||
$this->updateMenu($table);
|
||||
$this->genModule($id);
|
||||
|
||||
@@ -27,10 +27,10 @@ class CheckLogin implements MiddlewareInterface
|
||||
try {
|
||||
$token = JwtToken::getExtend();
|
||||
} catch (\Throwable $e) {
|
||||
throw new ApiException('您的登录凭证错误或者已过期,请重新登录', 401);
|
||||
throw new ApiException('Your login credential is invalid or expired, please login again', 401);
|
||||
}
|
||||
if ($token['plat'] !== 'saiadmin') {
|
||||
throw new ApiException('登录凭证校验失败');
|
||||
throw new ApiException('Login credential verification failed');
|
||||
}
|
||||
// 一次合并设置,避免 setHeader 覆盖导致只保留最后一个
|
||||
$request->setHeader(array_merge($request->header() ?: [], [
|
||||
|
||||
@@ -30,7 +30,7 @@ class SystemLog implements MiddlewareInterface
|
||||
// 记录日志
|
||||
Event::emit('user.operateLog', true);
|
||||
} catch (\Throwable $e) {
|
||||
throw new ApiException('登录凭获取失败,请检查');
|
||||
throw new ApiException('Failed to get login credential, please check');
|
||||
}
|
||||
}
|
||||
return $handler($request);
|
||||
|
||||
@@ -47,7 +47,7 @@ class BaseLogic extends AbstractLogic
|
||||
{
|
||||
$model = $this->model->find($id);
|
||||
if (!$model) {
|
||||
throw new ApiException('数据不存在');
|
||||
throw new ApiException('Data not found');
|
||||
}
|
||||
return $model->update($data);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class BaseLogic extends AbstractLogic
|
||||
{
|
||||
$model = $this->model->find($id);
|
||||
if (!$model) {
|
||||
throw new ApiException('数据不存在');
|
||||
throw new ApiException('Data not found');
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class BaseLogic extends AbstractLogic
|
||||
{
|
||||
$model = $this->model->findOrEmpty($id);
|
||||
if ($model->isEmpty()) {
|
||||
throw new ApiException('数据不存在');
|
||||
throw new ApiException('Data not found');
|
||||
}
|
||||
return $model->save($data);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class BaseLogic extends AbstractLogic
|
||||
{
|
||||
$model = $this->model->findOrEmpty($id);
|
||||
if ($model->isEmpty()) {
|
||||
throw new ApiException('数据不存在');
|
||||
throw new ApiException('Data not found');
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,7 @@ class ApiException extends BusinessException
|
||||
public function render(Request $request): ?Response
|
||||
{
|
||||
$message = $this->getMessage();
|
||||
$path = $request->path();
|
||||
if (str_contains($path, 'api/')) {
|
||||
$message = \app\api\util\ApiLang::translate($message, $request);
|
||||
}
|
||||
$message = \app\api\util\ApiLang::translate($message, $request);
|
||||
return json(['code' => $this->getCode() ?: 500, 'message' => $message]);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class EmailService
|
||||
$logic = new SystemConfigLogic();
|
||||
$config = $logic->getGroup('email_config');
|
||||
if (!$config) {
|
||||
throw new ApiException('未设置邮件配置');
|
||||
throw new ApiException('Mail config not set');
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ class EmailService
|
||||
public static function getMailer(): PHPMailer
|
||||
{
|
||||
if (!class_exists(PHPMailer::class)) {
|
||||
throw new ApiException('请执行 composer require phpmailer/phpmailer 并重启');
|
||||
throw new ApiException('Please run composer require phpmailer/phpmailer and restart');
|
||||
}
|
||||
$config = static::getConfig();
|
||||
$mailer = new PHPMailer();
|
||||
|
||||
@@ -54,7 +54,7 @@ class ChunkUploadService
|
||||
{
|
||||
$allow_file = Arr::getConfigValue($this->config, 'upload_allow_file');
|
||||
if (!in_array($data['ext'], explode(',', $allow_file))) {
|
||||
throw new ApiException('不支持该格式的文件上传');
|
||||
throw new ApiException('File format not supported for upload');
|
||||
}
|
||||
// 检查已经上传的分片文件
|
||||
for ($i = 0; $i < $data['total']; ++$i) {
|
||||
@@ -80,11 +80,11 @@ class ChunkUploadService
|
||||
{
|
||||
$allow_file = Arr::getConfigValue($this->config, 'upload_allow_file');
|
||||
if (!in_array($data['ext'], explode(',', $allow_file))) {
|
||||
throw new ApiException('不支持该格式的文件上传');
|
||||
throw new ApiException('File format not supported for upload');
|
||||
}
|
||||
$request = request();
|
||||
if (!$request) {
|
||||
throw new ApiException('切片上传服务必须在 HTTP 请求环境下调用');
|
||||
throw new ApiException('Chunk upload must be called in HTTP request context');
|
||||
}
|
||||
$uploadFile = current($request->file());
|
||||
$chunkName = $this->path . "{$data['hash']}_{$data['total']}_{$data['index']}.chunk";
|
||||
@@ -107,7 +107,7 @@ class ChunkUploadService
|
||||
for ($i = 0; $i < $data['total']; ++$i) {
|
||||
$chunkFile = $this->path . "{$data['hash']}_{$data['total']}_{$i}.chunk";
|
||||
if (!file_exists($chunkFile)) {
|
||||
throw new ApiException('切片文件查找失败,请重新上传');
|
||||
throw new ApiException('Chunk file not found, please upload again');
|
||||
}
|
||||
fwrite($fileHandle, file_get_contents($chunkFile));
|
||||
unlink($chunkFile);
|
||||
|
||||
@@ -34,17 +34,17 @@ class UploadService
|
||||
$ext = $file->getUploadExtension() ?: null;
|
||||
$file_size = $file->getSize();
|
||||
if ($file_size > Arr::getConfigValue($uploadConfig, 'upload_size')) {
|
||||
throw new ApiException('文件大小超过限制');
|
||||
throw new ApiException('File size exceeds limit');
|
||||
}
|
||||
$allow_file = Arr::getConfigValue($uploadConfig, 'upload_allow_file');
|
||||
$allow_image = Arr::getConfigValue($uploadConfig, 'upload_allow_image');
|
||||
if ($upload == 'image') {
|
||||
if (!in_array($ext, explode(',', $allow_image))) {
|
||||
throw new ApiException('不支持该格式的文件上传');
|
||||
throw new ApiException('File format not supported for upload');
|
||||
}
|
||||
} else {
|
||||
if (!in_array($ext, explode(',', $allow_file))) {
|
||||
throw new ApiException('不支持该格式的文件上传');
|
||||
throw new ApiException('File format not supported for upload');
|
||||
}
|
||||
}
|
||||
switch ($type) {
|
||||
@@ -115,7 +115,7 @@ class UploadService
|
||||
];
|
||||
break;
|
||||
default:
|
||||
throw new ApiException('该上传模式不存在');
|
||||
throw new ApiException('Upload mode not found');
|
||||
}
|
||||
return new $config['adapter'](array_merge(
|
||||
$config,
|
||||
|
||||
@@ -53,7 +53,7 @@ class CodeEngine
|
||||
|
||||
// 判断模板是否存在
|
||||
if (!is_dir($config['template_path'])) {
|
||||
throw new ApiException('模板目录不存在!');
|
||||
throw new ApiException('Template directory not found');
|
||||
}
|
||||
// 判断文件生成目录是否存在
|
||||
if (!is_dir($config['generate_path'])) {
|
||||
@@ -160,7 +160,7 @@ class CodeEngine
|
||||
}
|
||||
|
||||
if (empty($outPath)) {
|
||||
throw new ApiException('文件类型异常,无法生成指定文件!');
|
||||
throw new ApiException('Invalid file type, cannot generate file');
|
||||
}
|
||||
if (!is_dir(dirname($outPath))) {
|
||||
mkdir(dirname($outPath), 0777, true);
|
||||
@@ -176,7 +176,7 @@ class CodeEngine
|
||||
{
|
||||
$rootPath = dirname(base_path()) . DS . $this->value['generate_path'];
|
||||
if (!is_dir($rootPath)) {
|
||||
throw new ApiException('前端目录查找失败,必须与后端目录为同级目录!');
|
||||
throw new ApiException('Frontend directory not found, must be same level as backend');
|
||||
}
|
||||
|
||||
$rootPath = $rootPath . DS . 'src' . DS . 'views' . DS . 'plugin' . DS . $this->value['namespace'];
|
||||
@@ -199,7 +199,7 @@ class CodeEngine
|
||||
}
|
||||
|
||||
if (empty($outPath)) {
|
||||
throw new ApiException('文件类型异常,无法生成指定文件!');
|
||||
throw new ApiException('Invalid file type, cannot generate file');
|
||||
}
|
||||
if (!is_dir(dirname($outPath))) {
|
||||
mkdir(dirname($outPath), 0777, true);
|
||||
|
||||
@@ -57,7 +57,7 @@ class CodeZip
|
||||
$zipName = $config['generate_path'].'.zip';
|
||||
$dirPath = $config['generate_path'];
|
||||
if ($zipArc->open($zipName, \ZipArchive::OVERWRITE | \ZipArchive::CREATE) !== true) {
|
||||
throw new ApiException('无法打开文件,或者文件创建失败');
|
||||
throw new ApiException('Cannot open file or create file failed');
|
||||
}
|
||||
$this->addFileToZip($dirPath, $zipArc);
|
||||
$zipArc->close();
|
||||
@@ -158,7 +158,7 @@ class CodeZip
|
||||
@readfile($fileName);
|
||||
@unlink($fileName);
|
||||
} catch (\Throwable $th) {
|
||||
throw new ApiException('系统生成文件错误');
|
||||
throw new ApiException('System file generation error');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ class InstallController extends BaseController
|
||||
{
|
||||
parent::__construct();
|
||||
if ($this->adminId > 1) {
|
||||
throw new ApiException('仅超级管理员能够操作');
|
||||
throw new ApiException('Only super admin can perform this action');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,17 +105,17 @@ class InstallController extends BaseController
|
||||
{
|
||||
$spl_file = current($request->file());
|
||||
if (!$spl_file->isValid()) {
|
||||
return $this->fail('上传文件校验失败');
|
||||
return $this->fail('upload file validation failed');
|
||||
}
|
||||
$config = config('plugin.saipackage.upload', [
|
||||
'size' => 1024 * 1024 * 5,
|
||||
'type' => ['zip']
|
||||
]);
|
||||
if (!in_array($spl_file->getUploadExtension(), $config['type'])) {
|
||||
return $this->fail('文件格式上传失败,请选择zip格式文件上传');
|
||||
return $this->fail('upload failed, please upload zip file');
|
||||
}
|
||||
if ($spl_file->getSize() > $config['size']) {
|
||||
return $this->fail('文件大小不能超过5M');
|
||||
return $this->fail('file size cannot exceed 5M');
|
||||
}
|
||||
$install = new InstallLogic();
|
||||
$info = $install->upload($spl_file);
|
||||
@@ -132,7 +132,7 @@ class InstallController extends BaseController
|
||||
{
|
||||
$appName = $request->post("appName", '');
|
||||
if (empty($appName)) {
|
||||
return $this->fail('参数错误');
|
||||
return $this->fail('Invalid parameters');
|
||||
}
|
||||
$install = new InstallLogic($appName);
|
||||
$info = $install->install();
|
||||
@@ -150,12 +150,12 @@ class InstallController extends BaseController
|
||||
{
|
||||
$appName = $request->post("appName", '');
|
||||
if (empty($appName)) {
|
||||
return $this->fail('参数错误');
|
||||
return $this->fail('Invalid parameters');
|
||||
}
|
||||
$install = new InstallLogic($appName);
|
||||
$install->uninstall();
|
||||
UserMenuCache::clearMenuCache();
|
||||
return $this->success('卸载插件成功');
|
||||
return $this->success('uninstall plugin success');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +167,7 @@ class InstallController extends BaseController
|
||||
{
|
||||
Server::restart();
|
||||
|
||||
return $this->success('重载成功');
|
||||
return $this->success('reload success');
|
||||
}
|
||||
|
||||
// ========== 商店代理接口 ==========
|
||||
@@ -278,7 +278,7 @@ class InstallController extends BaseController
|
||||
{
|
||||
$token = $request->input('token');
|
||||
if (empty($token)) {
|
||||
return $this->fail('未登录');
|
||||
return $this->fail('not logged in');
|
||||
}
|
||||
|
||||
$result = $this->proxyRequest(
|
||||
@@ -299,7 +299,7 @@ class InstallController extends BaseController
|
||||
{
|
||||
$token = $request->input('token');
|
||||
if (empty($token)) {
|
||||
return $this->fail('未登录');
|
||||
return $this->fail('not logged in');
|
||||
}
|
||||
|
||||
$result = $this->proxyRequest(
|
||||
@@ -322,7 +322,7 @@ class InstallController extends BaseController
|
||||
$appId = $request->input('app_id');
|
||||
|
||||
if (empty($token)) {
|
||||
return $this->fail('未登录');
|
||||
return $this->fail('not logged in');
|
||||
}
|
||||
|
||||
$result = $this->proxyRequest(
|
||||
@@ -345,11 +345,11 @@ class InstallController extends BaseController
|
||||
$versionId = $request->input('id');
|
||||
|
||||
if (empty($token)) {
|
||||
return $this->fail('未登录');
|
||||
return $this->fail('not logged in');
|
||||
}
|
||||
|
||||
if (empty($versionId)) {
|
||||
return $this->fail('版本ID不能为空');
|
||||
return $this->fail('version id is required');
|
||||
}
|
||||
|
||||
$result = $this->proxyRequest(
|
||||
@@ -365,7 +365,7 @@ class InstallController extends BaseController
|
||||
}
|
||||
|
||||
if (!isset($result['raw'])) {
|
||||
return $this->fail('下载失败');
|
||||
return $this->fail('download failed');
|
||||
}
|
||||
|
||||
// 保存临时 zip 文件
|
||||
@@ -380,7 +380,7 @@ class InstallController extends BaseController
|
||||
$install = new InstallLogic();
|
||||
$info = $install->uploadFromPath($tempZip);
|
||||
|
||||
return $this->success($info, '下载成功,请在插件列表中安装');
|
||||
return $this->success($info, 'download success, please install in plugin list');
|
||||
} catch (Throwable $e) {
|
||||
@unlink($tempZip);
|
||||
return $this->fail($e->getMessage());
|
||||
|
||||
@@ -108,7 +108,7 @@ class InstallLogic
|
||||
if (empty($info['app'])) {
|
||||
Filesystem::delDir($copyToDir);
|
||||
// 基本配置不完整
|
||||
throw new ApiException('插件的基础配置信息错误');
|
||||
throw new ApiException('Plugin base config is invalid');
|
||||
}
|
||||
|
||||
|
||||
@@ -127,14 +127,14 @@ class InstallLogic
|
||||
$upgrade = Version::compare($nextVersion, $info['version']);
|
||||
if (!$upgrade) {
|
||||
Filesystem::delDir($copyToDir);
|
||||
throw new ApiException('插件已经存在');
|
||||
throw new ApiException('Plugin already exists');
|
||||
}
|
||||
}
|
||||
|
||||
if (Filesystem::dirIsEmpty($this->appDir) || (!Filesystem::dirIsEmpty($this->appDir) && !$upgrade)) {
|
||||
Filesystem::delDir($copyToDir);
|
||||
// 模块目录被占
|
||||
throw new ApiException('该插件的安装目录已经被占用');
|
||||
throw new ApiException('Plugin install directory is already occupied');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ class InstallLogic
|
||||
public function uploadFromPath(string $zipPath): array
|
||||
{
|
||||
if (!is_file($zipPath)) {
|
||||
throw new ApiException('文件不存在');
|
||||
throw new ApiException('File not found');
|
||||
}
|
||||
|
||||
// 解压
|
||||
@@ -181,7 +181,7 @@ class InstallLogic
|
||||
$info = Server::getIni($copyToDir);
|
||||
if (empty($info['app'])) {
|
||||
Filesystem::delDir($copyToDir);
|
||||
throw new ApiException('插件的基础配置信息错误');
|
||||
throw new ApiException('Plugin base config is invalid');
|
||||
}
|
||||
|
||||
$this->appName = $info['app'];
|
||||
@@ -199,13 +199,13 @@ class InstallLogic
|
||||
$upgrade = Version::compare($nextVersion, $info['version']);
|
||||
if (!$upgrade) {
|
||||
Filesystem::delDir($copyToDir);
|
||||
throw new ApiException('插件已经存在');
|
||||
throw new ApiException('Plugin already exists');
|
||||
}
|
||||
}
|
||||
|
||||
if (Filesystem::dirIsEmpty($this->appDir) || (!Filesystem::dirIsEmpty($this->appDir) && !$upgrade)) {
|
||||
Filesystem::delDir($copyToDir);
|
||||
throw new ApiException('该插件的安装目录已经被占用');
|
||||
throw new ApiException('Plugin install directory is already occupied');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,11 +237,11 @@ class InstallLogic
|
||||
{
|
||||
$state = $this->getInstallState();
|
||||
if ($state == self::INSTALLED || $state == self::DIRECTORY_OCCUPIED) {
|
||||
throw new ApiException('插件已经存在');
|
||||
throw new ApiException('Plugin already exists');
|
||||
}
|
||||
|
||||
if ($state == self::DEPENDENT_WAIT_INSTALL) {
|
||||
throw new ApiException('等待依赖安装');
|
||||
throw new ApiException('Waiting for dependencies to be installed');
|
||||
}
|
||||
|
||||
echo '开始安装[' . $this->appName . ']' . PHP_EOL;
|
||||
@@ -351,14 +351,14 @@ class InstallLogic
|
||||
public function checkPackage(): bool
|
||||
{
|
||||
if (!is_dir($this->appDir)) {
|
||||
throw new ApiException('插件目录不存在');
|
||||
throw new ApiException('Plugin directory not found');
|
||||
}
|
||||
$info = $this->getInfo();
|
||||
$infoKeys = ['app', 'title', 'about', 'author', 'version', 'state'];
|
||||
foreach ($infoKeys as $value) {
|
||||
if (!array_key_exists($value, $info)) {
|
||||
Filesystem::delDir($this->appDir);
|
||||
throw new ApiException('该插件的基础配置信息不完善');
|
||||
throw new ApiException('Plugin base config is incomplete');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -527,6 +527,6 @@ class InstallLogic
|
||||
} elseif ($arr) {
|
||||
return Server::setIni($this->appDir, $arr);
|
||||
}
|
||||
throw new ApiException('参数错误');
|
||||
throw new ApiException('Invalid parameters');
|
||||
}
|
||||
}
|
||||
|
||||
346
server/resource/translations/api/en.php
Normal file
346
server/resource/translations/api/en.php
Normal file
@@ -0,0 +1,346 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
return [
|
||||
'ACCOUNT_DISABLED' => 'Account is disabled and cannot log in',
|
||||
'API_AUTH_TOKEN_SECRET is not configured' => 'API_AUTH_TOKEN_SECRET is not configured',
|
||||
'AUTH_TOKEN_EXPIRED' => 'auth-token expired',
|
||||
'AUTH_TOKEN_FORMAT_INVALID' => 'auth-token format invalid',
|
||||
'AUTH_TOKEN_INVALID' => 'auth-token invalid',
|
||||
'AUTH_TOKEN_INVALID_OR_EXPIRED' => 'auth-token invalid or expired',
|
||||
'AUTH_TOKEN_REQUIRED' => 'Please provide auth-token',
|
||||
'Account is disabled and cannot log in' => 'Account is disabled and cannot log in',
|
||||
'App type must be plugin or app' => 'App type must be plugin or app',
|
||||
'BALANCE_LESS_THAN_MIN' => 'Balance %s is less than %s, cannot continue',
|
||||
'BATCH_DELETE_FORBIDDEN' => 'Batch delete is not allowed',
|
||||
'BUY_TICKET_ERROR' => 'Invalid lottery ticket purchase',
|
||||
'Balance %s is less than %s, cannot continue' => 'Balance %s is less than %s, cannot continue',
|
||||
'Batch delete is not allowed' => 'Batch delete is not allowed',
|
||||
'CONFIG_ID_NOT_FOUND_OR_TIER_EMPTY' => 'Config ID %s not found or tier is empty',
|
||||
'Cannot open file or create file failed' => 'Cannot open file or create file failed',
|
||||
'Cannot operate roles with higher level than current account' => 'Cannot operate roles with higher level than current account',
|
||||
'Cannot set parent category as child of current' => 'Cannot set parent category as child of current',
|
||||
'Cannot set parent department to a child of current department' => 'Cannot set parent department to a child of current department',
|
||||
'Cannot set parent to self' => 'Cannot set parent to self',
|
||||
'Chunk file not found, please upload again' => 'Chunk file not found, please upload again',
|
||||
'Chunk upload must be called in HTTP request context' => 'Chunk upload must be called in HTTP request context',
|
||||
'Coin change must be greater than 0' => 'Coin change must be greater than 0',
|
||||
'Config data not found' => 'Config data not found',
|
||||
'Config group not found' => 'Config group not found',
|
||||
'Counts only support 0, 100, 500, 1000, 5000' => 'Counts only support 0, 100, 500, 1000, 5000',
|
||||
'Current table does not support recycle bin' => 'Current table does not support recycle bin',
|
||||
'DATA_NOT_FOUND' => 'Data not found',
|
||||
'DIRECTION_INVALID' => 'direction must be 0 or 1',
|
||||
'Data not found' => 'Data not found',
|
||||
'Deduct amount cannot exceed current balance' => 'Deduct amount cannot exceed current balance',
|
||||
'Delete data error, please check' => 'Delete data error, please check',
|
||||
'Dict type not found' => 'Dict type not found',
|
||||
'FAIL' => 'Fail',
|
||||
'Failed to create image resource' => 'Failed to create image resource',
|
||||
'Failed to generate token' => 'Failed to generate token',
|
||||
'Failed to get file resource' => 'Failed to get file resource',
|
||||
'Failed to get login credential, please check' => 'Failed to get login credential, please check',
|
||||
'Failed to read database config' => 'Failed to read database config',
|
||||
'Failed to save file' => 'Failed to save file',
|
||||
'File format not supported for upload' => 'File format not supported for upload',
|
||||
'File generation not allowed in non-debug mode' => 'File generation not allowed in non-debug mode',
|
||||
'File not found' => 'File not found',
|
||||
'File size exceeds limit' => 'File size exceeds limit',
|
||||
'Free pool config not found' => 'Free pool config not found',
|
||||
'Free tier probabilities (T1–T5) sum cannot exceed 100%' => 'Free tier probabilities (T1–T5) sum cannot exceed 100%',
|
||||
'Free tier probability must be between 0 and 100%' => 'Free tier probability must be between 0 and 100%',
|
||||
'Frontend directory not found, must be same level as backend' => 'Frontend directory not found, must be same level as backend',
|
||||
'INSUFFICIENT_BALANCE' => 'Insufficient balance',
|
||||
'INSUFFICIENT_TICKETS' => 'Insufficient lottery tickets',
|
||||
'Import file error, please upload correct xlsx file' => 'Import file error, please upload correct xlsx file',
|
||||
'Insufficient balance' => 'Insufficient balance',
|
||||
'Insufficient balance to transfer' => 'Insufficient balance to transfer',
|
||||
'Insufficient lottery tickets' => 'Insufficient lottery tickets',
|
||||
'Invalid DiceReward id exists' => 'Invalid DiceReward id exists',
|
||||
'Invalid config ID exists' => 'Invalid config ID exists',
|
||||
'Invalid file format' => 'Invalid file format',
|
||||
'Invalid file type, cannot generate file' => 'Invalid file type, cannot generate file',
|
||||
'Invalid lottery ticket purchase' => 'Invalid lottery ticket purchase',
|
||||
'Invalid or expired token' => 'Invalid or expired token',
|
||||
'Invalid parameters' => 'Invalid parameters',
|
||||
'Invalid params: player_id and type are required (3=add, 4=deduct)' => 'Invalid params: player_id and type are required (3=add, 4=deduct)',
|
||||
'Invalid phone format, only +60 Malaysia numbers supported (e.g. +60123456789)' => 'Invalid phone format, only +60 Malaysia numbers supported (e.g. +60123456789)',
|
||||
'Invalid secret' => 'Invalid secret',
|
||||
'Invalid task type' => 'Invalid task type',
|
||||
'LOTTERY_CONFIG_NOT_FOUND' => 'Lottery config not found',
|
||||
'LOTTERY_POOL_CONFIG_DEFAULT_NOT_FOUND' => 'No name=default pool config found, please create one first',
|
||||
'LOTTERY_POOL_CONFIG_NOT_FOUND_DEFAULT' => 'Lottery pool config not found (name=default required)',
|
||||
'Logged out successfully' => 'Logged out successfully',
|
||||
'Login credential verification failed' => 'Login credential verification failed',
|
||||
'Lottery pool config not found (name=default required)' => 'Lottery pool config not found (name=default required)',
|
||||
'MSG_022FA411' => 'App type must be plugin or app',
|
||||
'MSG_04BF8179' => 'Data not found',
|
||||
'MSG_06F06DA6' => 'Invalid or expired token',
|
||||
'MSG_0A17D195' => 'Paid tier probability must be between 0 and 100%',
|
||||
'MSG_0A9A3E28' => 'Batch delete is not allowed',
|
||||
'MSG_0BCF9CBC' => 'Test count only supports 100, 500, 1000, 5000, 10000',
|
||||
'MSG_0CBB8FF6' => 'Service timeout: ',
|
||||
'MSG_0D49B785' => 'Old password is incorrect',
|
||||
'MSG_0FE75E2C' => 'Chunk upload must be called in HTTP request context',
|
||||
'MSG_146A3F0D' => 'Dict type not found',
|
||||
'MSG_17740DB3' => 'Token format invalid',
|
||||
'MSG_1798E4D4' => 'Template not found',
|
||||
'MSG_19E651B8' => 'coin is required',
|
||||
'MSG_1A499109' => 'File not found',
|
||||
'MSG_1BB27051' => 'auth-token expired',
|
||||
'MSG_1C1718A6' => 'Plugin already exists',
|
||||
'MSG_2240AD6D' => 'auth-token invalid',
|
||||
'MSG_2273437E' => 'Balance %s is less than %s, cannot continue',
|
||||
'MSG_22C6787F' => 'Chunk file not found, please upload again',
|
||||
'MSG_25BF8A8D' => 'Deduct amount cannot exceed current balance',
|
||||
'MSG_2830AE01' => 'Service timeout: Unknown reason',
|
||||
'MSG_2ED0C7A8' => 'Plugin base config is invalid',
|
||||
'MSG_2EE75A5E' => 'System file generation error',
|
||||
'MSG_2EFE74EE' => 'File generation not allowed in non-debug mode',
|
||||
'MSG_2F100DB4' => 'Cannot operate roles with higher level than current account',
|
||||
'MSG_334CE26A' => 'No permission to operate this data',
|
||||
'MSG_35FB9BA0' => 'File format not supported for upload',
|
||||
'MSG_381A19AE' => 'Upload mode not found',
|
||||
'MSG_3A4A6DE6' => 'username is required',
|
||||
'MSG_3A4FF81F' => 'No permission to operate department data',
|
||||
'MSG_3C99F7F7' => 'Reward config is empty, please maintain dice_reward_config first',
|
||||
'MSG_3DBFEA33' => 'Invalid file format',
|
||||
'MSG_43C4D703' => 'This department has users, please delete or transfer them first',
|
||||
'MSG_47FDBDD0' => 'Config group not found',
|
||||
'MSG_4CA58C61' => 'Update data error, please check',
|
||||
'MSG_4F1D271A' => 'Invalid DiceReward id exists',
|
||||
'MSG_521593FB' => 'Please set app name first',
|
||||
'MSG_557E5109' => 'Failed to get file resource',
|
||||
'MSG_559AAE0E' => 'No permission to operate role data',
|
||||
'MSG_560E6D91' => 'No path config available for this direction',
|
||||
'MSG_5643EE10' => 'Failed to generate token',
|
||||
'MSG_569EC863' => 'Current table does not support recycle bin',
|
||||
'MSG_56B44907' => 'Target category not found',
|
||||
'MSG_5CE17D6B' => 'auth-token invalid or expired',
|
||||
'MSG_5FF3A2BE' => 'Failed to read database config',
|
||||
'MSG_609A300B' => 'Insufficient balance',
|
||||
'MSG_60B9FC38' => 'Failed to get login credential, please check',
|
||||
'MSG_64A3C830' => 'User not found',
|
||||
'MSG_67C66962' => 'No name=default pool config found, please create one first',
|
||||
'MSG_6C16260B' => 'When free pool is not selected, please fill free custom tier probabilities (T1–T5)',
|
||||
'MSG_6CA924A1' => 'Lottery pool config not found (name=default required)',
|
||||
'MSG_6F00DFB2' => 'Success',
|
||||
'MSG_7310FDB8' => 'Frontend directory not found, must be same level as backend',
|
||||
'MSG_74E3CB84' => 'No available reward config',
|
||||
'MSG_75C6A69F' => 'Please provide auth-token',
|
||||
'MSG_7845F2E9' => 'Delete data error, please check',
|
||||
'MSG_86272B49' => 'Fail',
|
||||
'MSG_8865D363' => 'coin cannot be 0',
|
||||
'MSG_8B6AA32A' => 'Cannot set parent category as child of current',
|
||||
'MSG_8C2E3CE6' => 'Please login again (account logged in elsewhere)',
|
||||
'MSG_8FDBA3F1' => 'This dict code already exists',
|
||||
'MSG_91272513' => 'Invalid lottery ticket purchase',
|
||||
'MSG_94EE6593' => 'Plugin install directory is already occupied',
|
||||
'MSG_9501E2EF' => 'Insufficient balance to transfer',
|
||||
'MSG_950B6072' => 'Config data not found',
|
||||
'MSG_9A01DFBF' => 'Plugin base config is incomplete',
|
||||
'MSG_9D195F25' => 'Account is disabled and cannot log in',
|
||||
'MSG_9EE0801C' => 'Cannot open file or create file failed',
|
||||
'MSG_9F6B51C8' => 'Invalid file type, cannot generate file',
|
||||
'MSG_A049A679' => 'This category has sub-categories, please delete them first',
|
||||
'MSG_A3165463' => 'Only super admin can perform this action',
|
||||
'MSG_A4FB6212' => 'Failed to save file',
|
||||
'MSG_A6A8EA8F' => 'Plugin directory not found',
|
||||
'MSG_A72A7DC6' => 'This department has sub-departments, please delete them first',
|
||||
'MSG_A778ABB9' => 'auth-token format invalid',
|
||||
'MSG_ADA80442' => 'Please login again',
|
||||
'MSG_AE73E6F3' => 'API_AUTH_TOKEN_SECRET is not configured',
|
||||
'MSG_B387239D' => 'Paid tier probabilities (T1–T5) sum cannot exceed 100%',
|
||||
'MSG_B5C2F2F6' => 'Counts only support 0, 100, 500, 1000, 5000',
|
||||
'MSG_B5CD5C51' => 'Test record not found',
|
||||
'MSG_B720629D' => 'username and password are required',
|
||||
'MSG_BA173F12' => 'Sum of paid/free direction counts must be greater than 0',
|
||||
'MSG_BAC2EFB0' => 'Parent department cannot be the same as current department',
|
||||
'MSG_BB3C5A3F' => 'direction must be 0 or 1',
|
||||
'MSG_BBD3198A' => 'Invalid params: player_id and type are required (3=add, 4=deduct)',
|
||||
'MSG_BD8AD1D3' => 'Invalid phone format, only +60 Malaysia numbers supported (e.g. +60123456789)',
|
||||
'MSG_BEB15D55' => 'Invalid parameters',
|
||||
'MSG_C2E4B3DC' => 'Invalid task type',
|
||||
'MSG_C2F02095' => 'Insufficient lottery tickets',
|
||||
'MSG_C3CB20DC' => 'Free tier probability must be between 0 and 100%',
|
||||
'MSG_C43809BC' => 'Operation failed: ',
|
||||
'MSG_C548E557' => 'Missing parameters: agent_id, secret, time, signature are required',
|
||||
'MSG_C5D5D5E1' => 'Cannot set parent department to a child of current department',
|
||||
'MSG_C803EA6F' => 'Please register',
|
||||
'MSG_C80C5EF5' => 'Failed to create image resource',
|
||||
'MSG_C9BFC7E9' => 'Lottery config not found',
|
||||
'MSG_CDEA9DD8' => 'Your login credential is invalid or expired, please login again',
|
||||
'MSG_D15C0759' => 'Invalid secret',
|
||||
'MSG_D1D1C0A0' => 'Template directory not found',
|
||||
'MSG_D1E7769C' => 'Parent category cannot be the same as current',
|
||||
'MSG_D224020F' => 'Free pool config not found',
|
||||
'MSG_D75845B2' => 'Free tier probabilities (T1–T5) sum cannot exceed 100%',
|
||||
'MSG_DB560C68' => 'Please run composer require phpmailer/phpmailer and restart',
|
||||
'MSG_DEE31D19' => 'Timestamp expired or invalid, please sync time',
|
||||
'MSG_DF93D5F9' => 'Token expired, please login again',
|
||||
'MSG_E12FF883' => 'File size exceeds limit',
|
||||
'MSG_E15B47C6' => 'Super admin cannot be deleted',
|
||||
'MSG_E1BFE655' => 'Mail config not set',
|
||||
'MSG_E5849544' => 'Wrong password',
|
||||
'MSG_E66BC216' => 'This menu has sub-menus, please delete them first',
|
||||
'MSG_E6E6288B' => 'System default group cannot be deleted',
|
||||
'MSG_E84B2B0A' => 'Logged out successfully',
|
||||
'MSG_E8C8EC80' => 'Invalid config ID exists',
|
||||
'MSG_E96B26B9' => 'Coin change must be greater than 0',
|
||||
'MSG_EEDAAC44' => 'Waiting for dependencies to be installed',
|
||||
'MSG_F0F5F561' => 'Config ID %s not found or tier is empty',
|
||||
'MSG_F12E5DBA' => 'Reward config must cover 26 cells (id 0-25 or 1-26), currently only %s, cannot generate full 5-30 points and clockwise/counterclockwise mapping',
|
||||
'MSG_F2643E83' => 'Login credential verification failed',
|
||||
'MSG_F58CB5C8' => 'This category has sub-categories, please delete them first',
|
||||
'MSG_F5F9FF11' => 'Paid pool config not found',
|
||||
'MSG_F7BBA776' => 'Unknown reason',
|
||||
'MSG_F8EB5084' => 'Signature verification failed',
|
||||
'MSG_FA5FF202' => 'Cannot set parent to self',
|
||||
'MSG_FB4C0ADF' => 'Please select tables to generate',
|
||||
'MSG_FBC50B18' => 'Player not found',
|
||||
'MSG_FC1E3345' => 'Import file error, please upload correct xlsx file',
|
||||
'MSG_FDADA275' => 'When paid pool is not selected, please fill paid custom tier probabilities (T1–T5)',
|
||||
'MSG_FE1B67CA' => 'Please provide token',
|
||||
'Mail config not set' => 'Mail config not set',
|
||||
'Missing parameters: agent_id, secret, time, signature are required' => 'Missing parameters: agent_id, secret, time, signature are required',
|
||||
'NO_AVAILABLE_REWARD_CONFIG' => 'No available reward config',
|
||||
'No available reward config' => 'No available reward config',
|
||||
'No name=default pool config found, please create one first' => 'No name=default pool config found, please create one first',
|
||||
'No permission to operate department data' => 'No permission to operate department data',
|
||||
'No permission to operate role data' => 'No permission to operate role data',
|
||||
'No permission to operate this data' => 'No permission to operate this data',
|
||||
'OLD_PASSWORD_WRONG' => 'Old password is incorrect',
|
||||
'Old password is incorrect' => 'Old password is incorrect',
|
||||
'Only super admin can perform this action' => 'Only super admin can perform this action',
|
||||
'Operation failed: ' => 'Operation failed: ',
|
||||
'PASSWORD_WRONG' => 'Wrong password',
|
||||
'Paid pool config not found' => 'Paid pool config not found',
|
||||
'Paid tier probabilities (T1–T5) sum cannot exceed 100%' => 'Paid tier probabilities (T1–T5) sum cannot exceed 100%',
|
||||
'Paid tier probability must be between 0 and 100%' => 'Paid tier probability must be between 0 and 100%',
|
||||
'Parent category cannot be the same as current' => 'Parent category cannot be the same as current',
|
||||
'Parent department cannot be the same as current department' => 'Parent department cannot be the same as current department',
|
||||
'Player not found' => 'Player not found',
|
||||
'Please login again' => 'Please login again',
|
||||
'Please login again (account logged in elsewhere)' => 'Please login again (account logged in elsewhere)',
|
||||
'Please provide auth-token' => 'Please provide auth-token',
|
||||
'Please provide token' => 'Please provide token',
|
||||
'Please register' => 'Please register',
|
||||
'Please run composer require phpmailer/phpmailer and restart' => 'Please run composer require phpmailer/phpmailer and restart',
|
||||
'Please select tables to generate' => 'Please select tables to generate',
|
||||
'Please set app name first' => 'Please set app name first',
|
||||
'Plugin already exists' => 'Plugin already exists',
|
||||
'Plugin base config is incomplete' => 'Plugin base config is incomplete',
|
||||
'Plugin base config is invalid' => 'Plugin base config is invalid',
|
||||
'Plugin directory not found' => 'Plugin directory not found',
|
||||
'Plugin install directory is already occupied' => 'Plugin install directory is already occupied',
|
||||
'Reward config is empty, please maintain dice_reward_config first' => 'Reward config is empty, please maintain dice_reward_config first',
|
||||
'SUCCESS' => 'Success',
|
||||
'SUPER_ADMIN_CANNOT_DELETE' => 'Super admin cannot be deleted',
|
||||
'Service timeout: ' => 'Service timeout: ',
|
||||
'Signature verification failed' => 'Signature verification failed',
|
||||
'Sum of paid/free direction counts must be greater than 0' => 'Sum of paid/free direction counts must be greater than 0',
|
||||
'Super admin cannot be deleted' => 'Super admin cannot be deleted',
|
||||
'System default group cannot be deleted' => 'System default group cannot be deleted',
|
||||
'System file generation error' => 'System file generation error',
|
||||
'TOKEN_EXPIRED_RELOGIN' => 'Token expired, please login again',
|
||||
'TOKEN_FORMAT_INVALID' => 'Token format invalid',
|
||||
'TOKEN_INVALID' => 'Invalid or expired token',
|
||||
'TOKEN_REQUIRED' => 'Please provide token',
|
||||
'Target category not found' => 'Target category not found',
|
||||
'Template directory not found' => 'Template directory not found',
|
||||
'Template not found' => 'Template not found',
|
||||
'Test count only supports 100, 500, 1000, 5000, 10000' => 'Test count only supports 100, 500, 1000, 5000, 10000',
|
||||
'Test record not found' => 'Test record not found',
|
||||
'This category has sub-categories, please delete them first' => 'This category has sub-categories, please delete them first',
|
||||
'This department has sub-departments, please delete them first' => 'This department has sub-departments, please delete them first',
|
||||
'This department has users, please delete or transfer them first' => 'This department has users, please delete or transfer them first',
|
||||
'This dict code already exists' => 'This dict code already exists',
|
||||
'This menu has sub-menus, please delete them first' => 'This menu has sub-menus, please delete them first',
|
||||
'Timestamp expired or invalid, please sync time' => 'Timestamp expired or invalid, please sync time',
|
||||
'Token expired, please login again' => 'Token expired, please login again',
|
||||
'Token format invalid' => 'Token format invalid',
|
||||
'USERNAME_PASSWORD_REQUIRED' => 'username and password are required',
|
||||
'USERNAME_REQUIRED' => 'username is required',
|
||||
'USER_NOT_FOUND' => 'User not found',
|
||||
'Update data error, please check' => 'Update data error, please check',
|
||||
'Upload mode not found' => 'Upload mode not found',
|
||||
'User not found' => 'User not found',
|
||||
'Waiting for dependencies to be installed' => 'Waiting for dependencies to be installed',
|
||||
'When free pool is not selected, please fill free custom tier probabilities (T1–T5)' => 'When free pool is not selected, please fill free custom tier probabilities (T1–T5)',
|
||||
'When paid pool is not selected, please fill paid custom tier probabilities (T1–T5)' => 'When paid pool is not selected, please fill paid custom tier probabilities (T1–T5)',
|
||||
'Wrong password' => 'Wrong password',
|
||||
'Your login credential is invalid or expired, please login again' => 'Your login credential is invalid or expired, please login again',
|
||||
'add failed' => 'add failed',
|
||||
'add success' => 'add success',
|
||||
'admin already installed, to reinstall please delete env file and restart' => 'admin already installed, to reinstall please delete env file and restart',
|
||||
'all test data cleared' => 'all test data cleared',
|
||||
'auth-token expired' => 'auth-token expired',
|
||||
'auth-token format invalid' => 'auth-token format invalid',
|
||||
'auth-token invalid' => 'auth-token invalid',
|
||||
'auth-token invalid or expired' => 'auth-token invalid or expired',
|
||||
'captcha error' => 'captcha error',
|
||||
'clean success' => 'clean success',
|
||||
'clear cache success' => 'clear cache success',
|
||||
'clear failed: ' => 'clear failed: ',
|
||||
'coin cannot be 0' => 'coin cannot be 0',
|
||||
'coin is required' => 'coin is required',
|
||||
'connection refused, please check database ip/port and ensure database is running' => 'connection refused, please check database ip/port and ensure database is running',
|
||||
'create reward mapping success' => 'create reward mapping success',
|
||||
'database SQL file not found' => 'database SQL file not found',
|
||||
'database already installed, please do not install again' => 'database already installed, please do not install again',
|
||||
'database connection timeout, please check ip/port and firewall/security group rules' => 'database connection timeout, please check ip/port and firewall/security group rules',
|
||||
'database username or password is incorrect' => 'database username or password is incorrect',
|
||||
'delete failed' => 'delete failed',
|
||||
'delete success' => 'delete success',
|
||||
'direction must be 0 (clockwise) or 1 (counterclockwise)' => 'direction must be 0 (clockwise) or 1 (counterclockwise)',
|
||||
'direction must be 0 or 1' => 'direction must be 0 or 1',
|
||||
'download failed' => 'download failed',
|
||||
'download success, please install in plugin list' => 'download success, please install in plugin list',
|
||||
'execute success' => 'execute success',
|
||||
'execution failed' => 'execution failed',
|
||||
'file size cannot exceed 5M' => 'file size cannot exceed 5M',
|
||||
'import success' => 'import success',
|
||||
'import success, refreshed DiceReward, DiceRewardConfig(BIGWIN), and pool config' => 'import success, refreshed DiceReward, DiceRewardConfig(BIGWIN), and pool config',
|
||||
'install success' => 'install success',
|
||||
'invalid parameters, please check' => 'invalid parameters, please check',
|
||||
'login expired or invalid, please login again' => 'login expired or invalid, please login again',
|
||||
'missing parameter id' => 'missing parameter id',
|
||||
'missing parameter status' => 'missing parameter status',
|
||||
'missing player_id' => 'missing player_id',
|
||||
'no permission to delete selected data' => 'no permission to delete selected data',
|
||||
'no permission to operate this player' => 'no permission to operate this player',
|
||||
'no permission to update this record' => 'no permission to update this record',
|
||||
'no permission to view this record' => 'no permission to view this record',
|
||||
'not found' => 'not found',
|
||||
'not logged in' => 'not logged in',
|
||||
'operation failed' => 'operation failed',
|
||||
'operation success' => 'operation success',
|
||||
'operation type must be 3 (add) or 4 (deduct)' => 'operation type must be 3 (add) or 4 (deduct)',
|
||||
'optimize success' => 'optimize success',
|
||||
'parameter items must be an array' => 'parameter items must be an array',
|
||||
'please input email' => 'please input email',
|
||||
'please login first' => 'please login first',
|
||||
'please provide direction (0=clockwise, 1=counterclockwise)' => 'please provide direction (0=clockwise, 1=counterclockwise)',
|
||||
'please provide record_id' => 'please provide record_id',
|
||||
'please select cache to delete' => 'please select cache to delete',
|
||||
'please select data to delete' => 'please select data to delete',
|
||||
'please select player' => 'please select player',
|
||||
'please specify test record' => 'please specify test record',
|
||||
'record not found' => 'record not found',
|
||||
'reload success' => 'reload success',
|
||||
'reset success' => 'reset success',
|
||||
'save success' => 'save success',
|
||||
'send failed, please check logs' => 'send failed, please check logs',
|
||||
'send success' => 'send success',
|
||||
'super admin cannot reset password' => 'super admin cannot reset password',
|
||||
'test data cleared' => 'test data cleared',
|
||||
'too many requests, please try again later' => 'too many requests, please try again later',
|
||||
'uninstall plugin success' => 'uninstall plugin success',
|
||||
'update failed' => 'update failed',
|
||||
'update success' => 'update success',
|
||||
'upload failed, please upload zip file' => 'upload failed, please upload zip file',
|
||||
'upload file validation failed' => 'upload file validation failed',
|
||||
'uploaded file not found' => 'uploaded file not found',
|
||||
'username is required' => 'username is required',
|
||||
'version id is required' => 'version id is required',
|
||||
];
|
||||
346
server/resource/translations/api/zh.php
Normal file
346
server/resource/translations/api/zh.php
Normal file
@@ -0,0 +1,346 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
return [
|
||||
'ACCOUNT_DISABLED' => '账号已被禁用,无法登录',
|
||||
'API_AUTH_TOKEN_SECRET is not configured' => '服务端未配置 API_AUTH_TOKEN_SECRET',
|
||||
'AUTH_TOKEN_EXPIRED' => 'auth-token 已过期',
|
||||
'AUTH_TOKEN_FORMAT_INVALID' => 'auth-token 格式无效',
|
||||
'AUTH_TOKEN_INVALID' => 'auth-token 无效',
|
||||
'AUTH_TOKEN_INVALID_OR_EXPIRED' => 'auth-token 无效或已失效',
|
||||
'AUTH_TOKEN_REQUIRED' => '请携带 auth-token',
|
||||
'Account is disabled and cannot log in' => '账号已被禁用,无法登录',
|
||||
'App type must be plugin or app' => '应用类型必须为plugin或者app',
|
||||
'BALANCE_LESS_THAN_MIN' => '当前玩家余额%s小于%s无法继续游戏',
|
||||
'BATCH_DELETE_FORBIDDEN' => '禁止批量删除操作',
|
||||
'BUY_TICKET_ERROR' => '购买抽奖券错误',
|
||||
'Balance %s is less than %s, cannot continue' => '当前玩家余额%s小于%s无法继续游戏',
|
||||
'Batch delete is not allowed' => '禁止批量删除操作',
|
||||
'CONFIG_ID_NOT_FOUND_OR_TIER_EMPTY' => '配置ID %s 不存在或档位为空',
|
||||
'Cannot open file or create file failed' => '无法打开文件,或者文件创建失败',
|
||||
'Cannot operate roles with higher level than current account' => '不能操作比当前账户职级高的角色',
|
||||
'Cannot set parent category as child of current' => '不能将上级分类设置为当前分类的子分类',
|
||||
'Cannot set parent department to a child of current department' => '不能将上级部门设置为当前部门的子部门',
|
||||
'Cannot set parent to self' => '不能设置父级为自身',
|
||||
'Chunk file not found, please upload again' => '切片文件查找失败,请重新上传',
|
||||
'Chunk upload must be called in HTTP request context' => '切片上传服务必须在 HTTP 请求环境下调用',
|
||||
'Coin change must be greater than 0' => '平台币变动必须大于 0',
|
||||
'Config data not found' => '配置数据未找到',
|
||||
'Config group not found' => '配置组未找到',
|
||||
'Counts only support 0, 100, 500, 1000, 5000' => '各抽奖次数仅支持 0、100、500、1000、5000',
|
||||
'Current table does not support recycle bin' => '当前表不支持回收站功能',
|
||||
'DATA_NOT_FOUND' => '数据不存在',
|
||||
'DIRECTION_INVALID' => 'direction 必须为 0 或 1',
|
||||
'Data not found' => '数据不存在',
|
||||
'Deduct amount cannot exceed current balance' => '扣点数量不能大于当前余额',
|
||||
'Delete data error, please check' => '删除数据异常,请检查',
|
||||
'Dict type not found' => '字典类型不存在',
|
||||
'FAIL' => '失败',
|
||||
'Failed to create image resource' => '创建图片资源失败',
|
||||
'Failed to generate token' => '生成 token 失败',
|
||||
'Failed to get file resource' => '获取文件资源失败',
|
||||
'Failed to get login credential, please check' => '登录凭获取失败,请检查',
|
||||
'Failed to read database config' => '数据库配置读取失败',
|
||||
'Failed to save file' => '文件保存失败',
|
||||
'File format not supported for upload' => '不支持该格式的文件上传',
|
||||
'File generation not allowed in non-debug mode' => '非调试模式下,不允许生成文件',
|
||||
'File not found' => '文件不存在',
|
||||
'File size exceeds limit' => '文件大小超过限制',
|
||||
'Free pool config not found' => '免费奖池配置不存在',
|
||||
'Free tier probabilities (T1–T5) sum cannot exceed 100%' => '免费档位概率 T1~T5 之和不能超过 100%',
|
||||
'Free tier probability must be between 0 and 100%' => '免费档位概率每档只能 0-100%',
|
||||
'Frontend directory not found, must be same level as backend' => '前端目录查找失败,必须与后端目录为同级目录!',
|
||||
'INSUFFICIENT_BALANCE' => '平台币不足',
|
||||
'INSUFFICIENT_TICKETS' => '抽奖券不足',
|
||||
'Import file error, please upload correct xlsx file' => '导入文件错误,请上传正确的文件格式xlsx',
|
||||
'Insufficient balance' => '平台币不足',
|
||||
'Insufficient balance to transfer' => '余额不足,无法转出',
|
||||
'Insufficient lottery tickets' => '抽奖券不足',
|
||||
'Invalid DiceReward id exists' => '存在无效的 DiceReward id',
|
||||
'Invalid config ID exists' => '存在无效的配置ID',
|
||||
'Invalid file format' => '文件格式错误',
|
||||
'Invalid file type, cannot generate file' => '文件类型异常,无法生成指定文件!',
|
||||
'Invalid lottery ticket purchase' => '购买抽奖券错误',
|
||||
'Invalid or expired token' => 'token 无效',
|
||||
'Invalid parameters' => '参数错误',
|
||||
'Invalid params: player_id and type are required (3=add, 4=deduct)' => '参数错误:需要有效的 player_id 和 type(3=加点,4=扣点)',
|
||||
'Invalid phone format, only +60 Malaysia numbers supported (e.g. +60123456789)' => '手机号格式错误,仅支持 +60 开头的马来西亚号码(如 +60123456789)',
|
||||
'Invalid secret' => '密钥错误',
|
||||
'Invalid task type' => '任务类型异常',
|
||||
'LOTTERY_CONFIG_NOT_FOUND' => '奖池配置不存在',
|
||||
'LOTTERY_POOL_CONFIG_DEFAULT_NOT_FOUND' => '未找到 name=default 的奖池配置,请先创建',
|
||||
'LOTTERY_POOL_CONFIG_NOT_FOUND_DEFAULT' => '奖池配置不存在(需 name=default)',
|
||||
'Logged out successfully' => '已退出登录',
|
||||
'Login credential verification failed' => '登录凭证校验失败',
|
||||
'Lottery pool config not found (name=default required)' => '奖池配置不存在(需 name=default)',
|
||||
'MSG_022FA411' => '应用类型必须为plugin或者app',
|
||||
'MSG_04BF8179' => '数据不存在',
|
||||
'MSG_06F06DA6' => 'token 无效',
|
||||
'MSG_0A17D195' => '付费档位概率每档只能 0-100%',
|
||||
'MSG_0A9A3E28' => '禁止批量删除操作',
|
||||
'MSG_0BCF9CBC' => '测试次数仅支持 100、500、1000、5000、10000',
|
||||
'MSG_0CBB8FF6' => '服务超时,',
|
||||
'MSG_0D49B785' => '原密码错误',
|
||||
'MSG_0FE75E2C' => '切片上传服务必须在 HTTP 请求环境下调用',
|
||||
'MSG_146A3F0D' => '字典类型不存在',
|
||||
'MSG_17740DB3' => 'token 格式无效',
|
||||
'MSG_1798E4D4' => '模板不存在',
|
||||
'MSG_19E651B8' => 'coin 不能为空',
|
||||
'MSG_1A499109' => '文件不存在',
|
||||
'MSG_1BB27051' => 'auth-token 已过期',
|
||||
'MSG_1C1718A6' => '插件已经存在',
|
||||
'MSG_2240AD6D' => 'auth-token 无效',
|
||||
'MSG_2273437E' => '当前玩家余额%s小于%s无法继续游戏',
|
||||
'MSG_22C6787F' => '切片文件查找失败,请重新上传',
|
||||
'MSG_25BF8A8D' => '扣点数量不能大于当前余额',
|
||||
'MSG_2830AE01' => '服务超时,没有原因',
|
||||
'MSG_2ED0C7A8' => '插件的基础配置信息错误',
|
||||
'MSG_2EE75A5E' => '系统生成文件错误',
|
||||
'MSG_2EFE74EE' => '非调试模式下,不允许生成文件',
|
||||
'MSG_2F100DB4' => '不能操作比当前账户职级高的角色',
|
||||
'MSG_334CE26A' => '没有权限操作该数据',
|
||||
'MSG_35FB9BA0' => '不支持该格式的文件上传',
|
||||
'MSG_381A19AE' => '该上传模式不存在',
|
||||
'MSG_3A4A6DE6' => 'username 不能为空',
|
||||
'MSG_3A4FF81F' => '没有权限操作该部门数据',
|
||||
'MSG_3C99F7F7' => '奖励配置为空,请先维护 dice_reward_config',
|
||||
'MSG_3DBFEA33' => '文件格式错误',
|
||||
'MSG_43C4D703' => '该部门下存在用户,请先删除或者转移用户',
|
||||
'MSG_47FDBDD0' => '配置组未找到',
|
||||
'MSG_4CA58C61' => '修改数据异常,请检查',
|
||||
'MSG_4F1D271A' => '存在无效的 DiceReward id',
|
||||
'MSG_521593FB' => '请先设置应用名称',
|
||||
'MSG_557E5109' => '获取文件资源失败',
|
||||
'MSG_559AAE0E' => '没有权限操作该角色数据',
|
||||
'MSG_560E6D91' => '该方向下暂无可用路径配置',
|
||||
'MSG_5643EE10' => '生成 token 失败',
|
||||
'MSG_569EC863' => '当前表不支持回收站功能',
|
||||
'MSG_56B44907' => '目标分类不存在',
|
||||
'MSG_5CE17D6B' => 'auth-token 无效或已失效',
|
||||
'MSG_5FF3A2BE' => '数据库配置读取失败',
|
||||
'MSG_609A300B' => '平台币不足',
|
||||
'MSG_60B9FC38' => '登录凭获取失败,请检查',
|
||||
'MSG_64A3C830' => '用户不存在',
|
||||
'MSG_67C66962' => '未找到 name=default 的奖池配置,请先创建',
|
||||
'MSG_6C16260B' => '免费未选择奖池配置时,请填写免费自定义档位概率(T1~T5)',
|
||||
'MSG_6CA924A1' => '奖池配置不存在(需 name=default)',
|
||||
'MSG_6F00DFB2' => 'success',
|
||||
'MSG_7310FDB8' => '前端目录查找失败,必须与后端目录为同级目录!',
|
||||
'MSG_74E3CB84' => '暂无可用奖励配置',
|
||||
'MSG_75C6A69F' => '请携带 auth-token',
|
||||
'MSG_7845F2E9' => '删除数据异常,请检查',
|
||||
'MSG_86272B49' => 'fail',
|
||||
'MSG_8865D363' => 'coin 不能为 0',
|
||||
'MSG_8B6AA32A' => '不能将上级分类设置为当前分类的子分类',
|
||||
'MSG_8C2E3CE6' => '请重新登录(当前账号已在其他处登录)',
|
||||
'MSG_8FDBA3F1' => '该字典标识已存在',
|
||||
'MSG_91272513' => '购买抽奖券错误',
|
||||
'MSG_94EE6593' => '该插件的安装目录已经被占用',
|
||||
'MSG_9501E2EF' => '余额不足,无法转出',
|
||||
'MSG_950B6072' => '配置数据未找到',
|
||||
'MSG_9A01DFBF' => '该插件的基础配置信息不完善',
|
||||
'MSG_9D195F25' => '账号已被禁用,无法登录',
|
||||
'MSG_9EE0801C' => '无法打开文件,或者文件创建失败',
|
||||
'MSG_9F6B51C8' => '文件类型异常,无法生成指定文件!',
|
||||
'MSG_A049A679' => '该分类下存在子分类,请先删除子分类',
|
||||
'MSG_A3165463' => '仅超级管理员能够操作',
|
||||
'MSG_A4FB6212' => '文件保存失败',
|
||||
'MSG_A6A8EA8F' => '插件目录不存在',
|
||||
'MSG_A72A7DC6' => '该部门下存在子部门,请先删除子部门',
|
||||
'MSG_A778ABB9' => 'auth-token 格式无效',
|
||||
'MSG_ADA80442' => '请重新登录',
|
||||
'MSG_AE73E6F3' => '服务端未配置 API_AUTH_TOKEN_SECRET',
|
||||
'MSG_B387239D' => '付费档位概率 T1~T5 之和不能超过 100%',
|
||||
'MSG_B5C2F2F6' => '各抽奖次数仅支持 0、100、500、1000、5000',
|
||||
'MSG_B5CD5C51' => '测试记录不存在',
|
||||
'MSG_B720629D' => 'username、password 不能为空',
|
||||
'MSG_BA173F12' => '付费或免费至少一种方向次数之和大于 0',
|
||||
'MSG_BAC2EFB0' => '上级部门和当前部门不能相同',
|
||||
'MSG_BB3C5A3F' => 'direction 必须为 0 或 1',
|
||||
'MSG_BBD3198A' => '参数错误:需要有效的 player_id 和 type(3=加点,4=扣点)',
|
||||
'MSG_BD8AD1D3' => '手机号格式错误,仅支持 +60 开头的马来西亚号码(如 +60123456789)',
|
||||
'MSG_BEB15D55' => '参数错误',
|
||||
'MSG_C2E4B3DC' => '任务类型异常',
|
||||
'MSG_C2F02095' => '抽奖券不足',
|
||||
'MSG_C3CB20DC' => '免费档位概率每档只能 0-100%',
|
||||
'MSG_C43809BC' => '操作失败:',
|
||||
'MSG_C548E557' => '缺少参数:agent_id、secret、time、signature 不能为空',
|
||||
'MSG_C5D5D5E1' => '不能将上级部门设置为当前部门的子部门',
|
||||
'MSG_C803EA6F' => '请注册',
|
||||
'MSG_C80C5EF5' => '创建图片资源失败',
|
||||
'MSG_C9BFC7E9' => '奖池配置不存在',
|
||||
'MSG_CDEA9DD8' => '您的登录凭证错误或者已过期,请重新登录',
|
||||
'MSG_D15C0759' => '密钥错误',
|
||||
'MSG_D1D1C0A0' => '模板目录不存在!',
|
||||
'MSG_D1E7769C' => '上级分类和当前分类不能相同',
|
||||
'MSG_D224020F' => '免费奖池配置不存在',
|
||||
'MSG_D75845B2' => '免费档位概率 T1~T5 之和不能超过 100%',
|
||||
'MSG_DB560C68' => '请执行 composer require phpmailer/phpmailer 并重启',
|
||||
'MSG_DEE31D19' => '时间戳已过期或无效,请同步时间',
|
||||
'MSG_DF93D5F9' => 'token 已过期,请重新登录',
|
||||
'MSG_E12FF883' => '文件大小超过限制',
|
||||
'MSG_E15B47C6' => '超级管理员禁止删除',
|
||||
'MSG_E1BFE655' => '未设置邮件配置',
|
||||
'MSG_E5849544' => '密码错误',
|
||||
'MSG_E66BC216' => '该菜单下存在子菜单,请先删除子菜单',
|
||||
'MSG_E6E6288B' => '系统默认分组,无法删除',
|
||||
'MSG_E84B2B0A' => '已退出登录',
|
||||
'MSG_E8C8EC80' => '存在无效的配置ID',
|
||||
'MSG_E96B26B9' => '平台币变动必须大于 0',
|
||||
'MSG_EEDAAC44' => '等待依赖安装',
|
||||
'MSG_F0F5F561' => '配置ID %s 不存在或档位为空',
|
||||
'MSG_F12E5DBA' => '奖励配置需覆盖 26 个格位(id 0-25 或 1-26),当前仅 %s 条,无法完整生成 5-30 共26个点数、顺时针与逆时针的奖励对照',
|
||||
'MSG_F2643E83' => '登录凭证校验失败',
|
||||
'MSG_F58CB5C8' => '该部门下存在子分类,请先删除子分类',
|
||||
'MSG_F5F9FF11' => '付费奖池配置不存在',
|
||||
'MSG_F7BBA776' => '没有原因',
|
||||
'MSG_F8EB5084' => '签名验证失败',
|
||||
'MSG_FA5FF202' => '不能设置父级为自身',
|
||||
'MSG_FB4C0ADF' => '请选择要生成的表',
|
||||
'MSG_FBC50B18' => '玩家不存在',
|
||||
'MSG_FC1E3345' => '导入文件错误,请上传正确的文件格式xlsx',
|
||||
'MSG_FDADA275' => '付费未选择奖池配置时,请填写付费自定义档位概率(T1~T5)',
|
||||
'MSG_FE1B67CA' => '请携带 token',
|
||||
'Mail config not set' => '未设置邮件配置',
|
||||
'Missing parameters: agent_id, secret, time, signature are required' => '缺少参数:agent_id、secret、time、signature 不能为空',
|
||||
'NO_AVAILABLE_REWARD_CONFIG' => '暂无可用奖励配置',
|
||||
'No available reward config' => '暂无可用奖励配置',
|
||||
'No name=default pool config found, please create one first' => '未找到 name=default 的奖池配置,请先创建',
|
||||
'No permission to operate department data' => '没有权限操作该部门数据',
|
||||
'No permission to operate role data' => '没有权限操作该角色数据',
|
||||
'No permission to operate this data' => '没有权限操作该数据',
|
||||
'OLD_PASSWORD_WRONG' => '原密码错误',
|
||||
'Old password is incorrect' => '原密码错误',
|
||||
'Only super admin can perform this action' => '仅超级管理员能够操作',
|
||||
'Operation failed: ' => '操作失败:',
|
||||
'PASSWORD_WRONG' => '密码错误',
|
||||
'Paid pool config not found' => '付费奖池配置不存在',
|
||||
'Paid tier probabilities (T1–T5) sum cannot exceed 100%' => '付费档位概率 T1~T5 之和不能超过 100%',
|
||||
'Paid tier probability must be between 0 and 100%' => '付费档位概率每档只能 0-100%',
|
||||
'Parent category cannot be the same as current' => '上级分类和当前分类不能相同',
|
||||
'Parent department cannot be the same as current department' => '上级部门和当前部门不能相同',
|
||||
'Player not found' => '玩家不存在',
|
||||
'Please login again' => '请重新登录',
|
||||
'Please login again (account logged in elsewhere)' => '请重新登录(当前账号已在其他处登录)',
|
||||
'Please provide auth-token' => '请携带 auth-token',
|
||||
'Please provide token' => '请携带 token',
|
||||
'Please register' => '请注册',
|
||||
'Please run composer require phpmailer/phpmailer and restart' => '请执行 composer require phpmailer/phpmailer 并重启',
|
||||
'Please select tables to generate' => '请选择要生成的表',
|
||||
'Please set app name first' => '请先设置应用名称',
|
||||
'Plugin already exists' => '插件已经存在',
|
||||
'Plugin base config is incomplete' => '该插件的基础配置信息不完善',
|
||||
'Plugin base config is invalid' => '插件的基础配置信息错误',
|
||||
'Plugin directory not found' => '插件目录不存在',
|
||||
'Plugin install directory is already occupied' => '该插件的安装目录已经被占用',
|
||||
'Reward config is empty, please maintain dice_reward_config first' => '奖励配置为空,请先维护 dice_reward_config',
|
||||
'SUCCESS' => '成功',
|
||||
'SUPER_ADMIN_CANNOT_DELETE' => '超级管理员禁止删除',
|
||||
'Service timeout: ' => '服务超时,',
|
||||
'Signature verification failed' => '签名验证失败',
|
||||
'Sum of paid/free direction counts must be greater than 0' => '付费或免费至少一种方向次数之和大于 0',
|
||||
'Super admin cannot be deleted' => '超级管理员禁止删除',
|
||||
'System default group cannot be deleted' => '系统默认分组,无法删除',
|
||||
'System file generation error' => '系统生成文件错误',
|
||||
'TOKEN_EXPIRED_RELOGIN' => 'token 已过期,请重新登录',
|
||||
'TOKEN_FORMAT_INVALID' => 'token 格式无效',
|
||||
'TOKEN_INVALID' => 'token 无效',
|
||||
'TOKEN_REQUIRED' => '请携带 token',
|
||||
'Target category not found' => '目标分类不存在',
|
||||
'Template directory not found' => '模板目录不存在!',
|
||||
'Template not found' => '模板不存在',
|
||||
'Test count only supports 100, 500, 1000, 5000, 10000' => '测试次数仅支持 100、500、1000、5000、10000',
|
||||
'Test record not found' => '测试记录不存在',
|
||||
'This category has sub-categories, please delete them first' => '该部门下存在子分类,请先删除子分类',
|
||||
'This department has sub-departments, please delete them first' => '该部门下存在子部门,请先删除子部门',
|
||||
'This department has users, please delete or transfer them first' => '该部门下存在用户,请先删除或者转移用户',
|
||||
'This dict code already exists' => '该字典标识已存在',
|
||||
'This menu has sub-menus, please delete them first' => '该菜单下存在子菜单,请先删除子菜单',
|
||||
'Timestamp expired or invalid, please sync time' => '时间戳已过期或无效,请同步时间',
|
||||
'Token expired, please login again' => 'token 已过期,请重新登录',
|
||||
'Token format invalid' => 'token 格式无效',
|
||||
'USERNAME_PASSWORD_REQUIRED' => 'username、password 不能为空',
|
||||
'USERNAME_REQUIRED' => 'username 不能为空',
|
||||
'USER_NOT_FOUND' => '用户不存在',
|
||||
'Update data error, please check' => '修改数据异常,请检查',
|
||||
'Upload mode not found' => '该上传模式不存在',
|
||||
'User not found' => '用户不存在',
|
||||
'Waiting for dependencies to be installed' => '等待依赖安装',
|
||||
'When free pool is not selected, please fill free custom tier probabilities (T1–T5)' => '免费未选择奖池配置时,请填写免费自定义档位概率(T1~T5)',
|
||||
'When paid pool is not selected, please fill paid custom tier probabilities (T1–T5)' => '付费未选择奖池配置时,请填写付费自定义档位概率(T1~T5)',
|
||||
'Wrong password' => '密码错误',
|
||||
'Your login credential is invalid or expired, please login again' => '您的登录凭证错误或者已过期,请重新登录',
|
||||
'add failed' => '添加失败',
|
||||
'add success' => '添加成功',
|
||||
'admin already installed, to reinstall please delete env file and restart' => '管理后台已经安装!如需重新安装,请删除根目录env配置文件并重启',
|
||||
'all test data cleared' => '已清空所有测试数据',
|
||||
'auth-token expired' => 'auth-token 已过期',
|
||||
'auth-token format invalid' => 'auth-token 格式无效',
|
||||
'auth-token invalid' => 'auth-token 无效',
|
||||
'auth-token invalid or expired' => 'auth-token 无效或已失效',
|
||||
'captcha error' => '验证码错误',
|
||||
'clean success' => '清理成功',
|
||||
'clear cache success' => '清除缓存成功!',
|
||||
'clear failed: ' => '清空失败:',
|
||||
'coin cannot be 0' => 'coin 不能为 0',
|
||||
'coin is required' => 'coin 不能为空',
|
||||
'connection refused, please check database ip/port and ensure database is running' => 'Connection refused. 请确认数据库IP端口是否正确,数据库已经启动',
|
||||
'create reward mapping success' => '创建奖励对照成功',
|
||||
'database SQL file not found' => '数据库SQL文件不存在',
|
||||
'database already installed, please do not install again' => '数据库已经安装,请勿重复安装',
|
||||
'database connection timeout, please check ip/port and firewall/security group rules' => '数据库连接超时,请确认数据库IP端口是否正确,安全组及防火墙已经放行端口',
|
||||
'database username or password is incorrect' => '数据库用户名或密码错误',
|
||||
'delete failed' => '删除失败',
|
||||
'delete success' => '删除成功',
|
||||
'direction must be 0 (clockwise) or 1 (counterclockwise)' => 'direction 必须为 0(顺时针)或 1(逆时针)',
|
||||
'direction must be 0 or 1' => 'direction 必须为 0 或 1',
|
||||
'download failed' => '下载失败',
|
||||
'download success, please install in plugin list' => '下载成功,请在插件列表中安装',
|
||||
'execute success' => '执行成功',
|
||||
'execution failed' => '执行失败',
|
||||
'file size cannot exceed 5M' => '文件大小不能超过5M',
|
||||
'import success' => '导入成功',
|
||||
'import success, refreshed DiceReward, DiceRewardConfig(BIGWIN), and pool config' => '导入成功,已刷新 DiceReward、DiceRewardConfig(BIGWIN)、奖池配置',
|
||||
'install success' => '安装成功',
|
||||
'invalid parameters, please check' => '参数错误,请检查',
|
||||
'login expired or invalid, please login again' => '登录已过期或用户信息无效,请重新登录',
|
||||
'missing parameter id' => '缺少参数 id',
|
||||
'missing parameter status' => '缺少参数 status',
|
||||
'missing player_id' => '缺少 player_id',
|
||||
'no permission to delete selected data' => '无权限删除所选数据',
|
||||
'no permission to operate this player' => '无权限操作该玩家',
|
||||
'no permission to update this record' => '无权限修改该记录',
|
||||
'no permission to view this record' => '无权限查看该记录',
|
||||
'not found' => '未查找到信息',
|
||||
'not logged in' => '未登录',
|
||||
'operation failed' => '操作失败',
|
||||
'operation success' => '操作成功',
|
||||
'operation type must be 3 (add) or 4 (deduct)' => '操作类型必须为 3=加点 或 4=扣点',
|
||||
'optimize success' => '优化成功',
|
||||
'parameter items must be an array' => '参数 items 必须为数组',
|
||||
'please input email' => '请输入邮箱',
|
||||
'please login first' => '请先登录',
|
||||
'please provide direction (0=clockwise, 1=counterclockwise)' => '请传入 direction(0=顺时针 1=逆时针)',
|
||||
'please provide record_id' => '请传入 record_id',
|
||||
'please select cache to delete' => '请选择要删除的缓存',
|
||||
'please select data to delete' => '请选择要删除的数据',
|
||||
'please select player' => '请选择玩家',
|
||||
'please specify test record' => '请指定测试记录',
|
||||
'record not found' => '记录不存在',
|
||||
'reload success' => '重载成功',
|
||||
'reset success' => '重置成功',
|
||||
'save success' => '保存成功',
|
||||
'send failed, please check logs' => '发送失败,请查看日志',
|
||||
'send success' => '发送成功',
|
||||
'super admin cannot reset password' => '超级管理员不允许重置密码',
|
||||
'test data cleared' => '已清空测试数据',
|
||||
'too many requests, please try again later' => '请求过于频繁,请稍后再试',
|
||||
'uninstall plugin success' => '卸载插件成功',
|
||||
'update failed' => '修改失败',
|
||||
'update success' => '修改成功',
|
||||
'upload failed, please upload zip file' => '文件格式上传失败,请选择zip格式文件上传',
|
||||
'upload file validation failed' => '上传文件校验失败',
|
||||
'uploaded file not found' => '未找到上传文件',
|
||||
'username is required' => 'username 不能为空',
|
||||
'version id is required' => '版本ID不能为空',
|
||||
];
|
||||
50
server/scripts/gen_api_msg_keys.php
Normal file
50
server/scripts/gen_api_msg_keys.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* 将 “中文=>英文” 的历史映射(可临时放在 $legacy 变量里)转换为英文 key 映射:
|
||||
* - resource/translations/api/en.php: key=MSG_XXXXXXXX, value=英文
|
||||
* - resource/translations/api/zh.php: key=MSG_XXXXXXXX, value=中文
|
||||
*
|
||||
* 同时保留 resource/translations/api/{zh,en}.php 中已存在的显式英文错误码。
|
||||
*/
|
||||
|
||||
$root = dirname(__DIR__);
|
||||
|
||||
$enPath = $root . '/resource/translations/api/en.php';
|
||||
$zhPath = $root . '/resource/translations/api/zh.php';
|
||||
|
||||
$legacy = [];
|
||||
$en = is_file($enPath) ? (require $enPath) : [];
|
||||
$zh = is_file($zhPath) ? (require $zhPath) : [];
|
||||
|
||||
foreach ($legacy as $cn => $enVal) {
|
||||
if (!is_string($cn) || $cn === '' || !is_string($enVal)) {
|
||||
continue;
|
||||
}
|
||||
$key = 'MSG_' . strtoupper(sprintf('%08X', crc32($cn)));
|
||||
if (!isset($en[$key])) {
|
||||
$en[$key] = $enVal;
|
||||
}
|
||||
if (!isset($zh[$key])) {
|
||||
$zh[$key] = $cn;
|
||||
}
|
||||
}
|
||||
|
||||
$dump = static function (array $arr): string {
|
||||
ksort($arr);
|
||||
$out = "<?php\ndeclare(strict_types=1);\n\nreturn [\n";
|
||||
foreach ($arr as $k => $v) {
|
||||
$k = str_replace("'", "\\'", (string) $k);
|
||||
$v = str_replace("'", "\\'", (string) $v);
|
||||
$out .= " '{$k}' => '{$v}',\n";
|
||||
}
|
||||
$out .= "];\n";
|
||||
return $out;
|
||||
};
|
||||
|
||||
file_put_contents($enPath, $dump($en));
|
||||
file_put_contents($zhPath, $dump($zh));
|
||||
|
||||
echo "done\n";
|
||||
|
||||
184
server/scripts/replace_cn_messages_with_en.php
Normal file
184
server/scripts/replace_cn_messages_with_en.php
Normal file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* 批量把代码中的中文 message 替换为英文短句(显式英文,不是错误码):
|
||||
* - return $this->success('中文...')
|
||||
* - return $this->fail('中文...', ...)
|
||||
* - throw new ApiException('中文...', ...)
|
||||
*
|
||||
* 英文短句来源:resource/translations/api/en.php 与 zh.php 中的 MSG_ 对照(crc32 中文生成 key)。
|
||||
* 同时自动把“英文短句 => 英文/中文”写入 resource/translations/api/{en,zh}.php(Webman 标准路径)。
|
||||
*
|
||||
* 用法:
|
||||
* php server/scripts/replace_cn_messages_with_en.php
|
||||
*/
|
||||
|
||||
$root = dirname(__DIR__);
|
||||
$serverDir = $root;
|
||||
|
||||
$enPath = $root . '/resource/translations/api/en.php';
|
||||
$zhPath = $root . '/resource/translations/api/zh.php';
|
||||
|
||||
$enMap = is_file($enPath) ? (require $enPath) : [];
|
||||
$zhMap = is_file($zhPath) ? (require $zhPath) : [];
|
||||
|
||||
/** @var array<string, string> $cnToEn */
|
||||
$cnToEn = [];
|
||||
foreach ($zhMap as $k => $cn) {
|
||||
if (!is_string($k) || !is_string($cn)) {
|
||||
continue;
|
||||
}
|
||||
if (strncmp($k, 'MSG_', 4) !== 0) {
|
||||
continue;
|
||||
}
|
||||
$en = $enMap[$k] ?? null;
|
||||
if (is_string($en) && $en !== '') {
|
||||
$cnToEn[$cn] = $en;
|
||||
}
|
||||
}
|
||||
|
||||
$fallbackCn = [
|
||||
'添加成功' => 'add success',
|
||||
'修改成功' => 'update success',
|
||||
'删除成功' => 'delete success',
|
||||
'操作成功' => 'operation success',
|
||||
'保存成功' => 'save success',
|
||||
'执行成功' => 'execute success',
|
||||
'安装成功' => 'install success',
|
||||
'导入成功' => 'import success',
|
||||
'发送成功' => 'send success',
|
||||
'重载成功' => 'reload success',
|
||||
'重置成功' => 'reset success',
|
||||
'卸载插件成功' => 'uninstall plugin success',
|
||||
'优化成功' => 'optimize success',
|
||||
'清理成功' => 'clean success',
|
||||
'清除缓存成功!' => 'clear cache success',
|
||||
'已清空测试数据' => 'test data cleared',
|
||||
'已清空所有测试数据' => 'all test data cleared',
|
||||
'创建奖励对照成功' => 'create reward mapping success',
|
||||
'导入成功,已刷新 DiceReward、DiceRewardConfig(BIGWIN)、奖池配置' => 'import success, refreshed DiceReward, DiceRewardConfig(BIGWIN), and pool config',
|
||||
'下载成功,请在插件列表中安装' => 'download success, please install in plugin list',
|
||||
];
|
||||
|
||||
$containsCn = static function (string $s): bool {
|
||||
return preg_match('/[\x{4e00}-\x{9fff}]/u', $s) === 1;
|
||||
};
|
||||
|
||||
$quote = static function (string $s): string {
|
||||
return "'" . str_replace("'", "\\'", $s) . "'";
|
||||
};
|
||||
|
||||
$dump = static function (array $arr): string {
|
||||
ksort($arr);
|
||||
$out = "<?php\ndeclare(strict_types=1);\n\nreturn [\n";
|
||||
foreach ($arr as $k => $v) {
|
||||
$k = str_replace("'", "\\'", (string) $k);
|
||||
$v = str_replace("'", "\\'", (string) $v);
|
||||
$out .= " '{$k}' => '{$v}',\n";
|
||||
}
|
||||
$out .= "];\n";
|
||||
return $out;
|
||||
};
|
||||
|
||||
$files = [];
|
||||
$it = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($serverDir, FilesystemIterator::SKIP_DOTS)
|
||||
);
|
||||
foreach ($it as $file) {
|
||||
/** @var SplFileInfo $file */
|
||||
if (!$file->isFile()) {
|
||||
continue;
|
||||
}
|
||||
$path = $file->getPathname();
|
||||
if (substr($path, -4) !== '.php') {
|
||||
continue;
|
||||
}
|
||||
// 跳过 translations 目录与 scripts 自己,避免自我替换
|
||||
$norm = str_replace('\\', '/', $path);
|
||||
if (str_contains($norm, '/resource/translations/')) {
|
||||
continue;
|
||||
}
|
||||
if (str_contains($norm, '/scripts/replace_cn_messages_with_en.php')) {
|
||||
continue;
|
||||
}
|
||||
$files[] = $path;
|
||||
}
|
||||
|
||||
$totalReplaced = 0;
|
||||
$touchedFiles = 0;
|
||||
$addedKeys = 0;
|
||||
|
||||
foreach ($files as $path) {
|
||||
$content = file_get_contents($path);
|
||||
if (!is_string($content) || $content === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$replacedInFile = 0;
|
||||
$newContent = $content;
|
||||
|
||||
// 只处理单引号字符串:'...'
|
||||
$patterns = [
|
||||
// return $this->success('中文')
|
||||
'/(\$this->success\(\s*)\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/' => 'success',
|
||||
// return $this->success($data, '中文')
|
||||
'/(\$this->success\([^\\)]*?,\s*)\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/' => 'success_msg',
|
||||
// return $this->fail('中文', ...)
|
||||
'/(\$this->fail\(\s*)\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/' => 'fail',
|
||||
// throw new ApiException('中文', ...)
|
||||
'/(throw\s+new\s+ApiException\(\s*)\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/' => 'exception',
|
||||
];
|
||||
|
||||
foreach ($patterns as $regex => $type) {
|
||||
$newContent = preg_replace_callback($regex, function (array $m) use (
|
||||
$containsCn,
|
||||
$quote,
|
||||
&$cnToEn,
|
||||
$fallbackCn,
|
||||
&$enMap,
|
||||
&$zhMap,
|
||||
&$replacedInFile,
|
||||
&$addedKeys,
|
||||
$type
|
||||
) {
|
||||
$prefix = $m[1];
|
||||
$raw = $m[2];
|
||||
$cn = stripcslashes($raw);
|
||||
if (!$containsCn($cn)) {
|
||||
return $m[0];
|
||||
}
|
||||
$en = $cnToEn[$cn] ?? ($fallbackCn[$cn] ?? null);
|
||||
if (!is_string($en) || $en === '') {
|
||||
return $m[0];
|
||||
}
|
||||
|
||||
// 写入翻译表:英文短句作为 key
|
||||
if (!isset($enMap[$en])) {
|
||||
$enMap[$en] = $en;
|
||||
$addedKeys++;
|
||||
}
|
||||
if (!isset($zhMap[$en])) {
|
||||
$zhMap[$en] = $cn;
|
||||
$addedKeys++;
|
||||
}
|
||||
|
||||
$replacedInFile++;
|
||||
return $prefix . $quote($en);
|
||||
}, $newContent) ?? $newContent;
|
||||
}
|
||||
|
||||
if ($replacedInFile > 0 && $newContent !== $content) {
|
||||
file_put_contents($path, $newContent);
|
||||
$totalReplaced += $replacedInFile;
|
||||
$touchedFiles++;
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents($enPath, $dump($enMap));
|
||||
file_put_contents($zhPath, $dump($zhMap));
|
||||
|
||||
echo "touched_files={$touchedFiles}\n";
|
||||
echo "replaced={$totalReplaced}\n";
|
||||
echo "added_translation_pairs={$addedKeys}\n";
|
||||
|
||||
108
server/scripts/replace_e_crc_with_en_phrase.php
Normal file
108
server/scripts/replace_e_crc_with_en_phrase.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* 修复替换结果:把代码里的 'E_XXXXXXXX'(crc32 的十六进制)替换为真正英文短句。
|
||||
* 英文短句来源:resource/translations/api/en.php 的 MSG_XXXXXXXX。
|
||||
*
|
||||
* 同时确保 translations/api/{en,zh}.php 中包含:
|
||||
* - key=英文短句, en=英文短句
|
||||
* - key=英文短句, zh=对应中文
|
||||
*/
|
||||
|
||||
$root = dirname(__DIR__);
|
||||
$serverDir = $root;
|
||||
|
||||
$enPath = $root . '/resource/translations/api/en.php';
|
||||
$zhPath = $root . '/resource/translations/api/zh.php';
|
||||
|
||||
$enMap = is_file($enPath) ? (require $enPath) : [];
|
||||
$zhMap = is_file($zhPath) ? (require $zhPath) : [];
|
||||
|
||||
$dump = static function (array $arr): string {
|
||||
ksort($arr);
|
||||
$out = "<?php\ndeclare(strict_types=1);\n\nreturn [\n";
|
||||
foreach ($arr as $k => $v) {
|
||||
$k = str_replace("'", "\\'", (string) $k);
|
||||
$v = str_replace("'", "\\'", (string) $v);
|
||||
$out .= " '{$k}' => '{$v}',\n";
|
||||
}
|
||||
$out .= "];\n";
|
||||
return $out;
|
||||
};
|
||||
|
||||
$files = [];
|
||||
$it = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($serverDir, FilesystemIterator::SKIP_DOTS)
|
||||
);
|
||||
foreach ($it as $file) {
|
||||
/** @var SplFileInfo $file */
|
||||
if (!$file->isFile()) {
|
||||
continue;
|
||||
}
|
||||
$path = $file->getPathname();
|
||||
if (substr($path, -4) !== '.php') {
|
||||
continue;
|
||||
}
|
||||
$norm = str_replace('\\', '/', $path);
|
||||
if (str_contains($norm, '/resource/translations/')) {
|
||||
continue;
|
||||
}
|
||||
if (str_contains($norm, '/scripts/')) {
|
||||
continue;
|
||||
}
|
||||
$files[] = $path;
|
||||
}
|
||||
|
||||
$touchedFiles = 0;
|
||||
$replaced = 0;
|
||||
$added = 0;
|
||||
|
||||
foreach ($files as $path) {
|
||||
$content = file_get_contents($path);
|
||||
if (!is_string($content) || $content === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$newContent = preg_replace_callback(
|
||||
"/(['\"])E_([0-9A-Fa-f]{8})\\1/",
|
||||
function (array $m) use (&$enMap, &$zhMap, &$replaced, &$added) {
|
||||
$hex = strtoupper($m[2]);
|
||||
$msgKey = 'MSG_' . $hex;
|
||||
$en = $enMap[$msgKey] ?? null;
|
||||
$zh = $zhMap[$msgKey] ?? null;
|
||||
if (!is_string($en) || $en === '') {
|
||||
return $m[0];
|
||||
}
|
||||
if (!is_string($zh) || $zh === '') {
|
||||
$zh = $msgKey;
|
||||
}
|
||||
|
||||
if (!isset($enMap[$en])) {
|
||||
$enMap[$en] = $en;
|
||||
$added++;
|
||||
}
|
||||
if (!isset($zhMap[$en])) {
|
||||
$zhMap[$en] = $zh;
|
||||
$added++;
|
||||
}
|
||||
|
||||
$replaced++;
|
||||
return "'" . str_replace("'", "\\'", $en) . "'";
|
||||
},
|
||||
$content
|
||||
);
|
||||
|
||||
if (is_string($newContent) && $newContent !== $content) {
|
||||
file_put_contents($path, $newContent);
|
||||
$touchedFiles++;
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents($enPath, $dump($enMap));
|
||||
file_put_contents($zhPath, $dump($zhMap));
|
||||
|
||||
echo "touched_files={$touchedFiles}\n";
|
||||
echo "replaced={$replaced}\n";
|
||||
echo "added_translation_pairs={$added}\n";
|
||||
|
||||
215
server/scripts/replace_e_keys_using_git_diff.php
Normal file
215
server/scripts/replace_e_keys_using_git_diff.php
Normal file
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* 通过 git diff 恢复 E_XXXXXXXX 对应的原中文,并替换为英文短句:
|
||||
* - 在 server 下查找 "'E_XXXXXXXX'" 并替换为 "'<english phrase>'"
|
||||
* - 同时写入 resource/translations/api/{en,zh}.php:english=>english / english=>中文
|
||||
*
|
||||
* 英文短句来源优先级:
|
||||
* 1) resource/translations/api/en.php 与 zh.php 中的 MSG_ 对照(中文=>英文)
|
||||
* 2) 内置常用中文短语翻译表
|
||||
*/
|
||||
|
||||
$root = dirname(__DIR__);
|
||||
$repoRoot = dirname($root);
|
||||
|
||||
$enPath = $root . '/resource/translations/api/en.php';
|
||||
$zhPath = $root . '/resource/translations/api/zh.php';
|
||||
|
||||
$enMap = is_file($enPath) ? (require $enPath) : [];
|
||||
$zhMap = is_file($zhPath) ? (require $zhPath) : [];
|
||||
|
||||
/** @var array<string, string> $cnToEn 基于 MSG_ 的中文=>英文 */
|
||||
$cnToEn = [];
|
||||
foreach ($zhMap as $k => $cn) {
|
||||
if (!is_string($k) || !is_string($cn)) {
|
||||
continue;
|
||||
}
|
||||
if (strncmp($k, 'MSG_', 4) !== 0) {
|
||||
continue;
|
||||
}
|
||||
$en = $enMap[$k] ?? null;
|
||||
if (is_string($en) && $en !== '') {
|
||||
$cnToEn[$cn] = $en;
|
||||
}
|
||||
}
|
||||
|
||||
/** 常用中文短语翻译(兜底) */
|
||||
$fallbackCn = [
|
||||
'未查找到信息' => 'not found',
|
||||
'记录不存在' => 'record not found',
|
||||
'数据不存在' => 'data not found',
|
||||
'添加失败' => 'add failed',
|
||||
'修改失败' => 'update failed',
|
||||
'删除失败' => 'delete failed',
|
||||
'请选择要删除的数据' => 'please select data to delete',
|
||||
'参数错误,请检查' => 'invalid parameters, please check',
|
||||
'参数错误,请检查参数' => 'invalid parameters, please check',
|
||||
'操作失败' => 'operation failed',
|
||||
'执行失败' => 'execution failed',
|
||||
'请先登录' => 'please login first',
|
||||
'未登录' => 'not logged in',
|
||||
'下载失败' => 'download failed',
|
||||
'请求过于频繁,请稍后再试' => 'too many requests, please try again later',
|
||||
'验证码错误' => 'captcha error',
|
||||
'请选择要删除的缓存' => 'please select cache to delete',
|
||||
'请选择要删除的数据' => 'please select data to delete',
|
||||
'请选择要生成的表' => 'please select tables to generate',
|
||||
'发送失败,请查看日志' => 'send failed, please check logs',
|
||||
'请输入邮箱' => 'please input email',
|
||||
'版本ID不能为空' => 'version id is required',
|
||||
'上传文件校验失败' => 'upload file validation failed',
|
||||
'文件大小不能超过5M' => 'file size cannot exceed 5M',
|
||||
'文件格式上传失败,请选择zip格式文件上传' => 'upload failed, please upload zip file',
|
||||
'登录已过期或用户信息无效,请重新登录' => 'login expired or invalid, please login again',
|
||||
'超级管理员不允许重置密码' => 'super admin cannot reset password',
|
||||
'未找到上传文件' => 'uploaded file not found',
|
||||
'参数 items 必须为数组' => 'parameter items must be an array',
|
||||
'缺少参数 id' => 'missing parameter id',
|
||||
'缺少参数 status' => 'missing parameter status',
|
||||
'缺少 player_id' => 'missing player_id',
|
||||
'缺少参数:agent_id、secret、time、signature 不能为空' => 'missing parameters: agent_id, secret, time, signature are required',
|
||||
'无权限查看该记录' => 'no permission to view this record',
|
||||
'无权限修改该记录' => 'no permission to update this record',
|
||||
'无权限删除所选数据' => 'no permission to delete selected data',
|
||||
'无权限操作该玩家' => 'no permission to operate this player',
|
||||
'请选择玩家' => 'please select player',
|
||||
'操作类型必须为 3=加点 或 4=扣点' => 'operation type must be 3 (add) or 4 (deduct)',
|
||||
'请指定测试记录' => 'please specify test record',
|
||||
'请传入 record_id' => 'please provide record_id',
|
||||
'请传入 direction(0=顺时针 1=逆时针)' => 'please provide direction (0=clockwise, 1=counterclockwise)',
|
||||
'direction 必须为 0(顺时针)或 1(逆时针)' => 'direction must be 0 (clockwise) or 1 (counterclockwise)',
|
||||
'清空失败:' => 'clear failed: ',
|
||||
'管理后台已经安装!如需重新安装,请删除根目录env配置文件并重启' => 'admin already installed, to reinstall please delete env file and restart',
|
||||
'数据库用户名或密码错误' => 'database username or password is incorrect',
|
||||
'Connection refused. 请确认数据库IP端口是否正确,数据库已经启动' => 'connection refused, please check database ip/port and ensure database is running',
|
||||
'数据库连接超时,请确认数据库IP端口是否正确,安全组及防火墙已经放行端口' => 'database connection timeout, please check ip/port and firewall/security group rules',
|
||||
'数据库已经安装,请勿重复安装' => 'database already installed, please do not install again',
|
||||
'数据库SQL文件不存在' => 'database SQL file not found',
|
||||
];
|
||||
|
||||
$dump = static function (array $arr): string {
|
||||
ksort($arr);
|
||||
$out = "<?php\ndeclare(strict_types=1);\n\nreturn [\n";
|
||||
foreach ($arr as $k => $v) {
|
||||
$k = str_replace("'", "\\'", (string) $k);
|
||||
$v = str_replace("'", "\\'", (string) $v);
|
||||
$out .= " '{$k}' => '{$v}',\n";
|
||||
}
|
||||
$out .= "];\n";
|
||||
return $out;
|
||||
};
|
||||
|
||||
$diff = shell_exec('git -C ' . escapeshellarg($repoRoot) . ' diff -U0 -- server');
|
||||
if (!is_string($diff) || $diff === '') {
|
||||
echo "no diff\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/** @var array<string, string> $hexToCn */
|
||||
$hexToCn = [];
|
||||
$lines = preg_split("/\r\n|\n|\r/", $diff) ?: [];
|
||||
$prevCn = null;
|
||||
foreach ($lines as $line) {
|
||||
// - return $this->fail('未查找到信息');
|
||||
if (preg_match("/^\\-.*'([^']*?)'.*$/u", $line, $m) === 1) {
|
||||
$maybeCn = $m[1];
|
||||
if (preg_match('/[\x{4e00}-\x{9fff}]/u', $maybeCn) === 1) {
|
||||
$prevCn = $maybeCn;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// + return $this->fail('E_FC6490F8');
|
||||
if ($prevCn !== null && preg_match("/^\\+.*'E_([0-9A-Fa-f]{8})'.*$/", $line, $m) === 1) {
|
||||
$hexToCn[strtoupper($m[1])] = $prevCn;
|
||||
$prevCn = null;
|
||||
continue;
|
||||
}
|
||||
// reset when encountering unrelated added/removed line
|
||||
if (strlen($line) > 0 && ($line[0] === '+' || $line[0] === '-')) {
|
||||
$prevCn = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($hexToCn === []) {
|
||||
echo "no E_ mappings found in diff\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// 替换代码中的 E_XXXXXXXX
|
||||
$serverDir = $root;
|
||||
$files = [];
|
||||
$it = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($serverDir, FilesystemIterator::SKIP_DOTS)
|
||||
);
|
||||
foreach ($it as $file) {
|
||||
/** @var SplFileInfo $file */
|
||||
if (!$file->isFile()) {
|
||||
continue;
|
||||
}
|
||||
$path = $file->getPathname();
|
||||
if (substr($path, -4) !== '.php') {
|
||||
continue;
|
||||
}
|
||||
$norm = str_replace('\\', '/', $path);
|
||||
if (str_contains($norm, '/resource/translations/')) {
|
||||
continue;
|
||||
}
|
||||
if (str_contains($norm, '/scripts/')) {
|
||||
continue;
|
||||
}
|
||||
$files[] = $path;
|
||||
}
|
||||
|
||||
$touched = 0;
|
||||
$replaced = 0;
|
||||
$addedPairs = 0;
|
||||
|
||||
foreach ($files as $path) {
|
||||
$content = file_get_contents($path);
|
||||
if (!is_string($content) || $content === '') {
|
||||
continue;
|
||||
}
|
||||
$new = preg_replace_callback(
|
||||
"/(['\"])E_([0-9A-Fa-f]{8})\\1/",
|
||||
function (array $m) use (&$enMap, &$zhMap, &$replaced, &$addedPairs, $hexToCn, $cnToEn, $fallbackCn) {
|
||||
$hex = strtoupper($m[2]);
|
||||
$cn = $hexToCn[$hex] ?? null;
|
||||
if (!is_string($cn) || $cn === '') {
|
||||
return $m[0];
|
||||
}
|
||||
|
||||
$en = $cnToEn[$cn] ?? ($fallbackCn[$cn] ?? null);
|
||||
if (!is_string($en) || $en === '') {
|
||||
return $m[0];
|
||||
}
|
||||
|
||||
if (!isset($enMap[$en])) {
|
||||
$enMap[$en] = $en;
|
||||
$addedPairs++;
|
||||
}
|
||||
if (!isset($zhMap[$en])) {
|
||||
$zhMap[$en] = $cn;
|
||||
$addedPairs++;
|
||||
}
|
||||
|
||||
$replaced++;
|
||||
return "'" . str_replace("'", "\\'", $en) . "'";
|
||||
},
|
||||
$content
|
||||
);
|
||||
|
||||
if (is_string($new) && $new !== $content) {
|
||||
file_put_contents($path, $new);
|
||||
$touched++;
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents($enPath, $dump($enMap));
|
||||
file_put_contents($zhPath, $dump($zhMap));
|
||||
|
||||
echo "touched_files={$touched}\n";
|
||||
echo "replaced={$replaced}\n";
|
||||
echo "added_translation_pairs={$addedPairs}\n";
|
||||
|
||||
Reference in New Issue
Block a user