[ ['name' => 'companyid', 'title' => 'companyid', 'require' => true, 'type' => 'numeric'], ['name' => 'openid', 'title' => 'openid', 'type' => 'string'], ], 'getlistbywhere' => [ ['name' => 'companyid', 'title' => 'companyid', 'require' => true, 'type' => 'numeric'], ['name' => 'passstate', 'title' => 'passstate', 'type' => 'numeric', 'regex' => '/[0|1|2]{1}/'], ['name' => 'activestate', 'title' => 'activestate', 'type' => 'numeric', 'regex' => '/[0|1]{1}/'], ['name' => 'title', 'title' => 'title', 'type' => 'string', 'regex' => '/.{2,}/'], ['name' => 'page', 'title' => 'page', 'type' => 'numeric'], ['name' => 'size', 'title' => 'size', 'type' => 'numeric'], ], 'updatebyid' => [ ['name' => 'id', 'title' => 'companyid', 'require' => true, 'type' => 'numeric'], ], 'getinfobyid' => [ ['name' => 'id', 'title' => 'companyid', 'require' => true, 'type' => 'numeric'], ], 'getcountbyparty' => [ ['name' => 'partyid', 'title' => 'partyid', 'require' => true, 'type' => 'numeric'], ], ]; return $list; } /** * 新建数据 * 20220119 * wj */ public function newinfo($arr) { $result = $this->checkparam(__FUNCTION__, $arr); if (1 != $result['status']) { return $result; } $companyid = $arr['companyid']; $m_c = new companymodel(); $cinfo = $m_c->getinfobyid($companyid); if (empty($cinfo)) { return backarr(0, "企业信息不存在"); } $openid = $arr['openid']; $m_u = new usermodel(); $uinfo = $m_u->getinfobyopenid($openid); if (empty($uinfo)) { return backarr(0, "用户信息不存在"); } $m_i = new inventmodel(); $arr['company_id'] = $companyid; $arr['create_user_id'] = $uinfo['id']; $id = $m_i->insertData($arr); if (empty($id)) { return backarr(0, "新增失败"); } return backarr(1, "新增成功", ['id' => $id]); } /** * 获取列表数据 根据条件 * 20220119 * wj */ public function getlistbywhere($arr) { $result = $this->checkparam(__FUNCTION__, $arr); if (1 != $result['status']) { return $result; } $companyid = $arr['companyid']; $m_c = new companymodel(); $cinfo = $m_c->getinfobyid($companyid); if (empty($cinfo)) { return backarr(0, "企业信息不存在"); } $m_i = new inventmodel(); $where = [['company_id', '=', $companyid]]; if (isset($arr['title'])) { $where[] = ['title', 'like', '%' . $arr['title'] . '%']; } if (isset($arr['activestate'])) { $where[] = ['active_state', '=', $arr['activestate']]; } if (isset($arr['passstate'])) { $where[] = ['pass_state', '=', $arr['passstate']]; } $page = isset($arr['page']) && !empty($arr['page']) ? $arr['page'] : 1; $size = isset($arr['size']) && !empty($arr['size']) ? $arr['size'] : 10; $count = $m_i->getList($where, 'count'); if ($count <= 0) { return backarr(0, "无数据"); } $list = $m_i->getList($where, '*', $page, $size); return backarr(1, "查询成功", $list); } /** * 修改数据根据id * 20220119 * wj */ public function updatebyid($arr) { $result = $this->checkparam(__FUNCTION__, $arr); if (1 != $result['status']) { return $result; } $id = $arr['id']; $m_i = new inventmodel(); $row = $m_i->updatebyid($id, $arr); if (empty($row)) { return backarr(0, "修改失败"); } return backarr(1, "获取成功", ['id' => $id]); } /** * 获取数据根据id * 20220119 * wj */ public function getinfobyid($arr) { $result = $this->checkparam(__FUNCTION__, $arr); if (1 != $result['status']) { return $result; } $id = $arr['id']; $m_i = new inventmodel(); $iinfo = $m_i->getinfobyid($id); if (empty($iinfo)) { return backarr(0, "数据不存在"); } return backarr(1, "获取成功", $iinfo); } /** * 获取本次活动全部职位总数 * 20220122 * wj */ public function getcountbyparty($arr) { $result = $this->checkparam(__FUNCTION__, $arr); if (1 != $result['status']) { return $result; } $partyid = $arr['partyid']; $m_i = new inventmodel(); $count = $m_i->getcountbyparty($partyid); return backarr(1, "获取成功", $count); } }