Skip to content

建议这些参数改为可选 #2

@qiuyongsheng007

Description

@qiuyongsheng007

初始化public static function init($config)
{
if (empty($config['app_id'])) {
throw new \Exception('not empty app_id');
}
if (empty($config['secret'])) {
throw new \Exception('not empty secret');
}
if (empty($config['merchant_id'])) {
throw new \Exception('not empty merchant_id');
}
if (empty($config['salt'])) {
throw new \Exception('not empty salt');
}
if (empty($config['notify_url'])) {
throw new \Exception('not empty notify_url');
}
if (empty($config['token'])) {
throw new \Exception('not empty token');
}
$class = new self();
$class->app_id = $config['app_id'];
$class->secret = $config['secret'];
$class->token = $config['token'];
$class->merchant_id = $config['merchant_id'];
$class->salt = $config['salt'];
$class->settle_url = isset($config['settle_url']) ? $config['settle_url'] : $config['notify_url'];
$class->notify_url = $config['notify_url'];
$class->valid_time = isset($config['valid_time']) ? $config['valid_time'] : time() + 900;
return $class;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions