class WeixinVerify():

    father_path = os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\weixin_verify.yml"
    initparams = readyml(yamlfilepath)

    url = LoadEnvData.cf_testenv.get(
        'test_combineapi_host', 'host') + LoadEnvData.cf_testenv.get(
            'test_combineapi_host', 'weixin_verify_path')

    def __init__(self):

        pass

    def params_invalid(self):
        '''参数不正确'''
        params_dict = dict(self.initparams)

        # custid替换为非法字符

        params_dict['custid'] = "123xxx"
        status_error_code = WeixinVerifyReturnCodeEnum.PARAM_ILLEGAL.value

        return params_dict, status_error_code

    def verify_ok(self):
        '''账号合规'''
        params_dict = dict(self.initparams)

        #从库里选一个微信注册用户
        sql='select cust_id from customer_third_wechat where cust_id in (select cust_id from customer where  cust_mobile="" and ' \
            ' cust_email like "%ddmobile_user.com") ' \
            'and cust_bind_type=2 limit 1;'

        custid = MysqlGet(sql)

        params_dict['custid'] = custid

        status_error_code = WeixinVerifyReturnCodeEnum.SUCCESS.value

        return params_dict, status_error_code

    def verify_fail(self):
        '''账号合规'''
        params_dict = dict(self.initparams)

        params_dict['custid'] = LoadEnvData.cf_presetvar.get(
            'combine', 'cust_bind_weixin')

        status_error_code = WeixinVerifyReturnCodeEnum.VERIFY_FAIL.value

        return params_dict, status_error_code
class ChangeProfileImg():

    father_path = os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\changeprofileimg.yml"
    initparams = readyml(yamlfilepath)

    changeprofileimgpath = father_path + "\\resource\\changeprofileimg.png"

    url = LoadEnvData.cf_testenv.get(
        'test_profileapi_host', 'host') + LoadEnvData.cf_testenv.get(
            'test_profileapi_host', 'changeprofileimg_path')

    def __init__(self):

        #加载图像
        with open(self.changeprofileimgpath, 'rb') as f:
            self.bf = base64.b64encode(f.read())

        pass

    def custid_notexist(self):
        '''custid不存在'''
        params_dict = dict(self.initparams)

        # custid替换

        params_dict['custid'] = "123456789"
        params_dict['img_data'] = self.bf
        status_error_code = ChangeProfileImgReturnCodeEnum.USER_NOT_EXIST.value

        return params_dict, status_error_code

    def postinfo_null(self):
        '''info is null'''
        params_dict = dict(self.initparams)

        params_dict['img_data'] = ''

        status_error_code = ChangeProfileImgReturnCodeEnum.INFO_NULL.value

        return params_dict, status_error_code

    def postinfo_seccess(self):
        '''success'''
        params_dict = dict(self.initparams)

        params_dict['img_data'] = self.bf

        status_error_code = ChangeProfileImgReturnCodeEnum.SUCCESS.value

        return params_dict, status_error_code
Beispiel #3
0
class GetWeixinBindCustid():

    father_path = os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\get_weixin_bind_custid.yml"
    initparams = readyml(yamlfilepath)

    url = LoadEnvData.cf_testenv.get(
        'test_combineapi_host', 'host') + LoadEnvData.cf_testenv.get(
            'test_combineapi_host', 'get_weixin_bind_custid_path')

    def __init__(self):

        pass

    def params_invalid(self):
        '''参数不正确'''
        params_dict = dict(self.initparams)

        # unionid替换为非法字符

        params_dict['unionid'] = ""
        status_error_code = GetWeixinBindCustidReturnCodeEnum.PARAM_ERROR_PREFIX.value

        return params_dict, status_error_code

    def weixin_notbind_custid(self):
        '''未绑定'''
        params_dict = dict(self.initparams)

        #从库里获取一个未绑定的账户
        sql = 'select wx_union_id from customer_third_wechat where cust_bind_type=2 limit 1; '

        unionid = MysqlGet(sql)
        params_dict['unionid'] = unionid

        status_error_code = GetWeixinBindCustidReturnCodeEnum.NOT_COMBINED.value

        return params_dict, status_error_code

    def weixin_bind_custid(self):
        '''已绑定'''
        params_dict = dict(self.initparams)

        params_dict['unionid'] = LoadEnvData.cf_presetvar.get(
            'combine', 'cust_bind_weixin_unionid')

        status_error_code = GetWeixinBindCustidReturnCodeEnum.SUCCESS.value

        return params_dict, status_error_code

        pass
