WeMall微信商城源码活动报名插件代码详情

WeMall微信商城源码插件活动报名代码是用于商业推广的比较有效的方式,分享了部分比较重要的代码,供技术员学习参考,商家可自由设置报名项目,活动时间,报名内容

代码详情地址:http://addon.wemallshop.com/Product/addonList/menu_id/1 或 www.wemallshop.com

AdminController.class

<?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

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);
        }
    }

Index_index

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>{$config.name}</title>
    <meta name="format-detection" content="telephone=no, address=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <!-- apple devices fullscreen -->
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <link href="__CSS__/bootstrap.min.css" rel="stylesheet">
    <link href="__CSS__/font-awesome.min.css" rel="stylesheet">
    <link href="__CSS__/animate.css" rel="stylesheet">
    <link href="__CSS__/common.css" rel="stylesheet">
    <link href="__CSS__/sign.css" rel="stylesheet">

    <script type="text/javascript" src="__JS__/jquery.min.js"></script>
    <script type="text/javascript" src="__JS__/bootstrap.min.js"></script>

    <style type="text/css">
        #page_tag_load {
            display: none;
            font-size: 14px;
            position: fixed;
            bottom: 70px;
            height: 16px;
            margin-left: -29px;
            left: 50%
        }
    </style>
</head>
<body>
<div class="container container-fill">
    <div class="pcenter-main">
        <div class="head">
            <div class="pdetail">
                <div class="img-circle"><img src="{$user.avater}"></div>
                <div class="pull-left">
                    <span class="name">{$user.username}</span>
                    <span class="type">会员ID: {$user.id}</span>
                </div>
            </div>
            <div class="head-nav">
                <a class="head-nav-list"
                   href="">累计报名<span>{$config.apply}</span></a>
                <a class="head-nav-list"
                   href="">访问量<span>{$config.visiter}</span></a>
            </div>
        </div>
    </div>
    <div class="scroll-container">
        <div class="wrapper">
            <ul class="list-group">
                <li class="list-group-item" style="padding: 0px 0px;border-bottom: 1px solid #ccc;">
                    <div class="con">
                        <div class="list-hd">
                            <h5>项目:</h5><span>{$config.event}</span>
                        </div>
                    </div>
                </li>
                <li class="list-group-item" style="padding: 1px 0px;border-bottom: 1px solid #ccc;">
                    <div class="con">
                        <div class="list-hd">
                            <h5>时间:</h5><span>{$config.time_range}</span>
                        </div>
                    </div>
                </li>
                <li class="list-group-item" style="padding: 0px;">
                    <div class="con">
                        <div class="list-hd">
                            <h5>项目介绍:</h5><span>{$config.introduce}</span>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <ul class="nav nav-bardown nav-justified" style="z-index:10;">
        <li><a><span class="btn btn-default" style="border-radius: 50px;padding: 11.5px 30px;" onclick="submitApply();">点击报名</span></a></li>
    </ul>

    <div id="page_tag_load"><img src="__IMG__/ajax-loader.gif" alt="loader"></div>

    <div id="cover2" style="display: none; position: fixed; width: 100%; height: 100%;"></div>
    <div class="tc_c2" id="join_box"
         style="left: 0px; bottom: 0px; z-index: 3000; position: fixed; display: none;width: 100%;">
        <div class="join_box_Xq_out" style="max-height: 641px;">
            <div class="tc_c_close">
                <div><img title="关闭" onclick="hidePop(this);" ontouchstart="" src="__IMG__/share_qr_close3.png"></div>
            </div>
            <div class="join_box_Xq">
                <ul id="ul_join_property" class="pop_massage">
                    <li>
                        <div class="optionsName">姓名</div>
                        <div class="inpoutK">
                            <input value="{$contact.name}" type="text" class="font0" name="name" id="name">
                        </div>
                    </li>
                    <li>
                        <div class="optionsName">手机</div>
                        <div class="inpoutK">
                            <input value="{$contact.phone}" type="text" class="font0" name="phone" id="phone">
                        </div>
                    </li>
                    <li>
                        <div class="optionsName">地址</div>
                        <div class="inpoutK">
                            <input value="{$contact.address}" type="text" class="font0" name="address" id="address">
                        </div>
                    </li>
                    <li>
                        <div class="optionsName">项目</div>
                        <div class="inpoutK">
                            <!--<input value="{$contact.address}" type="text" class="font0" name="address" id="address">-->
                            <select name="event" style="width: 98%;" id="event">
                                <volist name="event" id="event">
                                    <option value="{$event}">{$event}</option>
                                </volist>
                            </select>
                        </div>
                    </li>
                    <li>
                        <div class="optionsName">备注</div>
                        <div class="inpoutK">
                            <input value="" type="text" class="font0" name="note" id="note">
                        </div>
                    </li>
                </ul>
            </div>

            <div class="tc_c_btn2" ontouchstart="" id="xdBtn">
                <a title="返回" class="fanHui" href="javascript:void(0);" ontouchstart="" onclick="_joinBox._prev()"
                   style="display: none;"></a>

                <div class="join_Btn">
                    <input id="input_submit" class="blueBtn" type="submit" value="我要报名"
                           style="display: none; width: 100%;">
                    <a style="width: 100%;" id="a_submit" class="blueBtn font02" href="javascript:void(0);"
                       onclick="submitOrder()">提交</a>
                </div>
            </div>

        </div>
    </div>
