This commit is contained in:
jiangyong27 2025-01-08 12:53:00 +08:00
parent 566a03e1e3
commit 24b37e9299
2 changed files with 10 additions and 6 deletions

View File

@ -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,

View File

@ -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(),