From 97c07373fd4feff051c92881dc0db15e8d100904 Mon Sep 17 00:00:00 2001 From: Samoye <849688611@qq.com> Date: Wed, 10 Jun 2020 09:25:17 +0800 Subject: [PATCH 1/2] change container get/set --- core/Container.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/Container.go b/core/Container.go index 7bced7a..3aa2bf4 100644 --- a/core/Container.go +++ b/core/Container.go @@ -9,8 +9,8 @@ import ( var C container type container struct { - accountObj map[string]interface{} - miniProgramObj map[string]interface{} + accountObj map[string]*Account.WxAccount + miniProgramObj map[string]*MiniProgram.WxMiniProgram } const( ACCOUNT=iota @@ -19,29 +19,29 @@ const( func Init(){ C=container{ - accountObj: make(map[string]interface{}), - miniProgramObj: make(map[string]interface{}), + accountObj: make(map[string]*Account.WxAccount), + miniProgramObj: make(map[string]*MiniProgram.WxMiniProgram ), } } -func (c container)GetAccount(name string) interface{} { +func (c container)GetAccount(name string) *Account.WxAccount { if v,exist:=c.accountObj[name];exist{ return v } return nil } -func(c container)SetAccount(name string,obj interface{}){ +func(c container)SetAccount(name string,obj *Account.WxAccount){ if obj!=nil{ c.accountObj[name]=obj } } -func (c container)GetMiniProgram(name string) interface{} { +func (c container)GetMiniProgram(name string) *MiniProgram.WxMiniProgram { if v,exist:=c.miniProgramObj[name];exist{ return v } return nil } -func(c container)SetMiniProgram(name string,obj interface{}){ +func(c container)SetMiniProgram(name string,obj *MiniProgram.WxMiniProgram ){ if obj!=nil{ c.miniProgramObj[name]=obj } -- Gitee From 599f8535d16cb54c059358aa23e97c11e973855e Mon Sep 17 00:00:00 2001 From: Samoye <849688611@qq.com> Date: Wed, 10 Jun 2020 09:28:50 +0800 Subject: [PATCH 2/2] change container get/set --- core/Container.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Container.go b/core/Container.go index 3aa2bf4..826c1ae 100644 --- a/core/Container.go +++ b/core/Container.go @@ -6,7 +6,7 @@ import ( MiniProgram "gitee.com/yizhisamoye/GoWeChat/miniProgram" "strings" ) -var C container +var WX container type container struct { accountObj map[string]*Account.WxAccount @@ -18,7 +18,7 @@ const( ) func Init(){ - C=container{ + WX=container{ accountObj: make(map[string]*Account.WxAccount), miniProgramObj: make(map[string]*MiniProgram.WxMiniProgram ), } -- Gitee