select(array('app_func_id' => $data['id'])); if ($func) { $platform = array(); Dever::db('app_platform', 'api')->delete(array('app_id' => $data['app_id'])); foreach ($func as $k => $v) { $api = Dever::db('api', 'api')->find($v['api_id']); if ($api) { $platform[$api['platform_id']] = $api['platform_id']; } } foreach ($platform as $k => $v) { Dever::db('app_platform', 'api')->insert(array('app_id' => $data['app_id'], 'platform_id' => $v)); } } } public function updateApi($db, $data) { if (isset($data['notify']) && $data['notify'] == 2) { Dever::db('api/api_notify')->delete(array('api_id' => $data['id'])); } } public function getPlatform($app) { $set['join'] = array ( array ( 'table' => 'platform', 'type' => 'left join', 'on' => 'platform.id=app_platform.platform_id', ), ); $set['col'] = 'platform.id as id,platform.name as name'; $platform = Dever::db('app_platform', 'api')->select(array('app_id' => $app), $set); return $platform; } public function getSetting($platform_id) { return Dever::db('platform_setting', 'api')->select(array('platform_id' => $platform_id)); } public function getCert($platform_id) { return Dever::db('platform_cert', 'api')->select(array('platform_id' => $platform_id)); } public function getCertName($id) { $info = Dever::db('platform_cert', 'api')->find($id); return $info['name']; } public function getApi($func_id, $env = 1) { $set['join'] = array ( array ( 'table' => 'api', 'type' => 'left join', 'on' => 'api.id=app_func_work.api_id', ), ); $set['col'] = 'api.*'; $set['order'] = 'app_func_work.sort asc,api.id desc'; $where['app_func_work.app_func_id'] = $func_id; if ($env) { $where['api.env'] = $env; } return Dever::db('app_func_work', 'api')->select($where, $set); } public function getAppPlatform($app_id, $platform_id) { $app = Dever::db('app', 'api')->find($app_id); $platform = Dever::db('platform', 'api')->find($platform_id); return $app['name'] . '-' . $platform['name']; } }