1
This commit is contained in:
@@ -18,7 +18,7 @@ type OrderController struct {
|
||||
// @Param orderID formData string true "订单号"
|
||||
// @Param payType formData int true "支付平台类型"
|
||||
// @Param vendorPayType formData string true "平台支付类型"
|
||||
// @Param orderType formData string true "订单类型member(会员),express快递,recharge充值"
|
||||
// @Param orderType formData string true "订单类型member(会员),express快递,recharge充值,telephoneBill充话费"
|
||||
// @Param appId formData string true "appId"
|
||||
// @Param isChoose formData int true "-1:未选中余额抵消 1:余额抵消"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
@@ -70,17 +70,19 @@ func (c *OrderController) Cash() {
|
||||
// @Description 创建订单
|
||||
// @Param token header string true "认证token"
|
||||
// @Param type formData int true "支付类型/账单类型"
|
||||
// @Param orderType formData int true "订单类型,1为发任务,2为冲会员,3为发快递,6-需要充值到余额购买的方式"
|
||||
// @Param orderType formData int true "订单类型,1为发任务,2为冲会员,3为发快递,6-需要充值到余额购买的方式,7-话费充值"
|
||||
// @Param way formData string true "认证方式"
|
||||
// @Param price formData int true "支付金额"
|
||||
// @Param lng formData float64 true "经纬度"
|
||||
// @Param lat formData float64 true "经纬度"
|
||||
// @Param mobile formData string false "充值电话"
|
||||
// @Param flowCode formData string false "业务代码"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /CreateOrder [post]
|
||||
func (c *OrderController) CreateOrder() {
|
||||
c.callCreateOrder(func(params *tOrderCreateOrderParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, errCode, err = cms.CreateOrder(params.Ctx, params.Type, params.OrderType, params.Way, params.Price, params.Lng, params.Lat)
|
||||
retVal, errCode, err = cms.CreateOrder(params.Ctx, params.Type, params.OrderType, params.Way, params.Price, params.Lng, params.Lat, params.Mobile, params.FlowCode)
|
||||
return retVal, errCode, err
|
||||
})
|
||||
}
|
||||
|
||||
69
controllers/recharge_callback.go
Normal file
69
controllers/recharge_callback.go
Normal file
@@ -0,0 +1,69 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"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"
|
||||
beego "github.com/astaxie/beego/adapter"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type RechargeController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
type CallBackMsg struct {
|
||||
Sign string `json:"sign"` // 签名:大写( md5( md5(密码)+ 平台订单号+秘钥 ) )
|
||||
Msg string `json:"msg"` // 响应结果描述
|
||||
OrderNumber string `json:"order_number "` // 平台订单号
|
||||
UserOrdernum string `json:"user_ordernum"` // 商户订单号
|
||||
OrderStatus string `json:"order_status"` // 状态:0:未提交,1:充值中,2:已充值,-1:失败
|
||||
Mobile string `json:"mobile"` // 电话
|
||||
Ctime string `json:"ctime"` // ctime
|
||||
Voucher string `json:"voucher"` // 透传流水号
|
||||
}
|
||||
|
||||
func (c *RechargeController) Msg() {
|
||||
if c.Ctx.Input.Method() == http.MethodPost {
|
||||
data, err := ioutil.ReadAll(getUsefulRequest2(c.Ctx).Body)
|
||||
if err != nil {
|
||||
c.Abort("404")
|
||||
return
|
||||
}
|
||||
values, err := utils.HTTPBody2Values(data, false)
|
||||
if err != nil {
|
||||
c.Abort("404")
|
||||
return
|
||||
}
|
||||
mapData := utils.URLValues2Map(values)
|
||||
resultData := CallBackMsg{}
|
||||
if err := utils.Map2StructByJson(mapData, &resultData, false); err != nil {
|
||||
c.Abort("404")
|
||||
return
|
||||
}
|
||||
|
||||
if resultData.OrderStatus == "0" || resultData.OrderStatus == "1" {
|
||||
c.Data["json"] = "success"
|
||||
c.ServeJSON()
|
||||
return
|
||||
}
|
||||
// 获取平台订单
|
||||
order := &model.Order{
|
||||
OrderID: resultData.UserOrdernum,
|
||||
}
|
||||
if err = dao.GetEntity(dao.GetDB(), order, "OrderID"); err != nil {
|
||||
globals.SugarLogger.Debugf("本地加载订单错误,请查询:%s", err)
|
||||
c.Abort("404")
|
||||
return
|
||||
}
|
||||
order.RechargeStatus = utils.Str2Int(resultData.OrderStatus)
|
||||
|
||||
dao.UpdateEntity(dao.GetDB(), order, "RechargeStatus")
|
||||
c.Data["json"] = "success"
|
||||
c.ServeJSON()
|
||||
} else {
|
||||
c.Abort("404")
|
||||
}
|
||||
}
|
||||
105
controllers/recharge_controller.go
Normal file
105
controllers/recharge_controller.go
Normal file
@@ -0,0 +1,105 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
beego "github.com/astaxie/beego/adapter"
|
||||
)
|
||||
|
||||
type RechargeManagerController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// GetUserRecharge 用户查询充值记录
|
||||
// @Title 分页查询用户充值列表
|
||||
// @Description 分页查询用户充值列表
|
||||
// @Param token header string true "认证token"
|
||||
// @Param page formData int true "页码"
|
||||
// @Param pageSize formData int true "页数"
|
||||
// @Param mobile formData string false "电话"
|
||||
// @Param orderId formData string false "订单号"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetUserRecharge [post]
|
||||
func (c *RechargeManagerController) GetUserRecharge() {
|
||||
c.callGetUserRecharge(func(params *tRechargeGetUserRechargeParams) (interface{}, string, error) {
|
||||
result, count, err := cms.QueryUserRecharge([]string{params.Ctx.GetUserID()}, params.Mobile, params.OrderId, params.Page, params.PageSize, "", "", 0)
|
||||
userRecharge := make(map[string]interface{}, 2)
|
||||
userRecharge["data"] = result
|
||||
userRecharge["count"] = count
|
||||
return userRecharge, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// GetRechargeOrderDetail 订单详情查询
|
||||
// @Title 订单详情查询
|
||||
// @Description 订单详情查询
|
||||
// @Param token header string true "认证token"
|
||||
// @Param orderId formData string true "订单号"
|
||||
// @Param mobile formData string true "手机号"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetRechargeOrderDetail [get]
|
||||
func (c *RechargeManagerController) GetRechargeOrderDetail() {
|
||||
c.callGetRechargeOrderDetail(func(params *tRechargeGetRechargeOrderDetailParams) (interface{}, string, error) {
|
||||
result, err := cms.QueryUserOrderDetail(params.OrderId, params.Mobile)
|
||||
return result, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// SystemQueryRechargeList 管理系统获取订单详情
|
||||
// @Title 管理系统获取订单详情
|
||||
// @Description 管理系统获取订单详情
|
||||
// @Param token header string true "认证token"
|
||||
// @Param orderId formData string false "订单号"
|
||||
// @Param mobile formData string false "手机号"
|
||||
// @Param rechargeStatus formData int false "充值状态 0-未提交,3-等待待充值(本地) 1:充值中(三方),2:已充值,-1:失败(三方)"
|
||||
// @Param page formData int true "页码"
|
||||
// @Param pageSize formData int true "页数"
|
||||
// @Param startTime formData string true "开始时间"
|
||||
// @Param endTime formData string true "结束时间"
|
||||
// @Param userName formData string false "用户名"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /SystemQueryRechargeList [post]
|
||||
func (c *RechargeManagerController) SystemQueryRechargeList() {
|
||||
c.callSystemQueryRechargeList(func(params *tRechargeSystemQueryRechargeListParams) (interface{}, string, error) {
|
||||
userIdList := make([]string, 0, 0)
|
||||
// 根据用户获取用户id
|
||||
if params.UserName != "" {
|
||||
userList, _, err := dao.GetUsers(dao.GetDB(), 0, params.UserName, "", nil, nil, nil, 0, 0)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
if len(userList) == 0 {
|
||||
return nil, "", errors.New(fmt.Sprintf("未查询到此用户:[%s]", params.UserName))
|
||||
}
|
||||
for _, v := range userList {
|
||||
userIdList = append(userIdList, v.UserID)
|
||||
}
|
||||
}
|
||||
|
||||
result, count, err := cms.QueryUserRecharge(userIdList, params.Mobile, params.OrderId, params.Page, params.PageSize, params.StartTime, params.EndTime, params.RechargeStatus)
|
||||
userRecharge := make(map[string]interface{}, 2)
|
||||
userRecharge["data"] = result
|
||||
userRecharge["count"] = count
|
||||
return userRecharge, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// QueryAccountBill 查询当前账号余额
|
||||
// @Title 查询当前账号余额
|
||||
// @Description 查询当前账号余额
|
||||
// @Param token header string true "认证token"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /QueryAccountBill [get]
|
||||
func (c *RechargeManagerController) QueryAccountBill() {
|
||||
c.callQueryAccountBill(func(params *tRechargeQueryAccountBillParams) (interface{}, string, error) {
|
||||
balance, err := api.TelephoneAPI.QueryAccountBill()
|
||||
return balance, "", err
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user