Exemple #1
0
    def fill_transfer_detail(self, raward):
        from WeiDian.service.SUser import SUser
        if hasattr(raward, 'RFstatus'):
            reward_info = self.sraward.get_raward_by_id(raward.RAid)
            # if reward_info.RAtransfer == False:
            #     raise SYSTEM_ERROR(u'信息错误,该券不能被赠送')
            if not re.match(r'^[0-2]$', str(raward.RFstatus)):
                raise SYSTEM_ERROR(u'优惠券转赠状态异常')
            if raward.RFstatus == 0:
                presenter = SUser().get_user_by_user_id(raward.RFfrom)
                recipient = SUser().get_user_by_user_id(raward.USid)
                if not presenter or not recipient:
                    raise NOT_FOUND(u'转赠信息不正确')
                if raward.USid == request.user.id:
                    usheader = presenter.USheader
                    remarks = '由{0}赠送'.format((presenter.USname).encode('utf8'))
                    tag = '赠送'
                    transfer_valid = True
                elif raward.RFfrom == request.user.id:
                    usheader = recipient.USheader
                    remarks = '已赠送给{0}'.format((recipient.USname).encode('utf8'))
                    tag = '赠送'
                    transfer_valid = False
            elif raward.RFstatus == 1:
                recipient = SUser().get_user_by_user_id(raward.USid)
                presenter = SUser().get_user_by_user_id(raward.RFfrom)
                if raward.USid == request.user.id:
                    usheader = presenter.USheader
                    remarks = '因领取后{0}小时未使用已退还给{1}'.format(reward_info.RAtransfereffectivetime, (presenter.USname).encode('utf8'))
                    tag = '已退回'
                    transfer_valid = False
                elif raward.RFfrom == request.user.id:
                    usheader = recipient.USheader
                    remarks = '{0}领取后{1}小时未使用还回'.format((recipient.USname).encode('utf8'), reward_info.RAtransfereffectivetime)
                    tag = '已还回'
                    transfer_valid = True
            elif raward.RFstatus == 2:
                recipient = SUser().get_user_by_user_id(raward.USid)
                usheader = recipient.USheader
                remarks = '{0}已使用'.format(str(recipient.USname))
                tag = '已使用'
                transfer_valid = False

        raward.fill(transfer_valid, 'transfer_valid')
        raward.fill(usheader, 'usheader')
        raward.fill(remarks, 'remarks')
        raward.fill(tag, 'tag')
        return raward
Exemple #2
0
 def __init__(self):
     from WeiDian.service.SComplain import SComplain
     self.scomplain = SComplain()
     from WeiDian.service.SActivity import SActivity
     self.sactivity = SActivity()
     from WeiDian.service.SUser import SUser
     self.suser = SUser()
Exemple #3
0
 def __init__(self):
     from WeiDian.service.SActivity import SActivity
     self.sactivity = SActivity()
     from WeiDian.service.SActivityComment import SActivityComment
     self.sacomment = SActivityComment()
     from WeiDian.service.SActivityLike import SActivityLike
     self.salike = SActivityLike()
     from WeiDian.service.SSuperUser import SSuperUser
     self.ssuperuser = SSuperUser()
     from WeiDian.service.SActivityMedia import SActivityMedia
     self.smedia = SActivityMedia()
     from WeiDian.service.SActivityTag import SActivityTag
     self.stags = SActivityTag()
     from WeiDian.service.SActivityFoward import SActivityFoward
     self.foward = SActivityFoward()
     from WeiDian.service.SProduct import SProduct
     self.sproduct = SProduct()
     from WeiDian.service.SUser import SUser
     self.suser = SUser()
     from WeiDian.service.SBigActivity import SBigActivity
     self.sbigactivity = SBigActivity()
     from WeiDian.service.STopNav import STopNav
     self.stopnav = STopNav()
     from WeiDian.service.STask import STask
     self.stask = STask()
     self.empty = ['', None, [], {}]
