|
@@ -354,11 +354,13 @@ class User extends AuthController
|
|
|
$f[] = Form::input('real_name', '真实姓名', $user->getData('real_name'));
|
|
|
$f[] = Form::text('phone', '手机号', $user->getData('phone'));
|
|
|
$f[] = Form::text('email', '邮箱', $user->getData('email'));
|
|
|
+ $f[] = Form::number('return_uper', '佣金比例(%)', $user->getData('return_uper'))->step(0.01);
|
|
|
// $f[] = Form::date('birthday', '生日', $user->getData('birthday') ? date('Y-m-d', $user->getData('birthday')) : 0);
|
|
|
$f[] = Form::input('card_id', '身份证号', $user->getData('card_id'));
|
|
|
$f[] = Form::textarea('mark', '用户备注', $user->getData('mark'));
|
|
|
+
|
|
|
// $f[] = Form::radio('is_promoter', '推广员', $user->getData('is_promoter'))->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '关闭']]);
|
|
|
-// $f[] = Form::radio('status', '状态', $user->getData('status'))->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '锁定']]);
|
|
|
+ $f[] = Form::radio('status', '状态', $user->getData('status'))->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '锁定']]);
|
|
|
$form = Form::make_post_form('添加用户通知', $f, Url::buildUrl('update', array('uid' => $uid)), 5);
|
|
|
$this->assign(compact('form'));
|
|
|
return $this->fetch('public/form-builder');
|
|
@@ -373,6 +375,7 @@ class User extends AuthController
|
|
|
['phone', 0],
|
|
|
['card_id', ''],
|
|
|
['birthday', ''],
|
|
|
+ ['return_uper', ''],
|
|
|
['mark', ''],
|
|
|
['money', 0],
|
|
|
['integration_status', 0],
|
|
@@ -439,6 +442,18 @@ class User extends AuthController
|
|
|
$edit['birthday'] = strtotime($data['birthday']);
|
|
|
$edit['mark'] = $data['mark'];
|
|
|
$edit['is_promoter'] = $data['is_promoter'];
|
|
|
+ if ($data['return_uper'] != $user['return_uper']) {
|
|
|
+ if ($user['spread_uid']) {
|
|
|
+ $uper = UserModel::where('uid', $user['spread_uid'])->value('return_uper') ?: 0;
|
|
|
+ $child = UserModel::where('spread_uid', $uid)->max('return_uper') ?: 0;
|
|
|
+ if ($data['return_uper'] > $uper) {
|
|
|
+ Json::fail('佣金比例不可大于上级!');
|
|
|
+ } elseif ($data['return_uper'] < $child) {
|
|
|
+ Json::fail('佣金比例不可小于下级!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $edit['return_uper'] = $data['return_uper'];
|
|
|
+ }
|
|
|
if ($edit) $res3 = UserModel::edit($edit, $uid);
|
|
|
else $res3 = true;
|
|
|
if ($res1 && $res2 && $res3) $res = true;
|