| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- /**
- *------Create thems Model------
- *------SCWPHP Version 1.0.0------
- *------Dev Model Jions------
- *------Create Time 2017-06-12 05:08:18------
- */
- namespace App\Api\Model;
- use \System\Model;
- class Article extends Model {
- protected $table = 'article';
- //获取系统通知数据
- public static function getArticle($userInfo){
- if (empty($userInfo['identity'])) {
- Render([], '2001', lang('Common','Api') -> get('user does login'));
- }
-
- $where = [];
- $where[] = ['status','=',1];
- // $where[] = ['time','>',date("Y-m-d H:i:s",strtotime('-1 week'))];
-
- if (!empty($_POST['type'])) {
- $where[] = ['type','=',$_POST['type']];
- }
- if(!empty($_POST['id'])){
- $where[] = ['article.id','=',$_POST['id']];
- }
-
- $data = lm('article', "api")
- ->join('article_type','article_type.id','article.type')
- ->select('article.id','identity','title','content','time','author','type','article_type.cate_name','status','img','article.sort')
- ->where($where)
- ->limit(5)
- ->get()
- ->toArray();
- return $data;
- }
- }
|