捕梦者基础框架API接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

66 lines
1.3 KiB

<?php
declare (strict_types=1);
namespace app\api\model;
use app\Request;
use think\Model;
/**
* @mixin think\Model
*/
class Block extends Common
{
protected $table = 'cloud_block';
/**
* 管理员列表数据模型
* @return array|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function index()
{
$name = $this->request->param('name', '');
$_op = $this->where('site_id', SITE_ID); //没有默认where查询 这个一定要 否则获取不到下面的getOptions查询条件值
if ($name) {
$_op->whereLike('name', "%{$name}%");
}
$_op->order('sort DESC,create_time DESC');
return parent::parentLists($_op);
}
/**
* 读取后
* @param Model $model
* @return bool|void
*/
public static function onAfterRead(Model $model)
{
}
/**
* 新增前
* @param Model $model
* @return mixed|void
*/
public static function onBeforeInsert(Model $model)
{
//code
}
/**
* 新增或修改前
* @param Model $model
* @return mixed|void
*/
public static function onBeforeWrite(Model $model)
{
}
}