mixpay优化

This commit is contained in:
richboo111
2022-09-19 15:54:38 +08:00
19 changed files with 288 additions and 46 deletions

View File

@@ -414,7 +414,11 @@ func AddUserDeliveryAddress(ctx *jxcontext.Context, address *model.UserDeliveryA
db := dao.GetDB()
lng := address.Lng
lat := address.Lat
address.AutoAddress, address.DistrictCode, address.CityCode, err = getAddressInfoFromCoord(db, lng, lat)
autoAddress := ""
autoAddress, address.DistrictCode, address.CityCode, err = getAddressInfoFromCoord(db, lng, lat)
if address.AutoAddress == "" {
address.AutoAddress = autoAddress
}
if err == nil {
globals.SugarLogger.Debugf("AddUserDeliveryAddress2 address:%s", utils.Format4Output(address, true))
txDB, _ := dao.Begin(db)

View File

@@ -4,6 +4,7 @@ import (
"encoding/hex"
"fmt"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals"
"io"
@@ -89,6 +90,10 @@ func (t *TcpClient) handleConn(c net.Conn) {
}
changePrinterStatus(printNo, status)
t.HandleCheckTcpHeart(printNo)
// todo 证明打印机已经被激活,将激活打印机存入数据库,保证用户不能无限制绑定打印机
if err := dao.NotExistsCreate(printNo); err != nil {
globals.SugarLogger.Debugf("监听打印机心跳,不存在则创建 :[%v]", err)
}
} else {
//在加到连接池中已经更新了时间所以放在else里
t.setPrintStatusTime(printNo)
@@ -258,6 +263,29 @@ func (t *TcpClient) doPrint(key string) (err error) {
if dataStr != "" {
a, b := getCallbackMsgInfo(dataStr)
t.changePrintMsg(dataStr, a, b)
// 查询打印机是否扣费,未扣费就扣费,已经扣费不做处理
have, err := dao.QueryOrderDeductionRecord(db, b, utils.Int64ToStr(a))
if err != nil && !have {
// 扣除打印机账号金额
if err = dao.DeductionPrintBalance(db, b); err != nil {
globals.SugarLogger.Debugf("扣除用户打印机金额错误 %s", err)
} else {
// 添加打印记录(支出记录)
if err = dao.AddPrintRecord(db, &model.PrintBillRecord{
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
PrintNo: b,
PayType: 2,
PayMoney: 1, // 固定支出一分钱
OrderId: utils.Int64ToStr(a),
UserId: "",
}); err != nil {
globals.SugarLogger.Debugf("添加打印机订单支付记录错误 %s", err)
}
}
} else {
globals.SugarLogger.Debugf("查询打印机扣费记录错误 %s", err)
}
//判断音频暂停?
//收到打印成功回调后,如果消息中有音频,需要等待一下,等上一个音频播完
//暂停时间就暂时取的sound标签内内容长度/2

View File

@@ -545,21 +545,21 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) {
func checkPrintMsg(db *dao.DaoDB, printMsg *model.PrintMsg) (err error) {
if printMsg.Content == "" {
return fmt.Errorf("此打印信息内容为空printMsg printNo:[%v], orderNo :[%v]", printMsg.PrintNo, printMsg.OrderNo)
return fmt.Errorf("此打印信息内容为空printMsg printNo:[%v], orderNo :[%v] 1", printMsg.PrintNo, printMsg.OrderNo)
}
if printMsg.PrintNo == "" {
return fmt.Errorf("此打印信息打印机编号为空printMsg printNo:[%v], orderNo :[%v]", printMsg.PrintNo, printMsg.OrderNo)
return fmt.Errorf("此打印信息打印机编号为空printMsg printNo:[%v], orderNo :[%v] 2", printMsg.PrintNo, printMsg.OrderNo)
}
if printMsg.OrderNo == "" {
return fmt.Errorf("此打印信息订单序号为空printMsg printNo:[%v], orderNo :[%v]", printMsg.PrintNo, printMsg.OrderNo)
}
if printer, err := dao.GetPrinter(db, printMsg.PrintNo); err == nil {
if printer != nil {
if printer.FlowFlag == 1 {
return fmt.Errorf("此打印机当月流量已用完请及时充值printNo:[%v]", printMsg.PrintNo)
}
}
return fmt.Errorf("此打印信息订单序号为空printMsg printNo:[%v], orderNo :[%v] 3", printMsg.PrintNo, printMsg.OrderNo)
}
//if printer, err := dao.GetPrinter(db, printMsg.PrintNo); err == nil {
// if printer != nil {
// if printer.FlowFlag == 1 {
// return fmt.Errorf("此打印机当月流量已用完请及时充值printNo:[%v]", printMsg.PrintNo)
// }
// }
//}
return err
}

View File

@@ -17,7 +17,7 @@ func TestPrintMsg(t *testing.T) {
ModelIDCULD: model.ModelIDCULD{},
PrintNo: "20220707000002",
Content: "<center>居中文字</center>",
OrderNo: "11111111", // 2147483648111
OrderNo: "1", // 2147483648111
Status: 0,
Comment: "",
MsgID: "1",

View File

@@ -7,7 +7,6 @@ import (
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals"
"github.com/astaxie/beego/client/orm"
"time"
)
@@ -42,7 +41,6 @@ func AddBillExpend(txDB orm.TxOrmer, billID int64, billType, expendPrice, jobID
ExpendPrice: expendPrice,
JobID: jobID,
}
globals.SugarLogger.Debug("进入AddBillExpend")
dao.WrapAddIDCULEntity(billExpend, jxcontext.AdminCtx.GetUserName())
return dao.CreateEntityTx(txDB, billExpend)
}
@@ -70,7 +68,6 @@ func GetUserBillDetail(ctx *jxcontext.Context, userID, fromTime, toTime string,
func AddExpendUpdateAccount(txDB orm.TxOrmer, userBill *model.UserBill, billType, price, jobID int) (err error) {
//1、账户支出增加一条记录
globals.SugarLogger.Debug("进入AddExpendUpdateAccount")
err = AddBillExpend(txDB, userBill.BillID, billType, price, jobID)
if err != nil {
return err

View File

@@ -245,7 +245,6 @@ func OnTLPayCallback(call *tonglianpayapi.CallBackResult) (err error) {
}
func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) {
globals.SugarLogger.Debug("进入微信回调============================")
order := &model.Order{
OrderID: call.CusorderID,
TransactionID: call.TrxID,
@@ -334,8 +333,6 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) {
}
}
dao.Commit(db, txdb)
globals.SugarLogger.Debug("call.TrxStatus======================", call.TrxStatus)
globals.SugarLogger.Debug("order.OrderType======================", order.OrderType)
if call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
switch order.OrderType {
case model.PayType4Express:

View File

@@ -4,7 +4,6 @@ import (
"fmt"
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
@@ -33,7 +32,7 @@ func SendUserMessage(msgType string, user *model.User, title, content string) (e
}
err = ddmsg.SendDDUserMessage(msgType, auth.AuthID, title, content)
} else if auth.Type == weixin.AuthTypeMP && msgType != dingdingapi.MsgTypeMarkdown {
err = weixinmsg.NotifyStoreStatusChanged(auth.AuthID, title, content)
//err = weixinmsg.NotifyStoreStatusChanged(auth.AuthID, title, content)
}
break
}

View File

@@ -0,0 +1,14 @@
package dao
import (
"time"
)
func NotExistsCreate(printNo string) error {
sql := `INSERT INTO print_activation (print_no,created_at) SELECT ?,? FROM dual WHERE NOT EXISTS (SELECT * FROM print_activation WHERE print_no = ?)`
param := []interface{}{printNo, time.Now(), printNo}
if _, err := ExecuteSQL(GetDB(), sql, param...); err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,7 @@
package dao
// DeductionPrintBalance 扣除打印机账号余额
func DeductionPrintBalance(db *DaoDB, printNo string) error {
_, err := ExecuteSQL(db, `UPDATE print_bill SET print_balance = print_balance -1 WHERE print_no = ?`, []interface{}{printNo}...)
return err
}

View File

@@ -0,0 +1,32 @@
package dao
import (
"git.rosy.net.cn/jx-callback/business/model"
"time"
)
// QueryOrderDeductionRecord 查询订单扣除记录
func QueryOrderDeductionRecord(db *DaoDB, printNo string, orderNo string) (bool, error) {
sql := `SELECT * FROM print_bill_record WHERE print_no = ? AND order_no = ? AND created_at > ? AND created_at < ?`
timeNow := time.Now()
startTime := time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, timeNow.Location())
endTime := time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 23, 59, 59, 0, timeNow.Location())
param := []interface{}{printNo, orderNo, startTime, endTime}
var result []*model.PrintBillRecord
if err := GetRows(db, &result, sql, param...); err != nil {
return false, err
}
if len(result) == 0 {
return false, nil
}
return true, nil
}
// AddPrintRecord 添加打印记录
func AddPrintRecord(db *DaoDB, param *model.PrintBillRecord) error {
return CreateEntity(db, param)
}

View File

@@ -32,7 +32,7 @@ type Printer struct {
}
type SystemTemp struct {
ID int `json:"id" db:"id"`
ID int `orm:"column(id)" json:"id" db:"id"`
CreatedAt *time.Time `json:"created_at" db:"created_at"`
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
LastOperator string `json:"last_operator" db:"last_operator"`
@@ -46,3 +46,97 @@ type SystemTemp struct {
PrintSn string `json:"print_sn" db:"print_sn"` // 模板所属打印机
IsUse int `json:"is_use" db:"is_use"` // 默认使用 1-使用/2-不使用
}
type Apps struct {
ID int `orm:"column(id)" json:"id" db:"id"`
CreatedAt *time.Time `json:"created_at" db:"created_at"`
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
LastOperator string `json:"last_operator" db:"last_operator"`
DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
UserID string `orm:"column(user_id)" json:"user_id" db:"user_id"` //属于哪个账号的
Name string `json:"name"` //应用名称
Type int `json:"type"` //应用类型
AppKey string `json:"app_key" db:"app_key"` //Key
Status int `json:"status"` //状态
Mobile string `json:"mobile"` //手机号
}
type MenuDetail struct {
ID int `orm:"column(id)" json:"id" db:"id"`
CreatedAt *time.Time `json:"created_at" db:"created_at"`
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
LastOperator string `json:"last_operator" db:"last_operator"`
DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
MenuID int `orm:"column(menu_id)" json:"menu_id" db:"menu_id"`
Name string `json:"name"`
Content string `json:"content"`
URL string `orm:"column(url)" json:"url" db:"url"`
Method string `json:"method"`
PublicParam string `json:"public_param" db:"public_param"`
PrivateParam string `json:"private_param" db:"private_param"`
CallParam string `json:"call_param" db:"call_param"`
ReturnParam string `json:"return_param" db:"return_param"`
ReturnEX string `orm:"column(return_ex)" json:"return_ex" db:"return_ex"`
}
//流量支出
type SimFlowExpend struct {
ID int `orm:"column(id)" json:"id" db:"id"`
CreatedAt *time.Time `json:"created_at" db:"created_at"`
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
LastOperator string `json:"last_operator" db:"last_operator"`
IccID string `orm:"column(icc_id)" json:"icc_id" db:"icc_id"` //sim卡iccid
Flow float64 `json:"flow"` //流量数
FlowUnit string `json:"flow_unit" db:"flow_unit"` //流量单位
}
//流量划入
type SimFlowIncome struct {
ID int `orm:"column(id)" json:"id" db:"id"`
CreatedAt *time.Time `json:"created_at" db:"created_at"`
UpdatedAt *time.Time `json:"updated_at" db:"updated_at"`
LastOperator string `json:"last_operator" db:"last_operator"`
IccID string `orm:"column(icc_id)" json:"icc_id" db:"icc_id"` //sim卡iccid
Flow float64 `json:"flow"` //流量数
FlowUnit string `json:"flow_unit" db:"flow_unit"` //流量单位
IncomeType int `json:"income_type" db:"income_type"` //1 表示系统每月自动划转2 表示商户自己冲的
OrderID string `orm:"column(order_id)" json:"order_id" db:"order_id"` //订单号
}
type PayOrder struct {
ID int `orm:"column(id)" json:"id" db:"id"`
CreatedAt *time.Time `json:"created_at" db:"created_at"`
OrderID string `orm:"column(order_id)" json:"order_id" db:"order_id"` //订单号
UserID string `orm:"column(user_id)" json:"user_id" db:"user_id"` //用户ID
OrderType string `json:"order_type" db:"order_type"` //订单类型,流量充值等
Origin string `json:"origin"` //订单来源,小程序,开放后台
Status int `json:"status"` //订单状态,待支付2已支付5支付成功110支付失败115
PayPrice int64 `json:"pay_price" db:"pay_price"` //支付金额
TransactionID string `orm:"column(transaction_id)" json:"transaction_id" db:"transaction_id"` // 支付成功后支付方生成的事务ID
PayFinishedAt *time.Time `json:"pay_finished_at" db:"pay_finished_at"`
PrepayID string `orm:"column(prepay_id)" json:"prepay_id" db:"prepay_id"` // 下单后支付前支付方生成的事务ID
OriginalData *string `json:"original_data" db:"original_data"`
Comment string `json:"comment"` //备注
ThingID string `orm:"column(thing_id)" json:"thing_id" db:"thing_id"` //订单充值项目ID
TypeID string `orm:"column(type_id)" json:"type_id" db:"type_id"` //类型ID充流量就是套餐对应的id
}
type OrderPay struct {
ID int `orm:"column(id)" json:"id" db:"id"`
CreatedAt time.Time `orm:"type(datetime)" json:"created_at" db:"created_at"` // 创建时间
UpdatedAt time.Time `orm:"type(datetime)" json:"updated_at" db:"updated_at"` // 更新时间
PayOrderID string `orm:"column(pay_order_id);size(48)" json:"pay_order_id" db:"pay_order_id"` // 京西支付定单号
PayType int `orm:"type(int);size(2)" json:"pay_type" db:"pay_type"` // 支付类型[1-微信,2-通联,3-抖音]
VendorPayType string `orm:"size(48)" json:"vendorPayType"` //
VendorOrderID string `orm:"column(vendor_order_id);size(48);index" json:"vendor_order_id" db:"vendor_order_id"` // 支付对应的购物订单号
PrintNo string `orm:"column(print_no);size(48);index" json:"print_no" db:"print_no"` // 充值打印机编号
Status int `orm:"type(int);size(2)" json:"status" json:"status" db:"status"` // 订单支付状态
PayCreatedAt time.Time `orm:"type(datetime);index" json:"pay_created_at" db:"pay_created_at"` // 下单时间
PayFinishedAt time.Time `orm:"type(datetime)" json:"pay_finished_at" db:"pay_finished_at"` // 支付完成时间
TotalFee int `orm:"type(int);size(11)" json:"total_fee" db:"total_fee"` // 支付金额
PrepayID string `orm:"column(prepay_id);index;size(48)" json:"prepay_id" db:"prepay_id"` // 下单后支付前支付方生成的事务ID
TransactionID string `orm:"column(transaction_id);index;size(48)" json:"transaction_id" db:"transaction_id"` // 支付成功后支付方生成的事务ID
OriginalData string `orm:"type(text)" json:"-"` // 返回消息
VendorID int `orm:"column(vendor_id)" json:"vendor_id" db:"vendor_id"` // 购物订单所属厂商代码(当前只有京西)
CodeURL string `orm:"column(code_url);size(3200)" json:"codeURL"` //
}

View File

@@ -0,0 +1,10 @@
package model
import "time"
// PrintActivation 打印机激活记录
type PrintActivation struct {
ID int `orm:"column(id)" json:"id" db:"id"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
PrintNo string `orm:"type(varchar);size(32);index" json:"print_no" db:"print_no"` // 打印机编号
}

View File

@@ -0,0 +1,13 @@
package model
import "time"
// PrintBill 打印机账户
type PrintBill struct {
ID int `orm:"column(id)" json:"id" db:"id"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
PrintNo string `orm:"type(varchar);size(32);index" json:"print_no" db:"print_no"` // 打印机编号
PrintBalance int64 `orm:"type(int);size(16)" json:"print_balance" db:"print_balance"` // 账户余额
UserId string `orm:"type(varchar);size(125)" json:"user_id" db:"user_id"` // 打印机所属用户
}

View File

@@ -0,0 +1,28 @@
package model
import "time"
// PrintBillRecord 打印机充值/小费记录
type PrintBillRecord struct {
ID int `orm:"column(id)" json:"id" db:"id"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
PrintNo string `orm:"type(varchar);size(32);index" json:"print_no" db:"print_no"` // 打印机编号
PayType int `orm:"type(int);size(2)" json:"pay_type" db:"pay_type"` // 支付类型[1-充值/2-支出]
PayMoney int `orm:"type(int);size(10)" json:"pay_money" db:"pay_money"` // 金额
OrderId string `orm:"type(varchar);size(64);index" json:"order_id" db:"order_id"` // 订单号
UserId string `orm:"type(varchar);size(125)" json:"user_id" db:"user_id"` // 打印机所属用户
}
type PrintBindStore struct {
ID int `orm:"column(id)" json:"id" db:"id"`
CreatedAt time.Time `orm:"type(datetime)" json:"created_at" db:"created_at"` // 创建时间
UpdatedAt time.Time `orm:"type(datetime)" json:"updated_at" db:"updated_at"` // 更新时间
StoreID int64 `orm:"column(store_id);type(int);size(11)" json:"store_id" db:"store_id"` // 门店id(为京西创建门店id)唯一
StoreName string `orm:"type(varchar);size(255)" json:"store_name" db:"store_name"` // 门店名称
StoreVendor int `orm:"type(int);size(2)" json:"store_vendor" db:"store_vendor"` // 门店平台
PrintNo string `orm:"type(varchar);size(32);index" json:"print_no" db:"print_no"` // 打印机编号
UserId string `orm:"type(varchar);size(125)" json:"user_id" db:"user_id"` // 打印机所属用户
StoreStatus int `orm:"type(int);size(2)" json:"store_status" db:"store_status"` // 门店状态
BindStatus int `orm:"type(int);size(2)" json:"bind_status" db:"bind_status"` // 绑定状态
}

View File

@@ -0,0 +1,27 @@
package q_bida
import (
"fmt"
bida "git.rosy.net.cn/baseapi/platformapi/q_bida"
"testing"
)
func TestQueryExpressPrice(t *testing.T) {
param := &bida.GetExpressPriceReq{
Type: 0,
PromiseTimeType: 0,
DeliveryType: 0,
GoodsValue: 1,
ReceiveAddress: "四川省攀枝花市米易县攀莲镇米易县米易县政府",
SendAddress: "四川省成都市锦江区牛市口街道大融厨(九眼桥店)七鑫大酒店",
Weight: 2,
Length: 0,
Height: 0,
Width: 0,
SendPhone: "18981810340",
ChannelType: 2,
}
data,err := QueryExpressPrice(param)
fmt.Println(err)
fmt.Println(data)
}

View File

@@ -68,14 +68,12 @@ func QueryExpressPrice(param *bida.GetExpressPriceReq) (map[string]*bida.GetExpr
param.ReceiveAddress = v + param.ReceiveAddress
}
}
globals.SugarLogger.Debug("检测param是否加上前缀", param.SendAddress, param.ReceiveAddress)
// 给快递默认值
result := make(map[string]*bida.GetExpressPriceRes, 0)
if param.Type == 0 {
// 渠道费每公斤加价五毛
switch param.ChannelType {
case 1: // 快递
globals.SugarLogger.Debug("进入QueryExpressPrice case1 ")
for i := 0; i < len(ExpressCompany); i++ {
param.Type = ExpressCompany[i]
fee, err := api.QBiDaAPI.GetExpressPrice(param)
@@ -267,12 +265,10 @@ func CancelWayOrder(ctx *jxcontext.Context, userId string, param *bida.CancelOrd
if err != nil {
return FailCode, err
}
globals.SugarLogger.Debug("回调获取order详情", orderWay)
userBill, err := dao.GetUserBill(db, orderWay.UserID, "")
if err != nil {
return FailCode, err
}
globals.SugarLogger.Debug("回调获取user_bill详情", userBill)
if orderWay.Status == 110 {
if orderWay.PayMethod == 1 { // 余额支付
@@ -306,15 +302,12 @@ func CancelWayOrder(ctx *jxcontext.Context, userId string, param *bida.CancelOrd
}
}
if orderWay.PayMethod == 5 { //混合支付
globals.SugarLogger.Debug("回调进入混合支付流程")
//余额增加相应金额
globals.SugarLogger.Debug("回调输出订单id", orderWay.OrderID)
mixPayInfo, err := dao.GetMixPayDetail(orderWay.OrderID)
if err != nil {
return FailCode, err
}
//userBill.AccountBalance = mixPayInfo.BalancePrice
globals.SugarLogger.Debug("回调输出userBill.AccountBalance", userBill.AccountBalance)
if err := dao.UpdateUserBill(userBill.UserID, mixPayInfo.BalancePrice); err != nil {
return 0, err
}
@@ -327,10 +320,6 @@ func CancelWayOrder(ctx *jxcontext.Context, userId string, param *bida.CancelOrd
return FailCode, err
}
globals.SugarLogger.Debug("回调进入微信退款")
globals.SugarLogger.Debug("orderWay==============", orderWay)
globals.SugarLogger.Debug("order==============", order)
globals.SugarLogger.Debug("order.OtherWayBill==============", order.OtherWayBill)
res, err := RefundOrderByTL(ctx, orderWay, order, order.OtherWayBill, int(orderWay.PayPrice*100), "申请退款")
if len(res.VendorRefundID) > 0 {
return SuccessCode, err
@@ -435,7 +424,6 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder, orderId string) error {
// globals.SugarLogger.Debug("Callback Success But Order Status Update Fail ....")
// return errors.New("Callback Success But Order Status Update Fail ")
//}
globals.SugarLogger.Debug("我到qbd回调接口了")
// 创建QBIDA订单
makeOrder := &bida.MakeOrderReq{
PromiseTimeType: order.PromiseTimeType,
@@ -472,9 +460,7 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder, orderId string) error {
otherId, err := createOtherOrder(makeOrder)
if err != nil {
order.ErrorMsg = err.Error()
globals.SugarLogger.Debug("err==========", err)
}
globals.SugarLogger.Debug("otherId==========", otherId)
order.OtherWayBill = otherId
order.OrderStatus = model.OrderStatusWaitPickup
order.UpdatedAt = time.Now()
@@ -486,16 +472,12 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder, orderId string) error {
// RefundOrderByTL 发起取消订单
func RefundOrderByTL(ctx *jxcontext.Context, orderPay *model.Order, order *model.UserVendorOrder, refundID string, refundFee int, refundDesc string) (orderPayRefund *model.OrderPayRefund, err error) {
globals.SugarLogger.Debug("进入取消订单流程")
globals.SugarLogger.Debug("进入取消订单流程,输出退款金额", refundFee)
result, err := api.TLpayAPI.PayRefund(&tonglianpayapi.PayRefundParam{
Trxamt: refundFee / 100,
Reqsn: utils.GetUUID(),
Remark: refundDesc,
OldTrxID: orderPay.TransactionID,
})
globals.SugarLogger.Debug("result===============", result)
globals.SugarLogger.Debug("errerrerr===============", err)
if err == nil {
orderPayRefund = &model.OrderPayRefund{
RefundID: refundID,
@@ -727,7 +709,7 @@ func TryAgainOrder(ctx *jxcontext.Context, oldNo string) (*model.UserVendorOrder
Bulk: utils.Int2Float64(fee[fmt.Sprintf("%d", oldOrder.Type)].Data.Bulk),
ServiceCharge: fee[fmt.Sprintf("%d", oldOrder.Type)].Data.ServiceCharge,
GuarantFee: fee[fmt.Sprintf("%d", oldOrder.Type)].Data.GuarantFee,
OriginalFee: utils.MustInterface2Float64(fee[fmt.Sprintf("%d", oldOrder.Type)].Data.OriginalFee),
OriginalFee: utils.Interface2Float64WithDefault(fee[fmt.Sprintf("%d", oldOrder.Type)].Data.OriginalFee, 0.0),
Increment: fee[fmt.Sprintf("%d", oldOrder.Type)].Data.IncrementFee,
}
return CreateWayOrder(ctx, param, oldOrder.UserId)

View File

@@ -282,7 +282,6 @@ func (c *EventController) UploadImg() {
// @router /UploadAudio [post]
func (c *EventController) UploadAudio() {
c.callUploadAudio(func(params *tEventUploadAudioParams) (retVal interface{}, errCode string, err error) {
globals.SugarLogger.Debug("我进入UploadAudio了")
var (
timeStr = time.Now().Format("20060102")
filePath = audioPath + timeStr
@@ -308,7 +307,6 @@ func (c *EventController) UploadAudio() {
}
defer f.Close()
io.Copy(f, file)
globals.SugarLogger.Debug("打印一下f========", f, file)
//c.SaveToFile("rsmAudio", filePath+fileName)
return &model.ImMessageRecord{
//Content: "https://www.jxcs.net/jxdata/cthrgw/dist/audio/" + timeStr + "/" + fileName,

View File

@@ -119,6 +119,7 @@ func (c *User2Controller) GetUser() {
// @Param remark formData string false "备注"
// @Param isDefault formData int false "是否是默认"
// @Param type formData int false "1为寄件人2为取件人收货人"
// @Param autoAddress formData string false "详细地址"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /AddMyDeliveryAddress [post]
@@ -139,6 +140,7 @@ func (c *User2Controller) AddMyDeliveryAddress() {
Remark: params.Remark,
IsDefault: int8(params.IsDefault),
Type: params.Type,
AutoAddress: params.AutoAddress,
}
retVal, err = cms.AddMyDeliveryAddress(params.Ctx, address)
return retVal, "", err

View File

@@ -53,10 +53,20 @@ func Init() {
} else {
orm.RegisterDataBase("default", "mysql", "root:WebServer@1@tcp(127.0.0.1:3306)/api?charset=utf8mb4&loc=Local&parseTime=true")
// 打印机,迁移至api做
orm.RegisterModel(&model.PrintMsg{})
orm.RegisterModel(&model.Printer{})
orm.RegisterModel(&model.SystemTemp{})
orm.RegisterModel(&model.PrintSetting{})
orm.RegisterModel(&model.Apps{})
orm.RegisterModel(&model.Printer{}, &model.PrintMsg{}, &model.PrintSetting{}, &model.SystemTemp{})
orm.RegisterModel(&model.NewConfig{})
//orm.RegisterModel(&model.User{})
orm.RegisterModel(&model.Place{})
orm.RegisterModel(&model.Menu{})
orm.RegisterModel(&model.MenuDetail{})
orm.RegisterModel(&model.SimFlowExpend{}, &model.SimFlowIncome{})
orm.RegisterModel(&model.PayOrder{})
orm.RegisterModel(&model.PrintBill{})
orm.RegisterModel(&model.OrderPay{})
orm.RegisterModel(&model.PrintBillRecord{})
orm.RegisterModel(&model.PrintBindStore{})
orm.RegisterModel(&model.PrintActivation{})
}
// create table
orm.RunSyncdb("default", false, true)