后台内容模块功能完善

This commit is contained in:
2020-03-31 16:17:45 +08:00
parent de73484cca
commit 85d33da0d4
24 changed files with 386 additions and 251 deletions

View File

@@ -40,13 +40,13 @@ class Client extends Base {
$result = ClientM::create($data);
if (false !== $result) {
return $this->success('成功添加', url('client/index'));
return $this->success('成功添加', url('/admin/client/index'));
} else {
return $this->error('添加失败!');
}
} else {
$info['appid'] = rand_string(10, 1); //八位数字appid
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
$info['appid'] = time(); //八位数字appid
$info['appsecret'] = \xin\helper\Str::random(32); //32位数字加字母秘钥
$this->data = array(
'info' => $info,
@@ -64,12 +64,12 @@ class Client extends Base {
$result = ClientM::update($data, ['id' => $this->request->param('id')]);
if (false !== $result) {
return $this->success('修改添加', url('client/index'));
return $this->success('修改添加', url('/admin/client/index'));
} else {
return $this->error($this->model->getError());
}
} else {
$info = $ClientM::where('id', $request->param('id'))->find();
$info = ClientM::where('id', $this->request->param('id'))->find();
$this->data = array(
'info' => $info,
@@ -81,7 +81,24 @@ class Client extends Base {
/**
* @title 删除客户端
*/
public function del(\think\Request $request) {
public function del() {
$id = $this->request->param('id', '');
$map = [];
if (!$id) {
return $this->error('请选择要操作的数据!');
}
if (is_array($id)) {
$map[] = ['id', 'IN', $id];
}else{
$map[] = ['id', '=', $id];
}
$result = ClientM::where($map)->delete();
if (false !== $result) {
return $this->success('删除成功');
} else {
return $this->error('删除失败!');
}
}
}