<?php
/**
 * Created by PhpStorm.
 * User: stanley-king
 * Date: 2017/7/9
 * Time: 下午10:19
 */

namespace statistics;

class statcall extends stat_base
{
    public function __construct($stime)
    {
        parent::__construct($stime);
    }

    public function read()
    {
        $this->calc_time(stat_base::cur_date_type);
        $result = $this->mModel->get_one($this->mDateId,'call_record',true);
        if(empty($result)) {
            return false;
        }
        else
        {
            $record = $result['call_record'];
            if(empty($record)) {
                return false;
            } else {
                return json_decode($record,true);
            }
        }
    }
    public function update($data)
    {
        $this->calc_time(stat_base::cur_date_type);
        $result = $this->mModel->get_one($this->mDateId,'call_record',true);
        $fEdit = empty($result) ? false : true;
        return $this->save($fEdit,['call_record' => json_encode($data)]);
    }
}