File.php 1.08 KB
<?php

namespace app\admin\controller\antis\contract;

use addons\antis\model\Invoice;
use app\admin\controller\antis\Base;

class File extends Base
{
    public function _initialize() {
        parent::_initialize();
        $this->model = new Invoice();
    }


    public function addz()
    {

        if (false === $this->request->isPost()) {
            return $this->view->fetch();
        }

        $param = $this->request->param();


        $file_id = \addons\antis\model\File::getId($param['row']['files']);

        $file = \addons\antis\model\File::where('id',$file_id)->find();

        $data = [
            'name'=>$param['name'],
            'files'=>$file['file_path'],
            'price'=>$param['price'],
            'num'=>$param['num'],
            'enter'=>$param['enter'],


            'contract_id'=>$param['contract_id'],
            'customer_id'=>$param['customer_id'],


            'createtime'=>time()
        ];

        //halt($data);


        $this->model->save($data);

        $this->success();

    }



}