ClientPoints.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. /**
  27. * @Desc 关联商品
  28. * @Author Gorden
  29. * @Date 2024/3/30 13:08
  30. *
  31. * @return \Illuminate\Database\Eloquent\Relations\HasOne
  32. */
  33. public function goods()
  34. {
  35. return $this->hasOne(Goods::class, 'goods_id', 'join_client_points_goods_id');
  36. }
  37. public function orders()
  38. {
  39. return $this->hasOne(Order::class, 'order_id', 'join_client_points_order_id');
  40. }
  41. }