样机小程序
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\service;
|
||||
|
||||
use app\common\model\BannerModule;
|
||||
use app\common\validate\BannerValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\Banner;
|
||||
|
||||
class BannerService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = Banner::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = BannerValidate::class;
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
public function getBanner($params){
|
||||
$where = [];
|
||||
if(isset($params['module'])){
|
||||
$where['module'] = $params['module'];
|
||||
}
|
||||
return Banner::where('status','1')->where($where)->get();
|
||||
}
|
||||
|
||||
public function getBannerModule(){
|
||||
return BannerModule::where('status','1')->get();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user