<?php
namespace app\event;
use app\model\User as UserModel;
use support\think\Db;
use Request;
class Card{
    function create($row){
        $cdkeys = [];
        for ($i=0; $i < $row['total']; $i++) { 
            array_push($cdkeys,[
                'type'          =>  $row['type'],
                'category_id'   =>  $row['id'],
                'account'       =>  \support\Random::uuid(),
                'password'     =>  '123456',
                'expires'       =>  $row['expires'],
                'days'          =>  $row['days'],
                'is_used'       =>  0,
                'use_time'      =>  0,
                'status'        =>  1,
                'created_at'    =>  time(),
                'updated_at'    =>  time(),
            ]);
        }
        
        $Cdkey = new \app\model\Cdkey;
        $Cdkey->saveAll($cdkeys);
        return $row;
    }
}