MerchantReconciliation.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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\order;
  12. use app\common\model\BaseModel;
  13. use app\common\model\system\admin\Admin;
  14. use app\common\model\system\merchant\Merchant;
  15. class MerchantReconciliation extends BaseModel
  16. {
  17. public static function tablePk(): ?string
  18. {
  19. return 'reconciliation_id';
  20. }
  21. public static function tableName(): string
  22. {
  23. return 'merchant_reconciliation';
  24. }
  25. public function withOrder()
  26. {
  27. return $this->hasMany(MerchantReconciliationOrder::class,'reconciliation_id','reconciliation_id');
  28. }
  29. public function merchant()
  30. {
  31. return $this->hasOne(Merchant::class,'mer_id','mer_id');
  32. }
  33. public function admin()
  34. {
  35. return $this->hasOne(Admin::class,'admin_id','admin_id');
  36. }
  37. /**
  38. * 计算扣除费用
  39. * @Author:Qinii
  40. * @Date: 2020/10/15
  41. * @return string
  42. */
  43. public function getChargeAttr()
  44. {
  45. return bcadd(bcadd(bcadd($this->order_extension,$this->order_rate,2),$this->refund_price,2),$this->refund_extensionthis,2);
  46. }
  47. }