<commit_before>from system.models import Administrator
from system.models import System
from system.models import Advertisement
from system.models import OrderList
from system.models import Shop
from system.models import Seller
from system.models import Customer
from system.models import BlacklistSeller
from system.models import BlacklistCustomer



class Administrator_class:
        """This is Administrator class"""
        AdministratorID = 0           #ԱID
	AdministratorAccount = ""     #Աʺ
	AdministratorPassword = ""    #Ա
	AdministratorName = ""        #Աǳ
	AdministratorTelephone = 0    #Ա绰
	AdministratorEmail = ""       #Աʼ
	Advertisement                 #
	SellerBlackList = []          #Һ
	CustomerBlackList = []        #Һ
	def __init__(self,administratorID):
	        self.AdministratorID = administratorID
	        admin = Administrator.objects.get(id=administratorID)
	        self.AdministratorAccount = admin.AdministratorAccount
	        self.AdministratorPassword = <PASSWORD>
	        self.AdministratorName = admin.AdministratorName
	        self.AdministratorTelephone = admin.AdministratorTelephone
	        self.AdministratorEmail = admin.AdministratorEmail
	        #Advertisement
	        self.SellerBlackList = SellerBlackList.object.get(AdministratorID = administratorID)
	        self.CustomerBlackList = CustomerBlackList.object.get(AdministratorID = administratorID)
	        
	def GetOrderList():    #жԲ鿴ʷ
	        return OrderList.objects.filter(OrderState = 3)
	
	def GetCommission():   #ÿһʽ׵Ӷ
	        a = []
	        b = OrderList.objects.filter(OrderState = 3)
	        for c in b.OrderProfit
	            a.append(c * System.ComissionRate)
	        return a

	def GetOrder(i):       #ض
	        return OrderList.objects.filter(OrderID = i)

	def Login(a, p):       #Ա¼
                b = Administrator.objects.filter(AdministratorAccount = a)
                if p = b.AdministratorPassword
                    return 1

	def BackupDB():   #ݿ
	        pass
	
	def RestoreDB():  #ָݿ
	        pass

	def ShopList DealShopApply():  #,ݿѡе״̬Ϊˡĵ̡
	        return Shop.objects.filter(ShopState = 0)
	
	def PassApply(i):    #ͨ
	        s = Shop.objects.filter(ShopID = i)
	        s.ShopState = 1
	        s.save()
	        return 1
	
	def RejectApply(i):  #˲ͨ
	        s = Shop.objects.filter(ShopID = i)
	        s.ShopState = 2
	        s.save()
	        return 1
	
	def BlacklistCustomer(self, c):  #,ΪID
	        r = raw_input("input:")
	        b = BlacklistCustomer(BlacklistCustomerID = ,
                                      AdministratorID = self.AdministratorID,
                                      CustomerID = c ,
                                      BlacklistCustomerReason = r)
	
	def BlacklistSeller(self, s):    #,ΪID
	        r = raw_input("input:")
	        b = BlacklistCustomer(BlacklistCustomerID = ,
                                      AdministratorID = self.AdministratorID,
                                      CustomerID = s ,
                                      BlacklistCustomerReason = r)

	def GetBlacklist():  #鿴Ϣ,˻б
	        return SellerBlackList.objects.all(),CustomerBlackList.objects.all()

	def RestoreCustomer(c):  #ָʺ
	        p = CustomerBlackList.object.get(CustomerID = c)
	        p.delete()

	def RestoreSeller(s):    #ָʺ
	        p = SellerBlackList.object.get(CustomerID = s)
	        p.delete()
	
	def DeleteCustomer(c):   #ɾʺ
	        p = Customer.object.get(CustomerID = c)
	        p.delete()
	
	def DeleteSeller(s):     #ɾʺ
	        p = Seller.object.get(SellerID = s)
	        p.delete()
	
	def SetAd(Advertisement Ad):  #ҳ
	        pass
	        
 





class System_class:
        """This is System class"""
        Announcement = ""        #(String)
        Date = 0                 #ʱ
	CommissionRate = 0       #Ӷ(ÿһʽ׶Ҫȡ)
	def __init__(self)
		self.Announcement = Announcement
		self.Date = Date
		self.CommissionRate = CommissionRate
	
	def GetAnnouncement(self):      #鿴(API)
		return self.Announcement 
	
	def ModifyAnnouncement():       #޸Ĺ(ϵͳԱȨ)
                r = raw_input("input:")
		p = System.objects.get(BulletinBoardContent=String)
		p.BulletinBoardContent = r                         
		p.save()
	
	def GetCommissionRate(self):
		return self.CommissionRate 
	
	def SetCommissionRate(self, n):
		self.CommissionRate = n
		return self.CommissionRate

	


















<commit_msg>Modify system.classes of administrator and system<commit_after>#encoding:utf-8

from system.models import *

