示例#1
0
    def do_deny_pay(self, apply_sorder):
        """
        拒绝支付处理
        :param apply_sorder: 申请帮助子订单id
        :return:
        """
        from mmm_da.lib.help.control import ApplyHelpMgr, AcceptHelpMgr
        apply_help_pay_dic = self.get_data_by_sorder(apply_sorder)
        assert apply_help_pay_dic

        apply_help_dic = ApplyHelpMgr().get_data_by_order(
            apply_help_pay_dic['apply_order'])

        # 封号
        account = AccountMgr().get_data_by_id(apply_help_dic['apply_uid'])
        account.attr_stat = SEALED

        # 接受帮助/申请帮助恢复
        AcceptHelpMgr().do_recover(apply_help_pay_dic['accept_order'],
                                   apply_help_pay_dic['apply_pmoney'])
        ApplyHelpMgr().do_recover(apply_help_pay_dic['apply_order'],
                                  apply_help_pay_dic['apply_pmoney'])

        # 未支付奖金处理
        BonusMgr().on_apply_cancel(apply_help_dic['apply_uid'],
                                   apply_help_pay_dic['apply_pmoney'])

        upd_dic = {
            "apply_sorder": apply_sorder,
            "apply_pstat": APYS_PAY_REFUSE
        }
        self.update_dic(apply_sorder, upd_dic)
示例#2
0
    def active_account(self, oper_account, active_id):
        """
        账号激活
        :param oper_account: 操作账号
        :param active_id: 激活id
        :return:
        """
        from mmm_da.lib.account.control import AccountMgr
        activing_account = AccountMgr().get_data_by_id(active_id)
        if not oper_account or not activing_account:
            logger.info("ActiveMgr::active_account Error, not account!!!, oper_id:%s, active_id:%s" % (oper_account.id, active_id))
            return False

        # 如果目标账户已经激活,不再激活
        if activing_account.attr_stat == ACTIVED:
            logger.info("ActiveMgr::active_account Error, has actived active_id:%s" % active_id)
            return False

        from mmm_da.lib.server_info import ServerInfoMgr
        if oper_account.attr_active_coin < ServerInfoMgr().attr_active_coin_loss:
            logger.info("ActiveMgr::active_account Error, oper account not enough active_coin!!!, oper_id:%s" % oper_account.id)
            return False

        # 扣除激活消耗
        oper_account.attr_active_coin -= ServerInfoMgr().attr_active_coin_loss

        # 激活
        activing_account.attr_stat = ACTIVED
        logger.info("ActiveMgr::active_account Success!!!, oper_id:%s, active_id:%s" % (oper_account.id, active_id))
        return True
