2024-10-29 16:32:47 +08:00

112 lines
2.4 KiB
PHP

<?php
namespace app\admin\logic\store_extract;
use app\common\model\store_extract\StoreExtract;
use app\common\logic\BaseLogic;
use support\exception\BusinessException;
use think\facade\Db;
/**
* 门店提现逻辑
* Class StoreExtractLogic
* @package app\admin\logic\store_extract
*/
class StoreExtractLogic extends BaseLogic
{
/**
* @notes 添加门店提现
* @param array $params
* @return bool
* @author admin
* @date 2024/05/31 17:09
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
StoreExtract::create([
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
throw new BusinessException($e->getMessage());
}
}
/**
* @notes 确认提现
* @param array $params
* @return bool
* @author admin
* @date 2024/05/31 17:09
*/
public static function Enter(array $params): bool
{
Db::startTrans();
try {
StoreExtract::update(['status'=>1,'pay_status'=>1],['id'=>$params['id']]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
throw new BusinessException($e->getMessage());
}
}
/**
* @notes 编辑门店提现
* @param array $params
* @return bool
* @author admin
* @date 2024/05/31 17:09
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
StoreExtract::where('id', $params['id'])->update([
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
throw new BusinessException($e->getMessage());
}
}
/**
* @notes 删除门店提现
* @param array $params
* @return bool
* @author admin
* @date 2024/05/31 17:09
*/
public static function delete(array $params): bool
{
return StoreExtract::destroy($params['id']);
}
/**
* @notes 获取门店提现详情
* @param $params
* @return array
* @author admin
* @date 2024/05/31 17:09
*/
public static function detail($params): array
{
return StoreExtract::findOrEmpty($params['id'])->toArray();
}
}