Ejemplo n.º 1
0
def handle_configs():
    """
    获取系统信息接口
    :return: json
    """
    res = ResMsg()
    id = request.args.get("id", 1)
    sysid = 1
    sys_configs = db.session.query(EtGlobalConfig).filter(
        EtGlobalConfig.id == sysid).first()
    res_data = dict()
    if sys_configs:
        res_data['data'] = helpers.model_to_dict(sys_configs)
        # logger.error(Redis.hgetall(redis_key_sys))
        if Redis.hgetall(redis_key_sys) == {}:
            del res_data['data']['update_time']
            cache_data = helpers.rmnullkeys(res_data['data'])
            logger.error(res_data['data'])
            ret = Redis.hmset(redis_key_sys, cache_data)
            logger.error(ret)

        res.update(code=ResponseCode.Success, data=res_data, msg='系统信息获取成功')
        return res.data
    else:

        res.update(code=ResponseCode.Success, data={}, msg='系统信息数据异常')
        return res.data
Ejemplo n.º 2
0
        def auto_handle_wd(app_context,
                           wd_id: int,
                           member_id: int,
                           status: int = 2):
            with app_context:
                res = {}

                verify_log = '系统自动发放'

                account_name = 'system'
                now_timestr = time.strftime("%Y-%m-%d %H:%M:%S",
                                            time.localtime())

                verify_orders = db.session.query(EtMemberWithdrawal).filter(
                    EtMemberWithdrawal.id == wd_id,
                    EtMemberWithdrawal.member_id == member_id).first()

                if not verify_orders:
                    res.update(code=ResponseCode.Success, data={}, msg=f'数据异常')
                    return res

                if verify_orders.pay_status == 3:
                    res.update(
                        dict(code=ResponseCode.Success,
                             data={},
                             msg=f'该单已发放无法再次提现'))
                    return res

                # if verify_orders.pay_status==2:
                #     res.update(dict(code=ResponseCode.Success, data={},
                #                 msg=f'正在支付走账'))
                #     return res

                user = db.session.query(
                    EtMember.id, EtMember.nickname, EtMember.status,
                    EtMember.m_class, EtMember.realname, EtMember.mobile,
                    EtMember.IIUV, EtMember.balance, EtMember.balance_version,
                    EtMember.setreal, EtMember.alipayid).filter(
                        EtMember.id == member_id).first()

                if not user:
                    res.update(
                        dict(code=ResponseCode.Success, data={},
                             msg=f'用户信息异常'))
                    return res

                user_info = (dict(zip(user.keys(), user)))

                pay_status = 2

                if user_info['status'] == 2:
                    verify_log = '账号违规,无法发放提现'
                    pay_status = 4
                    verify = 1
                    status = 1

                update_dict = {
                    "verify": status,
                    "verify_log": verify_log,
                    "account": account_name,
                    "check_time": now_timestr,
                    "pay_status": pay_status
                }
                update_dict_ready = helpers.rmnullkeys(update_dict)

                db.session.query(EtMemberWithdrawal).filter(
                    EtMemberWithdrawal.id == wd_id).update(update_dict_ready)

                res_data = dict()
                ret = ''

                try:
                    if user_info['status'] == 2:
                        # back balace to member
                        drp_config = Redis.hgetall(redis_key_drp)
                        handling_fee_s = drp_config[b'handling_fee']
                        handling_fee = float(
                            str(handling_fee_s, encoding="utf-8"))

                        add_balance = 0
                        if handling_fee == 0:
                            add_balance = verify_orders.amounts
                        else:
                            handling_fee = (1 - float(handling_fee) / 100)
                            add_balance = round(
                                verify_orders.amounts / handling_fee, 2)

                        if verify_orders.origin_amount:
                            add_balance = verify_orders.origin_amount

                        user_update_dict = {
                            "balance":
                            user_info['balance'] + add_balance * 100,
                            "balance_version": int(time.time())
                        }
                        db.session.query(EtMember).filter(
                            EtMember.id == mid, EtMember.balance_version ==
                            user_info['balance_version']).update(
                                user_update_dict)

                    db.session.commit()

                    # verify pass go alipay
                    ret = async_alipay_service.delay(
                        serial_number=wd_id,
                        alipay_account=user_info['alipayid'],
                        real_name=user_info['realname'],
                        pay_amount=verify_orders.amounts,
                        mid=member_id)

                    res.update(code=ResponseCode.Success,
                               data=res_data,
                               msg=f'提现审核成功,系统将发放收益到用户收款账户,请留意支付返回消息')
                    return res

                except Exception as why:

                    res.update(code=ResponseCode.Success,
                               data={},
                               msg=f'用户提现订单审核失败,数据异常{why}')
                    return res
