| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 | 
							- <?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()
 
-     {
 
-         $active_status = input('active_status','all');
 
-         $where = [
 
-             'order.user_id'=>$this->auth->id,
 
-             'order.status' =>1,
 
-         ];
 
-         if($active_status == 1){
 
-             $where['active.activestarttime'] = ['gt',time()];
 
-         }
 
-         if($active_status == 2){
 
-             $where['active.activestarttime'] = ['lt',time()];
 
-             $where['active.activeendtime'] = ['gt',time()];
 
-         }
 
-         if($active_status == 3){
 
-             $where['active.activeendtime'] = ['lt',time()];
 
-         }
 
-         $list = Db::name('order')->field('order.*,active.activestarttime,active.activeendtime,active.name,active.image')
 
-             ->join('active','order.active_id = active.id','LEFT')
 
-             ->where($where)->order('order.id desc')->autopage()->select();
 
-         $list = list_domain_image($list,['image']);
 
-         if(!empty($list)){
 
-             foreach($list as $key => &$item){
 
-                 $status_text = '进行中';
 
-                 $status = 2;
 
-                 if(time() < $item['activestarttime']){
 
-                     $status_text = '报名中';
 
-                     $status = 1;
 
-                 }
 
-                 if(time() > $item['activeendtime']){
 
-                     $status_text = '已结束';
 
-                     $status = 3;
 
-                 }
 
-                 $item['status_text'] = $status_text;
 
-                 $item['active_status'] = $status;
 
-             }
 
-         }
 
-         $this->success(1,$list);
 
-     }
 
-     public function info(){
 
-         $id = input('id',0);
 
-         $info = Db::name('order')->field('order.*,active.activestarttime,active.activeendtime,active.name,us.realname,school.schoolname,grade.gradename,classes.classname')
 
-             ->join('active','order.active_id = active.id','LEFT')
 
-             ->join('user_student us','order.student_id = us.id','LEFT')
 
-             ->join('school','us.school_id = school.id','LEFT')
 
-             ->join('grade','us.grade_id = grade.id','LEFT')
 
-             ->join('classes','us.classes_id = classes.id','LEFT')
 
-             ->where('order.id',$id)->find();
 
-         $status_text = '进行中';
 
-         $status = 2;
 
-         if(time() < $info['activestarttime']){
 
-             $status_text = '报名中';
 
-             $status = 1;
 
-         }
 
-         if(time() > $info['activeendtime']){
 
-             $status_text = '已结束';
 
-             $status = 3;
 
-         }
 
-         $info['status_text'] = $status_text;
 
-         $info['active_status'] = $status;
 
-         $this->success(1,$info);
 
-     }
 
- }
 
 
  |