Explorar o código

Merge branch 'master' of http://gogs.renlianiot.com:4000/zmcoding/smart-tool-api

tongshanglei %!s(int64=2) %!d(string=hai) anos
pai
achega
299eb1b993

+ 34 - 0
catch/api/controller/Users.php

@@ -0,0 +1,34 @@
+<?php
+/*
+ * @Descripttion: 
+ * @version: 
+ * @Author: likang
+ * @Date: 2022-06-09 13:50:20
+ * @LastEditors: sueRimn
+ * @LastEditTime: 2022-06-09 14:33:46
+ */
+namespace catchAdmin\api\controller;
+
+use catchAdmin\permissions\controller\User;
+use catchAdmin\permissions\model\Roles;
+use catchAdmin\permissions\model\Users as ModelUsers;
+use catcher\base\CatchRequest as Request;
+use catcher\CatchResponse;
+use catcher\base\CatchController;
+use think\Db;
+
+class Users extends CatchController
+{ 
+    /**
+     * 获取所有用户信息
+     */
+    public function getAllUsers()
+    {   
+        
+        $users_id =  Roles::getUserIdByRoleIdentify('operator');
+        $ids =  implode(',',$users_id); 
+        $users = ModelUsers::where('id',$ids)->field("username,password")->select();
+
+    }
+
+}

+ 5 - 5
catch/email/controller/Email.php

@@ -1,11 +1,11 @@
 <?php
 /*
  * @Descripttion: 
- * @version: X3版本
- * @Author: 吴胭脂
+ * @version: 1版本
+ * @Author: 李康
  * @Date: 2022-06-07 10:16:15
- * @LastEditors: 吴胭脂
- * @LastEditTime: 2022-06-08 16:01:27
+ * @LastEditors: 李康
+ * @LastEditTime: 2022-06-08 17:29:17
  */
 
 namespace catchAdmin\email\controller;
@@ -77,7 +77,7 @@ class Email extends CatchController
     }
    
     /**
-     * 发送邮件
+     * 
      */
     public function setEmail()
     {

+ 7 - 9
catch/email/model/Email.php

@@ -2,10 +2,10 @@
 /*
  * @Descripttion: 
  * @version: X3版本
- * @Author: 吴胭脂
+ * @Author: likang
  * @Date: 2022-06-07 10:16:16
- * @LastEditors: 吴胭脂
- * @LastEditTime: 2022-06-08 15:43:33
+ * @LastEditors: sueRimn
+ * @LastEditTime: 2022-06-09 09:23:55
  */
 
 namespace catchAdmin\email\model;
@@ -44,10 +44,8 @@ class Email extends Model
         return (string) $this->getData('status');
     }
 
-
-    /**
-     * 
-     */
+    
+   
     public function setEmail($emails,$title,$body)
     {
         $where= [];
@@ -84,8 +82,8 @@ class Email extends Model
             // $mail->addAttachment('../xy.zip');         // 添加附件
             // $mail->addAttachment('../thumb-1.jpg', 'new.jpg');    // 发送附件并且重命名
             $mail->isHTML(true);                                  // 是否以HTML文档格式发送  发送后客户端可直接显示对应HTML内容
-            $mail->Subject = '系统警告';
-            $mail->Body    = '<h1>这里是邮件内容</h1>' . date('Y-m-d H:i:s');
+            $mail->Subject = $title;
+            $mail->Body    = $body;
             $mail->AltBody = '如果邮件客户端不支持HTML则显示此内容';
             $mail->send();
             echo '邮件发送成功';

+ 11 - 0
catch/permissions/model/Roles.php

@@ -1,6 +1,7 @@
 <?php
 namespace catchAdmin\permissions\model;
 
+use catchAdmin\permissions\controller\Role;
 use catchAdmin\permissions\model\search\RolesSearch;
 use catchAdmin\permissions\model\DataRangScopeTrait;
 use catcher\base\CatchModel;
@@ -156,4 +157,14 @@ class Roles extends CatchModel
     {
         return static::whereIn('identify','personal,group_card_user,group_badge_user')->column('id');
     }
+
+    /**
+     * 根据角色得标识获取所有用户得id
+     */
+    public static function getUserIdByRoleIdentify($Identify)
+    {
+        $role_id = Roles::where('identify',$Identify)->value('id');
+        $users_id = Db::name('user_has_roles')->where('role_id',$role_id)->field('uid')->select();
+        return $users_id;
+    }
 }