| 1234567891011121314151617181920212223242526272829303132 | 
							- <?php
 
- /**
 
-  * Created by PhpStorm.
 
-  * User: 97
 
-  */
 
- namespace app\common\business;
 
- use app\common\model\mysql\Demo as mysqlDemo;
 
- class Demo{
 
-     /**
 
-      * business 层通过 getDemoDataByCategoryId 来获取数据
 
-      * @param $categoryId
 
-      * @param int $limit
 
-      * @return array
 
-      */
 
-     public function getDemoDataByCategoryId($categoryId,$limit = 10){
 
-         $model = new mysqlDemo;
 
-         $results = $model->getDemoDataByCategoryId($categoryId);
 
-         if(empty($results)){
 
-             return [];
 
-         }
 
-         $cagegorys = config("category");
 
-         foreach ($results as $key=>$result){
 
-             $results[$key]['categoryName'] = $cagegorys[$result['category_id']] ?? '--';
 
-         }
 
-         return $results;
 
-     }
 
- }
 
 
  |