1
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -287,6 +288,36 @@ func RefundBarCodeScannerOrder(ctx *jxcontext.Context, vendorOrderId string, sku
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddStoreTerm 添加设备终端
|
||||
func AddStoreTerm(storeId int, operation string) error {
|
||||
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeId, model.VendorIDJX, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
index := strings.LastIndex(storeDetail.Address, storeDetail.DistrictName)
|
||||
address := ""
|
||||
if index < 0 {
|
||||
address = storeDetail.Address
|
||||
} else {
|
||||
address = storeDetail.Address[index+len(storeDetail.DistrictName):]
|
||||
}
|
||||
param := &tonglianpayapi.AddTermReq{
|
||||
Termno: fmt.Sprintf("%d_1", storeDetail.ID),
|
||||
Devicetype: "10",
|
||||
Termsn: fmt.Sprintf("%d_1", storeDetail.ID),
|
||||
Operation: operation,
|
||||
Termstate: "",
|
||||
Termaddress: fmt.Sprintf("%s-%s-%s-%s", storeDetail.ProvinceName, storeDetail.CityName, storeDetail.DistrictName, address),
|
||||
Signtype: tonglianpayapi.EncryptionRsa,
|
||||
Sign: "",
|
||||
}
|
||||
if operation == tonglianpayapi.ScannerOperrationStart {
|
||||
param.Termstate = tonglianpayapi.ScannerOperrationStart
|
||||
}
|
||||
|
||||
return api.TLpayAPI.TLAddTerm(param)
|
||||
}
|
||||
|
||||
func checkJxAfsOrder(db *dao.DaoDB, goodsOrder *model.GoodsOrder, vendorOrderId string, skuIds map[int]int) (bool, int, error) {
|
||||
if goodsOrder.Status != model.OrderStatusFinished {
|
||||
return false, 0, fmt.Errorf("订单未完成支付,无法退款(刷新订单状态/联系管理员)")
|
||||
|
||||
@@ -70,6 +70,21 @@ func (c *JxOrderController) RefreshPayStatus() {
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 注册和注销门店扫码枪设备
|
||||
// @Description 注册和注销门店扫码枪设备
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeId formData int true "京西门店ID"
|
||||
// @Param operation formData string true "当前操作00-新增,02-注销"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /TerminalRegister [post]
|
||||
func (c *JxOrderController) TerminalRegister() {
|
||||
c.callTerminalRegister(func(params *tJxorderTerminalRegisterParams) (retVal interface{}, errCode string, err error) {
|
||||
err = localjx.AddStoreTerm(params.StoreId, params.Operation)
|
||||
return retVal, errCode, err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 到店扫码支付订单退款
|
||||
// @Description 到店扫码支付订单退款
|
||||
// @Param token header string true "认证token"
|
||||
|
||||
@@ -877,6 +877,14 @@ func init() {
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"],
|
||||
web.ControllerComments{
|
||||
Method: "TerminalRegister",
|
||||
Router: `/TerminalRegister`,
|
||||
AllowHTTPMethods: []string{"post"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"],
|
||||
web.ControllerComments{
|
||||
Method: "RefundOnlineOrder",
|
||||
|
||||
Reference in New Issue
Block a user