|
@@ -35,6 +35,30 @@ class Manage
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public function updateMain($id, $name, $data)
|
|
|
+ {
|
|
|
+ Dever::config('base')->hook = true;
|
|
|
+ $main = Dever::param('main', $data);
|
|
|
+
|
|
|
+ if ($main && $main == 1) {
|
|
|
+ $member = Dever::db('option/member')->find($id);
|
|
|
+ if ($member) {
|
|
|
+ $main_member = Dever::db('option/member')->select(array('main' => 1, 'aid' => $member['aid']));
|
|
|
+ if ($main_member) {
|
|
|
+ foreach ($main_member as $k => $v) {
|
|
|
+ if ($v['id'] != $id) {
|
|
|
+ Dever::db('option/member')->update(array('where_id' => $v['id'], 'main' => 2));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $account = Dever::db('option/account')->find($member['aid']);
|
|
|
+ if ($account) {
|
|
|
+ Dever::db('option/account')->update(array('where_id' => $account['id'], 'mid' => $member['id']));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function updateAccount($id, $name, $data)
|
|
|
{
|
|
|
Dever::config('base')->hook = true;
|