feat: 系统商城店铺入口
All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 2s
All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 2s
This commit is contained in:
61
app/admin/model/v1/SysMallStoreEntranceModel.php
Normal file
61
app/admin/model/v1/SysMallStoreEntranceModel.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model\v1;
|
||||
|
||||
use app\common\model\SysMallStoreEntranceBaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* 系统商城店铺入口模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class SysMallStoreEntranceModel extends SysMallStoreEntranceBaseModel
|
||||
{
|
||||
// 启用软删除
|
||||
use SoftDelete;
|
||||
// 软删除字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
|
||||
// 关联语言
|
||||
public function language()
|
||||
{
|
||||
return $this->belongsTo(\app\index\model\LanguageModel::class, 'language_id', 'id');
|
||||
}
|
||||
|
||||
// 所属语言范围查询
|
||||
public function scopeLanguage($query, $language)
|
||||
{
|
||||
$query->where($this->getTable() . '.language_id', '=', $language);
|
||||
}
|
||||
|
||||
// 查询启用状态
|
||||
public function scopeEnabled($query)
|
||||
{
|
||||
$query->where('disabled', '=', 0);
|
||||
}
|
||||
|
||||
// 查询禁用状态
|
||||
public function scopeDisabled($query)
|
||||
{
|
||||
$query->where('disabled', '=', 1);
|
||||
}
|
||||
|
||||
// 按名称搜索
|
||||
public function searchNameAttr($query, $value, $data)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return;
|
||||
}
|
||||
$query->where('name', 'like', "%{$value}%");
|
||||
}
|
||||
|
||||
// 按链接地址搜索
|
||||
public function searchLinkAttr($query, $value, $data)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return;
|
||||
}
|
||||
$query->where('link_url', 'like', "%{$value}%");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user