<?php

namespace app\model;

use think\Model;

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

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

    public function addSublet($param)
    {
        Db::startTrans();
        try {
            $id = $this->save($param);
            Db::commit();
            return [ "code" => "200", "msg" => $id ];
        } catch (\Exception $e) {
            Db::rollback();
            return [ "code" => "101", "msg" => "失败，数据异常" ];
        }


    }
}
