Exemplo n.º 1
0
 def doRemove(cls, rpath):
     mo = TyContext.Cls_MsgPack()
     try:
         userId = HttpUtils.checkUserParam()
         BeautyCertifyService.remove(userId)
         mo.setResult('info', '')
     except TyContext.FreetimeException, e:
         mo.setError(e.errorCode, e.message)
Exemplo n.º 2
0
    def doList(cls, path):
        mo = TyContext.Cls_MsgPack()
        try:
            userId = TyContext.RunHttp.getRequestParamInt('userId', 0)
            items = []
            total = 0

            if userId != 0:
                status = BeautyCertifyService.getBeautyCertifyStatus(userId)
                if status:
                    total = 1
                    items.append(cls.convertStatusToItem(status))
            else:
                pageNo = TyContext.RunHttp.getRequestParamInt('pn', 0)
                pageSize = TyContext.RunHttp.getRequestParamInt('ps', 30)
                state = TyContext.RunHttp.getRequestParamInt('state', 0)
                startTimeStr = TyContext.RunHttp.getRequestParam('startTime')
                endTimeStr = TyContext.RunHttp.getRequestParam('endTime')
                states = None
                if (state >= BeautyCertifyStatus.STATE_VERIFYING
                        and state < BeautyCertifyStatus.STATE_REJECTED):
                    states = [state]
                else:
                    states = [3, 4]

                if startTimeStr is not None and endTimeStr is not None:
                    startTime = int(
                        time.mktime(
                            datetime.strptime(
                                startTimeStr,
                                '%Y-%m-%d %H:%M:%S').timetuple()))
                    endTime = int(
                        time.mktime(
                            datetime.strptime(
                                endTimeStr, '%Y-%m-%d %H:%M:%S').timetuple()))
                else:
                    startTime = None
                    endTime = None
                total, statusList = BeautyCertifyService.listStatus(
                    pageNo * pageSize, pageSize, states, startTime, endTime)

                for status in statusList:
                    items.append(cls.convertStatusToItem(status))
            mo.setResult('total', total)
            mo.setResult('items', items)
            mo.setResult('pn', pageNo)
            mo.setResult('ps', pageSize)
        except TyContext.FreetimeException, e:
            mo.setError(e.errorCode, e.message)
Exemplo n.º 3
0
 def doRequestVerifyTest(cls, rpath):
     mo = TyContext.Cls_MsgPack()
     try:
         _gameId, userId = HttpUtils.checkGameRequest(False)
         status = BeautyCertifyService.requestVerify(userId)
         mo.setResult('state', status.state)
         mo.setResult('info', status.info)
     except TyContext.FreetimeException, e:
         mo.setError(e.errorCode, e.message)
Exemplo n.º 4
0
 def doAccept(cls, rpath):
     mo = TyContext.Cls_MsgPack()
     try:
         userId = HttpUtils.checkUserParam()
         status = BeautyCertifyService.accept(userId)
         mo.setResult('state', status.state)
         mo.setResult('info', status.info)
     except TyContext.FreetimeException, e:
         mo.setError(e.errorCode, e.message)
Exemplo n.º 5
0
 def doReject(cls, rpath):
     mo = TyContext.Cls_MsgPack()
     try:
         userId = HttpUtils.checkUserParam()
         reason = TyContext.RunHttp.getRequestParam('reason')
         status = BeautyCertifyService.reject(userId, reason)
         mo.setResult('state', status.state)
         mo.setResult('info', status.info)
     except TyContext.FreetimeException, e:
         mo.setError(e.errorCode, e.message)
