<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: your name
// +----------------------------------------------------------------------
namespace app\dice\logic\player_wallet_record;

use plugin\saiadmin\basic\think\BaseLogic;
use plugin\saiadmin\exception\ApiException;
use plugin\saiadmin\utils\Helper;
use app\dice\model\player_wallet_record\DicePlayerWalletRecord;

/**
 * 玩家钱包流水逻辑层
 */
class DicePlayerWalletRecordLogic extends BaseLogic
{
    /**
     * 构造函数
     */
    public function __construct()
    {
        $this->model = new DicePlayerWalletRecord();
    }

    /**
     * 添加数据（补全抽奖次数字段默认值）
     */
    public function add(array $data): mixed
    {
        $data['total_draw_count'] = $data['total_draw_count'] ?? 0;
        $data['paid_draw_count'] = $data['paid_draw_count'] ?? 0;
        $data['free_draw_count'] = $data['free_draw_count'] ?? 0;
        return parent::add($data);
    }

}