示例#3
0
    def get(self, account, apply_uid, accept_uid, apply_money, **kwargs):
        apply_money = int(apply_money)

        if not AccountMgr().is_id_exist(apply_uid):
            logger.info(
                "AutoMatchHandler ERROR_UID_NOT_EXIST, apply_uid not existed, %s"
                % apply_uid)
            self.set_status(error_code.ERROR_UID_NOT_EXIST, 'Parameter Error')
            return error_code.ERROR_UID_NOT_EXIST

        if not AccountMgr().is_id_exist(accept_uid):
            logger.info(
                "AutoMatchHandler ERROR_UID_NOT_EXIST, id not existed, %s" %
                accept_uid)
            self.set_status(error_code.ERROR_UID_NOT_EXIST, 'Parameter Error')
            return error_code.ERROR_UID_NOT_EXIST

        # 获取申请帮助信息
        apply_help_dic = ApplyHelpMgr().get_unfinish(apply_uid)
        if not apply_help_dic:
            # 判断是否有申请帮助请求在排队,如果有,直接进入匹配模式
            apply_help_req = ApplyHelpReqMgr().get_unfinish(apply_uid)
            if not apply_help_req:
                logger.info(
                    "AutoMatchHandler ERROR_LOGIC, not apply_help_dic, apply_uid:%s"
                    % apply_uid)
                self.set_status(error_code.ERROR_LOGIC, 'Parameter Error')
                return error_code.ERROR_LOGIC

            ApplyHelpReqMgr().do_match(apply_help_req['id'])
            apply_help_dic = ApplyHelpMgr().get_unfinish(apply_uid)
            assert apply_help_dic

        # 获取接受帮助信息
        accept_help_dic = AcceptHelpMgr().get_unfinish(accept_uid)
        if not accept_help_dic:
            accept_help_req = AcceptHelpReqMgr().get_unfinish(accept_uid)
            if not accept_help_req:
                logger.info(
                    "AutoMatchHandler ERROR_LOGIC, not accept_help_dic, accept_uid:%s"
                    % accept_uid)
                self.set_status(error_code.ERROR_LOGIC, 'Parameter Error')
                return error_code.ERROR_LOGIC

            AcceptHelpReqMgr().do_match(accept_help_req['id'])
            accept_help_dic = AcceptHelpMgr().get_unfinish(accept_uid)
            assert accept_help_dic

        # 接受帮助金额判定
        apply_money = min(apply_money, apply_help_dic['apply_lmoney'],
                          accept_help_dic['accept_lmoney'])

        # 手动匹配
        accept_matched_ls = [{
            "accept_order": accept_help_dic['accept_order'],
            "apply_money": apply_money
        }]
        AcceptApplyMatcher().matched_proc(apply_help_dic, accept_matched_ls)
        return error_code.ERROR_SUCCESS
示例#4
0
 def get(self, seal_id, **kwargs):
     seal_account = AccountMgr().get_data_by_id(str(seal_id))
     if not seal_account:
         logger.info(
             "seal_account get ERROR_UID_NOT_EXIST, not seal_account!!!, seal_id"
             % seal_id)
         self.set_status(error_code.ERROR_UID_NOT_EXIST, 'Parameter Error')
         return error_code.ERROR_UID_NOT_EXIST
     seal_account.attr_stat = SEALED
     return seal_account.get_info_dic()
示例#5
0
    def do_not_apply(self, apply_wait_uid):
        """
        在对应时间内没有申请帮助
        :param apply_wait_uid: 等待申请帮助uid
        :return:
        """
        # 封号
        account = AccountMgr().get_data_by_id(apply_wait_uid)
        account.attr_stat = SEALED

        # 删除等待
        self.del_wait(apply_wait_uid)
示例#6
0
    def get(self, unseal_id, **kwargs):
        unseal_account = AccountMgr().get_data_by_id(str(unseal_id))
        if not unseal_account:
            logger.info(
                "unseal_account get ERROR_UID_NOT_EXIST, not seal_account!!!, unseal_id"
                % unseal_id)
            self.set_status(error_code.ERROR_UID_NOT_EXIST, 'Parameter Error')
            return error_code.ERROR_UID_NOT_EXIST

        # 解除封号以后,该账号进入激活状态,不需要激活币
        unseal_account.attr_stat = ACTIVED
        return unseal_account.get_info_dic()
示例#7
0
文件: help.py 项目: cash2one/FundTray
    def post(self, account, **kwargs):
        accept_help = AcceptHelpMgr().get_unfinish(account.id)

        if not accept_help:
            accept_help_req = AcceptHelpReqMgr().get_unfinish(account.id)
            return {"result": error_code.ERROR_SUCCESS,
                    "accept_help": accept_help_req_2_accept_help(accept_help_req),
                    "apply_help_ls": []}

        apply_help_ls =[]

        # 获取申请帮助子订单信息
        apply_help_pays = ApplyHelpPayMgr().get_datas_by_accept_order(accept_help['accept_order'])
        for apply_help_pay_dic in apply_help_pays:
            apply_help_dic = ApplyHelpMgr().get_data_by_order(apply_help_pay_dic['apply_order'])

            # 申请帮助信息
            apply_info = sub_dict(apply_help_dic, ['apply_order','apply_uid','apply_stime',])
            apply_info.update(sub_dict(apply_help_pay_dic, ['apply_sorder', 'apply_pmoney', 'apply_mtime', 'apply_pstat', 'apply_piture', 'apply_message']))

            # 申请帮助账号信息
            account_obj = AccountMgr().get_data_by_id(apply_help_dic['apply_uid'])
            apply_info['bank_name'] = account_obj.bank_name

            apply_help_ls.append(apply_info)
        return {"result": error_code.ERROR_SUCCESS,
                "accept_help": accept_help,
                "apply_help_ls": apply_help_ls}