Exemplo n.º 6
0
    def doSetUserInfo(cls, rparams, mo, needReturn=True):
        TyContext.ftlog.info(cls.__name__, 'doSetUserInfo->rparams=', rparams,
                             'needReturn=', needReturn)
        userId = rparams.get('userId', 0)
        if userId <= 0:
            return

        nickname = rparams.get('name', '')
        sex = str(rparams.get('sex', ''))
        headurl = rparams.get('headurl', '')
        address = rparams.get('address', '')
        idcardno = rparams.get('idcardno', '')
        truename = rparams.get('truename', '')
        phonenumber = rparams.get('phonenumber', '')
        lang = rparams.get('lang', None)
        country = rparams.get('country', None)
        signature = rparams.get('signature', None)
        agreeAddFriend = rparams.get('agreeAddFriend', None)
        email = rparams.get('email', None)

        datas = []

        if len(address) > 0:
            datas.append('address')
            datas.append(address)

        if len(idcardno) > 0:
            datas.append('idcardno')
            datas.append(idcardno)

        if len(truename) > 0:
            datas.append('truename')
            datas.append(truename)

        if len(phonenumber) > 0:
            datas.append('phonenumber')
            datas.append(phonenumber)

        if lang != None:
            datas.append('lang')
            datas.append(lang)

        if country != None:
            datas.append('country')
            datas.append(country)

        if signature != None:
            datas.append('signature')
            datas.append(TyContext.KeywordFilter.replace(signature))

        if agreeAddFriend != None:
            if agreeAddFriend == '0' or agreeAddFriend == '1':
                datas.append('agreeAddFriend')
                datas.append(int(agreeAddFriend))

        if email != None:
            datas.append('email')
            datas.append(email)

        if len(sex) > 0 and sex in ('0', '1'):
            datas.append('sex')
            datas.append(sex)
            oldSex = TyContext.RedisUser.execute(userId, 'HGET',
                                                 'user:'******'sex')
            if oldSex == None:
                oldSex = sex
            if int(oldSex) != int(sex):
                BeautyCertifyService.onUserSexChanged(userId, oldSex, sex)

        TyContext.ftlog.debug('nickname=[', nickname, ']')

        if nickname == "LikaiAndZengxinxin" and TyContext.TYGlobal.corporation(
        ) == "pineapple":
            pass
        elif len(nickname) > 0:
            newNameIs360Default = Account360.isDefault360Username(nickname)
            if newNameIs360Default:
                oldname = TyContext.RedisUser.execute(userId, 'HGET',
                                                      'user:'******'name')
                TyContext.ftlog.debug('nickname=[', nickname, '] oldname=[',
                                      oldname, '] sex=[', sex, ']')
                if not oldname or Account360.isDefault360Username(oldname):
                    if sex not in ('0', '1'):
                        sex = TyContext.RedisUser.execute(
                            userId, 'HGET', 'user:'******'sex')
                        TyContext.ftlog.debug('nickname=[', nickname,
                                              '] oldname=[', oldname,
                                              '] oldsex=[', sex, ']')
                    nickname = UsernameGenerator.getInstance().generate(sex)
                    # 设定
                else:
                    # 保持原名字
                    nickname = None
            else:
                # 设定
                pass

            if nickname != None:
                # 需要根据不同的游戏ID做屏蔽是否不再允许再次更改.(appId 1-19)appId 为 12和15仍可以通过此接口修改名称(大菠萝,海外德州)
                appId = int(rparams.get('appId', '0'))
                accessAppId = [1, 2, 3, 4, 5, 6, 7, 8, 12, 15]  # h5mod
                if appId in accessAppId:
                    datas.append('name')
                    datas.append(nickname)
                    # 修改昵称次数
                    if needReturn:
                        setTimes = TyContext.RedisUser.execute(
                            userId, 'HINCRBY', 'user:'******'set_name_sum', 1)
                        if TyContext.TYGlobal.corporation() == "pineapple":
                            if setTimes > 1:
                                mo.setResult('code', 1)
                                return
        if len(headurl) > 0:
            UserPhotoService.setUserPhoto(userId, UserPhoto.PHOTO_TYPE_AVATAR,
                                          headurl)

        TyContext.ftlog.debug('datas', datas, userId)
        if len(datas) > 0:
            TyContext.RedisUser.execute(userId, 'HMSET', 'user:'******'clientSystem', '')
            oldname = TyContext.RedisUser.execute(userId, 'HGET',
                                                  'user:'******'name')
            newname = rparams.get('name', '')
            if clientSystem == 'Winpc' and oldname != newname:
                mo.setResult('code', 2)
                mo.setError(2, '老板,昵称不能随意修改哦。')
                TyContext.ftlog.debug(cls.__name__, 'doSetUserInfo->mo', mo)
            else:
                cls.__set_user_info_return__(rparams, mo)
