Usermanage.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /**
  3. *
  4. * User: anyluck
  5. * Date: 2020/6/2
  6. * Time: 17:31
  7. */
  8. namespace app\admin\controller;
  9. use app\common\controller\Backend;
  10. use app\common\model\UserLevel;
  11. use think\facade\Db;
  12. use think\facade\Request;
  13. use think\facade\View;
  14. class Usermanage extends Backend
  15. {
  16. // 用户管理
  17. // 用户列表
  18. public function index()
  19. {
  20. if (Request::isPost()) {
  21. $keys = Request::post('keys', '', 'trim');
  22. $page = Request::post('page') ? Request::post('page') : 1;
  23. $limit=input("limit")?:10;
  24. $list = Db::name('user')
  25. ->where('mail|phone|name','like',"%".$keys."%")
  26. ->order('id desc')
  27. ->paginate(['list_rows' =>$limit, 'page' => $page])
  28. ->toArray();
  29. foreach ($list['data'] as $k=>$v){
  30. if ($v['update_time']){
  31. $list['data'][$k]['update_time'] = date('Y-m-d H:i',$v['update_time']);
  32. }
  33. }
  34. return $result = ['code' => 0, 'msg' => lang('get info success'), 'data' => $list['data'], 'count' => $list['total']];
  35. }
  36. $vip=UserLevel::select();
  37. View::assign("vip",$vip);
  38. return View::fetch();
  39. }
  40. // 设置等级
  41. public function update_leve()
  42. {
  43. $id=input("id");
  44. $level=input("level");
  45. \app\common\model\User::update(["vip_level"=>$level],["id"=>$id]);
  46. json_result(200,"设置成功");
  47. }
  48. // 用户详细信息
  49. public function show()
  50. {
  51. }
  52. // 密码重置
  53. public function update_pwd()
  54. {
  55. }
  56. // 封号
  57. public function fenhao()
  58. {
  59. $id=input("id");
  60. $user=\app\common\model\User::where(["id"=>$id])->field("status")->find();
  61. if ($user->status==1){
  62. $update["status"]=0;
  63. }else{
  64. $update["status"]=1;
  65. }
  66. \app\common\model\User::update($update,["id"=>$id]);
  67. json_result(200,"操作成功");
  68. }
  69. //用户充值
  70. public function chongzhi()
  71. {
  72. }
  73. // 用户通证记录
  74. public function tongxingzheng()
  75. {
  76. }
  77. //设置会员等级
  78. public function update_level()
  79. {
  80. }
  81. }