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Fu5HNm1MOE6IdlZMY1QVdJMBeIVL4pm5n4oO7CMskJpyMy6yyD2kZz3eCndJ+gQL7zVjYMyEGo1afIopS2hRC98ulOFsDOIyRgdeC5BOTJ0XYxVpdoGidnDe4o7w+ODv+kiEQn/Yf98EC6VYfk1wT5yJGK/JzEBLdJGji5VL4pmOmghO7QosfmpyGNFyYockdo+v4Jdp+RQXAEVJTJUTd9PJDUUvCzFsAZSLb22s+5VLDxvsd93adX2cGpZSGm6JAUMJig0jdH6OSR684xNB5AdAMt3Z8TB6Vw8GL845stvJtwg1PG+8SFAWreI52LHPLtR3s74I97k2vk2LDzsB6PYeGu5pPE/pp+GX3tqk7bppfQILRQtwBaWsxUdbfq3jYXUcGpMyQO4pARUJDo0HD6dLSR2sYZ5bSADr0OSccUPreZUeT7qe4kG8nQQtLyG6VYzMj1AhfYcU2Fw70iOreFw7eue1jc/W54V8sGFWVVsuy7r28L/EDK7yYg5LbB2y7eZePKDL2J1kR5ekToMyQOAcTKgeB94HAbdLSOFkfU9lYptJGKtzfzWRB2qpSpPeYogy4v8ac6Bn7QlLSz8TGKhjT2ueBo4xdHvEA5Wj7x4pcbQ0GvVp4p/p+9VpDUUObqLXUv5umx9yAkFsHZ6LhXIkcO6XYm2JnxGXGbULhOGw+K8vfOWjYZocBNFwGM1k7zBwfmUe7pAsnmGp46qaYOGuBRQJAqGwlq8jYg70Bo8sCkRkAh1eCnjJA/7pBq1sdOdemxBaCQjMV4Z8aFDaI6Pt8zIURCpABQgcYN8XYxVpdoGXGbUegOGaYKavnqWeYZoYf9HSAa7YnW1X6b6+76NldoBKhU=');

还原代码

<?php
/**
 * 扣费模型
 */
