Commit 7df42407 authored by ligaishun's avatar ligaishun

新增钱包代解锁接口

parent 258c9ec8
......@@ -456,4 +456,39 @@ func FeedBackStatus(c *gin.Context){
}
appG.Response(http.StatusOK,e.NETWORK_ERROR,"网络出错")
log.Println(results)
}
func EscrowPasswd(c *gin.Context){
var passwd map[string]string
appG:=app.Gin{C:c}
err:=appG.C.ShouldBindJSON(&passwd)
if err!=nil{
appG.Response(http.StatusOK,e.INVALID_PARAMS,nil)
tlog.Info("invalid params")
return
}
r,errs:=setting.PaiClient.Unlock(&types.WalletUnLock{
Passwd: passwd["password"],
Timeout: 0,
WalletOrTicket: false,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
})
if errs!=nil{
appG.Response(http.StatusOK,e.NODE_ERROR,nil)
tlog.Info("节点故障")
return
}//覆盖原有密码
if !r.IsOk{
appG.Response(http.StatusOK,e.ERROR_AUTH,r.Msg)
tlog.Info("Auth Faild")
return
}
f,err:=os.OpenFile(setting.BityuanSetting.Passwd,os.O_WRONLY|os.O_TRUNC|os.O_CREATE,0666)
defer f.Close()
f.WriteString(passwd["password"])
appG.Response(http.StatusOK,e.SUCCESS,nil)
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment