<?php

namespace app\model;

use think\Db;
use think\Model;

/**
 * Created by PhpStorm.
 * User : zw
 * Date : 2018/2/1
 * Time : 17:15
 * Intro:
 */
class OBargainModel extends Model
{
    protected $table = "o_bargain";
    private $db_;

    function __construct()
    {
        $this->db_ = Db::name($this->table);
    }

    public function addBargain($params)
    {
        Db::startTrans();
        try {
            $this->db->inserAll($params);
            Db::commit();
            return 1;
        } catch (\Exception $e) {
            Db::rollback();
            return 0;
        }
    }
}