From 5c1ead0291ab1d8cc6b925740fa1e9f537f40ef9 Mon Sep 17 00:00:00 2001 From: vilson <545522390@qq.com> Date: Wed, 23 Jan 2019 17:34:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=88=90=E5=91=98=E8=B5=84?= =?UTF-8?q?=E6=96=99=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: vilson <545522390@qq.com> --- application/common.php | 9 ++++++++ application/index/controller/Index.php | 2 -- application/project/behavior/Task.php | 4 +++- application/project/controller/Account.php | 26 ++++++++++++++++++++-- config/config.php | 4 ++++ data/2.1.0/pearproject.sql | 17 +++++++++++++- data/pearproject.sql | 17 +++++++++++++- 7 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 config/config.php diff --git a/application/common.php b/application/common.php index f2cc477..3b08588 100644 --- a/application/common.php +++ b/application/common.php @@ -106,6 +106,15 @@ function isError($data) } } +/** + * 是否开启消息推送 + * @return mixed + */ +function isOpenNoticePush() +{ + return config('config.notice_push'); +} + /** * 日期格式标准输出 * @param string $datetime 输入日期 diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index 1f638a7..77ffc3e 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -39,9 +39,7 @@ class Index extends BasicApi public function index() { - $this->success('success'); - } /** diff --git a/application/project/behavior/Task.php b/application/project/behavior/Task.php index 55ee0d7..15aece1 100644 --- a/application/project/behavior/Task.php +++ b/application/project/behavior/Task.php @@ -171,7 +171,9 @@ class Task continue;//跳过产生者 } $result = $notifyModel->add($notifyData['title'], $notifyData['content'], $notifyData['type'], $data['memberCode'], $taskMember['member_code'], $notifyData['action'], json_encode($task), $notifyData['terminal'], $notifyData['avatar']); - $messageService->sendToUid($taskMember['member_code'], ['content' => $notifyData['content'], 'title' => $notifyData['title'], 'data' => ['organizationCode' => getCurrentOrganizationCode()], 'notify' => $result], $notifyData['action']); + if (isOpenNoticePush()) { + $messageService->sendToUid($taskMember['member_code'], ['content' => $notifyData['content'], 'title' => $notifyData['title'], 'data' => ['organizationCode' => getCurrentOrganizationCode()], 'notify' => $result], $notifyData['action']); + } } } } diff --git a/application/project/controller/Account.php b/application/project/controller/Account.php index b50e0df..726ae94 100644 --- a/application/project/controller/Account.php +++ b/application/project/controller/Account.php @@ -94,6 +94,28 @@ class Account extends BasicApi $this->success('', $list); } + public function read() + { + $code = Request::param('code'); + if (!$code) { + $this->error("缺少参数"); + } + $memberAccount = $this->model->where(['code' => $code])->field('id', true)->find(); + if ($memberAccount) { + $departments = ''; + $departmentCodes = $memberAccount['department_code']; + if ($departmentCodes) { + $departmentCodes = explode(',', $departmentCodes); + foreach ($departmentCodes as $departmentCode) { + $department = \app\common\Model\Department::where(['code' => $departmentCode])->field('name')->find(); + $departments .= "{$department['name']} "; + } + } + $memberAccount['departments'] = $departments; + } + $this->success('', $memberAccount); + } + /** * 授权管理 * @return array|string @@ -177,8 +199,8 @@ class Account extends BasicApi { //todo 权限判断 - $params = Request::only('mobile,email,desc,name,id,description'); - $result = $this->model->_edit($params, ['id' => $params['id']]); + $params = Request::only('mobile,email,desc,name,position,code,description'); + $result = $this->model->_edit($params, ['code' => $params['code']]); if ($result) { $this->success(''); } diff --git a/config/config.php b/config/config.php new file mode 100644 index 0000000..e399e83 --- /dev/null +++ b/config/config.php @@ -0,0 +1,4 @@ + false, +]; diff --git a/data/2.1.0/pearproject.sql b/data/2.1.0/pearproject.sql index f4811df..5ea4a26 100644 --- a/data/2.1.0/pearproject.sql +++ b/data/2.1.0/pearproject.sql @@ -11,7 +11,7 @@ Target Server Version : 50642 File Encoding : 65001 - Date: 22/01/2019 16:38:56 + Date: 23/01/2019 10:01:17 */ SET NAMES utf8mb4; @@ -158,6 +158,21 @@ INSERT INTO `pear_file` VALUES (40, 'dqkx4o6wp2r9uzt15fyaenlv', 'static/upload/f INSERT INTO `pear_file` VALUES (42, '7ru54lhm6i198stqkdcy3ap2', 'static/upload/file/default/6v7be19pwman2fird04gqu53/6v7be19pwman2fird04gqu53/20190112/20190112184757-05990022176026337.jpg', '05990022176026337', 'jpg', 45930, '', '6v7be19pwman2fird04gqu53', NULL, 'mo4uqwfb06dxv8ez2spkl3rg', '6v7be19pwman2fird04gqu53', '2019-01-12 18:47:57', 0, '', 0, 'http://easyproject.net/static/upload/file/default/6v7be19pwman2fird04gqu53/6v7be19pwman2fird04gqu53/20190112/20190112184757-05990022176026337.jpg', 'image/jpeg', '2019-01-12 22:26:56'); INSERT INTO `pear_file` VALUES (43, 'tfydkno68i4b7ha0q1x2uwcs', 'static/upload/file/default/bh5mdpzy7wg46kiqx9uclns2/6v7be19pwman2fird04gqu53/20190113/20190113122337-avatar.png', 'avatar', 'png', 51574, '', 'bh5mdpzy7wg46kiqx9uclns2', NULL, 'mo4uqwfb06dxv8ez2spkl3rg', '6v7be19pwman2fird04gqu53', '2019-01-13 12:23:37', 0, '', 0, 'http://easyproject.net/static/upload/file/default/bh5mdpzy7wg46kiqx9uclns2/6v7be19pwman2fird04gqu53/20190113/20190113122337-avatar.png', 'image/png', ''); +-- ---------------------------- +-- Table structure for pear_invite_link +-- ---------------------------- +DROP TABLE IF EXISTS `pear_invite_link`; +CREATE TABLE `pear_invite_link` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邀请码', + `create_by` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邀请人', + `invite_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '链接类型', + `source_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资源编码', + `create_time` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建时间', + `over_time` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '过期时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '邀请链接表' ROW_FORMAT = Compact; + -- ---------------------------- -- Table structure for pear_lock -- ---------------------------- diff --git a/data/pearproject.sql b/data/pearproject.sql index f4811df..5ea4a26 100644 --- a/data/pearproject.sql +++ b/data/pearproject.sql @@ -11,7 +11,7 @@ Target Server Version : 50642 File Encoding : 65001 - Date: 22/01/2019 16:38:56 + Date: 23/01/2019 10:01:17 */ SET NAMES utf8mb4; @@ -158,6 +158,21 @@ INSERT INTO `pear_file` VALUES (40, 'dqkx4o6wp2r9uzt15fyaenlv', 'static/upload/f INSERT INTO `pear_file` VALUES (42, '7ru54lhm6i198stqkdcy3ap2', 'static/upload/file/default/6v7be19pwman2fird04gqu53/6v7be19pwman2fird04gqu53/20190112/20190112184757-05990022176026337.jpg', '05990022176026337', 'jpg', 45930, '', '6v7be19pwman2fird04gqu53', NULL, 'mo4uqwfb06dxv8ez2spkl3rg', '6v7be19pwman2fird04gqu53', '2019-01-12 18:47:57', 0, '', 0, 'http://easyproject.net/static/upload/file/default/6v7be19pwman2fird04gqu53/6v7be19pwman2fird04gqu53/20190112/20190112184757-05990022176026337.jpg', 'image/jpeg', '2019-01-12 22:26:56'); INSERT INTO `pear_file` VALUES (43, 'tfydkno68i4b7ha0q1x2uwcs', 'static/upload/file/default/bh5mdpzy7wg46kiqx9uclns2/6v7be19pwman2fird04gqu53/20190113/20190113122337-avatar.png', 'avatar', 'png', 51574, '', 'bh5mdpzy7wg46kiqx9uclns2', NULL, 'mo4uqwfb06dxv8ez2spkl3rg', '6v7be19pwman2fird04gqu53', '2019-01-13 12:23:37', 0, '', 0, 'http://easyproject.net/static/upload/file/default/bh5mdpzy7wg46kiqx9uclns2/6v7be19pwman2fird04gqu53/20190113/20190113122337-avatar.png', 'image/png', ''); +-- ---------------------------- +-- Table structure for pear_invite_link +-- ---------------------------- +DROP TABLE IF EXISTS `pear_invite_link`; +CREATE TABLE `pear_invite_link` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邀请码', + `create_by` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邀请人', + `invite_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '链接类型', + `source_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资源编码', + `create_time` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建时间', + `over_time` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '过期时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '邀请链接表' ROW_FORMAT = Compact; + -- ---------------------------- -- Table structure for pear_lock -- ----------------------------