</div>
<script type="text/javascript">
    function submitApply(){
        $(‘#cover2‘).show();
        $(‘#join_box‘).show();
    }
    function hidePop(){
        $("#join_box").hide();
        $("#cover2").hide();
    }
    var submitFlag = true;
    function submitOrder(){
        if (submitFlag == false) {
            alert("请不要重复操作!");
            return;
        };
        var name = $(‘#name‘).val();
        var phone = $(‘#phone‘).val();
        var event = $(‘#event‘).val();
        var note = $(‘#note‘).val();
        var address = $(‘#address‘).val();

        if (name.length == 0 || phone.length == 0) {
            alert("请核对输入的信息!");
            return;
        };
        submitFlag = false;

        $.ajax({
            type: "post",
            url: "{:u_addons(‘Apply://Index/addOrder‘)}",
            data: {
                name: name,
                phone: phone,
                event: event,
                note: note,
                address: address
            },
            success: function (data) {
                if(data){
                    hidePop();
                    alert("报名成功!");
                    location.reload();
                }
            },
            beforeSend: function () {
                $(‘#page_tag_load‘).show();
            },
            complete: function () {
                $(‘#page_tag_load‘).hide();
                submitFlag = true;
            }

        });
    }
</script>
</body>
</html>

  

KoaHub.js -- 基于 Koa.js 平台的 Node.js web 快速开发框架

官网:http://js.koahub.com

时间: 2024-10-19 16:39:29

WeMall微信商城源码活动报名插件代码详情的相关文章

WeMall微信商城源码插件大转盘代码详情

WeMall微信商城源码插件大转盘代码是用于商业推广的比较有效的方式,分享了部分比较重要的代码,供技术员学习参考 代码详情地址:http://addon.wemallshop.com/Product/addonList/menu_id/1 或 www.wemallshop.com AdminController.class Php代码   <?php // +---------------------------------------------------------------------

Koahub软件市场免费版微信商城源码 wemall doraemon

Koahub软件市场免费版微信商城源码 wemall doraemon wemall doraemon是基于WeMall的Android app商城,服务端采用wemall微信商城,不对原商城做任何修改,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可随意定制修改,不做任何限制: [适合研究学习,支持wemall3.x版本] wemall doraemon是Android客户端程序,服务端采用wemall微信商城,不对原商城做任何修改,只需要在原商城目录下上传接口文件即可完成服务端

wemall app商城源码Android数据的SharedPreferences储存方式

wemall-mobile是基于WeMall的Android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.本文分享wemall app商城源码Android数据的SharedPreferences储存方式,供技术员参考学习.        SharedPreferences:除了SQLite数据库外,SharedPreferences也是一种轻型的数据储存方式,它的本质是基于XML文件存储key-value键值对数据,通常用来储存一些简单的配置信息.Sha

wemall app商城源码Android之支付宝通知处理类

wemall-mobile是基于WeMall的Android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.本文分享wemall app商城源码Android之处理支付宝各接口通知返回,供技术员参考学习. 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码,该代码仅供学习和研究支付宝接口使用,只是提供一个参考,调试通知返回时,可查看或改写log日志的写入TXT里的数据,来检查通知返回是否正常. w

wemall app商城源码机器人检测

wemall-mobile是基于WeMall的Android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.本文分享wemall app商城源码Android之 wemall app商城源码机器人检测,供技术员参考学习. <?php defined('THINK_PATH') or exit(); /** * 机器人检测 * @category Extend * @package Extend * @subpackage Behavior * @author

wemall app商城源码Android之通用通知接口demo

wemall-mobile是基于WeMall的Android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.本文分享Native(原生)支付模式一demo,供技术员参考学习. wemall官网地址:http://www.wemallshop.com 支付完成后,微信会把相关支付和用户信息发送到商户设定的通知URL,商户接收回调信息后,根据需要设定相应的处理流程. 这里举例使用log文件形式记录回调信息. notify_url.php <?php includ

wemall app商城源码Android中ViewHolder详细解释

1.ViewHolder的解释: (1).只是一个静态类,不是Android的API方法. (2).它的作用就在于减少不必要的调用findViewById,然后把对底下的控件引用存在ViewHolder里面,再在View.setTag(holder)把它放在view里,下次就可以直接取了. 2.convertView中的TAG: (1).Tag不像ID是用标示view的.Tag从本质上来讲是就是相关联的view的额外的信息.它们经常用来存储一些view的数据,这样做非常方便而不用存入另外的单独结

wemall app商城源码Android短信监听接收器

wemall doraemon是Android客户端程序,服务端采用wemall微信商城,不对原商城做任何修改,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可随意定制修改.本文分享其中短信监听接收器,用于自动获取短信验证码,然后自动填写到验证码区域代码,供技术员参考学习. package cn.smssdk.gui; import android.content.BroadcastReceiver; import android.content.Context; import a

wemall app商城源码中基于PHP的ThinkPHP惯例配置文件代码

wemall doraemon是Android客户端程序,服务端采用wemall微信商城,不对原商城做任何修改,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可随意定制修改.本文分享其中关于ThinkPHP惯例配置文件代码,供技术员参考学习. <?php /** * ThinkPHP惯例配置文件 * 该文件请不要修改,如果要覆盖惯例配置的值,可在项目配置文件中设定和惯例不符的配置项 * 配置名称大小写任意,系统会统一转换成小写 * 所有配置参数都可以在生效前动态改变 * @cate