43 行
954 B
PHP
43 行
954 B
PHP
<?php
|
|
|
|
namespace addons\shopro\library\regional_agent;
|
|
|
|
use addons\shopro\model\regional_agent\Config as ConfigModel;
|
|
|
|
class Config
|
|
{
|
|
protected $config = [];
|
|
|
|
public function __construct()
|
|
{
|
|
$this->config = ConfigModel::column('value', 'name');
|
|
}
|
|
|
|
public function isEnable()
|
|
{
|
|
return boolval($this->config['enable'] ?? 0);
|
|
}
|
|
|
|
public function isAgentCheck()
|
|
{
|
|
return boolval($this->config['agent_check'] ?? 1);
|
|
}
|
|
|
|
public function getCommissionEvent()
|
|
{
|
|
return $this->config['commission_event'] ?? 'confirm';
|
|
}
|
|
|
|
public function getCommissionMode()
|
|
{
|
|
$mode = $this->config['commission_mode'] ?? 'stack';
|
|
return in_array($mode, ['stack', 'exclusive', 'differential']) ? $mode : 'stack';
|
|
}
|
|
|
|
public function getApplyForm()
|
|
{
|
|
$form = $this->config['apply_form'] ?? '';
|
|
return $form ? json_decode($form, true) : null;
|
|
}
|
|
}
|