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

志愿者完善到答题模块

... ... @@ -31,6 +31,19 @@ class TeamModel extends Model
return $info;
}
/**
* 获取团队详情
* @param $id id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getTeamInfo($id){
$map['id']=$id;
$info=$this->where($map)->find();
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* auther: sgj
* Date: 2020/9/30
* Time: 14:12
*/
namespace api\common\model;
use think\Model;
class UserPassModel extends Model
{
/**
* 通过考试
* @param $user_id
* @param $class_id
*/
public function pass($user_id,$class_id){
$info['user_id']=$user_id;
$info['class_id']=$class_id;
$this->save($info);
}
}
\ No newline at end of file
... ...
... ... @@ -33,4 +33,22 @@ class VolunteerModel extends Model
$info=$this->where($map)->where($map1)->order('work_time','DESC')->select()->toArray();
return $info;
}
/**
* 增加工作时间
* @param $level
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function addWorkTime($userId,$time){
$map['user_id']=$userId;
$this->where($map)->setInc('work_time',$time);
/*添加团队工时*/
}
}
\ No newline at end of file
... ...
... ... @@ -15,6 +15,7 @@ use api\common\model\ClassQuestionModel;
use api\common\model\LevelModel;
use api\common\model\NewsTypeMode;
use api\common\model\TeamModel;
use api\common\model\UserPassModel;
use api\common\model\VolunteerModel;
use cmf\controller\RestBaseController;
use think\console\output\formatter\Style;
... ... @@ -302,13 +303,69 @@ class SecondController extends RestBaseController
/*添加用户时长*/
$volunteer=new VolunteerModel();
$volunteer->where('user_id',$user_id)->setInc('work_time',$question['work_time']);
$volunteer->addWorkTime($user_id,$question['work_time']);
/*添加到完成*/
$this->success('回答成功');
$UserPassModel=new UserPassModel();
$UserPassModel->pass($user_id,$class_id);
$return['time']=$question['work_time'];
$this->success('回答成功',$return);
}else{
$this->error('问题回答错误');
}
}
/**
* @title 团队列表
* @description 团队列表
* @author sgj
* @url /index/second/teamList
* @method GET
*
*
*@header name:XX-Token require:1 default: desc:token
*
*@param name:city type:int require:1 other: desc:城市名称
*
* @throws
*/
public function teamList(){
$city=input('city');
$Team=new TeamModel();
$map['status']=2;
$team=$Team->where('city',$city)->where($map)->select();
if (!empty($team)){
foreach ($team as $k=>$v) {
$return['id']=$v['id'];
$return['name']=$v['name'];
$return['create_time']=date('Y-m-d',$v['create_time']);
$return['work_total_time']=$v['work_total_time'];
$return['people_num']=$v['people_num'];
$return['pic']=cmf_get_image_url($return['pic']);
}
}
}
/**
* @title 团队详情
* @description 团队详情
* @author sgj
* @url /index/second/teamInfo
* @method GET
*
*
*@header name:XX-Token require:1 default: desc:token
*
*@param name:city type:int require:1 other: desc:城市名称
*
* @throws
*/
public function teamInfo(){
$id=input('id');
$Team=new TeamModel();
$Team->getTeamInfo($id);
}
}
\ No newline at end of file
... ...