model = new StudentLabel(); } /** * 获取学员标签列表 * @param array $where * @return array */ public function getPage(array $where = []) { $field = 'label_id,label_name,memo,sort,create_time,update_time'; $order = 'label_id desc'; $search_model = $this->model->withSearch(["label_name"], $where)->field($field)->order($order); $list = $this->pageQuery($search_model); return $list; } /** * 获取学员标签信息 * @param int $id * @return array */ public function getInfo(int $id) { $field = 'label_id,label_name,memo,sort,create_time,update_time'; $info = $this->model->field($field)->where([['label_id', "=", $id]])->findOrEmpty()->toArray(); return $info; } /** * 添加学员标签 * @param array $data * @return mixed */ public function add(array $data) { $res = $this->model->create($data); return $res->label_id; } /** * 学员标签编辑 * @param int $id * @param array $data * @return bool */ public function edit(int $id, array $data) { $this->model->where([['label_id', '=', $id]])->update($data); return true; } /** * 删除学员标签 * @param int $id * @return bool */ public function del(int $id) { $model = $this->model->where([['label_id', '=', $id]])->find(); $res = $model->delete(); return $res; } public function getMemberLabelListByLabelIds(array $label_ids) { return ( new CoreMemberLabelService() )->getMemberLabelListByLabelIds($label_ids); } }