<?php namespace Seller\Lib;
use Dever;
class Info
{
    # 余额扣款
    public function dec($id, $cash)
    {
        $state = Dever::db('info', 'seller')->update($id, array('cash' => array('-', $cash)));
        return $state;
    }

    # 余额加款
    public function inc($id, $cash)
    {
        $state = Dever::db('info', 'seller')->update($id, array('cash' => array('+', $cash)));
        return $state;
    }

    # 增加日志
    public function log($seller_id, $order_id, $cash, $type = 3)
    {
        $where['seller_id'] = $seller_id;
        $where['order_id'] = $order_id;
        $where['type'] = $type;
        $data = $where;
        if ($type == 2 || $type == 3) {
            $cash = -1*$cash;
        }
        $data['cash'] = $cash;
        //$data['yue'] = $this->yue($seller_id) - $cash;
        //Dever::db('log', 'seller')->up($where, $data);
        //Dever::db('log', 'seller')->insert($data);
        Dever::db('log1', 'seller')->insert($data);
    }

    # 获取余额
    public function yue($seller_id)
    {

    }
}