WeMall微信商城源码报名插件Apply,用于商城的签到系统,分享了部分比较重要的代码,供技术员学习参考
WeMall微信商城源码报名插件Apply,用于商城的签到系统,分享了部分比较重要的代码,供技术员学习参考
AdminController.class.php
<?php <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();//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<?php <br />
/**<br>
* Erstellt von PhpStorm.<br>
* Benutzer: heqing<br>
* Datum: 15.7.30<br>
* Zeit: 09:40<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>
}
wemall官网网址: www.wemallshop.com
Apply报名.rar ( 1,73 MB, 6 Monate lang)