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='widget-content padded text-center'><ul class='pagination'></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();//Ausgabe der Seitenanzeige<br>
// Paging-Datenabfrage durchführen. Beachten Sie, dass die Parameter der Limit-Methode die Attribute der Page-Klasse <br> verwenden müssen
$record = $record->limit($Page->firstRow . ',' . $Page->listRows)->order("id desc")->relation(true)->select( );<br>
<br>
$this->assign("record", $record);//Zuweisungsdatensatz<br>
$this->assign('page', $show);// Ausgabe der Aufgabenseite<br>
<br>
$this->display();<br>
}<br>
<br>
Öffentliche Funktion 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('Änderung erfolgreich', 'Admin/Admin/index/addon/Apply');<br>
<br>
}<br>
}
IndexController.class<?php<br />
<br />
<br />
Namespace AddonsApplyController;<br />
<br />
Die Klasse IndexController erweitert InitController<br />
{<br />
Öffentlich $appUrl = "";<br />
Öffentliche Funktion __construct()<br />
{<br />
parent::__construct();<br />
$this->appUrl = "http://" I("server.HTTP_HOST");<br>
}<br>
<br>
<br>
Öffentlicher Funktionsindex()<br>
{<br>
$user = R("App/Public/oauthLogin");<br>
// $this->assign("user",$user);<br>
<br>
$config = M("AddonApplyConfig")->where(array("status" => 1))->find();<br>
// print_r(explode(',',$config["event"]));<br>
$this->assign("event", explosion(',',$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);// Ausgabe der Aufgabenseite<br>
$this->display();<br>
}<br>
<br>
Öffentliche Funktion addConfig()<br>
{<br> M("AddonApplyConfig")->where(array("id" => "1"))->save($_POST);<br>
}<br>
<br>
öffentliche Funktion addOrder()<br>
{<br>
<br>
<br>
$userHas = M("AddonApplyContact")->where(array("user_id" => session("userId")))->find();<br>
<br>
if ($userHas) {<br>
$contact ["id"] = $userHas ["id"];<br>
$contact ["user_id"] = session("userId");<br>
$contact ["name"] = $_POST ["name"];<br>
$contact ["address"] = $_POST ["address"];<br>
M("AddonApplyContact")->save($contact);<br>
} else {<br>
$contact ["user_id"] = session("userId");<br>
$contact ["name"] = $_POST ["name"];<br>
$contact ["city"] = "";<br>
$contact ["area"] = "";<br>
$contact ["address"] = $_POST ["address"];<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 ["name"] = $_POST ["name"];<br>
$data ["phone"] = $_POST ["phone"];<br>
$data ["note"] = $_POST ["note"];<br>
$data ["event"] = $_POST["event"];<br>
$data ["time"] = date("Y-m-d H:i:s");<br>
$result = M("AddonApplyRecord")->add($data);<br>
<br>
M("AddonApplyConfig")->where(array("id" => 1))->setInc("apply");<br>
if ($result) {<br>
$this->ajaxReturn($result);<br>
}<br>
}<br>
<br>
<br>
}
Index_index<!DOCTYPE html><br>
<html lang="zh-cn"><br>
<Kopf><br>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><br>
<meta charset="utf-8"><br>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=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 type="text/javascript"><br>
Funktion subscribeApply(){<br>
$('#cover2').show();<br>
$('#join_box').show();<br>
}<br>
Funktion hidePop(){<br>
$("#join_box").hide();<br>
$("#cover2").hide();<br>
}<br>
var subscribeFlag = true;<br>
Funktion subscribeOrder(){<br>
If (submitFlag == false) {<br>
alarm("Bitte wiederholen Sie den Vorgang nicht!");<br>
zurück;<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>
warning("Bitte überprüfen Sie die eingegebenen Informationen!");<br>
zurück;<br>
};<br>
subscribeFlag = false;<br>
<br>
$.ajax({<br>
Typ: „Beitrag“,<br>
URL: "{:u_addons('Apply://Index/addOrder')}",<br>
Daten: {<br>
Name: Name,<br>
Telefon: Telefon,<br>
Ereignis: Ereignis,<br>
Hinweis: Hinweis,<br>
Adresse: Adresse<br>
},<br>
Erfolg: Funktion (Daten) {<br>
If(data){<br>
hidePop();<br>
alarm("Registrierung erfolgreich!");<br>
location.reload();<br>
}<br>
},<br>
beforeSend: function () {<br>
$('#page_tag_load').show();<br>
},<br>
Vollständig: Funktion () {<br>
$('#page_tag_load').hide();<br>
subscribeFlag = true;<br>
}<br>
<br> });<br>
}<br>
</script><br>
</body><br>
</html>
KoaHub.js – Node.js Web-Rapid-Development-Framework basierend auf der Koa.js-Plattform
Offizielle Website: http://js.koahub.com