当前位置: 首页 > article >正文

积分商品编辑规格里积分未会显问题处理

文件地址:app/services/product/sku/StoreProductAttrValueServices.php

方法名:getattr

替换此方法:

public function getattr($attr, $id, $type)
    {
        $value = attr_format($attr)[1];
        $valueNew = [];
        $count = 0;
        if ($type == 2) {
            /** @var StoreBargainServices $storeBargainServices */
            $storeBargainServices = app()->make(StoreBargainServices::class);
            $min_price = $storeBargainServices->value(['id' => $id], 'min_price');
        } else {
            $min_price = 0;
        }
        $sukValueArr = $this->getSkuArray(['product_id' => $id, 'type' => $type], 'bar_code,code,cost,price,ot_price,stock,image as pic,weight,volume,brokerage,brokerage_two,quota,quota_show,settle_price,integral', 'suk');
        foreach ($value as $key => $item) {
            $detail = $item['detail'];
//            sort($item['detail'], SORT_STRING);
            $suk = implode(',', $item['detail']);
            $sukValue = $sukValueArr[$suk] ?? [];
            if ($sukValue) {
                foreach (array_values($detail) as $k => $v) {
                    $valueNew[$count]['value' . ($k + 1)] = $v;
                }
                $valueNew[$count]['detail'] = json_encode($detail);
                $valueNew[$count]['pic'] = $sukValue['pic'] ?? '';
                $valueNew[$count]['price'] = $sukValue['price'] ? floatval($sukValue['price']) : 0;
                $valueNew[$count]['integral'] = $sukValue['integral'] ?: 0;
                $valueNew[$count]['settle_price'] = $sukValue['cost'] ? floatval($sukValue['settle_price']) : 0;
                $valueNew[$count]['cost'] = $sukValue['cost'] ? floatval($sukValue['cost']) : 0;
                $valueNew[$count]['ot_price'] = isset($sukValue['ot_price']) ? floatval($sukValue['ot_price']) : 0;
                $valueNew[$count]['stock'] = $sukValue['stock'] ? intval($sukValue['stock']) : 0;
                $valueNew[$count]['quota'] = isset($sukValue['quota_show']) && $sukValue['quota_show'] ? intval($sukValue['quota_show']) : 0;
                $valueNew[$count]['code'] = $sukValue['code'] ?? '';
                $valueNew[$count]['bar_code'] = $sukValue['bar_code'] ?? '';
                $valueNew[$count]['weight'] = $sukValue['weight'] ? floatval($sukValue['weight']) : 0;
                $valueNew[$count]['volume'] = $sukValue['volume'] ? floatval($sukValue['volume']) : 0;
                $valueNew[$count]['brokerage'] = $sukValue['brokerage'] ? floatval($sukValue['brokerage']) : 0;
                $valueNew[$count]['brokerage_two'] = $sukValue['brokerage_two'] ? floatval($sukValue['brokerage_two']) : 0;
                switch ($type) {
                    case 1://秒杀
                        $valueNew[$count]['_checked'] = true;
                        break;
                    case 2://砍价
                        $valueNew[$count]['min_price'] = $min_price ? floatval($min_price) : 0;
                        $valueNew[$count]['opt'] = true;
                        break;
                    case 3://拼团
                        $valueNew[$count]['_checked'] = true;
                        break;
                    case 4://积分
                        $valueNew[$count]['integral'] = isset($sukValue['integral']) ? floatval($sukValue['integral']) : 0;
                        $valueNew[$count]['_checked'] = true;
                        break;
                    default:
                        $valueNew[$count]['_checked'] = false;
                        $valueNew[$count]['opt'] = false;
                        break;
                }
                $count++;
            }
        }
        return $valueNew;
    }

http://www.kler.cn/a/407585.html

相关文章:

  • 数字化工厂 MES试点方案全解析(二)
  • 【MySQL课程学习】:MySQL安装,MySQL如何登录和退出?MySQL的简单配置
  • Python数据结构day2
  • VisionPro 机器视觉案例 之 彩色保险丝个数统计
  • Java开发经验——开发常用工具类
  • 【Python TensorFlow】进阶指南(续篇三)
  • Bugku CTF_Web——my-first-sqli
  • 使用Python生成F分布表并导出为Excel文件
  • linux从0到1——shell编程7
  • WPF绑定Bind方法合集,实时更新
  • YOLOv8-ultralytics-8.2.103部分代码阅读笔记-transformer.py
  • 麒麟网络负载均衡与高可用方案实践
  • 【数据结构OJ】【图论】货币套汇(图路径)
  • 十、事件类型(鼠标事件、焦点.. 、键盘.. 、文本.. 、滚动..)、事件对象、事件流(事件捕获、事件冒泡、阻止冒泡和默认行为、事件委托)
  • 【Python入门第七讲】列表(List)
  • Spire.PDF for .NET【页面设置】演示:打开 PDF 时自动显示书签或缩略图
  • chinaskills_cloud_iaas.iso镜像
  • 数据库【锁】的分类
  • Typora+PicGo+云服务器搭建博客图床
  • Github 2024-11-23 Rust开源项目日报 Top10
  • KVM虚拟机拷贝与迁移
  • 【强化学习的数学原理】第03课-贝尔曼最优公式-笔记
  • uniapp记录在微信小程序端修改复选框的样式
  • 大数据面试题每日练习--HDFS是如何工作的?
  • 如何通过OpenSSL来创建自签名的CA证书?
  • 软件测试面试之常规问题