作者 sgj
1 个管道 的构建 失败 耗费 0 秒

修改志愿者状态逻辑

... ... @@ -70,7 +70,7 @@ class VolunteerModel extends Model
$userInfo['use_time']=$user['use_time']??0;
$userInfo['level_time']=$user['work_time']-$user['use_time'];
if ($user['status']==2){
if ($user['study_time']>10){
if ($user['study_time']>=5 && $user['work_time']>10){
$userInfo['status']='志愿者';
$userInfo['user_num']=$userId.$user['create_time'];
}
... ... @@ -80,7 +80,7 @@ class VolunteerModel extends Model
$userInfo['user_num']='';
}
if ($user['study_time']>=5 && $user['study_time']<10){
if ($user['study_time']>=5 && $user['work_time']<10){
$userInfo['status']='志愿者(待实习)';
$userInfo['user_num']='';
}
... ... @@ -110,7 +110,7 @@ class VolunteerModel extends Model
$return['remark']='审核中';
}
if ($user['status']==2){
if ($user['study_time']>10){
if ($user['study_time']>=5 && $user['work_time']>10){
$userInfo['status']='志愿者';
$userInfo['user_num']=$userId.$user['create_time'];
$return['code']=4;
... ... @@ -124,7 +124,7 @@ class VolunteerModel extends Model
$return['remark']='志愿者(待学习)';
}
if ($user['study_time']>=5 && $user['study_time']<10){
if ($user['study_time']>=5 && $user['work_time']<10){
$userInfo['status']='志愿者(待实习)';
$userInfo['user_num']='';
... ...
... ... @@ -116,7 +116,6 @@ class TeamController extends AdminBaseController
if (!empty($info)){
$this->success('操作成功!');
}
}
... ...
... ... @@ -95,6 +95,28 @@ class UserController extends AdminBaseController
return $this->fetch();
}
/**
* 管理员添加
* @adminMenu(
* 'name' => '管理员添加',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '管理员添加',
* 'param' => ''
* )
*/
public function addTeam()
{
$roles = Db::name('role')->where(['status' => 1])->order("id DESC")->select();
$team=\db('team')->where(['status'=>2])->select();
$this->assign("roles", $roles);
$this->assign("team", $team);
return $this->fetch();
}
/**
* 管理员添加提交
* @adminMenu(
... ... @@ -139,6 +161,37 @@ class UserController extends AdminBaseController
}
}
public function addTeamPost()
{
if ($this->request->isPost()) {
if (!empty($_POST['role_id']) && is_array($_POST['role_id'])) {
$role_ids = $_POST['role_id'];
unset($_POST['role_id']);
$result = $this->validate($this->request->param(), 'User');
if ($result !== true) {
$this->error($result);
} else {
$_POST['user_pass'] = cmf_password($_POST['user_pass']);
$result = DB::name('user')->insertGetId($_POST);
if ($result !== false) {
//$role_user_model=M("RoleUser");
foreach ($role_ids as $role_id) {
if (cmf_get_current_admin_id() != 1 && $role_id == 1) {
$this->error("为了网站的安全,非网站创建者不可创建超级管理员!");
}
Db::name('RoleUser')->insert(["role_id" => $role_id, "user_id" => $result]);
}
$this->success("添加成功!", url("user/index"));
} else {
$this->error("添加失败!");
}
}
} else {
$this->error("请为此用户指定角色!");
}
}
}
/**
* 管理员编辑
... ...
... ... @@ -5,6 +5,7 @@
<ul class="nav nav-tabs">
<li class="active"><a href="{:url('index')}">团队列表</a></li>
<li><a href="{:url('addteam')}">添加团队</a></li>
<li><a href="{:url('user/addteam')}">添加团队管理员</a></li>
</ul>
<!-- <form class="well form-inline margin-top-20" method="post" action="{:url('activity/index')}">
关键字:
... ...
<include file="public@header" />
</head>
<body>
<div class="wrap">
<ul class="nav nav-tabs">
<!--<li><a href="{:url('user/index')}">{:lang('ADMIN_USER_INDEX')}</a></li>-->
<li class="active"><a href="{:url('user/add')}">{:lang('ADMIN_USER_ADD')}</a></li>
</ul>
<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('user/addteampost')}">
<div class="form-group">
<label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>{:lang('USERNAME')}</label>
<div class="col-md-6 col-sm-10">
<input type="text" class="form-control" id="input-user_login" name="user_login">
</div>
</div>
<div class="form-group">
<label for="input-user_pass" class="col-sm-2 control-label"><span class="form-required">*</span>{:lang('PASSWORD')}</label>
<div class="col-md-6 col-sm-10">
<input type="text" class="form-control" id="input-user_pass" name="user_pass" placeholder="******">
</div>
</div>
<div class="form-group">
<label for="input-user_pass" class="col-sm-2 control-label"><span class="form-required">*</span>团队名称</label>
<div class="col-md-6 col-sm-10">
<select class="form-control" name="team_id" id="more-template-select">
<foreach name="team" item="vo">
<option value="{$vo.id}">{$vo.name}</option>
</foreach>
</select>
</div>
</div>
<div class="form-group">
<label for="input-user_email" class="col-sm-2 control-label"><span class="form-required">*</span>{:lang('EMAIL')}</label>
<div class="col-md-6 col-sm-10">
<input type="text" class="form-control" id="input-user_email" name="user_email">
</div>
<input value="3" type="hidden" name="role_id[]">
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
</div>
</div>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>
\ No newline at end of file
... ...