50], [['shipping_id'], 'string', 'max' => 10], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'id', 'order_id' => '订单id', 'shipping_name' => '货流名称', 'shipping_id' => '运货单位', 'type' => '类型', 'goods' => '商品', 'status' => '状态', 'decription' => '描述', 'updated_at' => '更新时间', 'created_at' => '创建时间', ]; } /** * @author linyao * @email 602604991@qq.com * @created Nov 8, 2019 * * 行为存储创建时间和更新时间 */ public function behaviors() { return [ [ 'class' => TimestampBehavior::className(), 'createdAtAttribute' => 'created_at', 'updatedAtAttribute' => 'updated_at', 'value' => function() { return time(); }, ], ]; } /** * @param $column * @param null $value * @return bool * 获取各状态数组 */ public static function dropDown($column, $value = null) { $dropDownList = [ 'type' => [ self::TYPE_SHIPMENT_ALL => '全部发货', self::TYPE_SHIPMENT_PORTION => '部分发货', ], ]; //根据具体值显示对应的值 if ($value !== null) return array_key_exists($column, $dropDownList) ? $dropDownList[$column][$value] : false; //返回关联数组,用户下拉的filter实现 else return array_key_exists($column, $dropDownList) ? $dropDownList[$column] : false; } }