Przeglądaj źródła

Wesmiler 人人车 初始化项目 0816

APPLE 3 lat temu
rodzic
commit
80a879adf3

+ 31 - 0
application/api/controller/v1/Taxi.php

@@ -261,6 +261,37 @@ class Taxi extends ApiController
     }
     }
 
 
     /**
     /**
+     * 当前进行中订单详情
+     *
+     * @author 许祖兴 < zuxing.xu@lettered.cn>
+     * @date 2020/7/6 11:09
+     *
+     * @return \think\response\Json
+     * @throws \Lettered\Support\Exceptions\FailedException
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function newOrder()
+    {
+        $param = $this->request->param();
+        // 数据校验
+        $valid = $this->validate($param, [
+            'order_id' => 'require',
+        ]);
+        // 错误
+        if (true !== $valid) {
+            return $this->ApiJson(-1, $valid);
+        }
+
+        $info = model('common/TaxiOrder')->with(['paylog','user','taxi','taxiUser'])
+            ->where(['user_id' => $this->auth->user()['id']])
+            ->whereIn('status',[])
+            ->find();
+        return $this->ApiJson(0,'获取成功', $info);
+    }
+
+    /**
      * 订单
      * 订单
      *
      *
      * @author 许祖兴 < zuxing.xu@lettered.cn>
      * @author 许祖兴 < zuxing.xu@lettered.cn>

+ 10 - 1
application/common/model/TaxiOrder.php

@@ -38,12 +38,21 @@ class TaxiOrder extends BaseModel
     }
     }
 
 
     /**
     /**
+     * 关联车辆司机
+     * @return \think\model\relation\BelongsTo
+     */
+    public function taxiUser()
+    {
+        return $this->belongsTo('TaxiUser','taxi_uid','id');
+    }
+
+    /**
      * 关联车俩
      * 关联车俩
      * @return \think\model\relation\BelongsTo
      * @return \think\model\relation\BelongsTo
      */
      */
     public function taxi()
     public function taxi()
     {
     {
-        return $this->belongsTo('Taxi','taxi_id','id')->with(['user']);
+        return $this->belongsTo('Taxi','taxi_id','id');
     }
     }
 
 
     /**
     /**