use of org.nutz.mvc.annotation.At in project nutzboot by nutzam.
the class MainLauncher method make.
@AdaptBy(type = JsonAdaptor.class)
@At("/maker/make")
@Ok("json:full")
public NutMap make(@Param("..") NutMap params) throws IOException {
NutMap re = new NutMap();
String key = R.UU32();
File tmpRoot = Files.createDirIfNoExists(tmpDir + "/" + key);
build(tmpRoot, params);
re.put("key", key);
re.put("ok", true);
return re;
}
use of org.nutz.mvc.annotation.At in project nutzboot by nutzam.
the class EthModule method remoteAccounts.
@At("/remote/accounts")
public NutMap remoteAccounts() {
Map<String, Web3jAccount> accounts = new HashMap<>();
try {
List<String> accountAddrs = web3j.ethAccounts().send().getAccounts();
for (String address : accountAddrs) {
Web3jAccount account = new Web3jAccount();
account.setBanlance(web3j.ethGetBalance(address, DefaultBlockParameterName.LATEST).send().getBalance());
account.setAddress(address);
account.setName(address.substring(0, 8));
accounts.put(account.getName(), account);
}
return new NutMap("ok", true).setv("data", accounts);
} catch (IOException e) {
log.info("something happen", e);
return new NutMap("msg", e.getMessage());
}
}
use of org.nutz.mvc.annotation.At in project nutz by nutzam.
the class UserModule method add.
@POST
@At
public NutMap add(@Param("..") User user) {
NutMap re = new NutMap("ok", false);
if (Strings.isBlank(user.getName()))
return re.setv("msg", "名字不能是空");
if (Strings.isBlank(user.getPassword()))
return re.setv("msg", "密码不能是空");
dao.insert(user);
return re.setv("ok", true);
}
use of org.nutz.mvc.annotation.At in project nutz by nutzam.
the class UserModule method list.
@At
public QueryResult list(@Param("..") Pager pager) {
List<User> users = dao.query(User.class, null, pager);
pager.setRecordCount(dao.count(User.class));
QueryResult qr = new QueryResult(users, pager);
return qr;
}
use of org.nutz.mvc.annotation.At in project nutzboot by nutzam.
the class MainLauncher method index.
@At({ "/", "/index" })
@Ok("vm:/index.vm")
public NutMap index() {
NutMap obj = new NutMap();
obj.setv("name", "牛牪犇").setv("age", 18);
return obj;
}
Aggregations