Exemple #4
0
 def __init__(self):
     from WeiDian.service.SActivityComment import SActivityComment
     self.sactivitycomment = SActivityComment()
     from WeiDian.service.SActivity import SActivity
     self.sactivity = SActivity()
     from WeiDian.service.SUser import SUser
     self.suser = SUser()
     from WeiDian.service.SSuperUser import SSuperUser
     self.ssuperuser = SSuperUser()
Exemple #5
0
 def __init__(self):
     from WeiDian.service.SRaward import SRaward
     self.sraward = SRaward()
     from WeiDian.service.SUser import SUser
     self.suser = SUser()
     from WeiDian.service.SSuperUser import SSuperUser
     self.ssuperuser = SSuperUser()
     from WeiDian.control.Cuser import CUser
     self.cuser = CUser()
Exemple #6
0
 def __init__(self):
     from WeiDian.service.SCommision import SCommision
     self.scommion = SCommision()
     from WeiDian.service.SUser import SUser
     self.suser = SUser()
     from WeiDian.control.Cuser import CUser
     self.cuser = CUser()
     from WeiDian.common.divide import Partner
     self.pn = Partner()
     self.empty = ['', {}, [], None]
Exemple #7
0
 def __init__(self):
     from WeiDian.service.SProduct import SProduct
     self.sproduct = SProduct()
     from WeiDian.service.SUser import SUser
     self.suser = SUser()
     from WeiDian.service.SMyCenter import SMyCenter
     self.smycenter = SMyCenter()
     from WeiDian.service.SLevelRules import SLevelRules
     self.slevelrules = SLevelRules()
     from WeiDian.service.SUserAddress import SUserAddress
     self.suesraddress = SUserAddress()
     from WeiDian.service.SBankCard import SBankCard
     self.sbankcard = SBankCard()
     self.sorder = SOrder()
     self.sraward = SRaward()
     self.spartnermatch = SPartnerSellOrInviteMatch()
     self.stopnav = STopNav()
Exemple #8
0
 def __init__(self):
     from WeiDian.service.SProduct import SProduct
     self.sproduct = SProduct()
     from WeiDian.service.SUser import SUser
     self.suser = SUser()
     from WeiDian.service.STask import STask
     self.stask = STask()
     from WeiDian.service.SLevelRules import SLevelRules
     self.slevelrules = SLevelRules()
     from WeiDian.service.SUserAddress import SUserAddress
     self.suesraddress = SUserAddress()
     from WeiDian.service.SBankCard import SBankCard
     self.sbankcard = SBankCard()
     from WeiDian.service.SRaward import SRaward
     self.sraward = SRaward()
     from WeiDian.control.Cuser import CUser
     self.cuser = CUser()
     self.add_task_params = ['TAname', "TAtype", "TAhead", "TLid"]
     self.do_task_params = ["TUid"]
     self.add_task_level = [
         "TAlevel", "TArole", "TAcomplateNotifications", "reward"
     ]
Exemple #9
0
 def fill_user(self, comment):
     """给对象添加一个用户字段"""
     if comment.ACOrobot:
         user = {'usname': comment.ACOrobot, 'robot': 1}
     else:
         usid = comment.USid
         from WeiDian.service.SUser import SUser
         from WeiDian.service.SSuperUser import SSuperUser
         if comment.ACOparentid:
             user = SSuperUser().get_one_super_by_suid(usid)
             if user:
                 user.fill(0, 'robot')
                 user.hide('SUid')
         else:
             user = SUser().get_user_by_user_id(usid)  # 对象的用户
             if user:
                 user.fill(0, 'robot')
                 user.hide('USid')
                 user.hide('USphone')
     comment.user = user  # 对象的用户
     comment.add('user').hide('USid')
     return comment
Exemple #10
0
 def __init__(self):
     self.suser = SUser()
     self.stask = STask()
     self.smycenter = SMyCenter()
     self.sorder = SOrder()