SourceShoolApply.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.thinkphp.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: thinkphp <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\api\model;
  13. use app\common\model\SourceShoolApply as SourceShoolApplyModel;
  14. /**
  15. * 生源学校申请模型类
  16. * Class SourceShoolApply
  17. * @package app\api\model
  18. */
  19. class SourceShoolApply extends SourceShoolApplyModel
  20. {
  21. protected $globalScope = [''];
  22. /**
  23. * 隐藏字段
  24. * @var array
  25. */
  26. protected $hidden = [];
  27. /**
  28. * 获取老师已申请通过的生源学校
  29. * @param $userId
  30. * @return array
  31. */
  32. public static function getSchoolsByUser($userId)
  33. {
  34. return self::where(['user_id'=> $userId,'status'=>1])
  35. ->column('source_shools_id');
  36. }
  37. /**
  38. * 获取老师已申请通过的生源学校
  39. * @param $userId
  40. * @return array
  41. */
  42. public static function checkApplyByUser($userId, $schoolId)
  43. {
  44. $status = self::where(['user_id'=> $userId,'source_shools_id'=>$schoolId])
  45. ->value('status');
  46. return $status == 1? 1 : ($status == 2? 2 : 0);
  47. }
  48. }