LivingAllowanceApi.php 771 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace app\common\api;
  3. use app\common\model\LivingAllowance as LaModel;
  4. use app\common\state\LivingAllowanceState as LaState;
  5. /**
  6. * Description of LivingAllowanceApi
  7. *
  8. * @author sgq
  9. */
  10. class LivingAllowanceApi {
  11. public static function getList($where = []) {
  12. return LaModel::where($where)->select()->toArray();
  13. }
  14. public static function getInfoById($id) {
  15. return LaModel::findOrEmpty($id)->toArray();
  16. }
  17. public static function getApplyCountByIdCard($idCard) {
  18. $where = [];
  19. $where[] = ["idCard", "=", $idCard];
  20. $where[] = ["checkState", "<>", LaState::LA_NOTPASS];
  21. $list = LaModel::where($where)->distinct(true)->field("substr(year,1,4)")->select();
  22. return count($list);
  23. }
  24. }