20230419204506_update_customer_state_value.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. use app\model\Customer;
  3. use think\facade\Db;
  4. use think\migration\Migrator;
  5. class UpdateCustomerStateValue 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. Db::query("update fl_customer set state=0 where state in('待确认');");
  31. Db::query("update fl_customer set state=1 where state in('未到访');");
  32. Db::query("update fl_customer set state=2 where state in('已到访', '确认到店', '确定到店', '已到店');");
  33. Db::query("update fl_customer set state=3 where state in('确定到场', '确认到场', '已到场');");
  34. Db::query("update fl_customer set state=4 where state in('已量房', '确定量房', '确认量房');");
  35. Db::query("update fl_customer set state=5 where state in('定金', '交定', '已交定');");
  36. Db::query("update fl_customer set state=6 where state in('签单', '已签单');");
  37. Db::query("update fl_customer set state=7 where state in('无效');");
  38. Db::query("update fl_customer set state=8 where state in('已卖卡');");
  39. }
  40. }