Merge branch 'master' of http://114.215.101.231:8099/outsource/signUpForCar
# Conflicts: # public/themes/simpleboot3/user/yuyue/yu_studycar_2.html
正在显示
8 个修改的文件
包含
227 行增加
和
183 行删除
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <component name="ChangeListManager"> | 3 | <component name="ChangeListManager"> |
4 | <list default="true" id="03b59864-5835-4588-bfae-54004809f199" name="Default" comment=""> | 4 | <list default="true" id="03b59864-5835-4588-bfae-54004809f199" name="Default" comment=""> |
5 | <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | 5 | <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> |
6 | - <change beforePath="$PROJECT_DIR$/app/user/controller/LoginController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/user/controller/LoginController.php" afterDir="false" /> | 6 | + <change beforePath="$PROJECT_DIR$/app/admin/controller/CommentController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/admin/controller/CommentController.php" afterDir="false" /> |
7 | </list> | 7 | </list> |
8 | <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> | 8 | <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> |
9 | <option name="TRACKING_ENABLED" value="true" /> | 9 | <option name="TRACKING_ENABLED" value="true" /> |
@@ -72,7 +72,7 @@ | @@ -72,7 +72,7 @@ | ||
72 | </provider> | 72 | </provider> |
73 | </entry> | 73 | </entry> |
74 | </file> | 74 | </file> |
75 | - <file leaf-file-name="LoginController.php" pinned="false" current-in-tab="true"> | 75 | + <file leaf-file-name="LoginController.php" pinned="false" current-in-tab="false"> |
76 | <entry file="file://$PROJECT_DIR$/app/user/controller/LoginController.php"> | 76 | <entry file="file://$PROJECT_DIR$/app/user/controller/LoginController.php"> |
77 | <provider selected="true" editor-type-id="text-editor"> | 77 | <provider selected="true" editor-type-id="text-editor"> |
78 | <state relative-caret-position="321"> | 78 | <state relative-caret-position="321"> |
@@ -81,6 +81,15 @@ | @@ -81,6 +81,15 @@ | ||
81 | </provider> | 81 | </provider> |
82 | </entry> | 82 | </entry> |
83 | </file> | 83 | </file> |
84 | + <file leaf-file-name="CommentController.php" pinned="false" current-in-tab="true"> | ||
85 | + <entry file="file://$PROJECT_DIR$/app/admin/controller/CommentController.php"> | ||
86 | + <provider selected="true" editor-type-id="text-editor"> | ||
87 | + <state relative-caret-position="357"> | ||
88 | + <caret line="177" column="24" selection-start-line="177" selection-start-column="24" selection-end-line="177" selection-end-column="24" /> | ||
89 | + </state> | ||
90 | + </provider> | ||
91 | + </entry> | ||
92 | + </file> | ||
84 | <file leaf-file-name="UserBaseController.php" pinned="false" current-in-tab="false"> | 93 | <file leaf-file-name="UserBaseController.php" pinned="false" current-in-tab="false"> |
85 | <entry file="file://$PROJECT_DIR$/simplewind/cmf/controller/UserBaseController.php"> | 94 | <entry file="file://$PROJECT_DIR$/simplewind/cmf/controller/UserBaseController.php"> |
86 | <provider selected="true" editor-type-id="text-editor"> | 95 | <provider selected="true" editor-type-id="text-editor"> |
@@ -165,6 +174,7 @@ | @@ -165,6 +174,7 @@ | ||
165 | <option value="$PROJECT_DIR$/app/portal/controller/IndexController.php" /> | 174 | <option value="$PROJECT_DIR$/app/portal/controller/IndexController.php" /> |
166 | <option value="$PROJECT_DIR$/simplewind/cmf/controller/UserBaseController.php" /> | 175 | <option value="$PROJECT_DIR$/simplewind/cmf/controller/UserBaseController.php" /> |
167 | <option value="$PROJECT_DIR$/app/user/controller/LoginController.php" /> | 176 | <option value="$PROJECT_DIR$/app/user/controller/LoginController.php" /> |
177 | + <option value="$PROJECT_DIR$/app/admin/controller/CommentController.php" /> | ||
168 | </list> | 178 | </list> |
169 | </option> | 179 | </option> |
170 | </component> | 180 | </component> |
@@ -223,13 +233,13 @@ | @@ -223,13 +233,13 @@ | ||
223 | <item name="dm161xcgit" type="b2602c69:ProjectViewProjectNode" /> | 233 | <item name="dm161xcgit" type="b2602c69:ProjectViewProjectNode" /> |
224 | <item name="dm161xcgit" type="462c0819:PsiDirectoryNode" /> | 234 | <item name="dm161xcgit" type="462c0819:PsiDirectoryNode" /> |
225 | <item name="app" type="462c0819:PsiDirectoryNode" /> | 235 | <item name="app" type="462c0819:PsiDirectoryNode" /> |
226 | - <item name="user" type="462c0819:PsiDirectoryNode" /> | 236 | + <item name="admin" type="462c0819:PsiDirectoryNode" /> |
227 | </path> | 237 | </path> |
228 | <path> | 238 | <path> |
229 | <item name="dm161xcgit" type="b2602c69:ProjectViewProjectNode" /> | 239 | <item name="dm161xcgit" type="b2602c69:ProjectViewProjectNode" /> |
230 | <item name="dm161xcgit" type="462c0819:PsiDirectoryNode" /> | 240 | <item name="dm161xcgit" type="462c0819:PsiDirectoryNode" /> |
231 | <item name="app" type="462c0819:PsiDirectoryNode" /> | 241 | <item name="app" type="462c0819:PsiDirectoryNode" /> |
232 | - <item name="user" type="462c0819:PsiDirectoryNode" /> | 242 | + <item name="admin" type="462c0819:PsiDirectoryNode" /> |
233 | <item name="controller" type="462c0819:PsiDirectoryNode" /> | 243 | <item name="controller" type="462c0819:PsiDirectoryNode" /> |
234 | </path> | 244 | </path> |
235 | <path> | 245 | <path> |
@@ -338,14 +348,7 @@ | @@ -338,14 +348,7 @@ | ||
338 | <workItem from="1535514127808" duration="727000" /> | 348 | <workItem from="1535514127808" duration="727000" /> |
339 | <workItem from="1535532970259" duration="2527000" /> | 349 | <workItem from="1535532970259" duration="2527000" /> |
340 | <workItem from="1535546044129" duration="20814000" /> | 350 | <workItem from="1535546044129" duration="20814000" /> |
341 | - <workItem from="1535633001243" duration="13155000" /> | ||
342 | - </task> | ||
343 | - <task id="LOCAL-00009" summary="已评价无数据情况"> | ||
344 | - <created>1535465324978</created> | ||
345 | - <option name="number" value="00009" /> | ||
346 | - <option name="presentableId" value="LOCAL-00009" /> | ||
347 | - <option name="project" value="LOCAL" /> | ||
348 | - <updated>1535465324978</updated> | 351 | + <workItem from="1535633001243" duration="13825000" /> |
349 | </task> | 352 | </task> |
350 | <task id="LOCAL-00010" summary="已评价无数据情况"> | 353 | <task id="LOCAL-00010" summary="已评价无数据情况"> |
351 | <created>1535465766116</created> | 354 | <created>1535465766116</created> |
@@ -683,17 +686,24 @@ | @@ -683,17 +686,24 @@ | ||
683 | <option name="project" value="LOCAL" /> | 686 | <option name="project" value="LOCAL" /> |
684 | <updated>1535649911425</updated> | 687 | <updated>1535649911425</updated> |
685 | </task> | 688 | </task> |
686 | - <option name="localTasksCounter" value="58" /> | 689 | + <task id="LOCAL-00058" summary="登录处理"> |
690 | + <created>1535650097321</created> | ||
691 | + <option name="number" value="00058" /> | ||
692 | + <option name="presentableId" value="LOCAL-00058" /> | ||
693 | + <option name="project" value="LOCAL" /> | ||
694 | + <updated>1535650097321</updated> | ||
695 | + </task> | ||
696 | + <option name="localTasksCounter" value="59" /> | ||
687 | <servers /> | 697 | <servers /> |
688 | </component> | 698 | </component> |
689 | <component name="TimeTrackingManager"> | 699 | <component name="TimeTrackingManager"> |
690 | - <option name="totallyTimeSpent" value="67607000" /> | 700 | + <option name="totallyTimeSpent" value="68277000" /> |
691 | </component> | 701 | </component> |
692 | <component name="ToolWindowManager"> | 702 | <component name="ToolWindowManager"> |
693 | <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" /> | 703 | <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" /> |
694 | <editor active="true" /> | 704 | <editor active="true" /> |
695 | <layout> | 705 | <layout> |
696 | - <window_info content_ui="combo" id="Project" order="0" weight="0.14658849" /> | 706 | + <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.14658849" /> |
697 | <window_info anchor="bottom" id="TODO" order="6" /> | 707 | <window_info anchor="bottom" id="TODO" order="6" /> |
698 | <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" /> | 708 | <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" /> |
699 | <window_info anchor="bottom" id="Event Log" order="7" side_tool="true" /> | 709 | <window_info anchor="bottom" id="Event Log" order="7" side_tool="true" /> |
@@ -756,13 +766,6 @@ | @@ -756,13 +766,6 @@ | ||
756 | <option name="LAST_COMMIT_MESSAGE" value="登录处理" /> | 766 | <option name="LAST_COMMIT_MESSAGE" value="登录处理" /> |
757 | </component> | 767 | </component> |
758 | <component name="editorHistoryManager"> | 768 | <component name="editorHistoryManager"> |
759 | - <entry file="file://$PROJECT_DIR$/api/user/route.php"> | ||
760 | - <provider selected="true" editor-type-id="text-editor"> | ||
761 | - <state relative-caret-position="105"> | ||
762 | - <caret line="15" column="5" selection-start-line="15" selection-start-column="5" selection-end-line="15" selection-end-column="22" /> | ||
763 | - </state> | ||
764 | - </provider> | ||
765 | - </entry> | ||
766 | <entry file="file://$PROJECT_DIR$/api/user/controller/FavoritesController.php"> | 769 | <entry file="file://$PROJECT_DIR$/api/user/controller/FavoritesController.php"> |
767 | <provider selected="true" editor-type-id="text-editor"> | 770 | <provider selected="true" editor-type-id="text-editor"> |
768 | <state relative-caret-position="126"> | 771 | <state relative-caret-position="126"> |
@@ -1080,5 +1083,12 @@ | @@ -1080,5 +1083,12 @@ | ||
1080 | </state> | 1083 | </state> |
1081 | </provider> | 1084 | </provider> |
1082 | </entry> | 1085 | </entry> |
1086 | + <entry file="file://$PROJECT_DIR$/app/admin/controller/CommentController.php"> | ||
1087 | + <provider selected="true" editor-type-id="text-editor"> | ||
1088 | + <state relative-caret-position="357"> | ||
1089 | + <caret line="177" column="24" selection-start-line="177" selection-start-column="24" selection-end-line="177" selection-end-column="24" /> | ||
1090 | + </state> | ||
1091 | + </provider> | ||
1092 | + </entry> | ||
1083 | </component> | 1093 | </component> |
1084 | </project> | 1094 | </project> |
@@ -133,7 +133,7 @@ class CommentController extends AdminBaseController | @@ -133,7 +133,7 @@ class CommentController extends AdminBaseController | ||
133 | if (!empty($mobile)) { | 133 | if (!empty($mobile)) { |
134 | $where['mobile'] = $mobile; | 134 | $where['mobile'] = $mobile; |
135 | } | 135 | } |
136 | - $where['delete_time'] = 0; | 136 | + $where['c.delete_time'] = 0; |
137 | $list = DB::name($this->table_name) | 137 | $list = DB::name($this->table_name) |
138 | ->alias('c') | 138 | ->alias('c') |
139 | ->join('qnb_user u','u.id=c.teach_id') | 139 | ->join('qnb_user u','u.id=c.teach_id') |
@@ -175,7 +175,7 @@ class CommentController extends AdminBaseController | @@ -175,7 +175,7 @@ class CommentController extends AdminBaseController | ||
175 | ->alias('c') | 175 | ->alias('c') |
176 | ->join('qnb_user u','u.id=c.uid') | 176 | ->join('qnb_user u','u.id=c.uid') |
177 | ->field('c.*') | 177 | ->field('c.*') |
178 | - ->where(['delete_time'=>0]) | 178 | + ->where(['c.delete_time'=>0]) |
179 | ->paginate(15); | 179 | ->paginate(15); |
180 | 180 | ||
181 | $this->assign("list", $list->items()); | 181 | $this->assign("list", $list->items()); |
@@ -146,7 +146,7 @@ class IndexController extends HomeBaseController | @@ -146,7 +146,7 @@ class IndexController extends HomeBaseController | ||
146 | 146 | ||
147 | $gid = $req->param('gid'); | 147 | $gid = $req->param('gid'); |
148 | $res = Db::name('goods')->where(['id' => $gid])->find(); | 148 | $res = Db::name('goods')->where(['id' => $gid])->find(); |
149 | - $id = session('user.id'); | 149 | + $id = session('pay_uid'); |
150 | $data['gid'] = $gid; | 150 | $data['gid'] = $gid; |
151 | $data['uid'] = $id; | 151 | $data['uid'] = $id; |
152 | $data['create_time'] = time(); | 152 | $data['create_time'] = time(); |
@@ -95,6 +95,9 @@ class LoginController extends HomeBaseController | @@ -95,6 +95,9 @@ class LoginController extends HomeBaseController | ||
95 | if (!$op_tel_info){ | 95 | if (!$op_tel_info){ |
96 | $op_info = Db::name('user')->where(['openid'=>session('openid')])->find(); | 96 | $op_info = Db::name('user')->where(['openid'=>session('openid')])->find(); |
97 | if($op_info){ | 97 | if($op_info){ |
98 | + if($res['user_type'] == '2'){ | ||
99 | + $dataup['headimgurl'] = $op_info['headimgurl']; | ||
100 | + } | ||
98 | $dataup['openid'] = session('openid'); | 101 | $dataup['openid'] = session('openid'); |
99 | $dataup['province'] = $op_info['province']; | 102 | $dataup['province'] = $op_info['province']; |
100 | $dataup['city'] = $op_info['city']; | 103 | $dataup['city'] = $op_info['city']; |
@@ -127,14 +127,12 @@ class YuyueController extends UserBaseController | @@ -127,14 +127,12 @@ class YuyueController extends UserBaseController | ||
127 | } else { | 127 | } else { |
128 | $data['teach_id'] = intval($tech_id); | 128 | $data['teach_id'] = intval($tech_id); |
129 | $data['uid'] = session('user.id'); | 129 | $data['uid'] = session('user.id'); |
130 | - $data['status'] = array('neq','3'); | ||
131 | 130 | ||
131 | + $w['uid'] = session('user.id'); | ||
132 | + $w['status'] = array('neq','3'); | ||
132 | //预约订单完成后才可以再次预约 | 133 | //预约订单完成后才可以再次预约 |
133 | - $rr = Db::name('yuyue')->where($data)->order('create_time', 'desc')->find(); | ||
134 | - unset($data['status']); | ||
135 | - $ytime = strtotime($rr['yuyue_day'].''.$rr['yuyue_end'].':00'); | ||
136 | - $tt = time(); | ||
137 | - if ( $ytime >$tt) { | 134 | + $rr = Db::name('yuyue')->where($w)->find(); |
135 | + if ( $rr) { | ||
138 | return json(['code' => '0', 'msg' => '您好,您有待学车预约']); | 136 | return json(['code' => '0', 'msg' => '您好,您有待学车预约']); |
139 | } | 137 | } |
140 | 138 | ||
@@ -144,9 +142,9 @@ class YuyueController extends UserBaseController | @@ -144,9 +142,9 @@ class YuyueController extends UserBaseController | ||
144 | $data['yuyue_begin'] = session('yuyue_pre.begin'); | 142 | $data['yuyue_begin'] = session('yuyue_pre.begin'); |
145 | 143 | ||
146 | $ress = Db::name('yuyue')->where($data)->find(); | 144 | $ress = Db::name('yuyue')->where($data)->find(); |
147 | - if($ress){ | ||
148 | - return json(['code'=>'0','msg'=>'抱歉,您已经预约过']); | ||
149 | - } | 145 | +// if($ress){ |
146 | +// return json(['code'=>'0','msg'=>'抱歉,您已经预约过']); | ||
147 | +// } | ||
150 | $data['status'] = '1'; | 148 | $data['status'] = '1'; |
151 | $data['create_time'] = time(); | 149 | $data['create_time'] = time(); |
152 | 150 | ||
@@ -281,12 +279,15 @@ class YuyueController extends UserBaseController | @@ -281,12 +279,15 @@ class YuyueController extends UserBaseController | ||
281 | $data['yuyue_begin'] = $begin; | 279 | $data['yuyue_begin'] = $begin; |
282 | $data['yuyue_end'] = $end; | 280 | $data['yuyue_end'] = $end; |
283 | $data['yuyue_week'] = $week; | 281 | $data['yuyue_week'] = $week; |
284 | - $data['status'] = array('neq','3'); | ||
285 | - $ress = Db::name('yuyue')->where($data)->find(); | ||
286 | - unset($data['status']); | ||
287 | - if($ress){ | ||
288 | - return json(['code'=>'0','msg'=>'抱歉,您已经预约过']); | 282 | + |
283 | + $w['uid'] = session('user.id'); | ||
284 | + $w['status'] = array('neq','3'); | ||
285 | + //预约订单完成后才可以再次预约 | ||
286 | + $rr = Db::name('yuyue')->where($w)->find(); | ||
287 | + if ( $rr) { | ||
288 | + return json(['code' => '0', 'msg' => '您好,您有待学车预约']); | ||
289 | } | 289 | } |
290 | + | ||
290 | $data['status'] = 1; | 291 | $data['status'] = 1; |
291 | $data['create_time'] = time(); | 292 | $data['create_time'] = time(); |
292 | 293 |
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | // [ 入口文件 ] | 10 | // [ 入口文件 ] |
11 | date_default_timezone_set('Asia/Shanghai'); | 11 | date_default_timezone_set('Asia/Shanghai'); |
12 | // 调试模式开关 | 12 | // 调试模式开关 |
13 | -define("APP_DEBUG", 1); | 13 | +define("APP_DEBUG", 0); |
14 | 14 | ||
15 | // 定义CMF根目录,可更改此目录 | 15 | // 定义CMF根目录,可更改此目录 |
16 | define('CMF_ROOT', __DIR__ . '/../'); | 16 | define('CMF_ROOT', __DIR__ . '/../'); |
1 | -<?php | ||
2 | -/** | ||
3 | - * | ||
4 | - * example目录下为简单的支付样例,仅能用于搭建快速体验微信支付使用 | ||
5 | - * 样例的作用仅限于指导如何使用sdk,在安全上面仅做了简单处理, 复制使用样例代码时请慎重 | ||
6 | - * 请勿直接直接使用样例对外提供服务 | ||
7 | - * | ||
8 | - **/ | ||
9 | -date_default_timezone_set('Asia/Shanghai'); | ||
10 | -require_once "../lib/WxPay.Api.php"; | ||
11 | -require_once "WxPay.JsApiPay.php"; | ||
12 | -require_once "WxPay.Config.php"; | ||
13 | -require_once 'log.php'; | ||
14 | - | ||
15 | -//初始化日志 | ||
16 | -$logHandler = new CLogFileHandler("../logs/" . date('Y-m-d') . '.log'); | ||
17 | -$log = Log::Init($logHandler, 15); | ||
18 | -Log::DEBUG("===========step1-begin-jsapi-pay============="); | ||
19 | - | ||
20 | -//①、获取用户openid | ||
21 | -try { | ||
22 | - | ||
23 | - $tools = new JsApiPay(); | ||
24 | -// $openId = $tools->GetOpenid(); | ||
25 | - $deta = $_REQUEST; | ||
26 | - | ||
27 | - //测试专用 0.01 | ||
28 | - //$fee = $deta['fe'] ? $deta['fe'] * 100 : 100; | ||
29 | - $fee = 1; | ||
30 | - $out_trade_no = $deta['ot'] ? $deta['ot'] : date('YmdHis') . uniqid(); | ||
31 | - $body = $deta['sn'] ? $deta['sn'] : 'ceshi'; | ||
32 | - $attach = $deta['at'] ? $deta['at'] : 'ceshi'; | ||
33 | - $openId = $deta['op'] ? $deta['op'] : ''; | ||
34 | - | ||
35 | - //②、统一下单 | ||
36 | - $input = new WxPayUnifiedOrder(); | ||
37 | - $input->SetBody($body); | ||
38 | - $input->SetAttach($attach); | ||
39 | - $input->SetOut_trade_no($out_trade_no); | ||
40 | - $input->SetTotal_fee($fee); | ||
41 | - $input->SetTime_start(date("YmdHis")); | ||
42 | - $input->SetTime_expire(date("YmdHis", time() + 600)); | ||
43 | - $input->SetGoods_tag("qnbug_tag"); | ||
44 | -// $input->SetNotify_url("http://dm161xueche.qnbug.cn/paycenter/wechat/notify.php"); | ||
45 | - $input->SetNotify_url("http://wx.youlj.cn/paycenter/wechat/notify.php"); | ||
46 | - $input->SetTrade_type("JSAPI"); | ||
47 | - $input->SetOpenid($openId); | ||
48 | - $config = new WxPayConfig(); | ||
49 | - $order = WxPayApi::unifiedOrder($config, $input); | ||
50 | - Log::DEBUG("===========step2-begin-jsapi-pay============="); | ||
51 | - Log::DEBUG(json_encode($deta, true)); | ||
52 | - | ||
53 | - $jsApiParameters = $tools->GetJsApiParameters($order); | ||
54 | - | ||
55 | - | ||
56 | - //获取共享收货地址js函数参数 | ||
57 | - $editAddress = $tools->GetEditAddressParameters(); | ||
58 | -} catch (Exception $e) { | ||
59 | - Log::ERROR(json_encode($e)); | ||
60 | -} | ||
61 | -//③、在支持成功回调通知中处理成功之后的事宜,见 notify.php | ||
62 | -/** | ||
63 | - * 注意: | ||
64 | - * 1、当你的回调地址不可访问的时候,回调通知会失败,可以通过查询订单来确认支付是否成功 | ||
65 | - * 2、jsapi支付时需要填入用户openid,WxPay.JsApiPay.php中有获取openid流程 (文档可以参考微信公众平台“网页授权接口”, | ||
66 | - * 参考http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html) | ||
67 | - */ | ||
68 | -?> | ||
69 | - | ||
70 | -<html> | ||
71 | -<head> | ||
72 | - <meta http-equiv="content-type" content="text/html;charset=utf-8"/> | ||
73 | - <meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
74 | - <title>微信支付跳转中</title> | ||
75 | - <script type="text/javascript"> | ||
76 | - //调用微信JS api 支付 | ||
77 | - function jsApiCall() { | ||
78 | - WeixinJSBridge.invoke( | ||
79 | - 'getBrandWCPayRequest', | ||
80 | - <?php echo $jsApiParameters; ?>, | ||
81 | - function (res) { | ||
82 | - WeixinJSBridge.log(res.err_msg); | ||
83 | - //alert(res.err_code); | ||
84 | - if (res.err_msg == 'get_brand_wcpay_request:ok') { | ||
85 | - window.location.href = 'http://wx.youlj.cn/user/order/pay_success.html'; | ||
86 | - } else if (res.err_msg == 'get_brand_wcpay_request:cancel') { | ||
87 | - window.history.go(-1); | ||
88 | - } | ||
89 | - | ||
90 | - } | ||
91 | - ); | ||
92 | - } | ||
93 | - | ||
94 | - function callpay() { | ||
95 | - if (typeof WeixinJSBridge == "undefined") { | ||
96 | - if (document.addEventListener) { | ||
97 | - document.addEventListener('WeixinJSBridgeReady', jsApiCall, false); | ||
98 | - } else if (document.attachEvent) { | ||
99 | - document.attachEvent('WeixinJSBridgeReady', jsApiCall); | ||
100 | - document.attachEvent('onWeixinJSBridgeReady', jsApiCall); | ||
101 | - } | ||
102 | - } else { | ||
103 | - jsApiCall(); | ||
104 | - } | ||
105 | - } | ||
106 | - </script> | ||
107 | - <script type="text/javascript"> | ||
108 | - //获取共享地址 | ||
109 | - function editAddress() { | ||
110 | - WeixinJSBridge.invoke( | ||
111 | - 'editAddress', | ||
112 | - <?php echo $editAddress; ?>, | ||
113 | - function (res) { | ||
114 | - var value1 = res.proviceFirstStageName; | ||
115 | - var value2 = res.addressCitySecondStageName; | ||
116 | - var value3 = res.addressCountiesThirdStageName; | ||
117 | - var value4 = res.addressDetailInfo; | ||
118 | - var tel = res.telNumber; | ||
119 | - | ||
120 | - //alert(value1 + value2 + value3 + value4 + ":" + tel); | ||
121 | - } | ||
122 | - ); | ||
123 | - } | ||
124 | - | ||
125 | - window.onload = function () { | ||
126 | - if (typeof WeixinJSBridge == "undefined") { | ||
127 | - if (document.addEventListener) { | ||
128 | - document.addEventListener('WeixinJSBridgeReady', editAddress, false); | ||
129 | - } else if (document.attachEvent) { | ||
130 | - document.attachEvent('WeixinJSBridgeReady', editAddress); | ||
131 | - document.attachEvent('onWeixinJSBridgeReady', editAddress); | ||
132 | - } | ||
133 | - } else { | ||
134 | - editAddress(); | ||
135 | - } | ||
136 | - }; | ||
137 | - callpay() | ||
138 | - | ||
139 | - </script> | ||
140 | -</head> | ||
141 | -<body> | ||
142 | - | ||
143 | -</body> | 1 | +<?php |
2 | +/** | ||
3 | + * | ||
4 | + * example目录下为简单的支付样例,仅能用于搭建快速体验微信支付使用 | ||
5 | + * 样例的作用仅限于指导如何使用sdk,在安全上面仅做了简单处理, 复制使用样例代码时请慎重 | ||
6 | + * 请勿直接直接使用样例对外提供服务 | ||
7 | + * | ||
8 | + **/ | ||
9 | +date_default_timezone_set('Asia/Shanghai'); | ||
10 | +require_once "../lib/WxPay.Api.php"; | ||
11 | +require_once "WxPay.JsApiPay.php"; | ||
12 | +require_once "WxPay.Config.php"; | ||
13 | +require_once 'log.php'; | ||
14 | + | ||
15 | +//初始化日志 | ||
16 | +$logHandler = new CLogFileHandler("../logs/" . date('Y-m-d') . '.log'); | ||
17 | +$log = Log::Init($logHandler, 15); | ||
18 | +Log::DEBUG("===========step1-begin-jsapi-pay============="); | ||
19 | + | ||
20 | +//①、获取用户openid | ||
21 | +try { | ||
22 | + | ||
23 | + $tools = new JsApiPay(); | ||
24 | +// $openId = $tools->GetOpenid(); | ||
25 | + $deta = $_REQUEST; | ||
26 | + | ||
27 | + //测试专用 0.01 | ||
28 | + $fee = $deta['fe'] ? $deta['fe'] * 100 : 100; | ||
29 | + //$fee = 1; | ||
30 | + $out_trade_no = $deta['ot'] ? $deta['ot'] : date('YmdHis') . uniqid(); | ||
31 | + $body = $deta['sn'] ? $deta['sn'] : 'ceshi'; | ||
32 | + $attach = $deta['at'] ? $deta['at'] : 'ceshi'; | ||
33 | + $openId = $deta['op'] ? $deta['op'] : ''; | ||
34 | + | ||
35 | + //②、统一下单 | ||
36 | + $input = new WxPayUnifiedOrder(); | ||
37 | + $input->SetBody($body); | ||
38 | + $input->SetAttach($attach); | ||
39 | + $input->SetOut_trade_no($out_trade_no); | ||
40 | + $input->SetTotal_fee($fee); | ||
41 | + $input->SetTime_start(date("YmdHis")); | ||
42 | + $input->SetTime_expire(date("YmdHis", time() + 600)); | ||
43 | + $input->SetGoods_tag("qnbug_tag"); | ||
44 | +// $input->SetNotify_url("http://dm161xueche.qnbug.cn/paycenter/wechat/notify.php"); | ||
45 | + $input->SetNotify_url("http://wx.youlj.cn/paycenter/wechat/notify.php"); | ||
46 | + $input->SetTrade_type("JSAPI"); | ||
47 | + $input->SetOpenid($openId); | ||
48 | + $config = new WxPayConfig(); | ||
49 | + $order = WxPayApi::unifiedOrder($config, $input); | ||
50 | + Log::DEBUG("===========step2-begin-jsapi-pay============="); | ||
51 | + Log::DEBUG(json_encode($deta, true)); | ||
52 | + | ||
53 | + $jsApiParameters = $tools->GetJsApiParameters($order); | ||
54 | + | ||
55 | + | ||
56 | + //获取共享收货地址js函数参数 | ||
57 | + $editAddress = $tools->GetEditAddressParameters(); | ||
58 | +} catch (Exception $e) { | ||
59 | + Log::ERROR(json_encode($e)); | ||
60 | +} | ||
61 | +//③、在支持成功回调通知中处理成功之后的事宜,见 notify.php | ||
62 | +/** | ||
63 | + * 注意: | ||
64 | + * 1、当你的回调地址不可访问的时候,回调通知会失败,可以通过查询订单来确认支付是否成功 | ||
65 | + * 2、jsapi支付时需要填入用户openid,WxPay.JsApiPay.php中有获取openid流程 (文档可以参考微信公众平台“网页授权接口”, | ||
66 | + * 参考http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html) | ||
67 | + */ | ||
68 | +?> | ||
69 | + | ||
70 | +<html> | ||
71 | +<head> | ||
72 | + <meta http-equiv="content-type" content="text/html;charset=utf-8"/> | ||
73 | + <meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
74 | + <title>微信支付跳转中</title> | ||
75 | + <script type="text/javascript"> | ||
76 | + //调用微信JS api 支付 | ||
77 | + function jsApiCall() { | ||
78 | + WeixinJSBridge.invoke( | ||
79 | + 'getBrandWCPayRequest', | ||
80 | + <?php echo $jsApiParameters; ?>, | ||
81 | + function (res) { | ||
82 | + WeixinJSBridge.log(res.err_msg); | ||
83 | + //alert(res.err_code); | ||
84 | + if (res.err_msg == 'get_brand_wcpay_request:ok') { | ||
85 | + window.location.href = 'http://wx.youlj.cn/portal/index/pay_success.html'; | ||
86 | + } else if (res.err_msg == 'get_brand_wcpay_request:cancel') { | ||
87 | + window.history.go(-1); | ||
88 | + } | ||
89 | + | ||
90 | + } | ||
91 | + ); | ||
92 | + } | ||
93 | + | ||
94 | + function callpay() { | ||
95 | + if (typeof WeixinJSBridge == "undefined") { | ||
96 | + if (document.addEventListener) { | ||
97 | + document.addEventListener('WeixinJSBridgeReady', jsApiCall, false); | ||
98 | + } else if (document.attachEvent) { | ||
99 | + document.attachEvent('WeixinJSBridgeReady', jsApiCall); | ||
100 | + document.attachEvent('onWeixinJSBridgeReady', jsApiCall); | ||
101 | + } | ||
102 | + } else { | ||
103 | + jsApiCall(); | ||
104 | + } | ||
105 | + } | ||
106 | + </script> | ||
107 | + <script type="text/javascript"> | ||
108 | + //获取共享地址 | ||
109 | + function editAddress() { | ||
110 | + WeixinJSBridge.invoke( | ||
111 | + 'editAddress', | ||
112 | + <?php echo $editAddress; ?>, | ||
113 | + function (res) { | ||
114 | + var value1 = res.proviceFirstStageName; | ||
115 | + var value2 = res.addressCitySecondStageName; | ||
116 | + var value3 = res.addressCountiesThirdStageName; | ||
117 | + var value4 = res.addressDetailInfo; | ||
118 | + var tel = res.telNumber; | ||
119 | + | ||
120 | + //alert(value1 + value2 + value3 + value4 + ":" + tel); | ||
121 | + } | ||
122 | + ); | ||
123 | + } | ||
124 | + | ||
125 | + window.onload = function () { | ||
126 | + if (typeof WeixinJSBridge == "undefined") { | ||
127 | + if (document.addEventListener) { | ||
128 | + document.addEventListener('WeixinJSBridgeReady', editAddress, false); | ||
129 | + } else if (document.attachEvent) { | ||
130 | + document.attachEvent('WeixinJSBridgeReady', editAddress); | ||
131 | + document.attachEvent('onWeixinJSBridgeReady', editAddress); | ||
132 | + } | ||
133 | + } else { | ||
134 | + editAddress(); | ||
135 | + } | ||
136 | + }; | ||
137 | + callpay() | ||
138 | + | ||
139 | + </script> | ||
140 | +</head> | ||
141 | +<body> | ||
142 | + | ||
143 | +</body> | ||
144 | </html> | 144 | </html> |
1 | +<!DOCTYPE html> | ||
2 | +<html> | ||
3 | +<head> | ||
4 | + <meta charset="UTF-8"> | ||
5 | + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
6 | + <meta content="yes" name="apple-mobile-web-app-capable"> | ||
7 | + <meta content="yes" name="apple-touch-fullscreen"> | ||
8 | + <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,maximum-scale=1, minimum-scale=1, user-scalable=no"> | ||
9 | + <title>支付成功</title> | ||
10 | + <link rel="stylesheet" href="/static/css/common.css"> | ||
11 | + <link rel="stylesheet" href="/static/css/style.css"> | ||
12 | +</head> | ||
13 | +<body> | ||
14 | +<div class="box ss"> | ||
15 | + <div class="success_img"> | ||
16 | + <img src="/static/image/pay_success.png"> | ||
17 | + </div> | ||
18 | + <!--<h1 class="pay_money">¥7388.00</h1>--> | ||
19 | + | ||
20 | + <div class="menu_two"> | ||
21 | + <a href="{:url('user/yuyue/index')}"><img src="/static/image/btn_study.png"/></a> | ||
22 | + <a href="{:url('user/yuyue/my_order')}"><img src="/static/image/btn_look.png"/></a> | ||
23 | + </div> | ||
24 | +</div> | ||
25 | + | ||
26 | + | ||
27 | +<script type="text/javascript" src="/static/js/jquery-1.11.0.min.js"></script> | ||
28 | +<script type="text/javascript" src="/static/js/common.js"></script> | ||
29 | +</body> | ||
30 | +</html> |
-
请 注册 或 登录 后发表评论