Files
tuiguangzhushou/application/common/service/Permission.php
2020-08-06 15:26:41 +08:00

58 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +------------------------------------------------+
// |http://www.cjango.com |
// +------------------------------------------------+
// | 修复BUG不是一朝一夕的事情等我喝醉了再说吧 |
// +------------------------------------------------+
// | Author: 小陈叔叔 <Jason.Chen> |
// +------------------------------------------------+
namespace app\common\service;
use app\common\model\Permission as PermissionModel;
use app\common\validate\Permission as PermissionValidate;
class Permission extends _Init
{
public static function create($data)
{
$validate = new PermissionValidate();
if (!$validate->check($data)) {
return $validate->getError();
}
if (PermissionModel::create($data)) {
return true;
} else {
return '创建数据失败';
}
}
public static function update($data)
{
$validate = new PermissionValidate();
if (!$validate->check($data)) {
return $validate->getError();
}
if (PermissionModel::update($data)) {
return true;
} else {
return '修改数据失败';
}
}
public static function delete($id)
{
$info = PermissionModel::get($id);
if (!$info) {
return '数据不存在';
} elseif (PermissionModel::destroy($id)) {
return true;
} else {
return '系统繁忙';
}
}
}