multi-store/app/admin/logic/user_bill/UserBillLogic.php

94 lines
1.8 KiB
PHP

<?php
namespace app\admin\logic\user_bill;
use app\common\model\user_bill\UserBill;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 资金记录逻辑
* Class UserBillLogic
* @package app\admin\logic\user_bill
*/
class UserBillLogic extends BaseLogic
{
/**
* @notes 添加资金记录
* @param array $params
* @return bool
* @author admin
* @date 2024/05/31 16:44
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
UserBill::create([
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑资金记录
* @param array $params
* @return bool
* @author admin
* @date 2024/05/31 16:44
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
UserBill::where('id', $params['id'])->update([
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除资金记录
* @param array $params
* @return bool
* @author admin
* @date 2024/05/31 16:44
*/
public static function delete(array $params): bool
{
return UserBill::destroy($params['id']);
}
/**
* @notes 获取资金记录详情
* @param $params
* @return array
* @author admin
* @date 2024/05/31 16:44
*/
public static function detail($params): array
{
return UserBill::findOrEmpty($params['id'])->toArray();
}
}