increments('id')->comment('企业ID'); $table->integer('parent_id')->unsigned()->default(0)->comment('父级ID'); $table->string('sn', 20)->comment('套餐编号'); $table->string('name', 32)->comment('套餐名称'); $table->tinyInteger('type')->unsigned()->default(255)->comment('套餐类型(0:基础套餐 1:续费包 2:加油包 3:可选包 4:附加包)'); $table->tinyInteger('carrier_operator')->unsigned()->default(255)->comment('运营商(0:联通 1:移动 2:电信)'); $table->integer('cost_price')->unsigned()->default(0)->comment('成本价格'); $table->integer('guide_price')->unsigned()->default(0)->comment('指导价格'); $table->integer('flows')->unsigned()->default(0)->comment('套餐流量(M)'); $table->integer('voices')->unsigned()->default(0)->comment('套餐语音(分钟)'); $table->integer('messages')->unsigned()->default(0)->comment('套餐短信(条)'); $table->tinyInteger('has_messages')->unsigned()->default(255)->comment('是否开通短信服务(0:无 1:有)'); $table->tinyInteger('has_lbs')->unsigned()->default(255)->comment('是否开通LBS服务(0:无 1:有)'); $table->tinyInteger('reset_months')->unsigned()->default(0)->comment('重置周期(月)'); $table->tinyInteger('service_months')->unsigned()->default(0)->comment('套餐周期(月)'); $table->tinyInteger('effect_months')->unsigned()->default(0)->comment('生效延迟周期(月)'); $table->tinyInteger('delay_months')->unsigned()->default(0)->comment('服务延长周期(月)'); $table->text('description')->nullable()->comment('描述'); $table->timestamps(); $table->softDeletes(); $table->unique(['sn', 'deleted_at']); $table->index('name'); $table->index('parent_id'); $table->index('type'); $table->index('carrier_operator'); $table->comment("RD套餐"); }); Schema::create('real_orders', function (Blueprint $table) { $table->increments('id')->comment('订单ID'); $table->string('sn', 64)->comment('订单编号'); $table->tinyInteger('type')->unsigned()->default(0)->comment('订单类型(0:基础订单 1:套餐续费 2:续费包 3:加油包 4:可选包 5:附加包)'); $table->integer('company_id')->unsigned()->default(0)->comment("企业ID"); $table->integer('package_id')->unsigned()->default(0)->comment("套餐ID"); $table->string('transaction_no', 64)->comment('交易流水号'); $table->string('pay_channel', 20)->default('')->comment('支付频道'); $table->integer('unit_price')->unsigned()->default(0)->comment('单价'); $table->integer('counts')->unsigned()->default(0)->comment('数量'); $table->integer('total_price')->unsigned()->default(0)->comment('总价'); $table->timestamp('order_at')->nullable()->comment('下单时间'); $table->string('address')->default('')->comment('收货地址'); $table->string('contacts')->default('')->comment('联系人'); $table->string('mobile')->default('')->comment('电话'); $table->text('logistics_remark')->nullable()->comment('物流备注'); $table->text('remark')->nullable()->comment('订单备注'); $table->timestamps(); $table->softDeletes(); $table->unique(['sn', 'deleted_at']); $table->index('type'); $table->index(['company_id', 'package_id']); $table->index('order_at'); $table->comment('RD订单'); }); Schema::create('real_order_cards_table_partition', function (Blueprint $table) { $table->increments('id')->comment('关联表ID'); $table->tinyInteger('type')->unsigned()->default(0)->comment('订单类型(1:套餐续费 2:续费包 3:加油包 4:可选包 5:附加包)'); $table->bigInteger('sim')->unsigned()->default(0)->comment('sim号'); $table->integer('order_id')->unsigned()->default(0)->comment('订单ID'); $table->integer('company_id')->unsigned()->default(0)->comment('企业ID'); $table->integer('package_id')->unsigned()->default(0)->comment('套餐ID'); $table->integer('counts')->unsigned()->default(0)->comment('数量'); $table->integer('unit_price')->unsigned()->default(0)->comment('单价'); $table->timestamps(); $table->softDeletes(); $table->comment("RD订单企业套餐卡关联表"); $table->partition('type', 'list'); $table->addPartition('real_order_cards', 'list', [0]); $table->addPartition('real_order_renewal_cards', 'list', [1]); $table->addPartition('real_order_renewal_package_cards', 'list', [2]); $table->addPartition('real_order_flows_package_cards', 'list', [3]); $table->addPartition('real_order_optional_package_cards', 'list', [4]); $table->addPartition('real_order_additional_package_cards', 'list', [5]); }); Schema::table('real_order_cards', function (Blueprint $table) { $table->unique(['sim', 'order_id']); $table->unique(['sim', 'deleted_at']); }); Schema::table('real_order_renewal_cards', function (Blueprint $table) { $table->unique(['sim', 'order_id']); }); Schema::table('real_order_renewal_package_cards', function (Blueprint $table) { $table->unique(['sim', 'order_id']); }); Schema::table('real_order_flows_package_cards', function (Blueprint $table) { $table->unique(['sim', 'order_id']); }); Schema::table('real_order_optional_package_cards', function (Blueprint $table) { $table->unique(['sim', 'order_id']); }); Schema::table('real_order_additional_package_cards', function (Blueprint $table) { $table->unique(['sim', 'order_id']); });