|
@@ -459,6 +459,7 @@ class User extends AuthController
|
|
|
$f[] = Form::radio('is_promoter', '推广员', $user->getData('is_promoter'))->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '关闭']]);
|
|
$f[] = Form::radio('is_promoter', '推广员', $user->getData('is_promoter'))->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '关闭']]);
|
|
|
$f[] = Form::select('spread_uid', '推荐人', (string)$user->getData('spread_uid'))->options(array_merge([['value' => 0, 'label' => '无']], UserModel::where('uid', '<>', $uid)->field('uid as value,nickname as label')->select()->toArray()))->filterable(true);
|
|
$f[] = Form::select('spread_uid', '推荐人', (string)$user->getData('spread_uid'))->options(array_merge([['value' => 0, 'label' => '无']], UserModel::where('uid', '<>', $uid)->field('uid as value,nickname as label')->select()->toArray()))->filterable(true);
|
|
|
$f[] = Form::radio('lock_spread', '推荐锁定', $user->getData('lock_spread'))->options([['value' => 1, 'label' => '锁定'], ['value' => 0, 'label' => '解锁']]);
|
|
$f[] = Form::radio('lock_spread', '推荐锁定', $user->getData('lock_spread'))->options([['value' => 1, 'label' => '锁定'], ['value' => 0, 'label' => '解锁']]);
|
|
|
|
|
+ $f[] = Form::select('m_spread_uid', '异业推荐人', (string)$user->getData('m_spread_uid'))->options(array_merge([['value' => 0, 'label' => '无']], UserModel::where('uid', '<>', $uid)->field('uid as value,nickname as label')->select()->toArray()))->filterable(true);
|
|
|
$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);
|
|
$form = Form::make_post_form('添加用户通知', $f, Url::buildUrl('update', array('uid' => $uid)), 5);
|
|
|
$this->assign(compact('form'));
|
|
$this->assign(compact('form'));
|
|
@@ -480,6 +481,7 @@ class User extends AuthController
|
|
|
['integration', 0],
|
|
['integration', 0],
|
|
|
['status', 0],
|
|
['status', 0],
|
|
|
['spread_uid', 0],
|
|
['spread_uid', 0],
|
|
|
|
|
+ ['m_spread_uid', 0],
|
|
|
['lock_spread', 0],
|
|
['lock_spread', 0],
|
|
|
]);
|
|
]);
|
|
|
if (!$uid) return $this->failed('数据不存在');
|
|
if (!$uid) return $this->failed('数据不存在');
|
|
@@ -546,6 +548,23 @@ class User extends AuthController
|
|
|
if ($data['spread_uid'] != $user['spread_uid']) {
|
|
if ($data['spread_uid'] != $user['spread_uid']) {
|
|
|
$res_sp = \app\models\user\User::setSpread($data['spread_uid'], $uid);
|
|
$res_sp = \app\models\user\User::setSpread($data['spread_uid'], $uid);
|
|
|
}
|
|
}
|
|
|
|
|
+ if ($data['m_spread_uid'] != $user['m_spread_uid']) {
|
|
|
|
|
+ if ($uid == $data['m_spread_uid']) {
|
|
|
|
|
+ return Json::fail('不可绑定自己');
|
|
|
|
|
+ }
|
|
|
|
|
+ $spread_uid = $data['m_spread_uid'];
|
|
|
|
|
+ $sp = $data['m_spread_uid'];
|
|
|
|
|
+ $userlist = \app\models\user\User::column('uid,m_spread_uid', 'uid');
|
|
|
|
|
+ while ($sp) {
|
|
|
|
|
+ if ($sp == $uid) {
|
|
|
|
|
+ $spread_uid = 0;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ $sp = $userlist[$sp]['m_spread_uid'] ?? 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!$spread_uid) return Json::fail('绑定用户不满足');
|
|
|
|
|
+ $edit['m_spread_uid'] = $data['m_spread_uid'];
|
|
|
|
|
+ }
|
|
|
$edit['status'] = $data['status'];
|
|
$edit['status'] = $data['status'];
|
|
|
$edit['real_name'] = $data['real_name'];
|
|
$edit['real_name'] = $data['real_name'];
|
|
|
$edit['phone'] = $data['phone'];
|
|
$edit['phone'] = $data['phone'];
|