|
@@ -3,6 +3,7 @@
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
use app\common\controller\Backend;
|
|
|
+use think\Exception;
|
|
|
|
|
|
/**
|
|
|
* 会员权限管理
|
|
@@ -148,9 +149,13 @@ class UserPower extends Backend
|
|
|
}
|
|
|
if (isset($params['private_messages_time']) && !empty($params['private_messages_time'])) {
|
|
|
$params['private_messages_time'] = strtotime($params['private_messages_time']);
|
|
|
+ } else {
|
|
|
+ $params['private_messages_time'] = 0;
|
|
|
}
|
|
|
if (isset($params['speak_time']) && !empty($params['speak_time'])) {
|
|
|
$params['speak_time'] = strtotime($params['speak_time']);
|
|
|
+ } else {
|
|
|
+ $params['speak_time'] = 0;
|
|
|
}
|
|
|
$result = $row->allowField(true)->save($params);
|
|
|
} catch (ValidateException|PDOException|Exception $e) {
|
|
@@ -159,9 +164,85 @@ class UserPower extends Backend
|
|
|
if ($result == false) {
|
|
|
$this->error(__('No rows were updated'));
|
|
|
}
|
|
|
- $this->success();
|
|
|
+ $this->success('操作成功');
|
|
|
}
|
|
|
$this->view->assign("row", $row);
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 一键禁用
|
|
|
+ */
|
|
|
+ public function powerBan($ids = null)
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $row = $this->model->get($ids);
|
|
|
+ if (!$row) {
|
|
|
+ throw new Exception(__('No Results were found'));
|
|
|
+ }
|
|
|
+ $adminIds = $this->getDataLimitAdminIds();
|
|
|
+ if (is_array($adminIds)) {
|
|
|
+ if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
|
|
+ throw new Exception(__('You have no permission'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data = [
|
|
|
+ 'private_messages' => 2,//禁止私聊:0=正常,1=禁止.2=禁止(永久)
|
|
|
+ 'private_messages_time' => 0,//禁止私聊时间
|
|
|
+ 'speak' => 2,//禁言弹幕:0=正常,1=禁止.2=禁止(永久)
|
|
|
+ 'speak_time' => 0,//禁言时间
|
|
|
+ 'recharge' => 1,//充值:0=正常,1=禁止
|
|
|
+ 'raffle' => 1,//抽奖:0=正常,1=禁止
|
|
|
+ 'give_gift' => 1,//赠送礼物:0=正常,1=禁止
|
|
|
+ 'transfer' => 1,//转账:0=正常,1=禁止
|
|
|
+ 'payorder' => 1,//下单:0=正常,1=禁止
|
|
|
+ 'attire' => 1,//购买装扮:0=正常,1=禁止
|
|
|
+ 'noble' => 1,//开通贵族:0=正常,1=禁止
|
|
|
+ 'withdraw' => 1,//提现:0=允许,1=禁止
|
|
|
+ ];
|
|
|
+ $where['id'] = $ids;
|
|
|
+ $res = $this->model->update($data,$where);
|
|
|
+ $this->success('操作成功');
|
|
|
+ } catch (Exception $e) {
|
|
|
+ $this->error($e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 一键解禁
|
|
|
+ */
|
|
|
+ public function powerUnban($ids = null)
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $row = $this->model->get($ids);
|
|
|
+ if (!$row) {
|
|
|
+ throw new Exception(__('No Results were found'));
|
|
|
+ }
|
|
|
+ $adminIds = $this->getDataLimitAdminIds();
|
|
|
+ if (is_array($adminIds)) {
|
|
|
+ if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
|
|
+ throw new Exception(__('You have no permission'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data = [
|
|
|
+ 'private_messages' => 0,//禁止私聊:0=正常,1=禁止.2=禁止(永久)
|
|
|
+ 'private_messages_time' => 0,//禁止私聊时间
|
|
|
+ 'speak' => 0,//禁言弹幕:0=正常,1=禁止.2=禁止(永久)
|
|
|
+ 'speak_time' => 0,//禁言时间
|
|
|
+ 'recharge' => 0,//充值:0=正常,1=禁止
|
|
|
+ 'raffle' => 0,//抽奖:0=正常,1=禁止
|
|
|
+ 'give_gift' => 0,//赠送礼物:0=正常,1=禁止
|
|
|
+ 'transfer' => 0,//转账:0=正常,1=禁止
|
|
|
+ 'payorder' => 0,//下单:0=正常,1=禁止
|
|
|
+ 'attire' => 0,//购买装扮:0=正常,1=禁止
|
|
|
+ 'noble' => 0,//开通贵族:0=正常,1=禁止
|
|
|
+ 'withdraw' => 0,//提现:0=允许,1=禁止
|
|
|
+ ];
|
|
|
+ $where['id'] = $ids;
|
|
|
+ $res = $this->model->update($data,$where);
|
|
|
+ $this->success('操作成功');
|
|
|
+ } catch (Exception $e) {
|
|
|
+ $this->error($e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|