2048], [['order_no'], 'string', 'max' => 128], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'cx_mch_id' => '平台商户ID', 'scene' => '场景类型', 'type' => '类型:1=收入,2=支出', 'user_id' => '用户ID', 'integral' => '积分', 'before_account_integral' => '变化前账户积分', 'after_account_integral' => '变化后账户积分', 'desc' => '描述', 'order_type' => '订单类型', 'order_no' => '订单号', 'ext' => '扩展信息', 'created_at' => '添加时间', ]; } public function beforeSave($insert) { if(parent::beforeSave($insert)){ if($this->isNewRecord){ $this->created_at = time(); } return true; } else { return false; } } }