20250727172015_wuliu.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. declare(strict_types=1);
  3. use think\migration\db\Column;
  4. use think\migration\Migrator;
  5. class Wuliu extends Migrator
  6. {
  7. /**
  8. * Change Method.
  9. *
  10. * Write your reversible migrations using this method.
  11. *
  12. * More information on writing migrations is available here:
  13. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  14. *
  15. * The following commands can be used in this method and Phinx will
  16. * automatically reverse them when rolling back:
  17. *
  18. * createTable
  19. * renameTable
  20. * addColumn
  21. * renameColumn
  22. * addIndex
  23. * addForeignKey
  24. *
  25. * Remember to call "create()" or "update()" and NOT "save()" when working
  26. * with the Table class.
  27. */
  28. public function change()
  29. {
  30. // {
  31. // "status": "0",/* status 0:正常查询 201:快递单号错误 203:快递公司不存在 204:快递公司识别失败 205:没有信息 207:该单号被限制,错误单号 */
  32. // "msg": "ok",
  33. // "result": {
  34. // "number": "780098068058",
  35. // "type": "zto",
  36. // "list": [{
  37. // "time": "2018-03-09 11:59:26",
  38. // "status": "【石家庄市】快件已在【长安三部】 签收,签收人: 本人,感谢使用中通快递,期待再次为您服务!"
  39. // }, {
  40. // "time": "2018-03-09 09:03:10",
  41. // "status": "【石家庄市】 快件已到达 【长安三部】(0311-85344265),业务员 容晓光(15908220064) 正在第1次派件, 请保持电话畅通,并耐心等待"
  42. // }, {
  43. // "time": "2018-03-08 23:43:44",
  44. // "status": "【石家庄市】 快件离开 【石家庄】 发往 【长安三部】"
  45. // }, {
  46. // "time": "2018-03-08 21:00:44",
  47. // "status": "【石家庄市】 快件到达 【石家庄】"
  48. // }, {
  49. // "time": "2018-03-07 01:38:45",
  50. // "status": "【广州市】 快件离开 【广州中心】 发往 【石家庄】"
  51. // }, {
  52. // "time": "2018-03-07 01:36:53",
  53. // "status": "【广州市】 快件到达 【广州中心】"
  54. // }, {
  55. // "time": "2018-03-07 00:40:57",
  56. // "status": "【广州市】 快件离开 【广州花都】 发往 【石家庄中转】"
  57. // }, {
  58. // "time": "2018-03-07 00:01:55",
  59. // "status": "【广州市】 【广州花都】(020-37738523) 的 马溪 (18998345739) 已揽收"
  60. // }],
  61. // "deliverystatus": "3", /* 0:快递收件(揽件)1.在途中 2.正在派件 3.已签收 4.派送失败 5.疑难件 6.退件签收 */
  62. // "issign": "1", /* 1.是否签收 */
  63. // "expName": "中通快递", /* 快递公司名称 */
  64. // "expSite": "www.zto.com", /* 快递公司官网 */
  65. // "expPhone": "95311", /* 快递公司电话 */
  66. // "courier": "容晓光", /* 快递员 或 快递站(没有则为空)*/
  67. // "courierPhone":"15908220064", /* 快递员电话 (没有则为空) */
  68. // "updateTime":"2019-08-27 13:56:19", /* 快递轨迹信息最新时间 */
  69. // "takeTime":"2天20小时14分", /* 发货到收货消耗时长 (截止最新轨迹) */
  70. // "logo":"https://img3.fegine.com/express/zto.jpg" /* 快递公司LOGO */
  71. // }
  72. //}
  73. $table = $this->table('extension_wuliu', ['comment' => '物流数据']);
  74. $table
  75. ->addColumn('number', 'string', ['limit' => 50, 'default' => '', 'comment' => '快递单号'])
  76. ->addColumn('type', 'string', ['limit' => 32, 'default' => '', 'comment' => '快递公司'])
  77. ->addColumn('list', 'json', ['default' => '[]', 'comment' => '物流信息'])
  78. ->addColumn(Column::tinyInteger('delivery_status')->setUnsigned()->setDefault(0)
  79. ->setComment('物流状态 0:快递收件(揽件)1.在途中 2.正在派件 3.已签收 4.派送失败 5.疑难件 6.退件签收' ))
  80. ->addColumn(Column::tinyInteger('is_sign')->setUnsigned()->setDefault(0)->setComment('是否签收'))
  81. ->addColumn('exp_name', 'string', ['limit' => 100, 'default' => '', 'comment' => '快递公司名称'])
  82. ->addColumn('exp_site', 'string', ['limit' => 255, 'default' => '', 'comment' => '快递公司官网'])
  83. ->addColumn('exp_phone', 'string', ['limit' => 32, 'default' => '', 'comment' => '快递公司电话'])
  84. ->addColumn('courier', 'string', ['limit' => 32, 'default' => '', 'comment' => '快递员'])
  85. ->addColumn('courier_phone', 'string', ['limit' => 32, 'default' => '', 'comment' => '快递员电话'])
  86. ->addColumn(Column::string('take_time')->setDefault('')->setComment('发货到收货消耗时长'))
  87. ->addColumn('logo', 'string', ['limit' => 255, 'default' => '', 'comment' => '快递公司LOGO'])
  88. ->addTimestamps()
  89. ->addIndex('number')
  90. ->create();
  91. }
  92. }