扩展功能
This commit is contained in:
48
extend/catcher/traits/db/TransTrait.php
Normal file
48
extend/catcher/traits/db/TransTrait.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace catcher\traits\db;
|
||||
|
||||
use think\facade\Db;
|
||||
|
||||
trait TransTrait
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @time 2019年12月03日
|
||||
* @return void
|
||||
*/
|
||||
public function startTrans()
|
||||
{
|
||||
Db::startTrans();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @time 2019年12月03日
|
||||
* @return void
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
Db::commit();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @time 2019年12月03日
|
||||
* @return void
|
||||
*/
|
||||
public function rollback()
|
||||
{
|
||||
Db::rollback();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @time 2019年12月03日
|
||||
* @param \Closure $function
|
||||
* @return void
|
||||
*/
|
||||
public function transaction(\Closure $function)
|
||||
{
|
||||
Db::transaction($function());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user