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

志愿者修改

... ... @@ -59,10 +59,21 @@ class TeamModel extends Model
$info=$this->where($map1)->select();
foreach ($info as $k=>$v){
$info[$k]['pic']=cmf_get_image_url($v['pic']);
$info[$k]['my_time']=$this->myTime($user_id,$v['id']);
}
return $info;
}
/** 我的时间
* @param $user_id
* @param $team_id
* @return float|int
*/
private function myTime($user_id,$team_id){
$map['user_id']=$user_id;
$map['team_id']=$team_id;
$time=db('team_work_log')->where($map)->sum('work_time');
return $time;
}
}
\ No newline at end of file
... ...
... ... @@ -472,6 +472,7 @@ class SecondController extends RestBaseController
/*查询到已经申请的团队*/
$map['ta.status']=1;
$map['ta.user_id']=$user_id;
$Team= new TeamModel();
$info=db('team_apply')->alias('ta')
->field('t.*')
->join('team t','t.id=ta.team_id')
... ... @@ -483,7 +484,7 @@ class SecondController extends RestBaseController
$return[$k]['city']=$v['city'];
$return[$k]['people_num']=$v['people_num'];
$return[$k]['work_total_time']=$v['work_total_time'];
$return[$k]['my_time']=$this->myTime($user_id,$v['id']);
$return[$k]['my_time']=$Team->myTime($user_id,$v['id']);
}
if (!empty($return)){
$this->success('',$return);
... ... @@ -492,17 +493,13 @@ class SecondController extends RestBaseController
}
}
private function myTime($user_id,$team_id){
$map['user_id']=$user_id;
$map['team_id']=$team_id;
$time=db('team_work_log')->where($map)->sum('work_time');
return $time;
}
//
// private function myTime($user_id,$team_id){
// $map['user_id']=$user_id;
// $map['team_id']=$team_id;
// $time=db('team_work_log')->where($map)->sum('work_time');
// return $time;
// }
/**
* @title 志愿反馈
... ...