jh-admin/addon/saas/shop/controller/Config.php

85 lines
3.5 KiB
PHP

<?php
/**
* SAAS应用系统 --- 十年开发经验汇集巨献!
* ==========================================================
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
* ----------------------------------------------------------
* 官方网址: https://www.zoomtk.com
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
* ==========================================================
*/
namespace addon\saas\shop\controller;
use addon\fenxiao\model\FenxiaoWithdraw;
use app\model\system\Address as AddressModel;
use app\model\web\WebSite as WebsiteModel;
class Config extends SaasBase
{
/***
* 账号设置
* @return array|mixed
*/
public function setiing()
{
if (request()->isAjax()) {
$data = request()->post();
$website_model = new WebsiteModel();
if ($this->AgentInfo) {
$data['separate_accounts_value']=json_encode($data['separate_accounts_value']);
$res = $website_model->setWebSite($data, ['id' => $this->AgentInfo['id']]);
return $res;
} else {
return error(-1,'您还不是代理商');
}
}
if($this->AgentInfo['separate_accounts_value']){
$separate_accounts_value=json_decode($this->AgentInfo['separate_accounts_value'],true);
$this->AgentInfo['separate_accounts_value']=$separate_accounts_value;
}
$this->forthMenu();
$address_model = new AddressModel();
$list = $address_model->getAreaList([["pid", "=", 0], ["level", "=", 1]]);
$this->assign('info', $this->AgentInfo);
$this->assign("province_list", $list["data"]);
return $this->fetch('config/index');
}
/**
* 分销结算设置
*/
public function basics()
{
$model = new \addon\saas\model\Config();
if (request()->isAjax()) {
if (empty(input('transfer_type'))) {
$transfer_type = '';
} else {
$transfer_type = implode(',', input('transfer_type'));
}
$data = [
'account_type' => input('account_type', ''),
'withdraw_rate' => input('withdraw_rate', ''),//佣金提现手续费
'withdraw_status' => input('withdraw_status', ''),//提现审核
'transfer_type' => $transfer_type,//转账方式,
'is_auto_transfer' => input('is_auto_transfer', 0),//是否自动转账 1 手动转账 2 自动转账
'min' => input('withdraw', ''),//最低提现额度
'max' => input('max', 0),//提现最高额度
];
$res = $model->setRegionSettlementConfig($data, 1, $this->site_id);
return $res;
} else {
$withdraw_config = $model->getRegionSettlementConfig($this->site_id)[ 'data' ][ 'value' ] ?? [];
$this->assign('withdraw_info', $withdraw_config);
$fenxiao_withdraw_model = new FenxiaoWithdraw();
$transfer_type_list = $fenxiao_withdraw_model->getTransferType($this->site_id);
$transfer_type_list[ 'balance' ] = '余额';
$this->assign('transfer_type_list', $transfer_type_list);
$this->forthMenu();
return $this->fetch('config/region-withdraw');
}
}
}