You've already forked guangan
商品Address
This commit is contained in:
97
plugs/think-plugs-points-mall/src/model/PointsMallOrder.php
Normal file
97
plugs/think-plugs-points-mall/src/model/PointsMallOrder.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?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(PluginWemallOrderSender::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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user