搜索
首页php教程php手册WeMall微信商城源码插件大转盘代码详情

WeMall微信商城源码插件大转盘代码是用于商业推广的比较有效的方式,分享了部分比较重要的代码,供技术员学习参考
WeMall微信商城源码插件大转盘代码是用于商业推广的比较有效的方式,分享了部分比较重要的代码,供技术员学习参考

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

AdminController.class<?php <br /> // +----------------------------------------------------------------------  <br> // | OneThink [ WE CAN DO IT JUST THINK IT ]  <br> // +----------------------------------------------------------------------  <br> // | Copyright (c) 2013 http://www.onethink.cn All rights reserved.  <br> // +----------------------------------------------------------------------  <br> // | Author: 麦当苗儿 <zuojiazi> <http:>  <br> // +----------------------------------------------------------------------  <br> namespace Addons\Wheel\Controller;  <br>   <br> class AdminController extends InitController  <br> {  <br>   <br>   <br>     // public function __construct()  <br>     // {  <br>     //     parent::__construct();  <br>     // }  <br>   <br>     public function index()  <br>     {  <br>         $config = M("AddonWheelConfig")->find();  <br>         $this->assign("config", $config);  <br>   <br>         $record = D('Addons://Wheel/AddonWheelRecord'); // 实例化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();// 分页显示输出  <br>         // 进行分页数据查询 注意limit方法的参数要使用Page类的属性  <br>         $record = $record->limit($Page->firstRow . ',' . $Page->listRows)->order("id desc")->relation(true)->select();  <br>   <br>         $this->assign("record", $record);// 赋值数据集  <br>         $this->assign('page', $show);// 赋值分页输出  <br>   <br>         $this->display();  <br>     }  <br>   <br>     public function addConfig()  <br>     {  <br>         M("AddonWheelConfig")->where(array("id" => "1"))->save($_POST);  <br>         $this->success('设置成功', 'Admin/Admin/index/addon/Wheel');  <br>     }  <br> }  </http:></zuojiazi>
IndexController.class<?php <br /> /** <br>  * Created by PhpStorm. <br>  * User: heqing <br>  * Date: 15/7/30 <br>  * Time: 09:40 <br>  */  <br>   <br> namespace Addons\Wheel\Controller;  <br>   <br> // class IndexController extends InitController  <br> // {  <br> //     public function index()  <br> //     {  <br> //         $this->show('SystemInfo Index index');  <br> //     }  <br>   <br>   <br> // }  <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>     public function init()  <br>     {  <br>         return R("App/Common/init");  <br>     }  <br>   <br>     public function oauthRegister($wxuser)  <br>     {  <br>         return R("App/Common/oauthRegister", array($wxuser));  <br>     }  <br>   <br>     public function index()  <br>     {  <br>         $user=R("App/Public/oauthLogin");  <br>   <br>         // if (!session("userUid")) {  <br>         //     $weObj = $this->init();  <br>         //     $token = $weObj->getOauthAccessToken();  <br>         //     if (!$token) {  <br>         //         $weObj = $this->init();  <br>         //         $url = $weObj->getOauthRedirect($this->appUrl . u_addons('Wheel://App/Index/index'));  <br>         //         header("location: $url");  <br>         //         return;  <br>         //     } else {  <br>         //         $wxuser = $weObj->getOauthUserinfo($token["access_token"], $token["openid"]);  <br>         //         session("userUid", $wxuser["openid"]);  <br>         //         $this->oauthRegister($wxuser);  <br>         //     }  <br>         // }  <br>   <br>         $user = M("User")->where(array("uid" => session("userUid")))->find();  <br>   <br>         $config = M("AddonWheelConfig")->find();  <br>         $this->assign("config", $config);  <br>         $this->assign("user", $user);  <br>   <br>         $record = M("AddonWheelRecord")->where(array("user_id" => session("userId")))->order("id desc")->find();  <br>         $this->assign("record", $record);  <br>         $this->display();  <br>     }  <br>   <br>     /** <br>      * 中奖机率计算 <br>      */  <br>     function lotteryJson()  <br>     {  <br>         $today = date("Y-m-d");  <br>         $where["time"] = array("like", $today . "%");  <br>         $where["user_id"] = session("userId");  <br>         $record = D("Addons://Wheel/AddonWheelRecord")->where($where)->find();  <br>         if ($record) {  <br>             $this->ajaxReturn("-1");  <br>             return;  <br>         }  <br>   <br>         $config = M("AddonWheelConfig")->find();  <br>         //奖品概率  <br>         $proArr = array(  <br>             '1' => $config["level1_prob"],   <br>             '2' => $config["level2_prob"],   <br>             '3' => $config["level3_prob"],   <br>             '4' => $config["level4_prob"],   <br>             '5' => $config["level5_prob"],   <br>             '6' => $config["level6_prob"],   <br>             '7' => $config["level7_prob"]  <br>         );  <br>         //奖品库存  <br>         $proCount = array(  <br>             '1' => $config["level1_store"],  <br>             '2' => $config["level2_store"],  <br>             '3' => $config["level3_store"],  <br>             '4' => $config["level4_store"],  <br>             '5' => $config["level5_store"],  <br>             '6' => $config["level6_store"],  <br>             '7' => $config["level7_store"]  <br>         );  <br>         $file = './Data/wheel.txt';  <br>         $data = array(  <br>             '1' => 0, '2' => 0, '3' => 0, '4' => 0, '5' => 0, '6' => 0  <br>         );  <br>         if (!file_exists($file)) {  <br>             file_put_contents($file, serialize($data));  <br>         } else {  <br>             $str = file_get_contents($file);  <br>             $data = unserialize($str);  <br>         }  <br>         $rid = $this->getRand($proArr, $proCount);  <br>   <br>         if ($rid > 6) {  <br>             $rid = 0;  <br>         } else {  <br>             $rid = $this->returnRid($rid, $file, $data, $proCount, $proArr);  <br>         }  <br>   <br>         M("AddonWheelRecord")->add(array("user_id" => session("userId"), "level" => $rid));  <br>         echo $rid;  <br>     }  <br>   <br>     function returnRid($rid, $file, $data, $proCount, $proArr)  <br>     {  <br>         $data[$rid] = $data[$rid] + 1;  <br>         $count = $proCount[$rid]; // 总库存  <br>         if ($count              // 如果抽取的数据大于总库存时库存清0  <br>             $proCount[$rid] = 0;  <br>             // 然后继续计算一直计算出某个值的库存不为0  <br>             $rid = returnRid($rid, $file, $data, $proCount, $proArr);  <br>         } else {  <br>             // 写入缓存  <br>             file_put_contents($file, serialize($data));  <br>         }  <br>         return $rid;  <br>     }  <br>   <br>     /** <br>      * 中奖概率计算, 能用 <br>      * $proArr = array('1'=>'概率', '2'=>'概率'); <br>      * $proCount = array('1'=>'库存', '2'=>'库存'); <br>      */  <br>     function getRand($proArr, $proCount)  <br>     {  <br>         $result = '';  <br>         $proSum = 0;  <br>         foreach ($proCount as $key => $val) {  <br>             if ($val                  continue;  <br>             } else {  <br>                 $proSum = $proSum + $proArr[$key];  <br>             }  <br>         }  <br>         foreach ($proArr as $key => $proCur) {  <br>             if ($proCount[$key]                  continue;  <br>             } else {  <br>                 $randNum = mt_rand(1, $proSum);  <br>                 if ($randNum                      $result = $key;  <br>                     break;  <br>                 } else {  <br>                     $proSum -= $proCur;  <br>                 }  <br>             }  <br>         }  <br>         unset($proArr);  <br>         return $result;  <br>     }  <br> }  
InitController.class<?php <br /> /** <br>  * Created by PhpStorm. <br>  * User: heqing <br>  * Date: 15/7/30 <br>  * Time: 12:11 <br>  */  <br>   <br> namespace Addons\Wheel\Controller;  <br>   <br>   <br> use Common\Controller\Addon;  <br>   <br> class InitController extends Addon  <br> {  <br>   <br>     public function install()  <br>     {  <br>         $install_sql = './Addons/Wheel/Data/install.sql';  <br>         if (file_exists($install_sql)) {  <br>             execute_sql_file($install_sql);  <br>         }  <br>          $this->success("安装成功", "Admin/Addon/addon");  <br>     }  <br>   <br>     public function uninstall()  <br>     {  <br>         $uninstall_sql = './Addons/Wheel/Data/uninstall.sql';  <br>         if (file_exists($uninstall_sql)) {  <br>             execute_sql_file($uninstall_sql);  <br>         }  <br>         $this->success("卸载成功", "Admin/Addon/addon");  <br>     }  <br> }  
前台
Admin_index <section>  <br>     <h1>  <br>         大转盘管理  <br>         <small></small>  <br>     </h1>  <br> </section>   <br>  <section>  <br>     <div>  <br>         <div>  <br>             <div>  <br>                 <div>  <br>                     <h3 id="大转盘设置">大转盘设置</h3>    <br> <!-- /.box-tools -->  <br>   </div>  <br>                   <br>           <br>                             <div>  <br>                                 <div>  <br>                                     <div>  <br>                             <a><i></i>大转盘设置</a>  <br>                         </div>      <br>                         <div>  <br>                             <a><i></i>大转盘记录</a>  <br>                         </div>  <br>                                  <br>                                 <div>  <br>                                     <div>  <br>                                         <p>  <br>                                             </p> <form>  <br>                                                 <div>  <br>                                                     <label>大转盘名称</label>  <br>                                                     <div>  <br>                                                         <input>  <br>                                                     </div>  <br>                                                 </div>  <br>                                                 <div>  <br>                                                     <label>活动时间</label>  <br>                                                     <div>  <br>                                                         <input>  <br>                                                     </div>  <br>                                                 </div>  <br>                                                 <div>  <br>                                                     <label>活动说明</label>  <br>                                                     <div>  <br>                                                         <!--style给定宽度可以影响编辑器的最终宽度-->  <br>                                                         <script> <br /> {$config.activity_explain} <br /> <br /> </script>  <br>                                                     </div>  <br>                                                 </div>  <br>                                                 <div>  <br>                                                     <label>状态</label>  <br>                                                     <div>  <br>                                                         <select>  <br>                                                             <option>是</option>  <br>                                                             <option>否</option>  <br>                                                         </select>  <br>                                                     </div>  <br>                                                 </div>  <br>                                                 <div>  <br>                                                     <label>一天参与一次</label>  <br>                                                     <div>  <br>                                                         <select>  <br>                                                             <option>是</option>  <br>                                                             <option>否</option>  <br>                                                         </select>  <br>                                                     </div>  <br>                                                 </div>  <br>                                                 <div>  <br>                                                     <label>一等奖中奖概率</label>  <br>                                                     <div>  <br>                                                         <input>  <br>                                                     </div>  <br>                                                     <label>一等奖库存</label>  <br>                                                     <div>  <br>                                                         <input>  <br>                                                     </div>  <br>                                                 </div>  <br>                                                 <div>  <br>                                                     <label>二等奖中奖概率</label>  <br>                                                     <div>  <br>                                                         <input>  <br>                                                     </div>  <br>                                                     <label>二等奖库存</label>  <br>                                                     <div>  <br>                                                         <input>  <br>                                                     </div>  <br>                                                 </div>  <br>                                                 <div>  <br>                                                     <label>三等奖中奖概率</label>  <br>                                                     <div>  <br>                                                         <input>  <br>                                                     </div>  <br>                                                     <label>三等奖库存</label>  <br>                                                     <div>  <br>                                                         <input>  <br>                                                     </div>  <br>                                                 </div>  <br>                                                 <div>  <br>                                                     <label>四等奖中奖概率</label>  <br>                                                     <div>  <br>                                                         <input>  <br>                                                     </div>  <br>                                                     <label>四等奖库存</label>  <br>                                                     <div>  <br>                                                         <input>  <br>                                                     </div>  <br>                                                 </div>  <br>                                                 <div>  <br>                                                     <label>五等奖中奖概率</label>  <br>                                                     <div>  <br>                                                         <input>  <br>                                                     </div>  <br>                                                     <label>五等奖库存</label>  <br>                                                     <div>  <br>                                                         <input>  <br>                                                     </div>  <br>                                                 </div>  <br>                                                 <div></div> </form> </div> </div> </div> </div> </div> </div> </div></section>

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
微信文件多久过期微信文件多久过期Nov 21, 2022 pm 02:12 PM

