同步日志

This commit is contained in:
邓皓元 2019-01-23 19:01:14 +08:00
parent 4fc607f182
commit 2647a4547e
5 changed files with 20 additions and 7 deletions

View File

@ -45,6 +45,8 @@ class MongoSyncJob implements ShouldQueue
*/
public function handle()
{
Log::info("MongoSyncJob #: utcDateTime {$this->utcDateTime} - page {$this->page}");
$query = TblCard::select(['cNo', 'bNo', 'iccid', 'imsi', 'comId', 'oType', 'saDate', 'sDate', 'oRDate'])
->where('pNo', 'No00000000768')
->where('oRDate', '>', $this->utcDateTime)

View File

@ -4,6 +4,7 @@ namespace App\Domains\Virtual\Exports;
use App\Dicts;
use App\Core\AbstractExport;
use Illuminate\Support\Facades\DB;
use Dipper\Excel\Concerns\WithRows;
use Dipper\Excel\Concerns\FromQuery;
use Dipper\Excel\Concerns\Exportable;
@ -26,7 +27,10 @@ class CardExport extends AbstractExport implements FromQuery, WithHeadings, With
public function query()
{
$builder = app(OrderCardRepository::class)->withConditions($this->conditions)->applyConditions();
$builder = app(OrderCardRepository::class)->select([
'*',
DB::raw('timelines_json(sim) as timelines'),
])->withConditions($this->conditions)->applyConditions();
return $builder;
}

View File

@ -47,6 +47,8 @@ class CardSyncJob implements ShouldQueue
*/
public function handle()
{
Log::info("CardSyncJob #: maxId {$this->maxId} - page {$this->page}");
$blocs = app(BlocRepository::class)->withTrashed()->get()->pluck('id', 'shorthand')->toArray();
$query = DB::connection('vd_old')->table('ckb_custom')

View File

@ -71,6 +71,7 @@ class LogSyncJob implements ShouldQueue
*/
public function handle()
{
Log::info("LogSyncJob #: maxId {$this->maxId} - page {$this->page}");
$this->packages = app(PackageRepository::class)->withTrashed()->get()->keyBy('sn');
$this->products = app(ProductRepository::class)->withTrashed()->get()->keyBy('sn');
$this->companies = app(CompanyRepository::class)->withTrashed()->get()->keyBy('sn');

View File

@ -67,12 +67,16 @@ class CardService extends Service
$_timelines = json_decode($item->timelines, true);
foreach ($_timelines as &$timeline) {
$package = app(PackageService::class)->load($timeline['package_id']);
$timeline['type_name'] = self::$typeNames[$timeline['type']];
$timeline['name'] = $package['name'];
$timeline['service_start_at'] = Carbon::parse($timeline['service_start_at'])->format('Y-m');
$timeline['service_end_at'] = Carbon::parse($timeline['service_end_at'])->format('Y-m');
try{
foreach ($_timelines as &$timeline) {
$package = app(PackageService::class)->load($timeline['package_id']);
$timeline['type_name'] = self::$typeNames[$timeline['type']];
$timeline['name'] = $package['name'];
$timeline['service_start_at'] = Carbon::parse($timeline['service_start_at'])->format('Y-m');
$timeline['service_end_at'] = Carbon::parse($timeline['service_end_at'])->format('Y-m');
}
}catch(\Exception $e){
dd($item);
}
$company = app(CompanyService::class)->load($item->company_id);