《wemall开源版微商城代码片段-post传值》由会员分享,可在线阅读,更多相关《wemall开源版微商城代码片段-post传值(6页珍藏版)》请在金锄头文库上搜索。
1、文档供参考,可复制、编制,期待您的好评与关注! wemall开源版微商城代码片段-post传值1. 代码IndexController.class.php assign ( info, $info ); $menuresult = R ( Api/Api/getmenu ); $this-assign ( menu, $menuresult ); $goodsresult = R ( Api/Api/getgood ); $this-assign ( goods, $goodsresult ); $uid = I(get.uid); $usersresult = R ( Api/Api/get
2、user,array($uid); $alipay = M ( Alipay )-find (); if ($alipay) $this-assign ( alipay, 1 ); $this-assign ( users, $usersresult ); $this-display (); else echo 请使用微信访问!; public function fetchgooddetail() $where id = I(post.id); $result = M ( Good )-where ( $where )-find (); if ($result) $this-ajaxRetur
3、n ( $result ); public function getorders() $uid = I(post.uid); $user_id = M ( User )-where ( array ( uid = $uid ) )-find (); $result = M ( Order )-where ( array ( user_id = $user_id id ) )-order ( id desc )-select (); $this-ajaxReturn ( $result ); public function addorder() $uid = htmlspecialchars (
4、 I(post.uid); $userData = I(post.userData); $username = $userData 0 value; $phone = $userData 1 value; $pay = $userData 2 value; $address = $userData 3 value; $note = $userData 4 value; $totalprice = I(post.totalPrice); $cartdata = stripslashes ( I(post.cartData) ); $orderid = date ( ymdhis ) . mt_r
5、and ( 1, 9 ); $time = date ( Y/m/d H:i:s ); switch ($pay) case 0 : $pay_style = 货到付款; break; case 1 : $pay_style = 微信支付; break; $data orderid = $orderid; $data totalprice = $totalprice; $data pay_style = $pay_style; $data pay_status = 0; $data note = $note; $data order_status = 0; $data time = $time
6、; $data cartdata = $cartdata; $userdata = M ( User )-where ( array ( uid = $uid ) )-find (); if ($userdata) $user_id = $userdata id; $user id = $user_id; $user username = $username; $user phone = $phone; $user address = $address; M ( User )-save ( $user ); $data user_id = $user_id; M ( Order )-add (
7、 $data ); else $user uid = $uid; $user username = $username; $user phone = $phone; $user address = $address; $user_id = M ( User )-add ( $user ); $data user_id = $user_id; M ( Order )-add ( $data ); $config = M(Wxconfig)-find(); if ($pay = 1) echo http:/ . $_SERVER SERVER_NAME . _ROOT_ . /Api/wxPay/
8、js_api_call.php?body= . $config num . &orderid= . $orderid . &totalprice= . floatval($totalprice) * 100 . &url= . U(App/Index/index) . &uid= . $uid; / app start public function appregister() $username = I(post.username); $password = I(post.password); $phone = I(post.phone); if ($username & $password
9、 & $phone) $find = M ( User )-where ( array ( phone = $phone ) )-select (); if (! $find) $data username = $username; $data phone = $phone; $data password = md5 ( $password ); $data uid = date ( His ) . mt_rand ( 1, 9 ); $data time = date ( Y/m/d H:i:s ); $result = M ( User )-add ( $data ); if ($result) $this-ajaxReturn ( $result ); public function applogin() $phone = I(post.phone); $password = md5 ( I(