WeMall WeChat mall source code event registration plug-in code details
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();// Display output in pages<br>
// Perform paging data query. Note that the parameters of the limit method must use the attributes of the Page class<br>
$record = $record->limit($Page->firstRow . ',' . $Page->listRows)->order("id desc")->relation(true)->select( );<br>
<br>
$this->assign("record", $record);//Assignment data set<br>
$this->assign('page', $show);// Assignment paging output<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('Modification successful', 'Admin/Admin/index/addon/Apply');<br>
<br>
}<br>
}
IndexController.class<?php<br />
<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);// Assignment paging output<br>
$this->display();<br>
}<br>
<br>
Public function addConfig()<br>
{<br> M("AddonApplyConfig")->where(array("id" => "1"))->save($_POST);<br>
}<br>
<br>
public function 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>
<head><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>
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("Please do not repeat the operation!");<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("Please check the entered information!");<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("Registration successful!");<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>
</body><br>
</html>
KoaHub.js -- Node.js web rapid development framework based on Koa.js platform
Official website: http://js.koahub.com

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
