Пример #1
0
 def test_GRXX(self):
     if process == 'Credit':
         # ChangeEngine.changeCreditEngine(channel=channel, engine1=engine, engine2='344', engine3='345')   # 修改授信引擎
         alreadyapply = Mysql.selectwithparams(
             business,
             'select count(*) from mag_customer_apply where tel=%s', tel)[0]
         if alreadyapply == '0':
             Credit.credit(name=name, card=card, tel=tel,
                           channel=channel)  # 额度申请
         else:
             Credit.credittimes(name=name, tel=tel,
                                channel=channel)  # 二次额度申请
         Mongo.get_GRXX(phone=tel, engine=int(engine), GRXXlist=GRXXlist)
     elif process == 'Loan':
         # ChangeEngine.changeLoanEngine(channel=channel, engine=engine)   # 修改提现引擎
         alreadybandbankcard = Mysql.selectwithparams(
             business,
             'select count(*) from mag_bank_info where customer_id=(select id from mag_customer where tel=%s)',
             tel)[0]
         if alreadybandbankcard == '0':
             Loan.bankcard(tel=tel, channel=channel)
         Loan.loan(tel=tel, periods=periods, amount=amount,
                   channel=channel)  # 提现申请
         Mongo.get_GRXX(phone=tel, engine=int(engine), GRXXlist=GRXXlist)
         Loan.changeloaninfo(tel=tel, loanresult='F')
Пример #2
0
def bankcard(tel, channel):
    # 获取用户编号、客户编号
    id = Mysql.selectwithparams(business, RequestDataSql.getid, tel)[0]
    customer_id = Mysql.selectwithparams(business, RequestDataSql.getcustomerid, tel)[0]
    # 登陆
    login(tel, channel)
    # 银行卡OCR识别接口
    r = Appapi.bankCard(RequestDataSql.bankCarddata())
    Appapi.apiprint('银行卡OCR识别接口', RequestDataSql.bankCarddata(), r)
    bank_card_number = r.json().get('retData').get('bank_card_number')
    # 保存OCR次数
    r = Appapi.sendOCRTime(RequestDataSql.sendOCRTimedata(id, '4'))
    Appapi.apiprint('保存OCR次数', RequestDataSql.sendOCRTimedata(id, '4'), r)
    # 绑卡发送验证码接口
    r = Appapi.bindCardSendSmsCode(RequestDataSql.bindCardSendSmsCodedata(tel, customer_id, bank_card_number))
    Appapi.apiprint('绑卡发送验证码接口', RequestDataSql.bindCardSendSmsCodedata(tel, customer_id, bank_card_number), r)
    request_no = r.json().get('retData')
    # 绑卡校验验证码接口
    r = Appapi.bindCardCheckSmsCode(RequestDataSql.bindCardCheckSmsCodedata(tel, customer_id, request_no, bank_card_number))
    Appapi.apiprint('绑卡校验验证码接口', RequestDataSql.bindCardCheckSmsCodedata(tel, customer_id, request_no, bank_card_number), r)
    # 修改银行卡自动还款接口
    bankcard_id = Mysql.selectwithparams(business, RequestDataSql.getbankid, tel)[0]
    r = Appapi.updateBank(RequestDataSql.updateBankdata(bankcard_id))
    Appapi.apiprint('修改银行卡自动还款接口', RequestDataSql.updateBankdata(bankcard_id), r)
    # 设置支付密码接口 交易密码=111111
    r = Appapi.updatePassWord(RequestDataSql.updatePassWorddata(customer_id))
    Appapi.apiprint('设置支付密码接口', RequestDataSql.updatePassWorddata(customer_id), r)
Пример #3
0
def register(tel, channel):
    # 清用户信息
    Mysql.deletecustomer(business, tel)
    # 注册获取验证码
    r1 = Appapi.reggetSmsCode(RequestDataSql.reggetSmsCodedata(tel))
    Appapi.apiprint('注册获取验证码', RequestDataSql.reggetSmsCodedata(tel), r1)
    time.sleep(2)
    smsCode = Mysql.selectwithparams(business, RequestDataSql.getsmscode,
                                     tel)[0]
    print('注册')
    if channel == 'Android':
        r2 = Appapi.doRegister(
            RequestDataSql.androiddoregisterdata(tel, smsCode))
    elif channel == 'IOS':
        r2 = Appapi.doRegister(RequestDataSql.iosdoregisterdata(tel, smsCode))
    elif channel == 'H5':
        r2 = Appapi.doRegister(RequestDataSql.H5doregisterdata(tel, smsCode))
    else:
        print('暂不支持' + channel + '渠道')
    print(r2.text)
    retCode = json.loads(r2.text)['retCode']
    retMsg = json.loads(r2.text)['retMsg']
    if retCode == 'FAIL':
        print('注册失败,提示信息: ' + retMsg + '\n')
    elif retCode == 'SUCCESS':
        print('注册成功' + '\n')
    time.sleep(2)
    id = Mysql.selectwithparams(business, RequestDataSql.getid, tel)[0]
    return id
