UserTravelers.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace app\admin\model;
  3. use support\Db;
  4. use support\Model;
  5. /**
  6. * 亲属列表
  7. * Class Users
  8. * @package app\api\model
  9. */
  10. class UserTravelers extends Model
  11. {
  12. const IS_DEL_YES = 1;
  13. const IS_DEL_NO = 0;
  14. /**
  15. * The table associated with the model.
  16. *
  17. * @var string
  18. */
  19. protected $table = 'user_travelers';
  20. public $timestamps = false;
  21. /**
  22. * Notes:获取亲属列表
  23. * @return array
  24. * User: YCP
  25. * Date: 2022/11/10
  26. */
  27. public static function getUserTravelersList(int $page,int $limit,int $travelers_user_id)
  28. {
  29. $list = static::select('*')
  30. ->where(['travelers_del'=>static::IS_DEL_NO,'travelers_user_id'=>$travelers_user_id])
  31. ->orderBy('travelers_add_time','DESC')
  32. ->get();
  33. $count = static::where(['travelers_del'=>static::IS_DEL_NO,'travelers_user_id'=>$travelers_user_id])
  34. ->count();
  35. return [$list, $count];
  36. }
  37. /**
  38. * Notes:根据手机号获取会员信息
  39. * @param int $mobile
  40. * User: YCP
  41. * Date: 2022/11/10
  42. */
  43. public static function getUserInfo(int $mobile)
  44. {
  45. return static::where(['travelers_phone' => $mobile])
  46. ->first();
  47. }
  48. //时间格式
  49. public function getTravelersAddTimeAttribute($value)
  50. {
  51. return date('Y-m-d H:i:s', $value);
  52. }
  53. }