ホームページ  >  記事  >  php教程  >  WeMall WeChatモールチェックインプラグインのメインソースコード

WeMall WeChatモールチェックインプラグインのメインソースコード

WBOY
WBOYオリジナル
2016-10-11 14:01:521812ブラウズ

WeMall WeChat モール ソース コード サインイン プラグイン モールのサインイン システムに使用される Sign は、技術者が学習および参照するためのより重要なコードの一部を共有します
WeMall WeChat モール ソース コード サインイン プラグインモールのサインイン システムに使用される Sign は、技術者の学習参考のために、より重要なコードの一部を共有しています

AdminController.class.php<?php <?php<br /> <br> 名前空間 AddonsSignController;<br> <br> AdminController クラスは InitController を拡張します<br> {<br> <br> <br> パブリック関数 __construct()<br> {<br> 親::__construct();<br> }<br> <br> パブリック関数index()<br> {<br> $config = M("AddonSignConfig")->find();<br> $this->assign("config", $config);<br> <br> $record = D('Addons://Sign/AddonSignRecord') // User オブジェクトをインスタンス化します<br> <br> $count = $record->count();//要件を満たすレコードの総数をクエリします<br> $Page = new ThinkPage($count, 12); // ページング クラスをインスタンス化し、レコードの総数と各ページに表示されるレコードの数を渡します (25)<br> $Page->setConfig('テーマ', "<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> パブリック関数 addConfig()<br> {<br> M("AddonSignConfig")->where(array("id" => "1"))->save($_POST);<br> $this->success('変更成功', 'Admin/Admin/index/addon/Sign');<br> }<br> } IndexController.class.php<?php <?php<br /> 名前空間 AddonsSignController;<br> <br> クラス IndexController は InitController を拡張します<br> {<br> パブリック $appUrl = "";<br> パブリック関数 __construct()<br> {<br> 親::__construct();<br> $this->appUrl = "http://" .I("server.HTTP_HOST");<br> }<br> <br> パブリック関数 init()<br> {<br> return R("App/Common/init");<br> }<br> <br> パブリック関数 oauthRegister($wxuser)<br> {<br> return R("App/Common/oauthRegister", array($w​​xuser));<br> }<br> <br> パブリック関数index()<br> {<br> <br> $user = R("App/Public/oauthLogin");<br> <br> // $user = M("User")->where(array("uid" => session("userUid")))->find();<br> $contact = M("連絡先")->where(array("user_id" => $user["id"]))->find();<br> if ($contact) {<br> $this->assign("contact", $contact);<br> }<br> $config = M("Config")->find();<br> $this->assign("config", $config);<br> $this->assign("user", $user);<br> <br> $product = M("addonScore")->select();<br> $this->assign("product", $product);<br> $this->display();<br> }<br> <br> パブリック関数 addOrder()<br> {<br> // $user = M("User")->where(array("uid" => session("userUid")))->find();<br> $user = M("User")->where(array("id" => session("userId")))->find();<br> $score = floatval($user["score"]) - floatval($_POST["score"]);<br> If ($score >= 0) {<br> M("ユーザー")->where(array("id" => $user["id"]))->save(array("score" => $score));<br> else {<br> 戻る;<br> }<br> <br> $userHas = M("連絡先")->where(array("user_id" => session("userId")))->find();<br> if ($userHas) {<br>            $contact ["id"] = $userHas ["id"];<br>             $contact ["user_id"] = session("userId");<br>             $contact ["名前"] = $_POST ["名前"];<br>             $contact ["電話"] = $_POST ["電話"];<br>             $contact ["住所"] = $_POST ["住所"];<br>             M("連絡先")->保存($contact);<br>         } else {<br>             $contact ["user_id"] = session("userId");<br>             $contact ["名前"] = $_POST ["名前"];<br>             $contact ["city"] = "";<br>             $contact ["エリア"] = "";<br>             $contact ["電話"] = $_POST ["電話"];<br>             $contact ["住所"] = $_POST ["住所"];<br>             M("連絡先")->add($contact);<br>         }<br>         $userHas = M("連絡先")->where(array("user_id" => session("userId")))->find();<br>         $contact_id = $userHas["id"];<br> <br>         $data ["user_id"] = session("userId");<br>         $data ["contact_id"] = $contact_id;<br>         $data ["orderid"] = date("ymdhis") 。 mt_rand(1, 9);<br>         $data ["合計スコア"] = $_POST["スコア"];<br>         $data ["ステータス"] = 0;<br>         $data ["メモ"] = $_POST ["メモ"];<br>         $data ["time"] = date("Y-m-d H:i:s");<br>         $data ["score_id"] = $_POST ["id"];<br>         $result = M("AddonScoreOrder")->add($data);<br>         if ($result) {<br>             $this->ajaxReturn($result);<br>         }<br>     }<br>     public function sign(){<br>         $today = date("Y-m-d");<br>         $where["time"] = array("like", $today . "%");<br>         $where["user_id"] = session("userId");<br>         $record = D("Addons://Sign/AddonSignRecord")->where($where)->find();<br>         if ($record) {<br>             $this->ajaxReturn(array("ステータス" => 0));<br>             戻ります;<br>         }<br> <br>         $user = M("User")->where(array("id" => session("userId")))->find();<br> <br>         $count = 0;<br>         する{<br>             $count++;<br>             $yesterday = date("Y-m-d", strtotime("-$count day"));<br>             $where["time"] = array("like", $yesterday . "%");<br>            $record = D("AddonSignRecord")->where($where)->find();<br>         } while ($record);<br>         $ continue_sign = $count-1;<br> <br>         $config = M("AddonSignConfig")->find();<br>         if ($config) {<br>             $addScore = floatval($ continue_sign) * floatval($config["Continue_sign"]) + floatval($config["first_sign"]);<br>             M("AddonSignRecord")->add(array("user_id" => session("userId"), "スコア" => $addScore));<br> <br>             $score = floatval($user["score"]) + $addScore;<br>             M("ユーザー")->where(array("id" => $user["id"]))->save(array("score" => $score));<br>             $this->ajaxReturn(array("ステータス" => 1, "スコア" => $addScore));<br>         }<br>     }<br> <br> }Index_index.htmlnbsp;html><br> <br> <br>     <meta> <br>     <meta> <br>     <meta> <br>     <title>签到系统</title> <br>     <meta> <br>     <meta> <br>     <!-- apple devices fullscreen --><br>     <meta> <br>     <meta> <br>     <link> <br>     <link> <br>     <link> <br>     <link> <br>     <link> <br> <br> <br> <div> <br>     <div> <br>         <div> <br>             <div> <br>                 <div><img alt="WeMall WeChatモールチェックインプラグインのメインソースコード" ></div> <br>                 <div> <br>                     <span>{$user.ユーザー名}</span><br>                     <span>会员ID: {$user.id}</span><br>                 </div> <br>             </div> <br>             <div> <br>                 <a>积分<span>{$user.score}</span></a><br>                 <a><span><span class="btn btn-default" onclick="signIn(this)"></span>                                                                          style="color: #fff;background-color: transparent;border-color: #fff;">今日签到</span></a><br>             </div> <br>         </div> <br>     </div> <br>     <div> <br>         <div> <br>             <ul> <br>                 <volist><br>                     <li> <br>                         <div> <br>                             <div> <br>                                 <h5>{$product.name}</h5> <br>                             </div> <br>                             <div> <br>                                 <img alt="WeMall WeChatモールチェックインプラグインのメインソースコード" ><br>                             </div> <br>                             <div> <br>                                 <div>积分:<b>{$product.score}</b> </div> <br>                                 <div> <a></a>                                         onclick="doCart(this , ’{$product.score}’ , ’{$product.id}’)" style="color: black;">立即兑换<br>                                 </div> <br>                             </div> <br>                         </div> <br>                     </li> <br>                 </volist><br>             </ul> <br>         </div> <br>     </div> <br>     <div></div> <br>     <div class="tc_c2" id="join_box"></div>          style="left: 0px; bottom: 0px; z-index: 3000; position: fixed; display: none;width: 100%;"><br>         <div> <br>             <div> <br>                 <div><img alt="WeMall WeChatモールチェックインプラグインのメインソースコード" ></div> <br>             </div> <br>             <div> <br>                 <ul> <br>                     <li> <br>                         <div>姓名</div> <br>                         <div> <br>                             <input><br>                         </div> <br>                     </li> <br>                     <li> <br>                         <div>手机</div> <br>                         <div> <br>                             <input><br>                         </div> <br>                     </li> <br>                     <li> <br>                         <div>地址</div> <br>                         <div> <br>                             <input><br>                         </div> <br>                     </li> <br>                     <li> <br>                         <div>备注</div> <br>                         <div> <br>                             <input><br>                         </div> <br>                     </li> <br>                 </ul> <br>             </div> <br> <br>             <div> <br>                 <a title="返" class="fanHui" href="javascript:void(0);" onclick="_joinBox._prev()"></a>                    style="display: none;"><br> <br>                 <div> <br>                     <input id="input_submit" class="blueBtn" type="submit" value="我要报名">                            style="display: none; width: 100%;"><br>                     <a style="width: 100%;" class="blueBtn font02" href="javascript:void(0);"></a>                        onclick="submitOrder()">提交<br>                 </div> <br>             </div> <br> <br>         </div> <br>     </div> <br> <br>     <div> <br>         <div>温馨の提案</div> <br>         <div></div> <br>         <div><button>知道了</button></div> <br>         <div></div> <br>     </div> <br> <br> <br> <br> <br> <br> Admin_index.html

<section><br> <h1> <br> サインイン管理<br> <small></small><br> </h1> <br> </section><br> <!-- Main content --><br> <section><br> <div> <br> <!-- /.col --><br> <div> <br>                                                                                                                              <div> サインイン管理 管理                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     <br><div> <br><h3> サインイン設定 设                                                                                                           </h3> <br><!-- /.box-tools --><br> サインイン記録 记                                                                                                                                  </div> <br>                                                                                                                                         <div>サインイン設定>-><br> <div>                                                              onsubmit="return false;"                                                                                                                                    <!-- <h3>                                                                                                                                                                                                                                                                                                                                                                                                                                                                              初回ログインでポイントプレゼント</h3><br /> <br />                                                                                                                                                                                                                                                                                                                                    <br />                                                                                                                                                                                    </div>                                                                                                                                                         value="{$config.Continue_sign}" name="Continue_sign" type="text"><br />                                                                                                                                                                                                                                                                   <div class="form-group">                                                                                                                                                                                                                                                                                                                                                                                                                    --><br>                                                                                                                               <div>                                                                                                                                                 onclick="myFormSubmit(’{:u_addons(’Sign://Admin/Admin/index’)}’)"<br>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 <br>                                                                   <div> サインイン記録>-> <br> </div> </div> </div> </div> </div> </div> </div></section>

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。