class SetUserProfileAllInfo():

    father_path=os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\set_user_profile_all_info.yml"
    initparams = readyml(yamlfilepath)

    url = LoadEnvData.cf_testenv.get('test_profileapi_host', 'host') + LoadEnvData.cf_testenv.get('test_profileapi_host',\
                                                                                                  'set_user_profile_all_info_path')

    def __init__(self):

        pass

    def custid_invalid(self):
        '''custid不正确'''
        params_dict = dict(self.initparams)

        # custid替换为空
        params_dict['cust_id'] = ""
        status_error_code = SetUserProfileAllInfoReturnCodeEnum.CUSTID_WRONG.value

        return params_dict, status_error_code


    def job_long(self):
        '''cust_job的长度大于40'''
        params_dict = dict(self.initparams)

        params_dict['cust_id']=LoadEnvData.cf_presetvar.get('profile','cust_id')
        params_dict['cust_job']=''.join('a' for i in range(42))

        status_error_code = SetUserProfileAllInfoReturnCodeEnum.JOB_LONG.value

        return params_dict, status_error_code




    def setcompanyallinfo_success(self):
        '''修改完毕'''
        params_dict = dict(self.initparams)

        params_dict['cust_id'] = LoadEnvData.cf_presetvar.get('profile', 'enterprise_cust_id')

        status_error_code = SetUserProfileAllInfoReturnCodeEnum.SUCCESS.value

        return params_dict, status_error_code
Beispiel #5
0
class GetCombineResult():

    father_path=os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\get_combine_result.yml"
    initparams = readyml(yamlfilepath)

    url = LoadEnvData.cf_testenv.get('test_combineapi_host', 'host') + LoadEnvData.cf_testenv.get('test_combineapi_host', 'get_combine_result_path')

    def __init__(self):

        pass

    def params_invalid(self):
        '''参数不正确'''
        params_dict = dict(self.initparams)

        # custid替换为非法字符

        params_dict['custid'] = "123xxx"
        status_error_code = GetCombineResultReturnCodeEnum.PARAM_ERROR_PREFIX.value

        return params_dict, status_error_code

    def result_empty(self):
        '''参数不正确'''
        params_dict = dict(self.initparams)

        # custid替换为不存在

        params_dict['custid'] = "1234567889"
        status_error_code = GetCombineResultReturnCodeEnum.RESULT_EMPTY.value

        return params_dict, status_error_code

    def getresult_ok(self):
        '''获取结果OK'''
        params_dict = dict(self.initparams)

        # custid替换为不存在

        params_dict['custid'] = LoadEnvData.cf_presetvar.get('combine','combine_cust_id')
        status_error_code = GetCombineResultReturnCodeEnum.SUCCESS.value

        return params_dict, status_error_code
class SetUserProfile():

    father_path = os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\set_user_profile.yml"
    initparams = readyml(yamlfilepath)

    url = LoadEnvData.cf_testenv.get(
        'test_profileapi_host', 'host') + LoadEnvData.cf_testenv.get(
            'test_profileapi_host', 'set_user_profile_path')

    def __init__(self):

        pass

    def custid_invalid(self):
        '''custid不正确'''
        params_dict = dict(self.initparams)

        # custid替换为非法字符
        params_dict['cust_id'] = "123xxx"
        status_error_code = SetUserProfileReturnCodeEnum.CUSTID_WRONG.value

        return params_dict, status_error_code

    def keyword_invalid(self):
        '''keyword不正确'''
        params_dict = dict(self.initparams)

        # keyword替换为非法字符
        params_dict['keyword'] = "xxxxxx"
        status_error_code = SetUserProfileReturnCodeEnum.KEWWORD_WRONG.value

        return params_dict, status_error_code

    def content_null(self):
        '''设置内容为空'''
        params_dict = dict(self.initparams)

        # keyword替换为非法字符
        params_dict['keyword'] = "new_sex"
        status_error_code = SetUserProfileReturnCodeEnum.CONTENT_EMPTY.value

        return params_dict, status_error_code

    def address_fail(self):
        '''new_address设置不成功'''
        params_dict = dict(self.initparams)

        params_dict['keyword'] = "new_address"
        params_dict['content'] = 9999  #设置一个很大的区域

        status_error_code = SetUserProfileReturnCodeEnum.ADDRESS_FAIL.value

        return params_dict, status_error_code

    def birthday_fail(self):
        '''new_birthday设置不成功'''
        params_dict = dict(self.initparams)

        params_dict['keyword'] = "new_birthday"
        params_dict['content'] = "1990:03:44"

        status_error_code = SetUserProfileReturnCodeEnum.BIRTHDAY_FAIL.value

        return params_dict, status_error_code

    def station_long(self):
        '''station 长度超限 40'''
        params_dict = dict(self.initparams)

        params_dict['keyword'] = "station"
        params_dict['content'] = ''.join('a' for i in range(42))

        status_error_code = SetUserProfileReturnCodeEnum.STATION_FAIL.value

        return params_dict, status_error_code
