Exemplo n.º 1
0
def sign_newaccount(account, password):
    dbsession = DBSession()
    # table fd_t_account
    if is_merchant_exist(account)['is_exist']:
        return {'is_success': False, 'des': 'account is already exist!'}
    shop_id = get_newaccountid()
    newaccount = FD_T_Account(acc_id=shop_id,
                              acc_type=FD_ACCOUNT_TYPE_MERCHANT,
                              account=account,
                              password=password,
                              phone_no=None,
                              auth_mode=FD_AUTH_MODE_ACCOUNT,
                              open_id=None,
                              register_time=datetime.datetime.now())
    dbsession.add(newaccount)
    # table fd_t_fansmessageconfig
    fansmsgconfig = FD_T_Fansmessageconfig(shop_id=shop_id,
                                           current_p2p_count=0,
                                           p2p_remain_count=0,
                                           next_p2p_count=0,
                                           current_mass_count=0,
                                           mass_remain_count=0,
                                           next_mass_count=0)
    dbsession.add(fansmsgconfig)

    dbsession.commit()
    return {'is_success': True, 'shop_id': shop_id}
Exemplo n.º 2
0
def sign_newaccount(account, password):
    dbsession = DBSession()
    # table fd_t_account
    if is_merchant_exist(account)['is_exist']:
        return {'is_success': False, 'des': 'account is already exist!'}
    shop_id = get_newaccountid()
    newaccount = FD_T_Account(acc_id=shop_id, acc_type=FD_ACCOUNT_TYPE_MERCHANT, account=account, password=password,
                              phone_no=None, auth_mode=FD_AUTH_MODE_ACCOUNT, open_id=None,
                              register_time=datetime.datetime.now())
    dbsession.add(newaccount)
    # table fd_t_fansmessageconfig
    fansmsgconfig = FD_T_Fansmessageconfig(shop_id=shop_id, current_p2p_count=0, p2p_remain_count=0, next_p2p_count=0,
                                           current_mass_count=0, mass_remain_count=0, next_mass_count=0)
    dbsession.add(fansmsgconfig)

    dbsession.commit()
    return {'is_success': True, 'shop_id': shop_id}
Exemplo n.º 3
0
def sign_merchant(account, password, contact_name, contact_phone_no, contact_email,
                  contact_qq,
                  shop_name, brand_name, business_hours, telephone_no, city_id,
                  district_id, business_area, address, longitude, latitude,
                  category_list):
    if not is_merchant_exist(account)['is_exist']:
        session = DBSession()
        # geo = GEO()
        try:
            shop_id = get_newaccountid()
            new_account = FD_T_Account(acc_id=shop_id,
                                       acc_type=FD_ACCOUNT_TYPE_MERCHANT,
                                       account=account,
                                       password=password,
                                       auth_mode=FD_AUTH_MODE_ACCOUNT,
                                       phone_no=contact_phone_no,
                                       register_time=datetime.datetime.now(),
                                       )
            session.add(new_account)
            new_merchant = FD_T_Shopaccount(shop_id=shop_id,
                                            contact_name=contact_name,
                                            contact_phone_no=contact_phone_no,
                                            contact_email=contact_email,
                                            contact_qq=contact_qq,
                                            service_balance=0.0,
                                            service_status=1,
                                            portrait_url=CONFIG.DEFAULT_PORTRAIT_URL)
            session.add(new_merchant)
            new_shop = FD_T_Shop(shop_id=shop_id, shop_name=shop_name, brand_name=brand_name,
                                 business_hours=business_hours, telephone_no=telephone_no, city_id=city_id,
                                 district_id=district_id, business_area=business_area, address=address,
                                 longitude=longitude, latitude=latitude, category_list=category_list,
                                 qrcode='http://www.immbear.com/shop/' + str(shop_id),
                                 status=1)
            fansmsgconfig = FD_T_Fansmessageconfig(shop_id=shop_id, current_p2p_count=0, p2p_remain_count=0,
                                                   next_p2p_count=0,
                                                   current_mass_count=0, mass_remain_count=0, next_mass_count=0)
            session.add(fansmsgconfig)
            session.add(new_shop)
            session.commit()
            return dict(is_success=True, shop_id=new_merchant.shop_id)
        except Exception, e:
            mt_log.exception(e)
            session.rollback()
            return dict(error_code=MTERROR.RegisterFailed.code, des=MTERROR.RegisterFailed.des, is_success=False)
        finally:
Exemplo n.º 4
0
def sign_merchant(account, password, contact_name, contact_phone_no,
                  contact_email, contact_qq, shop_name, brand_name,
                  business_hours, telephone_no, city_id, district_id,
                  business_area, address, longitude, latitude, category_list):
    if not is_merchant_exist(account)['is_exist']:
        session = DBSession()
        # geo = GEO()
        try:
            shop_id = get_newaccountid()
            new_account = FD_T_Account(
                acc_id=shop_id,
                acc_type=FD_ACCOUNT_TYPE_MERCHANT,
                account=account,
                password=password,
                auth_mode=FD_AUTH_MODE_ACCOUNT,
                phone_no=contact_phone_no,
                register_time=datetime.datetime.now(),
            )
            session.add(new_account)
            new_merchant = FD_T_Shopaccount(
                shop_id=shop_id,
                contact_name=contact_name,
                contact_phone_no=contact_phone_no,
                contact_email=contact_email,
                contact_qq=contact_qq,
                service_balance=0.0,
                service_status=1,
                portrait_url=CONFIG.DEFAULT_PORTRAIT_URL)
            session.add(new_merchant)
            new_shop = FD_T_Shop(shop_id=shop_id,
                                 shop_name=shop_name,
                                 brand_name=brand_name,
                                 business_hours=business_hours,
                                 telephone_no=telephone_no,
                                 city_id=city_id,
                                 district_id=district_id,
                                 business_area=business_area,
                                 address=address,
                                 longitude=longitude,
                                 latitude=latitude,
                                 category_list=category_list,
                                 qrcode='http://www.immbear.com/shop/' +
                                 str(shop_id),
                                 status=1)
            fansmsgconfig = FD_T_Fansmessageconfig(shop_id=shop_id,
                                                   current_p2p_count=0,
                                                   p2p_remain_count=0,
                                                   next_p2p_count=0,
                                                   current_mass_count=0,
                                                   mass_remain_count=0,
                                                   next_mass_count=0)
            session.add(fansmsgconfig)
            session.add(new_shop)
            session.commit()
            return dict(is_success=True, shop_id=new_merchant.shop_id)
        except Exception, e:
            mt_log.exception(e)
            session.rollback()
            return dict(error_code=MTERROR.RegisterFailed.code,
                        des=MTERROR.RegisterFailed.des,
                        is_success=False)
        finally: