<?php
class flow_fund_depositClassModel extends flowModel
{
	
	  public function flowrsreplace($rs)
    {


         if($rs['business_type']){
                $data=$this->db->getone('oa_option',"num='".$rs['business_type']."' and pid=1350");
                $rs['business_type']=$data['name'];
            }
            
    
            return $rs;
        }


	//提交时调用
	protected function flowcheckfinsh($na, $sm){
    	$name=$this->rs['toaccount'];
    	$data=m('c_fund_account')->getone("`name`='$name'");
        $zfarr = array(
                    'account_balance'        =>$this->rs['trans_amount']+$data['account_balance'],
                    );

        m('c_fund_account')->update($zfarr,"`name`='$name'");
    	$id=$this->rs['id'];
    	$account_balance=$this->rs['trans_amount']+$data['account_balance'];//当前余额
    	$detail = array(
    	'account_balance'        =>$account_balance,
    	);
    	m('c_fund_detail')->update($detail,"`id`='$id'");
	                 
	


	     $toacc_detail = array(
                    'account'        => $this->rs['toaccount'],
                    'opt_type'        =>  1,
                    'amount'        => $this->rs['trans_amount'],
                    'account_balance'        =>$data['account_balance']+$this->rs['trans_amount'],
                    'trans_numb'        => $this->rs['trans_numb'],
                    'create_time'  =>$this->rs['create_time'],
                     'uid'  =>$this->rs['uid'],
            );
                m('c_account_detail')->insert($toacc_detail);

                 
	}
	 
}