Ejemplo n.º 3
0
def handle_orders_lists():
    """
    流水统计报表
    """
    res = ResMsg()
    now_timestr = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

    page_index = int(request.args.get("page", 1))
    page_size = int(request.args.get("limit", 10))
    date = int(request.args.get("date", 1))

    start_time = request.args.get("tstart", '')
    end_time = request.args.get("end", '')

    member_id = request.args.get("member_id", '')
    task_id = request.args.get("task_id", '')
    task_order_id = request.args.get("task_order_id", '')
    nickname = request.args.get("nickname", '')

    mobile = request.args.get("mobile", '')
    IIUV = request.args.get("IIUV", '')
    realname = request.args.get("realname", '')

    cond_by = ''
    if mobile:
        cond_by = f' WHERE m.mobile={mobile} '

    query_dict = {
        "member_id": int(member_id) if member_id else None,
        "task_id": int(task_id) if task_id else None,
        "task_order_id": int(task_order_id) if task_order_id else None,
    }
    filters = helpers.rmnullkeys(query_dict)
    flatten_filters = ' AND '.join("{!s}={!r}".format(key, val)
                                   for (key, val) in filters.items())
    p_i, p_num = (page_index - 1) * page_size, page_size

    where_cond = ''
    if flatten_filters:
        where_cond = f" AND {flatten_filters} "

        if start_time and end_time:
            where_cond += f" AND add_time>'{start_time}' AND add_time<='{end_time}' "
    else:
        if start_time and end_time:
            where_cond = f" AND add_time>'{start_time}' AND add_time<='{end_time}' "

    fetch_columns = "e.id,e.add_time,t.name AS task_name,t.task_reward,t.id as task_id,e.member_id,mr.parent_id as lv1_id,mr1.parent_id as lv2_id,mr2.parent_id as lv3_id"

    earning_sql = f"SELECT {fetch_columns} FROM ( SELECT id, amounts, member_id, task_order_id, task_id, amount_type, add_time FROM et_member_earnings WHERE task_order_id>0 {where_cond} ) AS e LEFT JOIN et_tasks AS t ON e.task_id = t.id \
    LEFT JOIN et_member_relations as mr ON mr.member_id=e.member_id \
    LEFT JOIN et_member_relations as mr1 ON mr.parent_id=mr1.member_id \
    LEFT JOIN et_member_relations as mr2 ON mr1.parent_id=mr2.member_id \
    WHERE  mr.top_parent_id IS NOT NULL LIMIT {p_i},{p_num}"

    count_earning_sql = f"SELECT {fetch_columns} FROM ( SELECT id, amounts, member_id, task_order_id, task_id, amount_type, add_time FROM et_member_earnings WHERE task_order_id>0 ) AS e LEFT JOIN et_tasks AS t ON e.task_id = t.id \
    LEFT JOIN et_member_relations as mr ON mr.member_id=e.member_id \
    LEFT JOIN et_member_relations as mr1 ON mr.parent_id=mr1.member_id \
    LEFT JOIN et_member_relations as mr2 ON mr1.parent_id=mr2.member_id \
    WHERE  mr.top_parent_id IS NOT NULL"

    earnings = db.session.execute(earning_sql).fetchall()

    counts = db.session.execute(count_earning_sql).fetchall()

    drp_config = Redis.hgetall(redis_key_drp)
    per_sets = json.loads(drp_config[b'profit_percentage'].decode('utf8'))

    logger.info(per_sets)

    profit_percentage_arr = []
    for i in range(len(per_sets)):
        profit_percentage_arr.append(per_sets[i]['per'])

    res_data = dict()

    if earnings:
        res_data['list'] = [{k: v
                             for (k, v) in row.items()} for row in earnings]
        res_data['length'] = len(counts)
        res_data['drpconfig'] = profit_percentage_arr

        res.update(code=ResponseCode.Success, data=res_data, msg='流水报表数据获取成功')
        return res.data
    else:

        res.update(code=ResponseCode.Success, data={}, msg='流水报表数据数据为空or异常')
        return res.data