示例#8
0
文件: help.py 项目: cash2one/FundTray
    def post(self, account, **kwargs):
        apply_helps = ApplyHelpMgr().get_datas_by_uid(account.id)

        if not apply_helps:
            # 将申请帮助请求信息转化成申请帮助信息
            apply_help_req = ApplyHelpReqMgr().get_unfinish(account.id)
            apply_help = apply_help_req_2_apply_help(apply_help_req)
            logger.info("cur_apply_help Success!!, not apply_helps:%s, apply_help_req:%s" % (apply_helps, apply_help_req))
            return {"result": error_code.ERROR_SUCCESS,
                    "apply_help_ls": [],
                    "apply_help": apply_help}

        assert len(apply_helps) == 1
        cur_apply_help = apply_helps[0]
        cur_apply_help_pay_ls = ApplyHelpPayMgr().get_datas_by_apply_order(cur_apply_help['apply_order'])

        apply_help_ls = []
        for apply_help_pay_dic in cur_apply_help_pay_ls:
            # 获取申请帮助信息
            apply_res_dic = sub_dict(cur_apply_help, ['apply_order', 'apply_uid', 'apply_stime',])
            apply_res_dic.update(sub_dict(apply_help_pay_dic, ['apply_sorder', 'apply_pmoney', 'apply_mtime', 'apply_pstat', 'apply_piture', 'apply_message']))

            # 获取接受帮助信息
            accept_info = AcceptHelpMgr().get_data_by_order(apply_help_pay_dic['accept_order'])
            apply_res_dic['accept_uid'] = accept_info['accept_uid']

            # 获取接受帮助账号信息
            account_obj = AccountMgr().get_data_by_id(accept_info['accept_uid'])
            apply_res_dic['bank_name'] = account_obj.bank_name

            apply_help_ls.append(apply_res_dic)

        return {"result": error_code.ERROR_SUCCESS,
                "apply_help": cur_apply_help,
                "apply_help_ls": apply_help_ls}
示例#9
0
 def match_ls(self):
     match_ls = self.__id_2_dic.values()
     match_ls = filter(
         lambda dic: dic['apply_lmoney'] > 0 and not AccountMgr().
         get_data_by_id(dic['apply_uid']).is_seal, match_ls)
     match_ls.sort(key=lambda x: x['apply_stime'])
     return match_ls
示例#10
0
    def do_confirm(self, apply_sorder):
        """
        确定收款处理, 订单完成
        :param apply_sorder: 申请帮助子订单id
        :return:
        """
        from mmm_da.lib.help.control import ApplyHelpMgr
        upd_dic = {"apply_sorder": apply_sorder, "apply_pstat": APYS_PAY_CFRM}
        self.update_dic(apply_sorder, upd_dic)

        # 确认奖励处理
        BonusMgr().on_confirm_pay(apply_sorder)

        apply_help_pay_dic = self.get_data_by_sorder(apply_sorder)

        # 添加马夫罗到钱包余额
        apply_help_dic = ApplyHelpMgr().get_data_by_order(
            apply_help_pay_dic['apply_order'])

        assert apply_help_dic
        account = AccountMgr().get_data_by_id(apply_help_dic['apply_uid'])

        account.attr_mafuluo += BonusMgr().on_extract_pi(apply_sorder)

        # 排单币返还成钱包余额
        account.attr_mafuluo += BonusMgr().match_coin_back(apply_sorder)

        # 订单完成
        self.do_finish(apply_sorder)
