-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mini-program): update miniprogram struct and fix build error
* update * update * update strong var statement * update * update * update * fix(officialAccount) - namespace * update * feat(mini-program): update miniprogram struct * fix(go.mod): update go-libs and go-socalite * fix(makefile): update makefile test scope * fix(base): fix import case error Co-authored-by: Matrix-X <matrix-x@artisan-cloud.com> Co-authored-by: Walle <walle@artisan-cloud.com>
- Loading branch information
1 parent
c9c5baf
commit 0d02781
Showing
35 changed files
with
372 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
indent_size = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# PowerWechat | ||
|
||
[![Go Build](https://github.com/ArtisanCloud/power-wechat/actions/workflows/go-build.yml/badge.svg?branch=release%2F1.0.0)](https://github.com/ArtisanCloud/power-wechat/actions/workflows/go-build.yml) | ||
|
||
[![Go Test](https://github.com/ArtisanCloud/power-wechat/actions/workflows/go-test.yml/badge.svg?branch=release%2F1.0.0)](https://github.com/ArtisanCloud/power-wechat/actions/workflows/go-test.yml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
package models | ||
|
||
import "time" | ||
|
||
// --- Transaction models ---- | ||
|
||
// Transaction | ||
type Transaction struct { | ||
Amount *TransactionAmount `json:"amount,omitempty"` | ||
AppID string `json:"appid,omitempty"` | ||
Attach string `json:"attach,omitempty"` | ||
BankType string `json:"bank_type,omitempty"` | ||
MchID string `json:"mchid,omitempty"` | ||
OutTradeNo string `json:"out_trade_no,omitempty"` | ||
Payer *TransactionPayer `json:"payer,omitempty"` | ||
PromotionDetail []PromotionDetail `json:"promotion_detail,omitempty"` | ||
SuccessTime string `json:"success_time,omitempty"` | ||
TradeState string `json:"trade_state,omitempty"` | ||
TradeStateDesc string `json:"trade_state_desc,omitempty"` | ||
TradeType string `json:"trade_type,omitempty"` | ||
TransactionId string `json:"transaction_id,omitempty"` | ||
} | ||
|
||
|
||
// TransactionAmount | ||
type TransactionAmount struct { | ||
Currency string `json:"currency,omitempty"` | ||
PayerCurrency string `json:"payer_currency,omitempty"` | ||
PayerTotal int64 `json:"payer_total,omitempty"` | ||
Total int64 `json:"total,omitempty"` | ||
} | ||
|
||
|
||
// TransactionPayer | ||
type TransactionPayer struct { | ||
Openid string `json:"openid,omitempty"` | ||
} | ||
|
||
|
||
// PromotionDetail | ||
type PromotionDetail struct { | ||
// 券ID | ||
CouponId string `json:"coupon_id,omitempty"` | ||
// 优惠名称 | ||
Name string `json:"name,omitempty"` | ||
// GLOBAL:全场代金券;SINGLE:单品优惠 | ||
Scope string `json:"scope,omitempty"` | ||
// CASH:充值;NOCASH:预充值。 | ||
Type string `json:"type,omitempty"` | ||
// 优惠券面额 | ||
Amount int64 `json:"amount,omitempty"` | ||
// 活动ID,批次ID | ||
StockId string `json:"stock_id,omitempty"` | ||
// 单位为分 | ||
WechatpayContribute int64 `json:"wechatpay_contribute,omitempty"` | ||
// 单位为分 | ||
MerchantContribute int64 `json:"merchant_contribute,omitempty"` | ||
// 单位为分 | ||
OtherContribute int64 `json:"other_contribute,omitempty"` | ||
// CNY:人民币,境内商户号仅支持人民币。 | ||
Currency string `json:"currency,omitempty"` | ||
GoodsDetail []PromotionGoodsDetail `json:"goods_detail,omitempty"` | ||
} | ||
|
||
|
||
// PromotionGoodsDetail | ||
type PromotionGoodsDetail struct { | ||
// 商品编码 | ||
GoodsId string `json:"goods_id"` | ||
// 商品数量 | ||
Quantity int64 `json:"quantity"` | ||
// 商品价格 | ||
UnitPrice int64 `json:"unit_price"` | ||
// 商品优惠金额 | ||
DiscountAmount int64 `json:"discount_amount"` | ||
// 商品备注 | ||
GoodsRemark string `json:"goods_remark,omitempty"` | ||
} | ||
|
||
|
||
|
||
// --- Refund models ---- | ||
// Refund | ||
type Refund struct { | ||
// 原支付交易对应的商户订单号 | ||
MchID string `json:"mchid"` | ||
// 微信支付交易订单号 | ||
TransactionId string `json:"transaction_id"` | ||
// 原支付交易对应的商户订单号 | ||
OutTradeNo string `json:"out_trade_no"` | ||
// 微信支付退款号 | ||
RefundId string `json:"refund_id"` | ||
// 商户系统内部的退款单号,商户系统内部唯一,只能是数字、大小写字母_-|*@ ,同一退款单号多次请求只退一笔。 | ||
OutRefundNo string `json:"out_refund_no"` | ||
// 退款状态,枚举值 | ||
RefundStatus string `json:"refund_status"` | ||
// 退款成功时间,退款状态status为SUCCESS(退款成功)时,返回该字段。遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日13点29分35秒。 | ||
SuccessTime *time.Time `json:"success_time,omitempty"` | ||
// 取当前退款单的退款入账方,有以下几种情况: 1)退回银行卡:{银行名称}{卡类型}{卡尾号} 2)退回支付用户零钱:支付用户零钱 3)退还商户:商户基本账户商户结算银行账户 4)退回支付用户零钱通:支付用户零钱通 | ||
UserReceivedAccount string `json:"user_received_account"` | ||
// 金额详细信息 | ||
Amount *Amount `json:"amount"` | ||
|
||
} | ||
|
||
|
||
// Amount | ||
type Amount struct { | ||
// 订单总金额,单位为分 | ||
Total int64 `json:"total"` | ||
// 退款标价金额,单位为分,可以做部分退款 | ||
Refund int64 `json:"refund"` | ||
// 现金支付金额,单位为分,只能为整数 | ||
PayerTotal int64 `json:"payer_total"` | ||
// 退款给用户的金额,不包含所有优惠券金额 | ||
PayerRefund int64 `json:"payer_refund"` | ||
// 去掉非充值代金券退款金额后的退款金额,单位为分,退款金额=申请退款金额-非充值代金券退款金额,退款金额<=申请退款金额 | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
src/miniProgram/liveBroadcast/request/requestBroadcastAddAssistant.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
package request | ||
|
||
import "github.com/ArtisanCloud/power-wechat/src/kernel/power" | ||
type RequestBroadcastAddAssistantUser struct { | ||
Username string `json:"username"` | ||
Nickname string `json:"nickname"` | ||
} | ||
|
||
type RequestBroadcastAddAssistant struct { | ||
RoomID int `json:"roomId"` | ||
Users []power.StringMap `json:"users"` | ||
RoomID int `json:"roomId"` | ||
Users []RequestBroadcastAddAssistantUser `json:"users"` | ||
} |
4 changes: 2 additions & 2 deletions
4
src/miniProgram/liveBroadcast/request/requestBroadcastAddGoods.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package request | ||
|
||
type RequestBroadcastAddGoods struct { | ||
IDs string `json:"ids"` | ||
RoomID int `json:"roomId"` | ||
IDs []int `json:"ids"` | ||
RoomID int `json:"roomId"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 11 additions & 3 deletions
14
src/miniProgram/liveBroadcast/request/requestBroadcastGoodsAdd.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
package request | ||
|
||
import "github.com/ArtisanCloud/power-wechat/src/kernel/power" | ||
|
||
type RequestBroadcastGoodsAdd struct { | ||
GoodsInfo *power.HashMap `json:"goodsInfo"` | ||
GoodsInfo *RequestBroadcastGoodsAddInfo `json:"goodsInfo"` | ||
} | ||
|
||
type RequestBroadcastGoodsAddInfo struct { | ||
CoverImgUrl string `json:"coverImgUrl"` | ||
Name string `json:"name"` | ||
PriceType int `json:"priceType"` | ||
Price float64 `json:"price"` | ||
Price2 float64 `json:"price2"` | ||
Url string `json:"url"` | ||
ThirdPartyAppid string `json:"thirdPartyAppid"` // 当商品为第三方小程序的商品则填写为对应第三方小程序的appid,自身小程序商品则为'' | ||
} |
5 changes: 5 additions & 0 deletions
5
src/miniProgram/liveBroadcast/request/requestBroadcastGoodsSort.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package request | ||
|
||
type RequestBroadcastGoodsSort struct { | ||
GoodsId string `json:"goodsId"` | ||
} |
15 changes: 12 additions & 3 deletions
15
src/miniProgram/liveBroadcast/request/requestBroadcastGoodsUpdate.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
package request | ||
|
||
import "github.com/ArtisanCloud/power-wechat/src/kernel/power" | ||
|
||
type RequestBroadcastGoodsUpdate struct { | ||
GoodsInfo *power.HashMap `json:"goodsInfo"` | ||
GoodsInfo *RequestBroadcastGoodsUpdateInfo `json:"goodsInfo"` | ||
} | ||
|
||
type RequestBroadcastGoodsUpdateInfo struct { | ||
GoodsId int `json:"goodsId"` | ||
CoverImgUrl string `json:"coverImgUrl,omitempty"` | ||
Name string `json:"name,omitempty"` | ||
PriceType int `json:"priceType,omitempty'"` | ||
Price float64 `json:"price,omitempty"` | ||
Price2 float64 `json:"price2,omitempty"` | ||
Url string `json:"url,omitempty"` | ||
ThirdPartyAppid string `json:"thirdPartyAppid,omitempty"` // 当商品为第三方小程序的商品则填写为对应第三方小程序的appid,自身小程序商品则为'' | ||
} |
Oops, something went wrong.