1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php namespace Api\Api;
- use Dever;
- use Manage\Lib\Auth;
- class Manage extends Auth
- {
- # 将sku中的key解析成前端可以读取的格式
- public function keyToField($key, $param = array())
- {
- $project = $param['project'] ?? 'api';
- if ($key != -1) {
- $result = array();
- $array = explode(',', $key);
- $result['key']['set'] = array();
- foreach ($array as $k => $v) {
- $value = Dever::db('spec_value', $project)->find($v);
- if ($value) {
- $spec = Dever::db('spec', $project)->find($value['spec_id']);
- $result['key']['set']['s_' . $spec['id']] = array($spec['name'], $value['value']);
- }
- }
- return $result;
- }
- }
- # 获取参数设置表的参数名
- public function getSettingName($value = false)
- {
- if ($value) {
- $info = Dever::db('platform_setting', 'api')->find($value);
- $result['key']['value'] = $info['key'];
- return $result;
- }
- }
- # 获取参数设置表的参数名
- public function getCertName($value = false)
- {
- if ($value) {
- $info = Dever::db('platform_cert', 'api')->find($value);
- $result['type']['value'] = $info['type'];
- return $result;
- }
- }
- # 根据平台获取接口
- public function getApi($value = false)
- {
- if ($value) {
- $where['platform_id'] = $value;
- $result['api_id']['value'] = '';
- $result['api_id']['option'] = Dever::db('api', 'api')->select($where);
- return $result;
- }
- }
- # 根据应用获取平台
- public function getAppPlatform()
- {
- return Dever::load('common', 'manage')->cascader(2, function($level, $parent) {
- if ($level == 1) {
- $data = Dever::db('app', 'api')->select([]);
- } elseif ($level == 2) {
- $data = Dever::load('app', 'api')->getPlatform($parent);
- }
- return $data;
- });
- }
- }
|