Пример #1
0
def credittimes(name, tel, channel):
    # 清除锦程方该客户额度
    JCapi.JCmoveLimitByName(name)
    # 获取客户编号
    customer_id = Mysql.selectwithparams(business,
                                         RequestDataSql.getcustomerid, tel)[0]
    # 清除拒绝原因
    Mysql.updatewithparams(business, RequestDataSql.deleterefusecode, tel)
    # 修改申请状态为拒绝
    Mysql.updatewithparams(business, RequestDataSql.updateapplystate, tel)
    # 修改额度为null
    Mysql.updatewithparams(business, RequestDataSql.updateamount, tel)
    # 修改channelcode已通过风控规则  APP -> 111
    Mysql.updatewithparams(business, RequestDataSql.updatechannelcode, tel)
    login(tel, channel)
    if channel == 'Android':
        r = Appapi.CreditForRisk(RequestDataSql.CreditForRiskdata(customer_id))
        Appapi.apiprint('安卓额度审批接口',
                        RequestDataSql.CreditForRiskdata(customer_id), r)
    elif channel == 'IOS':
        r = Appapi.CreditForIosRisk(
            RequestDataSql.CreditForIosRiskdata(customer_id))
        Appapi.apiprint('IOS额度审批接口',
                        RequestDataSql.CreditForIosRiskdata(customer_id), r)
    else:
        print('暂不支持' + channel + '渠道')
    time.sleep(5)
    GetResult.getcreditresult(tel)
Пример #2
0
def saveuserinfo(name, card, tel, channel):
    # 清除锦程方该客户额度
    JCapi.JCmoveLimitByName(name)
    id = register(tel, channel)
    # 登陆
    login(tel, channel)
    # 申请产品
    r = Appapi.applyProduct(RequestDataSql.applyProductdata(id))
    Appapi.apiprint('申请产品', RequestDataSql.applyProductdata(id), r)
    # 保存身份证、个人信息、联系人信息
    saveauthentication(tel, channel)
    saveauthenticationmock(name, card, tel)
    savePersonInfo(tel, channel)
    saveLinkManInfo(tel, channel)
Пример #3
0
def saveauthentication(tel, channel):
    # 修改锦程系统时间为当前时间
    date = datetime.datetime.now().strftime('%Y%m%d')
    JCapi.JCsetCurrentDate(date)
    time.sleep(1)
    # 获取用户编号
    id = Mysql.selectwithparams(business, RequestDataSql.getid, tel)[0]
    # 登陆
    login(tel, channel)
    # 身份证正面OCR识别 刘童的身份证
    r1 = Appapi.idCardFront(RequestDataSql.idCardFrontdata())
    Appapi.apiprint('身份证正面OCR识别', RequestDataSql.idCardFrontdata(), r1)
    # 获取身份证识别信息
    person_name = r1.json().get('retData').get('result').get('name')
    card = r1.json().get('retData').get('result').get('number')
    customer_id = r1.json().get('retData').get('customer_id')
    card_register_address = r1.json().get('retData').get('result').get(
        'address')
    Zcard_src = r1.json().get('retData').get('Zcard_src')
    # 保存OCR次数
    r = Appapi.sendOCRTime(RequestDataSql.sendOCRTimedata(id, '1'))
    Appapi.apiprint('保存OCR次数', RequestDataSql.sendOCRTimedata(id, '1'), r)
    # 身份证反面OCR识别 刘童的身份证
    r2 = Appapi.idCardBack(RequestDataSql.idCardBackdata())
    Appapi.apiprint('身份证反面OCR识别', RequestDataSql.idCardBackdata(), r2)
    # 获取身份证识别信息
    sign_date = r2.json().get('retData').get('result').get('sign_date')
    expiry_date = r2.json().get('retData').get('result').get('expiry_date')
    card_effective_time = sign_date + '-' + expiry_date
    Fcard_src = r2.json().get('retData').get('Fcard_src')
    # 保存OCR次数
    r = Appapi.sendOCRTime(RequestDataSql.sendOCRTimedata(id, '2'))
    Appapi.apiprint('保存OCR次数', RequestDataSql.sendOCRTimedata(id, '2'), r)
    # 保存身份信息
    r = Appapi.saveIndentityInfo(
        RequestDataSql.saveIndentityInfodata(person_name, card, id,
                                             customer_id, card_effective_time,
                                             card_register_address, Zcard_src,
                                             Fcard_src))
    Appapi.apiprint(
        '保存身份信息',
        RequestDataSql.saveIndentityInfodata(person_name, card, id,
                                             customer_id, card_effective_time,
                                             card_register_address, Zcard_src,
                                             Fcard_src), r)