class AdPayModel
{
    /**
     * 每日广告数据统计
     * 进行每日扣款
     * 更新地区行业投放数据
     */
    public function advertPay($t, $t1)
    {
        $map_ad_pay['w_time'] = array(array('egt', $t), array('lt', $t1));
        $map_ad_pay['pay'] = array('egt', 0);
        $map_ad_pay['status'] = 0;//未进行扣费的
        $ad_pays = M('w_ad_pay')->where($map_ad_pay)->select();
        
        //更新广告数据
        foreach ($ad_pays as $item)
        {
            M()->startTrans();
            $ad = M('w_ad')->find($item['ad_id']);
            //扣款步骤
            if($item['ad_id']&&$ad&&!$item['status'])
            {
                $data = null;
                $data['day_views'] = $ad['day_views']-$item['views'];//累计每日浏览量-昨日累计浏览=今日浏览
                $data['total_views'] = array('exp','total_views+'.$item['views']);
                $day_pay = $item['pay'];//今日扣款总额
                $remark='[广告每日结算]:['.$ad['id'].']'.date('Y-m-d', $t);
                if($ad['is_admin']!='1')
                {
                    $data['total_v_pay'] = array('exp','total_v_pay+'.$item['pay']);
                    $data['day_v_pay'] = $ad['day_v_pay']-$item['pay'];//累计每日浏览量-昨日累计浏览=今日浏览
                    //检查广告商账户预付款
                    $ad_user = M('User')->where(array('id'=>$ad['user_id']))->find();
                    $result['status'] = true;
                    //先扣赠送款
                    if($item['free_money']>0)
                    {
                        $rs = lockChangeAccountRemain(-$item['free_money'], 'free_money', 11, $remark.'[赠送款]', $ad_user['username'], 'w_ad_pay', $item['id']);
                        $result['status'] = $result['status']&& $rs['status'];
                    }
                    //预付款
                    if($item['imprest']>0)
                    {
                        $rs = lockChangeAccountRemain(-$item['imprest'], 'imprest', 11, $remark.'[预付款]', $ad_user['username'], 'w_ad_pay', $item['id']);
                        $result['status'] = $result['status']&& $rs['status'];
                    }
                    //广告费
                    if($item['ad_money']>0)
                    {
                        $rs = lockChangeAccountRemain(-$item['ad_money'], 'ad_money', 11, $remark.'[广告费]', $ad_user['username'], 'w_ad_pay', $item['id']);
                        $result['status'] = $result['status']&& $rs['status'];
                    }
                    if(!$result['status'])//账户余额不足,设置预存款时不会执行该方法
                    {
                        $data['use'] = 0;//扣费失败广告下架
                    }
                    else//扣款成功
                    {
                        /**
                         * 更新已入账奖金
                         */
                        $rs = M('w_ad_pay')->where(array('id'=>$item['id']))->save(array('status'=>1));
                        if($rs!==false)
                        {
                            $map_b['w_time'] = array(array('egt', $t), array('lt', $t1));
                            $bonus_cmp = M('w_bonus_company')->lock(true)->where($map_b)->find();
                            if($bonus_cmp)
                            {
                                $bonus_cmp['pay_imprest'] = $bonus_cmp['pay_imprest']>0?$bonus_cmp['pay_imprest']+$item['imprest']:$item['imprest'];
                                $bonus_cmp['pay_ad_money'] = $bonus_cmp['pay_ad_money']>0?$bonus_cmp['pay_ad_money']+$item['ad_money']:$item['ad_money'];
                                $day_true_pay = (1-$this->city_income*(1+$this->borker_area_income)-$this->county_income*(1+$this->borker_area_income))*$item['imprest']+$item['ad_money'];//真实钱币获得 70%预付款+广告费
                                $bonus_cmp['pay_money'] = $bonus_cmp['pay_money']>0?$bonus_cmp['pay_money']+$day_true_pay:$day_true_pay;
                                $rs = M('w_bonus_company')->save($bonus_cmp);//奖金纪录

                            }
                            else
                            {
                                $day_true_pay = (1-$this->city_income*(1+$this->borker_area_income)-$this->county_income*(1+$this->borker_area_income))*$item['imprest']+$item['ad_money'];//真实钱币获得 70%预付款+广告费
                                if($day_true_pay>0)
                                {
                                    $bonus_cmp['pay_imprest'] = $item['imprest'];
                                    $bonus_cmp['pay_ad_money'] = $item['ad_money'];
                                    $bonus_cmp['pay_money'] = $day_true_pay;
                                    $rs = M('w_bonus_company')->add($bonus_cmp);//奖金纪录
                                }

                            }
                            if($rs===false)
                            {
                                M()->rollback();
                                throw_exception('公司广告统计记录写入失败!'.M()->_sql());
                            }
                        }
                        else
                        {
                            M()->rollback();
                            throw_exception('公司广告统计记录写入失败!'.M()->_sql());
                        }
                    }
                }
                $rs = M('wAd')->where('id='.$ad['id'])->save($data);//广告更新
                if($rs===false)
                {
                    M()->rollback();
                    throw_exception('广告记录更新失败!'.M()->_sql());
                }
            }
            M()->commit();
        }
        //更新地区行业数据
        $ad_pay_areas = M('w_ad_pay_area')->where($map_ad_pay)->select();
        foreach ($ad_pay_areas as $item)
        {
            $map['ad_id'] = $item['ad_id'];
            $map['throw_area'] = $item['throw_area'];
            $ad_throw_area = M('w_ad_throw_area')->where($map)->find();

            //更新地区行业数据
            if($ad_throw_area&&!$ad_throw_area['status'])
            {
                $data = null;
                $data['day_views'] = $ad['day_views']-$item['views'];//累计每日浏览量-昨日累计浏览=今日浏览
                $data['day_pay'] = $ad['day_pay']-$item['pay'];//累计每日浏览量-昨日累计浏览=今日浏览
                $data['totay_pay'] = array('exp','totay_pay+'.$item['pay']);
                $data['status'] = '1';
                M('w_ad_throw_area')->where(array('id'=>$ad_throw_area['id']))->save($data);//广告更新
            }
        }
    }

}
?>

其他php-screw加密也可解,更多详细请关注QQ群 233415606


xingqiba
35 声望1 粉丝