1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use think\Db;
- use addons\epay\library\Service;
- /**
- * 订单
- */
- class order extends Api
- {
- protected $noNeedLogin = [''];
- protected $noNeedRight = ['*'];
- public function lists()
- {
- $where = [
- 'order.user_id'=>$this->auth->id,
- ];
- $list = Db::name('order')->field('order.*,product.images,product.title,product.category')
- ->join('product','order.product_id = product.id','LEFT')
- ->where($where)->order('order.id desc')->autopage()->select();
- $list = list_domain_image($list,['images']);
- if(!empty($list)){
- foreach($list as $key => &$item){
- //第一个图
- $item['image'] = isset($item['images'][0]) ? $item['images'][0] : '';
- }
- }
- $this->success(1,$list);
- }
- }
|