Files
CompanyProject/芳林公司项目/www.zhiyuanhelp.com/application/api/model/NewSchMajor.php
2024-09-27 01:32:49 +08:00

65 lines
2.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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;
}
}