|
|
@ -91,6 +91,7 @@ def update_plan(uid,plan,auid=None):
|
|
|
|
url = ":protocol://:host/store/subscribe/smart-top"
|
|
|
|
url = ":protocol://:host/store/subscribe/smart-top"
|
|
|
|
url = url.replace(":protocol",CONFIG['protocol']).replace(":host",CONFIG['api'])
|
|
|
|
url = url.replace(":protocol",CONFIG['protocol']).replace(":host",CONFIG['api'])
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
|
|
|
|
|
|
|
|
args = {"type":SYS_STORE['class']['read'],"args":SYS_STORE['args']}
|
|
|
|
args = {"type":SYS_STORE['class']['read'],"args":SYS_STORE['args']}
|
|
|
|
# reader = factory.instance(**args)
|
|
|
|
# reader = factory.instance(**args)
|
|
|
|
|
|
|
|
|
|
|
@ -99,9 +100,10 @@ def update_plan(uid,plan,auid=None):
|
|
|
|
headers['pid'] = plan
|
|
|
|
headers['pid'] = plan
|
|
|
|
if auid is not None:
|
|
|
|
if auid is not None:
|
|
|
|
headers["auid"]=json.dumps([auid])
|
|
|
|
headers["auid"]=json.dumps([auid])
|
|
|
|
httpclient = requests.session()
|
|
|
|
# httpclient = requests.session()
|
|
|
|
r = httpclient.post(url,headers=headers)
|
|
|
|
# r = httpclient.post(url,headers=headers)
|
|
|
|
#r = requests.post(url,headers=headers)
|
|
|
|
r = requests.post(url,headers=headers)
|
|
|
|
|
|
|
|
|
|
|
|
return json.loads( r.text)
|
|
|
|
return json.loads( r.text)
|
|
|
|
|
|
|
|
|
|
|
|
except Exception,e:
|
|
|
|
except Exception,e:
|
|
|
@ -135,11 +137,11 @@ def register() :
|
|
|
|
key = None
|
|
|
|
key = None
|
|
|
|
|
|
|
|
|
|
|
|
if 'key' not in session :
|
|
|
|
if 'key' not in session :
|
|
|
|
key = reader.view('users/uid_map',key=uid)
|
|
|
|
key = reader.view('users/uid_map',key=uid)
|
|
|
|
# if key :
|
|
|
|
|
|
|
|
# session['key'] = key
|
|
|
|
|
|
|
|
if key :
|
|
|
|
if key :
|
|
|
|
plans = reader.view('users/active_plan',key=str(key))
|
|
|
|
plans = reader.view('users/active_plan',key=str(key))
|
|
|
|
|
|
|
|
session['key'] = key
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
plans = None
|
|
|
|
plans = None
|
|
|
|
plan = body['plan'] if 'plan' in body else CONFIG['default_plan']#-- default plan
|
|
|
|
plan = body['plan'] if 'plan' in body else CONFIG['default_plan']#-- default plan
|
|
|
@ -156,7 +158,7 @@ def register() :
|
|
|
|
writer.write(label='hash',data=auid)
|
|
|
|
writer.write(label='hash',data=auid)
|
|
|
|
session['key'] = key
|
|
|
|
session['key'] = key
|
|
|
|
|
|
|
|
|
|
|
|
if plans :
|
|
|
|
if plans :
|
|
|
|
session['user-plan'] = plans
|
|
|
|
session['user-plan'] = plans
|
|
|
|
return ('',204)
|
|
|
|
return ('',204)
|
|
|
|
return "",403
|
|
|
|
return "",403
|
|
|
|