<?php

namespace app\common\model;

use think\Model;

/**
 * 模型
 */
class UserExchsoundLog extends Model
{

    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';

    /**
     * 添加钻石兑换记录
     */
    public function addExchsoundLog($user_id,$sound,$money) {
        if(!$user_id || !$sound || !$money) {
            return false;
        }
        $data = [
            "user_id"       => $user_id,
            "sound_coin"         => $sound,
            "jewel"         => $money,
            "createtime"    => time()
        ];
        return $this->insertGetId($data);
    }
}