2015_12_21_111514_create_sms_table.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateSmsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. if (!Schema::hasTable('laravel_sms')) {
  15. Schema::create('laravel_sms', function (Blueprint $table) {
  16. $table->increments('id');
  17. //to:用于存储手机号
  18. $table->string('to')->default('');
  19. //temp_id:存储模板标记,用于存储任何第三方服务商提供的短信模板标记/id
  20. $table->string('temp_id')->default('');
  21. //data:模板短信的模板数据,建议json格式
  22. $table->string('data')->default('');
  23. //content:内容
  24. $table->string('content')->default('');
  25. //voice_code:语言验证码code
  26. $table->string('voice_code')->default('');
  27. //发送失败次数
  28. $table->mediumInteger('fail_times')->default(0);
  29. //最后一次发送失败时间
  30. $table->integer('last_fail_time')->unsigned()->default(0);
  31. //发送成功时的时间
  32. $table->integer('sent_time')->unsigned()->default(0);
  33. //代理器使用日志,记录每个代理器的发送状态,可用于排错
  34. $table->text('result_info')->nullable();
  35. $table->timestamps();
  36. $table->softDeletes();
  37. $table->engine = 'InnoDB';
  38. //说明
  39. //1:temp_id和data用于发送模板短信。
  40. //2:content用于直接发送短信内容,不使用模板。
  41. //3:voice_code用于存储语言验证码code。
  42. });
  43. }
  44. }
  45. /**
  46. * Reverse the migrations.
  47. *
  48. * @return void
  49. */
  50. public function down()
  51. {
  52. Schema::dropIfExists('laravel_sms');
  53. }
  54. }