黄梓健
5 years ago
23 changed files with 702 additions and 331 deletions
-
2controllers/client/bully_screen.go
-
188controllers/client/live.go
-
8controllers/client/reward.go
-
27controllers/common/wechat_oauth.go
-
27controllers/pc/bully_screen.go
-
34controllers/pc/reward.go
-
1go.mod
-
9libs/im/im.go
-
2log/hdzj.log
-
26models/bully_screen_history.go
-
1models/init_models.go
-
2models/live_red_pack.go
-
3models/live_red_pack_info.go
-
16models/reward_history.go
-
24models/user_order.go
-
53models/user_transfer.go
-
140services/bully_reward/dao.go
-
19services/im/im.go
-
4services/pay/const.go
-
196services/pay/order.go
-
32services/pay/refund.go
-
163services/pay/transfer.go
-
26test/pay_test.go
@ -0,0 +1,53 @@ |
|||
package models |
|||
|
|||
import ( |
|||
"github.com/ouxuanserver/osmanthuswine/src/core" |
|||
"time" |
|||
) |
|||
|
|||
const UserTransferTN = TableNamePrefix + "user_transfer" |
|||
|
|||
type UserTransfer struct { |
|||
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` |
|||
CreatedAt time.Time `json:"created_at" xorm:"created comment('创建时间') TIMESTAMP"` |
|||
UpdatedAt time.Time `json:"updated_at" xorm:"updated comment('更新时间') TIMESTAMP"` |
|||
IsDelete int `json:"is_delete" xorm:"not null default 0 comment('是否删除') TINYINT(1)"` |
|||
DeviceInfo string `json:"device_info" xorm:"not null default '' comment('设备信息') VARCHAR(32)"` |
|||
NonceStr string `json:"nonce_str" xorm:"not null default '' comment('随机字符串') VARCHAR(32)"` |
|||
PartnerTradeNo string `json:"partner_trade_no" xorm:"not null default '' comment('商户订单号') VARCHAR(32)"` |
|||
PaymentNo string `json:"payment_no" xorm:"not null default '' comment('微信付款单号') VARCHAR(64)"` |
|||
PaymentTime string `json:"payment_time" xorm:"not null default '' comment('企业付款成功时间') VARCHAR(32)"` |
|||
Status int `json:"status" xorm:"not null default 0 comment('0未处理1处理中2转账成功3转账失败4查询尝试失败') TINYINT(1)"` |
|||
Reason string `json:"reason" xorm:"not null default '' comment('转账失败原因') VARCHAR(255)"` |
|||
OpenId string `json:"open_id" xorm:"not null default '' comment('用户open_id') VARCHAR(64)"` |
|||
PaymentAmount int `json:"payment_amount" xorm:"not null default 0 comment('转账金额,单位分') INT(18)"` |
|||
TransferTime string `json:"transfer_time" xorm:"not null default '' comment('转账时间') VARCHAR(32)"` |
|||
Desc string `json:"desc" xorm:"not null default '' comment('备注') VARCHAR(128)"` |
|||
ErrMsg string `json:"err_msg" xorm:"not null default '' comment('错误信息') VARCHAR(255)"` |
|||
} |
|||
|
|||
func (t *UserTransfer) TableName() string { |
|||
return UserTransferTN |
|||
} |
|||
|
|||
func GetUserTransferByStatus(status ...int) ([]*UserTransfer, error) { |
|||
transfers := make([]*UserTransfer, 0) |
|||
err := core.GetXormAuto().Where("is_delete=0").In("status", status).Find(&transfers) |
|||
return transfers, err |
|||
} |
|||
|
|||
func (t *UserTransfer) Add() (int64, error) { |
|||
return core.GetXormAuto().InsertOne(t) |
|||
} |
|||
|
|||
func (t *UserTransfer) GetByPartnerTradeNo(partnerTradeNo string) (bool, error) { |
|||
return core.GetXormAuto().Where("is_delete=0 and partner_trade_no=?", partnerTradeNo).Get(t) |
|||
} |
|||
|
|||
func (t *UserTransfer) UpdateByPartnerTradeNo(partnerTradeNo string) (int64, error) { |
|||
return core.GetXormAuto().Where("is_delete=0 and partner_trade_no=?", partnerTradeNo).Update(t) |
|||
} |
|||
|
|||
func (t *UserTransfer) UpdateErrMsg(partnerTradeNo, msg string) (int64, error) { |
|||
return core.GetXormAuto().Where("is_delete=0 and partner_trade_no=?", partnerTradeNo).Update(&UserTransfer{ErrMsg: msg}) |
|||
} |
@ -0,0 +1,19 @@ |
|||
package im_service |
|||
|
|||
import ( |
|||
"errors" |
|||
"hudongzhuanjia/libs/im" |
|||
"hudongzhuanjia/models" |
|||
) |
|||
|
|||
func SendNoticeByActivityId(activityId int64, data map[string]interface{}, members ...string) error { |
|||
live := new(models.LiveConfig) |
|||
exist, err := live.GetByActivityId(activityId) |
|||
if err != nil { |
|||
return err |
|||
} |
|||
if !exist { |
|||
return errors.New("直播信息不存在") |
|||
} |
|||
return im.SendGroupSystemNotification(live.ImGroupId, im.NoticeLiveRedPackStart, data, members...) |
|||
} |
@ -1,32 +0,0 @@ |
|||
package pay_service |
|||
|
|||
//func BatchQueryRefundByUserId(userId int64) error {
|
|||
// refunds := make([]*models.UserRefund, 0)
|
|||
// if err := core.GetXormAuto().Where("status = 0 and user_id=?", userId).Find(&refunds); err != nil {
|
|||
// return err
|
|||
// }
|
|||
// if err := batchQueryRefund(refunds); err != nil {
|
|||
// return err
|
|||
// }
|
|||
// return nil
|
|||
//}
|
|||
//func BatchQueryRefundByActivityId(activityId int64) error {
|
|||
// refunds := make([]*models.UserRefund, 0)
|
|||
// if err := core.GetXormAuto().Where("status = 0 and user_id=?", activityId).Find(&refunds); err != nil {
|
|||
// return err
|
|||
// }
|
|||
// if err := batchQueryRefund(refunds); err != nil {
|
|||
// return err
|
|||
// }
|
|||
// return nil
|
|||
//}
|
|||
//
|
|||
//func batchQueryRefund(refunds []*models.UserRefund) error {
|
|||
// for _, refund := range refunds {
|
|||
// _, err := QueryRefund(refund.OutTradeNo)
|
|||
// if err != nil {
|
|||
// return err
|
|||
// }
|
|||
// }
|
|||
// return nil
|
|||
//}
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue