32], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'merchant_no' => 'Merchant No', 'trade_id' => 'Trade ID', 'trade_type' => 'Trade Type', 'sys_order_no' => 'Sys Order No', 'trx_no' => 'Trx No', 'fee' => 'Fee', 'status' => 'Status', 'updated_at' => 'Updated At', 'created_at' => 'Created At', ]; } /** * 支付流水记录表 * * @return ActiveQuery */ public function getTrade() { return $this->hasOne(PaymentTrade::class, ['id' => 'trade_id']); } /** * 添加分账支付记录 * * @param array $data * [ * 'mall_id' => 'Mall ID', * 'merchant_no' => 'Merchant No', * 'trade_id' => 'Trade ID', * 'trade_type' => 'Trade Type', * 'sys_order_no' => 'Sys Order No', * 'trx_no' => 'Trx No' * 'fee' => 'Fee' * 'status' => 'Status' * ] * @return OrderModel */ public static function addLog($data = []) { if ( isset($data['trade_id']) && self::find()->where(['trade_id' => $data['trade_id']])->select('id')->one() ) { return true; } $data['created_at'] = $data['updated_at'] = time(); $model = new self(); $model->load($data, ''); return $model->save(); } /** * 支付成功 * * @return void */ public function success() { $this->status = StatusEnum::STATUS_100; $this->updated_at = time(); return $this->save(); } }