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
398c2a8e
Commit
398c2a8e
authored
Mar 23, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生成周报和日报图片
parent
01954bbd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
38 deletions
+56
-38
Statement.php
application/api_broker/controller/Statement.php
+38
-38
config.php
application/config.php
+1
-0
RAgentReport.php
application/model/RAgentReport.php
+16
-0
route.php
application/route.php
+1
-0
No files found.
application/api_broker/controller/Statement.php
View file @
398c2a8e
...
@@ -4,6 +4,7 @@ namespace app\api_broker\controller;
...
@@ -4,6 +4,7 @@ namespace app\api_broker\controller;
use
app\api_broker\extend\Basic
;
use
app\api_broker\extend\Basic
;
use
app\api_broker\service\StatementService
;
use
app\api_broker\service\StatementService
;
use
app\model\RAgentReport
;
use
think\Exception
;
use
think\Exception
;
use
think\Request
;
use
think\Request
;
...
@@ -49,63 +50,61 @@ class Statement extends Basic
...
@@ -49,63 +50,61 @@ class Statement extends Basic
}
}
/**
* 生成日报和周报图片
*
* @return \think\Response
*/
public
function
weekWorkImg
()
public
function
weekWorkImg
()
{
{
$params
=
array
(
if
(
empty
(
$this
->
params
[
"agent_id"
])
||
empty
(
$this
->
params
[
"img"
]))
{
"agent_id"
=>
1
,
"img"
=>
"12313"
,
"is_square"
=>
"123123"
,
"start_time"
=>
"2018-03-20 12:11:21"
,
"end_time"
=>
"2018-03-21 12:11:21"
,
"type"
=>
1
,
//0日报 1周报
);
if
(
empty
(
$params
[
"agent_id"
])
||
empty
(
$params
[
"img"
])
||
empty
(
$params
[
"table"
]))
{
return
$this
->
response
(
"101"
,
"参数错误"
);
return
$this
->
response
(
"101"
,
"参数错误"
);
}
}
$img_title
=
""
;
$img_title
=
""
;
$img
=
""
;
$img
=
""
;
//单图
//单图
$base64_image_content
=
$params
[
"img"
];
$base64_image_content
=
$this
->
params
[
"img"
];
if
(
preg_match
(
'/^(data:\s*image\/(\w+);base64,)/'
,
$base64_image_content
,
$array
))
{
if
(
preg_match
(
'/^(data:\s*image\/(\w+);base64,)/'
,
$base64_image_content
,
$array
))
{
$img_title
=
$array
[
2
];
//jpeg
$img_title
=
$array
[
2
];
//jpeg
$img
=
base64_decode
(
str_replace
(
$array
[
1
],
''
,
$base64_image_content
));
//返回文件流
$img
=
base64_decode
(
str_replace
(
$array
[
1
],
''
,
$base64_image_content
));
//返回文件流
}
}
$tmp_file
=
time
();
$tmp_file
=
time
();
$img_name
=
md5
(
uniqid
(
$tmp_file
))
.
'.'
.
$img_title
;
//图片名
$img_name
=
md5
(
uniqid
(
$tmp_file
))
.
'.'
.
$img_title
;
//图片名
$url
=
"week_work_img/"
.
$img_name
;
$url
=
'static/week_work_img/'
.
$img_name
;
file_put_contents
(
$url
,
$img
);
$data
[
'id'
]
=
''
;
$data
[
'house_id'
]
=
$this
->
request
->
data
[
'house_id'
];
$data
[
'start_time'
]
=
$this
->
request
->
data
[
'start_time'
];
$data
[
'end_time'
]
=
$this
->
request
->
data
[
'end_time'
];
$data
[
'img'
]
=
$img_name
;
$data
[
'agent_id'
]
=
$params
[
"agent_id"
];
$data
[
'table'
]
=
$this
->
request
->
data
[
'table'
];
if
(
empty
(
$this
->
request
->
data
[
'type'
]))
{
$data
[
'type'
]
=
0
;
//周报
}
else
{
$data
[
'type'
]
=
1
;
//日报
}
$result1
=
$this
->
Weekwork
->
save
(
$data
);
if
(
$result1
)
{
$code
=
200
;
$result
[
"status"
]
=
"1"
;
$msg
=
''
;
$result
[
"imgname"
]
=
$imgname
;
$result
[
"msg"
]
=
"成功"
;
if
(
file_put_contents
(
$url
,
$img
))
{
$agent_report
=
new
RAgentReport
();
if
(
empty
(
$this
->
params
[
'type'
]))
{
$data
[
'start_time'
]
=
$this
->
params
[
'start_time'
];
$data
[
'end_time'
]
=
$this
->
params
[
'start_time'
];
}
else
{
$data
[
'start_time'
]
=
$this
->
params
[
'start_time'
];
$data
[
'end_time'
]
=
$this
->
params
[
'end_time'
];
}
$data
[
'agent_id'
]
=
$this
->
params
[
'agent_id'
];
$data
[
'img_url'
]
=
$this
->
params
[
'agent_id'
];
$data
[
'type'
]
=
$this
->
params
[
'type'
];
$result
=
$agent_report
->
editData
(
$data
);
}
else
{
}
else
{
$result
[
"msg"
]
=
"上传失败"
;
$result
=
0
;
}
}
echo
json_encode
(
$result
);
if
(
!
$result
)
{
exit
;
$code
=
101
;
$msg
=
'生成图片失败'
;
}
return
$this
->
response
(
$code
,
$msg
);
}
}
}
}
\ No newline at end of file
application/config.php
View file @
398c2a8e
...
@@ -21,6 +21,7 @@ define('CHAT_IMG_URL', CURRENT_URL . 'static'. DS . 'chat_image/'); //聊天图
...
@@ -21,6 +21,7 @@ define('CHAT_IMG_URL', CURRENT_URL . 'static'. DS . 'chat_image/'); //聊天图
define
(
'CK_IMG_URL'
,
CURRENT_URL
.
'/resource/lib/Attachments/'
);
//ck 资源文件
define
(
'CK_IMG_URL'
,
CURRENT_URL
.
'/resource/lib/Attachments/'
);
//ck 资源文件
define
(
'_POOLKEY'
,
'FC100000022056027'
);
//隐私号码
define
(
'_POOLKEY'
,
'FC100000022056027'
);
//隐私号码
define
(
'_TLSYPoolKey'
,
'FC100000022056027'
);
//隐私号码池
define
(
'_TLSYPoolKey'
,
'FC100000022056027'
);
//隐私号码池
define
(
'WEEK_WORK_IMG'
,
CURRENT_URL
.
'static'
.
DS
.
'week_work_img/'
);
//周报日报目录
return
[
return
[
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 应用设置
// | 应用设置
...
...
application/model/RAgentReport.php
0 → 100644
View file @
398c2a8e
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/3/23
* Time: 14:30
*/
namespace
app\model
;
class
RAgentReport
extends
BaseModel
{
}
\ No newline at end of file
application/route.php
View file @
398c2a8e
...
@@ -356,6 +356,7 @@ Route::group('broker', [
...
@@ -356,6 +356,7 @@ Route::group('broker', [
'selectPerformanceByTime'
=>
[
'api_broker/Performance/selectPerformanceByTime'
,
[
'method'
=>
'get'
]],
'selectPerformanceByTime'
=>
[
'api_broker/Performance/selectPerformanceByTime'
,
[
'method'
=>
'get'
]],
'weekWorkImg'
=>
[
'api_broker/Statement/weekWorkImg'
,
[
'method'
=>
'post'
]],
//生成周报和日报图片
]);
]);
...
...
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