示例#11
0
    def get(self, account, view_uid, **kwargs):
        if not view_uid:
            logger.info(
                "view_account get ERROR_UID_NOT_EXIST, not view_account")
            self.set_status(error_code.ERROR_UID_NOT_EXIST, 'Parameter Error')
            return error_code.ERROR_UID_NOT_EXIST

        view_account = AccountMgr().get_data_by_id(str(view_uid))
        if not view_account:
            logger.info(
                "view_account get ERROR_UID_NOT_EXIST, not view_account!!!, view_uid"
                % view_uid)
            self.set_status(error_code.ERROR_UID_NOT_EXIST, 'Parameter Error')
            return error_code.ERROR_UID_NOT_EXIST

        return view_account.get_info_dic()
示例#12
0
    def get(self, account, adding_id, adding_coin, **kwargs):
        if not adding_id or not adding_coin:
            logger.info(
                "add_active_coin ERROR_UID_NOT_EXIST!!! not enough params")
            self.set_status(error_code.ERROR_UID_NOT_EXIST, 'Parameter Error')
            return error_code.ERROR_UID_NOT_EXIST

        adding_account = AccountMgr().get_data_by_id(adding_id)
        if not adding_account:
            logger.info(
                "add_active_coin ERROR_UID_NOT_EXIST, not adding id, adding id:%s"
                % (adding_id))
            self.set_status(error_code.ERROR_UID_NOT_EXIST, 'Parameter Error')
            return error_code.ERROR_UID_NOT_EXIST
        adding_account.attr_active_coin += int(adding_coin)
        return adding_account.get_info_dic()
示例#13
0
 def all_match_ls(self):
     match_ls = self.__oid_2_user_match_dic.values()
     match_ls.append(self.__system_match_dic)
     match_ls = filter(
         lambda dic: dic['accept_lmoney'] > 0 and not AccountMgr().
         get_data_by_id(dic['accept_uid']).is_seal, match_ls)
     match_ls.sort(key=lambda x: x['accept_stime'])
     return match_ls
示例#14
0
    def wrapper(self, *args, **kwargs):
        headers = self.request.headers
        access_token = kwargs[
            'access_token'] if "access_token" in kwargs else headers.get(
                'Authorization', None)
        id = kwargs['id'] if "id" in kwargs else headers.get('id', None)

        if not id or not access_token:
            logger.info(
                "%s: id_token_login ERROR_LOGIC!!! not id:%s or not access_token:%s"
                % (func, id, access_token))
            self.set_status(error_code.ERROR_LOGIC, 'Parameter Error')
            return {"result": error_code.ERROR_LOGIC}

        validate = TokenMgr().check_expire_access_token(access_token, id)
        if not validate:
            logger.info(
                "%s: id_token_login ERROR_LOGIC!!! access_token not valid, id:%s access_token:%s"
                % (func, id, access_token))
            self.set_status(401, "Unauthorized(access token invalid)")
            return {"result": error_code.ERROR_LOGIC}

        from mmm_da.lib.account.control import AccountMgr
        account = AccountMgr().get_data_by_id(str(id))
        if not account:
            logger.info(
                "%s: id_token_login ERROR_LOGIC!!! not account, id:%s" %
                (func, id))
            self.set_status(error_code.ERROR_LOGIC, 'Parameter Error')
            return {"result": error_code.ERROR_LOGIC}

        valid_result = __is_account_valid(account)
        if valid_result != error_code.ERROR_SUCCESS:
            logger.info("%s: is_account_valid %s!!! id:%s" %
                        (func, valid_result, id))
            self.set_status(valid_result, 'Parameter Error')
            return {"result": valid_result}

        kwargs['account'] = account

        # 只要有访问服务器产生账号,就算登陆
        account.attr_login_time = time.time()
        return func(self, *args, **kwargs)
