...
|
...
|
@@ -12,14 +12,17 @@ namespace api\index\controller; |
|
|
use api\common\model\ActivityNews;
|
|
|
use api\common\model\ClassModel;
|
|
|
use api\common\model\ClassQuestionModel;
|
|
|
use api\common\model\GoodsModel;
|
|
|
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 api\index\model\UserModel;
|
|
|
use cmf\controller\RestBaseController;
|
|
|
use FontLib\Table\Type\name;
|
|
|
use think\console\output\formatter\Style;
|
|
|
use think\Validate;
|
|
|
|
|
|
/**
|
|
|
* @title 志愿者二开接口
|
...
|
...
|
@@ -373,7 +376,7 @@ class SecondController extends RestBaseController |
|
|
$Team=new TeamModel();
|
|
|
$info= $Team->getTeamInfo($id);
|
|
|
$map['user_id']=$userId;
|
|
|
$map['team_id']=$id;k
|
|
|
$map['team_id']=$id;
|
|
|
$apply_info=db('team_apply')->where($map)->order('id','DESC')->find();
|
|
|
if (empty($apply_info)){
|
|
|
$info['user_status']=3;
|
...
|
...
|
@@ -383,6 +386,179 @@ class SecondController extends RestBaseController |
|
|
$this->success('',$info);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @title 申请加入团队
|
|
|
* @description 申请加入团队
|
|
|
* @author sgj
|
|
|
* @url /index/second/applyTeam
|
|
|
* @method POST
|
|
|
*
|
|
|
*
|
|
|
*@header name:XX-Token require:1 default: desc:token
|
|
|
*
|
|
|
*@param name:team_id type:int require:1 other: desc:团队id
|
|
|
*@param name:wx_id type:int require:1 other: desc:微信号
|
|
|
*@param name:mobile type:int require:1 other: desc:手机号
|
|
|
*@param name:join_reason type:int require:1 other: desc:加入原因
|
|
|
* @throws
|
|
|
*/
|
|
|
public function applyTeam(){
|
|
|
$user_id = $this->getUserId();
|
|
|
$param = $this->request->param();
|
|
|
$validate = new Validate([
|
|
|
'wx_id' => 'require',
|
|
|
'team_id' => 'require',
|
|
|
'mobile' => 'require',
|
|
|
'join_reason' => 'require',
|
|
|
|
|
|
]);
|
|
|
$validate->message([
|
|
|
'wx_id' => '微信号不能为空',
|
|
|
'team_id' =>'团队id不能为空',
|
|
|
'mobile' => '手机号不能为空',
|
|
|
'join_reason' => '加入原因不能为空',
|
|
|
]);
|
|
|
if (!$validate->check($param)) {
|
|
|
$this->error($validate->getError());
|
|
|
}
|
|
|
$param['create_time']=time();
|
|
|
$param['user_id']=$user_id;
|
|
|
$result=db('team_apply')->insert($param);
|
|
|
if ($result>0){
|
|
|
$this->success('操作成功');
|
|
|
}else{
|
|
|
$this->error('操作失败');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @title 我的团队
|
|
|
* @description 我的团队
|
|
|
* @author sgj
|
|
|
* @url /index/second/myTeam
|
|
|
* @method POST
|
|
|
*
|
|
|
*
|
|
|
*@header name:XX-Token require:1 default: desc:token
|
|
|
*
|
|
|
* @return name:团队名称
|
|
|
* @return pic:图片
|
|
|
* @return my_time:我的时间
|
|
|
* @return work_total_time:总时长
|
|
|
* @return people_num:人数
|
|
|
* @return city:城市
|
|
|
* @throws
|
|
|
*/
|
|
|
public function myTeam(){
|
|
|
$user_id = $this->getUserId();
|
|
|
/*查询到已经申请的团队*/
|
|
|
$map['ta.status']=1;
|
|
|
$map['ta.user_id']=$user_id;
|
|
|
$info=db('team_apply')->alias('ta')
|
|
|
->field('t.*')
|
|
|
->join('team t','t.id=ta.team_id')
|
|
|
->where($map)->select();
|
|
|
foreach ($info as $k=>$v) {
|
|
|
$return[$k]['pic']=cmf_get_image_url($v['pic']);
|
|
|
$return[$k]['name']=$v['name'];
|
|
|
$return[$k]['id']=$v['id'];
|
|
|
$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']);
|
|
|
}
|
|
|
if (!empty($return)){
|
|
|
$this->success('',$return);
|
|
|
}else{
|
|
|
$this->error('');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
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 志愿反馈
|
|
|
* @description 志愿反馈
|
|
|
* @author sgj
|
|
|
* @url /index/second/feedback
|
|
|
* @method POST
|
|
|
*
|
|
|
*
|
|
|
*@header name:XX-Token require:1 default: desc:token
|
|
|
*
|
|
|
* @return user:用户信息@
|
|
|
* @user avatar:头像 name:姓名 level:星级 work_time:总工时 use_time:消耗工时 level_time:剩余工时 status:状态
|
|
|
*
|
|
|
* @throws
|
|
|
*/
|
|
|
public function feedBack(){
|
|
|
$userId=$this->getUserId();
|
|
|
$userModel=new VolunteerModel();
|
|
|
$return['user']=$userModel->getUserInfo($userId);
|
|
|
$this->success('',$return);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @title 商品列表
|
|
|
* @description 商品列表
|
|
|
* @author sgj
|
|
|
* @url /index/second/goodsList
|
|
|
* @method POST
|
|
|
*
|
|
|
*
|
|
|
*@param name:page type:int require:1 other: desc:页数
|
|
|
*
|
|
|
*@header name:XX-Token require:1 default: desc:token
|
|
|
*
|
|
|
* @return data:商品信息@
|
|
|
* @data id pic:缩略图 work_time:消耗工时 good_name:名称 real_good:是否为实物 seal_num:销售量 num:库存量
|
|
|
*
|
|
|
* @throws
|
|
|
*/
|
|
|
public function goodsList(){
|
|
|
$goodModel=new GoodsModel();
|
|
|
$map['is_online']=1;
|
|
|
$goods=$goodModel->where($map)->paginate(10,true);
|
|
|
$list=$goods->items();
|
|
|
foreach ($list as $k=>$v){
|
|
|
$list[$k]['pic']=cmf_get_image_url($v['pic']);
|
|
|
$list[$k]['content']='';
|
|
|
}
|
|
|
$this->success('',$goods);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @title 商品详情
|
|
|
* @description 商品详情
|
|
|
* @author sgj
|
|
|
* @url /index/second/goodInfo
|
|
|
* @method POST
|
|
|
*
|
|
|
*
|
|
|
*@param name:id type:int require:1 other: desc:商品id
|
|
|
*
|
|
|
*@header name:XX-Token require:1 default: desc:token
|
|
|
*
|
|
|
* @return data:商品信息@
|
|
|
* @data content:内容详情 pic:缩略图 work_time:消耗工时 good_name:名称 real_good:是否为实物 seal_num:销售量 num:库存量
|
|
|
*
|
|
|
* @throws
|
|
|
*/
|
|
|
public function goodInfo(){
|
|
|
$id=input('id');
|
|
|
$goodModel=new GoodsModel();
|
|
|
$goodInfo=$goodModel->getGoods($id);
|
|
|
if (empty($goodInfo)){
|
|
|
$this->error('没有找到相应商品');
|
|
|
}
|
|
|
$this->success('',$goodInfo);
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|