智简魔方文档

结算购物车

方法概览

项目内容
文档类型PHP 类方法
方法标识app\home\model\CartModel::settle
所属业务商品管理
来源模块/系统购物车模型

功能说明

结算购物车

调用示例

$positions = ['string'];
$customfield = [];
$param = ['downstream_host_id' => 1, 'downstream_url' => 'https://example.com/callback', 'downstream_token' => 'example-token', 'downstream_system_type' => 'string'];
$result = (new \app\home\model\CartModel())->settle($positions, $customfield, $param);

参数

参数类型必填默认值校验规则说明
positionsarrayrequired商品位置数组
customfieldobject自定义参数,比如优惠码参数传:{"promo_code":["pr8nRQOGbmv5"]}
param.downstream_host_idint下游产品ID
param.downstream_urlstring下游地址
param.downstream_tokenstring下游产品token
param.downstream_system_typestring下游系统类型

返回值

返回项类型说明
dataobject数据
data.order_idint订单ID
statusint状态码,200成功,400失败
msgstring提示信息

正常返回

{
  "data": {
    "order_id": 1
  },
  "status": 1,
  "msg": "string"
}

异常情况

异常类型说明
Throwable调用失败时由具体实现抛出异常,异常信息以运行时结果为准。