首頁 > php教程 > php手册 > WeMall微信商城源碼活動報名外掛程式碼詳情

WeMall微信商城源碼活動報名外掛程式碼詳情

WBOY
發布: 2016-10-09 08:32:16
原創
1254 人瀏覽過

WeMall微信商城源码插件活动报名代码是用于商业推广的比较有效的方式,分享了部分比较重要的代码,供技术员学习参考,商家可自由设置报名项目,活动时间,报名内容

WeMall微信商城源码插件活动报名代码是用于商业推广的比较有效的方式,分享了部分比较重要的代码,供技术员学习参考,商家可自由设置报名项目,活动时间,报名内容

代码详情地址:http://addon.wemallshop.com/Product/addonList/menu_id/1 或 www.wemallshop.com


AdminController.class<?php<br /> <br /> namespace Addons\Apply\Controller;<br /> <br /> class AdminController extends InitController<br /> {<br /> <br /> public function __construct()<br /> {<br /> parent::__construct();<br /> }<br /> <br /> public function index()<br /> {<br /> $config = M("AddonApplyConfig")->find();<br>         $this->assign("config", $config);<br> <br>         $record = D('Addons://Apply/AddonApplyRecord'); // 实例化User对象<br>         $count = $record->count();// 查询满足要求的总记录数<br>         $Page = new \Think\Page($count, 12);// 实例化分页类 传入总记录数和每页显示的记录数(25)<br>         $Page->setConfig('theme', "<div class=&#039;widget-content padded text-center&#039;><ul class=&#039;pagination&#039;></li><li>%FIRST%</li><li>%UP_PAGE%</li><li>%LINK_PAGE%</li><li>%DOWN_PAGE%</li><li>%END%</li><li><a> %HEADER%  %NOW_PAGE%/%TOTAL_PAGE% 页</a></ul></div>");<br>         $show = $Page->show();// 分頁顯示輸出<br>         // 進行分頁資料查詢 注意limit方法的參數要使用Page類別的屬性<br>         $record = $record->limit($Page->firstRow . ',' . $Page->listRows)->order("id desc")->relation(truePage->listRows)->order("id desc")->relation(true)->se(); <br>         $this->assign("record", $record);// 賦值資料集<br>         $this->assign('page', $show);// 賦值分頁輸出<br> <br>         $this->display();<br>     }<br> <br>     public function addConfig()<br>     {<br>         $event = $_POST["event"];<br>         // $event = str_replace('"', "", $event);<br>         // $event = str_replace('[', "", $event);<br>         // $event = str_replace(']', "", $event);<br>         // $event = json_encode(explode(",", $event), JSON_UNESCAPED_UNICODE);<br> <br>         $_POST["event"] = $event;<br>         M("AddonApplyConfig")->where(array("id" => "1"))->save($_POST);<br>         $this->success('修改成功', 'Admin/Admin/index/addon/Apply');<br> <br>     }<br> }<br>
IndexController.class <br> <br> namespace AddonsApplyController;<br> <br> class IndexController extends InitController<br> {<br>     public $appUrl = "";<br>     public function __construct()<br>     {<br>         parent::__construct();<br>         $this->appUrl = "http://" . I("server.HTTP_HOST");<br>     }<br> <br> <br>     public function index()<br>     {<br>         $user = R("App/Public/oauthLogin");<br>         // $this->assign("user",$user);<br>         <br> <br>         $config = M("AddonApplyConfig")->where(array("status" => 1))->find();<br>         // print_r(explode(',',$config["event"]));<br>         $this->assign("event", explode(',',$config["event"]));<br>         $this->assign("config", $config);<br> <br>         $contact = M("Contact")->where(array("user_id" => $user["id"]))->find();<br>         if ($contact) {<br>             $this->assign("contact", $contact);<br>         }<br> <br>         M("AddonApplyConfig")->where(array("id" => 1))->setInc("visiter");<br> <br>         $this->assign('user', $user);// 賦值分頁輸出<br>         $this->display();<br>     }<br> <br>     public function addConfig()<br>     {<br>        M("AddonApplyConfig")->where(array("id" => "1"))->save($_POST);<br>     }<br> <br>     公用函數 addOrder()<br>     {<br>    <br> <br>         $userHas = M("AddonApplyContact")->where(array("user_id" => session("userId")))->find();<br> <br>         如果($userHas){<br>             $contact [“id”] = $userHas [“id”];<br>             $contact [“user_id”] = session(“userId”);<br>             $contact [「姓名」] = $_POST [「姓名」];<br>             $contact [「地址」] = $_POST [「地址」];<br>             M("AddonApplyContact")->save($contact);<br>         } 另外 {<br>             $contact [“user_id”] = session(“userId”);<br>             $contact [「姓名」] = $_POST [「姓名」];<br>             $contact ["城市"] = "";<br>             $contact ["區域"] = "";<br>             $contact [「地址」] = $_POST [「地址」];<br>             M("AddonApplyContact")->add($contact);<br>         }<br>         $userHas = M("AddonApplyContact")->where(array("user_id" => session("userId")))->find();<br>         $contact_id = $userHas["id"];<br> <br>         $config = M("AddonApplyConfig")->find();<br> <br>         $data[“user_id”]=session(“userId”);<br>         $data [“contact_id”] = $contact_id;<br>         $data [「名稱」] = $_POST [「名稱」];<br>         $data [「電話」] = $_POST [「電話」];<br>         $data [「註釋」] = $_POST [「註釋」];<br>         $data [「事件」] = $_POST[「事件」];<br>         $data["時間"]=日期("年月日H:i:s");<br>         $result = M("AddonApplyRecord")->add($data);<br> <br>         M("AddonApplyConfig")->where(array("id" => 1))->setInc("apply");<br>         如果($結果){<br>             $this->ajaxReturn($result);<br>         }<br>     }<br> <br> <br> }<b>Index_index</b><code class="prettyprint linenums lang-php"><br> <br> <br>     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <br>     <br>     <meta name="「viewport」content" device-width no> <br>     <title>{$config.name}</title><br>     <meta name="format-detection" content="telephone=no, address=no"><br>     <meta name="apple-mobile-web-app-capable" content="yes"><br>     <!-- apple devices fullscreen --><br>     <meta name="apple-touch-fullscreen" content="yes"><br>     <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><br>     <link href="__CSS__/bootstrap.min.css" rel="stylesheet"><br>     <link href="__CSS__/font-awesome.min.css" rel="stylesheet"><br>     <link href="__CSS__/animate.css" rel="stylesheet"><br>     <link href="__CSS__/common.css" rel="stylesheet"><br>     <link href="__CSS__/sign.css" rel="stylesheet"><br> <br>     <script type="text/javascript" src="__JS__/jquery.min.js"></script><br>     <script type="text/javascript" src="__JS__/bootstrap.min.js"></script><br> <br>     <style type="text/css"><br>         #page_tag_load {<br>             display: none;<br>             font-size: 14px;<br>             position: fixed;<br>             bottom: 70px;<br>             height: 16px;<br>             margin-left: -29px;<br>             left: 50%<br>         }<br>     </style><br> </head><br> <body><br> <div class="container container-fill"><br>     <div class="pcenter-main"><br>         <div class="head"><br>             <div class="pdetail"><br>                 <div class="img-circle"><img src="{$user.avater}"></div><br>                 <div class="pull-left"><br>                     <span class="name">{$user.username}</span><br>                     <span class="type">会员ID: {$user.id}</span><br>                 </div><br>             </div><br>             <div class="head-nav"><br>                 <a class="head-nav-list"<br /> href="">累计报名<span>{$config.apply}</span></a><br>                 <a class="head-nav-list"<br /> href="">访问量<span>{$config.visiter}</span></a><br>             </div><br>         </div><br>     </div><br>     <div class="scroll-container"><br>         <div class="wrapper"><br>             <ul class="list-group"><br>                 <li class="list-group-item" style="padding: 0px 0px;border-bottom: 1px solid #ccc;"><br>                     <div class="con"><br>                         <div class="list-hd"><br>                             <h5>项目:</h5><span>{$config.event}</span><br>                         </div><br>                     </div><br>                 </li><br>                 <li class="list-group-item" style="padding: 1px 0px;border-bottom: 1px solid #ccc;"><br>                     <div class="con"><br>                         <div class="list-hd"><br>                             <h5>时间:</h5><span>{$config.time_range}</span><br>                         </div><br>                     </div><br>                 </li><br>                 <li class="list-group-item" style="padding: 0px;"><br>                     <div class="con"><br>                         <div class="list-hd"><br>                             <h5>项目介绍:</h5><span>{$config.introduce}</span><br>                         </div><br>                     </div><br>                 </li><br>             </ul><br>         </div><br>     </div><br>     <ul class="nav nav-bardown nav-justified" style="z-index:10;"><br>         <li><a><span class="btn btn-default" style="border-radius: 50px;padding: 11.5px 30px;" onclick="submitApply();">点击报名</span></a></li><br>     </ul><br> <br>     <div id="page_tag_load"><img src="__IMG__/ajax-loader.gif" alt="loader"></div><br> <br>     <div id="cover2" style="display: none; position: fixed; width: 100%; height: 100%;"></div><br>     <div class="tc_c2" id="join_box"<br /> style="left: 0px; bottom: 0px; z-index: 3000; position: fixed; display: none;width: 100%;"><br>         <div class="join_box_Xq_out" style="max-height: 641px;"><br>             <div class="tc_c_close"><br>                 <div><img title="关闭" onclick="hidePop(this);" ontouchstart="" src="__IMG__/share_qr_close3.png"></div><br>             </div><br>             <div class="join_box_Xq"><br>                 <ul id="ul_join_property" class="pop_massage"><br>                     <li><br>                         <div class="optionsName">姓名</div><br>                         <div class="inpoutK"><br>                             <input value="{$contact.name}" type="text" class="font0" name="name" id="name"><br>                         </div><br>                     </li><br>                     <li><br>                         <div class="optionsName">手机</div><br>                         <div class="inpoutK"><br>                             <input value="{$contact.phone}" type="text" class="font0" name="phone" id="phone"><br>                         </div><br>                     </li><br>                     <li><br>                         <div class="optionsName">地址</div><br>                         <div class="inpoutK"><br>                             <input value="{$contact.address}" type="text" class="font0" name="address" id="address"><br>                         </div><br>                     </li><br>                     <li><br>                         <div class="optionsName">项目</div><br>                         <div class="inpoutK"><br>                             <!--<input value="{$contact.address}" type="text" class="font0" name="address" id="address">--><br>                             <select name="event" style="width: 98%;" id="event"><br>                                 <volist name="event" id="event"><br>                                     <option value="{$event}">{$event}</option><br>                                 </volist><br>                             </select><br>                         </div><br>                     </li><br>                     <li><br>                         <div class="optionsName">备注</div><br>                         <div class="inpoutK"><br>                             <input value="" type="text" class="font0" name="note" id="note"><br>                         </div><br>                     </li><br>                 </ul><br>             </div><br> <br>             <div class="tc_c_btn2" ontouchstart="" id="xdBtn"><br>                 <a title="返回" class="fanHui" href="javascript:void(0);" ontouchstart="" onclick="_joinBox._prev()"<br /> style="display: none;"></a><br> <br>                 <div class="join_Btn"><br>                     <input id="input_submit" class="blueBtn" type="submit" value="我要报名"<br /> style="display: none; width: 100%;"><br>                     <a style="width: 100%;" id="a_submit" class="blueBtn font02" href="javascript:void(0);"<br /> onclick="submitOrder()">提交</a><br>                 </div><br>             </div><br> <br>         </div><br>     </div><br> </div><br> <script><br />     function submitApply(){<br />         $('#cover2').show();<br />         $('#join_box').show();<br />     }<br />     function hidePop(){<br />         $("#join_box").hide();<br />         $("#cover2").hide();<br />     }<br />     var submitFlag = true;<br />     function submitOrder(){<br />         if (submitFlag == false) {<br />             alert("請勿重複操作!");<br />             return;<br />         };<br />         var name = $('#name').val();<br />         var phone = $('#phone').val();<br />         var event = $('#event').val();<br />         var note = $('#note').val();<br />         var address = $('#address').val();<br />      <br /> <br />         if (name.length == 0 || phone.length == 0) {<br />             alert("請核對輸入的資訊!");<br />             return;<br />         };<br />         submitFlag = false;<br /> <br />         $.ajax({<br />             type: "post",<br />             url: "{:u_addons('Apply://Index/addOrder')}",<br />             data: {<br />                 name: name,<br />                 phone: phone,<br />                 event: event,<br />                 note: note,<br />                 address: address<br />             },<br />             success: function (data) {<br />                 if(data){<br />                     hidePop();<br />                     alert("註冊成功!");<br />                     location.reload();<br />                 }<br />             },<br />             beforeSend: function () {<br />                 $('#page_tag_load').show();<br />             },<br />             complete: function () {<br />                 $('#page_tag_load').hide();<br />                 submitFlag = true;<br />             }<br /> <br />        });<br />     }<br /> </script><br> <br>

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門推薦
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板