我有一个“简单”的问题,但这让我头疼。我正在将我的项目与PagSeguro API集成在一起,我的购物车JSON是:
{
"0": {
"id": "ItsVRseZ",
"name": "82",
"price": 140,
"quantity": 1,
"attributes": {
"type": "ticket",
"match": {
"championship": "Gauchão 2018",
"club_main": "Internacional",
"club_main_arms": "/images/clubs/1/1537880299212.png",
"club_visitor": "Grêmio",
"club_visitor_arms": "/images/clubs/2/1537880338132.png",
"stadium": "Beira Rio",
"date_match": "30/11/2018 às 20:11"
},
"lot": 5,
"sector": "101"
},
"conditions": []
},
"1": {
"id": "tJfVtJt4",
"name": "83",
"price": 140,
"quantity": 1,
"attributes": {
"type": "ticket",
"match": {
"championship": "Gauchão 2018",
"club_main": "Internacional",
"club_main_arms": "/images/clubs/1/1537880299212.png",
"club_visitor": "Grêmio",
"club_visitor_arms": "/images/clubs/2/1537880338132.png",
"stadium": "Beira Rio",
"date_match": "30/11/2018 às 20:11"
},
"lot": 5,
"sector": "101"
},
"conditions": []
},
"elo_balance": 80,
"total": 200,
"subtotal": 280
}
我的问题是,我想将我的票证0
和1
的数组及其各自的ids, names and attributes
发送到PagSeguro ex的灯箱中:
国际高尔夫协会x格莱米奥·佩洛·坎佩纳托:高乔2018年。埃斯塔迪奥:贝拉里奥dia 30/11/2018às20:11。卡迪拉:82
国际高尔夫协会x格莱米奥·佩洛·坎佩纳托:高乔2018年。埃斯塔迪奥:贝拉里奥dia 30/11/2018às20:11。卡迪拉:83
foreach ($items as $item) {
$match = $item->attributes->match;
$data['payment'] = array(
'client' => array(
'name_full' => Auth::user()->name_first . ' ' . Auth::user()->name_second,
'email' => Auth::user()->email,
'phone' => substr(Auth::user()->phone, 2),
'cpf' => Auth::user()->cpf
),
'ticket' => array(
'id' => $item->id,
'description' => 'Ingresso para o jogo: ' . $match['club_main'] . ' X ' . $match['club_visitor'] . ', pelo campeonato: ' . $match['championship'],
'quantity' => $item->quantity,
'amount' => number_format($info['total'], 2)
)
);
$payment = PagSeguro::sendPayment($data['payment']);
目前,我的送货方式是这样的,我提交的值是我的JSON总计,而我的description
是一个描述,该描述从该数组中获取第一个,但是我想获取所有票。
我不知道我的主意是否明确,但任何疑问都只能谈谈!任何可以发光的人,非常感谢。