first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2020/4/27
* Time: 19:26
*/
namespace app\api\model;
use app\api\model\CollectNewMajor;
use think\Db;
use think\Model;
class NewSchMajor extends Model
{
/*
* 新高考查询学校专业
* */
public static function getNewSchoolMajors($array,$user_id){
unset($array['userPro']);
$result = Db::table('rec_zhejiang_schs_majors')->field('rec_id,professions')->where('rec_id','=',$array['id'])->find();
empty($result) ? $msg = '暂无数据!' : $msg = '查询成功!';
//查询用户收藏的专业
$resCollect = [];
if($user_id){
$resCollect = CollectNewMajor::getUserNewMajor($user_id);
}
if(empty($result)){
$arr = [];
}else{
$res = json_decode($result['professions']);
foreach ($res as $key => $val){
$arr[$key]['probability'] = $val->probability;
$arr[$key]['professionName'] = $val->professionName;
$arr[$key]['cost'] = $val->cost;
$arr[$key]['professionCode'] = $val->professionCode;
$arr[$key]['enterNum'] = $val->enterNum;
$arr[$key]['planNum'] = $val->planNum;
$arr[$key]['majorCode'] = $val->majorCode;
$arr[$key]['recommendType'] = $val->recommendType;
$arr[$key]['chooseCns'] = $val->chooseCns;
$arr[$key]['rec_id'] = $result['rec_id'];
$arr[$key]['lowestRank'] = $val->minSort;;
$arr[$key]['minScore'] = $val->minScore;
$arr[$key]['is_collect'] = 0;//收藏默认0后期修改
if(is_array($resCollect)){
if(in_array($result['rec_id'].'_'.$val->majorCode.'_'.$val->professionCode,$resCollect)){
$arr[$key]['is_collect'] = 1;
}
}
}
}
return $arr;
}
}