未加星标

WeMall微商城源码报名插件Apply的主要源码

字体大小 | |
[开发(php) 所属分类 开发(php) | 发布者 店小二05 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

WeMall微信商城源码报名插件Apply,用于商城的签到系统,分享了部分比较重要的代码,供技术员学习参考

AdminController.class.php

<php
namespace Addons\Apply\Controller;
class AdminController extends InitController
{
public function __construct()
{
parent::__construct();
}
public function index()
{
$config = M("AddonApplyConfig")->find();
$this->assign("config", $config);
$record = D(’Addons://Apply/AddonApplyRecord’); // 实例化User对象
$count = $record->count();// 查询满足要求的总记录数
$Page = new \Think\Page($count, 12);// 实例化分页类 传入总记录数和每页显示的记录数(25)
$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>");
$show = $Page->show();// 分页显示输出
// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
$record = $record->limit($Page->firstRow . ’,’ . $Page->listRows)->order("id desc")->relation(true)->select();
$this->assign("record", $record);// 赋值数据集
$this->assign(’page’, $show);// 赋值分页输出
$this->display();
}
public function addConfig()
{
$event = $_POST["event"];
// $event = str_replace(’"’, "", $event);
// $event = str_replace(’[’, "", $event);
// $event = str_replace(’]’, "", $event);
// $event = json_encode(explode(",", $event), JSON_UNESCAPED_UNICODE);
$_POST["event"] = $event;
M("AddonApplyConfig")->where(array("id" => "1"))->save($_POST);
$this->success(’修改成功’, ’Admin/Admin/index/addon/Apply’);
}
} IndexController.class.php <?php
/**
* Created by PhpStorm.
* User: heqing
* Date: 15/7/30
* Time: 09:40
*/
namespace Addons\Apply\Controller;
class IndexController extends InitController
{
public $appUrl = "";
public function __construct()
{
parent::__construct();
$this->appUrl = "http://" . I("server.HTTP_HOST");
}
public function index()
{
$user = R("App/Public/oauthLogin");
// $this->assign("user",$user);
$config = M("AddonApplyConfig")->where(array("status" => 1))->find();
// print_r(explode(’,’,$config["event"]));
$this->assign("event", explode(’,’,$config["event"]));
$this->assign("config", $config);
$contact = M("Contact")->where(array("user_id" => $user["id"]))->find();
if ($contact) {$this->assign("contact", $contact);
}
M("AddonApplyConfig")->where(array("id" => 1))->setInc("visiter");
$this->assign(’user’, $user);// 赋值分页输出
$this->display();
}
public function addConfig()
{
M("AddonApplyConfig")->where(array("id" => "1"))->save($_POST);
}
public function addOrder()
{
$userHas = M("AddonApplyContact")->where(array("user_id" => session("userId")))->find();
if ($userHas) {$contact ["id"] = $userHas ["id"];$contact ["user_id"] = session("userId");$contact ["name"] = $_POST ["name"];$contact ["address"] = $_POST ["address"];M("AddonApplyContact")->save($contact);
} else {$contact ["user_id"] = session("userId");$contact ["name"] = $_POST ["name"];$contact ["city"] = "";$contact ["area"] = "";$contact ["address"] = $_POST ["address"];M("AddonApplyContact")->add($contact);
}
$userHas = M("AddonApplyContact")->where(array("user_id" => session("userId")))->find();
$contact_id = $userHas["id"];
$config = M("AddonApplyConfig")->find();
$data ["user_id"] = session("userId");
$data ["contact_id"] = $contact_id;
$data ["name"] = $_POST ["name"];
$data ["phone"] = $_POST ["phone"];
$data ["note"] = $_POST ["note"];
$data ["event"] = $_POST["event"];
$data ["time"] = date("Y-m-d H:i:s");
$result = M("AddonApplyRecord")->add($data);
M("AddonApplyConfig")->where(array("id" => 1))->setInc("apply");
if ($result) {$this->ajaxReturn($result);
}
}
}

wemall官网网址: www.wemallshop.com


WeMall微商城源码报名插件Apply的主要源码

本文开发(php)相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师

主题: 微商微信数据
分页:12
转载请注明
本文标题:WeMall微商城源码报名插件Apply的主要源码
本站链接:http://www.codesec.net/view/482840.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 开发(php) | 评论(0) | 阅读(31)