作者 景龙
1 个管道 的构建 通过 耗费 1 秒

修改列表倒序排序

@@ -40,6 +40,7 @@ class Abouts extends Api @@ -40,6 +40,7 @@ class Abouts extends Api
40 if($this->request->isGet()){ 40 if($this->request->isGet()){
41 $data = Db::table('gc_about') 41 $data = Db::table('gc_about')
42 ->field('id,description,image,lng,lat') 42 ->field('id,description,image,lng,lat')
  43 + ->order('id desc')
43 ->find(); 44 ->find();
44 $this->success('成功',$data); 45 $this->success('成功',$data);
45 }else{ 46 }else{
@@ -104,6 +104,7 @@ class Cars extends Api @@ -104,6 +104,7 @@ class Cars extends Api
104 ->join('gc_user u','p.uid = u.id','LEFT') 104 ->join('gc_user u','p.uid = u.id','LEFT')
105 ->where(['c.uid'=>$this->user_id,'p.status'=>$this->normal,'u.status'=>'normal']) 105 ->where(['c.uid'=>$this->user_id,'p.status'=>$this->normal,'u.status'=>'normal'])
106 ->field('c.id,c.p_id,p.title,p.price,c.num,p.images') 106 ->field('c.id,c.p_id,p.title,p.price,c.num,p.images')
  107 + ->order('c.id desc')
107 ->select(); 108 ->select();
108 $this->success('成功',$data); 109 $this->success('成功',$data);
109 }else{ 110 }else{
@@ -114,6 +114,7 @@ class Comments extends Api @@ -114,6 +114,7 @@ class Comments extends Api
114 ->where(['c.p_id'=>$goods_id,'u.status'=>'normal']) 114 ->where(['c.p_id'=>$goods_id,'u.status'=>'normal'])
115 ->page($page,$limit) 115 ->page($page,$limit)
116 ->field('c.id,u.nickname,u.avatar,c.content,c.num,c.createtime') 116 ->field('c.id,u.nickname,u.avatar,c.content,c.num,c.createtime')
  117 + ->order('c.id desc')
117 ->select(); 118 ->select();
118 foreach($data as &$value){ 119 foreach($data as &$value){
119 $value['createtime'] = date('Y-m-d',$value['createtime']); 120 $value['createtime'] = date('Y-m-d',$value['createtime']);
@@ -68,6 +68,7 @@ class Gifts extends Api @@ -68,6 +68,7 @@ class Gifts extends Api
68 ->where(['status'=>$this->normal]) 68 ->where(['status'=>$this->normal])
69 ->page($page,$limit) 69 ->page($page,$limit)
70 ->field('id,title,score,images') 70 ->field('id,title,score,images')
  71 + ->order('id desc')
71 ->select(); 72 ->select();
72 $this->success('成功', ['my_score'=>$myScore['score'],'data'=>$data]); 73 $this->success('成功', ['my_score'=>$myScore['score'],'data'=>$data]);
73 }else{ 74 }else{
@@ -72,6 +72,7 @@ class Goods extends Api @@ -72,6 +72,7 @@ class Goods extends Api
72 ->where(['p.category_id'=>$category_id,'p.status'=>$this->normal,'u.status'=>'normal']) 72 ->where(['p.category_id'=>$category_id,'p.status'=>$this->normal,'u.status'=>'normal'])
73 ->page($page,$limit) 73 ->page($page,$limit)
74 ->field('p.id,u.type,p.title,u.address,p.pre_time,p.images') 74 ->field('p.id,u.type,p.title,u.address,p.pre_time,p.images')
  75 + ->order('p.id desc')
75 ->select(); 76 ->select();
76 foreach($data as &$value){ 77 foreach($data as &$value){
77 $value['pre_time'] = date('Y-m-d H:i:s',$value['pre_time']); 78 $value['pre_time'] = date('Y-m-d H:i:s',$value['pre_time']);
@@ -171,6 +172,7 @@ class Goods extends Api @@ -171,6 +172,7 @@ class Goods extends Api
171 $data = Db::table('gc_search') 172 $data = Db::table('gc_search')
172 ->where(['uid'=>$this->user_id]) 173 ->where(['uid'=>$this->user_id])
173 ->field('id,keywords') 174 ->field('id,keywords')
  175 + ->order('id desc')
174 ->select(); 176 ->select();
175 $this->success('成功', $data); 177 $this->success('成功', $data);
176 }else{ 178 }else{
@@ -309,6 +311,7 @@ class Goods extends Api @@ -309,6 +311,7 @@ class Goods extends Api
309 ->where($where) 311 ->where($where)
310 ->field('p.id,p.title,p.price,p.images') 312 ->field('p.id,p.title,p.price,p.images')
311 ->limit(20) 313 ->limit(20)
  314 + ->order('p.id desc')
312 ->select(); 315 ->select();
313 $this->success('成功', $data); 316 $this->success('成功', $data);
314 }else{ 317 }else{
@@ -242,6 +242,7 @@ class Gorders extends Api @@ -242,6 +242,7 @@ class Gorders extends Api
242 ->where(['o.uid'=>$this->user_id,'g.status'=>$this->normal,'u.status'=>'normal']) 242 ->where(['o.uid'=>$this->user_id,'g.status'=>$this->normal,'u.status'=>'normal'])
243 ->page($page,$limit) 243 ->page($page,$limit)
244 ->field('o.id,o.order_sn,u.username,g.title,o.num,o.createtime') 244 ->field('o.id,o.order_sn,u.username,g.title,o.num,o.createtime')
  245 + ->order('o.id desc')
245 ->select(); 246 ->select();
246 foreach($data as &$value){ 247 foreach($data as &$value){
247 $value['createtime'] = date('Y-m-d',$value['createtime']); 248 $value['createtime'] = date('Y-m-d',$value['createtime']);
@@ -45,6 +45,7 @@ class Index extends Api @@ -45,6 +45,7 @@ class Index extends Api
45 $data = Db::table('gc_category') 45 $data = Db::table('gc_category')
46 ->where(['status'=>'normal']) 46 ->where(['status'=>'normal'])
47 ->field('id,name,image') 47 ->field('id,name,image')
  48 + ->order('id desc')
48 ->select(); 49 ->select();
49 $this->success('成功', $data); 50 $this->success('成功', $data);
50 }else{ 51 }else{
@@ -78,6 +79,7 @@ class Index extends Api @@ -78,6 +79,7 @@ class Index extends Api
78 if($this->request->isGet()){ 79 if($this->request->isGet()){
79 $data = Db::table('gc_banner') 80 $data = Db::table('gc_banner')
80 ->field('id,image') 81 ->field('id,image')
  82 + ->order('id desc')
81 ->select(); 83 ->select();
82 $this->success('成功', $data); 84 $this->success('成功', $data);
83 }else{ 85 }else{
@@ -111,6 +113,7 @@ class Index extends Api @@ -111,6 +113,7 @@ class Index extends Api
111 if($this->request->isGet()){ 113 if($this->request->isGet()){
112 $data = Db::table('gc_gbanner') 114 $data = Db::table('gc_gbanner')
113 ->field('id,image') 115 ->field('id,image')
  116 + ->order('id desc')
114 ->select(); 117 ->select();
115 $this->success('成功', $data); 118 $this->success('成功', $data);
116 }else{ 119 }else{
@@ -68,6 +68,7 @@ class Omessages extends Api @@ -68,6 +68,7 @@ class Omessages extends Api
68 ->where(['o.s_uid'=>$this->user_id,'p.status'=>$this->normal,'u.status'=>'normal']) 68 ->where(['o.s_uid'=>$this->user_id,'p.status'=>$this->normal,'u.status'=>'normal'])
69 ->page($page,$limit) 69 ->page($page,$limit)
70 ->field('o.id,o.order_sn,o.status,p.title,u.username,o.is_read') 70 ->field('o.id,o.order_sn,o.status,p.title,u.username,o.is_read')
  71 + ->order('o.id desc')
71 ->select(); 72 ->select();
72 $this->success('成功',$data); 73 $this->success('成功',$data);
73 }else{ 74 }else{
@@ -272,6 +272,7 @@ class Person extends Api @@ -272,6 +272,7 @@ class Person extends Api
272 $data = Db::table('gc_bank') 272 $data = Db::table('gc_bank')
273 ->where(['uid'=>$this->user_id]) 273 ->where(['uid'=>$this->user_id])
274 ->field('id,bank_num,open_bank') 274 ->field('id,bank_num,open_bank')
  275 + ->order('id desc')
275 ->select(); 276 ->select();
276 $this->success('成功', $data); 277 $this->success('成功', $data);
277 }else{ 278 }else{
@@ -91,6 +91,7 @@ class Porders extends Api @@ -91,6 +91,7 @@ class Porders extends Api
91 ->where(['p.status'=>$this->normal,'u.status'=>'normal']) 91 ->where(['p.status'=>$this->normal,'u.status'=>'normal'])
92 ->whereIn('p.id',$p_ids) 92 ->whereIn('p.id',$p_ids)
93 ->field('p.id,p.title,p.price,p.images,u.username,u.mobile,u.address') 93 ->field('p.id,p.title,p.price,p.images,u.username,u.mobile,u.address')
  94 + ->order('p.id desc')
94 ->select(); 95 ->select();
95 $total = 0; 96 $total = 0;
96 foreach($data as $key=>$value){ 97 foreach($data as $key=>$value){
@@ -248,6 +249,7 @@ class Porders extends Api @@ -248,6 +249,7 @@ class Porders extends Api
248 ->where($where) 249 ->where($where)
249 ->page($page,$limit) 250 ->page($page,$limit)
250 ->field('o.id,o.order_sn,o.status,p.title,o.unit_price,o.num,p.images,o.p_id') 251 ->field('o.id,o.order_sn,o.status,p.title,o.unit_price,o.num,p.images,o.p_id')
  252 + ->order('o.id desc')
251 ->select(); 253 ->select();
252 $this->success('成功',$data); 254 $this->success('成功',$data);
253 }else{ 255 }else{
@@ -43,6 +43,7 @@ class Problems extends Api @@ -43,6 +43,7 @@ class Problems extends Api
43 if($this->request->isGet()){ 43 if($this->request->isGet()){
44 $data = Db::table('gc_problem') 44 $data = Db::table('gc_problem')
45 ->field('id,title') 45 ->field('id,title')
  46 + ->order('id desc')
46 ->select(); 47 ->select();
47 $this->success('成功',$data); 48 $this->success('成功',$data);
48 }else{ 49 }else{
@@ -61,6 +61,7 @@ class Smessages extends Api @@ -61,6 +61,7 @@ class Smessages extends Api
61 ->where(['a.uid'=>$this->user_id,'a.type'=>$withdrawal]) 61 ->where(['a.uid'=>$this->user_id,'a.type'=>$withdrawal])
62 ->page($page,$limit) 62 ->page($page,$limit)
63 ->field('m.id,m.title,m.type,m.is_read') 63 ->field('m.id,m.title,m.type,m.is_read')
  64 + ->order('m.id desc')
64 ->select(); 65 ->select();
65 $this->success('成功',$data); 66 $this->success('成功',$data);
66 }else{ 67 }else{
@@ -122,6 +122,7 @@ class Teams extends Api @@ -122,6 +122,7 @@ class Teams extends Api
122 ->where(['l.off_uid'=>$off_uid,'uid'=>$this->user_id,'u.status'=>'normal']) 122 ->where(['l.off_uid'=>$off_uid,'uid'=>$this->user_id,'u.status'=>'normal'])
123 ->page($page,$limit) 123 ->page($page,$limit)
124 ->field('u.id uid,u.username,u.avatar,l.type,l.createtime,l.s_score score') 124 ->field('u.id uid,u.username,u.avatar,l.type,l.createtime,l.s_score score')
  125 + ->order('l.id desc')
125 ->select(); 126 ->select();
126 foreach($data as &$value){ 127 foreach($data as &$value){
127 $value['createtime'] = date('Y-m-d',$value['createtime']); 128 $value['createtime'] = date('Y-m-d',$value['createtime']);