|
@@ -7,9 +7,8 @@
|
|
|
@Software: PyCharm
|
|
|
"""
|
|
|
import base64
|
|
|
-import datetime
|
|
|
import json
|
|
|
-from decimal import Decimal
|
|
|
+import logging
|
|
|
|
|
|
import requests
|
|
|
from Crypto.Cipher import AES
|
|
@@ -26,6 +25,8 @@ from Object.utils.SymmetricCryptoUtil import AESencrypt
|
|
|
https://www.showdoc.com.cn/unicomJYHapi/8158648460007467
|
|
|
"""
|
|
|
|
|
|
+logger = logging.getLogger('info')
|
|
|
+
|
|
|
|
|
|
class UnicomObjeect:
|
|
|
def __init__(self):
|
|
@@ -292,60 +293,14 @@ class UnicomObjeect:
|
|
|
"""
|
|
|
if iccid:
|
|
|
re_data = {"iccid": iccid, "status": 2}
|
|
|
- UnicomObjeect().update_device_state(**re_data)
|
|
|
+ response = UnicomObjeect().update_device_state(**re_data)
|
|
|
+ logger.info('停用iccid响应结果:{}'.format(response))
|
|
|
# 查询是否停用成功
|
|
|
re_data.pop('status')
|
|
|
result = UnicomObjeect().query_device_status(**re_data)
|
|
|
res_dict = UnicomObjeect().get_text_dict(result)
|
|
|
+ logger.info('查询iccid状态{}'.format(res_dict))
|
|
|
if res_dict['data']['status'] != 3:
|
|
|
UnicomObjeect().update_device_state(**re_data)
|
|
|
return True
|
|
|
return None
|
|
|
-
|
|
|
-
|
|
|
-if __name__ == '__main__':
|
|
|
-
|
|
|
- today = datetime.datetime.today()
|
|
|
- year = today.year
|
|
|
- month = today.month
|
|
|
- print(year)
|
|
|
- print(month)
|
|
|
- print(type(year))
|
|
|
- if not '':
|
|
|
- print('为空')
|
|
|
- price = '12.13'
|
|
|
- print(float(price))
|
|
|
- discount = '6'
|
|
|
- dd = Decimal(price) - Decimal(discount)
|
|
|
- print(dd.quantize(Decimal('0.00')))
|
|
|
-
|
|
|
- unicom_api = UnicomObjeect()
|
|
|
- data = {'foo': 1, 'bar': 2, 'baz': 3}
|
|
|
- print(unicom_api.createSign(**data))
|
|
|
- # result = unicom_api.generate_token()
|
|
|
- # result = unicom_api.refresh_token('5d0c0f30-99bd-4f17-9614-3524495b05d4')
|
|
|
- params = {'iccid': '89860621330065433774', 'status': 2}
|
|
|
- # response = unicom_api.verify_device(**params)
|
|
|
- # response = unicom_api.query_device_status(**params)
|
|
|
- response = unicom_api.update_device_state(**params)
|
|
|
- # response = unicom_api.query_device_usage_history(**params)
|
|
|
- # response = unicom_api.query_current_renew_list_usage_details(**params)
|
|
|
- # unicom_api.get_device_batch_detail()
|
|
|
- # response = unicom_api.query_package_list(**params)
|
|
|
- # response = unicom_api.query_renewal_list(**params)
|
|
|
-
|
|
|
- if response.status_code == 200:
|
|
|
- res = json.loads(response.text)
|
|
|
- print(res)
|
|
|
- response_json = {
|
|
|
- "success": True,
|
|
|
- "msg": "操作成功",
|
|
|
- "code": 0,
|
|
|
- "data": {
|
|
|
- "iccid": "8986062018007784202",
|
|
|
- "completeIccid": "89860620180077842020",
|
|
|
- "status": 1
|
|
|
- }
|
|
|
- }
|
|
|
- print(response_json['data']['iccid'])
|
|
|
- print(response.status_code)
|