|
@@ -1265,12 +1265,12 @@ class InitInfoView(View):
|
|
|
tko = TokenObject(token)
|
|
|
if tko.code == 0:
|
|
|
userID = tko.userID
|
|
|
- return self.init_uid(request_dict, userID, response)
|
|
|
+ return self.init_info(request_dict, userID, response)
|
|
|
else:
|
|
|
return response.json(tko.code)
|
|
|
|
|
|
# 初始化设备token
|
|
|
- def init_uid(self, request_dict, userID, response):
|
|
|
+ def init_info(self, request_dict, userID, response):
|
|
|
# 未读的系统消息
|
|
|
token_val = request_dict.get('token_val', None)
|
|
|
m_code = request_dict.get('m_code', None)
|
|
@@ -1278,8 +1278,8 @@ class InitInfoView(View):
|
|
|
appBundleId = request_dict.get('appBundleId', None)
|
|
|
tz = request_dict.get('tz', '0')
|
|
|
lang = request_dict.get('lang', '') # 语言区域
|
|
|
- # region = request_dict.get('region', '') # 语言区域
|
|
|
- nowTime = int(time.time())
|
|
|
+ is_ver = request_dict.get('is_ver', 0) # 判断是否为对接新接口的app版本
|
|
|
+ now_time = int(time.time())
|
|
|
if all([token_val, push_type, appBundleId]):
|
|
|
push_type = int(push_type)
|
|
|
if push_type == 0:
|
|
@@ -1307,25 +1307,36 @@ class InitInfoView(View):
|
|
|
user_ex_qs = UserExModel.objects.filter(userID_id=userID)
|
|
|
if user_ex_qs.exists():
|
|
|
update_dict = {
|
|
|
- 'updTime': nowTime,
|
|
|
+ 'updTime': now_time,
|
|
|
'appBundleId': appBundleId,
|
|
|
'region': lang
|
|
|
}
|
|
|
user_ex_qs.update(**update_dict)
|
|
|
else:
|
|
|
create_dict = {
|
|
|
- 'addTime': nowTime,
|
|
|
- 'updTime': nowTime,
|
|
|
+ 'addTime': now_time,
|
|
|
+ 'updTime': now_time,
|
|
|
'appBundleId': appBundleId,
|
|
|
'userID_id': userID,
|
|
|
'region': lang
|
|
|
}
|
|
|
UserExModel.objects.create(**create_dict)
|
|
|
# 获取设备是否存在有已被删除
|
|
|
-
|
|
|
- res = {
|
|
|
- 'usmsg': 0,
|
|
|
- }
|
|
|
+ res = {'usmsg': 0} # 预留字段, 有版本app该字段去掉会报错
|
|
|
+ if is_ver:
|
|
|
+ res['grade'] = 1
|
|
|
+ res['usingHelp'] = 0
|
|
|
+ res['apAdd'] = 1
|
|
|
+ res['apTool'] = 1
|
|
|
+ res['ad_module'] = {
|
|
|
+ "time": 0,
|
|
|
+ "start_path": "https://upload.jianshu.io/admin_banners/web_images/4894/23ecc55accf5c6a6c9910be966c125853d1f04a5.png",
|
|
|
+ "ad_path": [
|
|
|
+ "https://upload-images.jianshu.io/upload_images/17401036-b19d630b914206b6.jpg",
|
|
|
+ "https://upload-images.jianshu.io/upload_images/19895418-a2fda00de789ca7b",
|
|
|
+ "https://upload-images.jianshu.io/upload_images/9027928-72ce7b5d4cd53f14"
|
|
|
+ ]
|
|
|
+ }
|
|
|
return response.json(0, res)
|
|
|
|
|
|
|