first commit
This commit is contained in:
60
application/common/service/MemberList.php
Normal file
60
application/common/service/MemberList.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
// +------------------------------------------------+
|
||||
// |http://www.cjango.com |
|
||||
// +------------------------------------------------+
|
||||
// | 修复BUG不是一朝一夕的事情,等我喝醉了再说吧! |
|
||||
// +------------------------------------------------+
|
||||
// | Author: 小陈叔叔 <Jason.Chen> |
|
||||
// +------------------------------------------------+
|
||||
namespace app\common\service;
|
||||
|
||||
use app\common\model\MemberList as MemberListModel;
|
||||
use app\common\validate\MemberList as MemberListValidate;
|
||||
|
||||
class MemberList extends _Init
|
||||
{
|
||||
/**
|
||||
* 添加信息
|
||||
* @param [type] $data 文章数据
|
||||
*/
|
||||
public static function create($data, $uid)
|
||||
{
|
||||
$validate = new MemberListValidate();
|
||||
if (!$validate->scene('add')->check($data)) {
|
||||
return $validate->getError();
|
||||
}
|
||||
$info = MemberListModel::create($data);
|
||||
if ($info) {
|
||||
return true;
|
||||
} else {
|
||||
return '创建报单失败';
|
||||
}
|
||||
}
|
||||
|
||||
public static function edit($data)
|
||||
{
|
||||
$validate = new MemberListValidate();
|
||||
if (!$validate->scene('add')->check($data)) {
|
||||
return $validate->getError();
|
||||
}
|
||||
$info = MemberListModel::update($data);
|
||||
if ($info) {
|
||||
return true;
|
||||
} else {
|
||||
return '编辑失败';
|
||||
}
|
||||
}
|
||||
|
||||
public static function del($id)
|
||||
{
|
||||
$info = MemberListModel::get($id);
|
||||
if (!$info) {
|
||||
return '此人不存在';
|
||||
} elseif ($info->save(['status' => '-1'])) {
|
||||
return true;
|
||||
} else {
|
||||
return '删除失败';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user