Пример #4
0
def loan(tel, periods, amount, channel):
    # 获取用户编号、客户编号
    id = Mysql.selectwithparams(business, RequestDataSql.getid, tel)[0]
    customer_id = Mysql.selectwithparams(business, RequestDataSql.getcustomerid, tel)[0]
    # 登陆
    login(tel, channel)
    # 交易密码校验接口
    r = Appapi.checkPayPassword(RequestDataSql.checkPayPassworddata(customer_id))
    Appapi.apiprint('交易密码校验接口', RequestDataSql.checkPayPassworddata(customer_id), r)
    # 申请进件接口
    r = Appapi.createOrder(RequestDataSql.createOrderdata(customer_id, periods, amount))
    Appapi.apiprint('申请进件接口', RequestDataSql.createOrderdata(customer_id, periods, amount), r)
    # 查询放款审批结果
    time.sleep(5)
    GetResult.getloanresult(tel)
Пример #5
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)
Пример #6
0
def savePersonInfo(tel, channel):
    # 获取客户编号
    customer_id = Mysql.selectwithparams(business,
                                         RequestDataSql.getcustomerid, tel)[0]
    # 登陆
    login(tel, channel)
    r = Appapi.addPersonInfo(RequestDataSql.addPersonInfodata(customer_id))
    Appapi.apiprint('个人信息保存接口', RequestDataSql.addPersonInfodata(customer_id),
                    r)
Пример #7
0
def saveLinkManInfo(tel, channel):
    # 获取客户编号
    customer_id = Mysql.selectwithparams(business,
                                         RequestDataSql.getcustomerid, tel)[0]
    # 登陆
    login(tel, channel)
    # 联系人信息保存接口
    r = Appapi.upLinkMan(RequestDataSql.upLinkMandata(customer_id))
    Appapi.apiprint('联系人信息保存接口', RequestDataSql.upLinkMandata(customer_id), r)
Пример #8
0
 def test_DataDource(self):
     if process == 'Credit':
         ChangeEngine.changeCreditEngine(channel=channel,
                                         engine1=engine,
                                         engine2='344',
                                         engine3='345')  # 修改授信引擎
         alreadyapply = Mysql.selectwithparams(
             business,
             'select count(*) from mag_customer_apply where tel=%s', tel)[0]
         print(alreadyapply)
         if alreadyapply == 0:
             Credit.credit(name=name, card=card, tel=tel,
                           channel=channel)  # 额度申请
         else:
             Credit.credittimes(name=name, tel=tel,
                                channel=channel)  # 二次额度申请
         # time.sleep(10)
         # print('引擎报告'.center(60, '*'))
         # GetResult.getruleresult(process='Credit', tel=tel, engine=engine)  # 获取引擎报告
         # print('mongo库integrationMessage表存储的三方数据'.center(50, '*'))
         # Mongo.get_thirdpartydata(apiName=apiName, phone=tel)  # 获取mongo库integrationMessage表存储的三方数据
         # Mongo.update_thirdpartydata(apiName=apiName, phone=tel)  # 将mongo库三方数据有效期改为0
     elif process == 'Loan':
         ChangeEngine.changeLoanEngine(channel=channel,
                                       engine=engine)  # 修改提现引擎
         alreadybandbankcard = Mysql.selectwithparams(
             business,
             'select count(*) from mag_bank_info where customer_id=(select id from mag_customer where tel=%s)',
             tel)[0]
         if alreadybandbankcard == 0:
             Loan.bankcard(tel=tel, channel=channel)
         Loan.loan(tel=tel, periods=periods, amount=amount,
                   channel=channel)  # 提现申请
         time.sleep(10)
         print('引擎报告'.center(60, '*'))
         GetResult.getruleresult(process='Loan', tel=tel,
                                 engine=engine)  # 获取引擎报告
         print('mongo库integrationMessage表存储的三方数据'.center(50, '*'))
         Mongo.get_thirdpartydata(
             apiName=apiName,
             phone=tel)  # 获取mongo库integrationMessage表存储的三方数据
         Mongo.update_thirdpartydata(apiName=apiName,
                                     phone=tel)  # 将mongo库三方数据有效期改为0
         Loan.changeloaninfo(tel=tel, loanresult='S')
Пример #9
0
def getloanresult(tel):
    print('获取提现审批结果'.center(30, '*'))
    state = Mysql.selectwithparams(business, RequestDataSql.selectorderstate,
                                   tel)[0]
    print('提现审批状态: ' + state +
          ' (1订单审核中,2失效订单,3放款中(审批通过),4审批拒绝,5放款失败,6还款中(放款成功),7已结清订单)')
    if state == '1':
        print('提现审批结果: 订单审核中')
    elif state == '3':
        applNo = Mysql.selectwithparams(business, RequestDataSql.selectapplno,
                                        tel)[0]
        print('提现审批结果: 放款中(审批通过)' + '  applNo: ' + applNo)
    elif state == '4':
        decision_reject_reason = Mysql.selectwithparams(
            business, RequestDataSql.selectloanrefusecode, tel)[0]
        print('提现审批结果: 审批拒绝' + '  拒绝原因: ', decision_reject_reason)
    elif state == '5':
        print('提现审批结果: 放款失败')
    else:
        print('可能提现申请异常了,手动查看吧!')
