first commit
This commit is contained in:
135
app/adminapi/logic/withdraw/WithdrawBankLogic.php
Normal file
135
app/adminapi/logic/withdraw/WithdrawBankLogic.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\withdraw;
|
||||
|
||||
|
||||
use app\common\model\withdraw\WithdrawBank;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
use app\common\service\{FileService};
|
||||
use app\common\enum\YesNoEnum;
|
||||
|
||||
|
||||
/**
|
||||
* 可提现银行逻辑
|
||||
* Class WithdrawBankLogic
|
||||
* @package app\adminapi\logic\withdraw
|
||||
*/
|
||||
class WithdrawBankLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加可提现银行
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:19
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
WithdrawBank::create([
|
||||
'lang_id' => $params['lang_id'],
|
||||
'name' => $params['name'],
|
||||
'code' => $params['code'],
|
||||
'logo' => $params['logo'] ? FileService::setFileUrl($params['logo']) : '',
|
||||
'is_show' => $params['is_show'],
|
||||
'sort' => $params['sort']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑可提现银行
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:19
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
WithdrawBank::where('id', $params['id'])->update([
|
||||
'lang_id' => $params['lang_id'],
|
||||
'name' => $params['name'],
|
||||
'code' => $params['code'],
|
||||
'logo' => $params['logo'] ? FileService::setFileUrl($params['logo']) : '',
|
||||
'is_show' => $params['is_show'],
|
||||
'sort' => $params['sort']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除可提现银行
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:19
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return WithdrawBank::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取可提现银行详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:19
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return WithdrawBank::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
/**
|
||||
* @notes 提现银行数据
|
||||
* @param $params
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:19
|
||||
*/
|
||||
public static function allByLang($params)
|
||||
{
|
||||
return WithdrawBank::where(['is_show' => YesNoEnum::YES,'lang_id' => $params['lang_id']])
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
}
|
||||
162
app/adminapi/logic/withdraw/WithdrawMethodLogic.php
Normal file
162
app/adminapi/logic/withdraw/WithdrawMethodLogic.php
Normal file
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\withdraw;
|
||||
|
||||
|
||||
use app\common\model\withdraw\{WithdrawMethod,WithdrawWallet};
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
use app\common\service\{FileService};
|
||||
use app\common\enum\YesNoEnum;
|
||||
|
||||
|
||||
/**
|
||||
* 提现方式逻辑
|
||||
* Class WithdrawMethodLogic
|
||||
* @package app\adminapi\logic\withdraw
|
||||
*/
|
||||
class WithdrawMethodLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加提现方式
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/02/23 14:34
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
WithdrawMethod::create([
|
||||
'lang_id' => $params['lang_id'],
|
||||
'type' => $params['type'],
|
||||
'name' => $params['name'],
|
||||
'logo' => $params['logo'] ? FileService::setFileUrl($params['logo']) : '',
|
||||
'symbol' => $params['symbol'],
|
||||
'rate' => $params['rate'],
|
||||
'symbol_rate' => $params['symbol_rate'],
|
||||
'precision' => $params['precision'],
|
||||
'charge' => $params['charge'],
|
||||
'is_show' => $params['is_show'],
|
||||
'is_qrcode' => $params['is_qrcode'],
|
||||
'sort' => $params['sort']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑提现方式
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/02/23 14:34
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$method = WithdrawMethod::find($params['id']);
|
||||
if ($method->isEmpty()) {
|
||||
throw new \Exception('提现方式不存在');
|
||||
}
|
||||
|
||||
WithdrawWallet::where('method_id', $method['id'])->update([
|
||||
'lang_id' => $params['lang_id'],
|
||||
]);
|
||||
|
||||
WithdrawMethod::where('id', $params['id'])->update([
|
||||
'lang_id' => $params['lang_id'],
|
||||
'type' => $params['type'],
|
||||
'name' => $params['name'],
|
||||
'logo' => $params['logo'] ? FileService::setFileUrl($params['logo']) : '',
|
||||
'symbol' => $params['symbol'],
|
||||
'rate' => $params['rate'],
|
||||
'symbol_rate' => $params['symbol_rate'],
|
||||
'precision' => $params['precision'],
|
||||
'charge' => $params['charge'],
|
||||
'is_qrcode' => $params['is_qrcode'],
|
||||
'is_show' => $params['is_show'],
|
||||
'sort' => $params['sort']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除提现方式
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/02/23 14:34
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return WithdrawMethod::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取提现方式详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/02/23 14:34
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return WithdrawMethod::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 提现方式数据
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/10/13 10:53
|
||||
*/
|
||||
public static function getAllData()
|
||||
{
|
||||
$field = 'wm.id,wm.name,wm.lang_id';
|
||||
$field .= ',l.name as lang_name';
|
||||
|
||||
return WithdrawMethod::alias('wm')
|
||||
->join('language l', 'l.id = wm.lang_id')
|
||||
->field($field)
|
||||
->where(['wm.is_show' => YesNoEnum::YES])
|
||||
->order(['wm.sort' => 'desc', 'wm.id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
}
|
||||
75
app/adminapi/logic/withdraw/WithdrawWalletLogic.php
Normal file
75
app/adminapi/logic/withdraw/WithdrawWalletLogic.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\withdraw;
|
||||
|
||||
|
||||
use app\common\model\withdraw\WithdrawWallet;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
use app\common\service\{FileService};
|
||||
|
||||
|
||||
/**
|
||||
* 用户提现钱包逻辑
|
||||
* Class WithdrawWalletLogic
|
||||
* @package app\adminapi\logic\withdraw
|
||||
*/
|
||||
class WithdrawWalletLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑用户提现钱包
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author BD
|
||||
* @date 2024/02/26 13:32
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
WithdrawWallet::where('id', $params['id'])->update([
|
||||
'bank_id' => $params['bank_id'],
|
||||
'name' => $params['name'],
|
||||
'account' => $params['account'],
|
||||
'img' => $params['img'] ? FileService::setFileUrl($params['img']) : '',
|
||||
'is_disable' => $params['is_disable']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除用户提现钱包
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author BD
|
||||
* @date 2024/02/26 13:32
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return WithdrawWallet::destroy($params['id']);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user