优化代码

This commit is contained in:
yansongda 2018-06-19 17:49:11 +08:00
parent 4596f55a20
commit 501372b7ce
2 changed files with 13 additions and 7 deletions

View File

@ -28,10 +28,17 @@ use Yansongda\Supports\Str;
*/
class Wechat implements GatewayApplicationInterface
{
const MODE_NORMAL = 'normal'; // 普通模式
const MODE_DEV = 'dev'; // 沙箱模式
const MODE_HK = 'hk'; // 香港钱包
const MODE_SERVICE = 'service'; // 服务商
// 普通模式
const MODE_NORMAL = 'normal';
// 沙箱模式
const MODE_DEV = 'dev';
// 香港钱包
const MODE_HK = 'hk';
// 服务商
const MODE_SERVICE = 'service';
/**
* Config.

View File

@ -100,10 +100,9 @@ class Support
$payload = array_merge($payload, is_array($order) ? $order : ['out_trade_no' => $order]);
$type = isset($order['type']) ? $order['type'].($order['type'] == 'app' ? '' : '_').'id' : 'app_id';
$payload['appid'] = $config->get($type, '');
$mode = $config->get('mode', Wechat::MODE_NORMAL);
if ($mode === Wechat::MODE_SERVICE) {
if ($config->get('mode', Wechat::MODE_NORMAL) === Wechat::MODE_SERVICE) {
$payload['sub_appid'] = $config->get('sub_'.$type, '');
}