*/ class Api extends Model { use BaseModel; protected $schema = [ 'id' => 'int', 'api_module_id' => 'int', 'api_name' => 'varchar', 'method' => 'varchar', 'path' => 'varchar', 'token' => 'varchar', 'describe' => 'varchar', 'response' => 'text', 'create_time' => 'datetime', 'update_time' => 'datetime', 'delete_time' => 'int', ]; /** * 请求参数类型返回值处理 * @param bool $tag * @return array */ public static function getMethodSc($tag = true) { return $tag === true ? [ 'get' => Layui::tag()->orange('GET'), 'post' => Layui::tag()->red('POST'), ] : [ 'get' => 'GET', 'post' => 'POST', ]; } /** * 展示处理 * @param $value * @return string */ public function getMethodAttr($value) { $field = self::getMethodSc(); return $field[$value] ?? $value; } }