ShippingTemplate.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * @package merchant
  4. * Author: Qinii
  5. * Date: 2020/5/6
  6. * Time: 14:19
  7. */
  8. namespace app\common\model\store\shipping;
  9. use app\common\model\BaseModel;
  10. class ShippingTemplate extends BaseModel
  11. {
  12. /**
  13. * Author:Qinii
  14. * Date: 2020/5/6
  15. * Time: 14:20
  16. * @return string
  17. */
  18. public static function tablePk(): string
  19. {
  20. return 'shipping_template_id';
  21. }
  22. /**
  23. * Author:Qinii
  24. * Date: 2020/5/6
  25. * Time: 14:20
  26. * @return string
  27. */
  28. public static function tableName(): string
  29. {
  30. return 'shipping_template';
  31. }
  32. /**
  33. * 包邮
  34. * @Author:Qinii
  35. * @Date: 2020/5/6
  36. * @Time: 18:00
  37. * @return \think\model\relation\HasMany
  38. */
  39. public function free()
  40. {
  41. return $this->hasMany(ShippingTemplateFree::class, 'temp_id', 'shipping_template_id');
  42. }
  43. /**
  44. * 配送
  45. * @Author:Qinii
  46. * @Date: 2020/5/6
  47. * @Time: 18:01
  48. * @return \think\model\relation\HasMany
  49. */
  50. public function region()
  51. {
  52. return $this->hasMany(ShippingTemplateRegion::class, 'temp_id', 'shipping_template_id');
  53. }
  54. /**
  55. * @return \think\model\relation\HasOne
  56. * @author xaboy
  57. * @day 2020/6/4
  58. */
  59. public function freeAddress()
  60. {
  61. return $this->hasOne(ShippingTemplateFree::class, 'temp_id', 'shipping_template_id');
  62. }
  63. /**
  64. * @return \think\model\relation\HasOne
  65. * @author xaboy
  66. * @day 2020/6/4
  67. */
  68. public function regionAddress()
  69. {
  70. return $this->hasOne(ShippingTemplateRegion::class, 'temp_id', 'shipping_template_id');
  71. }
  72. /**
  73. * @Author:Qinii
  74. * @Date: 2020/5/6
  75. * @Time: 18:01
  76. * @return \think\model\relation\HasOne
  77. */
  78. public function undelives()
  79. {
  80. return $this->hasOne(ShippingTemplateUndelivery::class, 'temp_id', 'shipping_template_id');
  81. }
  82. }