修改支付

This commit is contained in:
邹景立 2021-05-08 15:33:02 +08:00
parent 1d2af54785
commit 6baecf52d0
2 changed files with 5 additions and 7 deletions

View File

@ -306,9 +306,9 @@ class Order extends Auth
if (empty($payments)) $this->error('获取订单支付参数失败'); if (empty($payments)) $this->error('获取订单支付参数失败');
// 读取支付通道配置 // 读取支付通道配置
$query = $this->app->db->name('BaseUserPayment')->field('type,code,name,cover,content')->order('sort desc,id desc'); $query = $this->app->db->name('BaseUserPayment')->field('type,code,name,cover,content')->order('sort desc,id desc');
$query->where(['status' => 1, 'deleted' => 0])->whereIn('code', str2arr($payments))->whereIn('type', PaymentService::getTypeByApi($this->type)); $query->where(['status' => 1, 'deleted' => 0])->whereIn('code', str2arr($payments))->whereIn('type', PaymentService::getTypeApi($this->type));
$this->success('获取支付参数数据', $query->withAttr('content', function ($content) { $this->success('获取支付参数数据', $query->withAttr('content', function ($content) {
return json_encode($content, true); return json_decode($content, true);
})->select()->toArray()); })->select()->toArray());
} }

View File

@ -236,11 +236,9 @@ abstract class PaymentService
*/ */
public static function getTypeAll(): array public static function getTypeAll(): array
{ {
$types = []; [$types, $binds] = [[], array_keys(UserAdminService::TYPES)];
foreach (self::TYPES as $k => $v) if (isset($v['bind'])) { foreach (self::TYPES as $k => $v) if (isset($v['bind'])) {
if (array_intersect($v['bind'], array_keys(UserAdminService::TYPES))) { if (array_intersect($v['bind'], $binds)) $types[$k] = $v;
$types[$k] = $v;
}
} }
return $types; return $types;
} }
@ -250,7 +248,7 @@ abstract class PaymentService
* @param string $api * @param string $api
* @return array * @return array
*/ */
public static function getTypeByApi(string $api = ''): array public static function getTypeApi(string $api = ''): array
{ {
$types = []; $types = [];
foreach (self::TYPES as $type => $attr) { foreach (self::TYPES as $type => $attr) {