全栈小学生 9b55b17b54 1
2023-05-31 11:20:09 +08:00

80 lines
1.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud-admin.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\model\pay;
use app\dict\order\OrderTypeDict;
use app\dict\pay\PayDict;
use core\base\BaseModel;
/**
* 订单模型
* Class Order
* @package app\model\order
*/
class Pay extends BaseModel
{
// 关闭自动写入update_time字段
protected $updateTime = false;
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
/**
* 模型名称
* @var string
*/
protected $name = 'pay';
//类型
protected $type = [
'pay_time' => 'timestamp',
'close_time' => 'timestamp',
];
protected $json = ['allow_type'];
protected $jsonAssoc = true;
/**
* 状态字段转化
* @param $value
* @return mixed
*/
public function getStatusNameAttr($value, $data)
{
return PayDict::getStatus()[$data['status'] ?? ''] ?? '';
}
/**
* 支持的支付方式
* @param $value
* @param $data
* @return void
*/
public function getPayTypeListAttr($value, $data){
return OrderTypeDict::getAllowPayType($data['trade_type']);
}
/**
* 支付方式字段转化
* @param $value
* @return mixed
*/
public function getTypeNameAttr($value, $data)
{
return PayDict::getPayType()[$data['type'] ?? '']['name'] ?? '';
}
}