AdminOauthController.php
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Powerless < wzxaini9@gmail.com>
// +----------------------------------------------------------------------
namespace app\user\controller;
use cmf\controller\AdminBaseController;
use think\Db;
class AdminOauthController extends AdminBaseController
{
/**
* 后台第三方用户列表
* @adminMenu(
* 'name' => '第三方用户',
* 'parent' => 'user/AdminIndex/default1',
* 'display'=> true,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '第三方用户',
* 'param' => ''
* )
*/
public function index()
{
$oauthUserQuery = Db::name('third_party_user');
$lists = $oauthUserQuery->field('a.*,u.user_nickname,u.sex,u.avatar')->alias('a')->join('__USER__ u','a.user_id = u.id')->where("status", 1)->order("create_time DESC")->paginate(10);
// 获取分页显示
$page = $lists->render();
$this->assign('lists', $lists);
$this->assign('page', $page);
// 渲染模板输出
return $this->fetch();
}
/**
* 后台删除第三方用户绑定
* @adminMenu(
* 'name' => '删除第三方用户绑定',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '删除第三方用户绑定',
* 'param' => ''
* )
*/
public function delete()
{
$id = input('param.id', 0, 'intval');
if (empty($id)) {
$this->error('非法数据!');
}
$result = Db::name("OauthUser")->where("id", $id)->delete();
if ($result !== false) {
$this->success("删除成功!", "admin_oauth/index");
} else {
$this->error('删除失败!');
}
}
}