Exemplo n.º 7
0
    def doSetUserInfo(cls, rparams, mo, needReturn=True):
        TyContext.ftlog.info(cls.__name__, 'doSetUserInfo->rparams=', rparams,
                             'needReturn=', needReturn)
        userId = rparams.get('userId', 0)
        if userId <= 0:
            return

        nickname = rparams.get('name', '')
        sex = str(rparams.get('sex', ''))
        headurl = rparams.get('headurl', '')
        address = rparams.get('address', '')
        idcardno = rparams.get('idcardno', '')
        truename = rparams.get('truename', '')
        phonenumber = rparams.get('phonenumber', '')
        lang = rparams.get('lang', None)
        country = rparams.get('country', None)
        signature = rparams.get('signature', None)
        agreeAddFriend = rparams.get('agreeAddFriend', None)
        email = rparams.get('email', None)
        snsinfo = rparams.get('snsinfo', None)

        datas = []

        if len(address) > 0:
            datas.append('address')
            datas.append(address)

        if len(idcardno) > 0:
            datas.append('idcardno')
            datas.append(idcardno)

        if len(truename) > 0:
            datas.append('truename')
            datas.append(truename)

        if len(phonenumber) > 0:
            datas.append('phonenumber')
            datas.append(phonenumber)

        if lang != None:
            datas.append('lang')
            datas.append(lang)

        if country != None:
            datas.append('country')
            datas.append(country)

        if signature != None:
            datas.append('signature')
            datas.append(TyContext.KeywordFilter.replace(signature))

        if agreeAddFriend != None:
            if agreeAddFriend == '0' or agreeAddFriend == '1':
                datas.append('agreeAddFriend')
                datas.append(int(agreeAddFriend))

        if email != None:
            datas.append('email')
            datas.append(email)

        if snsinfo != None:
            datas.append('snsinfo')
            datas.append(snsinfo)

        if len(sex) > 0 and sex in ('0', '1'):
            datas.append('sex')
            datas.append(sex)
            oldSex = TyContext.RedisUser.execute(userId, 'HGET',
                                                 'user:'******'sex')
            if oldSex == None:
                oldSex = sex
            if int(oldSex) != int(sex):
                BeautyCertifyService.onUserSexChanged(userId, oldSex, sex)

        TyContext.ftlog.debug('nickname=[', nickname, ']')
        oldname = TyContext.RedisUser.execute(userId, 'HGET',
                                              'user:'******'name')
        '''
        if nickname == "LikaiAndZengxinxin" and TyContext.TYGlobal.corporation() == "pineapple":
            pass
        '''
        if len(nickname) > 0:
            newNameIs360Default = Account360.isDefault360Username(nickname)
            if newNameIs360Default:
                TyContext.ftlog.debug('nickname=[', nickname, '] oldname=[',
                                      oldname, '] sex=[', sex, ']')
                if not oldname or Account360.isDefault360Username(oldname):
                    if sex not in ('0', '1'):
                        sex = TyContext.RedisUser.execute(
                            userId, 'HGET', 'user:'******'sex')
                        TyContext.ftlog.debug('nickname=[', nickname,
                                              '] oldname=[', oldname,
                                              '] oldsex=[', sex, ']')
                    nickname = UsernameGenerator.getInstance().generate(sex)
                    # 设定
                else:
                    # 保持原名字
                    nickname = None
            else:
                # 设定
                pass

            if nickname != None:
                # todo for 104 test add by tcz
                mo_tmp = TyContext.MsgPack()
                UsernameGenerator.change_old_user_name(nickname, userId,
                                                       mo_tmp)
                if str(mo_tmp.getResult('code')) != '0':
                    mo.setResult('code', mo_tmp.getResult('code'))
                    mo.setResult('info', mo_tmp.getResult(('info')))
                    return
                datas.append('name')
                datas.append(nickname)
                # 需要根据不同的游戏ID做屏蔽是否不再允许再次更改.(appId 1-19)appId 为 12和15仍可以通过此接口修改名称(大菠萝,海外德州)
                accessAppId = TyContext.Configure.get_global_item_json(
                    'change_nickname_appId', [12, 15])
                appId = int(rparams.get('appId', '0'))
                if not appId in accessAppId and oldname != nickname and needReturn:
                    TyContext.RedisUser.execute(userId, 'HINCRBY',
                                                'user:'******'set_name_sum', 1)

        if len(headurl) > 0:
            UserPhotoService.setUserPhoto(userId, UserPhoto.PHOTO_TYPE_AVATAR,
                                          headurl)

        if len(datas) > 0:
            TyContext.RedisUser.execute(userId, 'HMSET', 'user:' + str(userId),
                                        *datas)

        if needReturn:
            cls.__set_user_info_return__(rparams, mo)
