作者 邓超

x

@@ -25,22 +25,9 @@ class TemplateController extends BaseController @@ -25,22 +25,9 @@ class TemplateController extends BaseController
25 */ 25 */
26 public function index(){ 26 public function index(){
27 27
28 - $limit = $this->param['limit']??20; 28 + $lists = (new ATemplate)->lists($this->map,$this->page,$this->row,$this->order,['id','name','status','is_default','sort','thumb','url','created_at','updated_at']);
  29 + $this->response('success',Code::SUCCESS,$lists);
29 30
30 -  
31 - $lists = ATemplate::where(function ($query){  
32 -  
33 - !empty($this->param['status']) && $query->where('status',$this->param['status']);  
34 - !empty($this->param['name']) && $query->where('status',$this->param['name']);  
35 -  
36 -  
37 - })  
38 - ->select(['id','name','status','is_default','sort','thumb','url','created_at','updated_at'])  
39 - ->orderBy('sort')  
40 - ->paginate($limit);  
41 -  
42 -  
43 - return $this->success($lists->toArray());  
44 } 31 }
45 32
46 33
@@ -142,11 +129,9 @@ class TemplateController extends BaseController @@ -142,11 +129,9 @@ class TemplateController extends BaseController
142 */ 129 */
143 public function html_index($template_id){ 130 public function html_index($template_id){
144 131
  132 + $lists = (new ATemplate)->list($this->map,$this->order,['id','name','status','is_default','sort','thumb','url','created_at','updated_at']);
  133 + $this->response('success',Code::SUCCESS,$lists);
145 134
146 - $lists = ATemplateHtml::where('template_id',$template_id)->get();  
147 -  
148 -  
149 - return $this->success($lists->toArray());  
150 } 135 }
151 136
152 137