Files
guangan/plugs/think-plugs-points-mall/src/model/PointsMallOrder.php
2025-02-16 17:16:42 +08:00

101 lines
2.4 KiB
PHP

<?php
namespace plugin\points_mall\model;
use plugin\account\model\PluginAccountUser;
use think\admin\Model;
class PointsMallOrder extends Model
{
/**
* 关联推荐用户
* @return \think\model\relation\HasOne
*/
public function from()
{
return $this->hasOne(PluginAccountUser::class, 'id', 'puid1');
}
/**
* 关联商品数据
* @return \think\model\relation\HasMany
*/
public function items()
{
return $this->hasMany(PointsMallOrderItem::class, 'order_no', 'order_no');
}
//
// /**
// * 关联支付数据
// * @return \think\model\relation\HasOne
// */
// public function payment()
// {
// return $this->hasOne(PluginPaymentRecord::class, 'order_no', 'order_no')->where([
// 'payment_status' => 1,
// ]);
// }
//
// /**
// * 关联支付记录
// * @return \think\model\relation\HasMany
// */
// public function payments()
// {
// return $this->hasMany(PluginPaymentRecord::class, 'order_no', 'order_no')->order('id desc')->withoutField('payment_notify');
// }
/**
* 关联收货地址
* @return \think\model\relation\HasOne
*/
public function address()
{
return $this->hasOne(PointsMallAddress::class, 'id', 'address_id');
}
public function sender()
{
return $this->hasOne(PointsMallOrderSender::class, 'order_no', 'order_no');
}
//
// /**
// * 格式化支付通道
// * @param mixed $value
// * @return array
// */
// public function getPaymentAllowsAttr($value): array
// {
// $payments = is_string($value) ? str2arr($value) : [];
// return in_array('all', $payments) ? ['all'] : $payments;
// }
//
// /**
// * 时间格式处理
// * @param mixed $value
// * @return string
// */
// public function getPaymentTimeAttr($value): string
// {
// return $this->getCreateTimeAttr($value);
// }
//
// /**
// * 时间格式处理
// * @param mixed $value
// * @return string
// */
// public function setPaymentTimeAttr($value): string
// {
// return $this->setCreateTimeAttr($value);
// }
//
// public function setConfirmTimeAttr($value): string
// {
// return $this->setCreateTimeAttr($value);
// }
//
// public function getConfirmTimeAttr($value): string
// {
// return $this->getCreateTimeAttr($value);
// }
}