微信文件的过期时间需要根据情况来判断:1、如果发送的文件没有打开过,则在72小时以后微信系统会自动清理掉,即过了三天文件就会过期;2、如果已经查看了微信文件,但是并没有下载(当然已经下载的文件也是一样的),那么文件是可以保留180天的,在这180天以内随时都可以去下载。

微信拉黑和删除有什么区别微信拉黑和删除有什么区别Oct 18, 2022 am 11:29 AM

区别:1、拉黑后对话框从主页消失,但是聊天记录还在;删除后聊天记录全部消失不见了。2、拉黑后还能发给他,但是收不到他的消息;删除后不能发信息了。3、拉黑后双方都不可见彼此的朋友圈;删除对方以后,你看不到对方的朋友圈了,对方是否能看到你的,取决于设置(允许陌生人查看十张照片)与否,如果设置则可以看到朋友圈。

支持微信付款的购物平台有哪些支持微信付款的购物平台有哪些Nov 02, 2022 pm 02:44 PM

支持微信付款的购物平台有:1、京东,是中国的综合网络零售商;2、唯品会,是一家在线销售品牌折扣商品的互联网公司;3、拼多多,是社交新电商领导者,更懂消费者的购物平台;4、京喜,是京东旗下生活消费商城;5、蘑菇街,一个电子商务网站;6、聚美优品,是一家以销售化妆品为主的时尚购物网站;7、微店,是一个云推广电子商务平台;8、考拉海购,是一个跨境海淘业务为主的会员电商平台。

