Blame view

domain/device/CreateBatch.php 853 Bytes
931eed21   xu   1. A授权接口开发
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

namespace domain\device;

use Yii;
use domain\device\models\CreateBatch as CreateBatchModel;

class CreateBatch
{
    /**
     * @param $item
     * @return null|object
     * @throws \yii\base\InvalidConfigException
     */
    static function create($item)
    {
        $createBatch = Yii::createObject([
            'class'             => CreateBatchModel::className(),
            'batch_no'          => $item['batch_no'],
            'manufacture_id'    => $item['manufacture_id'],
            'project_id'        => $item['project_id'],
            'model_id'          => $item['model_id'],
            'num'               => $item['num'],
            'production_id'     => $item['production_id'],
        ]);
        if ($createBatch->save()) {
            return $createBatch;
        } else {
            return null;
        }
    }
}