|
|
@@ -52,12 +52,9 @@ class GroupActivityLogic extends BaseLogic
|
|
|
/**
|
|
|
* @notes 拼团订单详情
|
|
|
*/
|
|
|
- public static function orderDetail($sn,$order_id,$url){
|
|
|
- if (empty($sn) && empty($order_id)) {
|
|
|
- return [];
|
|
|
- }
|
|
|
- $where = $sn ? ['sn'=>$sn] : ['id'=>$order_id];
|
|
|
- $detail = GroupOrder::where($where)->findOrEmpty()->toArray();
|
|
|
+ public static function orderDetail($order_id,$url){
|
|
|
+
|
|
|
+ $detail = GroupOrder::where(['id'=>$order_id])->findOrEmpty()->toArray();
|
|
|
if(!empty($detail)){
|
|
|
$detail['activity'] = GroupActivity::with('goods')->where(['id'=>$detail['group_activity_id']])->visible([
|
|
|
'id','title','image','start_time','end_time','type','equity_id',
|
|
|
@@ -68,7 +65,7 @@ class GroupActivityLogic extends BaseLogic
|
|
|
|
|
|
$detail['users'] = GroupUserOrder::alias('a')
|
|
|
->leftJoin('user b','a.user_id=b.id')
|
|
|
- ->where(['a.sn'=>$sn,'a.status'=>1])
|
|
|
+ ->where(['a.id'=>$order_id,'a.status'=>1])
|
|
|
->field(['a.id','a.user_id','a.status','a.create_time','b.avatar','b.nickname'])
|
|
|
->order('a.create_time','asc')
|
|
|
->select()
|
|
|
@@ -111,8 +108,8 @@ class GroupActivityLogic extends BaseLogic
|
|
|
/**
|
|
|
* @notes 用户订单详情
|
|
|
*/
|
|
|
- public static function userOrderDetail($sn,$userId){
|
|
|
- $detail = GroupUserOrder::with('groupOrder')->where(['sn'=>$sn, 'user_id' => $userId])->field('id,status,pay_way,pay_time,pay_status,refund_status,remark,create_time,group_order_id,user_equity_id,area,address')->findOrEmpty()->toArray();
|
|
|
+ public static function userOrderDetail($order_id,$userId){
|
|
|
+ $detail = GroupUserOrder::with('groupOrder')->where(['id'=>$order_id, 'user_id' => $userId])->field('id,status,pay_way,pay_time,pay_status,refund_status,remark,create_time,group_order_id,user_equity_id,area,address')->findOrEmpty()->toArray();
|
|
|
if ($detail) {
|
|
|
$detail['is_refund'] = 0;
|
|
|
if ($detail['pay_status'] == 1 && $detail['refund_status'] == 0) {
|
|
|
@@ -144,7 +141,7 @@ class GroupActivityLogic extends BaseLogic
|
|
|
}
|
|
|
|
|
|
//校验拼团活动
|
|
|
- if (empty($params['sn'])) {
|
|
|
+ if (empty($params['order_id'])) {
|
|
|
//新开团
|
|
|
$activity = GroupActivity::findOrEmpty($params['group_activity_id']); //活动详情
|
|
|
if ($activity->isEmpty()) {
|
|
|
@@ -183,7 +180,7 @@ class GroupActivityLogic extends BaseLogic
|
|
|
}
|
|
|
} else {
|
|
|
//加入已开的拼团单
|
|
|
- $groupOrder = GroupOrder::where(['group_activity_id' => $params['group_activity_id'], 'sn' => $params['sn']])->findOrEmpty()->toArray();
|
|
|
+ $groupOrder = GroupOrder::where(['group_activity_id' => $params['group_activity_id'], 'id' => $params['order_id']])->findOrEmpty()->toArray();
|
|
|
if (empty($groupOrder)) {
|
|
|
throw new Exception('拼团订单不存在!'); //拼团活动不存在
|
|
|
}
|
|
|
@@ -243,7 +240,7 @@ class GroupActivityLogic extends BaseLogic
|
|
|
try {
|
|
|
$detail = GroupUserOrder::where([
|
|
|
'user_id' => $params['user_id'],
|
|
|
- 'sn'=>$params['sn']
|
|
|
+ 'id'=>$params['order_id']
|
|
|
])->field('id,status')->findOrEmpty()->toArray();
|
|
|
if(empty($detail)){
|
|
|
throw new Exception('订单不存在');
|
|
|
@@ -279,7 +276,7 @@ class GroupActivityLogic extends BaseLogic
|
|
|
try {
|
|
|
$order = GroupUserOrder::where([
|
|
|
'user_id' => $params['user_id'],
|
|
|
- 'sn'=>$params['sn']
|
|
|
+ 'id'=>$params['order_id']
|
|
|
])->field('id,sn,status,order_amount,pay_status,pay_way,user_equity_id,user_id,order_terminal')->findOrEmpty()->toArray();
|
|
|
if(empty($order)){
|
|
|
throw new Exception('订单不存在');
|
|
|
@@ -341,7 +338,7 @@ class GroupActivityLogic extends BaseLogic
|
|
|
try{
|
|
|
$order = GroupUserOrder::where([
|
|
|
'user_id' => $params['user_id'],
|
|
|
- 'sn' => $params['sn']
|
|
|
+ 'id' => $params['order_id']
|
|
|
])->findOrEmpty();
|
|
|
if($order->isEmpty()){
|
|
|
throw new \Exception('订单不存在');
|