class WeixinUnbindDelete():

    father_path = os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\weixin_unbind_delete.yml"
    initparams = readyml(yamlfilepath)

    url = LoadEnvData.cf_testenv.get(
        'test_loginapi', 'host') + LoadEnvData.cf_testenv.get(
            'test_loginapi', 'weixin_unbind_delete_path')

    def __init__(self):

        pass

    def custid_invalid(self):
        '''参数错误'''
        params_dict = dict(self.initparams)

        # custid替换为非法字符

        params_dict['custid'] = "123xxx"
        status_error_code = WeixinUnbindDeleteReturnCodeEnum.PARAM_ILLEGAL.value

        return params_dict, status_error_code

    def custid_notexist(self):
        '''custid找不到'''
        params_dict = dict(self.initparams)

        # custid替换为不存在的

        params_dict['custid'] = "99999999"
        status_error_code = WeixinUnbindDeleteReturnCodeEnum.CUST_NOT_FOUND.value

        return params_dict, status_error_code

    def custid_already_combine(self):
        '''账号合并的不允许删除'''

        #1、从customer_combine和customer_third_wechat中找一个custid传参
        sql = 'select combine_cust_id from customer_combine where combine_cust_id in (select cust_id from customer_third_wechat) limit 1;'

        custid_combinded = MysqlGet(sql)

        params_dict = dict(self.initparams)

        params_dict['custid'] = custid_combinded
        status_error_code = WeixinUnbindDeleteReturnCodeEnum.COMBINE_DENY.value

        return params_dict, status_error_code

    def weixin_unbind_success(self):
        '''解绑成功'''

        params_dict = dict(self.initparams)
        #1、先向插入customer_third_wechat
        #1.1获取一个未绑定的custid
        sql = 'select cust_id from customer where cust_id not in (select cust_id from customer_third_wechat) and cust_id>0 limit 1;'

        custid = MysqlGet(sql)

        #1.2插入数据

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

        sql = 'insert into customer_third_wechat(cust_id,wx_union_id,cust_bind_type,wx_use_status,cust_status,creation_date,last_changed_date) ' \
              'values({},{},{},{},{},{},{});'.format(int(custid),'"fake1230900000000"',1,1,1,\
                                                                                  '"'+localtime+'"','"'+localtime+'"')

        MysqlInsert(sql)

        params_dict['custid'] = custid
        status_error_code = WeixinUnbindDeleteReturnCodeEnum.SUCCESS.value

        return params_dict, status_error_code

        pass