Exemplo n.º 8
0
def game_sdk_init():
    from tyframework.context import TyContext

    TyContext.ftlog.info('game_sdk_init in')

    #     from tysdk.cmdcenter.httptimer import HttpSdkTimer
    #     TyContext.Cmds.add_timer(HttpSdkTimer)

    from tysdk.cmdcenter.httpuser import HttpUser
    TyContext.RunHttp.add_executer(HttpUser)

    from tysdk.cmdcenter.httpuserv3 import HttpUserV3
    TyContext.RunHttp.add_executer(HttpUserV3)

    from tysdk.cmdcenter.httpuserv4 import HttpUserV4
    TyContext.RunHttp.add_executer(HttpUserV4)

    from tysdk.cmdcenter.httpreportv4 import HttpReportV4
    TyContext.RunHttp.add_executer(HttpReportV4)

    from tysdk.cmdcenter.httpuserh5v3 import HttpUserH5V3
    TyContext.RunHttp.add_executer(HttpUserH5V3)

    from tysdk.cmdcenter.httppayh5v3 import HttpPayH5V3
    TyContext.RunHttp.add_executer(HttpPayH5V3)

    from tysdk.cmdcenter.httppayv1 import HttpPay
    TyContext.RunHttp.add_executer(HttpPay)

    from tysdk.cmdcenter.httppayv3 import HttpPayV3
    TyContext.RunHttp.add_executer(HttpPayV3)

    from tysdk.cmdcenter.httppayv4 import HttpPayV4
    TyContext.RunHttp.add_executer(HttpPayV4)

    from tysdk.cmdcenter.httpuserphotov3 import HttpUserPhotov3
    TyContext.RunHttp.add_executer(HttpUserPhotov3)

    from tysdk.cmdcenter.httpbeautycertifyv3 import HttpBeautyCertifyv3
    TyContext.RunHttp.add_executer(HttpBeautyCertifyv3)

    from tysdk.cmdcenter.httpavatarverifyv3 import HttpAvatarVerifyv3
    TyContext.RunHttp.add_executer(HttpAvatarVerifyv3)

    from tysdk.cmdcenter.httpsnsv3 import HttpSnsV3
    TyContext.RunHttp.add_executer(HttpSnsV3)

    from tysdk.cmdcenter.httpfriendv3 import HttpFriendV3
    TyContext.RunHttp.add_executer(HttpFriendV3)

    from tysdk.cmdcenter.httpupgradev3 import HttpUpgradev3
    TyContext.RunHttp.add_executer(HttpUpgradev3)

    from tysdk.cmdcenter.httppushv3 import HttpPushV3
    TyContext.RunHttp.add_executer(HttpPushV3)

    from tysdk.cmdcenter.httpmanagement import HttpManagement
    TyContext.RunHttp.add_executer(HttpManagement)

    from tysdk.cmdcenter.httpads import HttpAds
    TyContext.RunHttp.add_executer(HttpAds)

    from tysdk.cmdcenter.gamereg import HttpGameRegister
    TyContext.RunHttp.add_executer(HttpGameRegister)

    from tysdk.cmdcenter.testorder import HttpTestOrder
    TyContext.RunHttp.add_executer(HttpTestOrder)

    from tysdk.cmdcenter.httphello import HttpHello
    TyContext.RunHttp.add_executer(HttpHello)

    from tysdk.entity.ads.advertise import AdvertiseService
    AdvertiseService.on_init()

    from tysdk.entity.beautycertify3.beautycertify import BeautyCertifyService
    BeautyCertifyService.onInit()

    from tysdk.entity.beautycertify3.avatarverify import AvatarVerifyService
    AvatarVerifyService.onInit()

    from tysdk.entity.upgradev3.versionmanagerv3 import GameIncUpdateConfiger
    GameIncUpdateConfiger.instance()

    from tysdk.entity.upgradev3.versionmanagerv3 import GameIncUpdate
    GameIncUpdate.instance()

    from tysdk.entity.user_common.username import UsernameGenerator
    UsernameGenerator.createInstance()

    from tysdk.entity.duandai.channels import Channels
    Channels.init()

    init_subscription()

    TyContext.ftlog.info('game_sdk_init out')