|
@@ -8,6 +8,7 @@
|
|
|
namespace app\admin\controller\user;
|
|
|
|
|
|
use app\admin\controller\AuthController;
|
|
|
+use app\models\user\UserMoney;
|
|
|
use app\models\vote\UserVote;
|
|
|
use crmeb\repositories\UserRepository;
|
|
|
use crmeb\traits\CurdControllerTrait;
|
|
@@ -71,7 +72,7 @@ class User extends AuthController
|
|
|
list($group_id) = Util::postMore([
|
|
|
['group_id', 0],
|
|
|
], $this->request, true);
|
|
|
- $uids = explode(',',$uid);
|
|
|
+ $uids = explode(',', $uid);
|
|
|
$res = UserModel::whereIn('uid', $uids)->update(['group_id' => $group_id]);
|
|
|
if ($res) {
|
|
|
return Json::successful('设置成功');
|
|
@@ -119,6 +120,11 @@ class User extends AuthController
|
|
|
$f = array();
|
|
|
$f[] = Form::radio('money_status', '修改余额', 1)->options([['value' => 1, 'label' => '增加'], ['value' => 2, 'label' => '减少']]);
|
|
|
$f[] = Form::number('money', '余额')->min(0);
|
|
|
+ $money_type = init_money_type();
|
|
|
+ foreach ($money_type as $k => $v) {
|
|
|
+ $f[] = Form::radio($k . '_status', '修改' . $v, 1)->options([['value' => 1, 'label' => '增加'], ['value' => 2, 'label' => '减少']]);
|
|
|
+ $f[] = Form::number($k, $v)->min(0);
|
|
|
+ }
|
|
|
// $f[] = Form::radio('integration_status', '修改积分', 1)->options([['value' => 1, 'label' => '增加'], ['value' => 2, 'label' => '减少']]);
|
|
|
// $f[] = Form::number('integration', '积分')->min(0);
|
|
|
$form = Form::make_post_form('修改其他', $f, Url::buildUrl('update_other', array('uid' => $uid)));
|
|
@@ -134,6 +140,7 @@ class User extends AuthController
|
|
|
['integration_status', 0],
|
|
|
['integration', 0],
|
|
|
], $this->request);
|
|
|
+ $other_money = $this->request->param();
|
|
|
if (!$uid) return $this->failed('数据不存在');
|
|
|
$user = UserModel::get($uid);
|
|
|
if (!$user) return Json::fail('数据不存在!');
|
|
@@ -189,7 +196,22 @@ class User extends AuthController
|
|
|
}
|
|
|
if ($edit) $res3 = UserModel::edit($edit, $uid);
|
|
|
else $res3 = true;
|
|
|
- if ($res1 && $res2 && $res3) $res = true;
|
|
|
+
|
|
|
+ //其他币
|
|
|
+ $res_other = true;
|
|
|
+ $money_type = init_money_type();
|
|
|
+ foreach ($money_type as $k => $v) {
|
|
|
+ if ($other_money[$k . '_status'] && $other_money[$k]) {//积分增加或者减少
|
|
|
+ if ($other_money[$k . '_status'] == 1) {//增加
|
|
|
+ $res_other = $res_other && UserMoney::incomeMoney($user['uid'], $k, $other_money[$k], 'system_add', '系统增加了' . floatval($other_money[$k]) . $v);
|
|
|
+ } else if ($other_money[$k . '_status'] == 2) {//减少
|
|
|
+ if (UserMoney::initialUserMoney($user['uid'], $k)['money'] < $other_money[$k])
|
|
|
+ $other_money[$k] = UserMoney::initialUserMoney($user['uid'], $k)['money'];
|
|
|
+ $res_other = $res_other && UserMoney::expendMoney($user['uid'], $k, $other_money[$k], 'system_sub', '系统扣除了' . floatval($other_money[$k]) . $v);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($res1 && $res2 && $res3 && $res_other) $res = true;
|
|
|
else $res = false;
|
|
|
BaseModel::checkTrans($res);
|
|
|
if ($res) return Json::successful('修改成功!');
|