Beispiel #8
0
class WeixinRegister():

    father_path=os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\weixin_register.yml"
    presetvarinifilepath = father_path + "\\config\\presetvar.ini"
    testenvinifilepath=father_path+"\\config\\testenv.ini"

    initparams = readyml(yamlfilepath)
    cf_presetvar = readini(presetvarinifilepath)
    cf_testenv=readini(testenvinifilepath)

    url = cf_testenv.get('test_loginapi', 'host') + cf_testenv.get('test_loginapi', 'weixin_register_path')

    def __init__(self):

        pass


    def email_indb(self):
        '''email值已在库'''

        params_dict = dict(self.initparams)

        # email 替换为已在库的email
        email_exist = self.cf_presetvar.get('login', 'cust_email')

        params_dict['email'] = email_exist
        status_error_code = WeixinRegistrReturnCodeEnum.EMAIL_EXISTS.value

        return params_dict, status_error_code


    def nickname_indb(self):
        '''nickname已在库'''

        params_dict = dict(self.initparams)

        # email 替换为已在库的email
        nickname_exist = self.cf_presetvar.get('login', 'cust_nickname')

        params_dict['nickname'] = nickname_exist
        status_error_code = WeixinRegistrReturnCodeEnum.NICKNAME_EXISTS.value

        return params_dict, status_error_code

    def union_already_bind(self):
        '''union_id已经绑定过'''

        params_dict = dict(self.initparams)

        # email 替换为已在库的email
        unionid_exist = self.cf_presetvar.get('login', 'cust_unionid')

        params_dict['union_id'] = unionid_exist
        status_error_code = WeixinRegistrReturnCodeEnum.WEIXIN_REGISTER_IS_BIND.value

        return params_dict, status_error_code


    def email_empty(self):
        '''email 值为空'''
        pass

    def union_id_empty(self):
        '''union_id为空'''
        params_dict = dict(self.initparams)

        params_dict['union_id'] = ''
        status_error_code=WeixinRegistrReturnCodeEnum.FORMATTER_ERROR.value

        return params_dict,status_error_code

    def appkey_not_exist(self):
        '''appkey未传值或传的值不是申请分配的'''
        params_dict = dict(self.initparams)

        params_dict['appkey'] = '199999'
        status_error_code = WeixinRegistrReturnCodeEnum.APPKEY_ERROR.value

        return params_dict, status_error_code



    def weixinregister_success(self):
        '''参数正确,往customer库的Customers表里插入用户注册数据操作成功'''

        params_dict = dict(self.initparams)

        status_error_code=WeixinRegistrReturnCodeEnum.SUCCESS.value

        return params_dict,status_error_code

        pass
Beispiel #9
0
class GetUserProfile():

    father_path = os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\get_user_profile.yml"
    initparams = readyml(yamlfilepath)

    url = LoadEnvData.cf_testenv.get(
        'test_profileapi_host', 'host') + LoadEnvData.cf_testenv.get(
            'test_profileapi_host', 'get_user_profile_path')

    def __init__(self):

        pass

    def custid_invalid(self):
        '''custid不正确'''
        params_dict = dict(self.initparams)

        # custid替换为非法字符

        params_dict['cust_id'] = "123xxx"
        status_error_code = GetUserProfileReturnCodeEnum.CUSTID_WRONG.value

        return params_dict, status_error_code

    def keyword_invalid(self):
        '''keyword不正确'''
        params_dict = dict(self.initparams)

        params_dict['cust_id'] = LoadEnvData.cf_presetvar.get(
            'profile', 'cust_id')
        # keyword替换为非法字符

        params_dict['keyword'] = "xxxxxx"
        status_error_code = GetUserProfileReturnCodeEnum.KEWWORDWRONG.value

        return params_dict, status_error_code

    def empty_search(self):
        params_dict = dict(self.initparams)

        params_dict['cust_id'] = '12345678'  #custid不存在
        params_dict['keyword'] = ''
        status_error_code = GetUserProfileReturnCodeEnum.EMPTYINFO.value

        return params_dict, status_error_code

    def getuserprofile_success(self):
        '''获取用户档案信息成功'''

        params_dict = dict(self.initparams)

        params_dict['cust_id'] = LoadEnvData.cf_presetvar.get(
            'profile', 'cust_id')

        status_error_code = GetUserProfileReturnCodeEnum.SUCCESS.value

        params_dict_list = []
        # keyword展开
        for ele in params_dict['keyword']:

            params_dict['keyword'] = ele

            params_dict_list.append((params_dict, status_error_code))

        return params_dict_list