Ejemplo n.º 4
0
def async_calculating_earnings(parentid: int,
                               level: int,
                               earning_dict: dict,
                               task_id: int,
                               profit_percentage_arr: list,
                               type_set: int = 2):
    '''
        异步任务 计算该用户 所有上级 收益更新
        #type_set 收益来源:2:分销佣金 
        '''
    with current_app.app_context():
        res = dict()
        if earning_dict:
            fromuser = earning_dict['member_id']
            origin_money = earning_dict['amounts']
            logger.info(f'ORING收益:{origin_money}')
            logger.info(profit_percentage_arr)

            # get drpconfigs from cache
            drp_config = Redis.hgetall(redis_key_drp)
            per_set = drp_config[b'profit_percentage']
            per_set = str(per_set, encoding="utf-8")

            logger.info(f'分销比例all:{per_set}')
            per_set = json.loads(per_set)
            per_set = per_set[::-1]

            logger.info(f'reversed分销比例all:{per_set}')
            profit_percentage = per_set[level - 1]['per']
            logger.info(f'分销比例cur:{profit_percentage}')

            drp_money = origin_money * float(profit_percentage)
            logger.info(f'分销收益:{drp_money}')

            drp_earning_dict = {
                "member_id": parentid,
                "from_task_id": earning_dict['task_id'],
                "amounts": drp_money,
                "from_member_id": fromuser,
            }
            new_drp_earning = EtMemberDrp(**drp_earning_dict)
            db.session.add(new_drp_earning)
            logger.info(f'edt: {earning_dict}')

            user = db.session.query(EtMember).filter(
                EtMember.id == parentid).first()

            if user.status == 2:
                res.update(
                    dict(code=ResponseCode.Success,
                         data={},
                         msg=f'该用户已禁用,无法获得收益'))
                return res
            try:
                update_dict = {
                    "balance": drp_money * 100 + user.balance,
                    "balance_version": int(time.time())
                }

                db.session.query(EtMember).filter(
                    EtMember.id == parentid, EtMember.balance_version ==
                    user.balance_version).update(update_dict)

                db.session.commit()

                # update user cache
                Redis.delete(user_center_key + str(user.id))
                Redis.delete(user_info_key + str(user.mobile))
                Redis.delete(user_task_earnings_key + str(user.id))
                Redis.delete(user_appretice_detail_key + str(user.id))
                Redis.delete(user_apprentice_key + str(user.id))

                res.update(
                    dict(code=ResponseCode.Success,
                         data={},
                         msg=f'用户{fromuser}to{parentid}分销收益发放成功'))
                logger.info(res)
                return res
            except Exception as why:

                res.update(
                    dict(code=ResponseCode.Success,
                         data={},
                         msg=f'用户{fromuser}to{parentid}分销收益发放失败{why}'))
                logger.info(res)
                return res
