refactor: 修改语言接口

This commit is contained in:
2025-02-13 15:39:55 +08:00
parent 7bfb0cca1e
commit 8582d93678
3 changed files with 2 additions and 10 deletions

View File

@@ -32,7 +32,7 @@ class Language
public function cutover() public function cutover()
{ {
$id = request()->param('id'); $id = request()->param('id');
$language = LanguageModel::id($id)->find(); $language = LanguageModel::bypk($id)->find();
if (is_null($language)) { if (is_null($language)) {
return error('语言不存在'); return error('语言不存在');
} }

View File

@@ -15,10 +15,4 @@ class LanguageModel extends LanguageBaseModel
{ {
return $this->belongsTo(CountryModel::class, 'country_id', 'id'); return $this->belongsTo(CountryModel::class, 'country_id', 'id');
} }
// 根据id查询
public function scopeId($query, $value)
{
$query->where('id', '=', $value);
}
} }

View File

@@ -3,12 +3,10 @@ declare (strict_types = 1);
namespace app\common\model; namespace app\common\model;
use think\Model;
/** /**
* @mixin \think\Model * @mixin \think\Model
*/ */
class LanguageBaseModel extends Model class LanguageBaseModel extends BaseModel
{ {
// 表名 // 表名
protected $name = 'sys_language'; protected $name = 'sys_language';