public ResultMessage <ServiceInfoOutput> GetUnifiedOrder(string openId, double fee) { try { if (fee % 100 != 0) { return(new ResultMessage <ServiceInfoOutput>(ResultCode.Fail, "您要充值的金额必须是100的整数")); } var result = _purchaseService.UnifiedOrderResult(new ServiceOrder() { body = WxPayConfig.RECHARGE_NAME, openid = openId, total_fee = Convert.ToInt32(fee * 100), }); var data = new ServiceInfoOutput() { OrderId = result.GetValue("orderid").ToString(), ServiceName = WxPayConfig.RECHARGE_NAME, OpenId = openId, OrderPrice = (decimal)fee, PrepayId = result.GetValue("prepay_id").ToString(), Description = "代理商在线充值服务", Sid = null, }; return(new ResultMessage <ServiceInfoOutput>(data)); } catch (Exception e) { LogHelper.Logger.Error(e.Message); return(new ResultMessage <ServiceInfoOutput>(ResultCode.Fail, "生成订单失败,请重试")); } }
public ResultMessage <ServiceInfoOutput> GetUnifiedOrder(ServiceInfoInput input) { try { var result = _purchaseService.UnifiedOrderResult(new ServiceOrder() { body = input.body, openid = input.openid, total_fee = Convert.ToInt32(input.total_fee * 100), }); var data = new ServiceInfoOutput() { OrderId = result.GetValue("orderid").ToString(), ServiceName = input.body, OpenId = input.openid, OrderPrice = input.total_fee, PrepayId = result.GetValue("prepay_id").ToString(), Description = input.description, Sid = input.sid, PriceId = input.priceid, }; return(new ResultMessage <ServiceInfoOutput>(data)); } catch (Exception e) { LogHelper.Logger.Error("订单生成失败!" + e.Message); return(new ResultMessage <ServiceInfoOutput>(ResultCode.Fail, "订单生产失败,原因:" + e.Message + ",请重试!")); } }