RD数据库设计
This commit is contained in:
parent
9d3e4cb577
commit
d22f743b18
10
.env.example
10
.env.example
@ -14,11 +14,11 @@ DB_DATABASE=vd
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=root
|
||||
|
||||
DB_TD_HOST=rm-bp13y52rav2jc6952o.mysql.rds.aliyuncs.com
|
||||
DB_TD_PORT=3306
|
||||
DB_TD_DATABASE=ckb_jxc
|
||||
DB_TD_USERNAME=root
|
||||
DB_TD_PASSWORD=Fxft123456
|
||||
DB_REAL_HOST=rm-bp13y52rav2jc6952o.mysql.rds.aliyuncs.com
|
||||
DB_REAL_PORT=3306
|
||||
DB_REAL_DATABASE=ckb_jxc
|
||||
DB_REAL_USERNAME=root
|
||||
DB_REAL_PASSWORD=Fxft123456
|
||||
|
||||
DB_MONGO_DSN=mongodb://root:Fxft2017@dds-bp104401edaca7e41595-pub.mongodb.rds.aliyuncs.com:3717,dds-bp104401edaca7e42171-pub.mongodb.rds.aliyuncs.com:3717/admin?replicaSet=mgset-3015103
|
||||
DB_MONGO_DATABASE=CardInfo
|
||||
|
@ -7,6 +7,7 @@ use Illuminate\Config\Repository;
|
||||
class Dicts extends Repository
|
||||
{
|
||||
const DICTS = [
|
||||
'has' => ['无', '有'],
|
||||
'sex' => ['未知', '男', '女'],
|
||||
'params' => ['limit', 'page', 'search', 'searchFields', 'filter', 'orderBy', 'sortedBy', 'with', 'searchJoin'],
|
||||
'horoscope' => ['未知', '水瓶座', '双鱼座', '白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天秤座', '天蝎座', '射手座', '摩羯座'],
|
||||
@ -17,6 +18,11 @@ class Dicts extends Repository
|
||||
'permission_status' => ['关闭', '启用'],
|
||||
'week' => ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
|
||||
'weekIso' => ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||
'pay_type' => ['微信支付', '支付宝', '银行转账'],
|
||||
'carrier_operator' => ['联通', '移动', '电信'],
|
||||
'service_type' => ['套餐开通', '套餐续费', '套餐更换', '套餐销售'],
|
||||
'card_status' => ['测试期', '沉默期', '服务期', '已注销'],
|
||||
'bloc_channel' => ['运营商', '中间商'],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
|
@ -34,6 +34,8 @@ class CreateLogs extends Migration
|
||||
|
||||
$table->primary('id');
|
||||
});
|
||||
|
||||
db_alter('logs', '日志表');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateRealTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('real_companies', function (Blueprint $table) {
|
||||
$table->string('id', 20)->comment('企业编号');
|
||||
$table->string('name', 32)->comment('企业名称');
|
||||
$table->timestamps();
|
||||
|
||||
$table->primary('id');
|
||||
$table->index('name');
|
||||
});
|
||||
|
||||
db_alter('real_companies', 'RD企业');
|
||||
|
||||
Schema::create('real_blocs', function (Blueprint $table) {
|
||||
$table->string('id', 20)->comment('集团编号');
|
||||
$table->string('name', 32)->comment('集团名称');
|
||||
$table->tinyInteger('carrier_operator')->comment('运营商(0:联通 1:移动 2:电信)');
|
||||
$table->string('city')->comment('城市');
|
||||
$table->tinyInteger('channel')->comment('渠道(0:运营商 1:中间商)');
|
||||
$table->timestamps();
|
||||
|
||||
$table->primary('id');
|
||||
$table->index('name');
|
||||
$table->index('carrier_operator');
|
||||
});
|
||||
|
||||
db_alter('real_blocs', 'RD来源集团');
|
||||
|
||||
Schema::create('real_packages', function (Blueprint $table) {
|
||||
$table->string('id', 20)->comment('套餐编号');
|
||||
$table->string('parent_id', 20)->comment('父级编号');
|
||||
$table->string('name', 32)->comment('套餐名称');
|
||||
$table->tinyInteger('type')->unsigned()->default(0)->comment('套餐类型(0:基础套餐 1:续费包 2:加油包 3:可选包 4:附加包)');
|
||||
$table->tinyInteger('carrier_operator')->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_message_switch')->unsigned()->default(0)->comment('短信开关(0:无 1:有)');
|
||||
$table->tinyInteger('has_lbs')->unsigned()->default(0)->comment('lbs位置服务(0:无 1:有)');
|
||||
$table->tinyInteger('flow_cycles')->unsigned()->default(0)->comment('流量周期(月)');
|
||||
$table->tinyInteger('package_cycles')->unsigned()->default(0)->comment('套餐周期(月)');
|
||||
$table->timestamps();
|
||||
|
||||
$table->primary('id');
|
||||
$table->index('name');
|
||||
$table->index('parent_id');
|
||||
$table->index('type');
|
||||
$table->index('carrier_operator');
|
||||
});
|
||||
|
||||
db_alter('real_packages', 'RD套餐');
|
||||
|
||||
// 企业套餐关联表
|
||||
Schema::create('real_company_has_packages', function (Blueprint $table) {
|
||||
$table->string('company_id', 20)->comment('企业编号');
|
||||
$table->string('package_id', 20)->comment('套餐编号');
|
||||
$table->primary(['company_id', 'package_id']);
|
||||
});
|
||||
|
||||
db_alter('real_company_has_packages', 'RD企业套餐关联表');
|
||||
|
||||
Schema::create('cards', function (Blueprint $table) {
|
||||
$table->string('sim', 20)->comment('sim号');
|
||||
$table->string('imei', 20)->comment('imei号');
|
||||
$table->string('iccid', 20)->comment('iccid号');
|
||||
$table->string('real_company_id', 20)->comment('RD企业编号');
|
||||
$table->string('real_package_id', 20)->comment('RD套餐编号');
|
||||
$table->string('real_bloc_id', 20)->comment('RD来源集团编号');
|
||||
$table->integer('real_price')->unsigned()->default(0)->comment('RD售价');
|
||||
$table->tinyInteger('carrier_operator')->comment('运营商(0:联通 1:移动 2:电信)');
|
||||
$table->string('virtual_company_id', 20)->comment('VD企业编号');
|
||||
$table->string('virtual_package_id', 20)->comment('VD套餐编号');
|
||||
$table->integer('virtual_price')->unsigned()->default(0)->comment('VD售价');
|
||||
$table->timestamp('activate_at')->nullable()->comment('激活时间');
|
||||
$table->timestamps();
|
||||
|
||||
$table->primary('sim');
|
||||
$table->index('imei');
|
||||
$table->index('iccid');
|
||||
$table->index('real_company_id');
|
||||
$table->index('real_package_id');
|
||||
$table->index('real_bloc_id');
|
||||
$table->index('carrier_operator');
|
||||
$table->index('virtual_company_id');
|
||||
$table->index('virtual_package_id');
|
||||
$table->index('activate_at');
|
||||
});
|
||||
|
||||
db_alter('cards', '卡基础信息表');
|
||||
|
||||
Schema::create('real_orders', function (Blueprint $table) {
|
||||
$table->string('id', 20)->comment('订单编号');
|
||||
$table->tinyInteger('type')->unsigned()->default(0)->comment('套餐类型(0:基础套餐 1:续费包 2:加油包 3:可选包 4:附加包)');
|
||||
$table->string('company_id', 20)->comment('RD企业编号');
|
||||
$table->string('package_id', 20)->comment('RD套餐编号');
|
||||
$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->timestamp('service_start_at')->nullable()->comment('服务开始时间');
|
||||
$table->timestamp('service_end_at')->nullable()->comment('服务结束时间');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('type');
|
||||
$table->index('company_id');
|
||||
$table->index('package_id');
|
||||
$table->index('order_at');
|
||||
});
|
||||
|
||||
db_alter('real_orders', 'RD订单');
|
||||
|
||||
// 卡关联基础订单
|
||||
Schema::create('real_order_base_card_relations', function (Blueprint $table) {
|
||||
$table->string('orders_id', 20)->comment('订单编号');
|
||||
$table->string('sim', 20)->comment('sim卡号');
|
||||
$table->primary(['orders_id', 'sim']);
|
||||
});
|
||||
|
||||
db_alter('real_order_base_card_relations', 'RD卡关联基础订单');
|
||||
|
||||
// 卡关联续费订单
|
||||
Schema::create('real_order_renewal_card_relations', function (Blueprint $table) {
|
||||
$table->string('orders_id', 20)->comment('订单编号');
|
||||
$table->string('sim', 20)->comment('sim卡号');
|
||||
$table->primary(['orders_id', 'sim']);
|
||||
});
|
||||
|
||||
db_alter('real_order_renewal_card_relations', 'RD卡关联续费订单');
|
||||
|
||||
// 卡关联加油包订单
|
||||
Schema::create('real_order_flows_card_relations', function (Blueprint $table) {
|
||||
$table->string('orders_id', 20)->comment('订单编号');
|
||||
$table->string('sim', 20)->comment('sim卡号');
|
||||
$table->primary(['orders_id', 'sim']);
|
||||
});
|
||||
|
||||
db_alter('real_order_flows_card_relations', 'RD卡关联加油包订单');
|
||||
|
||||
// 卡关联可选包订单
|
||||
Schema::create('real_order_optional_card_relations', function (Blueprint $table) {
|
||||
$table->string('orders_id', 20)->comment('订单编号');
|
||||
$table->string('sim', 20)->comment('sim卡号');
|
||||
$table->primary(['orders_id', 'sim']);
|
||||
});
|
||||
|
||||
db_alter('real_order_optional_card_relations', 'RD卡关联可选包订单');
|
||||
|
||||
// 卡关联附加订单
|
||||
Schema::create('real_order_additional_card_relations', function (Blueprint $table) {
|
||||
$table->string('orders_id', 20)->comment('订单编号');
|
||||
$table->string('sim', 20)->comment('sim卡号');
|
||||
$table->primary(['orders_id', 'sim']);
|
||||
});
|
||||
|
||||
db_alter('real_order_additional_card_relations', 'RD卡关联附加订单');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('real_order_additional_card_relations');
|
||||
Schema::dropIfExists('real_order_optional_card_relations');
|
||||
Schema::dropIfExists('real_order_flows_card_relations');
|
||||
Schema::dropIfExists('real_order_renewal_card_relations');
|
||||
Schema::dropIfExists('real_order_base_card_relations');
|
||||
Schema::dropIfExists('real_orders');
|
||||
Schema::dropIfExists('cards');
|
||||
Schema::dropIfExists('real_company_has_packages');
|
||||
Schema::dropIfExists('real_packages');
|
||||
Schema::dropIfExists('real_blocs');
|
||||
Schema::dropIfExists('real_companies');
|
||||
}
|
||||
}
|
@ -1,24 +1,24 @@
|
||||
<?php
|
||||
namespace App\Domains\True\Providers;
|
||||
namespace App\Domains\Real\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Domains\True\Providers\RouteServiceProvider;
|
||||
use App\Domains\Real\Providers\RouteServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
|
||||
|
||||
class TrueServiceProvider extends ServiceProvider
|
||||
class RealServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* 引导启动任何应用程序服务
|
||||
*
|
||||
* php artisan make:migration --path=app/Domains/True/Database/migrations
|
||||
* php artisan make:migration --path=app/Domains/Real/Database/migrations
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// $this->loadMigrationsFrom([realpath(__DIR__ . '/../Database/migrations')]);
|
||||
$this->loadMigrationsFrom([realpath(__DIR__ . '/../Database/migrations')]);
|
||||
// $this->app->make(EloquentFactory::class)->load(realpath(__DIR__ . '/../Database/factories'));
|
||||
// $this->mergeConfigFrom(realpath(__DIR__ . '/../config.php'), 'domain.true');
|
||||
// $this->mergeConfigFrom(realpath(__DIR__ . '/../config.php'), 'domain.real');
|
||||
}
|
||||
|
||||
/**
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace App\Domains\True\Providers;
|
||||
namespace App\Domains\Real\Providers;
|
||||
|
||||
use Dipper\Foundation\Core\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
@ -11,7 +11,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
public function boot()
|
||||
{
|
||||
$app = $this->app;
|
||||
$namespace = 'App\Domains\True\Http\Controllers';
|
||||
$namespace = 'App\Domains\Real\Http\Controllers';
|
||||
$pathApi = __DIR__.'/../Routes/api.php';
|
||||
$pathWeb = __DIR__.'/../Routes/web.php';
|
||||
|
15
app/Domains/Real/Routes/api.php
Normal file
15
app/Domains/Real/Routes/api.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
// Prefix: /api/reals
|
||||
$router->group(['prefix' => 'reals', 'as' => 'reals'], function($router) {
|
||||
|
||||
// The controllers live in Domains/Real/Http/Controllers
|
||||
$router->get('/', ['as' => 'index', 'uses' => 'RealController@index']);
|
||||
|
||||
/**
|
||||
* 需要认证的接口
|
||||
*/
|
||||
// $router->group(['middleware' => ['adminAuth']], function($router) {
|
||||
// // $router->post('delete', ['as' => 'delete', 'uses' => 'RealController@delete']);
|
||||
// });
|
||||
});
|
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
$router->group(['prefix' => 'trues', 'as' => 'trues'], function($router) {
|
||||
$router->group(['prefix' => 'reals', 'as' => 'reals'], function($router) {
|
||||
|
||||
// The controllers live in Domains/True/Http/Controllers
|
||||
// $router->get('/', ['as' => 'index', 'uses' => 'TrueController@index']);
|
||||
// The controllers live in Domains/Real/Http/Controllers
|
||||
// $router->get('/', ['as' => 'index', 'uses' => 'RealController@index']);
|
||||
|
||||
/**
|
||||
* 需要认证的接口
|
||||
*/
|
||||
// $router->group(['middleware' => ['userAuth']], function($router) {
|
||||
// // $router->post('delete', ['as' => 'delete', 'uses' => 'TrueController@delete']);
|
||||
// // $router->post('delete', ['as' => 'delete', 'uses' => 'RealController@delete']);
|
||||
// });
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "app/true",
|
||||
"name": "app/real",
|
||||
"description": "",
|
||||
"type": "app-domain",
|
||||
"require": {
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTrueTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Prefix: /api/trues
|
||||
$router->group(['prefix' => 'trues', 'as' => 'trues'], function($router) {
|
||||
|
||||
// The controllers live in Domains/True/Http/Controllers
|
||||
$router->get('/', ['as' => 'index', 'uses' => 'TrueController@index']);
|
||||
|
||||
/**
|
||||
* 需要认证的接口
|
||||
*/
|
||||
// $router->group(['middleware' => ['adminAuth']], function($router) {
|
||||
// // $router->post('delete', ['as' => 'delete', 'uses' => 'TrueController@delete']);
|
||||
// });
|
||||
});
|
60
app/Models/Card.php
Normal file
60
app/Models/Card.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Core\Model;
|
||||
use App\Models\Real\Order as RealOrder;
|
||||
use App\Models\Real\Company as RealCompany;
|
||||
use App\Models\Real\Package as RealPackage;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Card extends Model
|
||||
{
|
||||
protected $table = 'cards';
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $primaryKey = 'sim';
|
||||
|
||||
protected $dates = ['activate_at'];
|
||||
|
||||
public function realCompany()
|
||||
{
|
||||
return $this->belongsTo(RealCompany::class, 'real_company_id', 'id');
|
||||
}
|
||||
|
||||
public function realPackage()
|
||||
{
|
||||
return $this->belongsTo(RealPackage::class, 'real_package_id', 'id');
|
||||
}
|
||||
|
||||
// 基础订单
|
||||
public function realOrderBases()
|
||||
{
|
||||
return $this->belongsToMany(RealOrder::class, 'real_order_base_card_relations', 'sim' ,'order_id');
|
||||
}
|
||||
|
||||
// 续费订单
|
||||
public function realOrderRenewals()
|
||||
{
|
||||
return $this->belongsToMany(RealOrder::class, 'real_order_renewal_card_relations', 'sim' ,'order_id');
|
||||
}
|
||||
|
||||
// 加油包订单
|
||||
public function realOrderFlows()
|
||||
{
|
||||
return $this->belongsToMany(RealOrder::class, 'real_order_flows_card_relations', 'sim' ,'order_id');
|
||||
}
|
||||
|
||||
// 可选包订单
|
||||
public function realOrderOptional()
|
||||
{
|
||||
return $this->belongsToMany(RealOrder::class, 'real_order_optional_card_relations', 'sim' ,'order_id');
|
||||
}
|
||||
|
||||
// 附加包订单
|
||||
public function realOrderAdditional()
|
||||
{
|
||||
return $this->belongsToMany(RealOrder::class, 'real_order_additional_card_relations', 'sim' ,'order_id');
|
||||
}
|
||||
}
|
18
app/Models/Real/Bloc.php
Normal file
18
app/Models/Real/Bloc.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Real;
|
||||
|
||||
use App\Core\Model;
|
||||
use App\Models\Card;
|
||||
|
||||
class Bloc extends Model
|
||||
{
|
||||
protected $table = 'blocs';
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
public function cards()
|
||||
{
|
||||
return $this->hasMany(Card::class, 'real_bloc_id', 'id');
|
||||
}
|
||||
}
|
28
app/Models/Real/Company.php
Normal file
28
app/Models/Real/Company.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Real;
|
||||
|
||||
use App\Core\Model;
|
||||
use App\Models\Card;
|
||||
|
||||
class Company extends Model
|
||||
{
|
||||
protected $table = 'companies';
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
public function packages()
|
||||
{
|
||||
return $this->belongsToMany(Package::class, 'real_company_has_packages', 'company_id', 'package_id');
|
||||
}
|
||||
|
||||
public function cards()
|
||||
{
|
||||
return $this->hasMany(Card::class, 'real_company_id', 'id');
|
||||
}
|
||||
|
||||
public function orders()
|
||||
{
|
||||
return $this->hasMany(Order::class, 'company_id', 'id');
|
||||
}
|
||||
}
|
40
app/Models/Real/Order.php
Normal file
40
app/Models/Real/Order.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Real;
|
||||
|
||||
use App\Core\Model;
|
||||
use App\Models\Card;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
protected $table = 'orders';
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $dates = ['order_at', 'service_start_at', 'service_end_at'];
|
||||
|
||||
public function cardBases()
|
||||
{
|
||||
return $this->belongsToMany(Card::class, 'real_order_base_card_relations', 'order_id', 'sim');
|
||||
}
|
||||
|
||||
public function cardRenewals()
|
||||
{
|
||||
return $this->belongsToMany(Card::class, 'real_order_renewal_card_relations', 'order_id', 'sim');
|
||||
}
|
||||
|
||||
public function cardFlows()
|
||||
{
|
||||
return $this->belongsToMany(Card::class, 'real_order_flows_card_relations', 'order_id', 'sim');
|
||||
}
|
||||
|
||||
public function cardOptional()
|
||||
{
|
||||
return $this->belongsToMany(Card::class, 'real_order_optional_card_relations', 'order_id', 'sim');
|
||||
}
|
||||
|
||||
public function cardAdditional()
|
||||
{
|
||||
return $this->belongsToMany(Card::class, 'real_order_additional_card_relations', 'order_id', 'sim');
|
||||
}
|
||||
}
|
28
app/Models/Real/Package.php
Normal file
28
app/Models/Real/Package.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Real;
|
||||
|
||||
use App\Core\Model;
|
||||
use App\Models\Card;
|
||||
|
||||
class Package extends Model
|
||||
{
|
||||
protected $table = 'packages';
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
public function companies()
|
||||
{
|
||||
return $this->belongsToMany(Company::class, 'real_company_has_packages', 'package_id', 'company_id');
|
||||
}
|
||||
|
||||
public function cards()
|
||||
{
|
||||
return $this->hasMany(Card::class, 'real_package_id', 'id');
|
||||
}
|
||||
|
||||
public function orders()
|
||||
{
|
||||
return $this->hasMany(Order::class, 'package_id', 'id');
|
||||
}
|
||||
}
|
@ -71,18 +71,18 @@ return [
|
||||
'strict' => env('DB_STRICT_MODE', false),
|
||||
],
|
||||
|
||||
'td' => [
|
||||
'real' => [
|
||||
'driver' => 'mysql',
|
||||
'host' => env('DB_TD_HOST', 'localhost'),
|
||||
'port' => env('DB_TD_PORT', 3306),
|
||||
'database' => env('DB_TD_DATABASE', 'forge'),
|
||||
'username' => env('DB_TD_USERNAME', 'forge'),
|
||||
'password' => env('DB_TD_PASSWORD', ''),
|
||||
'charset' => env('DB_TD_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_TD_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => env('DB_TD_PREFIX', ''),
|
||||
'timezone' => env('DB_TD_TIMEZONE', '+08:00'),
|
||||
'strict' => env('DB_TD_STRICT_MODE', false),
|
||||
'host' => env('DB_REAL_HOST', 'localhost'),
|
||||
'port' => env('DB_REAL_PORT', 3306),
|
||||
'database' => env('DB_REAL_DATABASE', 'forge'),
|
||||
'username' => env('DB_REAL_USERNAME', 'forge'),
|
||||
'password' => env('DB_REAL_PASSWORD', ''),
|
||||
'charset' => env('DB_REAL_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_REAL_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => env('DB_REAL_PREFIX', ''),
|
||||
'timezone' => env('DB_REAL_TIMEZONE', '+08:00'),
|
||||
'strict' => env('DB_REAL_STRICT_MODE', false),
|
||||
],
|
||||
|
||||
'mongo' => [
|
||||
|
@ -10,9 +10,7 @@ use App\Domains\Permission\Repositories\PermissionRepository;
|
||||
|
||||
class PermissionSeeder extends Seeder
|
||||
{
|
||||
const ROLES = [
|
||||
'name' => '超级管理员', 'type' => 0,
|
||||
];
|
||||
const ROLES = ['name' => '超级管理员'];
|
||||
|
||||
const PERMISSIONS = [
|
||||
[
|
||||
|
@ -1,7 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
require_once realpath(dirname(__FILE__) . '/TestCase.php');
|
||||
|
||||
$res = \DB::connection('mongo')->table('tblCard')->find('1440059652572');
|
||||
dd(\DB::connection('mongo')->table('tblCard')->count());
|
||||
|
||||
dd($res);
|
||||
$conditions = [
|
||||
'starttime' => Carbon::parse('2018-10-01')->startOfDay(),
|
||||
'endtime' => Carbon::parse('2018-10-31')->startOfDay(),
|
||||
];
|
||||
|
||||
$res = \DB::connection('mongo')->table('tblCard')->where(function ($query) use ($conditions) {
|
||||
$query->where('exPCodes.cDate', '>=', $conditions['starttime'])->where('exPCodes.cDate', '<=', $conditions['endtime'])->where('oDate', 'exists', false);
|
||||
})->orWhere(function ($query) use ($conditions) {
|
||||
$query->where('exPCodes.oDate', '>=', $conditions['starttime'])->where('exPCodes.oDate', '<=', $conditions['endtime'])->where('pType', 0);
|
||||
})->first();
|
||||
|
||||
dd($res['exPCodes']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user