|
|
@@ -119,8 +119,10 @@ 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);
|
|
|
- $f[] = Form::radio('integration_status', '修改积分', 1)->options([['value' => 1, 'label' => '增加'], ['value' => 2, 'label' => '减少']]);
|
|
|
+ $f[] = Form::radio('integration_status', '修改健康豆', 1)->options([['value' => 1, 'label' => '增加'], ['value' => 2, 'label' => '减少']]);
|
|
|
$f[] = Form::number('integration', '积分')->min(0);
|
|
|
+ $f[] = Form::radio('brokerage_price_status', '修改健康币', 1)->options([['value' => 1, 'label' => '增加'], ['value' => 2, 'label' => '减少']]);
|
|
|
+ $f[] = Form::number('brokerage_price', '积分')->min(0);
|
|
|
$form = Form::make_post_form('修改其他', $f, Url::buildUrl('update_other', array('uid' => $uid)));
|
|
|
$this->assign(compact('form'));
|
|
|
return $this->fetch('public/form-builder');
|
|
|
@@ -133,6 +135,8 @@ class User extends AuthController
|
|
|
['money', 0],
|
|
|
['integration_status', 0],
|
|
|
['integration', 0],
|
|
|
+ ['brokerage_price_status', 0],
|
|
|
+ ['brokerage_price', 0],
|
|
|
], $this->request);
|
|
|
if (!$uid) return $this->failed('数据不存在');
|
|
|
$user = UserModel::get($uid);
|
|
|
@@ -187,9 +191,33 @@ class User extends AuthController
|
|
|
} else {
|
|
|
$res2 = true;
|
|
|
}
|
|
|
- if ($edit) $res3 = UserModel::edit($edit, $uid);
|
|
|
- else $res3 = true;
|
|
|
- if ($res1 && $res2 && $res3) $res = true;
|
|
|
+ if ($data['brokerage_price_status'] && $data['brokerage_price']) {//健康币增加或者减少
|
|
|
+ if ($data['brokerage_price_status'] == 1) {//增加
|
|
|
+ $edit['brokerage_price'] = bcadd($user['brokerage_price'], $data['brokerage_price'], 2);
|
|
|
+ $res3 = UserBillAdmin::income('系统增加健康币', $user['uid'], 'brokerage_price', 'system_add', $data['brokerage_price'], $this->adminId, $edit['brokerage_price'], '系统增加了' . floatval($data['brokerage_price']) . '健康币');
|
|
|
+ try {
|
|
|
+ UserRepository::adminAddBrokeragePrice($user, $data['brokerage_price']);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ BaseModel::rollbackTrans();
|
|
|
+ return Json::fail($e->getMessage());
|
|
|
+ }
|
|
|
+ } else if ($data['brokerage_price_status'] == 2) {//减少
|
|
|
+ $edit['brokerage_price'] = bcsub($user['brokerage_price'], $data['brokerage_price'], 2);
|
|
|
+ $res3 = UserBillAdmin::expend('系统减少健康币', $user['uid'], 'brokerage_price', 'system_sub', $data['brokerage_price'], $this->adminId, $edit['brokerage_price'], '系统扣除了' . floatval($data['brokerage_price']) . '健康币');
|
|
|
+ try {
|
|
|
+ UserRepository::adminSubBrokeragePrice($user, $data['brokerage_price']);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ BaseModel::rollbackTrans();
|
|
|
+ return Json::fail($e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $res3 = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($edit) $res4 = UserModel::edit($edit, $uid);
|
|
|
+ else $res4 = true;
|
|
|
+ if ($res1 && $res2 && $res3 && $res4) $res = true;
|
|
|
else $res = false;
|
|
|
BaseModel::checkTrans($res);
|
|
|
if ($res) return Json::successful('修改成功!');
|