示例#15
0
 def req_ls(self):
     """
     获取请求的数据列表
     :return:
     """
     wait_ls = self.__id_2_dic.values()
     wait_ls = filter(
         lambda dic: not AccountMgr().get_data_by_id(dic['accept_req_uid']).
         is_seal, wait_ls)
     return wait_ls
示例#16
0
 def wait_ls(self):
     """
     获取等待的数据列表
     :return:
     """
     wait_ls = self.__uid_2_wait_dic.values()
     wait_ls = filter(
         lambda dic: not AccountMgr().get_data_by_id(dic['apply_wait_uid']).
         is_seal, wait_ls)
     return wait_ls
示例#17
0
    def get(self, phone, **kwargs):
        if not PHONE_REGEX.match(str(phone)):
            logger.info("check_phone ERROR_PHONE_INVALID phone:%s is invalid" % phone)
            self.set_status(error_code.ERROR_PHONE_INVALID, 'Parameter Error')
            return

        if AccountMgr().is_phone_exist(int(phone)):
            logger.info("check_phone ERROR_PHONE_EXISTED phone:%s has existed" % phone)
            self.set_status(error_code.ERROR_PHONE_EXISTED, 'Parameter Error')
            return
        return
示例#18
0
    def on_apply_finish(self, apply_uid, apply_money):
        """
        申请帮助支付完成奖金奖励
        :param apply_uid:   申请帮助uid
        :param apply_money: 申请帮助金额
        :return:
        """
        from mmm_da.lib.account.control import AccountMgr
        # 获取领导id列表
        leader_id_ls = []
        chd_account = AccountMgr().get_data_by_id(apply_uid)
        led_account = AccountMgr().get_data_by_id(chd_account.attr_leader_id)
        while led_account:
            leader_id_ls.append(led_account.id)
            led_account = AccountMgr().get_data_by_id(led_account.attr_leader_id)
            if not led_account:
                break

        # 奖励额度获取
        bonus_rate_ls = [BONUS_RATE_LV[i] if i < len(BONUS_RATE_LV) else MIN_BONUS_RATE
                         for i in xrange(len(leader_id_ls))]

        # 奖励
        bonus_dic = dict(zip(leader_id_ls, bonus_rate_ls))

        for uid, bonus_rate in bonus_dic.items():
            account = AccountMgr().get_data_by_id(uid)
            bonus_money = apply_money * bonus_rate / 100
            account.attr_mafuluo += bonus_money

            # 增加奖金日志
            BonusLogMgr().add_bonus_log(uid,
                                        apply_uid,
                                        bonus_money,
                                        LAYER_APPLY_PAID_REWARD)

        logger.info("BonusMgr::on_apply_finish reward!!! apply_uid={auid}, apply_money={amoney}, bonus_dic={bdic}"
                    .format(auid=apply_uid, amoney=apply_money, bdic=bonus_dic))
示例#19
0
    def post(self, **kwargs):
        """
        data_dic:account, passwd,
        id_card, email, phone,
        leader_id,
        bank, bank_address, bank_account, bank_name,
        wechat, alipay
        :param kwargs:
        :return:
        """
        if not is_param_equal(kwargs, MUST_KEY_SET):
            logger.info("register ERROR_LOGIC, not is_param_equal, %s" % kwargs)
            self.set_status(error_code.ERROR_LOGIC, 'Parameter Error')
            return {"result": error_code.ERROR_LOGIC}

        if AccountMgr().is_id_exist(kwargs['id']):
            logger.info("register ERROR_LOGIC, id existed, %s" % kwargs['id'])
            self.set_status(error_code.ERROR_LOGIC, 'Parameter Error')
            return {"result": error_code.ERROR_LOGIC}

        valid_kwargs = get_valid_param(kwargs, KEY_SET)
        AccountMgr().create_account(valid_kwargs)
        return {"result": error_code.ERROR_SUCCESS}
