60], [['pic_url'], 'string'], [['is_show'], 'default', 'value' => 1], [['is_delete'], 'default', 'value' => 0] ]; } /** * 保存分类 * @return array */ public function save() { $this->model->parent_id = $this->parent_id; $this->model->is_show = $this->is_show; $this->model->name = $this->name; $this->model->pic_url = $this->pic_url; $this->model->sort = $this->sort; $this->model->store_id = $this->store_id; if ($this->model->save()) { return [ 'code' => 0, 'msg' => '提交成功' ]; } else { return [ 'code' => 0, 'msg' => '保存失败' ]; } } /** * Undocumented function * * @Author LGL 24963@qq.com * @DateTime 2021-01-18 * @desc: 根据id获取分类列表 * @param array $id * @return void */ public static function getCatListById ($id = []) { if (empty($id) && !is_array($id)) { return []; } return Cat::find()->where(['in', 'id', $id])->select('id, name, pic_url')->asArray()->all(); } }