Пример #4
0
 def test_Cleardata(self):
     JCapi.JCmoveLimitByName(name)
     Mysql.deletecustomer(business, tel)
Пример #5
0
 def test_001(self):
     JCapi.JCmoveLimitByName(name=name)
     Mysql.deletecustomer(business, tel=tel)
Пример #6
0
def changeloaninfo(tel, loanresult):
    applyno = Mysql.selectwithparams(business, RequestDataSql.selectapplno, tel)[0]
    state1 = Mysql.selectwithparams(business, RequestDataSql.getloanstate, tel)[0]
    if applyno != None and state1 == '1':
        print('订单审核中')
    elif applyno != None and state1 == '2':
        print('订单失效')
    elif applyno != None and state1 == '3':
        print('申请提现成功,借据状态为‘放款中’。开始进行放款结果回调...')
        if loanresult =='S':
            # 调锦程葵花宝典为放款成功
            JCapi.JCsetLoanStatusS(applyno)
            # 查看借据状态变成‘还款中’
            time.sleep(60)
            state2 = Mysql.selectwithparams(business, RequestDataSql.getloanstate, tel)[0]
            if state2 !='6':
                time.sleep(70)
                state3 = Mysql.selectwithparams(business, RequestDataSql.getloanstate, tel)[0]
                if state3 !='6':
                    print('放款成功可能没有回调,看下日志吧')
                else:
                    print('放款成功已回调,借据状态为‘还款中’')
                    # 修改mysql库借据申请时间
                    yesterday = datetime.datetime.today() - datetime.timedelta(days=1)
                    newcreatetime = datetime.datetime.strftime(yesterday, '%Y%m%d%H%M%S')
                    params = (newcreatetime, tel)
                    Mysql.updatewithparams(business, RequestDataSql.updateloancreatetime, params)
                    # 调锦程葵花宝典修改系统时间为明天
                    tomorrow = datetime.datetime.today() + datetime.timedelta(days=1)
                    date = datetime.datetime.strftime(tomorrow, '%Y%m%d')
                    JCapi.JCsetCurrentDate(date)
                    # 跑批
                    JCapi.JCrunAll()
                    print('借据可以进行还款操作了')
            else:
                print('放款成功已回调,借据状态为‘还款中’')
                # 修改mysql库借据申请时间
                yesterday = datetime.datetime.today() - datetime.timedelta(days=1)
                newcreatetime = datetime.datetime.strftime(yesterday, '%Y%m%d%H%M%S')
                params = (newcreatetime, tel)
                Mysql.updatewithparams(business, RequestDataSql.updateloancreatetime, params)
                # 调锦程葵花宝典修改系统时间为明天
                tomorrow = datetime.datetime.today() + datetime.timedelta(days=1)
                date = datetime.datetime.strftime(tomorrow, '%Y%m%d')
                JCapi.JCsetCurrentDate(date)
                # 跑批
                JCapi.JCrunAll()
                print('借据可以进行还款操作了')
        elif loanresult == 'F':
            # 调锦程葵花宝典为放款失败
            JCapi.JCsetLoanStatusF(applyno)
            time.sleep(60)
            state4 = Mysql.selectwithparams(business, RequestDataSql.getloanstate, tel)[0]
            if state4 == '5':
                print('放款失败回调成功')
            else:
                time.sleep(65)
                state5 = Mysql.selectwithparams(business, RequestDataSql.getloanstate, tel)[0]
                if state5 == '5':
                    print('放款失败回调成功')
                else:
                    print('放款失败可能没有回调,看下日志吧')
        else:
            print('放款回调结果输入错误')
    elif applyno != None and state1 == '4':
        print('审批拒绝')
    elif applyno != None and state1 == '5':
        print('放款失败')
    elif applyno != None and state1 == '6':
        print('申请提现成功,借据状态为‘还款中’')
    elif applyno != None and state1 == '7':
        print('借据已结清')
    else:
        print('提现异常了')
