|
@@ -37,12 +37,16 @@ class Manage extends Auth
|
|
|
}
|
|
|
|
|
|
|
|
|
- public function getGoods()
|
|
|
+ public function getGoods($cate_key = '')
|
|
|
{
|
|
|
- $cate = Dever::db('cate', 'goods')->select([]);
|
|
|
+ $where = array();
|
|
|
+ if ($cate_key) {
|
|
|
+ $where['key'] = $cate_key;
|
|
|
+ }
|
|
|
+ $cate = Dever::db('cate', 'goods')->select($where);
|
|
|
$result = array();
|
|
|
foreach ($cate as $k => $v) {
|
|
|
- $goods = Dever::db('info', 'goods')->select(array('cate_id' => $v['id']));
|
|
|
+ $goods = Dever::db('info', 'goods')->select(array('cate_id' => $v['id'], 'status' => 1));
|
|
|
if ($goods) {
|
|
|
$result[] = array
|
|
|
(
|
|
@@ -56,12 +60,16 @@ class Manage extends Auth
|
|
|
}
|
|
|
|
|
|
|
|
|
- public function getGoodsSku()
|
|
|
+ public function getGoodsSku($cate_key = '')
|
|
|
{
|
|
|
- $cate = Dever::db('cate', 'goods')->select([]);
|
|
|
+ $where = array();
|
|
|
+ if ($cate_key) {
|
|
|
+ $where['key'] = $cate_key;
|
|
|
+ }
|
|
|
+ $cate = Dever::db('cate', 'goods')->select($where);
|
|
|
$result = array();
|
|
|
foreach ($cate as $k => $v) {
|
|
|
- $goods = Dever::db('info', 'goods')->select(array('cate_id' => $v['id']));
|
|
|
+ $goods = Dever::db('info', 'goods')->select(array('cate_id' => $v['id'], 'status' => 1));
|
|
|
if ($goods) {
|
|
|
foreach ($goods as $k1 => $v1) {
|
|
|
$sku = Dever::db('info_sku', 'goods')->select(array('info_id' => $v1['id']));
|
|
@@ -110,4 +118,19 @@ class Manage extends Auth
|
|
|
$cate = array_merge($cate, Dever::db('cate', 'goods')->select([]));
|
|
|
return $cate;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public function showGoodsInfo($goods, $goods_id, $sku_id)
|
|
|
+ {
|
|
|
+ $goods = Dever::db('info', 'goods')->find($goods_id);
|
|
|
+ $sku = Dever::db('info_sku', 'goods')->find($sku_id);
|
|
|
+ $result = $goods['name'];
|
|
|
+ if ($sku['key'] != -1) {
|
|
|
+ $spec = Dever::db('info_spec_value', 'goods')->find(array('id' => array('in', $sku['key'])), array('col' => 'id,group_concat(value) as name', 'group' => 'info_id'));
|
|
|
+ if ($spec) {
|
|
|
+ $result .= '-' . $spec['name'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
}
|