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();//페이지 표시 출력<br>
// 페이징 데이터 쿼리를 수행합니다. Limit 메소드의 매개변수는 Page 클래스 <br>의 속성을 사용해야 합니다.
$record = $record->limit($Page->firstRow . ',' . $Page->listRows)->order("id desc")->relation(true)->select( );<br>
<br>
$this->할당("record", $record);//과제 데이터 세트<br>
$this->할당('page', $show);// 할당 페이징 출력<br>
<br>
$this->display();<br>
}<br>
<br>
공개 함수 addConfig()<br>
{<br>
$event = $_POST["이벤트"];<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>
}
IndexController.class<?php<br />
<br />
<br />
네임스페이스 AddonsApplyController;<br />
<br />
IndexController 클래스는 InitController를 확장합니다<br />
{<br />
공개 $appUrl = "";<br />
공개 함수 __construct()<br />
{<br />
parent::__construct();<br />
$this->appUrl = "http://" . I("server.HTTP_HOST");<br>
}<br>
<br>
<br>
공용 함수 인덱스()<br>
{<br>
$user = R("App/Public/oauthLogin");<br>
// $this->할당("user",$user);<br>
<br>
$config = M("AddonApplyConfig")->where(array("status" => 1))->find();<br>
// print_r(explode(',',$config["event"]));<br>
$this->할당("이벤트", 폭발(',',$config["이벤트"]));<br>
$this->할당("config", $config);<br>
<br>
$contact = M("연락처")->where(array("user_id" => $user["id"]))->find();<br>
if ($contact) {<br>
$this->할당("연락처", $contact);<br>
}<br>
<br>
M("AddonApplyConfig")->where(array("id" => 1))->setInc("visiter");<br>
<br>
$this->할당('user', $user);// 할당 페이징 출력<br>
$this->display();<br>
}<br>
<br>
공개 함수 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>
if ($userHas) {<br>
$contact ["id"] = $userHas ["id"];<br>
$contact ["user_id"] = session("userId");<br>
$contact ["이름"] = $_POST ["이름"];<br>
$contact ["주소"] = $_POST ["주소"];<br>
M("AddonApplyContact")->저장($contact);<br>
} 그밖에 {<br>
$contact ["user_id"] = session("userId");<br>
$contact ["이름"] = $_POST ["이름"];<br>
$contact ["도시"] = "";<br>
$contact ["area"] = "";<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 ["time"] = date("연월일 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>
<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>
함수 submitApply(){<br>
$('#cover2').show();<br>
$('#join_box').show();<br>
}<br>
함수 hidePop(){<br>
$("#join_box").hide();<br>
$("#cover2").hide();<br>
}<br>
var submitFlag = true;<br>
함수 submitOrder(){<br>
If (submitFlag == false) {<br>
Alert("반복 작업을 하지 마세요!");<br>
반품;<br>
};<br>
var 이름 = $('#name').val();<br>
var 전화 = $('#phone').val();<br>
var 이벤트 = $('#event').val();<br>
var note = $('#note').val();<br>
var 주소 = $('#address').val();<br>
<br>
<br>
If (이름.길이 == 0 || 전화.길이 == 0) {<br>
Alert("입력하신 정보를 확인해주세요!");<br>
반품;<br>
};<br>
submitFlag = false;<br>
<br>
$.ajax({<br>
유형: "게시물",<br>
url: "{:u_addons('Apply://Index/addOrder')}",<br>
데이터: {<br>
이름: 이름,<br>
전화: 전화,<br>
이벤트: 이벤트,<br>
참고: 참고,<br>
주소:주소<br>
},<br>
성공: 함수(데이터) {<br>
If(데이터){<br>
hidePop();<br>
Alert("등록이 완료되었습니다!");<br>
location.reload();<br>
}<br>
},<br>
beforeSend: 함수 () {<br>
$('#page_tag_load').show();<br>
},<br>
완료: 함수 () {<br>
$('#page_tag_load').hide();<br>
submitFlag = true;<br>
}<br>
<br> });<br>
}<br>
<br>
</본문><br>
</html>
KoaHub.js -- Koa.js 플랫폼 기반의 Node.js 웹 신속 개발 프레임워크
공식 홈페이지: http://js.koahub.com