Эх сурвалжийг харах

Merge remote-tracking branch 'origin/jun' into liuxiangxin

liuxiangxin 4 сар өмнө
parent
commit
bed8a919f1

+ 1 - 1
app/Console/Commands/Regiment.php

@@ -99,7 +99,7 @@ class Regiment extends Command
             if (!$res)   Log::error('run_regiment','修改团活动失败'.json_encode($activeIds));
         }
         //团过期
-        $regimentList   =   RegimentModel::query()->where([['status','=',1],['end_time','<=',$time]])->get();
+        $regimentList   =   RegimentModel::query()->where([['status','=',0],['end_time','<=',$time]])->get();
         if ($regimentList){
             foreach ($regimentList as $v){
                 $activeList = $Model->query()->where('id','=',$v['active_id'])->first();

+ 0 - 2
app/Http/Controllers/Api/Orders.php

@@ -818,7 +818,6 @@ class Orders extends Api{
                     'active_id'     =>  $regimentActiveInfo['id'],
                     'product_id'    =>  $buyInfo['product_id'],
                     'people_number' =>  0,
-                    'status'        =>  4,
                     'start_time'    =>  $time,
                     'end_time'      =>  $time + $regimentActiveInfo['expiration']*3600,
                     'update_time'   =>  $time,
@@ -870,7 +869,6 @@ class Orders extends Api{
                 'active_id'     =>  $regimentActiveInfo['id'],
                 'product_id'    =>  $buyInfo['product_id'],
                 'order_id'      =>  $orderId,
-                'status'        =>  4,
                 'update_time'   =>  $time,
                 'insert_time'   =>  $time,
             ];

+ 7 - 26
app/Http/Controllers/Api/WechatPay.php

@@ -150,7 +150,7 @@ class WechatPay extends Api{
                         //查询团信息
                         $regimentInfo           =   Regiment::query()->where('id','=',$orderInfo['regiment_id'])->first()->toArray();
                         if (!$regimentInfo) {
-                            Log::log('notify_wechat_pay', '更新团订单失败' . json_encode($regimentInfo));
+                            Log::log('notify_wechat_pay', '查询团信息失败' . json_encode($regimentInfo));
                             // 回退数据
                             DB::rollBack();
                             return json_send(['code'=>'FAIL']);
@@ -158,7 +158,7 @@ class WechatPay extends Api{
                         //查询团活动
                         $regimentActiveInfo     =   RegimentActive::query()->where('id','=',$regimentInfo['active_id'])->first();
                         if (!$regimentActiveInfo) {
-                            Log::log('notify_wechat_pay', '更新团订单失败' . json_encode($regimentInfo));
+                            Log::log('notify_wechat_pay', '查询团活动失败' . json_encode($regimentInfo));
                             // 回退数据
                             DB::rollBack();
                             return json_send(['code'=>'FAIL']);
@@ -166,7 +166,7 @@ class WechatPay extends Api{
                         //查询团记录
                         $regimentRecordInfo     =   RegimentRecord::query()->where('order_id','=',$orderInfo['id'])->first();
                         if (!$regimentRecordInfo) {
-                            Log::log('notify_wechat_pay', '更新团订单失败' . json_encode($regimentInfo));
+                            Log::log('notify_wechat_pay', '查询团记录失败' . json_encode($regimentInfo));
                             // 回退数据
                             DB::rollBack();
                             return json_send(['code'=>'FAIL']);
@@ -176,7 +176,7 @@ class WechatPay extends Api{
                         $inc				=   Regiment::query()->where('id','=',$regimentId)->increment('people_number',1);
                         Log::log('notify_wechat_pay', '拼团人数加1,regiment_id:'.$regimentId.';'. json_encode($inc));
                         if( !$inc )			{
-                            Log::log('notify_wechat_pay', '更新团订单失败' . json_encode($regimentInfo));
+                            Log::log('notify_wechat_pay', '更新团人数加1失败' . json_encode($regimentInfo));
                             // 回退数据
                             DB::rollBack();
                             return json_send(['code'=>'FAIL']);
@@ -186,7 +186,7 @@ class WechatPay extends Api{
                             $res            =   regiment::query()->where('id','=',$regimentId)->update(['status'=>3]);
                             Log::log('notify_wechat_pay', '图满 团状态,regiment_id:'.$regimentId.';'. json_encode($res));
                             if( !$res )			{
-                                Log::log('notify_wechat_pay', '更新团订单失败' . json_encode($regimentInfo));
+                                Log::log('notify_wechat_pay', '更新团订单失败1' . json_encode($regimentInfo));
                                 // 回退数据
                                 DB::rollBack();
                                 return json_send(['code'=>'FAIL']);
@@ -194,7 +194,7 @@ class WechatPay extends Api{
                             //修改团记录状态
                             $res            =   RegimentRecord::query()->where('order_id','=',$orderInfo['id'])->update(['status'=>3]);
                             if( !$res )			{
-                                Log::log('notify_wechat_pay', '更新团订单失败' . json_encode($regimentInfo));
+                                Log::log('notify_wechat_pay', '更新团记录状态失败' . json_encode($regimentInfo));
                                 // 回退数据
                                 DB::rollBack();
                                 return json_send(['code'=>'FAIL']);
@@ -202,7 +202,7 @@ class WechatPay extends Api{
                             //修改订单
                             $orderRes       =   Orders::query()->where('regiment_id','=',$regimentId)->update(['status'=>'2']);
                             if( !$orderRes )			{
-                                Log::log('notify_wechat_pay', '更新订单失败' . json_encode($regimentInfo));
+                                Log::log('notify_wechat_pay', '更新订单失败' . json_encode($regimentInfo));
                                 // 回退数据
                                 DB::rollBack();
                                 return json_send(['code'=>'FAIL']);
@@ -212,25 +212,6 @@ class WechatPay extends Api{
                             foreach ($orderList as $key => $value) {
                                 if( $value['order_score'] > 0 ) $CustomScore->trade($orderInfo['custom_uid'],$value['id'],$value['order_score'],5,1);
                             }
-                        }else{
-                            //修改团状态
-                            if($regimentInfo['custom_uid']  ==  $orderInfo['custom_uid']){
-                                $res        =   Regiment::query()->where('id','=',$regimentId)->update(['status'=>0]);
-                                if( !$res )			{
-                                    Log::log('notify_wechat_pay', '更新团订单失败' . json_encode($regimentInfo));
-                                    // 回退数据
-                                    DB::rollBack();
-                                    return json_send(['code'=>'FAIL']);
-                                }
-                            }
-                            //修改团记录状态
-                            $res            =   RegimentRecord::query()->where('order_id','=',$orderInfo['id'])->update(['status'=>0]);
-                            if( !$res )			{
-                                Log::log('notify_wechat_pay', '更新团订单失败' . json_encode($regimentInfo));
-                                // 回退数据
-                                DB::rollBack();
-                                return json_send(['code'=>'FAIL']);
-                            }
                         }
                     }
                     // 提交数据

+ 7 - 4
resources/views/admin/regiment/index.blade.php

@@ -65,15 +65,18 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 								@endif
 							</td>
 							<td>
+								@if( $a['status'] == 0 )
+										拼团中
+								@endif
 								@if( $a['status'] == 1 )
-									拼团中
+										取消拼团
 								@endif
 								@if( $a['status'] == 2 )
-										拼团失败
-								@endif
-								@if( $a['status'] == 3 )
 										拼团成功
 								@endif
+									@if( $a['status'] == 3 )
+										拼团失败
+									@endif
 							</td>
 							<td>{{date('Y/m/d H:i:s',$a['start_time'])}}</td>
 							<td>{{date('Y/m/d H:i:s',$a['end_time'])}}</td>

+ 1 - 1
resources/views/admin/regiment_active/edit.blade.php

@@ -27,7 +27,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		</div>
 		<div class="form-group col-sm-2">
 			<label class="control-label">拼团有效期,小时 </label>
-			<input class="form-control" required="required" type="number" placeholder="拼团有效期小时" name="expiration_hours" maxlength="45" max="24" value="{{fmod($oldData['expiration'], 24)}}" />
+			<input class="form-control" required="required" type="number" placeholder="拼团有效期小时" name="expiration_hours" maxlength="45" max="24" value="{{$oldData['expiration']}}" />
 		</div>
 		<div class="form-group col-sm-2">
 			<label class="control-label">最多参与次数</label>