37 lines
880 B
PHP
37 lines
880 B
PHP
<?php
|
|
|
|
namespace app\adminapi\logic\match;
|
|
|
|
use app\common\logic\BaseLogic;
|
|
use app\common\model\league\League;
|
|
|
|
class LeagueLogic extends BaseLogic
|
|
{
|
|
public static function detail($params): array
|
|
{
|
|
return League::findOrEmpty($params['id'])->toArray();
|
|
}
|
|
|
|
public static function edit(array $params): bool
|
|
{
|
|
try {
|
|
League::update([
|
|
'id' => $params['id'],
|
|
'label' => $params['label'],
|
|
'icon' => $params['icon'] ?? '',
|
|
'sort' => $params['sort'] ?? 0,
|
|
'is_show' => $params['is_show'] ?? 1,
|
|
]);
|
|
return true;
|
|
} catch (\Exception $e) {
|
|
self::setError($e->getMessage());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static function delete(array $params)
|
|
{
|
|
League::destroy($params['id']);
|
|
}
|
|
}
|