first commit
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/15
|
||||
* Time: 11:42
|
||||
*/
|
||||
|
||||
namespace app\api\controller;
|
||||
use app\api\model\SchoolChoice as ChoiceModel;
|
||||
use app\api\model\SchScore;
|
||||
use app\api\validate\IDMustValidate;
|
||||
use app\api\validate\SchEnrollValidate;
|
||||
use app\api\validate\SchMajorValidate;
|
||||
use app\api\validate\SchoolChoiceValidate;
|
||||
use app\api\model\User;
|
||||
use app\api\model\Major;
|
||||
use think\facade\Log;
|
||||
|
||||
class SchoolChoice extends BaseController
|
||||
{
|
||||
/*
|
||||
* 院校查询
|
||||
* */
|
||||
public function getSchoolBy(){
|
||||
//参数验证
|
||||
(new SchoolChoiceValidate())->goCheck();
|
||||
$array = input('post.');
|
||||
$vipType = 0;
|
||||
//判断用户是否登录
|
||||
if($array['is_login']){
|
||||
$user_id = $this->verifyToken();
|
||||
//验证用户
|
||||
$limit = 5;
|
||||
//用户已登录验证是否具有查看概率权限
|
||||
$resAuth = User::checkUserAuthByUserID($user_id,$array['type'],$array['userPro'],$array['score'],$array['subType']);
|
||||
if($resAuth == 0){
|
||||
$vipType = 1;
|
||||
$limit = 10;
|
||||
}
|
||||
|
||||
}else{
|
||||
$limit = 2;
|
||||
$user_id = 0;
|
||||
}
|
||||
|
||||
$page = $array['page'];
|
||||
$result = ChoiceModel::getSchoolByCondition($array,$page,$limit,$user_id,$vipType);
|
||||
return api_return($result['msg'],$result);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 返回院校数量
|
||||
* */
|
||||
public function getSchoolCount(){
|
||||
//参数验证
|
||||
(new SchoolChoiceValidate())->goCheck();
|
||||
$array = input('post.');
|
||||
//判断用户是否登录
|
||||
if($array['is_login']){
|
||||
$this->verifyToken();
|
||||
}
|
||||
$result = ChoiceModel::getSchoolCount($array);
|
||||
return api_return('ok',$result);
|
||||
}
|
||||
|
||||
/*
|
||||
* 查询学校的专业
|
||||
* */
|
||||
public function getSchMajorBy(){
|
||||
(new SchMajorValidate())->goCheck();
|
||||
$array = input('post.');
|
||||
$user_id = 0;
|
||||
//判断用户是否登录
|
||||
if($array['is_login']){
|
||||
$user_id = $this->verifyToken();
|
||||
}
|
||||
$result = Major::getSchMajorBy($array,$user_id);
|
||||
if($result){
|
||||
return api_return('ok',$result);
|
||||
}else{
|
||||
return api_return('暂无数据');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 查询院校历年招生情况
|
||||
* */
|
||||
public function getSchEnrollByYear(){
|
||||
(new SchEnrollValidate())->goCheck();
|
||||
$array = input('post.');
|
||||
|
||||
$result = SchScore::getSchEnrollByYear($array);
|
||||
if($result){
|
||||
return api_return('ok',$result);
|
||||
}else{
|
||||
return api_return('暂无数据');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user