コード例 #1
0
ファイル: models.py プロジェクト: cash2one/ESNS
    def success(self, payOrder):
        """
        支付成功
        by: 范俊伟 at:2015-03-07
        修改支付处理
        by: 王健 at:2015-03-17
        """
        update = Order.objects.filter(id=self.id).exclude(
            status=STATUS_SUCCESS).update(
                pay_date=payOrder.close_time,
                pay_type=payOrder.pay_type,
                trade_no=payOrder.trade_no,
                payer_bank_account=payOrder.payer_bank_account,
                into_bank_account=payOrder.into_bank_account,
                status=STATUS_SUCCESS)
        if update:
            projectRechargeRecord = ProjectRechargeRecord()
            projectRechargeRecord.project = self.project
            projectRechargeRecord.date = payOrder.close_time
            projectRechargeRecord.order_id = self.id
            projectRechargeRecord.price0 = self.product.gold
            projectRechargeRecord.price_type = 0
            projectRechargeRecord.save(user_id=self.user_id)

            if hasattr(self, 'contract'):
                from ns_manage.models import CONTRACT_STATUS_PAYED_ARRIVED

                contract = self.contract
                contract.status = CONTRACT_STATUS_PAYED_ARRIVED
                contract.save()
コード例 #2
0
ファイル: models.py プロジェクト: appleface2050/ESNS
    def success(self, payOrder):
        """
        支付成功
        by: 范俊伟 at:2015-03-07
        修改支付处理
        by: 王健 at:2015-03-17
        """
        update = (
            Order.objects.filter(id=self.id)
            .exclude(status=STATUS_SUCCESS)
            .update(
                pay_date=payOrder.close_time,
                pay_type=payOrder.pay_type,
                trade_no=payOrder.trade_no,
                payer_bank_account=payOrder.payer_bank_account,
                into_bank_account=payOrder.into_bank_account,
                status=STATUS_SUCCESS,
            )
        )
        if update:
            projectRechargeRecord = ProjectRechargeRecord()
            projectRechargeRecord.project = self.project
            projectRechargeRecord.date = payOrder.close_time
            projectRechargeRecord.order_id = self.id
            projectRechargeRecord.price0 = self.product.gold
            projectRechargeRecord.price_type = 0
            projectRechargeRecord.save(user_id=self.user_id)

            if hasattr(self, "contract"):
                from ns_manage.models import CONTRACT_STATUS_PAYED_ARRIVED

                contract = self.contract
                contract.status = CONTRACT_STATUS_PAYED_ARRIVED
                contract.save()
コード例 #3
0
ファイル: views_pay.py プロジェクト: cash2one/ESNS
def get_project_balance_base(project_id):
    """
    获取项目的余额信息
    by:王健 at:2015-3-2
    修改 余额获取函数,未来应该写成一个
    by:王健 at:2015-3-15
    以消耗值 和 余额取反了
    by:王健 at:2015-3-16
    :param request:
    :param project_id:
    :return:
    """
    record_list = ProjectRechargeRecord.objects.filter(
        project_id=project_id).order_by('-date')[:1]
    if len(record_list) > 0:
        pre = record_list[0]
    else:
        pre = ProjectRechargeRecord(
            date=datetime.datetime(year=2105, month=1, day=1))
    result = {'total': pre.price2}
    ppcr = ProjectPersonChangeRecord.objects.filter(
        project_id=project_id).order_by('-create_date')[:1]
    if len(ppcr) == 1:
        ppcr = ppcr[0]
    result['price'] = result['total'] - ppcr.commit_value()
    if not result['price']:
        result['price'] = 0
    result['person_nums'] = ppcr.members
    result['days'] = ppcr.commit_days()
    return result
コード例 #4
0
ファイル: view.py プロジェクト: cash2one/ESNS
def add_price_2_project(request):
    """
    测试充值
    by:王健 at:2015-05-08
    :param request:
    :return:
    """
    if settings.ENVIRONMENT != 'aliyun':
        pr = ProjectRechargeRecord()
        pr.project = Project.objects.get(pk=49)
        pr.date = timezone.now()
        pr.order_id = None
        pr.price0 = 10
        pr.price_type = 1
        pr.save(sysmessage=1)
    return HttpResponse("success")
コード例 #5
0
ファイル: view.py プロジェクト: appleface2050/ESNS
def add_price_2_project(request):
    """
    测试充值
    by:王健 at:2015-05-08
    :param request:
    :return:
    """
    if settings.ENVIRONMENT != 'aliyun':
        pr = ProjectRechargeRecord()
        pr.project = Project.objects.get(pk=49)
        pr.date = timezone.now()
        pr.order_id = None
        pr.price0 = 10
        pr.price_type = 1
        pr.save(sysmessage=1)
    return HttpResponse("success")