作者 郭盛
1 个管道 的构建 通过 耗费 2 秒

生成海报

... ... @@ -4,7 +4,6 @@
<list default="true" id="73de7205-e736-4b59-941a-a54ab4506a41" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/index/controller/OtherController.php" afterPath="$PROJECT_DIR$/api/index/controller/OtherController.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/index/controller/SendController.php" afterPath="$PROJECT_DIR$/api/index/controller/SendController.php" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
... ... @@ -15,11 +14,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="OtherController.php" pinned="false" current-in-tab="false">
<file leaf-file-name="OtherController.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/api/index/controller/OtherController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="661">
<caret line="325" column="5" lean-forward="true" selection-start-line="325" selection-start-column="5" selection-end-line="325" selection-end-column="5" />
<state relative-caret-position="234">
<caret line="283" column="0" lean-forward="true" selection-start-line="283" selection-start-column="0" selection-end-line="283" selection-end-column="0" />
<folding>
<element signature="e#129#158#0#PHP" expanded="true" />
<element signature="e#325#493#0#PHP" expanded="false" />
... ... @@ -38,27 +37,34 @@
<element signature="e#6001#6927#0#PHP" expanded="false" />
<element signature="e#6933#7237#0#PHP" expanded="false" />
<element signature="e#7242#7631#0#PHP" expanded="false" />
<element signature="e#7637#7981#0#PHP" expanded="false" />
<element signature="e#7986#9588#0#PHP" expanded="false" />
<element signature="e#9594#10174#0#PHP" expanded="false" />
<element signature="e#10180#11331#0#PHP" expanded="false" />
<element signature="e#11351#12215#0#PHP" expanded="false" />
<element signature="e#12242#12642#0#PHP" expanded="false" />
<element signature="e#12665#13238#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="SendController.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/api/index/controller/SendController.php">
<file leaf-file-name="config.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/api/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="125">
<caret line="99" column="5" lean-forward="true" selection-start-line="99" selection-start-column="5" selection-end-line="99" selection-end-column="5" />
<folding>
<element signature="e#296#1102#0#PHP" expanded="false" />
<element signature="e#1108#2740#0#PHP" expanded="false" />
<element signature="e#2746#2930#0#PHP" expanded="false" />
<element signature="e#3433#4607#0#PHP" expanded="false" />
<element signature="e#4612#6545#0#PHP" expanded="false" />
<element signature="e#6551#7483#0#PHP" expanded="false" />
<element signature="e#7488#9131#0#PHP" expanded="false" />
<element signature="e#9137#9946#0#PHP" expanded="false" />
<element signature="e#9951#11545#0#PHP" expanded="false" />
</folding>
<state relative-caret-position="574">
<caret line="260" column="53" lean-forward="false" selection-start-line="260" selection-start-column="21" selection-end-line="260" selection-end-column="53" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="RestBaseController.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/simplewind/cmf/controller/RestBaseController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-3775">
<caret line="106" column="9" lean-forward="true" selection-start-line="106" selection-start-column="9" selection-end-line="106" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
... ... @@ -122,9 +128,9 @@
<option value="$PROJECT_DIR$/api/index/controller/ReleaseController.php" />
<option value="$PROJECT_DIR$/api/index/controller/FinanceController.php" />
<option value="$PROJECT_DIR$/api/index/controller/ResourceController.php" />
<option value="$PROJECT_DIR$/api/index/controller/OtherController.php" />
<option value="$PROJECT_DIR$/simplewind/cmf/controller/RestBaseController.php" />
<option value="$PROJECT_DIR$/api/index/controller/SendController.php" />
<option value="$PROJECT_DIR$/api/index/controller/OtherController.php" />
</list>
</option>
</component>
... ... @@ -143,8 +149,8 @@
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds" extendedState="1">
<option name="x" value="317" />
<option name="y" value="91" />
<option name="x" value="-1" />
<option name="y" value="71" />
<option name="width" value="1661" />
<option name="height" value="937" />
</component>
... ... @@ -282,15 +288,15 @@
<workItem from="1569484124771" duration="560000" />
<workItem from="1569486627319" duration="2740000" />
<workItem from="1569494185536" duration="1054000" />
<workItem from="1569544728303" duration="16455000" />
<workItem from="1569544728303" duration="17760000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="390342000" />
<option name="totallyTimeSpent" value="391647000" />
</component>
<component name="ToolWindowManager">
<frame x="317" y="91" width="1661" height="937" extended-state="1" />
<frame x="-1" y="71" width="1661" height="937" extended-state="1" />
<editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.20424734" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
... ... @@ -486,13 +492,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="394">
<caret line="255" column="49" lean-forward="true" selection-start-line="255" selection-start-column="49" selection-end-line="255" selection-end-column="49" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/themes/admin_simpleboot3/admin/finance/edit.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1320">
... ... @@ -613,14 +612,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/index/controller/ActiveController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1321">
<caret line="197" column="0" lean-forward="true" selection-start-line="197" selection-start-column="0" selection-end-line="197" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/index/controller/FinanceController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="900">
... ... @@ -687,18 +678,70 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/index/controller/SendController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="325">
<caret line="98" column="26" lean-forward="false" selection-start-line="98" selection-start-column="26" selection-end-line="98" selection-end-column="26" />
<folding>
<element signature="e#296#1102#0#PHP" expanded="false" />
<element signature="e#1108#2740#0#PHP" expanded="false" />
<element signature="e#2746#2930#0#PHP" expanded="false" />
<element signature="e#2935#3427#0#PHP" expanded="false" />
<element signature="e#3433#4607#0#PHP" expanded="false" />
<element signature="e#4612#6545#0#PHP" expanded="false" />
<element signature="e#6551#7483#0#PHP" expanded="false" />
<element signature="e#7488#9131#0#PHP" expanded="false" />
<element signature="e#9137#9946#0#PHP" expanded="false" />
<element signature="e#9951#11545#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/simplewind/cmf/controller/RestBaseController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="625">
<caret line="292" column="0" lean-forward="true" selection-start-line="292" selection-start-column="0" selection-end-line="292" selection-end-column="0" />
<state relative-caret-position="-3775">
<caret line="106" column="9" lean-forward="true" selection-start-line="106" selection-start-column="9" selection-end-line="106" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="574">
<caret line="260" column="53" lean-forward="false" selection-start-line="260" selection-start-column="21" selection-end-line="260" selection-end-column="53" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/index/controller/ActiveController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175">
<caret line="602" column="4" lean-forward="false" selection-start-line="602" selection-start-column="4" selection-end-line="614" selection-end-column="5" />
<folding>
<element signature="e#330#916#0#PHP" expanded="false" />
<element signature="e#921#1852#0#PHP" expanded="false" />
<element signature="e#1858#2458#0#PHP" expanded="false" />
<element signature="e#2463#4046#0#PHP" expanded="false" />
<element signature="e#4052#5044#0#PHP" expanded="false" />
<element signature="e#5049#6284#0#PHP" expanded="false" />
<element signature="e#6290#6899#0#PHP" expanded="false" />
<element signature="e#6904#8090#0#PHP" expanded="false" />
<element signature="e#8096#8619#0#PHP" expanded="false" />
<element signature="e#8624#9157#0#PHP" expanded="false" />
<element signature="e#9163#9683#0#PHP" expanded="false" />
<element signature="e#9688#10261#0#PHP" expanded="false" />
<element signature="e#10267#10534#0#PHP" expanded="false" />
<element signature="e#10539#15152#0#PHP" expanded="false" />
<element signature="e#15158#15422#0#PHP" expanded="false" />
<element signature="e#15427#20222#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/index/controller/OtherController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="661">
<caret line="325" column="5" lean-forward="true" selection-start-line="325" selection-start-column="5" selection-end-line="325" selection-end-column="5" />
<state relative-caret-position="234">
<caret line="283" column="0" lean-forward="true" selection-start-line="283" selection-start-column="0" selection-end-line="283" selection-end-column="0" />
<folding>
<element signature="e#129#158#0#PHP" expanded="true" />
<element signature="e#325#493#0#PHP" expanded="false" />
... ... @@ -717,24 +760,13 @@
<element signature="e#6001#6927#0#PHP" expanded="false" />
<element signature="e#6933#7237#0#PHP" expanded="false" />
<element signature="e#7242#7631#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/index/controller/SendController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="125">
<caret line="99" column="5" lean-forward="true" selection-start-line="99" selection-start-column="5" selection-end-line="99" selection-end-column="5" />
<folding>
<element signature="e#296#1102#0#PHP" expanded="false" />
<element signature="e#1108#2740#0#PHP" expanded="false" />
<element signature="e#2746#2930#0#PHP" expanded="false" />
<element signature="e#3433#4607#0#PHP" expanded="false" />
<element signature="e#4612#6545#0#PHP" expanded="false" />
<element signature="e#6551#7483#0#PHP" expanded="false" />
<element signature="e#7488#9131#0#PHP" expanded="false" />
<element signature="e#9137#9946#0#PHP" expanded="false" />
<element signature="e#9951#11545#0#PHP" expanded="false" />
<element signature="e#7637#7981#0#PHP" expanded="false" />
<element signature="e#7986#9588#0#PHP" expanded="false" />
<element signature="e#9594#10174#0#PHP" expanded="false" />
<element signature="e#10180#11331#0#PHP" expanded="false" />
<element signature="e#11351#12215#0#PHP" expanded="false" />
<element signature="e#12242#12642#0#PHP" expanded="false" />
<element signature="e#12665#13238#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ...
... ... @@ -324,21 +324,102 @@ class OtherController extends RestBaseController
$result->save($savePath."poster_".$user_id."_$job_id.png");
$this->success('SUCCESS',['url'=>cmf_get_image_url("poster/poster_".$user_id."_$job_id.png")]);
}
// public function getCode($user_id,$job_id,$url){
// $savePath = './../upload/get_code/';
// $filename = "code_$user_id.jpg";
// if(!file_exists($savePath.$filename)){
// $data = [
// 'app_id' => 'wx5d55a70fea6f8f97',
// 'secret' => '8e4ceb09d76596b6f74fc79fdb3331c4',
// ];
// $app = new Application($data);
// $accessToken = $app->access_token;
// $access_token = $accessToken->getToken();
// $qrcode = $this->imgShare($user_id,$job_id,$access_token,$url);
// }elsE{
// $qrcode = "qrcode/code_".$user_id."_$job_id.jpg";
public function getCode($user_id,$job_id,$url){
$savePath = './../upload/get_code/';
$filename = "code_$user_id.jpg";
if(!file_exists($savePath.$filename)){
$data = [
'app_id' => 'wxa6fdb286b1a5ad67',
'secret' => '029cb6043b9cc94a2afeaa49da1f9e71',
];
$access_token = $this->get_access_token();
$qrcode = $this->imgShare($user_id,$job_id,$access_token,$url);
}elsE{
$qrcode = "qrcode/code_".$user_id."_$job_id.jpg";
}
return $qrcode;
}
public function imgShare($user_id,$job_id,$access_token,$path,$is_qiniu = 0){
$url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=".$access_token;
$post['path'] = $path;//'pages/begin/begin?share_id='.$user_id.'&job_id='.$job_id;
$post['width'] = 400;
$result = $this->curl($url, json_encode($post));
$array = json_decode($result, true);
if($array['errmsg']) {
return false;
}
// 分享二维码保存到用户数据
if (!file_exists(ROOT_PATH . 'public' . DS . 'upload/qrcode/')) {
mkdir(ROOT_PATH . 'public' . DS . 'upload/qrcode/', 0777, true);
}
$filename = "code_".$user_id."_$job_id.jpg";
$furl = ROOT_PATH . 'public' . DS . 'upload/qrcode/'.$filename;
file_put_contents($furl, $result);
// 判断是否上传到七牛云
// if($is_qiniu) {
// // 本地图片上传到七牛云
// $storage = new Storage();
// $storage->upload($filename, './../upload/qrcode/' . $filename, 'image');
//// @unlink('../../public/upload/user_qrcode/'.$filename);
// }
// return $qrcode;
// }
return "qrcode/".$filename;
}
// curl方法
protected function curl($url, $post = null, $header = null) {
// 初始化
$curl = curl_init();
// 设置抓取的url
curl_setopt($curl, CURLOPT_URL, $url);
// 请求头
if($header) {
curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
}
// 设置头文件的信息作为数据流输出
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_NOBODY, 0);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
// 设置获取的信息以文件流的形式返回,而不是直接输出。
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if($post) {
curl_setopt($curl, CURLOPT_POST, 1);
//把POST的变量加上
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
}
// 执行命令
$data = curl_exec($curl);
if (curl_errno($curl)) {
$data = curl_error($curl);
}
return $data;
}
//获取access_token
public function get_access_token()
{
$app_id = config('app_id');
$app_secret = config('app_secret');
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$app_id.'&secret='.$app_secret;
$res = $this->http_get($url);
$json_arr = json_decode($res,true);
$token = $json_arr['access_token'];
return $token;
}
//curl get请求
public function http_get($url){
$curl = curl_init();//启动一个CURL会话
curl_setopt($curl, CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 对认证证书来源的检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, false);//不开启header
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // 获取的信息以文件流的形式返回
$result = curl_exec($curl); //执行操作
curl_close($curl);
return $result;
}
}
\ No newline at end of file
... ...