3
This commit is contained in:
@@ -98,7 +98,7 @@ class AccountController extends Crud
|
||||
// return $this->fail('账户不存在或密码错误');
|
||||
// }
|
||||
//$secret = $admin['totp_secret'] ?:'EJGYB7OZR2W46XRX7VB3PXHSOY4LUAWCA5GTDAVTWKHXNDAAAIIP7AQ3JSO3XZJNX5J5OTIDEQVKLYFYIYNAXSCYF4GNZ2EMA4ORA3Y';
|
||||
\support\Log::alert($admin['totp_secret']);
|
||||
//\support\Log::alert($admin['totp_secret']);
|
||||
$totp = \OTPHP\TOTP::create($admin->totp_secret);
|
||||
//$secret = $totp->getSecret();
|
||||
//$totp->setLabel('cansnow');
|
||||
|
||||
@@ -143,9 +143,9 @@ class ConfigController extends Base
|
||||
$post = $request->post('row');
|
||||
Db::startTrans();
|
||||
try {
|
||||
if($post['type'] == 'selects'){
|
||||
$post['value'] = implode(',',$post['value']);
|
||||
}
|
||||
// if($post['type'] == 'selects'){
|
||||
// $post['value'] = implode(',',$post['value']);
|
||||
// }
|
||||
$user = ConfigModel::create($post);
|
||||
Db::commit();
|
||||
$this->buildcache();
|
||||
@@ -165,7 +165,7 @@ class ConfigController extends Base
|
||||
$v['value'] = json_decode($v['value'], true);
|
||||
}
|
||||
if(in_array($v['type'] ,['selects']) && !is_array($v['value'])){
|
||||
$v['value'] = explode(',',$v['value']);
|
||||
$v['value'] = explode(',',$v['value']??'');
|
||||
}
|
||||
$list[$v['name']] = $v['value'];
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ class IndexController extends Base
|
||||
//$day7_user_recharge_sum = Recharge::where('status',2)->whereTime('created_at', '-7 days')->sum('amount');
|
||||
// 总用户数
|
||||
$user_count = \app\model\User::where('status',1)->count('id');
|
||||
$recharge_total = \app\model\Recharge::where('status',\app\enum\RechargeStatus::COMPLETE->value)->sum('amount');
|
||||
$recharge_total = 0;//\app\model\Recharge::where('status',\app\enum\RechargeStatus::COMPLETE->value)->sum('amount');
|
||||
// mysql版本
|
||||
$withdrawl_total = \app\model\Withdrawl::where('status',\app\enum\WithdrawlStatus::COMPLETE->value)->sum('recive_amount');
|
||||
// mysql版本
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
|
||||
use plugin\admin\app\controller\Base;
|
||||
use plugin\admin\app\controller\Crud;
|
||||
use plugin\admin\app\model\User as UserModel;
|
||||
use support\exception\BusinessException;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* OpenIM管理
|
||||
*/
|
||||
class OpenimController extends Crud
|
||||
{
|
||||
|
||||
/**
|
||||
* @var UserModel
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @return void
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->model = new UserModel();
|
||||
$groupList = [
|
||||
['value'=>0,'label'=>"普通用户"],
|
||||
['value'=>1,'label'=>"内部用户"],
|
||||
['value'=>2,'label'=>"联盟商"],
|
||||
];
|
||||
$roleList = \app\model\UserRole::order('id','desc')->column('name as label,id as value');
|
||||
$this->assign('groupList',$groupList);
|
||||
$this->assignconfig('groupList',$groupList);
|
||||
$this->assign('roleList',$roleList);
|
||||
$this->assignconfig('roleList',$roleList);
|
||||
}
|
||||
public function team(Request $request): Response
|
||||
{
|
||||
return view();
|
||||
}
|
||||
// public function select(Request $request): Response
|
||||
// {
|
||||
// $this->model = $this->model->with(['referrer','role']);
|
||||
// return parent::select($request);
|
||||
// }
|
||||
/**
|
||||
* 浏览
|
||||
* @return Response
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
return view('user/index');
|
||||
}
|
||||
public function select(Request $request): Response{
|
||||
$res = $request->IM->user->getUsers(1,20);
|
||||
//cp($request->IM->user->getAllUsersUid());
|
||||
if($res['errCode']!==0){
|
||||
return $this->fail($res['errDlt']);
|
||||
}
|
||||
return json([
|
||||
'code' => 0,
|
||||
"msg" => "ok",
|
||||
'count' => $res['data']['total'],
|
||||
'data' =>$res['data']['users'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws BusinessException|Throwable
|
||||
*/
|
||||
public function insert(Request $request): Response
|
||||
{
|
||||
if ($request->method() === 'POST') {
|
||||
return parent::insert($request);
|
||||
}
|
||||
return view('user/update',[
|
||||
'row' => UserModel::findOrEmpty(0)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws BusinessException|Throwable
|
||||
*/
|
||||
public function update(Request $request): Response
|
||||
{
|
||||
if ($request->method() === 'POST') {
|
||||
[$id, $data] = $this->updateInput($request);
|
||||
$this->doUpdate($id, $data);
|
||||
$ret = $this->success('操作成功');
|
||||
return $ret;
|
||||
}
|
||||
$ids = Request()->get('ids');
|
||||
$user = $this->model->where('id',$ids)->find();
|
||||
return view('user/update',[
|
||||
'row' => $user
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,7 @@ class UserController extends Crud
|
||||
{
|
||||
if ($request->method() === 'POST') {
|
||||
return parent::insert($request);
|
||||
|
||||
}
|
||||
return view('user/update',[
|
||||
'row' => UserModel::findOrEmpty(0)
|
||||
|
||||
Reference in New Issue
Block a user