<?php
|
|
namespace app\admin\controller;
|
|
use app\admin\model\Client as ClientModel;
|
|
class Client extends Controller
|
{
|
/**
|
* 小程序列表
|
*/
|
public function index()
|
{
|
$model = new ClientModel;
|
$list = $list = $model->getList($this->postData());
|
return $this->renderSuccess('', compact('list'));
|
}
|
/**
|
* 添加应用
|
*/
|
public function add()
|
{
|
$model = new ClientModel;
|
// 新增记录
|
if ($model->add($this->postData())) {
|
return $this->renderSuccess('添加成功');
|
}
|
return $this->renderError($model->getError() ?: '添加失败');
|
}
|
|
/**
|
* 添加应用
|
*/
|
public function edit($client_id)
|
{
|
$model = ClientModel::detail($client_id);
|
// 新增记录
|
if ($model->edit($this->postData())) {
|
return $this->renderSuccess('修改成功');
|
}
|
return $this->renderError($model->getError() ?: '修改失败');
|
}
|
|
/**
|
* 删除小程序
|
*/
|
public function delete($client_id)
|
{
|
// 小程序详情
|
$model = ClientModel::detail($client_id);
|
if (!$model->setDelete()) {
|
return $this->renderError('操作失败');
|
}
|
return $this->renderSuccess('操作成功');
|
}
|
|
/*
|
*启用禁用
|
*/
|
public function updateStatus($client_id)
|
{
|
$model = ClientModel::detail($client_id);
|
if (!$model->updateStatus()) {
|
return $this->renderError('操作失败');
|
}
|
return $this->renderSuccess('操作成功');
|
}
|
}
|