OrderVoucher.php 769 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. /**
  5. * @property Orders orders
  6. * @property User user
  7. */
  8. class OrderVoucher extends Model
  9. {
  10. protected $autoWriteTimestamp=true;
  11. public function orders(){
  12. return $this->belongsTo(Orders::class,'order_id');
  13. }
  14. public function user(){
  15. return $this->belongsTo(User::class);
  16. }
  17. public function makeAudit($pass){
  18. $this['status']=$pass;
  19. if($pass){
  20. $order=$this->orders;
  21. if($order->is_wait_pay){
  22. $order->makePay();
  23. }
  24. }
  25. SiteMsg::sendMsg(
  26. $pass?SiteMsg::TYPE_ORDER_OFFLINE_PAY_PASS:SiteMsg::TYPE_ORDER_OFFLINE_PAY_REJECT,
  27. $this->user
  28. );
  29. $this->save();
  30. }
  31. }