0] ]; } /** * 保存分类 * @return array */ public function save() { if (!$this->validate()) { return [ 'code' => 1, 'msg' => $this->getErrorSummary(false)[0] ]; } $this->model->store_id = get_store_id(); $this->model->mch_id = $this->mch_id; $this->model->attributes = $this->attributes; if ($this->model->save()) { return [ 'code' => 0, 'msg' => '提交成功' ]; } else { return [ 'code' => 0, 'msg' => '保存失败' ]; } } public static function getList() { $query = Mch::find()->where([ 'is_delete' => 0, 'store_id' => get_store_id() ])->with(['user', 'setting']); $query->andWhere([ 'review_status' => get_params('review_status',1) ]); $query->select(['*'])->orderBy(['sort' => SORT_ASC, 'id' => SORT_DESC]); $pagination = pagination_make($query); $pagination['data'] = $pagination['list']; unset($pagination['list']); return [ 'code' => 0, 'msg' => 'success', 'data' => $pagination, 'common_cat' => MchCommonCat::find()->where([ 'store_id' => get_store_id(), 'is_delete' => 0 ])->select(['id', 'name'])->orderBy(['sort' => SORT_ASC, 'id' => SORT_DESC])->all() ]; } }