API接口通用订单列表中订单商品缩略图回调怎么写

迅睿框架 更新 2024-04-24 10:38:04 不耻下问

API接口通用订单列表中订单商品缩略图回调怎么写?


通用订单-我的订单,API接口返回的是

data>list>0>godds>0

image


以下回调只能写到订单信息,还要加一层订单里面商品信息(goods)

$rt = [];
if ($data) {
    foreach ($data['list'] as $t) {
        $rt[] = [
            'sn' => $t['sn'], // 标题
            'title' => $t['title'], // 标题
            'id' => $t['id'], // id号
            'uid' => $t['uid'], // id号
            'mid' => $t['mid'], // id号
            'catname' => dr_cat_value('news', $t['catid'], 'name'), // news模块的当前内容栏目名称
            'price' => $t['price'], // news模块的当前内容栏目名称
            'quantity' => $t['quantity'], // news模块的当前内容栏目名称
            'sku_name' => $t['sku_name'], // news模块的当前内容栏目名称
            'sku_value' => $t['sku_value'], // news模块的当前内容栏目名称
            'thumb' => dr_thumb($t['thumb'], 200, 200), // 图片id转换为地址
            'updatetime' => dr_date($t['inputtime'], 'Y-m-d H:i:s'), // 时间转换
            'goods' => $t['goods'], // goods
        ];
    }
}
return $rt;

'goods' => $t['goods'], // goods
这里面的缩略图回调

方案

  • 迅睿框架技术-阿锋 #1 · 2023-06-24 18:16:16
    满意答案
    $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'], // 标题
                'title' => $t['title'], // 标题
                'id' => $t['id'], // id号
                'uid' => $t['uid'], // id号
                'mid' => $t['mid'], // id号
                'catname' => dr_cat_value('news', $t['catid'], 'name'), // news模块的当前内容栏目名称
                'price' => $t['price'], // news模块的当前内容栏目名称
                'quantity' => $t['quantity'], // news模块的当前内容栏目名称
                'sku_name' => $t['sku_name'], // news模块的当前内容栏目名称
                'sku_value' => $t['sku_value'], // news模块的当前内容栏目名称
                'thumb' => dr_thumb($t['thumb'], 200, 200), // 图片id转换为地址
                'updatetime' => dr_date($t['inputtime'], 'Y-m-d H:i:s'), // 时间转换
                'goods' => $t['goods'], // goods
            ];
        }
    }
    return $rt;
  • 匿名者 #2 · 2023-07-02 16:46:24
    @不耻下问 官方技术员写的这么完美 解决了吗
  • 不耻下问 #3 · 2024-04-24 10:38:04
    @迅睿框架技术-阿锋:完结完结完结完结

迅睿系统漏洞

在线考试竞赛系统
在线考试竞赛系统(2026-09-12)
增加投票功能 考试功能拓展 注意:更新后需要执行系统更新,更新数...
网上信箱
网上信箱(2026-09-12)
修复新版本兼容问题
GeoSeo收录宝
GeoSeo收录宝(2026-09-12)
1 优化Update.php文件,解决版本在线升级不完整问题 2 ...
GeoSeo工具箱
GeoSeo工具箱(2026-09-11)
修正历史记录推送
微信系统
微信系统(2026-09-11)
增加数据统计总览界面 账号管理增加服务和公众号的区别 菜单管理支持更...
答题系统
答题系统(2026-09-11)
一站式在线答题系统,支持真题考试、题库练习和错题本,适合培训、考证、...
阿里云滑动验证码
阿里云滑动验证码(2026-09-10)
采用阿里云验证码替换迅睿系统自带的图片验证码和滑动验证码。后台设置方...
下载Plus
下载Plus(2026-09-09)
为网站附件下载加上“计数、限次、统计、防护”四重能力:按用户组控制下...
全库搜索
全库搜索(2026-09-09)
修复全模块搜索时,删除按钮点击无效的bug
在线客服
在线客服(2026-09-09)
增加消息提示音