refactor codes

1. change controller.js, add "constants" declaration.