Ejemplo n.º 5
0
def async_alipay_service(serial_number: int, alipay_account: str,
                         real_name: str, pay_amount: int, mid: int):
    """
    @req: req_data
    req_data = {'alipay_account': alipay, 'alipay_name': real_name,
                        'amount': amount, 'serial_number': serial_number}
    @resp: result_status, error_code

    :return:
    """
    with current_app.app_context():
        res = {}
        now_timestr = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

        headers = {'content-type': 'application/json;charset=UTF-8'}
        req_data = {
            'alipay_account': alipay_account,
            'alipay_name': real_name,
            'amount': pay_amount,
            'serial_number': serial_number
        }

        req_data['secret_key'] = 'FA77E2804734C22F72B22D9B7EDB41A9'
        wd_record = db.session.query(EtMemberWithdrawal).filter(
            EtMemberWithdrawal.id == serial_number).first()

        if wd_record:
            if wd_record.pay_status == 3:
                res.update(
                    dict(code=ResponseCode.Success,
                         data={},
                         msg=f'该单已发放无法再次提现'))
                return res

        user = db.session.query(EtMember).filter(EtMember.id == mid).first()

        verify_orders = db.session.query(EtMemberWithdrawal).filter(
            EtMemberWithdrawal.id == serial_number,
            EtMemberWithdrawal.member_id == mid).first()

        if user.status == 2:

            drp_config = Redis.hgetall(redis_key_drp)
            handling_fee_s = drp_config[b'handling_fee']
            handling_fee = float(str(handling_fee_s, encoding="utf-8"))

            add_balance = 0
            if handling_fee == 0:
                add_balance = verify_orders.amounts
            else:
                handling_fee = (1 - float(handling_fee) / 100)
                add_balance = round(verify_orders.amounts / handling_fee, 2)

            if verify_orders.origin_amount:
                add_balance = verify_orders.origin_amount

            update_dict = {
                "balance": user.balance + add_balance * 100,
                "balance_version": int(time.time())
            }

            db.session.query(EtMember).filter(
                EtMember.id == mid, EtMember.balance_version ==
                user.balance_version).update(user_update_dict)
            update_dict = {
                "id": serial_number,
                "verify": 1,
                "pay_status": 4,
                "end_time": now_timestr,
                "verify_log": '账号已封禁,无法提现',
                "pay_log": '账号已封禁,无法提现',
            }
            update_dict_ready = helpers.rmnullkeys(update_dict)

            db.session.query(EtMemberWithdrawal).filter(
                EtMemberWithdrawal.id == serial_number).update(
                    update_dict_ready)
            try:
                db.session.commit()
                Redis.delete(user_center_key + str(user.id))
                Redis.delete(user_info_key + str(user.mobile))
                Redis.delete(user_withdraw_recode_key + str(user.id))

            except Exception as why:
                msg = f'支付失败,请稍后再试{why}'
                logging.info(str(why))
                return msg

            if user.status == 2:
                res.update(
                    dict(code=ResponseCode.Success,
                         data={},
                         msg=f'该用户已禁用,无法提现'))
                return res

            res.update(
                dict(code=ResponseCode.Success, data={}, msg=f'该用户余额已不足,无法提现'))
            return res

        try:

            resp = requests.post(
                'http://47.91.142.164/api/alipay/transfer',
                data=req_data,
            )

            resp_json = resp.json()

            if resp_json.get('code') == 0:
                resp_data = resp_json.get('data', {})
                result_status, error_code = resp_data.get(
                    'status'), resp_data.get('error_code')
            else:
                result_status, error_code = False, resp_json.get('msg', u'')

        except Exception as e:
            result_status, error_code = False, '网络错误' + str(e)
            logger.info(str(e))
            logger.info(result_status)

        if result_status:
            # update_db pay_status

            pay_status = 3
            update_dict = {
                "id": serial_number,
                "pay_status": pay_status,
                "end_time": now_timestr,
                "verify_log": '提现成功,已到账',
                "pay_log": '提现成功,已到账',
            }
            update_dict_ready = helpers.rmnullkeys(update_dict)

            db.session.query(EtMemberWithdrawal).filter(
                EtMemberWithdrawal.id == serial_number).update(
                    update_dict_ready)

            try:
                db.session.commit()
                # update user cache
                Redis.delete(user_center_key + str(user.id))
                Redis.delete(user_info_key + str(user.mobile))
                Redis.delete(user_withdraw_recode_key + str(user.id))
                # send balance 100 to a parent which is never get the balance from this member
                new_member_reward(from_user=user.id)
            except Exception as why:
                msg = f'修改失败,请稍后再试{why}'
                return msg

            # title = '提现成功'
            # content = '恭喜您提现审核通过成功提现 {0}元'.format('%.2f' % (pay_amount))
            # logger.info(result_status)

        else:
            remark = ''
            if error_code in [
                    '支付宝提现系统升级中!', 'INVALID_PARAMETER',
                    'PAYCARD_UNABLE_PAYMENT', 'PAYER_DATA_INCOMPLETE',
                    'PERMIT_CHECK_PERM_LIMITED', 'PAYER_STATUS_ERROR',
                    'PAYER_STATUS_ERROR', 'PAYER_DATA_INCOMPLETE',
                    'PAYMENT_INFO_INCONSISTENCY', 'CERT_MISS_TRANS_LIMIT',
                    'CERT_MISS_ACC_LIMIT', 'PAYEE_ACC_OCUPIED',
                    'MEMO_REQUIRED_IN_TRANSFER_ERROR',
                    'PERMIT_PAYER_LOWEST_FORBIDDEN', 'PERMIT_PAYER_FORBIDDEN',
                    'PERMIT_CHECK_PERM_IDENTITY_THEFT',
                    'REMARK_HAS_SENSITIVE_WORD', 'ACCOUNT_NOT_EXIST',
                    'PAYER_CERT_EXPIRED', 'SYNC_SECURITY_CHECK_FAILED',
                    'TRANSFER_ERROR'
            ]:
                remark = '支付宝提现系统升级中!请销后尝试'
            elif error_code in [
                    'PERM_AML_NOT_REALNAME_REV', 'PERM_AML_NOT_REALNAME_REV',
                    'PERMIT_NON_BANK_LIMIT_PAYEE'
            ]:
                remark = '请登录支付宝站内或手机客户端完善身份信息后,重试!'
            elif error_code in [
                    'PAYEE_NOT_EXIST', 'PERMIT_NON_BANK_LIMIT_PAYEE'
            ]:
                remark = '支付宝账号不存在!请检查之后重试'
            elif error_code == 'PAYEE_USER_INFO_ERROR':
                remark = '支付宝账号和姓名不匹配,请更换成实名信息支付宝账号!'
            elif error_code in [
                    '服务暂时不可用!', 'SYSTEM_ERROR', 'PAYER_BALANCE_NOT_ENOUGH'
            ]:
                remark = '服务暂时不可用'
            elif error_code == 'BLOCK_USER_FORBBIDEN_RECIEVE':
                remark = '账户异常被冻结,无法收款,请咨询支付宝客服95188'
            else:
                remark = '支付失败,请稍后再试' + str(error_code)

            now_timestr = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

            pay_status = 4

            update_dict = {
                "id": serial_number,
                "verify": 1,
                "pay_status": pay_status,
                "verify_log": str(remark),
                "pay_log": str(remark) + ':' + str(error_code),
                # "end_time": now_timestr
            }
            update_dict_ready = helpers.rmnullkeys(update_dict)

            db.session.query(EtMemberWithdrawal).filter(
                EtMemberWithdrawal.id == serial_number).update(
                    update_dict_ready)

            drp_config = Redis.hgetall(redis_key_drp)
            handling_fee_s = drp_config[b'handling_fee']
            handling_fee = float(str(handling_fee_s, encoding="utf-8"))
            logging.info('+提现失败金额:')
            logging.info(str(verify_orders.amounts))
            add_balance = 0
            if handling_fee == 0:
                add_balance = verify_orders.amounts
            else:
                handling_fee = (1 - float(handling_fee) / 100)
                add_balance = round(verify_orders.amounts / handling_fee, 2)

            if verify_orders.origin_amount:
                add_balance = verify_orders.origin_amount

            user_update_dict = {
                "balance": user.balance + add_balance * 100,
                "balance_version": int(time.time())
            }

            db.session.query(EtMember).filter(
                EtMember.id == mid, EtMember.balance_version ==
                user.balance_version).update(user_update_dict)

            try:
                db.session.commit()
                Redis.delete(user_center_key + str(user.id))
                Redis.delete(user_info_key + str(user.mobile))
                Redis.delete(user_withdraw_recode_key + str(user.id))

            except Exception as why:
                msg = f'支付失败,请稍后再试{why}'
                logging.info(str(why))
                return msg

            logging.info(error_code + remark)
            return error_code + remark
