首页 > php教程 > php手册 > 正文

WeMall微商城源码投票插件Vote的主要源码

php中文网
发布: 2016-10-17 09:12:08
原创
1810人浏览过

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

AdminController.class.php namespace Addons\Vote\Controller;

class AdminController extends InitController
{


    public function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
        $config = M("AddonVoteConfig")->find();
        $this->assign("config", $config);

        $record = D(’Addons://Vote/AddonVoteRecord’); // 实例化User对象
        $count = $record->count();// 查询满足要求的总记录数
        $Page =  new \Think\Page($count, 12);// 实例化分页类 传入总记录数和每页显示的记录数(25)
        $Page->setConfig(’theme’, "

");
        $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()
    {
        M("AddonVoteConfig")->where(array("id" => "1"))->save($_POST);
        $this->success(’设置成功’, ’Admin/Admin/index/addon/Vote’);
    }
}IndexController.class.php

namespace Addons\Vote\Controller;

class IndexController extends InitController
{
    public $appUrl = "";
    public function __construct()
    {
        parent::__construct();
        $this->appUrl = "http://" . I("server.HTTP_HOST");
    }

    public function init()
    {
        return R("App/Common/init");
    }

    public function oauthRegister($wxuser)
    {
        return R("App/Common/oauthRegister", array($wxuser));
    }

    public function index()
    {
        $user=R("App/Public/oauthLogin");

        // if (!session("userUid")) {
        //     $weObj = $this->init();
        //     $token = $weObj->getOauthAccessToken();
        //     if (!$token) {
        //         $weObj = $this->init();
        //         $url = $weObj->getOauthRedirect($this->appUrl . u_addons(’Vote://App/Index/index’));
        //         header("location: $url");
        //         return;
        //     } else {
        //         $wxuser = $weObj->getOauthUserinfo($token["access_token"], $token["openid"]);
        //         session("userUid", $wxuser["openid"]);
        //         $this->oauthRegister($wxuser);
        //     }
        // }

        $user = M("User")->where(array("uid" => session("userUid")))->find();

        $config = M("AddonVoteConfig")->find();
        $this->assign("config", $config);
        $this->assign("user", $user);

        M("AddonVoteConfig")->where(array("id"=>$config["id"]))->setInc("visiter_num");
        $this->display();
    }

    public function vote()
    {
        $username=M(’User’)->where(array("id"=>session("userId")))->find();
       
        M("AddonVoteRecord")->add(array("user_id"=>session("userId"),"username"=>$username[’username’]));
        M("AddonVoteConfig")->where(array("id"=>I("get.id")))->setInc("vote_num");
    }
}
Index_index.html
nbsp;html>


    
    
    
    投票系统
    
    
    
    
    
    
    
    
    
    

    <script></script>
    <script></script>



    

        

            

                
WeMall微商城源码投票插件Vote的主要源码

                

                    {$user.username}
                    会员ID: {$user.id}
                

            

            

                                    href="">累计投票{$config.vote_num}
                                    href="">访问量{$config.visiter_num}
            

        

    

    

        

            

                    

  •                     

                            

                                
    项目:
    {$config.name}
                            

                        

                    

  •                 

  •                     

                            

                                
    时间:
    {$config.activity_time}
                            

                        

                    

  •                 

  •                     

                            

                                
    投票介绍:
    {$config.about}
                            

                        

                    

  •             

        

    

    


<script><br /> function openUrl(url){<br /> $.get(url , function (data) {<br /> alert(’投票成功!’);<br /> location.reload();<br /> });<br /> }<br /> <br /> </script>


Admin_index.html

    


        投票管理
        
    





    

        

                

                    

大转盘设置

  
                
                

            

                                

                                    

                            投票设置
                        
    
                        

                            投票记录
                        

                               
                            

                                

                                    

                                    



                                    

                                          onsubmit="return false;" class="form-horizontal">
                                        

                                            

                                            

                                                                                                        name="name" type="text">
                                            

                                        

                                        

                                            

                                            

                                                                                                        value="{$config.activity_time}" name="activity_time" type="text">
                                            

                                        

                                        
                                        

                                                    
                                                    

                                                        
                                                        <script><br /> {$config.about}<br /> <br /> </script>
                                                    

                                                


                                        

                                            

                                            

                                                                                                         onclick="myFormSubmit(’{:u_addons(\’Vote://Admin/Admin/index\’)}’)"
                                                        type="submit">提交
                                                
                                                
                                            

                                        

                                    
                                    
                                

                                

                                  
                                    



                                    


                                        
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                                

                                                    
                                                    
                                                    
                                                    
                                                
                                            
                                            
                                        

                                                
                                            

                                                ID
                                            

                                                用户名
                                            

                                                时间
                                            

                                                        
                                                    

                                                        {$record.id}
                                                    

                                                        {$record.username}
                                                    

                                                        {$record.time}
                                                    

                                        

                                            
                                            {$page}
                                        

                                        
                                    

                                    
                                

                            

                        

                    

                


            

        

    





<script><br /> // //实例化编辑器<br /> // var um = UM.getEditor(’myEditor’ , {<br /> // textarea : ’about’<br /> // });<br /> <br /> // function setFocus() {<br /> // UM.getEditor(’myEditor’).focus();<br /> // }<br /> $(function() {<br /> //实例化编辑器异步载入<br /> var editor = new UE.ui.Editor();<br /> editor.render("UEditor");<br /> });<br /> <br /> if (’{$config}’) {<br /> $(’select[name="status"]’).val(’{$config.status}’);<br /> $(’select[name="everyday"]’).val(’{$config.everyday}’);<br /> // UE.getEditor(’myEditor’).setContent(’{$config.activity_explain}’);<br /> }<br /> </script>
  
wemall官网网址: www.wemallshop.com

WeMall微商城源码投票插件Vote的主要源码

附件 Vote投票.rar ( 1.73 MB 下载:1 次 )

最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号