购买api
This commit is contained in:
@@ -185,6 +185,33 @@ namespace Home.Controllers
|
||||
return new ApiResult(data);
|
||||
}
|
||||
|
||||
[HttpPost,AllowAnonymous]
|
||||
public async Task<ApiResult> ApiCreateOrder([FromBody]CreateOrderRequest request)
|
||||
{
|
||||
request.UseAccountAmount = 1;
|
||||
request.CouponId = 0;
|
||||
//通过apikey获取用户信息
|
||||
var userEntity = m_UserService.Query(m => m.apikey == request.apikey).FirstOrDefault();
|
||||
if (userEntity == null)
|
||||
{
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "apikey不正确");
|
||||
}
|
||||
var userId = userEntity.Id;
|
||||
var ret = await m_ProductOrderService.CreateOrder(request, userId);
|
||||
|
||||
if (ret.Code != ResultCode.C_SUCCESS)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
if (ret.Data.OtherPayAmount == 0)
|
||||
{
|
||||
await m_ProductOrderService.ProcessOrderAccount(ret.Data);
|
||||
return new ApiResult("00");
|
||||
}
|
||||
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "未知错误!联系客服解决!");
|
||||
}
|
||||
|
||||
|
||||
#region 微信支付
|
||||
private async Task<string> CreateWxPayOrder(ProductOrderEntity request)
|
||||
|
||||
Reference in New Issue
Block a user