|
|
<?php
|
|
|
/**
|
|
|
* Created by PhpStorm.
|
|
|
* auther: sgj
|
|
|
* Date: 2020/9/26
|
|
|
* Time: 14:46
|
|
|
*/
|
|
|
|
|
|
namespace api\index\controller;
|
|
|
|
|
|
|
|
|
use api\common\model\LevelModel;
|
|
|
use api\common\model\TeamModel;
|
|
|
use api\common\model\VolunteerModel;
|
|
|
use cmf\controller\RestBaseController;
|
|
|
|
|
|
/**
|
|
|
* @title 志愿者二开接口
|
|
|
* @description 志愿者二开接口
|
|
|
*/
|
|
|
class SecondController extends RestBaseController
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
* @title 获取排行
|
|
|
* @description 获取排行
|
|
|
* @author SGJ
|
|
|
* @url /index/second/getRank
|
|
|
* @method POST
|
|
|
*
|
|
|
* @header name:XX-Token require:1 default: desc:token
|
|
|
*
|
|
|
* @param name:type type:int require:1 other: desc:类型1,志愿者2,团队
|
|
|
* @param name:star type:int require:1 other: desc:类型6,金牌1,一星2,二星
|
|
|
*
|
|
|
* @return list:志愿者@
|
|
|
* @list rank:排名 name:姓名 province:省市 work_time:工作时间
|
|
|
*/
|
|
|
public function getRank(){
|
|
|
$type=input('type');
|
|
|
if ($type==1){
|
|
|
$star=input('star');
|
|
|
$userModel=new VolunteerModel();
|
|
|
$list=$userModel->getListByLevel($star);
|
|
|
$return=[];
|
|
|
foreach ($list as $k=>$v){
|
|
|
$return[$k]['name']=$v['name'];
|
|
|
$return[$k]['province']=$v['province'];
|
|
|
$return[$k]['work_time']=$v['work_time'];
|
|
|
}
|
|
|
}else{
|
|
|
$teamModel=new TeamModel();
|
|
|
$list=$teamModel->getTeamList('work_total_time desc','');
|
|
|
if(!empty($list)){
|
|
|
foreach ($list as $k=>$v){
|
|
|
$return[$k]['name']=$v['name'];
|
|
|
$return[$k]['work_time']=$v['work_total_time'];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$this->success('',$return);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|