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

接口完成

... ... @@ -333,11 +333,34 @@ class ActivityController extends AdminBaseController
*
*/
public function joinTime(){
$id=input('id');
$map['id']=input('id');
\db('join')->where($map)->find();
return $this->fetch();
}
/**
* 提交参与时间
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
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();
$user_id=$join['user_id'];
$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]);
if ($result>0){
$this->success('编辑成功!');
}else{
$this->error('编辑失败!');
}
}
}
\ No newline at end of file
... ...
... ... @@ -82,7 +82,7 @@
<a href="{:url('activity/joinPass',array('id'=>$vo['id']))}" class="js-ajax-dialog-btn" data-msg="确定审核通过吗?">通过</a>|
<a href="{:url('activity/joinUnPass',array('id'=>$vo['id']))}" class="js-ajax-dialog-btn" data-msg="确定审核通过吗?">拒绝</a>|
<a href="{:url('activity/joinTime',array('id'=>$vo['id']))}">修改参加活动时间</a>
<font onclick="doSelectCategory({$vo['id']})" href="{:url('activity/joinTime',array('id'=>$vo['id']))}">修改参加活动时间</font>
</td>
</tr>
... ... @@ -93,5 +93,30 @@
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="application/javascript">
function doSelectCategory(res) {
var selectedCategoriesId = res
console.log(res)
openIframeLayer("{:url('activity/joinTime')}?id=" + selectedCategoriesId, '请完善信息', {
area: ['1000px', '700px'],
// btn: ['确定', '取消'],
yes: function (index, layero) {
//do something
var iframeWin = window[layero.find('iframe')[0]['name']];
var selectedCategories = iframeWin.confirm();
if (selectedCategories.selectedCategoriesId.length == 0) {
layer.msg('请选择分类');
return;
}
$('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(','));
$('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' '));
//console.log(layer.getFrameIndex(index));
layer.close(index); //如果设定了yes回调,需进行手工关闭
}
});
}
</script>
</body>
</html>
\ No newline at end of file
... ...
<include file="public@header" />
</head>
<body>
<div class="wrap">
<ul class="nav nav-tabs">
</ul>
<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('joinTimePost')}">
<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="hidden" class="form-control" id="input-name" name="id" value="{$_GET['id']}">
</div>
</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
... ...
... ... @@ -99,6 +99,13 @@
id="card_number" value="{$data.card_number}" placeholder="请输入身份证号" disabled/>
</td>
</tr>
<tr>
<th width="100">工作时长</th>
<td>
<input class="form-control" type="text" name="work_time"
id="record_phone" value="{$data.work_time}" placeholder="请输入证明人电话" disabled/>
</td>
</tr>
<!--<tr>-->
<!--<th width="100">固定电话</th>-->
<!--<td>-->
... ... @@ -229,6 +236,7 @@
id="record_phone" value="{$vo.record_phone}" placeholder="请输入证明人电话" disabled/>
</td>
</tr>
</table>
</foreach>
<div class="form-group">
... ...