[色子游戏]奖池配置

This commit is contained in:
2026-03-03 13:47:25 +08:00
parent 1e8ea9c886
commit ea9f17d43b
7 changed files with 148 additions and 43 deletions

View File

@@ -6,7 +6,7 @@
// +----------------------------------------------------------------------
namespace app\dice\logic\lottery_config;
use plugin\saiadmin\basic\eloquent\BaseLogic;
use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\utils\Helper;
use app\dice\model\lottery_config\DiceLotteryConfig;

View File

@@ -6,7 +6,7 @@
// +----------------------------------------------------------------------
namespace app\dice\model\lottery_config;
use plugin\saiadmin\basic\eloquent\BaseModel;
use plugin\saiadmin\basic\think\BaseModel;
/**
* 色子奖池配置模型
@@ -15,10 +15,16 @@ use plugin\saiadmin\basic\eloquent\BaseModel;
*
* @property $id ID
* @property $name 名称
* @property $weight 权重
* @property $remark 备注
* @property $type 奖池类型
* @property $safety_line 安全线
* @property $create_time 创建时间
* @property $update_time 修改时间
* @property $t1_wight T1池权重
* @property $t2_wight T2池权重
* @property $t3_wight T3池权重
* @property $t4_wight T4池权重
* @property $t5_wight T5池权重
*/
class DiceLotteryConfig extends BaseModel
{
@@ -26,7 +32,7 @@ class DiceLotteryConfig extends BaseModel
* 数据表主键
* @var string
*/
protected $primaryKey = 'id';
protected $pk = 'id';
/**
* 数据库表名称
@@ -34,14 +40,6 @@ class DiceLotteryConfig extends BaseModel
*/
protected $table = 'dice_lottery_config';
/**
* 属性转换
*/
protected function casts(): array
{
return array_merge(parent::casts(), [
]);
}
/**
* 名称 搜索
*/

View File

@@ -18,9 +18,12 @@ class DiceLotteryConfigValidate extends BaseValidate
*/
protected $rule = [
'name' => 'require',
'weight' => 'require',
'remark' => 'require',
'type' => 'require',
't1_wight' => 'require',
't2_wight' => 'require',
't3_wight' => 'require',
't4_wight' => 'require',
't5_wight' => 'require',
];
/**
@@ -28,9 +31,12 @@ class DiceLotteryConfigValidate extends BaseValidate
*/
protected $message = [
'name' => '名称必须填写',
'weight' => '权重必须填写',
'remark' => '备注必须填写',
'type' => '奖池类型必须填写',
't1_wight' => 'T1池权重必须填写',
't2_wight' => 'T2池权重必须填写',
't3_wight' => 'T3池权重必须填写',
't4_wight' => 'T4池权重必须填写',
't5_wight' => 'T5池权重必须填写',
];
/**
@@ -39,15 +45,21 @@ class DiceLotteryConfigValidate extends BaseValidate
protected $scene = [
'save' => [
'name',
'weight',
'remark',
'type',
't1_wight',
't2_wight',
't3_wight',
't4_wight',
't5_wight',
],
'update' => [
'name',
'weight',
'remark',
'type',
't1_wight',
't2_wight',
't3_wight',
't4_wight',
't5_wight',
],
];

View File

@@ -2,3 +2,15 @@
/**
* Here is your custom functions.
*/
/**
* mb_split 兼容:当 PHP 未启用 mbstring 或 mb_split 不可用时,用 preg_split 模拟
* 解决 Illuminate\Support\Str::studly() 在 Windows 等环境下报 Call to undefined function mb_split() 的问题
*/
if (!function_exists('mb_split')) {
function mb_split(string $pattern, string $string, int $limit = -1): array
{
$regex = '/' . str_replace('/', '\\/', $pattern) . '/u';
return preg_split($regex, $string, $limit === -1 ? -1 : $limit) ?: [];
}
}