request->only([ 'page' => 1, 'size' => 10, 'good_code' => '', 'good_name' => '', 'status' => '', 'type' => '' ], 'post'); return GoodLogic::list($param); } //添加商品 public function add() { $param = $this->request->only([ 'good_cover_img', 'good_name', 'moq', 'step', 'good_banner_img', 'good_img', 'good_param', 'unit_id', 'type', 'price' => 0, 'good_remark' => '', ], 'post'); validate(GoodValidate::class)->scene('add')->check($param); return GoodLogic::add($param); } //读取商品详情 public function read() { $id = $this->request->post('id/d', 0); validate(GoodValidate::class)->scene('read')->check(['id' => $id]); return GoodLogic::read($id); } //编辑商品 public function edit() { $param = $this->request->only([ 'id', 'good_cover_img', 'good_name', 'moq', 'step', 'price', 'good_banner_img', 'good_img', 'good_param', 'unit_id', 'good_remark', ], 'post'); validate(GoodValidate::class)->scene('edit')->check($param); return GoodLogic::edit($param); } //商品启禁用 public function status() { $param = $this->request->only(['id', 'status',], 'post'); $val = Validate::rule(Config::get('validate_rules.status')); if (!$val->check($param)) throw new ValidateException($val->getError()); return GoodLogic::status($param); } //删除商品 public function delete() { $id = $this->request->post('id/d', 0); return GoodLogic::delete($id); } }