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

图片水印

... ... @@ -2,7 +2,10 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e93f11c2-a7d9-4d35-8b1c-8dd18e7f5fef" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/application/api/controller/Pay.php" afterPath="$PROJECT_DIR$/application/api/controller/Pay.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/application/api/controller/User.php" afterPath="$PROJECT_DIR$/application/api/controller/User.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/public/api.html" afterPath="$PROJECT_DIR$/public/api.html" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
... ... @@ -16,7 +19,7 @@
<file leaf-file-name="User.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/application/api/controller/User.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="721">
<state relative-caret-position="537">
<caret line="453" column="58" lean-forward="false" selection-start-line="453" selection-start-column="58" selection-end-line="453" selection-end-column="58" />
<folding>
<element signature="e#38#68#0#PHP" expanded="true" />
... ... @@ -24,7 +27,6 @@
<element signature="e#462#1200#0#PHP" expanded="false" />
<element signature="e#1205#2868#0#PHP" expanded="false" />
<element signature="e#2874#3402#0#PHP" expanded="false" />
<element signature="e#3407#4178#0#PHP" expanded="false" />
<element signature="e#4184#4591#0#PHP" expanded="false" />
<element signature="e#4596#4939#0#PHP" expanded="false" />
<element signature="e#4945#5782#0#PHP" expanded="false" />
... ... @@ -36,26 +38,42 @@
<element signature="e#11641#12217#0#PHP" expanded="false" />
<element signature="e#12222#12769#0#PHP" expanded="false" />
<element signature="e#12775#13459#0#PHP" expanded="false" />
<element signature="e#15142#16012#0#PHP" expanded="false" />
<element signature="e#16017#18111#0#PHP" expanded="false" />
<element signature="e#18117#18494#0#PHP" expanded="false" />
<element signature="e#18499#18763#0#PHP" expanded="false" />
<element signature="e#18769#19274#0#PHP" expanded="false" />
<element signature="e#19279#19530#0#PHP" expanded="false" />
<element signature="e#19536#20015#0#PHP" expanded="false" />
<element signature="e#20020#20777#0#PHP" expanded="false" />
<element signature="e#20783#21146#0#PHP" expanded="false" />
<element signature="e#21151#21342#0#PHP" expanded="false" />
<element signature="e#21348#21706#0#PHP" expanded="false" />
<element signature="e#21711#21901#0#PHP" expanded="false" />
<element signature="e#21907#23050#0#PHP" expanded="false" />
<element signature="e#23055#25610#0#PHP" expanded="false" />
<element signature="e#25616#26107#0#PHP" expanded="false" />
<element signature="e#26112#27325#0#PHP" expanded="false" />
<element signature="e#27331#27865#0#PHP" expanded="false" />
<element signature="e#27870#28784#0#PHP" expanded="false" />
<element signature="e#28790#29321#0#PHP" expanded="false" />
<element signature="e#29326#30246#0#PHP" expanded="false" />
<element signature="e#15260#16130#0#PHP" expanded="false" />
<element signature="e#16135#18229#0#PHP" expanded="false" />
<element signature="e#18235#18612#0#PHP" expanded="false" />
<element signature="e#18617#18881#0#PHP" expanded="false" />
<element signature="e#18887#19392#0#PHP" expanded="false" />
<element signature="e#19397#19648#0#PHP" expanded="false" />
<element signature="e#19654#20133#0#PHP" expanded="false" />
<element signature="e#20138#20895#0#PHP" expanded="false" />
<element signature="e#20901#21264#0#PHP" expanded="false" />
<element signature="e#21269#21460#0#PHP" expanded="false" />
<element signature="e#21466#21824#0#PHP" expanded="false" />
<element signature="e#21829#22019#0#PHP" expanded="false" />
<element signature="e#22025#23168#0#PHP" expanded="false" />
<element signature="e#23173#25728#0#PHP" expanded="false" />
<element signature="e#25734#26225#0#PHP" expanded="false" />
<element signature="e#26230#27443#0#PHP" expanded="false" />
<element signature="e#27449#27983#0#PHP" expanded="false" />
<element signature="e#27988#28902#0#PHP" expanded="false" />
<element signature="e#28908#29439#0#PHP" expanded="false" />
<element signature="e#29444#30364#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Pay.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/application/api/controller/Pay.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="525">
<caret line="102" column="35" lean-forward="false" selection-start-line="102" selection-start-column="35" selection-end-line="102" selection-end-column="35" />
<folding>
<element signature="e#450#569#0#PHP" expanded="false" />
<element signature="e#575#888#0#PHP" expanded="false" />
<element signature="e#893#2938#0#PHP" expanded="false" />
<element signature="e#5337#5554#0#PHP" expanded="false" />
<element signature="e#5581#7480#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ... @@ -109,13 +127,13 @@
<option value="$PROJECT_DIR$/application/admin/view/video/edit.html" />
<option value="$PROJECT_DIR$/composer.json" />
<option value="$PROJECT_DIR$/public/assets/js/backend/user/user.js" />
<option value="$PROJECT_DIR$/application/api/controller/Pay.php" />
<option value="$PROJECT_DIR$/application/admin/view/vip/index.html" />
<option value="$PROJECT_DIR$/public/assets/js/backend/vip.js" />
<option value="$PROJECT_DIR$/application/admin/view/pic/add.html" />
<option value="$PROJECT_DIR$/application/admin/view/pic/edit.html" />
<option value="$PROJECT_DIR$/public/assets/js/backend/pic.js" />
<option value="$PROJECT_DIR$/application/extra/verify.php" />
<option value="$PROJECT_DIR$/application/api/controller/Pay.php" />
<option value="$PROJECT_DIR$/application/api/controller/User.php" />
</list>
</option>
... ... @@ -134,11 +152,11 @@
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds" extendedState="1">
<option name="x" value="132" />
<option name="y" value="34" />
<component name="ProjectFrameBounds">
<option name="x" value="441" />
<option name="y" value="86" />
<option name="width" value="1699" />
<option name="height" value="977" />
<option name="height" value="974" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
... ... @@ -235,7 +253,7 @@
<workItem from="1574141466352" duration="745000" />
<workItem from="1574143209694" duration="3660000" />
<workItem from="1574146994475" duration="23222000" />
<workItem from="1574209189943" duration="31042000" />
<workItem from="1574209189943" duration="31449000" />
</task>
<task id="LOCAL-00001" summary="调试">
<created>1574145133364</created>
... ... @@ -248,7 +266,7 @@
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="102617000" />
<option name="totallyTimeSpent" value="103024000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
... ... @@ -260,7 +278,7 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="132" y="34" width="1699" height="977" extended-state="1" />
<frame x="441" y="86" width="1699" height="974" extended-state="0" />
<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.14887126" sideWeight="0.5" order="1" 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.32912987" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
... ... @@ -269,7 +287,7 @@
<window_info id="Version Control" 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="1" side_tool="false" content_ui="tabs" />
<window_info id="Run" 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="5" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.15119047" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.15053764" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
... ... @@ -604,19 +622,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/api/controller/Pay.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="409">
<caret line="129" column="39" lean-forward="false" selection-start-line="129" selection-start-column="39" selection-end-line="129" selection-end-column="39" />
<folding>
<element signature="e#450#569#0#PHP" expanded="false" />
<element signature="e#575#888#0#PHP" expanded="false" />
<element signature="e#893#2938#0#PHP" expanded="false" />
<element signature="e#2961#3178#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/admin/controller/Vip.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-116">
... ... @@ -689,9 +694,23 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/api/controller/Pay.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="525">
<caret line="102" column="35" lean-forward="false" selection-start-line="102" selection-start-column="35" selection-end-line="102" selection-end-column="35" />
<folding>
<element signature="e#450#569#0#PHP" expanded="false" />
<element signature="e#575#888#0#PHP" expanded="false" />
<element signature="e#893#2938#0#PHP" expanded="false" />
<element signature="e#5337#5554#0#PHP" expanded="false" />
<element signature="e#5581#7480#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/api/controller/User.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="721">
<state relative-caret-position="537">
<caret line="453" column="58" lean-forward="false" selection-start-line="453" selection-start-column="58" selection-end-line="453" selection-end-column="58" />
<folding>
<element signature="e#38#68#0#PHP" expanded="true" />
... ... @@ -699,7 +718,6 @@
<element signature="e#462#1200#0#PHP" expanded="false" />
<element signature="e#1205#2868#0#PHP" expanded="false" />
<element signature="e#2874#3402#0#PHP" expanded="false" />
<element signature="e#3407#4178#0#PHP" expanded="false" />
<element signature="e#4184#4591#0#PHP" expanded="false" />
<element signature="e#4596#4939#0#PHP" expanded="false" />
<element signature="e#4945#5782#0#PHP" expanded="false" />
... ... @@ -711,26 +729,26 @@
<element signature="e#11641#12217#0#PHP" expanded="false" />
<element signature="e#12222#12769#0#PHP" expanded="false" />
<element signature="e#12775#13459#0#PHP" expanded="false" />
<element signature="e#15142#16012#0#PHP" expanded="false" />
<element signature="e#16017#18111#0#PHP" expanded="false" />
<element signature="e#18117#18494#0#PHP" expanded="false" />
<element signature="e#18499#18763#0#PHP" expanded="false" />
<element signature="e#18769#19274#0#PHP" expanded="false" />
<element signature="e#19279#19530#0#PHP" expanded="false" />
<element signature="e#19536#20015#0#PHP" expanded="false" />
<element signature="e#20020#20777#0#PHP" expanded="false" />
<element signature="e#20783#21146#0#PHP" expanded="false" />
<element signature="e#21151#21342#0#PHP" expanded="false" />
<element signature="e#21348#21706#0#PHP" expanded="false" />
<element signature="e#21711#21901#0#PHP" expanded="false" />
<element signature="e#21907#23050#0#PHP" expanded="false" />
<element signature="e#23055#25610#0#PHP" expanded="false" />
<element signature="e#25616#26107#0#PHP" expanded="false" />
<element signature="e#26112#27325#0#PHP" expanded="false" />
<element signature="e#27331#27865#0#PHP" expanded="false" />
<element signature="e#27870#28784#0#PHP" expanded="false" />
<element signature="e#28790#29321#0#PHP" expanded="false" />
<element signature="e#29326#30246#0#PHP" expanded="false" />
<element signature="e#15260#16130#0#PHP" expanded="false" />
<element signature="e#16135#18229#0#PHP" expanded="false" />
<element signature="e#18235#18612#0#PHP" expanded="false" />
<element signature="e#18617#18881#0#PHP" expanded="false" />
<element signature="e#18887#19392#0#PHP" expanded="false" />
<element signature="e#19397#19648#0#PHP" expanded="false" />
<element signature="e#19654#20133#0#PHP" expanded="false" />
<element signature="e#20138#20895#0#PHP" expanded="false" />
<element signature="e#20901#21264#0#PHP" expanded="false" />
<element signature="e#21269#21460#0#PHP" expanded="false" />
<element signature="e#21466#21824#0#PHP" expanded="false" />
<element signature="e#21829#22019#0#PHP" expanded="false" />
<element signature="e#22025#23168#0#PHP" expanded="false" />
<element signature="e#23173#25728#0#PHP" expanded="false" />
<element signature="e#25734#26225#0#PHP" expanded="false" />
<element signature="e#26230#27443#0#PHP" expanded="false" />
<element signature="e#27449#27983#0#PHP" expanded="false" />
<element signature="e#27988#28902#0#PHP" expanded="false" />
<element signature="e#28908#29439#0#PHP" expanded="false" />
<element signature="e#29444#30364#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ...
... ... @@ -82,6 +82,62 @@ class Pay extends Api
}
}
/**
* @ApiTitle (图片购买支付)
* @ApiSummary (图片购买支付)
* @ApiMethod (POST)
* @ApiRoute (/api/pay/picpay)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="order_id", type="inter", required=true, description="订单id")
*
*/
public function picpay(){
$rule = config('verify.path');
if($this->request->isPost()){
$order_id = $this->request->post('order_id');
$openid = $this->getopenid();
if(empty($openid)){
$this->error(['code'=>2,'msg'=>'openid不能为空']);
}
$data = Db::name('order')->where('id',$order_id)->find();
if($data){
if($data['status'] == 2){
$this->error('该订单已支付过了');
}else{
//创建支付对象
$config = config('verify.wx_pay');
$app = Factory::payment($config);
$result = $app->order->unify([
'body' => '山东航拍',
'out_trade_no' => $data['num'],//支付订单号
'total_fee' => $data['money']*100,//单位分
'notify_url' => $rule.'api/pay/payOrderNotify', // 支付结果通知网址,如果不设置则会使用配置里的默认地址
'trade_type' => 'JSAPI', // 请对应换成你的支付方式对应的值类型
'openid' => $openid,
]);
if($result['return_code'] === 'SUCCESS' && $result['result_code'] === 'SUCCESS'){
$params = [
'appId' => $config['app_id'],
'timeStamp' => time(),
'nonceStr' => $result['nonce_str'], // 统一下单返回的随机字符串
'package' => 'prepay_id='.$result['prepay_id'], // 统一下单Id
'signType' => 'MD5', // 签名方法
];
// 注意这里用的是商户平台的Key进行二次签名
$params['paySign'] = generate_sign($params, $config['key']);
$this->success('成功',$params);
}
$this->error($result['err_code_des']);
}
}else{
$this->error('无效的订单');
}
}else{
$this->error('请求方式错误');
}
}
//获取用户openid
public function getopenid()
{
... ...
... ... @@ -432,6 +432,7 @@ class User extends Api
if(empty($data)){
$this->error(['code'=>2,'msg'=>'参数错误']);
}
$data['water_url'] = $rule.$data['water_url'];
$data['vip_price'] = $data['price'] * 0.75;
$data['thumbnail'] = $rule.$data['thumbnail'];
$data['content'] = strip_tags($data['content']);
... ... @@ -450,6 +451,7 @@ class User extends Api
$this->error(['code'=>2,'msg'=>'参数错误']);
}
$data['is_vip'] = 1;
$data['water_url'] = $rule.$data['water_url'];
$data['vip_price'] = $data['price'] * 0.75;
$data['thumbnail'] = $rule.$data['thumbnail'];
$data['content'] = strip_tags($data['content']);
... ...
此 diff 太大无法显示。