|
@@ -19,6 +19,7 @@ use app\common\constant\CommonConstant;
|
|
|
use app\common\service\GoodsCategoryService;
|
|
|
use library\Controller;
|
|
|
use library\tools\Data;
|
|
|
+use think\Db;
|
|
|
|
|
|
/**
|
|
|
* 商品分类
|
|
@@ -114,8 +115,8 @@ class GoodsCategory extends Controller
|
|
|
protected function _form_filter(&$data)
|
|
|
{
|
|
|
if ($this->request->isGet()) {
|
|
|
- $category_list = GoodsCategoryService::get_list([]);
|
|
|
- $this->category_list = array_merge([['id' => '0', 'pid' => '-1', 'name' => '顶级']],$category_list ? $category_list->toArray() : []);
|
|
|
+ $this->category_list = GoodsCategoryService::get_list([]);
|
|
|
+ $this->category_list = array_merge([['id' => '0', 'pid' => '-1', 'name' => '顶级']],$this->category_list ? $this->category_list->toArray() : []);
|
|
|
}
|
|
|
if ($this->request->isPost()) {
|
|
|
|
|
@@ -135,4 +136,23 @@ class GoodsCategory extends Controller
|
|
|
$this->_delete($this->table);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除结果处理
|
|
|
+ * @param boolean $result
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
+ */
|
|
|
+ protected function _remove_delete_result($result)
|
|
|
+ {
|
|
|
+ if ($result) {
|
|
|
+ list($data) = [$this->request->post()];
|
|
|
+ if($data['pid'] == 0){
|
|
|
+ Db::name($this->table)->where('pid',$data['id'])->update(['is_deleted' => CommonConstant::IS_DELETED_1]);
|
|
|
+ }
|
|
|
+ $this->success("删除成功!", '');
|
|
|
+ } else {
|
|
|
+ $this->error("删除失败,请稍候再试!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|