Explorar o código

新增获取java登录信息

xialei hai 1 ano
pai
achega
8f292b8604
Modificáronse 2 ficheiros con 51 adicións e 0 borrados
  1. 48 0
      app/controller/api/Auth.php
  2. 3 0
      route/api.php

+ 48 - 0
app/controller/api/Auth.php

@@ -766,6 +766,54 @@ $data=$user->toArray();
766 766
         $count = Db::query($sql);
767 767
         return count(explode(",",$count[0]['count'])) - 1;
768 768
     }
769
+
770
+
771
+
772
+    /**
773
+     * 整合用户登录token
774
+     * @return mixed
775
+     * @author xaboy
776
+     * @day 2020/6/1
777
+     */
778
+    public function tokenList()
779
+    {
780
+        $user = $this->request->userInfo()->hidden(['account','label_id', 'group_id', 'pwd', 'card_id', 'last_time', 'last_ip', 'status', 'spread_time', 'real_name']);
781
+        $user->append(['service', 'user_group','total_consume', 'total_collect_product', 'total_collect_store', 'total_coupon', 'total_visit_product', 'total_unread']);     
782
+        $userInfo = $user->toArray();
783
+
784
+        $data['mweb_info'] = $this->curl_java_login($userInfo['phone'])['data'];
785
+        $data['merchant_info'] = [];
786
+
787
+        return app('json')->success($data);
788
+    }
789
+
790
+
791
+
792
+    function curl_java_login($phone){
793
+        $curl = curl_init();
794
+        curl_setopt_array($curl, array(
795
+        CURLOPT_URL => 'http://shop.gdjbp.com/gateway/userCenter_service/userLogOnService/userPhoneLogOn',
796
+        CURLOPT_RETURNTRANSFER => true,
797
+        CURLOPT_ENCODING => '',
798
+        CURLOPT_MAXREDIRS => 10,
799
+        CURLOPT_TIMEOUT => 0,
800
+        CURLOPT_FOLLOWLOCATION => true,
801
+        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
802
+        CURLOPT_CUSTOMREQUEST => 'POST',
803
+        CURLOPT_POSTFIELDS =>'{"phone":'.$phone.',"sms_code":"9527","type":"1"}',
804
+        CURLOPT_HTTPHEADER => array(
805
+            'Content-Type: application/json'
806
+        ),
807
+        ));
808
+        $response = curl_exec($curl);
809
+        curl_close($curl);
810
+        $response = json_decode($response, true);
811
+        return $response;
812
+    }
813
+
814
+
815
+
816
+
769 817
     /**
770 818
      * 获取用户信息
771 819
      * @return mixed

+ 3 - 0
route/api.php

@@ -41,6 +41,9 @@ Route::group('api/', function () {
41 41
         Route::post('logout', 'api.Auth/logout');
42 42
         //用户信息
43 43
         Route::get('user', 'api.Auth/userInfo');
44
+        //整合用户登录token
45
+        Route::post('tokenList', 'api.Auth/tokenList');
46
+
44 47
         //志愿者信息
45 48
         Route::get('userVolunteer', 'api.Auth/userVolunteer');
46 49
         //申请成为志愿者