随笔分类 -  my_work_2011

工作中的记录,算是总结之类的吧。
摘要:# -*- coding: utf-8 -*-import os,renum = 0for root, dis, files in os.walk('G:\\paopaoyu\\apps'): for fil in files: p = re.compile('\W*.py$') m = p.search(fil) if m: #print fil f = file(root + '\\' + fil) temp = 0 while True: ... 阅读全文

posted @ 2012-03-05 14:15 蛇小狼 阅读(185) 评论(0) 推荐(0)

摘要:德国人真的有点死板。。。只给JS的api,不给REST API接入的是http://www.meinvz.net/1,引入JS文件和初始化 1 <script type="text/javascript" 2 src="{{ media_url }}Res/jquery.js"> 3 </script> 4 <script type="text/javascript" 5 src="http://imgs3.plinga.de/general/easyXDM.min.js?v=1"&g 阅读全文

posted @ 2011-08-30 10:18 蛇小狼 阅读(413) 评论(0) 推荐(0)

摘要:平时由于经常给测试人员调试一些东西,虽然写了一些脚本,感觉还是不方便。python的cmd模块提供的更优雅的方式,很喜欢。刚写了一些平时常用的测试代码:# -*- coding:utf-8 -*-import os, sysfrom datetime import datetimeimport cmdimport warningsfrom django.conf import settingsdef not_exit(func): def _func(*args, **kwargs): try: res = func(*args, **kwargs) return res except: pr 阅读全文

posted @ 2011-07-07 18:08 蛇小狼 阅读(597) 评论(0) 推荐(0)

摘要:这个以facebook台湾的测试版为例。仅仅测试用户登录,主要说明测试的使用和django环境的设置。代码如下:import osimport sysimport unittestimport hashlibTEST_MEMBER_ID = 11SNS_ID = 100002309745702TEST_SESSION_KEY = '125737724171219|2.AQCp7ctCYXJh4ooW.3600.1310022000.1-100002309745702|qj4000WhhKWGtApOI0icEpzSyZ8' # Need to get from sns plat 阅读全文

posted @ 2011-07-07 14:33 蛇小狼 阅读(303) 评论(0) 推荐(0)

摘要:需要给前端以xml格式提供一些数据,这些数据在目前的数据库中已经存在。如果使用django返回xml数据的话,需要包装下头信息:r = HttpResponse(str_xml)r.mimetype = "text/xml"r['Content-Type'] = "application/xml"另外,使用group by可以使用以下方式来查询。objs = Fish.objects.raw("SELECT id, almanac_name, style , almanac_code,almanac_description FR 阅读全文

posted @ 2011-06-30 11:38 蛇小狼 阅读(322) 评论(0) 推荐(0)

摘要:四、充值充值弹窗<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js"></script><script>FB.init({ appId:'{{ app_id }}', cookie:true, status:true, xfbml:true });</script>function buyit(rmb, pearls){ FB.ui({ method:'pa 阅读全文

posted @ 2011-06-29 15:21 蛇小狼 阅读(2021) 评论(1) 推荐(0)

摘要:一、开发者后台账号设置web site sit url: http://apps.facebook.com/app_name/facebook Integration canvas url: http://your_real_domain/ iframe size: auto_resize bookmark url: you_app_url tab name: you_app_name tab url: your_real_domainadvanced sandbox mode: enable disable时,只有测试号可以登录app Remove Deprecated Auth Metho 阅读全文

posted @ 2011-06-29 15:12 蛇小狼 阅读(1338) 评论(1) 推荐(0)

摘要:开心网文档很全面,接入先对简单。actions API以充值举例kaixin001_paymentdef _generate_sig(params): hasher = hashlib.md5(''.join(['%s=%s' % (str(x), str(params[x])) for x in sorted(params.keys())])) hasher.update(SECRET_KEY) return hasher.hexdigest()def _generate_kaixin_base_params(session_key, method=" 阅读全文

posted @ 2011-04-25 10:57 蛇小狼 阅读(278) 评论(0) 推荐(0)

摘要:借助第三方库m2crypto,在linux下安装使用sudo apt-get install m2crypto即可。实现方法:paypal代码from M2Crypto import BIO, SMIME, X509#from django.conf import settings#DKY7UM4QRRD5Y#seller_1301033066_per@163.com def paypal_encrypt(attributes): plaintext = '' for key, value in attributes.items(): plaintext += u'%s 阅读全文

posted @ 2011-04-22 11:49 蛇小狼 阅读(348) 评论(0) 推荐(0)

摘要:一、接入流程① App调用opensocial.requestPayment(),生成支付信息② Mbga向对应App服务器的endpoint URL发送支付确认信息请求③ App服务器验证mbga发送的请求之后返回response给mbga,mbga引导用户去充值页面④ 用户同意充值了,就向App服务器发送一个支付确认的request。⑤ App服务器验证request的正确性,处理游戏内部item购买业务,最后返回response给mbga。Mbga在收到正常的response之后,就确定了支付了。⑥ 执行最初调用opensocial.requestPayment()的最后一个参数(执行c 阅读全文

posted @ 2011-04-18 11:28 蛇小狼 阅读(758) 评论(0) 推荐(0)

摘要:需求:游戏账号可以登录discuz论坛。思路:时间短,没有做API接口。直接使用数据库同步的方法。1,用户登录游戏的时候,判断是否该账户在discuz_ucenter中,有则pass,没有则在uc_members中插入一条用户记录。2,用户在修改游戏账号密码的时候,同时修改discuz_ucenter中对应该账户的密码。3,用户在注册游戏账号的时候,同时写入discuz_ucenter中用户记录。实现:一,修改settings.py中的数据库配置,增加一个discuz论坛所在的数据库,键名称为"ucenter"。例如:DATABASES={'default' 阅读全文

posted @ 2011-04-14 12:24 蛇小狼