<?php

namespace app\model;

/**
 * Created by PhpStorm.
 * User : zw
 * Date : 2018/1/26
 * Time : 16:48
 * Intro:
 */

use think\Model;
use think\helper\Time;
use think\Db;

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

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

    /**
     * 添加报备
     * @param $params
     * @return array
     */
    public function addReport($params)
    {
        Db::startTrans();
        try {
            $this->db->insert($params);
            $id =  $this->id;
            Db::commit();
            return $id ;
        } catch (\Exception $e) {
            Db::rollback();
            return 0;
        }
    }
}