123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- /**
- *
- * User: anyluck
- * Date: 2020/6/2
- * Time: 17:31
- */
- namespace app\admin\controller;
- use app\common\controller\Backend;
- use app\common\model\UserLevel;
- use think\facade\Db;
- use think\facade\Request;
- use think\facade\View;
- class Usermanage extends Backend
- {
- // 用户管理
- // 用户列表
- public function index()
- {
- if (Request::isPost()) {
- $keys = Request::post('keys', '', 'trim');
- $page = Request::post('page') ? Request::post('page') : 1;
- $limit=input("limit")?:10;
- $list = Db::name('user')
- ->where('mail|phone|name','like',"%".$keys."%")
- ->order('id desc')
- ->paginate(['list_rows' =>$limit, 'page' => $page])
- ->toArray();
- foreach ($list['data'] as $k=>$v){
- if ($v['update_time']){
- $list['data'][$k]['update_time'] = date('Y-m-d H:i',$v['update_time']);
- }
- }
- return $result = ['code' => 0, 'msg' => lang('get info success'), 'data' => $list['data'], 'count' => $list['total']];
- }
- $vip=UserLevel::select();
- View::assign("vip",$vip);
- return View::fetch();
- }
- // 设置等级
- public function update_leve()
- {
- $id=input("id");
- $level=input("level");
- \app\common\model\User::update(["vip_level"=>$level],["id"=>$id]);
- json_result(200,"设置成功");
- }
- // 用户详细信息
- public function show()
- {
- }
- // 密码重置
- public function update_pwd()
- {
- }
- // 封号
- public function fenhao()
- {
- $id=input("id");
- $user=\app\common\model\User::where(["id"=>$id])->field("status")->find();
- if ($user->status==1){
- $update["status"]=0;
- }else{
- $update["status"]=1;
- }
- \app\common\model\User::update($update,["id"=>$id]);
- json_result(200,"操作成功");
- }
- //用户充值
- public function chongzhi()
- {
-
- }
- // 用户通证记录
- public function tongxingzheng()
- {
- }
- //设置会员等级
- public function update_level()
- {
-
- }
- }
|