UserIdcards.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\common\model\user;
  13. use app\common\model\BaseModel;
  14. /**
  15. * 用户认证
  16. * Class Delivery
  17. * @package app\common\model
  18. */
  19. class UserIdcards extends BaseModel
  20. {
  21. // 定义表名
  22. protected $name = 'user_idcards';
  23. // 定义主键
  24. protected $pk = 'id';
  25. public function getUserIdCard($userId){
  26. return self::where('user_id',$userId)->order('id','desc')->find();
  27. }
  28. /**
  29. * 获取器:隐藏身份证中间
  30. * @param $value
  31. * @return mixed
  32. */
  33. /* public function getIdCardAttr($value)
  34. {
  35. if (strlen($value) === 18) {
  36. return hide_id_card($value);
  37. }
  38. }*/
  39. /**
  40. * 检查用户是否已实名认证
  41. * @param $userId
  42. * @return bool
  43. * @throws \think\db\exception\DataNotFoundException
  44. * @throws \think\db\exception\DbException
  45. * @throws \think\db\exception\ModelNotFoundException
  46. */
  47. public static function checkUserHasIdcard($userId){
  48. return boolval(self::where(['user_id'=>$userId])->find());
  49. }
  50. }