OSDN Git Service

Merge branch 'master' into zhouyasong-patch-1
authorgguoss <1536310027@qq.com>
Fri, 15 Sep 2017 09:30:34 +0000 (17:30 +0800)
committergguoss <1536310027@qq.com>
Fri, 15 Sep 2017 09:30:34 +0000 (17:30 +0800)
1  2 
blockchain/reactor.go
cmd/bytomcli/main.go

Simple merge
@@@ -353,31 -345,44 +354,44 @@@ func createAsset(client *rpc.Client, ar
        ins.Quorum = 1
        ins.Alias = "bob"
        ins.Tags = map[string]interface{}{"test_tag": "v0",}
 -      ins.Definition = map[string]interface{}{"test_definition": "v0"}
 +      ins.Definition = map[string]interface{}{}
        ins.ClientToken = args[0]
-       responses := make([]interface{}, 50)
-       client.Call(context.Background(), "/create-asset", &[]Ins{ins,}, &responses)
+       assets := make([]query.AnnotatedAsset, 1)
+       client.Call(context.Background(), "/create-asset", &[]Ins{ins,}, &assets)
        //dieOnRPCError(err)
-       fmt.Printf("responses:%v\n", responses)
+       fmt.Printf("responses:%v\n", assets)
  }
  
- func updateAccountTags(client *rpc.Client,args []string){
-       if len(args) != 0{
-               fatalln("error:updateAccountTags not use args")
+ func updateAccountTags(client *rpc.Client, args []string) {
+       if len(args) != {
+               fatalln("update-account-tags [<ID>|<alias>] [tags_key:<tags_value>]")
        }
        type Ins struct {
-       ID    *string
-       Alias *string
-       Tags  map[string]interface{} `json:"tags"`
- }
+               ID    *string
+               Alias *string
+               Tags  map[string]interface{} `json:"tags"`
      }
        var ins Ins
-       aa := "1234"
-       alias := "asdfg"
-       ins.ID = &aa
-       ins.Alias = &alias
-       ins.Tags = map[string]interface{}{"test_tag": "v0",}
+       //TODO:(1)when alias = acc...,how to do;
+       //TODO:(2)support more tags together
+       if "acc" == args[0][:3] {
+               ins.ID = &args[0]
+               ins.Alias = nil
+       } else {
+               ins.Alias = &args[0]
+               ins.ID = nil
+       }
+       tags := strings.Split(args[1], ":")
+       if len(tags) != 2 {
+               fatalln("update-account-tags [<ID>|<alias>] [tags_key:<tags_value>]")
+       }
+       ins.Tags = map[string]interface{}{tags[0]: tags[1]}
        responses := make([]interface{}, 50)
-       client.Call(context.Background(), "/update-account-tags", &[]Ins{ins,}, &responses)
+       client.Call(context.Background(), "/update-account-tags", &[]Ins{ins}, &responses)
        fmt.Printf("responses:%v\n", responses)
  }