Ejemplo n.º 6
0
def calculating_earnings(task_order:dict, task_id:int, type_set:int =1):
    '''
    计算该用户收益 同时异步完成该用户 所有上级 收益更新
    #type_set 收益来源:1:任务收益 2:分销佣金3:新手红包奖励
    '''
    res = ResMsg()
    if isinstance(task_order, dict):
        task = db.session.query(EtTask).filter(EtTask.id == task_id).first()
        logger.info('发放父亲节点收益')
        if task:
            task_dict= dict(helpers.model_to_dict(task))
            logger.info(task_dict)

            if task_dict['task_class']==3:
                type_set = 3
            

            task_earning_money= float(task_dict['task_reward'])
            
            earning_dict ={
                "member_id": task_order['member_id'],
                "task_id": task_id,
                "amounts": task_earning_money,
                "task_order_id": task_order['id'],
                "amount_type": type_set
            }
            logger.info(earning_dict)
            new_earning = EtMemberEarning(**earning_dict)

            isearn_sended= user = db.session.query(EtMemberEarning).filter(
                EtMemberEarning.task_order_id == task_order['id']).first()

            if isearn_sended:
                logger.info("该用户订单收益已发放")
                return "该用户订单收益已发放'"

            db.session.add(new_earning)

            user = db.session.query(EtMember).filter(
                EtMember.id == task_order['member_id']).first()

            if user.status==2:
                res.update(dict(code=ResponseCode.Success, data={},
                                msg=f'该用户已禁用,无法获得收益'))
                return res
                
            if user:
                try:
                    update_dict = {
                        "balance": task_earning_money*100 + user.balance,
                        "balance_version": int(time.time())
                    }

                    db.session.query(EtMember).filter(
                        EtMember.id == task_order['member_id'], EtMember.balance_version == user.balance_version).update(update_dict)
                    db.session.commit()

                    # update user cache
                    Redis.delete(user_center_key + str(user.id))
                    Redis.delete(user_info_key + str(user.mobile))
                    Redis.delete(user_task_earnings_key + str(user.id))

                    #缓存获取分销比例参数
                    drp_config = Redis.hgetall(redis_key_drp)
                    per_sets = json.loads(drp_config[b'profit_percentage'].decode('utf8'))
                    
                    logger.info(per_sets)
                    
                    # get各级分销比例
                    profit_percentage_arr=[]
                    for i in range(len(per_sets)):
                        profit_percentage_arr.append (per_sets[i]['per'])
                    
                    logger.info("比例设置:")
                    # logger.info(profit_percentage_arr) 
                    
                    # get当前用户关系树
                    rel_from_relations = db.session.execute(f"SELECT * FROM et_member_relations WHERE member_id={task_order['member_id']}").first()
                    root_id= None

                    if rel_from_relations['parent_id']:
                        root_id= rel_from_relations['parent_id']

                    if rel_from_relations['top_parent_id']:
                        root_id= rel_from_relations['top_parent_id']

                    realtion_tree_key_m = realtion_tree_key + str(root_id)
                    logger.info("tree:")
                    
                    tree_node = Redis.hget(realtion_tree_key_m, 0)
                    logger.info(str(tree_node))
                    realtion_tree_fromuser = json.loads(tree_node)

                    logger.info(str(realtion_tree_fromuser))
                    importer = DictImporter()
                    
                    parents=[]
                    realtion_tree = importer.import_(realtion_tree_fromuser)
                    cur_node_tuple  = realtionlib.findall_by_attr(realtion_tree, task_order['member_id'])
                    cur_node = cur_node_tuple[0]
                    logger.info('ancestors:')
                    logger.info(str(cur_node.ancestors)) 
                    
                    if cur_node.ancestors:
                        # async-task: for all parents : drp_earnings
                        for i,k in enumerate(cur_node.ancestors):
                            parents.append(k.name)
                            parentid= k.name
                            drp_level = i+1
                            logger.info('k-name:'+str(k.name))
                            logger.info('drp_level:'+str(drp_level))
                            if drp_level<4:
                                result = async_calculating_earnings.delay(parentid, drp_level, earning_dict, task_id, task_order['id'], type_set=2 )
                    
                        logger.info(parents) 

                    res.update(code=ResponseCode.Success, data={},msg=f'用户交单任务收益更新成功')
                    logger.info(res.data)
                except Exception as why:

                    res.update(code=ResponseCode.Success, data={},msg=f'用户交单任务收益数据添加失败{why}')
                    logger.info(res.data)
            else:
                res.update(code=ResponseCode.Success, data={},msg=f'用户信息异常{user}')
