config
This commit is contained in:
parent
566a03e1e3
commit
24b37e9299
|
@ -23,13 +23,18 @@ type QyWeixin struct {
|
|||
func (q *QyWeixin) Approve(ctx *gin.Context) {
|
||||
cfg := config.GetConfig()
|
||||
cid := cast.ToInt64(ctx.Param("cid"))
|
||||
corp, err := dao.NewCorpDao().Get(cid)
|
||||
if err != nil || corp == nil {
|
||||
panic(config.ErrParam.New().Append(err))
|
||||
}
|
||||
|
||||
approve := service.NewApprove(cid)
|
||||
corpConfig := corp.GetConfig()
|
||||
approve := service.NewApprove(corp)
|
||||
reply := approve.Reply
|
||||
qyApp := qyweixin.NewApp(&qyweixin.AppConfig{
|
||||
Corpid: cfg.QyWeixin.Corpid,
|
||||
Secret: cfg.QyWeixin.ApproveSecret,
|
||||
Agent: cfg.QyWeixin.ApproveAgent,
|
||||
Corpid: corpConfig.CorpId,
|
||||
Secret: corpConfig.ApproveSecret,
|
||||
Agent: corpConfig.ApproveAgent,
|
||||
Token: config.QyWeixinAgentToken,
|
||||
AesKey: config.QyWeixinAgentAesKey,
|
||||
Replay: reply,
|
||||
|
|
|
@ -32,8 +32,7 @@ type Approve struct {
|
|||
approveClient *qyweixin.AppApprove
|
||||
}
|
||||
|
||||
func NewApprove(cid int64) *Approve {
|
||||
corp, _ := dao.NewCorpDao().Get(cid)
|
||||
func NewApprove(corp *model.Corp) *Approve {
|
||||
return &Approve{
|
||||
corp: corp,
|
||||
corpConfig: corp.GetConfig(),
|
||||
|
|
Loading…
Reference in New Issue