微信可以绑别人的银行卡号么微信可以绑别人的银行卡号么Mar 14, 2023 pm 04:53 PM

可以。未经过实名认证的微信号,可以绑定他人的银行卡,但在绑定过程中需要提供银行卡的开户人姓名、开户行地址、开户时预留的联系方式及银行卡支付密码;已通过实名认证的微信号,无法绑定他人银行卡,只能添加使用自己身份证办理的银行卡。

一个身份证只能绑定一个微信吗一个身份证只能绑定一个微信吗Mar 02, 2023 pm 01:50 PM

不是,一个身份证能绑定5个微信。按照微信当前规定,一个身份证可以实名认证5个微信号;如果已经实名认证了5个微信账号,但是还想要继续实名,就要把已经实名认证的一些不用的微信号清除以后,才可以再实名认证新的微信号。

微信赞赏码和收款码的区别是什么微信赞赏码和收款码的区别是什么Oct 31, 2022 pm 03:18 PM

区别:1、赞赏码是用于别人给自己打赏的,收取小费等小金额的赞赏给予,而收款码是一般的收款行为,可以进行大额收费的二维码;2、收款码是随时会变的,如果不是商家收款码,每次打开都会变,但是赞赏码不同,赞赏码是不会变的;3、赞赏码只能进行小额的首款,而收款码将可以大额首款。

