<?php

namespace app\traits\account;

use app\model\AccountDataLog;

//用户积分相关
trait AccountScoreTrait
{

    /**
     * 用户已使用积分
     * */
    public function getAccountUsedScore($accountId)
    {
        return abs( AccountDataLog::where("account_id", $accountId)
            ->where("type", AccountDataLog::TYPE_SCORE)
            ->where("num", "<", 0)
            ->sum("num"));
    }


}