restruect code done

1. enhanced the web api
2. moduleize the common function enty
3. make it more flexible