class CombineStatus():

    father_path=os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\combine_status.yml"
    initparams = readyml(yamlfilepath)

    url = LoadEnvData.cf_testenv.get('test_combineapi_host', 'host') + LoadEnvData.cf_testenv.get('test_combineapi_host', 'combine_status_path')

    def __init__(self):

        pass

    def params_invalid(self):
        '''参数不正确'''
        params_dict = dict(self.initparams)

        # custid替换为非法字符

        params_dict['custid'] = "123xxx"
        status_error_code = CombineStatusReturnCodeEnum.PARAM_ERROR_PREFIX.value

        return params_dict, status_error_code


    def combine_notweixin(self):
        '''非微信账号,即主站账号'''

        params_dict = dict(self.initparams)

        #从库里获取一个主站账户
        sql='select cust_id from customer where cust_id not in (select cust_id from customer_third_wechat union ' \
            ' select cust_id from customer_third) and cust_id>0 limit 1'

        custid=MysqlGet(sql)
        params_dict['custid'] = custid

        status_error_code = CombineStatusReturnCodeEnum.NOT_WEIXIN.value

        return params_dict, status_error_code


    def combine_done(self):
        '''合并完成'''

        params_dict = dict(self.initparams)

        #在customer_third_wechat表中找到一条cust_bind_type=1的custid 或找一个绑定过微信的custid

        params_dict['custid'] =LoadEnvData.cf_presetvar.get('combine','cust_bind_weixin')

        status_error_code = CombineStatusReturnCodeEnum.SUCCESS.value

        return params_dict, status_error_code

    def combine_notdo(self):
        '''未合并'''

        params_dict = dict(self.initparams)

        #从customer_third_wechat表中找到一条cust_bind_type=2的custid,该custid作为子账号在customer_combine表不存在

        sql='select cust_id from customer_third_wechat where cust_bind_type=2 and cust_id not in (select cust_id from customer_combine ' \
            ') limit 1'

        custid = MysqlGet(sql)
        params_dict['custid'] = custid

        status_error_code = CombineStatusReturnCodeEnum.NOT_COMBINED.value

        return params_dict, status_error_code

    def combine_doing(self):
        '''合并进行中'''

        params_dict = dict(self.initparams)

        #用主账号在customer_combine_process中查询数据

        params_dict['custid'] = LoadEnvData.cf_presetvar.get('combine','combine_cust_id')

        status_error_code = CombineStatusReturnCodeEnum.COMBINE_DOING.value

        return params_dict, status_error_code
class SetCompanyProfileAllInfo():

    father_path = os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\set_company_profile_all_info.yml"
    initparams = readyml(yamlfilepath)

    url = LoadEnvData.cf_testenv.get('test_profileapi_host', 'host') + LoadEnvData.cf_testenv.get('test_profileapi_host',\
                                                                                                  'set_company_profile_all_info_path')

    def __init__(self):

        pass

    def custid_invalid(self):
        '''custid不正确'''
        params_dict = dict(self.initparams)

        # custid替换为空
        params_dict['cust_id'] = ""
        status_error_code = SetCompanyProfileAllInfoReturnCodeEnum.CUSTID_WRONG.value

        return params_dict, status_error_code

    def company_long(self):
        '''cust_company的长度大于100'''
        params_dict = dict(self.initparams)

        params_dict['cust_id'] = LoadEnvData.cf_presetvar.get(
            'profile', 'enterprise_cust_id')
        params_dict['cust_company'] = ''.join('a' for i in range(102))

        status_error_code = SetCompanyProfileAllInfoReturnCodeEnum.COMPANY_LONG.value

        return params_dict, status_error_code

    def province_city_town_null(self):
        '''cust_province_id/cust_city_id/cust_town_id/cust_quarter_id 是空'''

        params_dict = dict(self.initparams)

        params_dict['cust_id'] = LoadEnvData.cf_presetvar.get(
            'profile', 'enterprise_cust_id')

        params_dict['cust_province_id'] = ''
        params_dict['cust_city_id'] = ''

        status_error_code = SetCompanyProfileAllInfoReturnCodeEnum.PROVINCE_TOWN_QUARTER_EMPTY.value

        return params_dict, status_error_code

    def setcompanyallinfo_success(self):
        '''修改完毕'''
        params_dict = dict(self.initparams)

        params_dict['cust_id'] = LoadEnvData.cf_presetvar.get(
            'profile', 'enterprise_cust_id')

        status_error_code = SetCompanyProfileAllInfoReturnCodeEnum.SUCCESS.value

        return params_dict, status_error_code
