| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace common\models\alipay;
- use Yii;
- use yii\helpers\Json;
- /**
- * This is the model class for table "qimall_alipay_transfer".
- *
- * @property int $id 订单id
- * @property int $status 状态[-1:删除;0:禁用;1启用]
- * @property int $created_at 创建时间
- * @property int $updated_at 更新时间
- * @property int $mall_id 所属内部系统
- * @property string $request 请求数据
- * @property string $response 响应数据
- * @property string $out_biz_no 单号
- * @property string $type 来源
- */
- class AlipayTransfer extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_alipay_transfer';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['status', 'created_at', 'updated_at', 'mall_id'], 'integer'],
- [['request', 'response'], 'required'],
- [['request', 'response'], 'string'],
- [['out_biz_no'], 'string', 'max' => 36],
- [['type'], 'string', 'max' => 255],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'status' => 'Status',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- 'mall_id' => 'Mall ID',
- 'request' => 'Request',
- 'response' => 'Response',
- 'out_biz_no' => 'Out Biz No',
- ];
- }
- /**
- * 新增记录
- * @param int $mall_id
- * @param string $out_biz_no
- * @param string $type
- * @param array $request
- * @param array $response
- * @return mixed|string|true
- */
- public static function create(int $mall_id, string $out_biz_no, string $type, array $request, array $response)
- {
- $model = new AlipayTransfer();
- $model->mall_id = $mall_id;
- $model->out_biz_no = $out_biz_no;
- $model->type = $type;
- $model->request = Json::encode($request);
- $model->response = Json::encode($response);
- if (!$model->save()) {
- return $model->getError();
- }
- return true;
- }
- }
|