Пример #7
0
def credit(name, card, tel, channel):
    # 清除锦程方该客户额度
    JCapi.JCmoveLimitByName(name)
    id = register(tel, channel)
    # 登陆
    login(tel, channel)
    # 申请产品
    r = Appapi.applyProduct(RequestDataSql.applyProductdata(id))
    Appapi.apiprint('申请产品', RequestDataSql.applyProductdata(id), r)
    # 保存身份证、个人信息、联系人信息
    saveauthentication(tel, channel)
    saveauthenticationmock(name, card, tel)
    savePersonInfo(tel, channel)
    saveLinkManInfo(tel, channel)
    # 获取客户编号
    customer_id = Mysql.selectwithparams(business,
                                         RequestDataSql.getcustomerid, tel)[0]
    # 登陆
    login(tel, channel)
    if channel == 'Android':
        # 保存设备信息及地理位置信息
        r = Appapi.addDeviceInfo(
            RequestDataSql.androidaddDeviceInfodata(customer_id))
        Appapi.apiprint('保存设备信息及地理位置信息接口',
                        RequestDataSql.androidaddDeviceInfodata(customer_id),
                        r)
        # 保存通话记录接口
        r = Appapi.saveCallRecord(
            RequestDataSql.androidsaveCallRecorddata(customer_id))
        Appapi.apiprint('保存通话记录接口',
                        RequestDataSql.androidsaveCallRecorddata(customer_id),
                        r)
    elif channel == 'IOS':
        r = Appapi.addDeviceInfo(
            RequestDataSql.iosaddDeviceInfodata(customer_id))
        Appapi.apiprint('保存设备信息及地理位置信息接口',
                        RequestDataSql.iosaddDeviceInfodata(customer_id), r)
    else:
        print('暂不支持' + channel + '渠道')
    # 安心签开户
    r = Appapi.getAnXinQianAccount(
        RequestDataSql.getAnXinQianAccountdata(customer_id))
    Appapi.apiprint('安心签开户',
                    RequestDataSql.getAnXinQianAccountdata(customer_id), r)
    # 人脸识别
    print('后台更新数据mock人脸识别' + '\n')
    mockfacesql = 'UPDATE mag_customer SET ALTER_TIME = "20190823172433", oss_face_key ="alp02/53b1754f1b928ecda45112401e2e3b91_20190925143347515.jpg", face_src ="https://ronghuialp.oss-cn-shenzhen.aliyuncs.com/alp02/7dbbbcdec97fa205bc1ded9a57fda42d_20190823172433200.jpg?Expires=1566552333&OSSAccessKeyId=LTAIvE2cfCGXURWc&Signature=ra4iAtrGeddIUF7Lu7pn05sdQd4%3D", person_face_state="1", person_face_complete="100", face_liveness_score = "1.0", face_verify_score= "1", face_verify_result ="1" WHERE ID = "' + customer_id + '"'
    Mysql.updatewithoutparams(business, mockfacesql)
    # # 修改channelcode已通过风控规则  APP -> 111
    # Mysql.updatewithparams(business, RequestDataSql.updatechannelcode, tel)
    if channel == 'Android':
        r = Appapi.CreditForRisk(RequestDataSql.CreditForRiskdata(customer_id))
        Appapi.apiprint('安卓额度审批接口',
                        RequestDataSql.CreditForRiskdata(customer_id), r)
    elif channel == 'IOS':
        r = Appapi.CreditForIosRisk(
            RequestDataSql.CreditForIosRiskdata(customer_id))
        Appapi.apiprint('IOS额度审批接口',
                        RequestDataSql.CreditForIosRiskdata(customer_id), r)
    else:
        print('暂不支持' + channel + '渠道')
    time.sleep(5)
    GetResult.getcreditresult(tel)
