1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-23 20:00:27 +08:00
course-tencent-cloud/app/Models/UserBalance.php
2021-02-13 18:21:42 +08:00

79 lines
1.1 KiB
PHP

<?php
namespace App\Models;
use Phalcon\Mvc\Model\Behavior\SoftDelete;
class UserBalance extends Model
{
/**
* 用户编号(主键)
*
* @var int
*/
public $user_id = 0;
/**
* 可用现金(元)
*
* @var float
*/
public $cash = 0.00;
/**
* 可用积分
*
* @var int
*/
public $point = 0;
/**
* 删除标识
*
* @var int
*/
public $deleted = 0;
/**
* 创建时间
*
* @var int
*/
public $create_time = 0;
/**
* 更新时间
*
* @var int
*/
public $update_time = 0;
public function getSource(): string
{
return 'kg_user_balance';
}
public function initialize()
{
parent::initialize();
$this->addBehavior(
new SoftDelete([
'field' => 'deleted',
'value' => 1,
])
);
}
public function beforeCreate()
{
$this->create_time = time();
}
public function beforeSave()
{
$this->update_time = time();
}
}