public function getUserByKey() { $keyId = Input::post('key'); $key = Key::findOne(['id' => $keyId]); if (!empty($key)) { $account = Account::findOne(['uid' => $key->uid]); if (!empty($account)) { Response::json(['code' => 0, 'data' => ['key' => $key, 'name' => $account->identifier]]); return; } } Response::json(['code' => 1, 'message' => '未获取帐号信息']); }
private function _pushCommandAccessCheck($repo, $keyId) { $result = false; if (!empty($repo)) { $key = Key::findOne(['id' => $keyId]); $project = Project::findOne(['identifier' => $repo]); if (empty($key)) { Exception::throwException(20001); } if (empty($project)) { Exception::throwException(20002); } if ($key->uid == $project->uid) { $result = true; } } return $result; }