- 精华
- 阅读权限
- 50
- 好友
- 相册
- 分享
- 听众
- 收听
- 注册时间
- 2022-5-8
- 在线时间
- 小时
- 最后登录
- 1970-1-1
|
新注册的号在合服之后还能在合服上玩
1.在【正式配置】【平台杂项】添加下面,再发布配置
'zone_login':[
# zone = 原服 id(字符串),merge_zone=合服id(字符串)
{ 'zone': '1','merge_zone': 'h1_1'},
# { 'zone': '102','merge_zone': 'h2_1'},
# { 'zone': '103','merge_zone': 'h3_1'},
# { 'zone': '104','merge_zone': 'h4_1'},
# { 'zone': '105','merge_zone': 'h5_1'},
# { 'zone': '106','merge_zone': 'h6_1'},
# { 'zone': '107','merge_zone': 'h7_1'},
],
2.在文件添加修改
data\server\trunk\game_lib\game_lib\models\main.py
#---------------------------- 分隔符
@classmethod
def ucoin_pay(cls, request, params):
pid, zone, uid, ts = params['order_id'].split('|')
md5_str,tstr,_ = params['sessionid'].split('|')
if md5_str != hashlib.md5('%s%s%s' % (uid,tstr,settings.PWD)).hexdigest():
return {'status': 'error', 'msg': u'非法登陆', 'ucoin': user_zone.ucoin}
user_zone = cls.get(uid)
v = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
pay_id = '%s|%s|ucoin' % (pid,v)
goods_config = game_config.goods.get(pid,None)
if goods_config:
pay_config = game_config.pay_config[goods_config['pay_id']]
else:
pay_config = game_config.pay_config[pid]
pay_money = pay_config[0]
if user_zone.ucoin < pay_money:
return {'status':'error', 'msg': '充值失败', 'ucoin': user_zone.ucoin}
#---------------------------- 分隔符
if user_zone.ucoin < 10000: #添加 1 锁定充值,不要就不要修改
user_zone.ucoin += abs(pay_money) #添加 2
else: #添加 3
user_zone.ucoin -= pay_money #修改 4
#---------------------------- 分隔符
pay_result = UserZone.call_server_api(zone, 'user_pay', {'uid': user_zone.uid, 'pid': pid, 'pay_id': pay_id})
if pay_result['succ'] != 1:
return {'status':'error', 'msg': '充值失败', 'ucoin': user_zone.ucoin}
user_zone.save()
return {'status': 'success', 'ucoin': user_zone.ucoin}
@classmethod
def register(cls, request, params):
username = params['username']
pwd = params['pwd']
pwd1 = params['pwd1']
pf = params['pf']
new_install_login_conf = game_config.help_msg.get('new_install_login_conf',None)
if not new_install_login_conf:
white_pf = True
elif new_install_login_conf.get('white_pfs') and pf in new_install_login_conf['white_pfs']:
white_pf = True
else:
white_pf = False
if new_install_login_conf and not new_install_login_conf['new_install'] and not white_pf:
return {'status': 'error', 'msg': u'连接服务器失败'}
if len(username) not in range(3,17) or len(pwd) not in range(6,17):
return {'status': 'error', 'msg': u'账户名或密码格式不正确'}
if pwd != pwd1:
return {'status': 'error', 'msg': u'重复输入密码不正确'}
try:
user_zone = cls()
user_zone.pf = pf
user_zone.pf_key = username
user_zone.pf_pwd = hashlib.md5(pwd).hexdigest()
user_zone.www = 1
#---------------------------- 分隔符
user_zone.ucoin = 2000 #添加 5 先充填 ,不要就不要添加
for item in game_config.system_simple['zone_login']:#添加 6
user_zone.zone_login[item['zone']] = {'merge_zone': str(item['merge_zone']), 'login_time': datetime.datetime.now()} #添加 7
#---------------------------- 分隔符
user_zone.save()
except:
return {'status': 'error', 'msg': u'用户名重复'}
return {'status': 'success', 'username': username, 'pwd': pwd, 'uid': user_zone.uid}
@classmethod
def register_fast(cls, request, params):
pf = params['pf']
new_install_login_conf = game_config.help_msg.get('new_install_login_conf',None)
if not new_install_login_conf:
white_pf = True
elif new_install_login_conf.get('white_pfs') and pf in new_install_login_conf['white_pfs']:
white_pf = True
else:
white_pf = False
if new_install_login_conf and not new_install_login_conf['new_install'] and not white_pf:
return {'status': 'error', 'msg': u'连接服务器失败'}
user_zone = cls()
user_zone.pf = pf
rnd_str = '%06d_%s' % (random.randint(0,229999),time.time())
user_zone.pf_key = hashlib.md5(rnd_str).hexdigest()
user_zone.www = 1
#---------------------------- 分隔符
user_zone.ucoin = 2000 #添加 8 先充填,不要就不要添加
for item in game_config.system_simple['zone_login']:#添加 9
user_zone.zone_login[item['zone']] = {'merge_zone': str(item['merge_zone']), 'login_time': datetime.datetime.now()} #添加 10
#---------------------------- 分隔符
user_zone.save()
uid = user_zone.uid
#username = utils.to_ustr(user_zone.uid)
rnd_unamestr = '%03d' % random.randint(0,89)
username = 'wz%s%s' % (uid,rnd_unamestr)
for item in range(10):
try:
user_zone.pf_key = username
pwd = '%06d' % random.randint(0,998899)
pwd = hashlib.md5(pwd).hexdigest()[:8]
user_zone.pf_pwd = hashlib.md5(pwd).hexdigest()
user_zone.save()
break
except:
rnd_unamestr = '%03d' % random.randint(0,555)
username = 'wz%s%s' % (uid,rnd_unamestr)
continue
return {'status': 'success', 'username': username, 'pwd': pwd, 'uid': user_zone.uid}
#---------------------------- 分隔符
|
|