| 1234567891011121314151617181920212223242526272829303132333435 | 
							- <?php
 
- namespace app\common\api;
 
- use app\admin\model\Notice;
 
- /**
 
-  * Description of NoticeApi
 
-  *
 
-  * @author sgq
 
-  */
 
- class NoticeApi {
 
-     public static function getList($params = []) {
 
-         $where = [];
 
-         $condition = $params["condition"];
 
-         $order = $params["order"] ?: "desc";
 
-         $offset = $params["offset"] ?: 0;
 
-         $limit = $params["limit"] ?: 10;
 
-         if ($condition) {
 
-             $where[] = ["n.title", "like", "%{$condition}%"];
 
-             $where[] = ["n.content", "like", "%{$condition}%"];
 
-         }
 
-         $count = Notice::alias("n")->whereOr($where)->count();
 
-         $list = Notice::alias("n")->whereOr($where)
 
-                         ->leftJoin("sys_user u", "u.id=n.creater")
 
-                         ->leftJoin("sys_company c", "c.id=u.companyId")
 
-                         ->order(["n.isTop" => $order, "n.topTime" => $order, "n.createTime" => $order])
 
-                         ->limit($offset, $limit)
 
-                         ->field("n.*,concat(u.name,'(',c.name,')') as createrName")
 
-                         ->select()->toArray();
 
-         return ["total" => $count, "rows" => $list];
 
-     }
 
- }
 
 
  |