【產(chǎn)品名稱】:CRMEB PRO版 / 多店版
【產(chǎn)品版本】:v2.3.1(20221122)
【部署方式】:linux / docker
【部署環(huán)境】:本地環(huán)境 / 線上環(huán)境
【php版本】:7.4
【Mysql版本】:5.8
【使用終端】:小程序
商品詳情頁有銷量
拼團(tuán)詳情頁累計(jì)銷量為0
查看前端代碼讀取的 storeInfo.total 字段
查看后端代碼有關(guān)聯(lián)查詢 with(['total']),在 app/model/activity/combination/StoreCombination.php 大概136行
/**
* 一對(duì)一關(guān)聯(lián)
* 商品關(guān)聯(lián)商品商品詳情
* @return \think\model\relation\HasOne
*/
public function total()
{
return $this->hasOne(StoreProduct::class, 'id', 'product_id')->where('is_show', 1)->where('is_del', 0)->field(['SUM(sales+ficti) as total', 'id', 'price'])->bind([
'total' => 'total', 'product_price' => 'price'
]);
}
函數(shù)名和返回的bind屬性total重名了,在model返回中被hidden掉了
修復(fù)如下:
修改 public function total() 為 public function totals()
修改 app/services/activity/combination/StoreCombinationServices.php 文件 combinationDetail 函數(shù)(大概375行)
原始代碼:
$storeInfo = $this->dao->getOne(['id' => $id], '*', ['descriptions', 'total']);
修改為:
$storeInfo = $this->dao->getOne(['id' => $id], '*', ['descriptions', 'totals']);
修改 app/dao/activity/combination/StoreCombinationDao.php 文件 validProduct 函數(shù) (大概137行)
原始代碼:
return $this->search($where)->where('id', $id)->with(['total'])->field($field)->order('add_time desc')->find();
修改為:
return $this->search($where)->where('id', $id)->with(['totals'])->field($field)->order('add_time desc')->find();
修改后可以正常顯示累計(jì)銷量
最終修復(fù)還是已官方修復(fù)為準(zhǔn),以上為本人臨時(shí)的修補(bǔ)方案。