采用Beego作为web框架,访问Beego官网来获得更多相关的信息
利用该平台可以查询链上的所有订单、司机还有转账记录信息
-
配置Golang环境
访问Golang官网 安装对应的Goalng运行环境,并且设置好$GOROOT和$GOPATH
Golang版本应该高于1.8
项目文件夹应该放置在src目录下 一个设定好的$GOPATH应该有如下的目录组织
$GOPATH
src
travision
cd $GOPATH/src/travision
-
配置Beego包(可选)
参见Beego官网
若不需要进一步对web框架进行开发,也可以直接使用项目内置的包,参见3 -
配置相应的包
编译所需要的依赖库都包含在vendor
文件夹下
cd vendor
cp -rf . $GOPATH/src
注意:如果已经配置了Beego环境,则忽略vendor/github.com/astaxie/beego
-
修改IP
根据部署链的服务器的IP修改travision/gocode/const/const.go
中IP参数 -
部署合约
合约代码存放在onekey/contract/
中
第一次使用时我们需要重新部署合约,并更新gocode/contract/const.go
中的参数,具体参看onekey
目录下README -
启动服务
cd $GOPATH/src/travision
go build
./travision
即可打开服务,开始监听8080端口。浏览器打开即可使用监控平台。
-
平台每次刷新都会从合约中获取最新的数据,所以刷新时间较长是正常的,可以从运行
./travision
的终端看到数据读取的进度 -
example
中为一个完整流程的例子,可以参考