feat : site

This commit is contained in:
2024-11-12 15:40:33 +08:00
parent 82dd7450af
commit 900d98234b
7 changed files with 169 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Model;
use App\Constants\Common\SiteCode;
use Hyperf\Database\Model\Builder;
use Hyperf\DbConnection\Model\Model;
/**
@@ -62,4 +63,22 @@ class Site extends Model
->where('is_del',SiteCode::SITE_NO_DEL)
->update(['status' => SiteCode::SITE_DISABLE]);
}
/**
* @param string $name
* @return Builder|\Hyperf\Database\Model\Model|null
*/
public function getInfoByName(string $name): \Hyperf\Database\Model\Model|Builder|null
{
return $this->where('name',$name)->where('is_del',SiteCode::SITE_NO_DEL)->first();
}
/**
* @param int $id
* @return \Hyperf\Database\Model\Model|Builder|null
*/
public function getInfoById(int $id): \Hyperf\Database\Model\Model|Builder|null
{
return $this->where('id',$id)->where('is_del',SiteCode::SITE_NO_DEL)->first();
}
}