Пример #8
0
def advancerepay(tel, applyno, prepayAmt, repayresult):
    # 获取用户编号、客户编号
    id = Mysql.selectwithparams(business, RequestDataSql.getid, tel)[0]
    customer_id = Mysql.selectwithparams(business,
                                         RequestDataSql.getcustomerid, tel)[0]
    jcLtNo = Mysql.selectwithparams(business, RequestDataSql.getjcLtNo, tel)[0]
    state = Mysql.selectwithparams(
        business, 'select state from mag_order where applNo=%s', applyno)[0]
    if state == '6':
        # 登录
        r = Appapi.login(RequestDataSql.androidlogindata(tel))
        Appapi.apiprint('登录', RequestDataSql.androidlogindata(tel), r)
        # # 借据还款接口
        # r = Appapi.repayreceipt(RequestDataSql.repayreceiptdata(jcLtNo))
        # Appapi.apiprint('借据还款接口', RequestDataSql.repayreceiptdata(jcLtNo), r)
        # 判断借据日期是否是当天
        r = Appapi.isCanRepay(RequestDataSql.isCanRepaydata(applyno))
        Appapi.apiprint('判断借据日期是否是当天', RequestDataSql.isCanRepaydata(applyno),
                        r)
        # 还款计划查询接口
        r = Appapi.repaymentPlanList(
            RequestDataSql.repaymentPlanListdata(applyno))
        Appapi.apiprint('还款计划查询接口',
                        RequestDataSql.repaymentPlanListdata(applyno), r)
        # 显示银行卡信息接口
        r = Appapi.getBank(RequestDataSql.getBankdata(customer_id))
        Appapi.apiprint('显示银行卡信息接口', RequestDataSql.getBankdata(customer_id),
                        r)
        # 提前还款金额计算接口
        r = Appapi.partRepayTry(
            RequestDataSql.partRepayTrydata(applyno, prepayAmt))
        Appapi.apiprint('提前还款金额计算接口',
                        RequestDataSql.partRepayTrydata(applyno, prepayAmt), r)
        repaymentAmount = r.json().get('retData').get('repaymentAmount')
        # 线上还款接口
        r = Appapi.directRepay(
            RequestDataSql.directRepaydata(applyno, repaymentAmount))
        Appapi.apiprint(
            '线上还款接口', RequestDataSql.directRepaydata(applyno, repaymentAmount),
            r)
        code = r.json.get('retData').get('code')
        if code == 'E0001':
            if repayresult == 'S':
                JCapi.JCrepaysetSuccess(applyno,
                                        repaymentAmount)  # 还款状态修改为成功等待回调
                time.sleep(60)
                state1 = Mysql.selectwithparams(
                    business,
                    'select state from mag_repayment_record where appl_no=%s order by create_time desc limit 1',
                    applyno)[0]
                if state1 == '1':
                    print('还款状态修改为成功已回调')
                else:
                    print('请查看还款状态修改为成功回调状态')
            elif repayresult == 'F':
                JCapi.JCrepaysetFail(applyno, repaymentAmount)  # 还款状态修改为成功等待回调
                time.sleep(60)
                state1 = Mysql.selectwithparams(
                    business,
                    'select state from mag_repayment_record where appl_no=%s order by create_time desc limit 1',
                    applyno)[0]
                if state1 == '2':
                    print('还款状态修改为失败已回调')
                else:
                    print('请查看还款状态修改为失败回调状态')
        else:
            print('线上还款异常了,看下日志吧')
    else:
        print('借据状态不是还款中,请查看')