64], [['title'], 'string', 'max' => 128], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'cx_mch_id' => '平台商户ID', 'user_id' => '用户ID', 'order_no' => '订单号', 'amount' => '订单金额', 'is_pay' => '支付状态:0=未支付,1=已支付', 'pay_type' => '支付方式', 'title' => '支付摘要', 'support_pay_types' => '支持的支付方式(JSON)', 'created_at' => '添加时间', 'updated_at' => '更新时间', 'out_trade_no' => '商户订单号', 'transaction_id' => '交易流水号', ]; } public function beforeSave($insert) { if(parent::beforeSave($insert)){ if($this->isNewRecord){ $this->created_at = time(); } $this->updated_at = time(); $this->htmlTagFilter(); return true; } else { return false; } } public function htmlTagFilter() { $this->title = Model::htmlTagFilter($this->title); } public function encodeSupportPayTypes($data) { $serializer = new \app\components\Serializer(); return $serializer->encode($data); } public function decodeSupportPayTypes($data) { $serializer = new \app\components\Serializer(); return $serializer->decode($data); } public function getPaymentOrder() { return $this->hasMany(PaymentOrder::className(), ['payment_order_union_id' => 'id']); } }