Ejemplo n.º 7
0
def handle_withdrawals_verify():
    """
    用户提现审核接口
    @logic 审核完成 异步发送任务至redis队列执行支付宝付款任务
    :return: json
    """
    res = ResMsg()
    req = request.get_json(force=True)

    wd_id = int(req.get("id", 1))
    member_id = int(req.get("member_id", 1))
    status = int(req.get("status", 1))
    verify_log = str(req.get("verify_log", '数据真实有效,情节感人,通过'))

    account_name = session.get("user_name")
    now_timestr = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

    verify_orders = db.session.query(EtMemberWithdrawal).filter(
        EtMemberWithdrawal.id == wd_id,
        EtMemberWithdrawal.member_id == member_id).first()

    if not account_name or not verify_orders:
        res.update(code=ResponseCode.Success,
                   data={},
                   msg=f'账户{account_name}数据异常')
        return res.data

    if not status:
        res.update(code=ResponseCode.Success, data={}, msg='未提交审核数据,操作已经撤销')
        return res.data
    pay_status = 1
    if status == 2:
        pay_status = 2

    update_dict = {
        "verify": status,
        "verify_log": verify_log,
        "account": account_name,
        "check_time": now_timestr,
        "pay_status": pay_status
    }
    update_dict_ready = helpers.rmnullkeys(update_dict)

    db.session.query(EtMemberWithdrawal).filter(
        EtMemberWithdrawal.id == wd_id).update(update_dict_ready)
    res_data = dict()
    ret = ''
    try:
        user = db.session.query(
            EtMember.id, EtMember.nickname, EtMember.status, EtMember.m_class,
            EtMember.realname, EtMember.mobile, EtMember.IIUV,
            EtMember.balance, EtMember.balance_version, EtMember.setreal,
            EtMember.alipayid).filter(EtMember.id == member_id).first()

        user_info = (dict(zip(user.keys(), user)))
        drp_config = Redis.hgetall(redis_key_drp)
        handling_fee_s = drp_config[b'handling_fee']
        handling_fee = float(str(handling_fee_s, encoding="utf-8"))
        logger.info("handling_fee:")
        logger.info(handling_fee)

        # verify reject
        if status == 1:

            if handling_fee == 0:
                add_balance = verify_orders.amounts
            else:
                handling_fee = (1 - float(handling_fee) / 100)
                add_balance = round(verify_orders.amounts / handling_fee, 2)

            if verify_orders.origin_amount:
                add_balance = verify_orders.origin_amount

            logger.info("add_balance:")
            logger.info(add_balance)

            update_dict = {
                "balance": user_info['balance'] + add_balance * 100,
                "balance_version": int(time.time())
            }
            logger.info(update_dict)

            db.session.query(EtMember).filter(
                EtMember.id == member_id, EtMember.balance_version ==
                user_info['balance_version']).update(update_dict)
            try:
                db.session.commit()

                Redis.delete(user_center_key + str(user_info['id']))
                Redis.delete(user_info_key + str(user_info['mobile']))

                res.update(code=ResponseCode.Success, data={}, msg='该单未通过审核')
                return res.data

            except Exception as why:

                res.update(code=ResponseCode.Success,
                           data={},
                           msg=f'审核拒绝操作数据异常{why}')
                return res.data

        db.session.commit()
        # verify pass go alipay
        if status == 2:
            if user:
                ret = async_alipay_service.delay(
                    serial_number=wd_id,
                    alipay_account=user_info['alipayid'],
                    real_name=user_info['realname'],
                    pay_amount=verify_orders.amounts,
                    mid=member_id)

        logger.info(ret)
        res.update(code=ResponseCode.Success,
                   data=res_data,
                   msg=f'提现审核成功,系统将发放收益到用户收款账户,请留意支付返回消息')
        return res.data

    except Exception as why:

        res.update(code=ResponseCode.Success,
                   data={},
                   msg=f'用户提现订单审核失败,数据异常{why}')
        return res.data