class Admistrator_class:
	#管理员ID编号
	AdministratorID = 0
	#管理员帐号
	AdministratorAccount = ""
	#管理员密码
	AdministratorPassword = ""
	#管理员昵称
	AdministratorName = ""
	#管理员电话    
	AdministratorTelephone = 0 
	#管理员邮件 
	AdministratorEmail = ""
	#主页店铺广告   
	HomeShopAdvList = []
	#主页商品广告     
	HomeCommodityAdvList = []
	#卖家黑名单     
	SellerBlackList = []
	 #买家黑名单      
	CustomerBlackList = []

	def __init__(self, administratorID):
		self.AdministratorID = administratorID
		admin = Administrator.objects.get(id = administratorID)
		self.AdministratorAccount = admin.AdministratorAccount
		self.AdministratorPassword = <PASSWORD>
		self.AdministratorName = admin.AdministratorName
		self.AdministratorTelephone = admin.AdministratorTelephone
		self.AdministratorEmail = admin.AdministratorEmail
		#Advertisement
		self.HomeShopAdvList = HomeShopAdv.objects.filter(OwnerID = administratorID)
		self.HomeCommodityAdvList = HomeCommodityAdv.objects.filter(OwnerID = administratorID)
		#BlackList
		self.SellerBlackList = SellerBlackList.objects.get(AdministratorID = administratorID)
		self.CustomerBlackList = CustomerBlackList.objects.get(AdministratorID = administratorID)
	        
	def GetOrderList():    #获得所有订单以查看销售历史。
		return OrderList.objects.filter(OrderState = 3)
	
	def GetCommission(self):   #计算出每一笔交易的佣金。
		ComissionList = []
		for c in OrderList.objects.filter(OrderState = 3):
			ComissionList.append(Commodity(id = c.CommodityID.id) * \
            	(System.objects.get(id=1)).ComissionRate)
		return ComissionList

	def GetSpecificOrder(orderListID):       #获得特定订单
		return OrderList.objects.get(id = orderListID)

	def Login(account, password):       #管理员登录
		admin = Administrator.objects.filter(AdministratorAccount = account)
		if (password == <PASSWORD>):
			return 1

	def BackupDB():   #备份数据库
		pass
	
	def RestoreDB():  #恢复数据库
		pass

	def ShopListDealShopApply():  #处理店铺申请,从数据库中选择所有店铺状态为’待审核’的店铺。
		return Shop.objects.filter(ShopState = 0)
	
	def PassApply(shopID):    #审核通过
		s = Shop.objects.filter(id = shopID)
		s.ShopState = 1
		s.save()
		return 1
	
	def RejectApply(shopID):  #审核不通过
		s = Shop.objects.filter(id = shopID)
		s.ShopState = 2
		s.save()
		return 1
	
	def BlacklistCustomer(self, customerID):  #拉黑买家,参数为买家ID
		r = raw_input("input:")  #input BlacklistReason
        b = BlacklistCustomer(BlacklistCustomerReason = r,
        	AdministratorID = self.AdministratorID, CustomerID = customerID)
        b.save()
	
	def BlacklistSeller(self, sellerID):    #拉黑卖家,参数为卖家ID
		r = raw_input("input:")   #input BlacklistReason
		b = BlacklistSeller(BlacklistSellerReason = r,
			AdministratorID = self.AdministratorID, SellerID = sellerID)
		b.save()

	def GetBlacklistCustomer():  #查看买家黑名单信息
		return BlackListCustomer.objects.all()

	def GetBlacklistSeller():  #查看卖家黑名单信息
		return BlackListSeller.objects.all()

	def RestoreCustomer(customerID):  #恢复买家帐号
		c = BlackListCustomer.objects.get(id = customerID)
		c.delete()

	def RestoreSeller(sellerID):    #恢复卖家帐号
		s = BlackListSeller.objects.get(id = sellerID)
		s.delete()
	
	def DeleteCustomer(customerID):   #删除买家帐号
		c = Customer.objects.get(id = customerID)
		c.delete()
	
	def DeleteSeller(sellerID):     #删除卖家帐号
		s = Seller.objects.get(SellerID = sellerID)
		s.delete()
	
	def SetHomeShopAdv(self, shopID, ownerID):  #配置主页店铺广告
		r = raw_input("input:")   #input AdvertisementContent
		Adv = HomeShopAdv(ShopID = shopID, OwnerID = self.AdministratorID,
			AdvertisementContent = r)
		Adv.save()
    
	        
 	def SetHomeCommodityAdv(self, commodityID, ownerID):  #配置主页商品广告
 		r = raw_input("input:")   #input AdvertisementContent
		Adv = HomeShopAdv(CommodityID = commodityID, OwnerID = self.AdministratorID,
			AdvertisementContent = r)
		Adv.save()




class System_class:
	"""This is System class"""
	Announcement = ""        #公告(String)
	AnnouncementDate = ""    #公告时间
	CommissionRate = 0       #交易佣金率(每一笔交易都要收取)
	def __init__(self):
		self.Announcement = (System.objects.get(id = 1)).BulletinBoardDecription
		self.AnnouncementDate = (System.objects.get(id = 1)).BulletinBoardDate
		self.CommissionRate = (System.objects.get(id = 1)).CommissionRate
	

	def GetAnnouncement(self):  #查看公告板(公共API)
		return self.Announcement 
	
	def ModifyAnnouncement():       #修改公告(系统管理员权限)
		r = raw_input("input:")
		p = System.objects.get(id = 1)
		p.BulletinBoardDecription = r                         
		p.save()
	
	def GetCommissionRate(self):
		return self.CommissionRate 
	
	def SetCommissionRate(self, commissionRate):
		self.CommissionRate = n
		self.save()

	



















{'fraction_non_alphanumeric': 0.09650380500716886, 'fraction_numerical': 0.003198411823094739, 'mean_word_length': 2.8005029337803857, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1655603', 'n_tokens_mistral': 3300, 'n_tokens_neox': 3066, 'n_words': 567}