M230423025740QimallAddonsUnionpayRequestLog.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace addons\UnionPay\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230423025740QimallAddonsUnionpayRequestLog
  6. */
  7. class M230423025740QimallAddonsUnionpayRequestLog extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $table = 'qimall_addons_unionpay_request_log';
  16. $sql = "select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
  17. $res = $this->db->createCommand($sql)->execute();
  18. if (!empty($res)) return '';
  19. $sql = "CREATE TABLE `qimall_addons_unionpay_request_log` (
  20. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  21. `mall_id` int(10) NOT NULL COMMENT '商城ID',
  22. `type` varchar(255) NOT NULL DEFAULT '' COMMENT '类型',
  23. `out_trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '订单号',
  24. `oldtrxid` varchar(255) NOT NULL DEFAULT '' COMMENT '原交易的收银宝平台流水',
  25. `trade_type` varchar(255) NOT NULL DEFAULT '' COMMENT 'trade_type',
  26. `randomstr` varchar(32) NOT NULL DEFAULT '' COMMENT '随机字符',
  27. `request_data` longtext COMMENT '请求数据',
  28. `response_data` longtext COMMENT '返回数据',
  29. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  30. `updated_at` int(10) NOT NULL DEFAULT '0',
  31. `created_at` int(10) NOT NULL DEFAULT '0',
  32. PRIMARY KEY (`id`)
  33. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='请求日志表';";
  34. $this->execute($sql);
  35. } catch (\Exception $e) {
  36. }
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function safeDown()
  42. {
  43. echo "M230423025740QimallAddonsUnionpayRequestLog cannot be reverted.\n";
  44. return false;
  45. }
  46. /*
  47. // Use up()/down() to run migration code without a transaction.
  48. public function up()
  49. {
  50. }
  51. public function down()
  52. {
  53. echo "M230423025740QimallAddonsUnionpayRequestLog cannot be reverted.\n";
  54. return false;
  55. }
  56. */
  57. }