/** * Create a new app key * * <b>Request Type</b>: POST<br/><br/> * <b>Request Endpoint</b>:http://{server-domain}/management/app-keys<br/><br/> * <b>Content-type</b>: application/json<br/><br/> * <b>Summary</b>: This api is used for billing account to create a new app key * <br/><br/> * * <b>Request Params</b>:<br/> * name: string, the app name, required<br/> * content: string, the app description, required<br/> * <br/><br/> * * <b>Request Example:</b><br/> * <pre> * { * "name" : "不宅人", * "content" : "不宅人是一款徒步APP" * } * </pre> * <br/><br/> * * <b>Response Example</b>:<br/> * <pre> * { * "id": "5524d4ac2736e7f5048b4567", * "name": "爱不宅", * "content" : "不宅人是一款徒步APP", * "privateKey": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6InV3aW1zY3Ryb2UifQ.eyJ1aWQiOiI1NGEwZTBkMTI3MzZlN2QyMDQ4YjQ1NjkiLCJzY29wZXMiOltdLCJhcHAiOiI1NTI0ZDRhYzI3MzZlN2Y1MDQ4YjQ1NjcifQ.BRVjkrm7M5speEDhVpCVsIKkJioD8PVcAhxC-Zm9P5g" * } * </pre> */ public function actionCreate() { $name = $this->getParams('name'); $content = $this->getParams('content', ''); $icon = $this->getParams('icon', ''); $app = new Applications(); $app->_id = new \MongoId(); $app->name = $name; $app->content = $content; $app->icon = $icon; $token = Token::getToken(); $app->accountId = $token->accountId; $app->generateKey(); return $app->validateSave(); }