示例#1
0
def sign_shop(shop_id, 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):
    session = DBSession()
    if is_shop_exist(shop_id)['is_exist']:
        return {'success': False, 'des': 'shop is already exist'}
    try:
        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.encode('utf-8'),
                             longitude=longitude, latitude=latitude, category_list=category_list,
                             qrcode='http://www.immbear.com/shop/' + str(shop_id),
                             status=1)
        session.add(new_shop)
        session.commit()
        return {'success': True, 'shop_id': shop_id, 'is_success': False}
    except Exception, e:
        session.rollback()
        mt_log.exception(e)
        return {'success': False, 'res': str(e), 'is_success': False}
示例#2
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:
示例#3
0
文件: db_shop.py 项目: fanux/forward
def sign_shop(shop_id, 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):
    session = DBSession()
    if is_shop_exist(shop_id)['is_exist']:
        return {'success': False, 'des': 'shop is already exist'}
    try:
        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.encode('utf-8'),
                             longitude=longitude,
                             latitude=latitude,
                             category_list=category_list,
                             qrcode='http://www.immbear.com/shop/' +
                             str(shop_id),
                             status=1)
        session.add(new_shop)
        session.commit()
        return {'success': True, 'shop_id': shop_id, 'is_success': False}
    except Exception, e:
        session.rollback()
        mt_log.exception(e)
        return {'success': False, 'res': str(e), 'is_success': False}
示例#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: