UserAuth.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace app\admin\model;
  3. use support\Model;
  4. /**
  5. * 悦享家会员认证模型
  6. * Class Members
  7. * @package app\api\model
  8. */
  9. class UserAuth extends Model
  10. {
  11. const UPDATED_AT = 'auth_update_time';
  12. const WAIT = '0';
  13. const DONE = '1';
  14. const RETURN = '2';
  15. const CANCEL = '3';
  16. const MEMBER_AUTH_STATUS = [
  17. self::WAIT => '待审核',
  18. self::DONE => '审核通过',
  19. self::RETURN => '审核驳回',
  20. self::CANCEL => '主动撤销'
  21. ];
  22. /**
  23. * The table associated with the model.
  24. *
  25. * @var string
  26. */
  27. protected $table = 'user_auth';
  28. protected $dateFormat = 'U';
  29. /**
  30. * Notes:获取指定条件一列
  31. * @param int $status
  32. * @return array
  33. * User: yym
  34. * Date: 2022/8/4
  35. */
  36. public static function getListIds(int $status)
  37. {
  38. return static::select('auth_user_id')->where(['auth_status' => $status])->get()->toArray();
  39. }
  40. /**
  41. * Notes:更新会员认证信息
  42. * @param int $user_id
  43. * @param string $category
  44. * @param array $update
  45. * @return int
  46. * User: yym
  47. * Date: 2022/8/4
  48. */
  49. public static function updateAuth(int $user_id, string $category, array $update)
  50. {
  51. return static::where(['auth_user_id' => $user_id, 'auth_type' => $category])->update($update);
  52. }
  53. /**
  54. * Notes:插入记录
  55. * @param array $data
  56. * @return int
  57. * User: yym
  58. * Date: 2022/8/5
  59. */
  60. public static function insertData(array $data)
  61. {
  62. return static::insertGetId($data);
  63. }
  64. }