示例#20
0
    def get(self, account, req_id, req_money, **kwargs):
        if not AccountMgr().is_id_exist(req_id):
            logger.info(
                "AddApplyHelpHandler ERROR_UID_NOT_EXIST, id not existed, %s" %
                req_id)
            self.set_status(error_code.ERROR_UID_NOT_EXIST, 'Parameter Error')
            return error_code.ERROR_UID_NOT_EXIST

        req_money = int(req_money)
        req_id = str(req_id)
        ApplyHelpReqMgr().add_req(req_id, req_money)
        apply_help_req = ApplyHelpReqMgr().get_unfinish(req_id)
        assert apply_help_req
        ApplyHelpReqMgr().do_match(apply_help_req['id'])
        return error_code.ERROR_SUCCESS
示例#21
0
        def id_passwd_login_params_wrapper(self, id, passwd, *args, **kwargs):
            if not id or not passwd:
                logger.info(
                    "%s: id_passwd_login ERROR_LOGIC!!! not enough params" %
                    func)
                self.set_status(error_code.ERROR_LOGIC, 'Parameter Error')
                return {"result": error_code.ERROR_LOGIC}

            if required_admin:
                if int(id) != int(SYSTEM_ACCOUNT_ID):
                    logger.info(
                        "%s: id_passwd_login ERROR_LOGIC!!! request system account"
                        % func)
                    self.set_status(error_code.ERROR_LOGIC, 'Parameter Error')
                    return {"result": error_code.ERROR_LOGIC}

            account = AccountMgr().get_data_by_id(id)
            if not account or account.passwd != passwd:
                logger.info(
                    "%s:id_passwd_login ERROR_LOGIC, login error, id:%s, passwd:%s"
                    % (func, id, passwd))
                self.set_status(error_code.ERROR_LOGIC, 'Parameter Error')
                return {"result": error_code.ERROR_LOGIC}

            valid_result = __is_account_valid(account)
            if valid_result != error_code.ERROR_SUCCESS:
                logger.info("%s: is_account_valid %s!!! id:%s" %
                            (func, valid_result, id))
                self.set_status(valid_result, 'Parameter Error')
                return {"result": valid_result}

            kwargs['account'] = account

            # 只要有访问服务器产生账号,就算登陆
            account.attr_login_time = time.time()
            return func(self, *args, **kwargs)
示例#22
0
    def on_apply_cancel(self, apply_uid, apply_money):
        """
        申请帮助取消支付奖金惩罚
        :param apply_uid:   申请帮助uid
        :param apply_money: 申请帮助金额
        :return:
        """
        from mmm_da.lib.server_info import ServerInfoMgr
        from mmm_da.lib.account.control import AccountMgr
        apply_account = AccountMgr().get_data_by_id(apply_uid)
        leader_account = AccountMgr().get_data_by_id(apply_account.attr_leader_id)
        assert leader_account

        punish_money = -apply_money * ServerInfoMgr().attr_apply_unpaid_punish / 100
        leader_account.attr_mafuluo += punish_money

        # 增加奖金日志
        BonusLogMgr().add_bonus_log(apply_account.attr_leader_id,
                                    apply_uid,
                                    punish_money,
                                    LAYER_APPLY_UNPAID_PUNISH)

        logger.info("BonusMgr::on_apply_cancel punish!!! leader_id={luid}, apply_uid={auid}, punish_money={pmoney}"
                    .format(luid=apply_account.attr_leader_id, auid=apply_uid, pmoney=punish_money))
示例#23
0
    def do_finish(self, apply_order):
        """
        申请帮助完成
        :param apply_order: 申请帮助订单id
        :return:
        """
        upd_dic = {"apply_order": apply_order, "apply_stat": APYS_FINISH}
        self.update_dic(apply_order, upd_dic)

        # 增加完成订单数
        apply_help = self.get_data_by_order(apply_order)
        account = AccountMgr().get_data_by_id(apply_help['apply_uid'])
        account.attr_finished_apply += 1

        # 内存删除完成订单
        self.__del_data_2_mem(apply_help)
