| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace addons\UnionPay\common\models;
- use common\enums\StatusEnum;
- use common\models\base\BaseActiveRecord;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_unionpay_request_log".
- *
- * @property int $id
- * @property int $mall_id 商城ID
- * @property string $type 类型
- * @property string $out_trade_no 订单号
- * @property string $oldtrxid 原交易的收银宝平台流水
- * @property string $trade_type trade_type
- * @property string $randomstr 随机字符
- * @property string|null $request_data 请求数据
- * @property string|null $response_data 返回数据
- * @property int $status 状态
- * @property int $updated_at
- * @property int $created_at
- */
- class UnionpayRequestLog extends BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_unionpay_request_log}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'type'], 'required'],
- [['mall_id', 'status', 'updated_at', 'created_at'], 'integer'],
- [['request_data', 'response_data'], 'string'],
- [['type', 'out_trade_no', 'oldtrxid', 'trade_type'], 'string', 'max' => 255],
- [['randomstr'], 'string', 'max' => 32],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => '商城ID',
- 'type' => '类型',
- 'out_trade_no' => '订单号',
- 'oldtrxid' => '原交易的收银宝平台流水',
- 'trade_type' => 'trade_type',
- 'randomstr' => '随机字符',
- 'request_data' => '请求数据',
- 'response_data' => '返回数据',
- 'status' => '状态',
- 'updated_at' => 'Updated At',
- 'created_at' => 'Created At',
- ];
- }
- public static function setData(int $mall_id, array $data)
- {
- $model = new self();
- $model->loadDefaultValues();
- $model->mall_id = $mall_id;
- if (!$model->load($data, '')) throw new \Exception($model->getErrorMessage());
- if (!$model->save()) {
- Yii::error(';;;;;;;;;;;;;;'.$model->getErrorMessage());
- return false;
- }
- return $model;
- }
- }
|