<?php
|
namespace app\common\model\plus\business;
|
|
use app\common\model\BaseModel;
|
use app\common\service\order\OrderService;
|
use app\common\enum\order\OrderPayStatusEnum;
|
use app\common\enum\order\OrderPayTypeEnum;
|
use app\api\service\order\PaymentService;
|
use app\common\enum\order\OrderTypeEnum;
|
|
/**
|
* 名片订单模型
|
*/
|
class Order extends BaseModel
|
{
|
protected $name = 'business_card_order';
|
|
/**
|
* 关联用户表
|
*/
|
public function user()
|
{
|
return $this->belongsTo('app\\common\\model\\user\\User', 'user_id', 'user_id');
|
}
|
|
/**
|
* 关联名片表
|
*/
|
public function businessCard()
|
{
|
return $this->belongsTo('app\\common\\model\\plus\\business\\Business', 'business_card_id', 'business_card_id');
|
}
|
|
/**
|
* 关联名片等级表
|
*/
|
public function grade()
|
{
|
return $this->belongsTo('app\\common\\model\\plus\\business\\Grade', 'grade_id', 'grade_id');
|
}
|
|
/**
|
* 生成订单号
|
*/
|
public function orderNo()
|
{
|
return OrderService::createOrderNo();
|
}
|
|
/**
|
* 获取订单支付详情
|
*/
|
public static function getPayDetail($orderNo)
|
{
|
return (new static())->with(['user', 'businessCard', 'grade'])->where(['order_no' => $orderNo])->find();
|
}
|
}
|