github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/mp/shakearound/device/applystatus.go (about)

     1  package device
     2  
     3  import (
     4  	"github.com/chanxuehong/wechat/mp/core"
     5  )
     6  
     7  type ApplyStatus struct {
     8  	ApplyTime    int64  `json:"apply_time"`    // 提交申请的时间戳
     9  	AuditStatus  int    `json:"audit_status"`  // 审核状态。0:审核未通过、1:审核中、2:审核已通过;审核会在三个工作日内完成
    10  	AuditComment string `json:"audit_comment"` // 审核备注,包括审核不通过的原因
    11  	AuditTime    int64  `json:"audit_time"`    // 确定审核结果的时间戳,若状态为审核中,则该时间值为0
    12  }
    13  
    14  // 查询设备ID申请审核状态
    15  func GetApplyStatus(clt *core.Client, applyId int64) (status *ApplyStatus, err error) {
    16  	request := struct {
    17  		ApplyId int64 `json:"apply_id"`
    18  	}{
    19  		ApplyId: applyId,
    20  	}
    21  
    22  	var result struct {
    23  		core.Error
    24  		ApplyStatus `json:"data"`
    25  	}
    26  
    27  	incompleteURL := "https://api.weixin.qq.com/shakearound/device/applystatus?access_token="
    28  	if err = clt.PostJSON(incompleteURL, &request, &result); err != nil {
    29  		return
    30  	}
    31  
    32  	if result.ErrCode != core.ErrCodeOK {
    33  		err = &result.Error
    34  		return
    35  	}
    36  	status = &result.ApplyStatus
    37  	return
    38  }