|
@@ -9,6 +9,11 @@ class RechargeChannel extends BaseModel
|
|
|
protected $fillable = ['key', 'name', 'type', 'rate','min','max' ,'fixed' ,'sort'];
|
|
protected $fillable = ['key', 'name', 'type', 'rate','min','max' ,'fixed' ,'sort'];
|
|
|
protected $hidden = [];
|
|
protected $hidden = [];
|
|
|
|
|
|
|
|
|
|
+ public function getFixedAttribute($value)
|
|
|
|
|
+ {
|
|
|
|
|
+ return $value ? explode(',', $value) : null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//获取充值通道
|
|
//获取充值通道
|
|
|
public static function product($from = '')
|
|
public static function product($from = '')
|
|
|
{
|
|
{
|
|
@@ -30,12 +35,12 @@ class RechargeChannel extends BaseModel
|
|
|
$where['id'] = ['in', $channel_ids];
|
|
$where['id'] = ['in', $channel_ids];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- $product = self::where($where)->orderBy('sort', 'asc')->get()->toArray();
|
|
|
|
|
|
|
+ $product = self::where($where)->orderBy('sort', 'asc')->select(['name','type','min','max','fixed','rate'])->get()->toArray();
|
|
|
|
|
|
|
|
$list = [];
|
|
$list = [];
|
|
|
- $config = [];
|
|
|
|
|
- foreach($product as $pv) {
|
|
|
|
|
- if ($config) {
|
|
|
|
|
|
|
+ foreach($product as $key => $pv) {
|
|
|
|
|
+ if (isset($list[$pv['type']]['config'])) {
|
|
|
|
|
+ $config = $list[$pv['type']]['config'];
|
|
|
if (empty($config['range'])) {
|
|
if (empty($config['range'])) {
|
|
|
$config['range'][] = $config;
|
|
$config['range'][] = $config;
|
|
|
}
|
|
}
|
|
@@ -56,13 +61,16 @@ class RechargeChannel extends BaseModel
|
|
|
} else {
|
|
} else {
|
|
|
$config = $pv;
|
|
$config = $pv;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ $list[$pv['type']] = [
|
|
|
|
|
+ 'key' => $key,
|
|
|
|
|
+ 'label' => lang($pv['name']),
|
|
|
|
|
+ 'value' => $pv['type'],
|
|
|
|
|
+ 'config' => $config ?? [],
|
|
|
|
|
+ ];
|
|
|
}
|
|
}
|
|
|
- $list[] = [
|
|
|
|
|
- 'label' => lang($pv['type']),
|
|
|
|
|
- 'value' => $pv['type'],
|
|
|
|
|
- 'config' => $config ?? [],
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+ $list = array_column($list, null, 'key');
|
|
|
|
|
|
|
|
- return $list;
|
|
|
|
|
|
|
+ return array_values($list);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|