API接口通用訂單列表中訂單商品縮略圖回調(diào)怎么寫(xiě)?
通用訂單-我的訂單,API接口返回的是
data>list>0>godds>0

以下回調(diào)只能寫(xiě)到訂單信息,還要加一層訂單里面商品信息(goods)
$rt = [];
if ($data) {
foreach ($data['list'] as $t) {
$rt[] = [
'sn' => $t['sn'], // 標(biāo)題
'title' => $t['title'], // 標(biāo)題
'id' => $t['id'], // id號(hào)
'uid' => $t['uid'], // id號(hào)
'mid' => $t['mid'], // id號(hào)
'catname' => dr_cat_value('news', $t['catid'], 'name'), // news模塊的當(dāng)前內(nèi)容欄目名稱(chēng)
'price' => $t['price'], // news模塊的當(dāng)前內(nèi)容欄目名稱(chēng)
'quantity' => $t['quantity'], // news模塊的當(dāng)前內(nèi)容欄目名稱(chēng)
'sku_name' => $t['sku_name'], // news模塊的當(dāng)前內(nèi)容欄目名稱(chēng)
'sku_value' => $t['sku_value'], // news模塊的當(dāng)前內(nèi)容欄目名稱(chēng)
'thumb' => dr_thumb($t['thumb'], 200, 200), // 圖片id轉(zhuǎn)換為地址
'updatetime' => dr_date($t['inputtime'], 'Y-m-d H:i:s'), // 時(shí)間轉(zhuǎn)換
'goods' => $t['goods'], // goods
];
}
}
return $rt;'goods' => $t['goods'], // goods 這里面的縮略圖回調(diào)
$rt = []; if ($data) { foreach ($data['list'] as $t) { foreach($t['goods'] as $i => $v) { $t['goods'][$i]['thumb']=dr_get_file($v['thumb']); } $rt[] = [ 'sn' => $t['sn'], // 標(biāo)題 'title' => $t['title'], // 標(biāo)題 'id' => $t['id'], // id號(hào) 'uid' => $t['uid'], // id號(hào) 'mid' => $t['mid'], // id號(hào) 'catname' => dr_cat_value('news', $t['catid'], 'name'), // news模塊的當(dāng)前內(nèi)容欄目名稱(chēng) 'price' => $t['price'], // news模塊的當(dāng)前內(nèi)容欄目名稱(chēng) 'quantity' => $t['quantity'], // news模塊的當(dāng)前內(nèi)容欄目名稱(chēng) 'sku_name' => $t['sku_name'], // news模塊的當(dāng)前內(nèi)容欄目名稱(chēng) 'sku_value' => $t['sku_value'], // news模塊的當(dāng)前內(nèi)容欄目名稱(chēng) 'thumb' => dr_thumb($t['thumb'], 200, 200), // 圖片id轉(zhuǎn)換為地址 'updatetime' => dr_date($t['inputtime'], 'Y-m-d H:i:s'), // 時(shí)間轉(zhuǎn)換 'goods' => $t['goods'], // goods ]; } } return $rt;開(kāi)源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問(wèn)題!