class CombineVerify():

    father_path=os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\combine_verify.yml"
    initparams = readyml(yamlfilepath)

    url = LoadEnvData.cf_testenv.get('test_combineapi_host', 'host') + LoadEnvData.cf_testenv.get('test_combineapi_host', 'combine_verify_path')

    def __init__(self):

        pass

    def params_invalid(self):
        '''参数不正确'''
        params_dict = dict(self.initparams)

        # custid替换为空

        params_dict['custid'] = ""
        status_error_code = CombineVerifyReturnCodeEnum.PARAM_ERROR_PREFIX.value

        return params_dict, status_error_code


    def cancel_deny(self):
        '''用户已申请注销'''

        params_dict = dict(self.initparams)

        # custid替换为空

        params_dict['custid'] = LoadEnvData.cf_presetvar.get('combine', 'custid_cancel')

        status_error_code = CombineVerifyReturnCodeEnum.CUSTID_ALREADY_APPLY_CANCEL.value

        return params_dict, status_error_code


    def custid_binded(self):
        '''子账号已合并过'''

        params_dict = dict(self.initparams)

        # custid替换为空

        params_dict['custid'] = LoadEnvData.cf_presetvar.get('combine','cust_id')

        status_error_code = CombineVerifyReturnCodeEnum.CUSTID_COMBINE_REPEAT_VERIFY_FAIL.value

        return params_dict, status_error_code

    def custid_enterprise_deny(self):
        '''企业账号不具备合并条件'''

        params_dict = dict(self.initparams)

        # custid替换为企业账号

        params_dict['custid'] = LoadEnvData.cf_presetvar.get('combine', 'enterprise_cust_id')

        status_error_code = CombineVerifyReturnCodeEnum.CUSTID_DENY_FOR_ENTERPRISE_FAIL.value

        return params_dict, status_error_code


    def custid_veify_ok(self):
        '''可以合并'''
        params_dict = dict(self.initparams)

        #不在customer_combine表中的custid
        params_dict['custid'] = LoadEnvData.cf_presetvar.get('combine', 'cust_bind_weixin')

        status_error_code = CombineVerifyReturnCodeEnum.SUCCESS.value

        return params_dict, status_error_code
Beispiel #13
0
import os
from utils.readyaml import readyml
import time
picture_time = time.strftime("%Y-%m-%d-%H_%M_%s", time.localtime(time.time()))
image_path = os.path.join(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'image/')
element_path = os.path.join(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
    'data/element.yaml')
d = readyml(element_path)
url = "https://txqa.ziyun-cloud.com/factoryPortal/"
pt_user = '******'
pt_password = '******'

print(d)
class Weixin_Bind_Custid():

    father_path = os.path.dirname(os.path.dirname(__file__))

    yamlfilepath = father_path + "\\data\\weixin_bind_custid.yml"
    presetvarinifilepath = father_path + "\\config\\presetvar.ini"
    testenvinifilepath = father_path + "\\config\\testenv.ini"

    initparams = readyml(yamlfilepath)
    cf_presetvar = readini(presetvarinifilepath)
    cf_testenv = readini(testenvinifilepath)

    url = cf_testenv.get('test_loginapi', 'host') + cf_testenv.get(
        'test_loginapi', 'weixin_bind_custid_path')

    def __init__(self):
        pass

    def custid_notindb(self):
        '''custid不存在'''

        params_dict = dict(self.initparams)

        status_error_code = WeixinBindCustidReturnCodeEnum.CUSTID_NOT_FIND.value

        return params_dict, status_error_code

    def custid_binded(self):
        '''当前custid已绑定过其它微信'''
        params_dict = dict(self.initparams)

        #custid替换为库里已绑定过微信的custid
        params_dict['custid'] = self.cf_presetvar.get('login',
                                                      'cust_bind_weixin')

        status_error_code = WeixinBindCustidReturnCodeEnum.CUSTID_BINDED.value

        return params_dict, status_error_code

    def weixin_binded(self):
        '''当前微信曾绑定过其它custid'''
        params_dict = dict(self.initparams)

        #1.从库里选择一个未绑定过微信的custid
        sql = 'select cust_id from customer where cust_id not in (select cust_id from customer_third_wechat) and cust_id>0 limit 1;'
        custid = PyMySQL1().mysqlget(sql)

        #2.从库里选择一个微信union_id(该union_id必被绑定过)
        sql = 'select wx_union_id from customer_third_wechat where cust_bind_type=2 limit 1; '
        unionid = PyMySQL1().mysqlget(sql)

        #3.更新组合参数
        params_dict['custid'] = custid
        params_dict['union_id'] = unionid

        status_error_code = WeixinBindCustidReturnCodeEnum.WEIXIN_BINDED.value

        return params_dict, status_error_code

    def weixin_binc_custid_success(self):
        '''绑定成功'''
        params_dict = dict(self.initparams)
        # 1.从库里选择一个未绑定过微信的custid
        sql = 'select cust_id from customer where cust_id not in (select cust_id from customer_third_wechat) limit 1;'
        custid = PyMySQL1().mysqlget(sql)

        # 2.更新组合参数
        params_dict['custid'] = custid

        status_error_code = WeixinBindCustidReturnCodeEnum.SUCCESS.value

        return params_dict, status_error_code