作者 sgj
1 个管道 的构建 通过 耗费 3 秒

bug修改

... ... @@ -285,7 +285,17 @@ class ActivityController extends AdminBaseController
->alias('j')
->join('volunteer v','v.user_id=j.user_id')
->where($map)
->select();
->select()
->toArray();
foreach ($join as $k=>$v){
if (!empty($v['add_time'])){
$join[$k]['add_time']=date('Y-m-d H:i:s',$v['add_time']);
}
if (!empty($v['sgin_time'])){
$join[$k]['sgin_time']=date('Y-m-d H:i:s',$v['sgin_time']);
}
}
$this->assign('data',$join);
return $this->fetch();
}
... ... @@ -334,7 +344,8 @@ class ActivityController extends AdminBaseController
*/
public function joinTime(){
$map['id']=input('id');
\db('join')->where($map)->find();
$info=\db('join')->where($map)->find();
$this->assign('info',$info);
return $this->fetch();
}
... ... @@ -346,6 +357,7 @@ class ActivityController extends AdminBaseController
public function joinTimePost(){
$map['id']=input('id');
$data['work_time']=input('work_time');
$result=\db('join')->where($map)->update($data);
/*更新用户使用时间*/
$join=\db('join')->where($map)->find();
... ... @@ -353,12 +365,12 @@ class ActivityController extends AdminBaseController
$all_map['user_id']=$user_id;
$all_result=\db('join')->where($all_map)->sum('work_time');
//dump($all_result);
\db('user')->where('user_id',$user_id)->update(['work_time'=>$all_result]);
\db('volunteer')->where('user_id',$user_id)->update(['work_time'=>$all_result]);
if ($result>0){
$this->success('编辑成功!');
}else{
$this->error('编辑失败!');
$this->error('时长没有变化!');
}
}
... ...
... ... @@ -75,8 +75,8 @@
<case value="3">线上+线下</case>
</switch>
</td>
<td>{:date('Y-m-d H:i:s',$vo['add_time'])}</td>
<td>{:date('Y-m-d H:i:s',$vo['sgin_time'])}</td>
<td>{$vo['add_time']}</td>
<td>{$vo['sgin_time']}</td>
<td>{$vo['work_time']}</td>
<td>
... ...
... ... @@ -8,7 +8,7 @@
<div class="form-group">
<label for="input-name" class="col-sm-2 control-label"><span class="form-required">*</span>工作时间</label>
<div class="col-md-6 col-sm-10">
<input type="number" class="form-control" id="input-name" name="work_time">
<input type="number" class="form-control" value="{$info['work_time']}" id="input-name" name="work_time">
<input type="hidden" class="form-control" id="input-name" name="id" value="{$_GET['id']}">
</div>
</div>
... ...