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

修改备注

... ... @@ -3,6 +3,7 @@
<component name="ChangeListManager">
<list default="true" id="0011664b-87e9-41bd-9f37-18792fb15777" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/index/controller/ShopgoodsController.php" afterPath="$PROJECT_DIR$/api/index/controller/ShopgoodsController.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/index/controller/UserController.php" afterPath="$PROJECT_DIR$/api/index/controller/UserController.php" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
... ... @@ -27,8 +28,8 @@
<file leaf-file-name="UserController.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/api/index/controller/UserController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="882">
<caret line="504" column="7" lean-forward="true" selection-start-line="504" selection-start-column="7" selection-end-line="504" selection-end-column="7" />
<state relative-caret-position="982">
<caret line="803" column="23" lean-forward="false" selection-start-line="803" selection-start-column="12" selection-end-line="803" selection-end-column="23" />
<folding>
<element signature="e#345#694#0#PHP" expanded="false" />
<element signature="e#699#1464#0#PHP" expanded="false" />
... ... @@ -66,6 +67,10 @@
<element signature="e#22028#23108#0#PHP" expanded="false" />
<element signature="e#23114#23538#0#PHP" expanded="false" />
<element signature="e#23543#24154#0#PHP" expanded="false" />
<element signature="e#26229#27093#0#PHP" expanded="false" />
<element signature="e#27120#27520#0#PHP" expanded="false" />
<element signature="e#27544#28117#0#PHP" expanded="false" />
<element signature="e#28140#28950#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ... @@ -74,8 +79,8 @@
<file leaf-file-name="ShopgoodsController.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/api/index/controller/ShopgoodsController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="209">
<caret line="421" column="38" lean-forward="true" selection-start-line="421" selection-start-column="38" selection-end-line="421" selection-end-column="38" />
<state relative-caret-position="257">
<caret line="319" column="54" lean-forward="true" selection-start-line="319" selection-start-column="54" selection-end-line="319" selection-end-column="54" />
<folding>
<element signature="e#411#604#0#PHP" expanded="false" />
<element signature="e#609#825#0#PHP" expanded="false" />
... ... @@ -95,10 +100,11 @@
<element signature="e#7331#7740#0#PHP" expanded="false" />
<element signature="e#7746#8131#0#PHP" expanded="false" />
<element signature="e#8136#8807#0#PHP" expanded="false" />
<element signature="e#8813#9259#0#PHP" expanded="false" />
<element signature="e#9264#10115#0#PHP" expanded="false" />
<element signature="e#10121#10391#0#PHP" expanded="false" />
<element signature="e#10396#10872#0#PHP" expanded="false" />
<element signature="e#10878#11508#0#PHP" expanded="false" />
<element signature="e#11513#12865#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ... @@ -172,8 +178,8 @@
<option value="$PROJECT_DIR$/public/themes/simpleboot3/index/index.html" />
<option value="$PROJECT_DIR$/api/index/controller/SubscribeController.php" />
<option value="$PROJECT_DIR$/simplewind/cmf/controller/RestBaseController.php" />
<option value="$PROJECT_DIR$/api/index/controller/UserController.php" />
<option value="$PROJECT_DIR$/api/index/model/ShopgoodsModel.php" />
<option value="$PROJECT_DIR$/api/index/controller/UserController.php" />
<option value="$PROJECT_DIR$/api/index/controller/ShopgoodsController.php" />
</list>
</option>
... ... @@ -192,9 +198,9 @@
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds">
<option name="x" value="286" />
<option name="y" value="102" />
<component name="ProjectFrameBounds" extendedState="1">
<option name="x" value="255" />
<option name="y" value="92" />
<option name="width" value="1582" />
<option name="height" value="969" />
</component>
... ... @@ -240,6 +246,17 @@
<item name="index" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="controller" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path>
<item name="scrap" type="b2602c69:ProjectViewProjectNode" />
<item name="scrap" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="public" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path>
<item name="scrap" type="b2602c69:ProjectViewProjectNode" />
<item name="scrap" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="public" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="upload" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
</expand>
<select />
</subPane>
... ... @@ -248,7 +265,7 @@
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../decor/decor" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../areial" />
<property name="DefaultHtmlFileTemplate" value="HTML File" />
</component>
<component name="RecentsManager">
... ... @@ -336,15 +353,15 @@
<workItem from="1575016153150" duration="3315000" />
<workItem from="1575246616478" duration="21722000" />
<workItem from="1575278769037" duration="7395000" />
<workItem from="1575332430854" duration="6882000" />
<workItem from="1575332430854" duration="9615000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="417340000" />
<option name="totallyTimeSpent" value="420073000" />
</component>
<component name="ToolWindowManager">
<frame x="286" y="102" width="1582" height="969" extended-state="0" />
<frame x="255" y="92" width="1582" height="969" 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.19513798" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
... ... @@ -757,10 +774,18 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/index/model/ShopgoodsModel.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="556">
<caret line="43" column="37" lean-forward="true" selection-start-line="43" selection-start-column="37" selection-end-line="43" selection-end-column="37" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/index/controller/UserController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="882">
<caret line="504" column="7" lean-forward="true" selection-start-line="504" selection-start-column="7" selection-end-line="504" selection-end-column="7" />
<state relative-caret-position="982">
<caret line="803" column="23" lean-forward="false" selection-start-line="803" selection-start-column="12" selection-end-line="803" selection-end-column="23" />
<folding>
<element signature="e#345#694#0#PHP" expanded="false" />
<element signature="e#699#1464#0#PHP" expanded="false" />
... ... @@ -798,22 +823,18 @@
<element signature="e#22028#23108#0#PHP" expanded="false" />
<element signature="e#23114#23538#0#PHP" expanded="false" />
<element signature="e#23543#24154#0#PHP" expanded="false" />
<element signature="e#26229#27093#0#PHP" expanded="false" />
<element signature="e#27120#27520#0#PHP" expanded="false" />
<element signature="e#27544#28117#0#PHP" expanded="false" />
<element signature="e#28140#28950#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/index/model/ShopgoodsModel.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="556">
<caret line="43" column="37" lean-forward="true" selection-start-line="43" selection-start-column="37" selection-end-line="43" selection-end-column="37" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/api/index/controller/ShopgoodsController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="209">
<caret line="421" column="38" lean-forward="true" selection-start-line="421" selection-start-column="38" selection-end-line="421" selection-end-column="38" />
<state relative-caret-position="257">
<caret line="319" column="54" lean-forward="true" selection-start-line="319" selection-start-column="54" selection-end-line="319" selection-end-column="54" />
<folding>
<element signature="e#411#604#0#PHP" expanded="false" />
<element signature="e#609#825#0#PHP" expanded="false" />
... ... @@ -833,10 +854,11 @@
<element signature="e#7331#7740#0#PHP" expanded="false" />
<element signature="e#7746#8131#0#PHP" expanded="false" />
<element signature="e#8136#8807#0#PHP" expanded="false" />
<element signature="e#8813#9259#0#PHP" expanded="false" />
<element signature="e#9264#10115#0#PHP" expanded="false" />
<element signature="e#10121#10391#0#PHP" expanded="false" />
<element signature="e#10396#10872#0#PHP" expanded="false" />
<element signature="e#10878#11508#0#PHP" expanded="false" />
<element signature="e#11513#12865#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ...
... ... @@ -385,13 +385,13 @@ class ShopgoodsController extends RestBaseController
*
* @header name:XX-Token require:1 default: desc:token
*
* @param name:shoprecycle_id require:1 other: desc: 上门回收地址ID
* @param name:shopgoods_id require:1 other desc: 商品ID
* @param name:num require:1 other desc: 购买数量
* @param name:goods_money require:1 other desc: 商品金额
* @param name:total require:1 other desc: 总价
* @param name:express require:1 other desc: 配送方式(1快递配送 2同城配送)
* @param name:content require:1 other desc: 留言备注
* @param name:shoprecycle_id require:1 default: desc:上门回收地址ID
* @param name:shopgoods_id require:1 default: desc:商品ID
* @param name:num require:1 default: desc:购买数量
* @param name:goods_money require:1 default: desc:商品金额
* @param name:total require:1 default: desc:总价
* @param name:express require:1 default: desc:配送方式(1快递配送2同城配送)
* @param name:content require:1 default: desc:留言备注
*
*/
public function shoporder()
... ...
... ... @@ -777,4 +777,137 @@ class UserController extends RestBaseController
$this->error('sql语句错误');
}
}
/**
* @title 有奖分享(二维码)
* @description 有奖分享(二维码)
* @author Guosheng
* @url /index/User/code
* @method GET
*
* @header name:XX-Token require:1 default: desc:token
*
* @param name:route type:string require:1 other: desc:页面路径与参数
*
*/
public function code()
{
$user_id = $this->getUserId();
$url = $this->request->param('route');
if(empty($url)){
$this->error(['code'=>40005,'msg'=>'缺少必要参数']);
}
$savePath = './../upload/poster/';
if (!file_exists($savePath)){
mkdir($savePath, 0777,true);
}
if(!file_exists("./upload/qrcode/code_$user_id.jpg")){
$code = $this->getusercode($user_id,$url);
}else{
$code = "qrcode/code_$user_id.jpg";
}
}
public function getusercode($user_id,$url){
$savePath = './../upload/get_code/';
$filename = "code_$user_id.jpg";
if(!file_exists($savePath.$filename)){
$access_token = $this->get_access_token();
$qrcode = $this->imgShare($user_id,$access_token,$url);
}elsE{
$qrcode = "qrcode/code_".$user_id.".jpg";
}
return $qrcode;
}
public function imgShare($user_id,$access_token,$path){
$url = "https://api.weixin.qq.com/wxa/getwxacode?access_token=".$access_token;
$post['path'] = $path;
$post['width'] = 280;
$post['is_hyaline'] = true;
$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);
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;
}
//curl post请求
public function http_post($url,$data){
$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_POST, true); // 发送一个常规的Post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); // Post提交的数据包
curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, false); // 开启header
//curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);//请求头部
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // 获取的信息以文件流的形式返回
$result = curl_exec($curl); //执行操作
curl_close($curl);
return $result;
}
}
\ No newline at end of file
... ...