ClientPoints.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace app\model;
  3. use support\Model;
  4. class ClientPoints extends Model
  5. {
  6. protected $table = 'client_points';
  7. protected $primaryKey = 'client_points_id';
  8. protected $dateFormat = 'U';
  9. const CREATED_AT = 'client_points_addtimes';
  10. const UPDATED_AT = null;
  11. public function serializeDate(\DateTimeInterface $date)
  12. {
  13. return $date->format('Y-m-d H:i:s');
  14. }
  15. /**
  16. * @Desc 关联会员
  17. * @Author Gorden
  18. * @Date 2024/3/30 13:08
  19. *
  20. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  21. */
  22. public function member()
  23. {
  24. return $this->hasOne(Member::class, 'member_id', 'join_client_points_member_id');
  25. }
  26. public function memberInfo()
  27. {
  28. return $this->hasOne(MemberInfo::class, 'join_info_member_id', 'join_client_points_member_id');
  29. }
  30. public function memberCert()
  31. {
  32. return $this->hasOne(MemberCert::class,'join_cert_member_id','join_client_points_member_id');
  33. }
  34. /**
  35. * @Desc 关联商品
  36. * @Author Gorden
  37. * @Date 2024/3/30 13:08
  38. *
  39. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  40. */
  41. public function goods()
  42. {
  43. return $this->hasOne(Goods::class, 'goods_id', 'join_client_points_goods_id');
  44. }
  45. public function orders()
  46. {
  47. return $this->hasOne(Order::class, 'order_id', 'join_client_points_order_id');
  48. }
  49. }