Files
2026-09-01 22:15:50 +08:00

77 lines
1.9 KiB
PHP

<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\common\model\card;
use cores\BaseModel;
/**
* 兑换卡打印模型
* Class CardPrint
* @package app\common\model\card
*/
class CardPrint extends BaseModel
{
// 定义表名
protected $name = 'card_print';
// 定义主键
protected $pk = 'print_id';
protected $updateTime = false;
/**
* 关联兑换卡表
* @return \think\model\relation\BelongsTo
*/
public function card()
{
$module = self::getCalledModule();
return $this->belongsTo("app\\{$module}\\model\\Card");
}
/**
* 获取器:下载时间
* @param $value
* @return string
*/
public function getDownloadTimeAttr($value)
{
return format_time($value);
}
/**
* 新增记录
* @param array $data
*/
public static function add(array $data)
{
$model = new static;
$model->save($data);
}
/**
* 充值卡打印详情
* @param $where
* @param array $with
* @return static|null
* @throws \think\exception\DbException
*/
public static function detail($where, $with = [])
{
!is_array($where) && $where = ['print_id' => (int)$where];
return static::get($where, $with);
}
}