|
@@ -0,0 +1,101 @@
|
|
|
+<?php
|
|
|
+/*
|
|
|
+ * @Author: wang jun
|
|
|
+ * @Date: 2022-01-18 11:12:23
|
|
|
+ * @Last Modified by: wang jun
|
|
|
+ * @Last Modified time: 2022-01-19 15:51:59
|
|
|
+ */
|
|
|
+namespace app\admin\logic;
|
|
|
+
|
|
|
+use app\admin\model\companymodel;
|
|
|
+use think\facade\Log;
|
|
|
+
|
|
|
+class companylogic extends baselogic
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * 设置请求数据规则
|
|
|
+ * 20220107
|
|
|
+ * wj
|
|
|
+ */
|
|
|
+ protected function setrules()
|
|
|
+ {
|
|
|
+ $list = [
|
|
|
+ 'auditcompany' => [
|
|
|
+ ['name' => 'ids', 'title' => 'id', 'require' => true, 'type' => 'array'],
|
|
|
+ ['name' => 'ispass', 'title' => 'ispass', 'require' => true, 'type' => 'numeric', 'regex' => '/[1|2]{1}/'],
|
|
|
+ ],
|
|
|
+ 'getlistbywhere' => [
|
|
|
+ ['name' => 'ispass', 'title' => 'ispass', 'type' => 'numeric', 'regex' => '/[0|1|2]{1}/'],
|
|
|
+ ['name' => 'companyname', 'title' => 'companyname', 'type' => 'string'],
|
|
|
+ ['name' => 'starttime', 'title' => 'starttime', 'type' => 'datetime'],
|
|
|
+ ['name' => 'endtime', 'title' => 'starttime', 'type' => 'datetime'],
|
|
|
+ ['name' => 'page', 'title' => 'page', 'type' => 'numeric'],
|
|
|
+ ['name' => 'size', 'title' => 'size', 'type' => 'numeric'],
|
|
|
+ ],
|
|
|
+ ];
|
|
|
+ return $list;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 审核公司
|
|
|
+ * 20220208
|
|
|
+ * wj
|
|
|
+ */
|
|
|
+ public function auditcompany($arr)
|
|
|
+ {
|
|
|
+ $result = $this->checkparam(__FUNCTION__, $arr);
|
|
|
+ if (1 != $result['status']) {
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+ $ids = $arr['ids'];
|
|
|
+ if (is_string($ids)) {
|
|
|
+ $ids = [$ids];
|
|
|
+ }
|
|
|
+ $ispass = $arr['ispass'];
|
|
|
+ $m_c = new companymodel();
|
|
|
+ foreach ($ids as $key => $value) {
|
|
|
+ $where = ['id' => $value];
|
|
|
+ $info = $m_c->getInfo($where);
|
|
|
+ if (empty($info)) {
|
|
|
+ log::error("company_id " . $value . " 无对应企业");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if ($ispass != $info['ispass']) {
|
|
|
+ $update = ['ispass' => $ispass];
|
|
|
+ $m_c->updateinfo($where, $update);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return backarr(1, "操作成功");
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取公司列表
|
|
|
+ * 20220208
|
|
|
+ * wj
|
|
|
+ */
|
|
|
+ public function getlistbywhere($arr)
|
|
|
+ {
|
|
|
+ $result = $this->checkparam(__FUNCTION__, $arr);
|
|
|
+ if (1 != $result['status']) {
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+ $where = [];
|
|
|
+ if (isset($arr['ispass'])) {
|
|
|
+ $where[] = ['ispass', '=', $arr['ispass']];
|
|
|
+ }
|
|
|
+ if (isset($arr['companyname'])) {
|
|
|
+ $where[] = ['companyname', 'like', '%' . $arr['companyname'] . '%'];
|
|
|
+ }
|
|
|
+ if (isset($arr['starttime']) && isset($arr['endtime'])) {
|
|
|
+ $where[] = ['create_time', '>=', $arr['starttime']];
|
|
|
+ $where[] = ['create_time', '<=', $arr['endtime']];
|
|
|
+ }
|
|
|
+ $m_c = new companymodel();
|
|
|
+ $count = $m_c->getList($where, 'count');
|
|
|
+ if ($count <= 0) {
|
|
|
+ return backarr(0, "无数据");
|
|
|
+ }
|
|
|
+ $page = isset($arr['page']) && !empty($arr['page']) ? $arr['page'] : 1;
|
|
|
+ $size = isset($arr['size']) && !empty($arr['size']) ? $arr['size'] : 10;
|
|
|
+ $list = $m_c->getList($where, '*', $page, $size);
|
|
|
+ return backarr(1, "查询成功", $list);
|
|
|
+ }
|
|
|
+}
|