| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- // +----------------------------------------------------------------------
- // | 商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017~2021 https://www.thinkphp.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
- // +----------------------------------------------------------------------
- // | Author: thinkphp <admin@yiovo.com>
- // +----------------------------------------------------------------------
- declare (strict_types=1);
- namespace app\api\model;
- use app\common\model\SourceShoolApply as SourceShoolApplyModel;
- /**
- * 生源学校申请模型类
- * Class SourceShoolApply
- * @package app\api\model
- */
- class SourceShoolApply extends SourceShoolApplyModel
- {
- protected $globalScope = [''];
- /**
- * 隐藏字段
- * @var array
- */
- protected $hidden = [];
- /**
- * 获取老师已申请通过的生源学校
- * @param $userId
- * @return array
- */
- public static function getSchoolsByUser($userId)
- {
- return self::where(['user_id'=> $userId,'status'=>1])
- ->column('source_shools_id');
- }
- /**
- * 获取老师已申请通过的生源学校
- * @param $userId
- * @return array
- */
- public static function checkApplyByUser($userId, $schoolId)
- {
- $status = self::where(['user_id'=> $userId,'source_shools_id'=>$schoolId])
- ->value('status');
- return $status == 1? 1 : ($status == 2? 2 : 0);
- }
- }
|