|
|
@@ -93,14 +93,13 @@ class User extends Backend
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 编辑
|
|
|
- *
|
|
|
+ * 茶宝调整
|
|
|
* @param $ids
|
|
|
* @return string
|
|
|
* @throws DbException
|
|
|
* @throws \think\Exception
|
|
|
*/
|
|
|
- public function edit($ids = null)
|
|
|
+ public function approve($ids = null)
|
|
|
{
|
|
|
$ids = intval($ids);
|
|
|
$row = $this->model->get($ids);
|
|
|
@@ -113,14 +112,12 @@ class User extends Backend
|
|
|
}
|
|
|
if (false === $this->request->isPost()) {
|
|
|
$wallet = (new LedgerWalletModel())->get($ids);
|
|
|
- $row['power'] = $wallet['power'] ?? "-";
|
|
|
-
|
|
|
- $google=new GoogleAuthenticator();
|
|
|
+ $row['token'] = $wallet['token'] ?? "-";
|
|
|
+ //$google=new GoogleAuthenticator();
|
|
|
//生成验证秘钥
|
|
|
//$secret=$google->createSecret();
|
|
|
- $qrCodeUrl = $google->getQRCodeGoogleUrl('RWACHA', config('google_secret'));
|
|
|
+ //$qrCodeUrl = $google->getQRCodeGoogleUrl('RWACHA', config('google_secret'));
|
|
|
$this->view->assign('row', $row);
|
|
|
- $this->view->assign('qrCodeUrl', $qrCodeUrl);
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
$params = $this->request->post('row/a');
|
|
|
@@ -128,10 +125,6 @@ class User extends Backend
|
|
|
$this->error(__('Parameter %s can not be empty', ''));
|
|
|
}
|
|
|
$params = $this->preExcludeFields($params);
|
|
|
- $newLevelId = $params['team_level_id'];
|
|
|
- if($newLevelId > 0 && empty((new TeamLevelModel())->getTeamLevelName($newLevelId))){
|
|
|
- $this->error('会员等级错误');
|
|
|
- }
|
|
|
$google=new GoogleAuthenticator();
|
|
|
$checkResult = $google->verifyCode(config('google_secret'), $params['code'], 6);
|
|
|
if (!$checkResult) $this->error('谷歌验证码错误');
|
|
|
@@ -140,13 +133,6 @@ class User extends Backend
|
|
|
// 启动事务
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
- // 更新会员等级
|
|
|
- if ($newLevelId != $row['team_level_id']) {
|
|
|
- $updated = (new UserModel())->save(['team_level_id' => $newLevelId], ['id' => $row['id']]);
|
|
|
- if (empty($updated)) {
|
|
|
- throw new Exception('更新会员等级影响行数为0');
|
|
|
- }
|
|
|
- }
|
|
|
// 更新茶宝
|
|
|
if (bccomp($newPower, 0, 6) !== 0) {
|
|
|
(new LedgerWalletModel)->changeWalletAccount($ids, Asset::TOKEN, $newPower, LedgerWalletModel::System);
|