CouponPacketSequence.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace app\model;
  3. use DateTimeInterface;
  4. use support\Model;
  5. class CouponPacketSequence extends Model
  6. {
  7. protected $table = 'coupon_packet_sequence';
  8. protected $primaryKey = 'coupon_packet_sequence_id';
  9. protected $keyType = 'string';
  10. protected $dateFormat = 'U';
  11. const CREATED_AT = 'coupon_packet_sequence_addtimes';
  12. const UPDATED_AT = null;
  13. public function serializeDate(DateTimeInterface $date)
  14. {
  15. return $date->format('Y-m-d H:i:s');
  16. }
  17. /**
  18. * @Desc 关联券包
  19. * @Author Gorden
  20. * @Date 2024/9/12 14:33
  21. *
  22. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  23. */
  24. public function packet()
  25. {
  26. return $this->hasOne(CouponPacket::class,'coupon_packet_id','join_sequence_coupon_packet_id');
  27. }
  28. /**
  29. * @Desc 关联会员
  30. * @Author Gorden
  31. * @Date 2024/3/30 13:08
  32. *
  33. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  34. */
  35. public function member()
  36. {
  37. return $this->hasOne(Member::class, 'member_id', 'join_coupon_packet_sequence_member_id');
  38. }
  39. /**
  40. * @Desc 关联实名
  41. * @Author Gorden
  42. * @Date 2024/8/21 13:50
  43. *
  44. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  45. */
  46. public function cert()
  47. {
  48. return $this->hasOne(MemberCert::class, 'join_cert_member_id', 'join_coupon_packet_sequence_member_id');
  49. }
  50. /**
  51. * @Desc 关联详情
  52. * @Author Gorden
  53. * @Date 2024/8/21 13:51
  54. *
  55. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  56. */
  57. public function info()
  58. {
  59. return $this->hasOne(MemberInfo::class, 'join_info_member_id', 'join_coupon_packet_sequence_member_id');
  60. }
  61. }