StoreServiceLog.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\model\store\service;
  12. use app\common\model\BaseModel;
  13. use app\common\model\store\order\StoreOrder;
  14. use app\common\model\store\order\StoreRefundOrder;
  15. use app\common\model\store\product\Product;
  16. use app\common\model\store\product\ProductGroup;
  17. use app\common\model\store\product\ProductPresell;
  18. use app\common\model\system\merchant\Merchant;
  19. use app\common\model\user\User;
  20. class StoreServiceLog extends BaseModel
  21. {
  22. public static function tablePk(): ?string
  23. {
  24. return 'service_log_id';
  25. }
  26. public static function tableName(): string
  27. {
  28. return 'store_service_log';
  29. }
  30. public function orderInfo()
  31. {
  32. return $this->hasOne(StoreOrder::class, 'order_id', 'msn')->with('orderProduct');
  33. }
  34. public function product()
  35. {
  36. return $this->hasOne(Product::class, 'product_id', 'msn');
  37. }
  38. public function presell()
  39. {
  40. return $this->hasOne(ProductPresell::class, 'product_presell_id', 'msn')->append(['product']);
  41. }
  42. public function productGroup()
  43. {
  44. return $this->hasOne(ProductGroup::class, 'product_group_id', 'msn')->append(['product']);
  45. }
  46. public function refundOrder()
  47. {
  48. return $this->hasOne(StoreRefundOrder::class, 'refund_order_id', 'msn')->with('refundProduct.product');
  49. }
  50. public function user()
  51. {
  52. return $this->hasOne(User::class, 'uid', 'uid')->field('uid,avatar,nickname');
  53. }
  54. public function service()
  55. {
  56. return $this->hasOne(StoreService::class, 'service_id', 'service_id')->field('service_id,avatar,nickname');
  57. }
  58. public function merchant()
  59. {
  60. return $this->hasOne(Merchant::class, 'mer_id', 'mer_id');
  61. }
  62. }