-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
64 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
package wx | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Khan/genqlient/graphql" | ||
"github.com/twiglab/crm/member/pkg/data" | ||
"github.com/twiglab/crm/member/pkg/low" | ||
) | ||
|
||
type MemberCli struct { | ||
client graphql.Client | ||
} | ||
|
||
func NewMemberCli(client graphql.Client) *MemberCli { | ||
return &MemberCli{client: client} | ||
} | ||
|
||
func (c *MemberCli) Add(ctx context.Context, wxOpenID string) error { | ||
_, err := low.QueryWxMember(ctx, c.client, data.OpenIDReq{WxOpenID: wxOpenID}) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package wx | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Khan/genqlient/graphql" | ||
"github.com/twiglab/crm/wechat/pkg/data" | ||
"github.com/twiglab/crm/wechat/pkg/low" | ||
) | ||
|
||
type WxCli struct { | ||
client graphql.Client | ||
} | ||
|
||
func (c *WxCli) AuthUser(ctx context.Context, jsCode string) error { | ||
_, err := low.AuthUser(ctx, c.client, data.JsCodeReq{JsCode: jsCode}) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} |