You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.4 KiB
68 lines
2.4 KiB
2 months ago
|
<?php
|
||
|
|
||
|
namespace app\admin\service\setting;
|
||
|
|
||
|
use app\admin\service\AdminBaseService;
|
||
|
use app\model\DrawalSettingModel;
|
||
|
|
||
|
class DrawalService extends AdminBaseService
|
||
|
{
|
||
|
// 提现手续费
|
||
|
|
||
|
public function index()
|
||
|
{
|
||
|
|
||
|
try {
|
||
|
$list = DrawalSettingModel::select();
|
||
|
$rows = [];
|
||
|
if(!$list->isEmpty()){
|
||
|
$rows = $list->toArray();
|
||
|
}
|
||
|
return $this->toData('0', 'SUCCESS', ['list' => $rows, 'total' => count($rows)]);
|
||
|
}catch (\Exception $exception){
|
||
|
return $this->toData('1', '系统繁忙', []);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
public function edit($param)
|
||
|
{
|
||
|
try {
|
||
|
if(empty($param['id']) || !is_numeric($param['id'])){
|
||
|
return $this->toData('1', '目标不存在', []);
|
||
|
}
|
||
|
|
||
|
if(empty($param['bank_drawal_fee']) || !is_numeric($param['bank_drawal_fee']) || $param['bank_drawal_fee'] < 0){
|
||
|
return $this->toData('1', '银行提现手续费无效', []);
|
||
|
}
|
||
|
if(empty($param['digital_drawal_fee']) || !is_numeric($param['digital_drawal_fee']) || $param['digital_drawal_fee'] < 0){
|
||
|
return $this->toData('1', '数字币提现手续费无效', []);
|
||
|
}
|
||
|
if(empty($param['min_recharge']) || !is_numeric($param['min_recharge']) || $param['min_recharge'] < 0){
|
||
|
return $this->toData('1', '最小充值金额无效', []);
|
||
|
}
|
||
|
if(empty($param['min_drawal']) || !is_numeric($param['min_drawal']) || $param['min_drawal'] < 0){
|
||
|
return $this->toData('1', '最小提现金额无效', []);
|
||
|
}
|
||
|
|
||
|
$drawal = DrawalSettingModel::where('id', $param['id'])->find();
|
||
|
if(empty($drawal)){
|
||
|
return $this->toData('1', '目标不存在', []);
|
||
|
}
|
||
|
$drawal->bank_drawal_fee = $param['bank_drawal_fee'];
|
||
|
$drawal->digital_drawal_fee = $param['digital_drawal_fee'];
|
||
|
$drawal->min_recharge = $param['min_recharge'];
|
||
|
$drawal->min_drawal = $param['min_drawal'];
|
||
|
$drawal->save();
|
||
|
|
||
|
$fee_key="DRAWAL:FEE:SETTING";
|
||
|
$redis = $this->getRedis();
|
||
|
$redis->del($fee_key);
|
||
|
$redis->hMSet($fee_key,$param);
|
||
|
|
||
|
return $this->toData('0','SUCCESS');
|
||
|
}catch (\Exception $exception){
|
||
|
return $this->toData('1', '系统繁忙', []);
|
||
|
}
|
||
|
}
|
||
|
}
|