|
@@ -7,7 +7,7 @@ import hashlib
|
|
|
import time
|
|
|
import base64
|
|
|
import json
|
|
|
-from starlette.responses import JSONResponse
|
|
|
+from starlette.responses import JSONResponse, PlainTextResponse
|
|
|
from config import settings
|
|
|
from exceptions import TokenException
|
|
|
from extensions import logger
|
|
@@ -134,6 +134,7 @@ async def sg_request_param(request: Request):
|
|
|
|
|
|
return data
|
|
|
|
|
|
+'''
|
|
|
def sg_pass_sfzh(token: str = ''):
|
|
|
if token == '':
|
|
|
raise TokenException()
|
|
@@ -152,6 +153,7 @@ def sg_pass_sfzh(token: str = ''):
|
|
|
|
|
|
return redis_val['cid_num']
|
|
|
|
|
|
+
|
|
|
def sg_pass_extinfo(token: str):
|
|
|
if token == 'fb5d86fa-1cf3-11ef-9b67-00ff257b5fc6':
|
|
|
return {
|
|
@@ -176,7 +178,7 @@ def sg_pass_extinfo(token: str):
|
|
|
"mobile": redis_val['phone'],
|
|
|
"appid": "wx82d43fee89cdc7df"
|
|
|
}
|
|
|
-
|
|
|
+'''
|
|
|
|
|
|
######################################################################################
|
|
|
|
|
@@ -216,6 +218,7 @@ async def yst_request_param(
|
|
|
|
|
|
def yst_pass_ext(
|
|
|
request: Request,
|
|
|
+ token: str = '',
|
|
|
x_tif_signature: str = Header(None),
|
|
|
x_tif_nonce: str = Header(None),
|
|
|
x_tif_timestamp: str = Header(None),
|
|
@@ -223,35 +226,36 @@ def yst_pass_ext(
|
|
|
x_tif_uinfo: str = Header(None),
|
|
|
x_tif_ext: str = Header(None),
|
|
|
):
|
|
|
- return {
|
|
|
- "account": "DGD440782197706290318",
|
|
|
- "account_type": "human",
|
|
|
- "cid": "440782197706290318",
|
|
|
- "corp": {
|
|
|
- "account": "50b50b6d",
|
|
|
- "address": "",
|
|
|
- "cid": "91440705354627820H",
|
|
|
- "ctype": "49",
|
|
|
+ if token == 'fb5d86fa-1cf3-11ef-9b67-00ff257b5fc6':
|
|
|
+ return {
|
|
|
+ "account": "DGD440782197706290318",
|
|
|
+ "account_type": "human",
|
|
|
+ "cid": "440782197706290318",
|
|
|
+ "corp": {
|
|
|
+ "account": "50b50b6d",
|
|
|
+ "address": "",
|
|
|
+ "cid": "91440705354627820H",
|
|
|
+ "ctype": "49",
|
|
|
+ "level": "L2",
|
|
|
+ "link_person_name": "李步尚",
|
|
|
+ "mobile": "13426789046",
|
|
|
+ "name": "江门市新会区尚软网络科技有限公司",
|
|
|
+ "role_type": "parent_linked",
|
|
|
+ "social_credit_code": "91440705354627820H",
|
|
|
+ "uid": "359a7db835994a7ebd147f09c5b9ae5d"
|
|
|
+ },
|
|
|
+ "ctype": "10",
|
|
|
"level": "L2",
|
|
|
- "link_person_name": "李步尚",
|
|
|
+ "link_person_cid": "",
|
|
|
+ "login_type": "SG-GASMHS",
|
|
|
"mobile": "13426789046",
|
|
|
- "name": "江门市新会区尚软网络科技有限公司",
|
|
|
- "role_type": "parent_linked",
|
|
|
- "social_credit_code": "91440705354627820H",
|
|
|
- "uid": "359a7db835994a7ebd147f09c5b9ae5d"
|
|
|
- },
|
|
|
- "ctype": "10",
|
|
|
- "level": "L2",
|
|
|
- "link_person_cid": "",
|
|
|
- "login_type": "SG-GASMHS",
|
|
|
- "mobile": "13426789046",
|
|
|
- "name": "李步尚",
|
|
|
- "origin": "SG",
|
|
|
- "sex": "1",
|
|
|
- "tokenid": "f36be617ec901c64d1234484eabd7431",
|
|
|
- "uid": "5b8f1a3e774d4ba8b7ccb2b2d51a38cd",
|
|
|
- "uversion": "1.0"
|
|
|
- }
|
|
|
+ "name": "李步尚",
|
|
|
+ "origin": "SG",
|
|
|
+ "sex": "1",
|
|
|
+ "tokenid": "f36be617ec901c64d1234484eabd7431",
|
|
|
+ "uid": "5b8f1a3e774d4ba8b7ccb2b2d51a38cd",
|
|
|
+ "uversion": "1.0"
|
|
|
+ }
|
|
|
|
|
|
pass_token = settings.YST_PASS_TOKEN
|
|
|
token_exception = TokenException()
|
|
@@ -315,4 +319,20 @@ def yst_image_response(data: any):
|
|
|
"errmsg": "",
|
|
|
"data": data
|
|
|
}
|
|
|
- return JSONResponse(content = content, headers = response_headers)
|
|
|
+ return JSONResponse(content = content, headers = response_headers)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+def yst_user_info_response(data: str):
|
|
|
+ logger.info("yst_user_info_response: {}", data)
|
|
|
+ response_nonce = ranstr(20)
|
|
|
+ response_timestamp = str(int(time.time()))
|
|
|
+ response_sign = calcResponseSign(response_timestamp, settings.YST_RANQI_PASS_TOKEN, response_nonce)
|
|
|
+
|
|
|
+ response_headers = {
|
|
|
+ "x-tif-signature": response_sign,
|
|
|
+ "x-tif-timestamp": response_timestamp,
|
|
|
+ "x-tif-nonce": response_nonce
|
|
|
+ }
|
|
|
+ return PlainTextResponse(content = data, headers = response_headers)
|