添加:获取昨天客户订单或者团队订单
This commit is contained in:
parent
e256c793ff
commit
28f778fef4
|
|
@ -3331,8 +3331,17 @@ class MemberController extends ApiController
|
||||||
return $this->successJson('success', compact('self_info','children'));
|
return $this->successJson('success', compact('self_info','children'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取指定订单列表
|
||||||
|
public function getOrderList(){
|
||||||
|
// 参数获取
|
||||||
|
$orderType = request()->input('order_type');
|
||||||
|
if(empty($orderType)) return $this->errorJson('非法请求!');
|
||||||
|
$memberReferral = new MemberReferralService();
|
||||||
|
// 获取当前用户基本信息
|
||||||
|
$orderList = $memberReferral->getOrderList($orderType);
|
||||||
|
|
||||||
|
return $this->successJson('success', $orderList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -469,8 +469,38 @@ class MemberReferralService
|
||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Common: 获取指定订单列表
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/04/22 17:28
|
||||||
|
* @param $orderType
|
||||||
|
* @param $pageSize
|
||||||
|
* @return array
|
||||||
|
* @throws AppException
|
||||||
|
*/
|
||||||
|
public function getOrderList($orderType){
|
||||||
|
// 查出用户的某一级别下线的会员资料
|
||||||
|
$member = MemberModel::find(\app\frontend\models\Member::current()->uid);
|
||||||
|
if (!$member) return [];
|
||||||
|
// 获取下级订单列表 agent_order=直推客户;agent_order_count=全部客户
|
||||||
|
$teamMembersIds = $member->memberChildren()
|
||||||
|
->when($orderType == 'agent_order',function($query){
|
||||||
|
$query->where('level', 1);
|
||||||
|
})
|
||||||
|
->pluck('child_id')
|
||||||
|
->toArray();
|
||||||
|
// 订单列表
|
||||||
|
$orderStatus = Setting::get('shop.relation_base.member_order_status') == 1 ? [1, 2, 3] : [3];
|
||||||
|
return Order::select(['id','uid','price','status','order_sn'])
|
||||||
|
->whereIn('uid',$teamMembersIds)
|
||||||
|
->whereIn('status',$orderStatus)
|
||||||
|
->with(['hasManyOrderGoods'=>function($orderGoods){
|
||||||
|
$orderGoods->select(['id','goods_id','order_id','total','title','thumb','price']);
|
||||||
|
}])
|
||||||
|
->orderBy('id', 'desc')
|
||||||
|
->simplePaginate(10)
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue