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

增加获取最近订单地址列表

... ... @@ -183,6 +183,8 @@ class Cars extends Api
* @ApiMethod (GET)
* @ApiRoute (/api/cars/likeGodsList)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="page", type="inter", required=true, description="分页页码")
*
* @ApiReturn({
... ... @@ -339,6 +341,8 @@ class Cars extends Api
* @ApiMethod (GET)
* @ApiRoute (/api/cars/settleUseCoupon)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="goods_id", type="string", required=true, description="商品id(多个以逗号隔开,如:1,3,4)")
* @ApiParams (name="total_goods_price", type="inter", required=true, description="商品总金额")
*
... ... @@ -483,4 +487,33 @@ class Cars extends Api
}
}
/**
* @ApiTitle (获取最近订单的地址)
* @ApiSummary (获取最近订单的地址)
* @ApiMethod (GET)
* @ApiRoute (/api/cars/getOrderAddress)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1575462785",
"data": {
"id": 2,
"receive_name": "景龙1",
"receive_mobile": "13752011725",
"receive_address": "天津市南开区1"
}
})
*/
public function getOrderAddress(){
if($this->request->isGet()){
$res = Common::findSoftWhereData('order',['uid'=>$this->uid],'id,receive_name,receive_mobile,receive_address');
$this->success('成功',$res);
}else{
$this->error('请求方式错误');
}
}
}
... ...
... ... @@ -24,10 +24,11 @@ class Common
* 查找单条数据(软删除)
* @ApiInternal
*/
public static function findSoftWhereData($table,$where,$field,$except=false){
public static function findSoftWhereData($table,$where,$field,$except=false,$order='id desc'){
$res = Db::name($table)
->where($where)
->field($field,$except)
->order($order)
->useSoftDelete('deletetime')
->find();
return $res;
... ...
此 diff 太大无法显示。