78 lines
2.1 KiB
PHP
78 lines
2.1 KiB
PHP
<?php
|
||
// +------------------------------------------------+
|
||
// |http://www.cjango.com |
|
||
// +------------------------------------------------+
|
||
// | 修复BUG不是一朝一夕的事情,等我喝醉了再说吧! |
|
||
// +------------------------------------------------+
|
||
// | Author: 小陈叔叔 <Jason.Chen> |
|
||
// +------------------------------------------------+
|
||
namespace app\mobile\controller;
|
||
|
||
use app\common\model\MemberList as MemberListModel;
|
||
use app\common\service\MemberList as MemberListService;
|
||
|
||
class Member extends _Init
|
||
{
|
||
|
||
public function _initialize()
|
||
{
|
||
parent::_initialize();
|
||
$this->nav = 5;
|
||
}
|
||
|
||
public function index()
|
||
{
|
||
$this->list = MemberListModel::where('uid', UID)->where('status', 'egt', 0)->select();
|
||
return $this->fetch('');
|
||
}
|
||
|
||
public function add()
|
||
{
|
||
if (IS_POST) {
|
||
$data = $this->request->post();
|
||
$res = MemberListService::create($data, UID);
|
||
if ($res === true) {
|
||
$this->success('添加成功', url('member/index'));
|
||
} else {
|
||
$this->error($res);
|
||
}
|
||
} else {
|
||
$this->showfoot = '1';
|
||
return $this->fetch('');
|
||
}
|
||
|
||
}
|
||
public function edit($id)
|
||
{
|
||
if (IS_POST) {
|
||
$data = $this->request->post();
|
||
$res = MemberListService::edit($data);
|
||
if ($res === true) {
|
||
$this->success('编辑成功', url('member/index'));
|
||
} else {
|
||
$this->error($res);
|
||
}
|
||
} else {
|
||
$this->info = MemberListModel::get($id);
|
||
return $this->fetch('add');
|
||
}
|
||
}
|
||
|
||
public function del($id)
|
||
{
|
||
$res = MemberListService::del($id);
|
||
$this->back($res);
|
||
// if ($res === true) {
|
||
// $this->success('删除成功', url('member/index'));
|
||
// } else {
|
||
// $this->error($res);
|
||
// }
|
||
}
|
||
|
||
public function info($id)
|
||
{
|
||
$this->info = MemberListModel::get($id);
|
||
return $this->fetch();
|
||
}
|
||
}
|