<?php
namespace app\model;

use think\Db;
use think\Model;

/**
 * Created by PhpStorm.
 * User: zw
 * Date: 2018/1/29
 * Time: 下午5:47
 */

class OrderModel extends Model{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'o_order';
    protected $db_;

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

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

    }
}