Просмотр исходного кода

Merge branch 'Haozi' of ssh://was.baoshi56.com:10022/var/git/bswas

LD 5 лет назад
Родитель
Сommit
e52e925e1a

+ 11 - 1
app/Http/Controllers/TestController.php

@@ -1271,11 +1271,21 @@ where purch.islower=1 and deliver.id>'.$id);
         ProcurementCheckSheet::query()->insert($insert_);
     }
     public function testPro(){
+        $status=0;
         $procurements=Procurement::query()
             ->withCount('procurementQuotations')
             ->with('ownerMaterial.material')
-            ->where('status',0)
+            ->where('status',$status)
             ->get();
+        $keys = [];
+        foreach ($procurements as $key=>$procurement){
+            if ($procurement->procurement_quotations_count>0 && $status==0 )$keys[]= $key;
+            if ($procurement->type==2 && $procurement->supplier_id )$keys[]= $key;
+            if (Carbon::parse($procurement->deadline)->gt(Carbon::now())) $procurement->deadline=Carbon::parse($procurement->deadline)->diffInMilliseconds();
+            else $procurement->deadline=0;
+        }
+        $procurements = $procurements->diffKeys($keys);
         dd($procurements);
+        if (!empty($procurements)) return $this->success($procurements);
     }
 }

+ 2 - 2
app/Http/Controllers/api/thirdPart/weixin/AuthController.php

@@ -77,11 +77,11 @@ class AuthController extends Controller
         $url='https://api.weixin.qq.com/sns/jscode2session?';
         $get=Http::get($url,$requests);
         $resp=$get->json();
-        if (!$resp['openid']) return $this->error('授权失败,无法获取openid');
+        if (!isset($resp['openid'])) return $this->error('授权失败,无法获取openid');
         UserDetail::query()
             ->where('user_id',Auth::user()['id'])
             ->update(['procurement_wechat_open_id'=>$resp['openid'],]);
-//        return $this->success($resp['openid'],'获取openID成功');
+        return $this->success($resp['openid'],'获取openID成功');
     }
 
 }