4 changed files with 109 additions and 6 deletions
-
27app/Admin/Controllers/StoreUserReportController.php
-
25app/Models/ImsCjdcOrder.php
-
57app/Models/ImsCjdcOrderMain.php
-
6resources/lang/zh-CN/store-user-report.php
@ -0,0 +1,25 @@ |
|||
<?php |
|||
|
|||
namespace App\Models; |
|||
|
|||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
|||
|
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class ImsCjdcOrder extends Model |
|||
{ |
|||
use HasDateTimeFormatter; |
|||
protected $table = 'ims_cjdc_order'; |
|||
public $timestamps = false; |
|||
|
|||
public function user() |
|||
{ |
|||
return $this->hasOne('\App\Models\ImsCjdcUser','id','user_id'); |
|||
} |
|||
|
|||
public function store() |
|||
{ |
|||
return $this->hasOne('\App\Models\ImsCjdcStore','id','store_id'); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,57 @@ |
|||
<?php |
|||
|
|||
namespace App\Models; |
|||
|
|||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
|||
|
|||
use Illuminate\Database\Eloquent\Model; |
|||
use Illuminate\Support\Facades\DB; |
|||
|
|||
class ImsCjdcOrderMain extends Model |
|||
{ |
|||
use HasDateTimeFormatter; |
|||
protected $table = 'ims_cjdc_order_main'; |
|||
public $timestamps = false; |
|||
|
|||
public function imsCjdcUser() |
|||
{ |
|||
return $this->hasOne('\App\Models\ImsCjdcUser','id','user_id'); |
|||
} |
|||
|
|||
public function market() |
|||
{ |
|||
return $this->hasOne('\App\Models\ImsCjdcMarket','id','market_id'); |
|||
} |
|||
|
|||
/** |
|||
* 同时变更主订单和子订单状态, |
|||
* @param $oid //主订单id
|
|||
* @param $state //订单状态
|
|||
*/ |
|||
public function modifyState($oid,$state) |
|||
{ |
|||
return DB::transaction(function () use ($oid,$state){ |
|||
$data1['state'] = $data2['state'] = $state; |
|||
$data1['update_time'] = time(); |
|||
if ($state == 4) { |
|||
$data1['complete_time'] = $data2['complete_time'] = time(); |
|||
|
|||
} elseif ($state == 3) { |
|||
$data1['jd_time'] = $data2['jd_time'] = time(); |
|||
} |
|||
DB::table('ims_cjdc_order_main') |
|||
->where('id',$oid) |
|||
->update($data1); |
|||
DB::table('ims_cjdc_order') |
|||
->where('order_main_id',$oid) |
|||
->update($data2); |
|||
if ($state==4){ |
|||
//添加店铺流水记录
|
|||
$account = new StoreAccount(); |
|||
$account->addStoreAccount($oid); |
|||
} |
|||
return true; |
|||
}); |
|||
|
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue