1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-23 13:42:25 +08:00

Compare commits

...

9 Commits

Author SHA1 Message Date
Thinker
af158c680a Merge branch 'silenceper:v2' into v2 2023-10-09 15:24:39 +08:00
Thinker
12f76c4b67 refactor:修改字段名称以符合golint标准 2023-10-09 15:22:52 +08:00
曹晶
da5067bcb2 fix(work): fix json Unmarshal Error in GetExternalUserDetail api (#732)
fix json Unmarshal Error, err=json: cannot unmarshal number into Go struct field
WechatChannel.follow_user.wechat_channels.source of type string
2023-10-09 02:02:37 -05:00
Thinker
0359086e28 refactor:重命名checkin为record(该文件内所有方法均为获取记录) 2023-10-09 14:55:34 +08:00
Thinker
aea22236be feat: 企业微信-打卡-月报数据 2023-10-09 14:55:02 +08:00
Thinker
e8c430e0a3 feat: 企业微信-打卡-日报数据 2023-10-09 14:49:47 +08:00
houseme
8f10936479 fix: util.DecodeWithError result (#729) 2023-10-07 12:55:11 +08:00
曹晶
9bfebc8a27 fix(work): fix DepartmentGet with commonError is invalid or not struct (#728)
fix DepartmentGet with commonError is invalid or not struct
2023-09-25 14:15:33 +08:00
silenceper
4f6cbc3d59 remove goreleaser (#727) 2023-09-24 20:24:15 +08:00
10 changed files with 341 additions and 189 deletions

View File

@@ -1,29 +0,0 @@
name: goreleaser
on:
push:
tags:
- '*'
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.16
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,29 +0,0 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod download
# you may remove this if you don't need go generate
- go generate ./...
builds:
- skip: true
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

View File

@@ -116,5 +116,14 @@ host: https://qyapi.weixin.qq.com/
| ---------------- | -------- | --------------------- | ---------- | -------------------------- | -------- | | ---------------- | -------- | --------------------- | ---------- | -------------------------- | -------- |
| 群机器人发送消息 | POST | /cgi-bin/webhook/send | YES | (r *Client) RobotBroadcast | chcthink | | 群机器人发送消息 | POST | /cgi-bin/webhook/send | YES | (r *Client) RobotBroadcast | chcthink |
## 打卡
[官方文档](https://developer.work.weixin.qq.com/document/path/96497)
| 名称 | 请求方式 | URL | 是否已实现 | 使用方法 | 贡献者 |
|----------| -------- | --------------------- | ---------- | -------------------------- |---------|
| 获取打卡日报数据 | POST | /cgi-bin/checkin/getcheckin_daydata | YES | (r *Client) GetDayData | Thinker |
| 获取打卡月报数据 | POST | /cgi-bin/checkin/getcheckin_monthdata | YES | (r *Client) GetMonthData | Thinker |
## 应用管理 ## 应用管理
TODO TODO

View File

@@ -180,7 +180,7 @@ type MediaInfo struct {
CreateTime int64 `json:"create_time"` // 上传时间,时间戳。 CreateTime int64 `json:"create_time"` // 上传时间,时间戳。
ExpireTime int64 `json:"expire_time"` // 过期时间,时间戳。 ExpireTime int64 `json:"expire_time"` // 过期时间,时间戳。
DramaID int64 `json:"drama_id"` // 所属剧目 id。 DramaID int64 `json:"drama_id"` // 所属剧目 id。
FileSize string `json:"file_size"` // 媒资文件大小,单位:字节。 FileSize int64 `json:"file_size"` // 媒资文件大小,单位:字节。
Duration int64 `json:"duration"` // 播放时长,单位:秒。 Duration int64 `json:"duration"` // 播放时长,单位:秒。
Name string `json:"name"` // 媒资文件名。 Name string `json:"name"` // 媒资文件名。
Description string `json:"description"` // 描述。 Description string `json:"description"` // 描述。

View File

@@ -27,7 +27,7 @@ import (
) )
// SingleFileUpload 单文件上传 // SingleFileUpload 单文件上传
func (s *MiniDrama) SingleFileUpload(ctx context.Context, in *SingleFileUploadRequest) (out *SingleFileUploadResponse, err error) { func (s *MiniDrama) SingleFileUpload(ctx context.Context, in *SingleFileUploadRequest) (out SingleFileUploadResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, singleFileUpload); err != nil { if address, err = s.requestAddress(ctx, singleFileUpload); err != nil {
return return
@@ -76,12 +76,12 @@ func (s *MiniDrama) SingleFileUpload(ctx context.Context, in *SingleFileUploadRe
return return
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "SingleFileUpload") err = util.DecodeWithError(response, &out, "SingleFileUpload")
return return
} }
// PullUpload 拉取上传 // PullUpload 拉取上传
func (s *MiniDrama) PullUpload(ctx context.Context, in *PullUploadRequest) (out *PullUploadResponse, err error) { func (s *MiniDrama) PullUpload(ctx context.Context, in *PullUploadRequest) (out PullUploadResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, pullUpload); err != nil { if address, err = s.requestAddress(ctx, pullUpload); err != nil {
return return
@@ -92,12 +92,12 @@ func (s *MiniDrama) PullUpload(ctx context.Context, in *PullUploadRequest) (out
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "PullUpload") err = util.DecodeWithError(response, &out, "PullUpload")
return return
} }
// GetTask 查询任务状态 // GetTask 查询任务状态
func (s *MiniDrama) GetTask(ctx context.Context, in *GetTaskRequest) (out *GetTaskResponse, err error) { func (s *MiniDrama) GetTask(ctx context.Context, in *GetTaskRequest) (out GetTaskResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, getTask); err != nil { if address, err = s.requestAddress(ctx, getTask); err != nil {
return return
@@ -109,12 +109,12 @@ func (s *MiniDrama) GetTask(ctx context.Context, in *GetTaskRequest) (out *GetTa
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "GetTask") err = util.DecodeWithError(response, &out, "GetTask")
return return
} }
// ApplyUpload 申请分片上传 // ApplyUpload 申请分片上传
func (s *MiniDrama) ApplyUpload(ctx context.Context, in *ApplyUploadRequest) (out *ApplyUploadResponse, err error) { func (s *MiniDrama) ApplyUpload(ctx context.Context, in *ApplyUploadRequest) (out ApplyUploadResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, applyUpload); err != nil { if address, err = s.requestAddress(ctx, applyUpload); err != nil {
return return
@@ -126,13 +126,13 @@ func (s *MiniDrama) ApplyUpload(ctx context.Context, in *ApplyUploadRequest) (ou
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "ApplyUpload") err = util.DecodeWithError(response, &out, "ApplyUpload")
return return
} }
// UploadPart 上传分片 // UploadPart 上传分片
// Content-Type 需要指定为 multipart/form-data; boundary=<delimiter><箭头括号>表示必须替换为有效值的变量。 // Content-Type 需要指定为 multipart/form-data; boundary=<delimiter><箭头括号>表示必须替换为有效值的变量。
func (s *MiniDrama) UploadPart(ctx context.Context, in *UploadPartRequest) (out *UploadPartResponse, err error) { func (s *MiniDrama) UploadPart(ctx context.Context, in *UploadPartRequest) (out UploadPartResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, uploadPart); err != nil { if address, err = s.requestAddress(ctx, uploadPart); err != nil {
return return
@@ -165,12 +165,12 @@ func (s *MiniDrama) UploadPart(ctx context.Context, in *UploadPartRequest) (out
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "UploadPart") err = util.DecodeWithError(response, &out, "UploadPart")
return return
} }
// CommitUpload 确认上传 // CommitUpload 确认上传
func (s *MiniDrama) CommitUpload(ctx context.Context, in *CommitUploadRequest) (out *CommitUploadResponse, err error) { func (s *MiniDrama) CommitUpload(ctx context.Context, in *CommitUploadRequest) (out CommitUploadResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, commitUpload); err != nil { if address, err = s.requestAddress(ctx, commitUpload); err != nil {
return return
@@ -182,12 +182,12 @@ func (s *MiniDrama) CommitUpload(ctx context.Context, in *CommitUploadRequest) (
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "CommitUpload") err = util.DecodeWithError(response, &out, "CommitUpload")
return return
} }
// ListMedia 获取媒体列表 // ListMedia 获取媒体列表
func (s *MiniDrama) ListMedia(ctx context.Context, in *ListMediaRequest) (out *ListMediaResponse, err error) { func (s *MiniDrama) ListMedia(ctx context.Context, in *ListMediaRequest) (out ListMediaResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, listMedia); err != nil { if address, err = s.requestAddress(ctx, listMedia); err != nil {
return return
@@ -199,12 +199,12 @@ func (s *MiniDrama) ListMedia(ctx context.Context, in *ListMediaRequest) (out *L
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "ListMedia") err = util.DecodeWithError(response, &out, "ListMedia")
return return
} }
// GetMedia 获取媒资详细信息 // GetMedia 获取媒资详细信息
func (s *MiniDrama) GetMedia(ctx context.Context, in *GetMediaRequest) (out *GetMediaResponse, err error) { func (s *MiniDrama) GetMedia(ctx context.Context, in *GetMediaRequest) (out GetMediaResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, getMedia); err != nil { if address, err = s.requestAddress(ctx, getMedia); err != nil {
return return
@@ -216,12 +216,12 @@ func (s *MiniDrama) GetMedia(ctx context.Context, in *GetMediaRequest) (out *Get
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "GetMedia") err = util.DecodeWithError(response, &out, "GetMedia")
return return
} }
// GetMediaLink 获取媒资播放链接 // GetMediaLink 获取媒资播放链接
func (s *MiniDrama) GetMediaLink(ctx context.Context, in *GetMediaLinkRequest) (out *GetMediaLinkResponse, err error) { func (s *MiniDrama) GetMediaLink(ctx context.Context, in *GetMediaLinkRequest) (out GetMediaLinkResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, getMediaLink); err != nil { if address, err = s.requestAddress(ctx, getMediaLink); err != nil {
return return
@@ -233,12 +233,12 @@ func (s *MiniDrama) GetMediaLink(ctx context.Context, in *GetMediaLinkRequest) (
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "GetMediaLink") err = util.DecodeWithError(response, &out, "GetMediaLink")
return return
} }
// DeleteMedia 删除媒体 // DeleteMedia 删除媒体
func (s *MiniDrama) DeleteMedia(ctx context.Context, in *DeleteMediaRequest) (out *DeleteMediaResponse, err error) { func (s *MiniDrama) DeleteMedia(ctx context.Context, in *DeleteMediaRequest) (out DeleteMediaResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, deleteMedia); err != nil { if address, err = s.requestAddress(ctx, deleteMedia); err != nil {
return return
@@ -250,12 +250,12 @@ func (s *MiniDrama) DeleteMedia(ctx context.Context, in *DeleteMediaRequest) (ou
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "DeleteMedia") err = util.DecodeWithError(response, &out, "DeleteMedia")
return return
} }
// AuditDrama 审核剧本 // AuditDrama 审核剧本
func (s *MiniDrama) AuditDrama(ctx context.Context, in *AuditDramaRequest) (out *AuditDramaResponse, err error) { func (s *MiniDrama) AuditDrama(ctx context.Context, in *AuditDramaRequest) (out AuditDramaResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, auditDrama); err != nil { if address, err = s.requestAddress(ctx, auditDrama); err != nil {
return return
@@ -267,12 +267,12 @@ func (s *MiniDrama) AuditDrama(ctx context.Context, in *AuditDramaRequest) (out
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "AuditDrama") err = util.DecodeWithError(response, &out, "AuditDrama")
return return
} }
// ListDramas 获取剧目列表 // ListDramas 获取剧目列表
func (s *MiniDrama) ListDramas(ctx context.Context, in *ListDramasRequest) (out *ListDramasResponse, err error) { func (s *MiniDrama) ListDramas(ctx context.Context, in *ListDramasRequest) (out ListDramasResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, listDramas); err != nil { if address, err = s.requestAddress(ctx, listDramas); err != nil {
return return
@@ -284,12 +284,12 @@ func (s *MiniDrama) ListDramas(ctx context.Context, in *ListDramasRequest) (out
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "ListDramas") err = util.DecodeWithError(response, &out, "ListDramas")
return return
} }
// GetDrama 获取剧目信息 // GetDrama 获取剧目信息
func (s *MiniDrama) GetDrama(ctx context.Context, in *GetDramaRequest) (out *GetDramaResponse, err error) { func (s *MiniDrama) GetDrama(ctx context.Context, in *GetDramaRequest) (out GetDramaResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, getDrama); err != nil { if address, err = s.requestAddress(ctx, getDrama); err != nil {
return return
@@ -300,12 +300,12 @@ func (s *MiniDrama) GetDrama(ctx context.Context, in *GetDramaRequest) (out *Get
return return
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "GetDrama") err = util.DecodeWithError(response, &out, "GetDrama")
return return
} }
// GetCdnUsageData 查询 CDN 用量数据 // GetCdnUsageData 查询 CDN 用量数据
func (s *MiniDrama) GetCdnUsageData(ctx context.Context, in *GetCdnUsageDataRequest) (out *GetCdnUsageDataResponse, err error) { func (s *MiniDrama) GetCdnUsageData(ctx context.Context, in *GetCdnUsageDataRequest) (out GetCdnUsageDataResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, getCdnUsageData); err != nil { if address, err = s.requestAddress(ctx, getCdnUsageData); err != nil {
return return
@@ -316,12 +316,12 @@ func (s *MiniDrama) GetCdnUsageData(ctx context.Context, in *GetCdnUsageDataRequ
return return
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "GetCdnUsageData") err = util.DecodeWithError(response, &out, "GetCdnUsageData")
return return
} }
// GetCdnLogs 查询 CDN 日志 // GetCdnLogs 查询 CDN 日志
func (s *MiniDrama) GetCdnLogs(ctx context.Context, in *GetCdnLogsRequest) (out *GetCdnLogsResponse, err error) { func (s *MiniDrama) GetCdnLogs(ctx context.Context, in *GetCdnLogsRequest) (out GetCdnLogsResponse, err error) {
var address string var address string
if address, err = s.requestAddress(ctx, getCdnLogs); err != nil { if address, err = s.requestAddress(ctx, getCdnLogs); err != nil {
return return
@@ -332,7 +332,7 @@ func (s *MiniDrama) GetCdnLogs(ctx context.Context, in *GetCdnLogsRequest) (out
return return
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "GetCdnLogs") err = util.DecodeWithError(response, &out, "GetCdnLogs")
return return
} }

View File

@@ -37,7 +37,7 @@ func (s *VirtualPayment) SetSessionKey(sessionKey string) {
} }
// QueryUserBalance 查询虚拟支付余额 // QueryUserBalance 查询虚拟支付余额
func (s *VirtualPayment) QueryUserBalance(ctx context.Context, in *QueryUserBalanceRequest) (out *QueryUserBalanceResponse, err error) { func (s *VirtualPayment) QueryUserBalance(ctx context.Context, in *QueryUserBalanceRequest) (out QueryUserBalanceResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -60,12 +60,12 @@ func (s *VirtualPayment) QueryUserBalance(ctx context.Context, in *QueryUserBala
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "QueryUserBalance") err = util.DecodeWithError(response, &out, "QueryUserBalance")
return return
} }
// CurrencyPay currency pay 扣减代币(一般用于代币支付) // CurrencyPay currency pay 扣减代币(一般用于代币支付)
func (s *VirtualPayment) CurrencyPay(ctx context.Context, in *CurrencyPayRequest) (out *CurrencyPayResponse, err error) { func (s *VirtualPayment) CurrencyPay(ctx context.Context, in *CurrencyPayRequest) (out CurrencyPayResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -88,12 +88,12 @@ func (s *VirtualPayment) CurrencyPay(ctx context.Context, in *CurrencyPayRequest
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "CurrencyPay") err = util.DecodeWithError(response, &out, "CurrencyPay")
return return
} }
// QueryOrder 查询创建的订单(现金单,非代币单) // QueryOrder 查询创建的订单(现金单,非代币单)
func (s *VirtualPayment) QueryOrder(ctx context.Context, in *QueryOrderRequest) (out *QueryOrderResponse, err error) { func (s *VirtualPayment) QueryOrder(ctx context.Context, in *QueryOrderRequest) (out QueryOrderResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -116,12 +116,12 @@ func (s *VirtualPayment) QueryOrder(ctx context.Context, in *QueryOrderRequest)
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "QueryOrder") err = util.DecodeWithError(response, &out, "QueryOrder")
return return
} }
// CancelCurrencyPay 取消订单 代币支付退款 (currency_pay 接口的逆操作) // CancelCurrencyPay 取消订单 代币支付退款 (currency_pay 接口的逆操作)
func (s *VirtualPayment) CancelCurrencyPay(ctx context.Context, in *CancelCurrencyPayRequest) (out *CancelCurrencyPayResponse, err error) { func (s *VirtualPayment) CancelCurrencyPay(ctx context.Context, in *CancelCurrencyPayRequest) (out CancelCurrencyPayResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -144,13 +144,13 @@ func (s *VirtualPayment) CancelCurrencyPay(ctx context.Context, in *CancelCurren
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "CancelCurrencyPay") err = util.DecodeWithError(response, &out, "CancelCurrencyPay")
return return
} }
// NotifyProvideGoods 通知发货 // NotifyProvideGoods 通知发货
// 通知已经发货完成(只能通知现金单),正常通过 xpay_goods_deliver_notify 消息推送返回成功就不需要调用这个 api 接口。这个接口用于异常情况推送不成功时手动将单改成已发货状态 // 通知已经发货完成(只能通知现金单),正常通过 xpay_goods_deliver_notify 消息推送返回成功就不需要调用这个 api 接口。这个接口用于异常情况推送不成功时手动将单改成已发货状态
func (s *VirtualPayment) NotifyProvideGoods(ctx context.Context, in *NotifyProvideGoodsRequest) (out *NotifyProvideGoodsResponse, err error) { func (s *VirtualPayment) NotifyProvideGoods(ctx context.Context, in *NotifyProvideGoodsRequest) (out NotifyProvideGoodsResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -174,12 +174,12 @@ func (s *VirtualPayment) NotifyProvideGoods(ctx context.Context, in *NotifyProvi
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "NotifyProvideGoods") err = util.DecodeWithError(response, &out, "NotifyProvideGoods")
return return
} }
// PresentCurrency 代币赠送接口,由于目前不支付按单号查赠送单的功能,所以当需要赠送的时候可以一直重试到返回 0 或者返回 268490004重复操作为止 // PresentCurrency 代币赠送接口,由于目前不支付按单号查赠送单的功能,所以当需要赠送的时候可以一直重试到返回 0 或者返回 268490004重复操作为止
func (s *VirtualPayment) PresentCurrency(ctx context.Context, in *PresentCurrencyRequest) (out *PresentCurrencyResponse, err error) { func (s *VirtualPayment) PresentCurrency(ctx context.Context, in *PresentCurrencyRequest) (out PresentCurrencyResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -203,12 +203,12 @@ func (s *VirtualPayment) PresentCurrency(ctx context.Context, in *PresentCurrenc
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "PresentCurrency") err = util.DecodeWithError(response, &out, "PresentCurrency")
return return
} }
// DownloadBill 下载订单交易账单 // DownloadBill 下载订单交易账单
func (s *VirtualPayment) DownloadBill(ctx context.Context, in *DownloadBillRequest) (out *DownloadBillResponse, err error) { func (s *VirtualPayment) DownloadBill(ctx context.Context, in *DownloadBillRequest) (out DownloadBillResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -232,12 +232,12 @@ func (s *VirtualPayment) DownloadBill(ctx context.Context, in *DownloadBillReque
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "DownloadBill") err = util.DecodeWithError(response, &out, "DownloadBill")
return return
} }
// RefundOrder 退款 对使用 jsapi 接口下的单进行退款 // RefundOrder 退款 对使用 jsapi 接口下的单进行退款
func (s *VirtualPayment) RefundOrder(ctx context.Context, in *RefundOrderRequest) (out *RefundOrderResponse, err error) { func (s *VirtualPayment) RefundOrder(ctx context.Context, in *RefundOrderRequest) (out RefundOrderResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -261,12 +261,12 @@ func (s *VirtualPayment) RefundOrder(ctx context.Context, in *RefundOrderRequest
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "RefundOrder") err = util.DecodeWithError(response, &out, "RefundOrder")
return return
} }
// CreateWithdrawOrder 创建提现单 // CreateWithdrawOrder 创建提现单
func (s *VirtualPayment) CreateWithdrawOrder(ctx context.Context, in *CreateWithdrawOrderRequest) (out *CreateWithdrawOrderResponse, err error) { func (s *VirtualPayment) CreateWithdrawOrder(ctx context.Context, in *CreateWithdrawOrderRequest) (out CreateWithdrawOrderResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -290,12 +290,12 @@ func (s *VirtualPayment) CreateWithdrawOrder(ctx context.Context, in *CreateWith
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "CreateWithdrawOrder") err = util.DecodeWithError(response, &out, "CreateWithdrawOrder")
return return
} }
// QueryWithdrawOrder 查询提现单 // QueryWithdrawOrder 查询提现单
func (s *VirtualPayment) QueryWithdrawOrder(ctx context.Context, in *QueryWithdrawOrderRequest) (out *QueryWithdrawOrderResponse, err error) { func (s *VirtualPayment) QueryWithdrawOrder(ctx context.Context, in *QueryWithdrawOrderRequest) (out QueryWithdrawOrderResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -319,12 +319,12 @@ func (s *VirtualPayment) QueryWithdrawOrder(ctx context.Context, in *QueryWithdr
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "QueryWithdrawOrder") err = util.DecodeWithError(response, &out, "QueryWithdrawOrder")
return return
} }
// StartUploadGoods 开始上传商品 // StartUploadGoods 开始上传商品
func (s *VirtualPayment) StartUploadGoods(ctx context.Context, in *StartUploadGoodsRequest) (out *StartUploadGoodsResponse, err error) { func (s *VirtualPayment) StartUploadGoods(ctx context.Context, in *StartUploadGoodsRequest) (out StartUploadGoodsResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -348,12 +348,12 @@ func (s *VirtualPayment) StartUploadGoods(ctx context.Context, in *StartUploadGo
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "StartUploadGoods") err = util.DecodeWithError(response, &out, "StartUploadGoods")
return return
} }
// QueryUploadGoods 查询上传商品 // QueryUploadGoods 查询上传商品
func (s *VirtualPayment) QueryUploadGoods(ctx context.Context, in *QueryUploadGoodsRequest) (out *QueryUploadGoodsResponse, err error) { func (s *VirtualPayment) QueryUploadGoods(ctx context.Context, in *QueryUploadGoodsRequest) (out QueryUploadGoodsResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -377,12 +377,12 @@ func (s *VirtualPayment) QueryUploadGoods(ctx context.Context, in *QueryUploadGo
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "QueryUploadGoods") err = util.DecodeWithError(response, &out, "QueryUploadGoods")
return return
} }
// StartPublishGoods 开始发布商品 // StartPublishGoods 开始发布商品
func (s *VirtualPayment) StartPublishGoods(ctx context.Context, in *StartPublishGoodsRequest) (out *StartPublishGoodsResponse, err error) { func (s *VirtualPayment) StartPublishGoods(ctx context.Context, in *StartPublishGoodsRequest) (out StartPublishGoodsResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -406,12 +406,12 @@ func (s *VirtualPayment) StartPublishGoods(ctx context.Context, in *StartPublish
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "StartPublishGoods") err = util.DecodeWithError(response, &out, "StartPublishGoods")
return return
} }
// QueryPublishGoods 查询发布商品 // QueryPublishGoods 查询发布商品
func (s *VirtualPayment) QueryPublishGoods(ctx context.Context, in *QueryPublishGoodsRequest) (out *QueryPublishGoodsResponse, err error) { func (s *VirtualPayment) QueryPublishGoods(ctx context.Context, in *QueryPublishGoodsRequest) (out QueryPublishGoodsResponse, err error) {
var jsonByte []byte var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil { if jsonByte, err = json.Marshal(in); err != nil {
return return
@@ -435,7 +435,7 @@ func (s *VirtualPayment) QueryPublishGoods(ctx context.Context, in *QueryPublish
} }
// 使用通用方法返回错误 // 使用通用方法返回错误
err = util.DecodeWithError(response, out, "QueryPublishGoods") err = util.DecodeWithError(response, &out, "QueryPublishGoods")
return return
} }

View File

@@ -58,6 +58,11 @@ type (
ParentID int `json:"parentid"` // 父部门id。根部门为1 ParentID int `json:"parentid"` // 父部门id。根部门为1
Order int `json:"order"` // 在父部门中的次序值。order值大的排序靠前 Order int `json:"order"` // 在父部门中的次序值。order值大的排序靠前
} }
// DepartmentGetResponse 获取单个部门详情
DepartmentGetResponse struct {
util.CommonError
Department Department `json:"department"`
}
) )
// DepartmentCreate 创建部门 // DepartmentCreate 创建部门
@@ -138,9 +143,9 @@ func (r *Client) DepartmentGet(departmentID int) (*Department, error) {
if response, err = util.HTTPGet(fmt.Sprintf(departmentGetURL, accessToken, departmentID)); err != nil { if response, err = util.HTTPGet(fmt.Sprintf(departmentGetURL, accessToken, departmentID)); err != nil {
return nil, err return nil, err
} }
result := &Department{} result := &DepartmentGetResponse{}
if err = util.DecodeWithError(response, result, "DepartmentGet"); err != nil { if err = util.DecodeWithError(response, result, "DepartmentGet"); err != nil {
return nil, err return nil, err
} }
return result, nil return &result.Department, nil
} }

View File

@@ -1,69 +0,0 @@
package checkin
import (
"fmt"
"github.com/silenceper/wechat/v2/util"
)
const (
// getCheckinDataURL 获取打卡记录数据
getCheckinDataURL = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata?access_token=%s"
)
type (
// GetCheckinDataRequest 获取打卡记录数据请求
GetCheckinDataRequest struct {
OpenCheckinDataType int64 `json:"opencheckindatatype"`
StartTime int64 `json:"starttime"`
EndTime int64 `json:"endtime"`
UserIDList []string `json:"useridlist"`
}
// GetCheckinDataResponse 获取打卡记录数据响应
GetCheckinDataResponse struct {
util.CommonError
CheckinData []*GetCheckinDataItem `json:"checkindata"`
}
// GetCheckinDataItem 打卡记录数据
GetCheckinDataItem struct {
UserID string `json:"userid"`
GroupName string `json:"groupname"`
CheckinType string `json:"checkin_type"`
ExceptionType string `json:"exception_type"`
CheckinTime int64 `json:"checkin_time"`
LocationTitle string `json:"location_title"`
LocationDetail string `json:"location_detail"`
WifiName string `json:"wifiname"`
Notes string `json:"notes"`
WifiMac string `json:"wifimac"`
MediaIDs []string `json:"mediaids"`
SchCheckinTime int64 `json:"sch_checkin_time"`
GroupID int64 `json:"groupid"`
ScheduleID int64 `json:"schedule_id"`
TimelineID int64 `json:"timeline_id"`
Lat int64 `json:"lat,omitempty"`
Lng int64 `json:"lng,omitempty"`
DeviceID string `json:"deviceid,omitempty"`
}
)
// GetCheckinData 获取打卡记录数据
// @see https://developer.work.weixin.qq.com/document/path/90262
func (r *Client) GetCheckinData(req *GetCheckinDataRequest) (*GetCheckinDataResponse, error) {
var (
accessToken string
err error
)
if accessToken, err = r.GetAccessToken(); err != nil {
return nil, err
}
var response []byte
if response, err = util.PostJSON(fmt.Sprintf(getCheckinDataURL, accessToken), req); err != nil {
return nil, err
}
result := &GetCheckinDataResponse{}
if err = util.DecodeWithError(response, result, "GetCheckinData"); err != nil {
return nil, err
}
return result, nil
}

265
work/checkin/record.go Normal file
View File

@@ -0,0 +1,265 @@
package checkin
import (
"fmt"
"github.com/silenceper/wechat/v2/util"
)
const (
// getCheckinDataURL 获取打卡记录数据
getCheckinDataURL = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata?access_token=%s"
// getDayDataURL 获取打卡日报数据
getDayDataURL = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckin_daydata?access_token=%s"
// getMonthDataURL 获取打卡月报数据
getMonthDataURL = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckin_monthdata?access_token=%s"
)
type (
// GetCheckinDataRequest 获取打卡记录数据请求
GetCheckinDataRequest struct {
OpenCheckinDataType int64 `json:"opencheckindatatype"`
StartTime int64 `json:"starttime"`
EndTime int64 `json:"endtime"`
UserIDList []string `json:"useridlist"`
}
// GetCheckinDataResponse 获取打卡记录数据响应
GetCheckinDataResponse struct {
util.CommonError
CheckinData []*GetCheckinDataItem `json:"checkindata"`
}
// GetCheckinDataItem 打卡记录数据
GetCheckinDataItem struct {
UserID string `json:"userid"`
GroupName string `json:"groupname"`
CheckinType string `json:"checkin_type"`
ExceptionType string `json:"exception_type"`
CheckinTime int64 `json:"checkin_time"`
LocationTitle string `json:"location_title"`
LocationDetail string `json:"location_detail"`
WifiName string `json:"wifiname"`
Notes string `json:"notes"`
WifiMac string `json:"wifimac"`
MediaIDs []string `json:"mediaids"`
SchCheckinTime int64 `json:"sch_checkin_time"`
GroupID int64 `json:"groupid"`
ScheduleID int64 `json:"schedule_id"`
TimelineID int64 `json:"timeline_id"`
Lat int64 `json:"lat,omitempty"`
Lng int64 `json:"lng,omitempty"`
DeviceID string `json:"deviceid,omitempty"`
}
)
// GetCheckinData 获取打卡记录数据
// @see https://developer.work.weixin.qq.com/document/path/90262
func (r *Client) GetCheckinData(req *GetCheckinDataRequest) (*GetCheckinDataResponse, error) {
var (
accessToken string
err error
)
if accessToken, err = r.GetAccessToken(); err != nil {
return nil, err
}
var response []byte
if response, err = util.PostJSON(fmt.Sprintf(getCheckinDataURL, accessToken), req); err != nil {
return nil, err
}
result := &GetCheckinDataResponse{}
if err = util.DecodeWithError(response, result, "GetCheckinData"); err != nil {
return nil, err
}
return result, nil
}
type (
// GetDayDataResponse 获取打卡日报数据
GetDayDataResponse struct {
util.CommonError
Datas []DayDataItem `json:"datas"`
}
// DayDataItem 日报
DayDataItem struct {
BaseInfo DayBaseInfo `json:"base_info"`
SummaryInfo DaySummaryInfo `json:"summary_info"`
HolidayInfos []HolidayInfo `json:"holiday_infos"`
ExceptionInfos []ExceptionInfo `json:"exception_infos"`
OtInfo OtInfo `json:"ot_info"`
SpItems []SpItem `json:"sp_items"`
}
// DayBaseInfo 基础信息
DayBaseInfo struct {
Date int64 `json:"date"`
RecordType int64 `json:"record_type"`
Name string `json:"name"`
NameEx string `json:"name_ex"`
DepartsName string `json:"departs_name"`
AcctID string `json:"acctid"`
DayType int64 `json:"day_type"`
RuleInfo DayRuleInfo `json:"rule_info"`
}
// DayCheckInTime 当日打卡时间
DayCheckInTime struct {
WorkSec int64 `json:"work_sec"`
OffWorkSec int64 `json:"off_work_sec"`
}
// DayRuleInfo 打卡人员所属规则信息
DayRuleInfo struct {
GroupID int64 `json:"groupid"`
GroupName string `json:"groupname"`
ScheduleID int64 `json:"scheduleid"`
ScheduleName string `json:"schedulename"`
CheckInTimes []DayCheckInTime `json:"checkintime"`
}
// DaySummaryInfo 汇总信息
DaySummaryInfo struct {
CheckinCount int64 `json:"checkin_count"`
RegularWorkSec int64 `json:"regular_work_sec"`
StandardWorkSec int64 `json:"standard_work_sec"`
EarliestTime int64 `json:"earliest_time"`
LastestTime int64 `json:"lastest_time"`
}
// HolidayInfo 假勤相关信息
HolidayInfo struct {
SpNumber string `json:"sp_number"`
SpTitle SpTitle `json:"sp_title"`
SpDescription SpDescription `json:"sp_description"`
}
// SpTitle 假勤信息摘要-标题信息
SpTitle struct {
Data []SpData `json:"data"`
}
// SpDescription 假勤信息摘要-描述信息
SpDescription struct {
Data []SpData `json:"data"`
}
// SpData 假勤信息(多种语言描述,目前只有中文一种)
SpData struct {
Lang string `json:"lang"`
Text string `json:"text"`
}
// SpItem 假勤统计信息
SpItem struct {
Count int64 `json:"count"`
Duration int64 `json:"duration"`
TimeType int64 `json:"time_type"`
Type int64 `json:"type"`
VacationID int64 `json:"vacation_id"`
Name string `json:"name"`
}
// ExceptionInfo 校准状态信息
ExceptionInfo struct {
Count int64 `json:"count"`
Duration int64 `json:"duration"`
Exception int64 `json:"exception"`
}
// OtInfo 加班信息
OtInfo struct {
OtStatus int64 `json:"ot_status"`
OtDuration int64 `json:"ot_duration"`
ExceptionDuration []uint64 `json:"exception_duration"`
}
)
// GetDayData 获取打卡日报数据
// @see https://developer.work.weixin.qq.com/document/path/96498
func (r *Client) GetDayData(req *GetCheckinDataRequest) (result *GetDayDataResponse, err error) {
var (
response []byte
accessToken string
)
if accessToken, err = r.GetAccessToken(); err != nil {
return
}
if response, err = util.PostJSON(fmt.Sprintf(getDayDataURL, accessToken), req); err != nil {
return
}
result = new(GetDayDataResponse)
if err = util.DecodeWithError(response, result, "GetDayData"); err != nil {
return
}
return
}
type (
// GetMonthDataResponse 获取打卡月报数据
GetMonthDataResponse struct {
util.CommonError
Datas []MonthDataItem `json:"datas"`
}
// MonthDataItem 月报数据
MonthDataItem struct {
BaseInfo MonthBaseInfo `json:"base_info"`
SummaryInfo MonthSummaryInfo `json:"summary_info"`
ExceptionInfos []ExceptionInfo `json:"exception_infos"`
SpItems []SpItem `json:"sp_items"`
OverWorkInfo OverWorkInfo `json:"overwork_info"`
}
// MonthBaseInfo 基础信息
MonthBaseInfo struct {
RecordType int64 `json:"record_type"`
Name string `json:"name"`
NameEx string `json:"name_ex"`
DepartsName string `json:"departs_name"`
AcctID string `json:"acctid"`
RuleInfo MonthRuleInfo `json:"rule_info"`
}
// MonthRuleInfo 打卡人员所属规则信息
MonthRuleInfo struct {
GroupID int64 `json:"groupid"`
GroupName string `json:"groupname"`
}
// MonthSummaryInfo 汇总信息
MonthSummaryInfo struct {
WorkDays int64 `json:"work_days"`
ExceptDays int64 `json:"except_days"`
RegularDays int64 `json:"regular_days"`
RegularWorkSec int64 `json:"regular_work_sec"`
StandardWorkSec int64 `json:"standard_work_sec"`
}
// OverWorkInfo 加班情况
OverWorkInfo struct {
WorkdayOverSec int64 `json:"workday_over_sec"`
HolidayOverSec int64 `json:"holidays_over_sec"`
RestDayOverSec int64 `json:"restdays_over_sec"`
}
)
// GetMonthData 获取打卡月报数据
// @see https://developer.work.weixin.qq.com/document/path/96499
func (r *Client) GetMonthData(req *GetCheckinDataRequest) (result *GetMonthDataResponse, err error) {
var (
response []byte
accessToken string
)
if accessToken, err = r.GetAccessToken(); err != nil {
return
}
if response, err = util.PostJSON(fmt.Sprintf(getMonthDataURL, accessToken), req); err != nil {
return
}
result = new(GetMonthDataResponse)
if err = util.DecodeWithError(response, result, "GetMonthData"); err != nil {
return
}
return
}

View File

@@ -104,7 +104,7 @@ type Tag struct {
// WechatChannel 视频号添加的场景 // WechatChannel 视频号添加的场景
type WechatChannel struct { type WechatChannel struct {
NickName string `json:"nickname"` NickName string `json:"nickname"`
Source string `json:"source"` Source int `json:"source"`
} }
// GetExternalUserDetail 获取外部联系人详情 // GetExternalUserDetail 获取外部联系人详情