feat : rank
This commit is contained in:
@@ -5,27 +5,72 @@ declare(strict_types=1);
|
|||||||
namespace App\Controller\Admin;
|
namespace App\Controller\Admin;
|
||||||
|
|
||||||
use App\Controller\AbstractController;
|
use App\Controller\AbstractController;
|
||||||
|
use App\Middleware\Admin\JwtAuthMiddleware;
|
||||||
|
use App\Service\Admin\Statement\ChefService;
|
||||||
|
use App\Service\Admin\Statement\DriverService;
|
||||||
|
use App\Service\Admin\Statement\FinancesService;
|
||||||
|
use App\Service\Admin\Statement\RefundService;
|
||||||
|
use App\Service\Admin\Statement\SiteService;
|
||||||
|
use Hyperf\HttpServer\Annotation\Controller;
|
||||||
|
use Hyperf\HttpServer\Annotation\Middlewares;
|
||||||
|
use Hyperf\HttpServer\Annotation\RequestMapping;
|
||||||
|
use Hyperf\Validation\Annotation\Scene;
|
||||||
|
|
||||||
|
#[Controller(prefix: "admin/statement")]
|
||||||
|
#[Middlewares([
|
||||||
|
JwtAuthMiddleware::class,
|
||||||
|
])]
|
||||||
class StatementController extends AbstractController
|
class StatementController extends AbstractController
|
||||||
{
|
{
|
||||||
//todo list
|
/**
|
||||||
public function finances()
|
* 财务报表
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
#[RequestMapping(path: "finances", methods: "GET")]
|
||||||
|
#[Scene(scene: "finances")]
|
||||||
|
public function finances(): array
|
||||||
{
|
{
|
||||||
|
return (new FinancesService)->handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function chef()
|
/**
|
||||||
|
* 厨师报表 也是菜品报表
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
#[RequestMapping(path: "chef", methods: "GET")]
|
||||||
|
#[Scene(scene: "chef")]
|
||||||
|
public function chef(): array
|
||||||
{
|
{
|
||||||
|
return (new ChefService)->handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function site()
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
#[RequestMapping(path: "site", methods: "GET")]
|
||||||
|
#[Scene(scene: "site")]
|
||||||
|
public function site(): array
|
||||||
{
|
{
|
||||||
|
return (new SiteService)->handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function driver()
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
#[RequestMapping(path: "driver", methods: "GET")]
|
||||||
|
#[Scene(scene: "driver")]
|
||||||
|
public function driver(): array
|
||||||
{
|
{
|
||||||
|
return (new DriverService)->handle();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
#[RequestMapping(path: "refund", methods: "GET")]
|
||||||
|
#[Scene(scene: "refund")]
|
||||||
|
public function refund(): array
|
||||||
|
{
|
||||||
|
return (new RefundService)->handle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,9 +30,13 @@ class ChefStatement extends Model
|
|||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*/
|
*/
|
||||||
protected array $fillable = [];
|
protected array $fillable = [];
|
||||||
|
protected array $guarded = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* The attributes that should be cast to native types.
|
||||||
*/
|
*/
|
||||||
protected array $casts = ['id' => 'integer', 'cycle_id' => 'integer', 'kitchen_id' => 'integer', 'chef_id' => 'integer', 'sku_id' => 'integer', 'sale' => 'integer', 'refund' => 'integer', 'cancel' => 'integer'];
|
protected array $casts = ['id' => 'integer', 'cycle_id' => 'integer', 'kitchen_id' => 'integer', 'chef_id' => 'integer', 'sku_id' => 'integer', 'sale' => 'integer', 'refund' => 'integer', 'cancel' => 'integer'];
|
||||||
|
|
||||||
|
const string CREATED_AT = 'create_time';
|
||||||
|
const string UPDATED_AT = 'updated_time';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,13 @@ class RefundStatement extends Model
|
|||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*/
|
*/
|
||||||
protected array $fillable = [];
|
protected array $fillable = [];
|
||||||
|
protected array $guarded = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* The attributes that should be cast to native types.
|
||||||
*/
|
*/
|
||||||
protected array $casts = ['id' => 'integer', 'cycle_id' => 'integer', 'kitchen_id' => 'integer'];
|
protected array $casts = ['id' => 'integer', 'cycle_id' => 'integer', 'kitchen_id' => 'integer'];
|
||||||
|
|
||||||
|
const string CREATED_AT = 'create_time';
|
||||||
|
const string UPDATED_AT = 'update_time';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use Hyperf\DbConnection\Model\Model;
|
|||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $date
|
* @property string $date
|
||||||
* @property int $cycle_id
|
* @property int $cycle_id
|
||||||
|
* @property int $city_id
|
||||||
* @property int $kitchen_id
|
* @property int $kitchen_id
|
||||||
* @property int $site_id
|
* @property int $site_id
|
||||||
* @property int $driver_id
|
* @property int $driver_id
|
||||||
@@ -32,9 +33,12 @@ class SiteDriverStatement extends Model
|
|||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*/
|
*/
|
||||||
protected array $fillable = [];
|
protected array $fillable = [];
|
||||||
|
protected array $guarded = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* The attributes that should be cast to native types.
|
||||||
*/
|
*/
|
||||||
protected array $casts = ['id' => 'integer', 'cycle_id' => 'integer', 'kitchen_id' => 'integer', 'site_id' => 'integer', 'driver_id' => 'integer', 'option_order_number' => 'integer', 'option_copies' => 'integer', 'option_add_staple_food_num' => 'integer', 'meal_order_number' => 'integer', 'meal_copies' => 'integer', 'meal_add_staple_food_num' => 'integer'];
|
protected array $casts = ['id' => 'integer', 'cycle_id' => 'integer','city_id' => 'integer', 'kitchen_id' => 'integer', 'site_id' => 'integer', 'driver_id' => 'integer', 'option_order_number' => 'integer', 'option_copies' => 'integer', 'option_add_staple_food_num' => 'integer', 'meal_order_number' => 'integer', 'meal_copies' => 'integer', 'meal_add_staple_food_num' => 'integer'];
|
||||||
|
|
||||||
|
const string CREATED_AT = 'create_time';
|
||||||
}
|
}
|
||||||
|
|||||||
99
app/Service/Admin/Statement/ChefService.php
Normal file
99
app/Service/Admin/Statement/ChefService.php
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This service file is part of item.
|
||||||
|
*
|
||||||
|
* @author ctexthuang
|
||||||
|
* @contact ctexthuang@qq.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Service\Admin\Statement;
|
||||||
|
|
||||||
|
use App\Model\AdminUser;
|
||||||
|
use App\Model\ChefStatement;
|
||||||
|
use App\Model\Kitchen;
|
||||||
|
use App\Model\Sku;
|
||||||
|
use App\Service\Admin\BaseService;
|
||||||
|
use Hyperf\DbConnection\Db;
|
||||||
|
use Hyperf\Di\Annotation\Inject;
|
||||||
|
|
||||||
|
class ChefService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var ChefStatement
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected ChefStatement $chefStatementModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Kitchen
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected Kitchen $kitchenModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var AdminUser
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected AdminUser $adminUserModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Sku
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected Sku $skuModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function handle(): array
|
||||||
|
{
|
||||||
|
$searchCityId = $this->request->input('search_city_id');
|
||||||
|
$searchKitchenId = $this->request->input('search_kitchen_id');
|
||||||
|
$searchCycleId = $this->request->input('search_cycle_id');
|
||||||
|
$searchChefId = $this->request->input('search_chef_id');
|
||||||
|
$limit = (int)$this->request->input('limit',10);
|
||||||
|
|
||||||
|
$list = $this->chefStatementModel
|
||||||
|
->when($searchCityId, function ($query) use ($searchCityId) {
|
||||||
|
$kitchenIds = $this->kitchenModel->where('city_id', $searchCityId)->pluck('id')->toArray();
|
||||||
|
$query->whereIn('kitchen_id', $kitchenIds);
|
||||||
|
})
|
||||||
|
->when($searchKitchenId, function ($query) use ($searchKitchenId) {
|
||||||
|
$query->where('kitchen_id', $searchKitchenId);
|
||||||
|
})
|
||||||
|
->when($searchChefId, function ($query) use ($searchChefId) {
|
||||||
|
$query->where('chef_id', $searchChefId);
|
||||||
|
})
|
||||||
|
->when($searchCycleId, function ($query) use ($searchCycleId) {
|
||||||
|
$query->where('cycle_id', $searchCycleId);
|
||||||
|
})
|
||||||
|
->orderByDesc('cycle_id')
|
||||||
|
->select(
|
||||||
|
'date',
|
||||||
|
'cycle_id',
|
||||||
|
'kitchen_id',
|
||||||
|
'chef_id',
|
||||||
|
'sku_id',
|
||||||
|
'sale',
|
||||||
|
'refund',
|
||||||
|
'cancel'
|
||||||
|
)
|
||||||
|
->paginate($limit)
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
if (empty($list['data'])) return $this->return->success('success', ['list' => []]);
|
||||||
|
|
||||||
|
$skuIds = array_column($list['data'], 'sku_id');
|
||||||
|
$chefIds = array_column($list['data'], 'chef_id');
|
||||||
|
$skuList = $this->skuModel->whereIn('id', $skuIds)->pluck('title', 'id')->toArray();
|
||||||
|
$chefList = $this->adminUserModel->whereIn('id',$chefIds)->pluck('chinese_name','id')->toArray();
|
||||||
|
foreach ($list['data'] as &$v) {
|
||||||
|
$v['sku_title'] = $skuList[$v['sku_id']] ?? '';
|
||||||
|
$v['chef_name'] = $chefList[$v['chef_id']] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->return->success('success', ['list' => $list]);
|
||||||
|
}
|
||||||
|
}
|
||||||
77
app/Service/Admin/Statement/DriverService.php
Normal file
77
app/Service/Admin/Statement/DriverService.php
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This service file is part of item.
|
||||||
|
*
|
||||||
|
* @author ctexthuang
|
||||||
|
* @contact ctexthuang@qq.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Service\Admin\Statement;
|
||||||
|
|
||||||
|
use App\Model\Site;
|
||||||
|
use App\Model\SiteDriverStatement;
|
||||||
|
use App\Service\Admin\BaseService;
|
||||||
|
use Hyperf\Di\Annotation\Inject;
|
||||||
|
|
||||||
|
class DriverService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var SiteDriverStatement
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected SiteDriverStatement $siteDriverStatementModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Site
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected Site $siteModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function handle(): array
|
||||||
|
{
|
||||||
|
$searchCityId = $this->request->input('search_city_id');
|
||||||
|
$searchCycleId = $this->request->input('search_cycle_id');
|
||||||
|
$searchDriverId = $this->request->input('search_driver_id');
|
||||||
|
$limit = (int)$this->request->input('limit',10);
|
||||||
|
|
||||||
|
$list = $this->siteDriverStatementModel
|
||||||
|
->when($searchCityId, function ($query) use ($searchCityId) {
|
||||||
|
$query->whereIn('city_id', $searchCityId);
|
||||||
|
})
|
||||||
|
->when($searchDriverId, function ($query) use ($searchDriverId) {
|
||||||
|
$query->where('driver_id', $searchDriverId);
|
||||||
|
})
|
||||||
|
->when($searchCycleId, function ($query) use ($searchCycleId) {
|
||||||
|
$query->where('cycle_id', $searchCycleId);
|
||||||
|
})
|
||||||
|
->orderByDesc('cycle_id')
|
||||||
|
->select(
|
||||||
|
'date',
|
||||||
|
'cycle_id',
|
||||||
|
'site_id',
|
||||||
|
'option_order_number',
|
||||||
|
'option_copies',
|
||||||
|
'option_add_staple_food_num',
|
||||||
|
'meal_order_number',
|
||||||
|
'meal_copies',
|
||||||
|
'meal_add_staple_food_num'
|
||||||
|
)
|
||||||
|
->paginate($limit)
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
if (empty($list['data'])) return $this->return->success('success', ['list' => []]);
|
||||||
|
|
||||||
|
$siteIds = array_column($list['data'], 'site_id');
|
||||||
|
$siteList = $this->siteModel->whereIn('id', $siteIds)->pluck('name', 'id')->toArray();
|
||||||
|
foreach ($list['data'] as &$v) {
|
||||||
|
$v['site_name'] = $siteList[$v['site_id']] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->return->success('success', ['list' => $list]);
|
||||||
|
}
|
||||||
|
}
|
||||||
69
app/Service/Admin/Statement/FinancesService.php
Normal file
69
app/Service/Admin/Statement/FinancesService.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This service file is part of item.
|
||||||
|
*
|
||||||
|
* @author ctexthuang
|
||||||
|
* @contact ctexthuang@qq.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Service\Admin\Statement;
|
||||||
|
|
||||||
|
use App\Model\FinancesStatement;
|
||||||
|
use App\Model\Kitchen;
|
||||||
|
use App\Service\Admin\BaseService;
|
||||||
|
use Hyperf\DbConnection\Db;
|
||||||
|
use Hyperf\Di\Annotation\Inject;
|
||||||
|
|
||||||
|
class FinancesService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var FinancesStatement
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected FinancesStatement $financesStatementModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Kitchen
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected Kitchen $kitchenModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function handle(): array
|
||||||
|
{
|
||||||
|
$searchCityId = $this->request->input('search_city_id');
|
||||||
|
$searchKitchenId = $this->request->input('search_kitchen_id');
|
||||||
|
$limit = (int)$this->request->input('limit',10);
|
||||||
|
|
||||||
|
$list = $this->financesStatementModel
|
||||||
|
->when($searchCityId, function ($query) use ($searchCityId) {
|
||||||
|
$kitchenIds = $this->kitchenModel->where('city_id', $searchCityId)->pluck('id')->toArray();
|
||||||
|
$query->whereIn('kitchen_id', $kitchenIds);
|
||||||
|
})
|
||||||
|
->when($searchKitchenId, function ($query) use ($searchKitchenId) {
|
||||||
|
$query->where('kitchen_id', $searchKitchenId);
|
||||||
|
})
|
||||||
|
->groupBy('cycle_id')
|
||||||
|
->orderByDesc('cycle_id')
|
||||||
|
->select(
|
||||||
|
'date',
|
||||||
|
'cycle_id',
|
||||||
|
// 'kitchen_id',
|
||||||
|
Db::raw('SUM(`gross_sales`) as gross_sales'),
|
||||||
|
Db::raw('SUM(`discounts`) as discounts'),
|
||||||
|
Db::raw('SUM(`net_sales`) as net_sales'),
|
||||||
|
Db::raw('SUM(`option_order_number`) as option_order_number'),
|
||||||
|
Db::raw('SUM(`option_copies`) as option_copies'),
|
||||||
|
Db::raw('SUM(`meal_order_number`) as meal_order_number'),
|
||||||
|
Db::raw('SUM(`meal_copies`) as meal_copies'),
|
||||||
|
)
|
||||||
|
->paginate($limit)
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
return $this->return->success('success', ['list' => $list]);
|
||||||
|
}
|
||||||
|
}
|
||||||
64
app/Service/Admin/Statement/RefundService.php
Normal file
64
app/Service/Admin/Statement/RefundService.php
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This service file is part of item.
|
||||||
|
*
|
||||||
|
* @author ctexthuang
|
||||||
|
* @contact ctexthuang@qq.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Service\Admin\Statement;
|
||||||
|
|
||||||
|
use App\Model\Kitchen;
|
||||||
|
use App\Model\RefundStatement;
|
||||||
|
use App\Service\Admin\BaseService;
|
||||||
|
use Hyperf\DbConnection\Db;
|
||||||
|
use Hyperf\Di\Annotation\Inject;
|
||||||
|
|
||||||
|
class RefundService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var RefundStatement
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected RefundStatement $refundStatementModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Kitchen
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected Kitchen $kitchenModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function handle(): array
|
||||||
|
{
|
||||||
|
$searchCityId = $this->request->input('search_city_id');
|
||||||
|
$searchKitchenId = $this->request->input('search_kitchen_id');
|
||||||
|
// $searchCycleId = $this->request->input('search_cycle_id');
|
||||||
|
$limit = (int)$this->request->input('limit',10);
|
||||||
|
|
||||||
|
$list = $this->refundStatementModel
|
||||||
|
->when($searchCityId, function ($query) use ($searchCityId) {
|
||||||
|
$kitchenIds = $this->kitchenModel->where('city_id', $searchCityId)->pluck('id')->toArray();
|
||||||
|
$query->whereIn('kitchen_id', $kitchenIds);
|
||||||
|
})
|
||||||
|
->when($searchKitchenId, function ($query) use ($searchKitchenId) {
|
||||||
|
$query->where('kitchen_id', $searchKitchenId);
|
||||||
|
})
|
||||||
|
->groupBy('cycle_id')
|
||||||
|
->orderByDesc('cycle_id')
|
||||||
|
->select(
|
||||||
|
'date',
|
||||||
|
'cycle_id',
|
||||||
|
// 'kitchen_id',
|
||||||
|
Db::raw('SUM(`refund_price`) as refund_price'),
|
||||||
|
)
|
||||||
|
->paginate($limit)
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
return $this->return->success('success', ['list' => $list]);
|
||||||
|
}
|
||||||
|
}
|
||||||
77
app/Service/Admin/Statement/SiteService.php
Normal file
77
app/Service/Admin/Statement/SiteService.php
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This service file is part of item.
|
||||||
|
*
|
||||||
|
* @author ctexthuang
|
||||||
|
* @contact ctexthuang@qq.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Service\Admin\Statement;
|
||||||
|
|
||||||
|
use App\Model\Site;
|
||||||
|
use App\Model\SiteDriverStatement;
|
||||||
|
use App\Service\Admin\BaseService;
|
||||||
|
use Hyperf\Di\Annotation\Inject;
|
||||||
|
|
||||||
|
class SiteService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var SiteDriverStatement
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected SiteDriverStatement $siteDriverStatementModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Site
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected Site $siteModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function handle(): array
|
||||||
|
{
|
||||||
|
$searchCityId = $this->request->input('search_city_id');
|
||||||
|
$searchCycleId = $this->request->input('search_cycle_id');
|
||||||
|
$searchSiteId = $this->request->input('search_site_id');
|
||||||
|
$limit = (int)$this->request->input('limit',10);
|
||||||
|
|
||||||
|
$list = $this->siteDriverStatementModel
|
||||||
|
->when($searchCityId, function ($query) use ($searchCityId) {
|
||||||
|
$query->whereIn('city_id', $searchCityId);
|
||||||
|
})
|
||||||
|
->when($searchSiteId, function ($query) use ($searchSiteId) {
|
||||||
|
$query->where('site_id', $searchSiteId);
|
||||||
|
})
|
||||||
|
->when($searchCycleId, function ($query) use ($searchCycleId) {
|
||||||
|
$query->where('cycle_id', $searchCycleId);
|
||||||
|
})
|
||||||
|
->orderByDesc('cycle_id')
|
||||||
|
->select(
|
||||||
|
'date',
|
||||||
|
'cycle_id',
|
||||||
|
'site_id',
|
||||||
|
'option_order_number',
|
||||||
|
'option_copies',
|
||||||
|
'option_add_staple_food_num',
|
||||||
|
'meal_order_number',
|
||||||
|
'meal_copies',
|
||||||
|
'meal_add_staple_food_num'
|
||||||
|
)
|
||||||
|
->paginate($limit)
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
if (empty($list['data'])) return $this->return->success('success', ['list' => []]);
|
||||||
|
|
||||||
|
$siteIds = array_column($list['data'], 'site_id');
|
||||||
|
$siteList = $this->siteModel->whereIn('id', $siteIds)->pluck('name', 'id')->toArray();
|
||||||
|
foreach ($list['data'] as &$v) {
|
||||||
|
$v['site_name'] = $siteList[$v['site_id']] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->return->success('success', ['list' => $list]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -79,6 +79,7 @@ class DeliverStatementService
|
|||||||
|
|
||||||
$insertModel->date = $cycleInfo->dates;
|
$insertModel->date = $cycleInfo->dates;
|
||||||
$insertModel->cycle_id = $this->cycleId;
|
$insertModel->cycle_id = $this->cycleId;
|
||||||
|
$insertModel->city_id = $siteInfo->city_id;
|
||||||
$insertModel->site_id = $this->siteId;
|
$insertModel->site_id = $this->siteId;
|
||||||
$insertModel->kitchen_id = $siteInfo->kitchen_id;
|
$insertModel->kitchen_id = $siteInfo->kitchen_id;
|
||||||
$insertModel->driver_id = $info->driver_id;
|
$insertModel->driver_id = $info->driver_id;
|
||||||
|
|||||||
Reference in New Issue
Block a user