|
@@ -92,6 +92,7 @@ class Cat extends Base
|
|
|
$data = [];
|
|
|
foreach ($list as $value) {
|
|
|
$value['item'] = array_column(made($value['id'] ?? 0), 'id');
|
|
|
+// $value['is_gold'] = cat_is_gold($value['id']);;
|
|
|
$data[] = $value;
|
|
|
}
|
|
|
return app_show(0, '获取成功', ['list' => $data, 'count' => $count]);
|
|
@@ -166,7 +167,6 @@ class Cat extends Base
|
|
|
public function create()
|
|
|
{
|
|
|
$param = $this->request->only(['cat_name', 'pid', 'cat_desc' => '', 'fund_code' => '', 'specs_id', 'weight' => 0, 'status' => 0], 'post', 'trim');
|
|
|
-// $cat_name = isset($this->post['cat_name']) && $this->post['cat_name'] !== '' ? trim($this->post['cat_name']) : '';
|
|
|
$val = Validate::rule([
|
|
|
'cat_name|分类名称' => 'require|max:255',
|
|
|
'pid|父级id' => 'require|number|egt:0',
|
|
@@ -176,18 +176,6 @@ class Cat extends Base
|
|
|
]);
|
|
|
|
|
|
if (!$val->check($param)) return json_show(1004, $val->getError());
|
|
|
-
|
|
|
-// if ($cat_name == '') {
|
|
|
-// return error_show(1002, '参数cat_name不能为空');
|
|
|
-// }
|
|
|
-// $pid = isset($this->post['pid']) && $this->post['pid'] !== '' ? intval($this->post['pid']) : '0';
|
|
|
-// if ($pid === '') {
|
|
|
-// return error_show(1002, '参数pid不能为空');
|
|
|
-// }
|
|
|
-
|
|
|
-// $cat_desc = isset($this->post['cat_desc']) && $this->post['cat_desc'] !== '' ? trim($this->post['cat_desc']) : '';
|
|
|
-// $fund_code = isset($this->post['fund_code']) && $this->post['fund_code'] !== '' ? trim($this->post['fund_code']) : '';
|
|
|
-
|
|
|
$level = 1;
|
|
|
|
|
|
if ($param['pid'] != 0) {
|
|
@@ -496,16 +484,8 @@ class Cat extends Base
|
|
|
//详情
|
|
|
public function info()
|
|
|
{
|
|
|
-// $id = isset($this->post['id']) && $this->post['id'] !== '' ? intval($this->post['id']) : '';
|
|
|
- $id = $this->request->post('id/d', 0, 'trim');
|
|
|
-// if ($id == '') {
|
|
|
-// return error_show(1002, '参数id不能为空');
|
|
|
-// }
|
|
|
-// $idinfo = Db::name('cat')->where(['id' => $id])->find();
|
|
|
-// if ($idinfo == '') {
|
|
|
-// return error_show(1002, '未找到数据');
|
|
|
-// }
|
|
|
|
|
|
+ $id = $this->request->post('id/d', 0, 'trim');
|
|
|
$idinfo = Db::name('cat')
|
|
|
->where(['id' => $id])
|
|
|
->append(['spec'])
|
|
@@ -519,12 +499,7 @@ class Cat extends Base
|
|
|
->toArray();
|
|
|
})
|
|
|
->findOrEmpty();
|
|
|
-
|
|
|
-// $info = Db::name('cat_specs')->where(['cat_id' => $idinfo['id'], 'is_del' => 0])->column('specs_id');
|
|
|
-// $temp = Db::name('specs')->where(['id' => $info, 'is_del' => 0])->field('id,spec_name')->select();
|
|
|
- //$idinfo['cat_id']=$info['cat_id'];
|
|
|
-// $idinfo['spec'] = $temp;
|
|
|
- // $idinfo['specs_id']=$info;
|
|
|
+
|
|
|
return $idinfo ? json_show(0, '获取成功', $idinfo) : json_show(1002, '未找到数据');
|
|
|
}
|
|
|
|
|
@@ -642,9 +617,6 @@ class Cat extends Base
|
|
|
$cat['platform_id'] = $value['id'];
|
|
|
$cat['addtime'] = $date;
|
|
|
$cat['updatetime'] = $date;
|
|
|
-// $isT = Db::name('cat_plat')
|
|
|
-// ->where(['cat_id' => $cat['cat_id'], 'platform_id' => $cat['platform_id'], 'is_del' => 0])
|
|
|
-// ->column('cat_id');
|
|
|
if (isset($isT[$cat['platform_id']])) {
|
|
|
$data = $cat;
|
|
|
unset($data['cat_id']);
|