123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\common\model;
- use think\Model;
- /**
- * @property Orders orders
- * @property User user
- */
- class OrderVoucher extends Model
- {
- protected $autoWriteTimestamp=true;
- public function orders(){
- return $this->belongsTo(Orders::class,'order_id');
- }
- public function user(){
- return $this->belongsTo(User::class);
- }
- public function makeAudit($pass){
- $this['status']=$pass;
- if($pass){
- $order=$this->orders;
- if($order->is_wait_pay){
- $order->makePay();
- }
- }
- SiteMsg::sendMsg(
- $pass?SiteMsg::TYPE_ORDER_OFFLINE_PAY_PASS:SiteMsg::TYPE_ORDER_OFFLINE_PAY_REJECT,
- $this->user
- );
- $this->save();
- }
- }
|