示例#24
0
 def gen_layer_detail(self, layer_id_ls):
     """
     计算每层的详细激活信息
     :param layer_id_ls: 层id列表
     :return: {}
     """
     from mmm_da.lib.account.control import AccountMgr
     actived = 0
     unactived = 0
     for id in layer_id_ls:
         account = AccountMgr().get_data_by_id(id)
         if account.attr_stat == ACTIVED:
             actived += 1
         else:
             unactived +=1
     return {"sum": len(layer_id_ls), "actived": actived, "unactived": unactived}
示例#25
0
    def get(self, account, do_id, **kwargs):
        if not do_id:
            logger.info("account get ERROR_LOGIC, not do_id")
            self.set_status(error_code.ERROR_LOGIC, 'Parameter Error')
            return {"result": error_code.ERROR_LOGIC}

        is_self = str(account.id) == str(do_id)

        view_account = account \
            if is_self \
            else AccountMgr().get_data_by_id(str(do_id))
        if not view_account:
            logger.info("account get ERROR_LOGIC, not view_account!!!, do_id:%s" % do_id)
            self.set_status(error_code.ERROR_LOGIC, 'Parameter Error')
            return {"result": error_code.ERROR_LOGIC}

        return {"result": error_code.ERROR_SUCCESS,
                "account_info": view_account.get_info_dic() if is_self else view_account.view_info_dic() }
示例#26
0
    def do_finish(self, accept_order):
        """
        接受帮助订单完成处理,完成的时候不能删除订单
        :param accept_order:接受帮助订单id
        :return:
        """
        upd_dic = {"accept_order": accept_order, "accept_stat": ACPS_FINISH}
        self.update_dic(accept_order, upd_dic)

        # 订单完成数+1
        accept_help = self.get_data_by_order(accept_order)
        account = AccountMgr().get_data_by_id(accept_help['accept_uid'])
        account.attr_finished_accept += 1

        # 内存删除完成订单
        self.__del_data_2_mem(accept_help)

        # 添加等待申请帮助
        from mmm_da.lib.help_wait.control import ApplyHelpWaitMgr
        ApplyHelpWaitMgr().add_wait(accept_help['accept_uid'], time.time())
示例#27
0
    def post(self, account, tgt_id, tgt_coin, **kwargs):
        tgt_coin = int(tgt_coin)
        tgt_account = AccountMgr().get_data_by_id(tgt_id)
        if not tgt_account:
            logger.info(
                "match_coin_transfer ERROR_LOGIC, tgt_id:%s not exist" %
                tgt_id)
            self.set_status(error_code.ERROR_UID_NOT_EXIST, 'Parameter Error')
            return {"result": error_code.ERROR_UID_NOT_EXIST}

        if account.attr_match_coin < tgt_coin:
            logger.info(
                "match_coin_transfer ERROR_LOGIC, match_coin:%s lack for tgt_coin:%s"
                % (tgt_account.attr_match_coin, tgt_coin))
            self.set_status(error_code.ERROR_LOGIC, 'Parameter Error')
            return {"result": error_code.ERROR_LOGIC}

        # 转账
        account.attr_match_coin -= tgt_coin
        tgt_account.attr_match_coin += tgt_coin
        return {"result": error_code.ERROR_SUCCESS}
示例#28
0
 def get(self, **kwargs):
     return {"result": error_code.ERROR_SUCCESS,
             "leader_id":random.choice(AccountMgr().get_all_ids())}
示例#29
0
 def get(self, id, **kwargs):
     if not AccountMgr().is_id_exist(int(id)):
         logger.info("check_id ERROR_LOGIC, id:%s not exist" % id)
         self.set_status(error_code.ERROR_UID_NOT_EXIST, 'Parameter Error')
         return
     return