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><ul>
<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></li>
</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_indexhtml><br>
<br>
<br>
<meta>
<br>
<meta>
<br>
<meta>
<br>
<title>{$config.name}</title>
<br>
<meta>
<br>
<meta>
<br>
<!-- apple devices fullscreen --><br>
<meta>
<br>
<meta>
<br>
<link>
<br>
<link>
<br>
<link>
<br>
<link>
<br>
<link>
<br>
<br>
<script></script><br>
<script></script><br>
<br>
<style><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>
<br>
<br>
<div>
<br>
<div>
<br>
<div>
<br>
<div>
<br>
<div><img src="/static/imghwm/default1.png" data-src="{$user.avater}" class="lazy" alt="WeMall WeChat mall source code event registration plug-in code details" ></div>
<br>
<div>
<br>
<span>{$user.username}</span><br>
<span>会员ID: {$user.id}</span><br>
</div>
<br>
</div>
<br>
<div>
<br>
<a></a>
href="">累计报名<span>{$config.apply}</span><br>
<a></a>
href="">访问量<span>{$config.visiter}</span><br>
</div>
<br>
</div>
<br>
</div>
<br>
<div>
<br>
<div>
<br>
<ul>
<br>
<li>
<br>
<div>
<br>
<div>
<br>
<h5 id="项目">项目:</h5>
<span>{$config.event}</span><br>
</div>
<br>
</div>
<br>
</li>
<br>
<li>
<br>
<div>
<br>
<div>
<br>
<h5 id="时间">时间:</h5>
<span>{$config.time_range}</span><br>
</div>
<br>
</div>
<br>
</li>
<br>
<li>
<br>
<div>
<br>
<div>
<br>
<h5 id="项目介绍">项目介绍:</h5>
<span>{$config.introduce}</span><br>
</div>
<br>
</div>
<br>
</li>
<br>
</ul>
<br>
</div>
<br>
</div>
<br>
<ul>
<br>
<li><a><span>点击报名</span></a></li>
<br>
</ul>
<br>
<br>
<div><img src="/static/imghwm/default1.png" data-src="__IMG__/ajax-loader.gif" class="lazy" alt="WeMall WeChat mall source code event registration plug-in code details" ></div>
<br>
<br>
<div></div>
<br>
<div></div>
style="left: 0px; bottom: 0px; z-index: 3000; position: fixed; display: none;width: 100%;"><br>
<div>
<br>
<div>
<br>
<div><img src="/static/imghwm/default1.png" data-src="__IMG__/share_qr_close3.png" class="lazy" alt="WeMall WeChat mall source code event registration plug-in code details" ></div>
<br>
</div>
<br>
<div>
<br>
<ul>
<br>
<li>
<br>
<div>姓名</div>
<br>
<div>
<br>
<input><br>
</div>
<br>
</li>
<br>
<li>
<br>
<div>手机</div>
<br>
<div>
<br>
<input><br>
</div>
<br>
</li>
<br>
<li>
<br>
<div>地址</div>
<br>
<div>
<br>
<input><br>
</div>
<br>
</li>
<br>
<li>
<br>
<div>项目</div>
<br>
<div>
<br>
<!--<input value="{$contact.address}" type="text" class="font0" name="address" id="address">--><br>
<select><br>
<volist><br>
<option>{$event}</option>
<br>
</volist><br>
</select><br>
</div>
<br>
</li>
<br>
<li>
<br>
<div>备注</div>
<br>
<div>
<br>
<input><br>
</div>
<br>
</li>
<br>
</ul>
<br>
</div>
<br>
<br>
<div>
<br>
<a></a>
style="display: none;"><br>
<br>
<div>
<br>
<input>
style="display: none; width: 100%;"><br>
<a></a>
onclick="submitOrder()">提交<br>
</div>
<br>
</div>
<br>
<br>
</div>
<br>
</div>
<br>
<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>
<br>
KoaHub.js -- Node.js web rapid development framework based on Koa.js platform
Official website: http://js.koahub.com

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

实现方法:1、使用“sleep(延迟秒数)”语句,可延迟执行函数若干秒;2、使用“time_nanosleep(延迟秒数,延迟纳秒数)”语句,可延迟执行函数若干秒和纳秒;3、使用“time_sleep_until(time()+7)”语句。

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

php字符串有下标。在PHP中,下标不仅可以应用于数组和对象,还可应用于字符串,利用字符串的下标和中括号“[]”可以访问指定索引位置的字符,并对该字符进行读写,语法“字符串名[下标值]”;字符串的下标值(索引值)只能是整数类型,起始值为0。

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。

在php中,可以使用substr()函数来读取字符串后几个字符,只需要将该函数的第二个参数设置为负值,第三个参数省略即可;语法为“substr(字符串,-n)”,表示读取从字符串结尾处向前数第n个字符开始,直到字符串结尾的全部字符。

查找方法:1、用strpos(),语法“strpos("字符串值","查找子串")+1”;2、用stripos(),语法“strpos("字符串值","查找子串")+1”。因为字符串是从0开始计数的,因此两个函数获取的位置需要进行加1处理。


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

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

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version
