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

生成海报

... ... @@ -2,7 +2,6 @@
<project version="4">
<component name="ChangeListManager">
<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" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
... ... @@ -17,8 +16,8 @@
<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="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" />
<state relative-caret-position="550">
<caret line="329" column="46" lean-forward="true" selection-start-line="329" selection-start-column="46" selection-end-line="329" selection-end-column="46" />
<folding>
<element signature="e#129#158#0#PHP" expanded="true" />
<element signature="e#325#493#0#PHP" expanded="false" />
... ... @@ -35,35 +34,21 @@
<element signature="e#5407#5707#0#PHP" expanded="false" />
<element signature="e#5717#5996#0#PHP" expanded="false" />
<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" />
<element signature="e#9644#10495#0#PHP" expanded="false" />
<element signature="e#10515#11379#0#PHP" expanded="false" />
<element signature="e#11406#11806#0#PHP" expanded="false" />
<element signature="e#11829#12402#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
</file>
<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="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" />
<caret line="106" column="9" lean-forward="false" selection-start-line="106" selection-start-column="9" selection-end-line="106" selection-end-column="9" />
<folding />
</state>
</provider>
... ... @@ -148,11 +133,11 @@
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds" extendedState="1">
<option name="x" value="-1" />
<option name="y" value="71" />
<option name="width" value="1661" />
<option name="height" value="937" />
<component name="ProjectFrameBounds" extendedState="7">
<option name="x" value="194" />
<option name="y" value="110" />
<option name="width" value="1657" />
<option name="height" value="921" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
... ... @@ -211,7 +196,7 @@
<item name="resource" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="public" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="upload" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="portal" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="qrcode" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
</expand>
<select />
... ... @@ -226,7 +211,11 @@
<property name="DefaultHtmlFileTemplate" value="HTML File" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\htdocs\project1\resource\public" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="D:\htdocs\project1\resource\public\static\font-awesome\fonts" />
<recent name="D:\htdocs\project1\resource\api\index\controller" />
</key>
</component>
... ... @@ -288,18 +277,18 @@
<workItem from="1569484124771" duration="560000" />
<workItem from="1569486627319" duration="2740000" />
<workItem from="1569494185536" duration="1054000" />
<workItem from="1569544728303" duration="17760000" />
<workItem from="1569544728303" duration="21293000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="391647000" />
<option name="totallyTimeSpent" value="395180000" />
</component>
<component name="ToolWindowManager">
<frame x="-1" y="71" width="1661" height="937" extended-state="1" />
<frame x="-8" y="-8" width="1936" height="1056" extended-state="7" />
<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" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17430703" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.34076828" sideWeight="0.50296295" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
... ... @@ -326,53 +315,11 @@
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<option name="time" value="5" />
<option name="time" value="6" />
</breakpoint-manager>
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/app/database.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/debug.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/install/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="346">
<caret line="225" column="26" lean-forward="true" selection-start-line="225" selection-start-column="26" selection-end-line="225" selection-end-column="26" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/admin/controller/AttractController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-71">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/simplewind/cmf/common.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="297">
<caret line="454" column="9" lean-forward="false" selection-start-line="454" selection-start-column="9" selection-end-line="454" selection-end-column="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/user/controller/AssetController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
... ... @@ -700,15 +647,7 @@
<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>
<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" />
<caret line="106" column="9" lean-forward="false" selection-start-line="106" selection-start-column="9" selection-end-line="106" selection-end-column="9" />
<folding />
</state>
</provider>
... ... @@ -738,10 +677,51 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/upload/portal/20190831/d8585d9b898179f2871f8bd4c760c0ec.png">
<provider selected="true" editor-type-id="images">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/upload/portal/20190831/09a03adff86b1ef6d96ab3496f48a45a.png">
<provider selected="true" editor-type-id="images">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="274">
<caret line="248" column="6" lean-forward="true" selection-start-line="248" selection-start-column="6" selection-end-line="248" selection-end-column="6" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/favicon.ico">
<provider selected="true" editor-type-id="images">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/simplewind/vendor/topthink/think-image/src/Image.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="258">
<caret line="95" column="27" lean-forward="false" selection-start-line="95" selection-start-column="27" selection-end-line="95" selection-end-column="27" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/upload/qrcode/code_10_22.jpg">
<provider selected="true" editor-type-id="images">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/upload/qrcode/code_11_22.jpg">
<provider selected="true" editor-type-id="images">
<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="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" />
<state relative-caret-position="550">
<caret line="329" column="46" lean-forward="true" selection-start-line="329" selection-start-column="46" selection-end-line="329" selection-end-column="46" />
<folding>
<element signature="e#129#158#0#PHP" expanded="true" />
<element signature="e#325#493#0#PHP" expanded="false" />
... ... @@ -758,15 +738,11 @@
<element signature="e#5407#5707#0#PHP" expanded="false" />
<element signature="e#5717#5996#0#PHP" expanded="false" />
<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" />
<element signature="e#9644#10495#0#PHP" expanded="false" />
<element signature="e#10515#11379#0#PHP" expanded="false" />
<element signature="e#11406#11806#0#PHP" expanded="false" />
<element signature="e#11829#12402#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ...
... ... @@ -284,22 +284,23 @@ class OtherController extends RestBaseController
/**
* @title 生成海报
* @description
* @description 生成海报
* @author GuoSheng
* @url /index/Other/getPoster
* @method GET
*
* @header name:XX-Token require:1 default: desc:token
*
* @param name:job_id require:1 default: desc:招聘信息id
* @param name:url require:1 default: desc:页面路径与参数
* @param name:job_id type:int require:1 other: desc:信息id
* @param name:route type:string require:1 other: desc:页面路径与参数
*
* @return url:海报地址
*
*/
public function getPoster(){
$job_id = $this->request->param('job_id',0,'intval');
$url = $this->request->param('url');
$user_id = $this->getUserId();
$user_id= $this->getUserId();
$job_id = $this->request->param('job_id');
$url = $this->request->param('route');
if(empty($user_id) || empty($job_id) || empty($url)){
$this->error(['code'=>40005,'msg'=>'缺少必要参数']);
}
... ... @@ -315,12 +316,10 @@ class OtherController extends RestBaseController
$jobModel = new JobModel();
$where['id'] = ['eq',$job_id];
$job = $jobModel->getOne($where);
$image = \think\Image::open(ROOT_PATH."public/bg.png");
$result = $image->water(ROOT_PATH."public/upload/$code",[360,1420],100)
->text($job['job_name'],ROOT_PATH.'public/static/font-awesome/fonts/PingFang Medium.ttf',45,'#070C1D',[100,1100])
->text($job['job_city']."-".$job['job_county'],ROOT_PATH.'public/static/font-awesome/fonts/PingFang Medium.ttf',30,'#070C1D',[700,1200])
->text($job['wage'],ROOT_PATH.'public/static/font-awesome/fonts/PingFang Medium.ttf',30,'#FF5D2E',[100,1200])
->text($job['occupation_name'],ROOT_PATH.'public/static/font-awesome/fonts/PingFang Medium.ttf',32,'#070C1D',[100,1300]);
->text($job['job_title'],ROOT_PATH.'public/static/font-awesome/fonts/PingFang Medium.ttf',45,'#070C1D',[100,1100]);
$result->save($savePath."poster_".$user_id."_$job_id.png");
$this->success('SUCCESS',['url'=>cmf_get_image_url("poster/poster_".$user_id."_$job_id.png")]);
}
... ... @@ -329,10 +328,6 @@ class OtherController extends RestBaseController
$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{
... ... @@ -340,8 +335,7 @@ class OtherController extends RestBaseController
}
return $qrcode;
}
public function imgShare($user_id,$job_id,$access_token,$path,$is_qiniu = 0){
public function imgShare($user_id,$job_id,$access_token,$path){
$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;
... ... @@ -357,13 +351,6 @@ class OtherController extends RestBaseController
$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/".$filename;
}
... ...