1.优化开奖逻辑

2.优化后台开奖派彩
3.优化接口规范
This commit is contained in:
2026-04-17 13:56:13 +08:00
parent 3cf386756b
commit bf3d50a309
50 changed files with 1036 additions and 770 deletions

View File

@@ -29,14 +29,4 @@ class Channel extends Model
{
return is_null($value) ? null : (float)$value;
}
public function adminGroup(): \think\model\relation\BelongsTo
{
return $this->belongsTo(\app\admin\model\AdminGroup::class, 'admin_group_id', 'id');
}
public function admin(): \think\model\relation\BelongsTo
{
return $this->belongsTo(\app\admin\model\Admin::class, 'admin_id', 'id');
}
}

View File

@@ -11,13 +11,15 @@ class GameRecord extends Model
protected $autoWriteTimestamp = true;
protected $type = [
'create_time' => 'integer',
'update_time' => 'integer',
'period_start_at' => 'integer',
'status' => 'integer',
'draw_mode' => 'integer',
'preset_number' => 'integer',
'result_number' => 'integer',
'create_time' => 'integer',
'update_time' => 'integer',
'period_start_at' => 'integer',
'status' => 'integer',
'draw_mode' => 'integer',
'preset_number' => 'integer',
'result_number' => 'integer',
'platform_profit_amount' => 'string',
'winner_user_count' => 'integer',
];
public function setPeriodStartAtAttr($value, $data = [])

View File

@@ -13,6 +13,30 @@ class User extends Model
protected $autoWriteTimestamp = true;
/**
* 生成 10 位唯一对外标识(大写字母与数字,排除易混淆字符)
*/
public static function generateUniquePublicCode10(): string
{
$chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
$len = strlen($chars);
for ($attempt = 0; $attempt < 80; $attempt++) {
$code = '';
for ($i = 0; $i < 10; $i++) {
$code .= $chars[random_int(0, $len - 1)];
}
if (!self::where('uuid', $code)->find()) {
return $code;
}
}
throw new \RuntimeException('Failed to generate unique user uuid');
}
public static function formatLoginRemark(int $timestamp, string $ip): string
{
return '最后登录:' . date('Y-m-d H:i:s', $timestamp) . ' IP:' . $ip;
}
protected $type = [
'create_time' => 'integer',
'update_time' => 'integer',