Пример #10
0
def getcreditresult(tel):
    print('获取额度申请结果'.center(30, '*'))
    refuse_code = Mysql.selectwithparams(business,
                                         RequestDataSql.getapplystate, tel)[0]
    print('apply_state: ' + refuse_code + ' (1:通过,0:拒绝,2:人工审核,3:系统审核中)')
    if refuse_code == '1':
        credit_amount = Mysql.selectwithparams(business,
                                               RequestDataSql.getamount,
                                               tel)[0]
        print('额度申请结果: 通过' + '  获得额度: ' + credit_amount)
    elif refuse_code == '0':
        rule_refuse_node = Mysql.selectwithparams(business,
                                                  RequestDataSql.getrefusecode,
                                                  tel)[0]
        print('额度申请结果: 拒绝' + '  拒绝原因: ' + rule_refuse_node)
    elif refuse_code == '2':
        print('额度申请结果: 进入人工审核')
    elif refuse_code == '3':
        print('额度申请结果: 系统审核中')
    else:
        print('请手动查看额度申请结果!')
Пример #11
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)
Пример #12
0
 def get_GRXX(self, phone, engine, GRXXlist):
     sql = 'select apply_no from mag_customer_apply where tel=%s'
     apply_no = Mysql.selectwithparams(business, sql, phone)[0]
     collection = MongoDB().conn('creditRequest')
     # sort() 方法第一个参数为要排序的字段,第二个字段指定排序规则,1 为升序,-1 为降序,默认为升序
     result = collection.find({
         "creditRequestParam.data.applyNo": apply_no,
         "engineId": engine
     }).sort("createDate", -1)[0]
     if result != None:
         creditRequestParam = result.get('creditRequestParam')
         data = creditRequestParam.get('data')
         # print(result)
         print('业务系统加工入引擎业务字段:'.center(30, '*'))
         print(creditRequestParam, '\n')
         for GRXX in GRXXlist:
             if GRXX not in data.keys():
                 print(GRXX + ' 字段没有进行加工')
             else:
                 GRXXvalue = data.get(GRXX)
                 print(GRXX + ' 字段值:', GRXXvalue)
     else:
         print('mongo库无查询结果')
Пример #13
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('提现异常了')
Пример #14
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)
Пример #15
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('借据状态不是还款中,请查看')
Пример #16
0
def getruleresult(process, tel, engine):
    params = (tel, engine)
    if process == 'Credit':
        sql = 'select risk_state from mag_risk_info where customer_id=(select id from mag_customer where tel=%s) and risk_num=%s order by create_time desc limit 1'
        risk_state = Mysql.selectwithparams(business, sql, params)[0]
        if risk_state == '0' or risk_state == '4':
            print('风控异常了,看下日志吧')
        else:
            sql1 = 'select pid from mag_risk_info where customer_id=(select id from mag_customer where tel=%s) and risk_num=%s order by create_time desc limit 1'
            pid = Mysql.selectwithparams(business, sql1, params)[0]
            sql2 = 'select result, id, input from zw_resultset where batch_no=%s'
            result, id, input = Mysql.selectwithparams(
                rule, sql2, pid)[0], Mysql.selectwithparams(
                    rule, sql2,
                    pid)[1], Mysql.selectwithparams(rule, sql2, pid)[2]
            if result == '通过':
                print(engine + '引擎结果为: ' + result)
                print(engine + '引擎规则列表为: ' + input)
            elif result == '拒绝':
                print(engine + '引擎结果为: ' + result)
                print(engine + '规则列表为: ' + input)
                sql3 = 'select name, remark from zw_resultset_list where resultset_id=%s'
                name, remark = Mysql.selectwithparams(
                    rule, sql3, id)[0], Mysql.selectwithparams(rule, sql3,
                                                               id)[1]
                print('用户申请被 (' + name + ' ' + remark + ') 拒绝')
    elif process == 'Loan':
        sql4 = 'select pid from mag_risk_info where customer_id=(select id from mag_customer where tel=%s) and risk_num=%s order by create_time desc limit 1'
        pid = Mysql.selectwithparams(business, sql4, params)[0]
        sql5 = 'select result, id, input from zw_resultset where batch_no=%s'
        result, id, input = Mysql.selectwithparams(
            rule, sql5, pid)[0], Mysql.selectwithparams(
                rule, sql5, pid)[1], Mysql.selectwithparams(rule, sql5, pid)[2]
        if result == '通过':
            print(engine + '引擎结果为: ' + result)
            print(engine + '引擎规则列表为: ' + input)
        elif result == '拒绝':
            print(engine + '引擎结果为: ' + result)
            print(engine + '规则列表为: ' + input)
            sql6 = 'select name, remark from zw_resultset_list where resultset_id=%s'
            name, remark = Mysql.selectwithparams(
                rule, sql6, id)[0], Mysql.selectwithparams(rule, sql6, id)[1]
            print('用户申请被 (' + name + ' ' + remark + ') 拒绝')
    else:
        print('请输入 process = Credit 或 Loan')