feat: 修改了StoreFinanceFlowLists和StoreFinanceFlowWeekLists类中的查询逻辑,并更新了SystemStoreStorageLists类。
This commit is contained in:
parent
454a0ea3ad
commit
33857f15df
@ -32,6 +32,7 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
{
|
||||
return [
|
||||
'=' => ['store_id', 'user_id', 'create_time', 'staff_id'],
|
||||
'between_time'=>'create_time',
|
||||
];
|
||||
}
|
||||
|
||||
@ -48,15 +49,6 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
public function lists(): array
|
||||
{
|
||||
return StoreFinanceFlow::where($this->searchWhere)
|
||||
->when(!empty($this->params['start_time']), function ($query) {
|
||||
$query->whereTime('create_time', '>=', $this->params['start_time']);
|
||||
})
|
||||
->when(!empty($this->params['end_time']), function ($query) {
|
||||
if ($this->params['end_time'] == $this->params['start_time']) {
|
||||
$this->params['end_time'] = strtotime($this->params['end_time']) + 86399;
|
||||
}
|
||||
$query->whereTime('create_time', '<=', $this->params['end_time']);
|
||||
})
|
||||
->when(!empty($this->request->adminInfo['store_id']), function ($query) {
|
||||
$query->where('store_id', $this->request->adminInfo['store_id']);
|
||||
})
|
||||
|
@ -45,7 +45,7 @@ class StoreFinanceFlowWeekLists extends BaseAdminDataLists implements ListsSearc
|
||||
{
|
||||
return StoreFinanceFlow::where($this->searchWhere)
|
||||
->field('
|
||||
CONCAT("第", YEARweek(FROM_UNIXTIME(create_time, "%Y-%m-%d")), "周(", MONTH(FROM_UNIXTIME(create_time, "%Y-%m-%d")), "月)") as date,
|
||||
CONCAT("第", LPAD(YEAR(FROM_UNIXTIME(create_time, "%Y-%m-%d")), 4, "0"), "-", LPAD(WEEK(FROM_UNIXTIME(create_time, "%Y-%m-%d"), 3), 2, "0"), "周(", LPAD(MONTH(FROM_UNIXTIME(create_time, "%Y-%m-%d")), 2, "0"), "月)") as date,
|
||||
SUM(CASE WHEN financial_pm = 1 THEN number ELSE 0 END) as income,
|
||||
SUM(CASE WHEN financial_pm = 0 THEN number ELSE 0 END) as expenditure
|
||||
')
|
||||
|
@ -46,7 +46,7 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI
|
||||
public function lists(): array
|
||||
{
|
||||
return SystemStoreStorage::where($this->searchWhere)
|
||||
->field(['id', 'store_id', 'admin_id', 'staff_id', 'product_id', 'nums', 'status'])
|
||||
->field(['id', 'store_id', 'admin_id', 'staff_id', 'product_id', 'nums','mark', 'status'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($item){
|
||||
@ -58,7 +58,9 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI
|
||||
}else{
|
||||
$item['staff_name']='无';
|
||||
}
|
||||
$item['store_name']=StoreProduct::where('id',$item['product_id'])->value('store_name');
|
||||
$find=StoreProduct::where('id',$item['product_id'])->field('store_name,image')->find();
|
||||
$item['store_name']=$find['store_name'];
|
||||
$item['image']=$find['image'];
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
|
Loading…
x
Reference in New Issue
Block a user