|
|
@@ -283,6 +283,16 @@ class User extends Backend
|
|
|
}else{
|
|
|
unset($params['fund_pwd']);
|
|
|
}
|
|
|
+
|
|
|
+ //修改代理
|
|
|
+ if($row->agent_id !=$params['agent_id'] && empty($row->is_agent)) {
|
|
|
+
|
|
|
+ //伞下不是代理/代理是他的
|
|
|
+ $this->model->where('id','IN', UsersPath::where('parent_id', $ids)->column('user_id'))
|
|
|
+ ->where('is_agent', 0)
|
|
|
+ ->update(['agent_id'=>$params['agent_id']]);
|
|
|
+ }
|
|
|
+
|
|
|
$result = $row->allowField(true)->save($params);
|
|
|
Db::commit();
|
|
|
} catch (ValidateException|PDOException|Exception $e) {
|
|
|
@@ -365,7 +375,10 @@ class User extends Backend
|
|
|
if($key == 'is_agent'){
|
|
|
//默认开启:设置伞下当前会员所属代理id
|
|
|
$map['agent_id'] = $values[$key] == 0? $row->agent_id: $ids;
|
|
|
- $this->model->where('id','IN', UsersPath::where('parent_id', $ids)->column('user_id'))->update($map);
|
|
|
+ //伞下/代理是自己, 是agent_id = 自己user_id吗
|
|
|
+ $this->model->where('id','IN', UsersPath::where('parent_id', $ids)->column('user_id'))
|
|
|
+ ->where('is_agent', 0)
|
|
|
+ ->update($map);
|
|
|
}
|
|
|
$count = $row->allowField(true)->isUpdate(true)->save($values);
|
|
|
Db::commit();
|