电脑微信打字为什么打一个少一个电脑微信打字为什么打一个少一个Mar 28, 2023 pm 03:43 PM

电脑微信打字打一个少一个是因为开启了改写状态,其解决办法:1、打开电脑微信;2、在微信聊天窗口输入对话文字内容;3、找到并按下键盘上的Insert键即可正常输入文字内容。

财付通是微信还是支付宝财付通是微信还是支付宝Oct 18, 2022 pm 02:35 PM

财付通是微信,是腾讯公司旗下的第三方支付平台,其核心业务是协助在互联网上进行交易的双方完成支付和收款,其使用方式是:1、进行账户注册及登录;2、进行账户充值;3、根据需求设置快捷支付;4、通过打开微信支付或QQ钱包查询交易账单。

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

仓库:如何复兴队友
1 个月前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.能量晶体解释及其做什么(黄色晶体)
2 周前By尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒险:如何获得巨型种子
1 个月前By尊渡假赌尊渡假赌尊渡假赌

热工具

EditPlus 中文破解版

EditPlus 中文破解版

体积小,语法高亮,不支持代码提示功能

螳螂BT

螳螂BT

Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

安全考试浏览器

安全考试浏览器

Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

PhpStorm Mac 版本

PhpStorm Mac 版本

最新(2018.2.1 )专业的PHP集成开发工具