11package wxworkfinancesdk
22
3- // #cgo LDFLAGS: -w - L${SRCDIR}/lib -lWeWorkFinanceSdk_C
3+ // #cgo LDFLAGS: -L${SRCDIR}/lib -lWeWorkFinanceSdk_C
44// #cgo CFLAGS: -Wall
55// #cgo CFLAGS: -I ${SRCDIR}/lib/
66// #include <stdlib.h>
@@ -14,7 +14,7 @@ import (
1414
1515// Client Client对象
1616type Client struct {
17- ptr C.WeWorkFinanceSdk_t
17+ ptr * C.WeWorkFinanceSdk_t
1818}
1919
2020// NewClient 初始化函数
@@ -91,7 +91,7 @@ func (c *Client) DecryptData(encryptKey string, encryptMsg string) (Message, err
9191 C .FreeSlice (msgSlice )
9292 }()
9393
94- retC := C .DecryptData (encryptKey , encryptMsg , msgSlice )
94+ retC := C .DecryptData (encryptKeyC , encryptMsgC , msgSlice )
9595 ret := int (retC )
9696 if ret != 0 {
9797 return nil , NewSDKErr (ret )
@@ -195,7 +195,7 @@ func (c *Client) GetMediaData(indexBuf string, sdkFileId string, proxy string, p
195195 }
196196 return & MediaData {
197197 OutIndexBuf : C .GoString (C .GetOutIndexBuf (mediaDataC )),
198- Data : C .GoBytes (C .GetData (mediaDataC ), int ( C .GetDataLen (mediaDataC ) )),
198+ Data : C .GoBytes (unsafe . Pointer ( C .GetData (mediaDataC )), C .GetDataLen (mediaDataC )),
199199 IsFinish : int (C .IsMediaDataFinish (mediaDataC )) == 1 ,
200200 }, nil
201201}
@@ -219,5 +219,5 @@ func (c *Client) DownloadMedia(w io.Writer, sdkField string, proxy string, passw
219219
220220// GetContentFromSlice 转换C.struct_Slice_t为go bytes
221221func (c Client ) GetContentFromSlice (slice * C.struct_Slice_t ) []byte {
222- return C .GoBytes (C .GetContentFromSlice (slice ), int ( C .GetSliceLen (slice ) ))
222+ return C .GoBytes (unsafe . Pointer ( C .GetContentFromSlice (slice )), C .GetSliceLen (slice ))
223223}
0 commit comments