Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
89b07272
Commit
89b07272
authored
Aug 06, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
未提交财务日报的门店
parent
a219ece8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
77 deletions
+118
-77
DailyUncommitted.php
application/index/controller/DailyUncommitted.php
+1
-77
route.php
application/route.php
+2
-0
DailyUncommittedTask.php
application/task/controller/DailyUncommittedTask.php
+115
-0
No files found.
application/index/controller/DailyUncommitted.php
View file @
89b07272
...
...
@@ -2,13 +2,7 @@
namespace
app\index\controller
;
use
app\api\service\AccountBalanceService
;
use
app\api_broker\service\PushMessageService
;
use
app\api_broker\service\RedisCacheService
;
use
app\index\extend\Basic
;
use
app\model\AStore
;
use
app\model\GReceiptOperatingRecords
;
use
app\model\ODaily
;
use
app\model\ODailyUncommittedModel
;
use
think\Request
;
...
...
@@ -23,76 +17,6 @@ class DailyUncommitted extends Basic
$this
->
m_daily_uncommitted
=
new
ODailyUncommittedModel
();
}
/**
* 未提交财务日报的门店
* @return \think\Response
*/
public
function
selectDailyUncommitted
()
{
$time
=
date
(
"Y-m-d"
);
$m_store
=
new
AStore
();
$m_daily
=
new
ODaily
();
$s_push_msg
=
new
PushMessageService
();
//门店集合
$store_result
=
$m_store
->
selectDailyUncommitted
(
'a.id,a.district_id,b.id as agent_id,b.name'
,
[]);
foreach
(
$store_result
as
$k
=>
$v
)
{
$params_d
=
[];
$params_d
[
'store_id'
]
=
$v
[
'id'
];
$params_d
[
'daily_date'
]
=
$time
;
//查询门店当天是否提交日报
$daily_data
=
$m_daily
->
getDailyList
(
'id,site_id'
,
$params_d
,
1
,
1
);
if
(
empty
(
$daily_data
))
{
if
(
!
$v
[
'agent_id'
]){
continue
;
}
//没提交插入数据表
$params_add
=
[];
$params_add
[
"agent_id"
]
=
$v
[
'agent_id'
];
$params_add
[
"agent_name"
]
=
$v
[
'name'
];
$params_add
[
"store_id"
]
=
$v
[
'id'
];
$params_add
[
"district_id"
]
=
$v
[
'district_id'
];
$params_add
[
"daily_date"
]
=
$time
;
$this
->
addDailyUncommitted
(
$params_add
);
$agent_ids
[]
=
$v
[
'agent_id'
];
}
}
//推送
if
(
isset
(
$agent_ids
)){
$message
=
'辛苦了!记得提交今日的财务日报!'
;
$s_push_msg
->
record
(
15
,
0
,
$agent_ids
,
$this
->
userId
,[
'message'
=>
$message
]);
}
return
$this
->
response
(
"200"
,
"成功"
,
[]);
}
/**
* 新增
* @param $params
* @return bool
*/
public
function
addDailyUncommitted
(
$params
)
{
$data
[
"agent_id"
]
=
$params
[
'agent_id'
];
$data
[
"agent_name"
]
=
$params
[
'agent_name'
];
$data
[
"store_id"
]
=
$params
[
'store_id'
];
$data
[
"district_id"
]
=
$params
[
'district_id'
];
$data
[
"daily_date"
]
=
$params
[
'daily_date'
];
$data
[
"status"
]
=
0
;
$data
[
"is_inform"
]
=
1
;
$result
=
$this
->
m_daily_uncommitted
->
saveDailyUncommitted
(
$data
);
//int(1)
if
(
$result
)
{
return
true
;
}
else
{
return
false
;
}
}
/**
...
...
@@ -130,7 +54,7 @@ class DailyUncommitted extends Basic
}
/**
* 更新已提交
*
* @param $store_id
* @param $time
* @return bool
...
...
application/route.php
View file @
89b07272
...
...
@@ -773,6 +773,8 @@ Route::group('task', [
'delCache'
=>
[
'task/UpdateRedisCache/delCache'
,
[
'method'
=>
'get'
]],
//清空多种缓存
'delGroup'
=>
[
'task/UpdateRedisCache/delGroup'
,
[
'method'
=>
'get'
]],
//批量去除角色缓存
'delRule'
=>
[
'task/UpdateRedisCache/delRule'
,
[
'method'
=>
'get'
]],
//批量去除规则缓存
'selectDailyUncommitted'
=>
[
'task/DailyUncommittedTask/selectDailyUncommitted'
,
[
'method'
=>
'get'
]],
//未提交财务日报的门店
]);
Route
::
group
(
'broker'
,
[
...
...
application/task/controller/DailyUncommittedTask.php
0 → 100644
View file @
89b07272
<?php
namespace
app\task\controller
;
use
app\api_broker\service\PushMessageService
;
use
app\model\ODailyUncommittedModel
;
/**
* Class DailyUncommittedTask
* @package app\task\controller
*/
class
DailyUncommittedTask
{
private
$m_daily_uncommitted
;
function
__construct
()
{
$this
->
m_daily_uncommitted
=
new
ODailyUncommittedModel
();
}
/**
* 未提交财务日报的门店
* @return string
*/
public
function
selectDailyUncommitted
()
{
$time
=
date
(
"Y-m-d"
);
$s_push_msg
=
new
PushMessageService
();
//门店集合
$sql
=
"SELECT
`a`.`id`,
`a`.`district_id`,
b.id AS agent_id,
`b`.`name`
FROM
`a_store` `a`
LEFT JOIN `a_agents` `b` ON `a`.`id` = b.store_id
AND ( b.LEVEL = 20 OR b.LEVEL = 40 )
WHERE
`a`.`status` = 0
AND `a`.`id` IN (
SELECT
*
FROM
( ( SELECT id AS store_id FROM a_store ) UNION ALL ( SELECT store_id FROM o_daily WHERE daily_date = '
{
$time
}
' ) ) c
GROUP BY
store_id
HAVING
count( store_id ) = 1
)"
;
$store_result
=
$this
->
m_daily_uncommitted
->
query
(
$sql
);
foreach
(
$store_result
as
$k
=>
$v
)
{
if
(
!
$v
[
'agent_id'
]){
continue
;
}
$params_save
=
[];
$params_save
[
'agent_id'
]
=
$v
[
'agent_id'
];
$params_save
[
'daily_date'
]
=
$time
;
$get_result
=
$this
->
m_daily_uncommitted
->
getDailyUncommitted
(
'id'
,
$params_save
);
if
(
$get_result
){
big_log
(
'已经存在'
);
continue
;
}
//没提交插入数据表
$params_add
=
[];
$params_add
[
"agent_id"
]
=
$v
[
'agent_id'
];
$params_add
[
"agent_name"
]
=
$v
[
'name'
];
$params_add
[
"store_id"
]
=
$v
[
'id'
];
$params_add
[
"district_id"
]
=
$v
[
'district_id'
];
$params_add
[
"daily_date"
]
=
$time
;
$this
->
addDailyUncommitted
(
$params_add
);
$agent_ids
[]
=
$v
[
'agent_id'
];
}
//推送
if
(
isset
(
$agent_ids
)){
$message
=
'辛苦了!记得提交今日的财务日报!'
;
$s_push_msg
->
record
(
15
,
0
,
$agent_ids
,
0
,[
'message'
=>
$message
]);
}
return
"成功"
;
}
/**
* 新增
* @param $params
* @return bool
*/
public
function
addDailyUncommitted
(
$params
)
{
$data
[
"agent_id"
]
=
$params
[
'agent_id'
];
$data
[
"agent_name"
]
=
$params
[
'agent_name'
];
$data
[
"store_id"
]
=
$params
[
'store_id'
];
$data
[
"district_id"
]
=
$params
[
'district_id'
];
$data
[
"daily_date"
]
=
$params
[
'daily_date'
];
$data
[
"status"
]
=
0
;
$data
[
"is_inform"
]
=
1
;
$result
=
$this
->
m_daily_uncommitted
->
saveDailyUncommitted
(
$data
);
//int(1)
if
(
$result
)
{
return
true
;
}
else
{
return
false
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment