...
|
...
|
@@ -3,6 +3,9 @@ |
|
|
namespace app\admin\controller\user;
|
|
|
|
|
|
use app\admin\library\Auth;
|
|
|
use app\admin\model\AuthGroup;
|
|
|
use app\admin\model\ThirdExam;
|
|
|
use app\admin\model\ThirdStudy;
|
|
|
use app\common\controller\Backend;
|
|
|
use app\common\model\User as UserModel;
|
|
|
use Exception;
|
...
|
...
|
@@ -591,4 +594,40 @@ class User extends Backend |
|
|
|
|
|
$this->success();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 分配组织
|
|
|
*/
|
|
|
public function fporganization($ids = null)
|
|
|
{
|
|
|
if ($this->request->isPost()) {
|
|
|
empty($ids) && $this->error('请选择用户');
|
|
|
$organization_id = $this->request->post("organization_id");
|
|
|
empty($organization_id) && $this->error('请选择组织');
|
|
|
$update_data = ['organization_id'=>$organization_id];
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
|
|
|
$this->model->where('id','in',$ids)->update($update_data);
|
|
|
ThirdStudy::where('third_id','in',$ids)->update($update_data);
|
|
|
ThirdExam::where('user_id','in',$ids)->update($update_data);
|
|
|
|
|
|
Db::commit();
|
|
|
} catch (ValidateException $e) {
|
|
|
Db::rollback();
|
|
|
$this->error($e->getMessage());
|
|
|
} catch (PDOException $e) {
|
|
|
Db::rollback();
|
|
|
$this->error($e->getMessage());
|
|
|
} catch (Exception $e) {
|
|
|
Db::rollback();
|
|
|
$this->error($e->getMessage());
|
|
|
}
|
|
|
$this->success();
|
|
|
}
|
|
|
$this->getOrganizationId() > 0 && $this->error(__('You have no permission'));
|
|
|
$organizationList = AuthGroup::where('is_organization','1')->column('name','id');
|
|
|
$this->view->assign('organizationList',$organizationList);
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
} |
...
|
...
|
|