StoreProductLogDao中如何二级关联出商品绑定品牌出来
return $this->search($where)->with(['storeName'])
->field([
'product_id',
'SUM(visit_num) as visit',
'COUNT(distinct(uid)) as user',
'SUM(cart_num) as cart',
'SUM(order_num) as orders',
'SUM(pay_num) as pay',
'SUM(pay_price * pay_num) as price',
'SUM(cost_price) as cost',
'ROUND((SUM(pay_price)-SUM(cost_price))/SUM(cost_price),2) as profit',
'SUM(collect_num) as collect',
'ROUND((COUNT(distinct(pay_uid))-1)/COUNT(distinct(uid)),2) as changes',
'COUNT(distinct(pay_uid))-1 as repeats'
])
->group('product_id')->order($sortField . ' desc')->limit(20)->select()->toArray();
StoreProductLogDao加了storeProduct后,这样:$this->search($where)->with(['storeName','storeProduct.brand']) 好象不行。
如何关联第三个表eb_store_brand的品牌名出来,求大神指教??
{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}
作者 管理员 企业
{{itemf.name}}
{{itemc.user_info.nickname}}
{{itemc.user_name}}
回复 {{itemc.comment_user_info.nickname}}
{{itemf.name}}