public function isLogin() { if (!Session::get("member_uid")) { message('请登录后操作', web_url('reg/login', [], 'uc'), 'error'); } return TRUE; }
public function doWebContent() { $aid = q('get.aid', 0, 'intval'); //文章 $article = Db::table('web_article')->where('siteid', SITEID)->where('aid', $aid)->first(); if (empty($article)) { message('文章不存在', 'back', 'error'); } $article['url'] = web_url('entry/content', ['aid' => $article['aid'], 'cid' => $article['category_cid']], 'article'); //栏目 $category = Db::table('web_category')->where('cid', $article['category_cid'])->first(); $category['url'] = empty($category['cat_linkurl']) ? web_url('entry/category', ['cid' => $category['cid']], 'article') : $category['cat_linkurl']; //模板风格 $template_name = $article['template_name'] ?: $category['template_name']; if (empty($template_name)) { $template_name = Db::table('web')->where('id', $this->webid)->pluck('template_name'); if (empty($template_name)) { $template_name = Db::table('template')->where('is_default', 1)->pluck('name'); } } $path = "theme/{$template_name}/{$this->dir}"; if (is_file($path . '/article.html')) { $tpl = $path . '/article.html'; define('__TEMPLATE__', $path); } else { //模板不存在时使用默认模板 $tpl = 'theme/default/' . $this->dir . '/article.html'; define('__TEMPLATE__', "theme/default/{$this->dir}"); } View::with('hdcms', $article); View::with('category', $category); return View::make($tpl); }
function upload_image($file) { $file_name = time(); $file_name .= rand(); $ext = $file->getClientOriginalExtension(); $file->move(public_path() . "/uploads", $file_name . "." . $ext); $local_url = web_url() . "/uploads/" . $file_name . "." . $ext; return $local_url; }
public function doWebNotify() { if ($_GET['code'] == 'SUCCESS') { //模块业务处理 Db::table('balance')->where('tid', $_GET['tid'])->update(['status' => 1]); message('支付成功,系统将跳转到会员中心', web_url('entry/home'), 'success'); } else { message('支付成功,系统将跳转到会员中心', web_url('entry/home'), 'error'); } }
public function doWebSetting() { if (IS_POST) { $_POST['uid'] = Session::get('member.uid'); if (m('Member')->save()) { Util::instance('member')->updateSession(); message('修改成功', web_url('entry/home'), 'success'); } } View::with('user', Session::get('member')); View::make($this->ucenter_template . '/change_user_info.html'); }
public function wechat() { $pay = Db::table('pay')->where('tid', Session::get('pay.tid'))->first(); $data['total_fee'] = $pay['fee'] * 100; //支付金额单位分 $data['body'] = $pay['body']; //商品描述 $data['attach'] = $pay['attach']; //附加数据 $data['out_trade_no'] = $pay['tid']; //会员定单号 c('weixin.notify_url', __ROOT__ . '/index.php/wxnotifyurl/' . SITEID); c('weixin.back_url', web_url('pay/notify', Session::get('pay'), Session::get('pay.module'))); Weixin::instance('pay')->jsapi($data); }
public function doWebPost() { if (IS_POST) { //不存在默认地址时将此地址设置为默认 if (!$this->db->getMemberDefaultAddress()) { $_POST['isdefault'] = 1; } $action = empty($_POST['id']) ? 'add' : 'save'; if ($this->db->{$action}()) { message('保存地址成功', web_url('lists'), 'success'); } message($this->db->getError(), 'back', 'error'); } if ($id = q('get.id', 0, 'intval')) { View::with('field', $this->db->find($id)); } View::make($this->ucenter_template . '/address_post.html'); }
public function doWebChangeMobile() { if (IS_POST) { Validate::make([['mobile', 'required|phone', '手机号输入错误', 3]]); if (Validate::fail()) { message(Validate::getError(), 'back', 'error'); } if ($this->db->where('mobile', $_POST['mobile'])->where('uid', '<>', Session::get('member.uid'))->get()) { message('手机号已经被使用', 'back', 'error'); } $_POST['uid'] = Session::get('member.uid'); if ($d = $this->db->save()) { //更新用户session $this->db->updateUserSessionData(); message('手机号更新成功', web_url('entry/home'), 'success'); } message($this->db->getError(), 'back', 'error'); } View::make($this->ucenter_template . '/change_mobile.html'); }
<a class="btn btn-xs btn-success" href="<?php echo web_url('delete', array('name' => 'member', 'openid' => $v['openid'], 'status' => 1)); ?> " onclick="return confirm('确定要恢复该账户吗?');"><i class="icon-edit"></i>恢复账户</a> <?php } ?> <a class="btn btn-xs btn-info" href="<?php echo web_url('detail', array('name' => 'member', 'openid' => $v['openid'])); ?> "><i class="icon-edit"></i>账户编辑</a> <br/><br/> <a class="btn btn-xs btn-info" href="<?php echo web_url('recharge', array('name' => 'member', 'openid' => $v['openid'], 'op' => 'credit')); ?> "><i class="icon-edit"></i>积分管理</a> <a class="btn btn-xs btn-info" href="<?php echo web_url('recharge', array('name' => 'member', 'openid' => $v['openid'], 'op' => 'gold')); ?> "><i class="icon-edit"></i>余额管理</a> </td> </tr> <?php } } ?> </tbody> </table> <?php echo $pager; include page('footer');
public function providerForgotPassword() { $email = Input::get('email'); $walker = Walker::where('email', $email)->first(); if ($walker) { $new_password = time(); $new_password .= rand(); $new_password = sha1($new_password); $new_password = substr($new_password, 0, 8); $walker->password = Hash::make($new_password); $walker->save(); // send email /* $subject = "Your New Password"; $email_data = array(); $email_data['password'] = $new_password; send_email($walker->id, 'walker', $email_data, $subject, 'forgotpassword'); */ $settings = Settings::where('key', 'admin_email_address')->first(); $admin_email = $settings->value; $login_url = web_url() . "/provider/signin"; $pattern = array('name' => ucwords($walker->first_name . " " . $walker->last_name), 'admin_eamil' => $admin_email, 'new_password' => $new_password, 'login_url' => $login_url); $subject = "Your New Password"; email_notification($walker->id, 'walker', $pattern, $subject, 'forgot_password', 'imp'); // echo $pattern; return Redirect::to('provider/signin')->with('success', 'password reseted successfully. Please check your inbox for new password.'); } else { return Redirect::to('provider/signin')->with('error', 'This email ID is not registered with us'); } }
<?php $sidebardata = array(array('name' => '管理', 'style' => 'alert-info', 'data' => array(array('icon' => '', 'url' => web_url("/database/room"), 'text' => '房間管理')))); echo sidebar($sidebardata, $active);
<img src="<?php echo WEBSITE_ROOT; ?> addons/addon10/pic/8.png"> <span></span> </a> </div> <div class="item-bottom s-bg-fff" style=""> <div class="tit"> <h4 ><a href="<?php echo web_url('scene', array('op' => 'preview', 'theme' => 'hammer')); ?> ">锤子手机</a></h4> <p data-author=""><a href="javascript:void(0)"></a></p> <span class="css_sprite s-bg-qr_icon icon-qr"></span> </div> <div class="con"> <strong class="f-tr" ><a href="<?php echo web_url('scene', array('op' => 'preview', 'theme' => 'hammer')); ?> " style="color:green" >模板预览</a></strong> </div> </div> </div> </div> </div> <div class="f-clear"></div> </div> <?php include page('footer');
<?php $sidebardata = array(array( 'name'=>'', 'style'=>'alert-info', 'data'=>array( // array('icon'=>'','url'=>web_url("/database/dorm"),'text'=>'宿舍管理'), array('icon'=>'','url'=>web_url("/site/index"),'text'=>'據點清單'), // array('icon'=>'','url'=>web_url("/database/room"),'text'=>'據點狀態'), // array('icon'=>'','url'=>web_url("/database/electronum"),'text'=>'電表管理'), ) ), ); echo sidebar($sidebardata, $active); ?>
<h2>列印</h2> <hr> <br> <h2>資料查看</h2> <hr> <div class="btn-group"> <a class="btn btn-default" href="" id="href_contract">查看合約</a> </div> </div> <div class="col-md-8" > <div class="well" style="width:100%;"> <h2>列印預覽</h2> <hr> <iframe id="printFrame" src="<?php echo web_url('/contract/pdf_gen'); ?> " style="width:100%;height:630px"></iframe> </div> </div> </div> </div> </div> <?php if (!is_null($keep)) { $keep_result[0][0] = (new DateTime($keep_result[0]['e_date']))->modify('+1 day')->format('Y-m-d'); $keep_result[0][1] = (new DateTime($keep_result[0]['out_date']))->modify('+1 day')->format('Y-m-d'); } ?> <a class="btn" id="keepbtn" onclick=" <?php
baidu_map(); <?php } ?> } }); }); KindEditor.ready(function(K){ var editor = KindEditor.editorObj || K.editor({ themeType: 'simple', allowImageUpload:false, formatUploadUrl:false, allowFileManager: false, uploadJson : "<?php echo web_url('newkeupload'); ?> " }); $('.select_img').click(function(e){ editor.loadPlugin('image', function(){ editor.plugin.imageDialog({ imageUrl: $(e.target).parent().prev().val(), clickFn: function(url, title, width, height, border, align){ var val = url; if(url.toLowerCase().indexOf("http://") == -1 && url.toLowerCase().indexOf("https://") == -1) { var filename = /images(.*)/.exec(url); if(filename && filename[0]) { val = filename[0]; }
?> /website/js/bootstrap.min.js"></script> <script> $(document).ready(function () { var datas; setInterval(function () { var url = $("#trackURL").attr("href"); ; var formdata = ''; $.ajax(url, { data: formdata, type: "GET", success: function (response) { var at = "<?php echo web_url(); ?> "; if (response.success) { $("#tit").html(response.titl); $("#log").attr("src", at + response.logo); initialize(response.cur_lat, response.cur_lon, response.prev_lat, response.prev_lon); } else { console.log("Something went wrong!!"); } google.maps.event.addDomListener(window, 'load', initialize); } });
<tr> <td width="260" align="right"><strong>登录帐号:</strong></td> <td><input name="adminname" type="text" id="adminname" class="textipt" value="admin" style="width:150px" /></td> </tr> <tr> <td align="right"><strong>登录密码:</strong></td> <td><input name="adminpwd" type="text" class="textipt" value="" style="width:150px" /></td> </tr> <tr> <td colspan="2" align="right"> <div class="butbox boxcenter"> <input name="doact" type="hidden" value="install" /> <input type="button" class="backbut" value="" onclick="window.location.href='<?php echo web_url("install", array("name" => "public", "op" => "setp2")); ?> ';" style="margin-right:20px" /> <input name="submit" type="submit" class="setupbut" value="" /> </div></td> </tr> </table> </form> <?php } ?> </body> </html>
<?php if (checksubmit("submit")) { $insert = array('title' => $_GP['title'], 'amount' => intval($_GP['amount']), 'endtime' => strtotime($_GP['endtime']), 'price' => $_GP['price'], 'gold' => $_GP['gold'], 'awardtype' => intval($_GP['awardtype']), 'credit_cost' => intval($_GP['credit_cost']), 'createtime' => time(), "deleted" => 0, 'content' => htmlspecialchars_decode($_GP['content'])); if (!empty($_FILES['logo']['tmp_name'])) { $upload = file_upload($_FILES['logo']); if (is_error($upload)) { message($upload['message'], '', 'error'); } $logo = $upload['path']; } if (!empty($logo)) { $insert['logo'] = $logo; } mysqld_insert('addon7_award', $insert); message('保存成功', web_url('awardlist'), 'success'); } include addons_page('award');
public function update_list() { $list_id = Request::segment(3); $list = Lists::find($list_id); $list->name = Input::get('name'); $list->description = Input::get('description'); $list->direction = Input::get('direction'); $image = Input::file('background_image'); $validator = Validator::make(array('ima' => $image), array('ima' => 'required|mimes:jpeg,bmp,png,jpg')); if ($validator->fails()) { $error_messages = $validator->messages(); $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401); $response_code = 200; $message = "Invalid Input File"; $type = "failed"; return Redirect::to('/list/edit/' . $list_id)->with('type', $type)->with('message', $message); } else { if (Input::hasFile('background_image')) { $extension = Input::file('background_image')->getClientOriginalExtension(); $fileName = time() . "." . $extension; $destinationPath = public_path() . "/uploads/"; Input::file('background_image')->move($destinationPath, $fileName); $list->background_image_url = web_url() . "/uploads/" . $fileName; } $list->save(); $products = Input::get('products'); ListProduct::where('list_id', $list_id)->delete(); if ($products) { foreach ($products as $key => $value) { $list_product = new ListProduct(); $list_product->list_id = $list_id; $list_product->product_id = $key; $product_temp = Product::find($key); if ($product_temp) { $list_product->store_id = $product_temp->store_id; } else { $list_product->store_id = 0; } $list_product->quantity = $value; $list_product->sort_order = 0; $list_product->save(); } } // Redirect return Redirect::to('/list/edit/' . $list_id); } }
function js_section() { ?> <script type="text/javascript"> // 學生資料 function room_suggestion(keeproom){ var dorm = document.getElementById("dorm_select").value; var data = "dorm_id=" + dorm; post('/utility/room_suggestion', data, callback, 0); function callback(data){ if (data.state==true) { var data = data.result; var htmltext = "<option class='form-control'>請選擇...</option>"; for (var i = data.length - 1; i >= 0; i--) { htmltext += "<option class='form-control' value='"+data[i].room_id+"'>"+data[i].name+"</option>"; }; document.getElementById("room_select").innerHTML = htmltext; document.getElementById("room_select").focus(); if (typeof(keeproom)!=='undefined') { //for keep room document.getElementById('room_select').value = keeproom; }; }else{ errormsg("傳輸出現問題"+xhr.responseText); } } } function get_rent_cal(){ var rpm = $('#rent').val(); var s_date = $('#datepickerStart').val(); var e_date = $('#datepickerEnd').val(); var countpeo = $('input[name*="stu_id[]"]').length; if (checkSE()) { var data = 'rpm='+rpm+'&s_date='+s_date+'&e_date='+e_date+'&countpeo='+countpeo; post('/contract/get_rent_cal', data, callback, 0) function callback(data){ if (data!==false) { $('#total_days').html(data.date_result.td); $('#total_peo').html(countpeo); $('#mib').html(data.date_result.mib); $('#ROD').html(data.date_result.rod); $('#mib_rent').html(data.rent_result.mib_rent); $('#ROD_rent').html(data.rent_result.ROD_rent); $('#total_rent').html(data.rent_result.total_rent); $('#final_tr').html(data.rent_result.total_rent); } } } } function checkSE(){ var s_date = $('#datepickerStart').val(); var e_date = $('#datepickerEnd').val(); if (s_date!==''&&e_date!=='') { if (date_diff(s_date, e_date)<=0) { errormsg('合約日期錯誤'); $('#final_sd').html('合約日期錯誤'); $('#final_ed').html('合約日期錯誤'); $('#final_tr').html('合約日期錯誤'); return false; }else{ $('#final_sd').html($('#datepickerStart').val()); $('#final_ed').html($('#datepickerEnd').val()); return true; } }else{ $('#final_sd').html('合約日期未填'); $('#final_ed').html('合約日期未填'); $('#final_tr').html('合約日期未填'); return false; } } function checkInOut(){ var s_date = $('#datepickerIn').val(); var e_date = $('#datepickerOut').val(); if (s_date!==''&&e_date!=='') { if (date_diff(s_date, e_date)<=0) { errormsg('遷入遷出日期錯誤'); return false; }else{ return true; } }else{ return false; } } function date_diff(s_date, e_date){ var start = new Date(s_date); var end = new Date(e_date); return (end-start)/86400000; } function submitreservation(){ var new_sname = $('#new_sname').val() var new_mobile = $('#new_mobile').val() var dorm_select = $('#dorm_select').val() var room_select = $('#room_select').val() var d_date = $('#d_date').val() var sales = $('#sales').val() var note = $('#note').val() var datepickerStart = $('#datepickerStart').val() var datepickerEnd = $('#datepickerEnd').val() var res_deposit = $('#res_deposit').val(); var status = 1; if (new_sname == '') { status = 0; errormsg('姓名未填'); }else if (new_mobile == '') { status = 0; errormsg('電話未填'); }else if (dorm_select == '') { status = 0; errormsg('宿舍未填'); }else if (room_select == '') { status = 0; errormsg('房間未填'); }else if (d_date == '') { status = 0; errormsg('有效期限沒填'); }else if (res_deposit == '') { status = 0; errormsg('訂金沒填'); } if (status == 1) { var data = "res_deposit="+res_deposit+"&new_sname="+new_sname+"&new_mobile="+new_mobile+"&dorm_select="+dorm_select+"&room_select="+room_select+"&d_date="+d_date+"&sales="+sales+"¬e="+note+"&datepickerStart="+datepickerStart+"&datepickerEnd="+datepickerEnd; post('/reservation/submit_reservation', data, callback, 0); function callback(data){ if (data.state == 1) { var r_id = data.id; final_check(r_id); checkOK(); }else{ errormsg('儲存失敗,再試一次') } } } } function checknotoverlap(){ var s_date = $('#datepickerStart').val(); var e_date = $('#datepickerEnd').val(); var room_id = $('#room_select').val(); var status = 1; if (s_date == ''||typeof s_date=='undefined') { status = 0; errormsg('開始日期未填'); }else if (e_date == ''||typeof e_date=='undefined') { status = 0; errormsg('結束日期未填'); } if (room_id!==''&&room_id!==null&&room_id!==0&&status==1) { var data = 's_date='+s_date+'&e_date='+e_date+'&room_id='+room_id; post('/contract/check_not_over_lap', data, callback, 0); function callback(data){ if (data.state ===true) { submitreservation(); }else if(data.state ===false){ $('#over_lap_dorm').html(data.result[0].dname); $('#over_lap_room').html(data.result[0].rname); $('#over_lap_list').html(''); for (var i = 0;i < data.result.length; i++) { datum = data.result[i]; $('#over_lap_list').append('<tr><td>'+(i+1)+'</td><td>'+((datum.source=='res')?'預定單':((datum.source=='con')?'合約':''))+'</td><td>'+datum.sname+'</td><td>'+datum.mobile+'</td><td>'+datum.s_date+'</td><td>'+datum.e_date+'</td><td>'+datum.in_date+'</td><td>'+datum.out_date+'</td></tr>') }; $('#overlapModal').modal('toggle'); recheck(); }else if(data.state ===-1){ errormsg('房間日期資料輸入不完整或格式錯誤'); recheck(); } } }else{ errormsg('房號、遷入、遷出日期請填寫完整'); } } function checkOK(){ $('#btncheck').html('送出'); $('#btncheck').attr('class','btn btn-success btn-lg'); $('#InOutcheck').attr('class', 'glyphicon glyphicon-ok-circle'); $('#final_id').html($('#datepickerIn').val()); $('#final_od').html($('#datepickerOut').val()); $('#checkInOutval').val(1); $('#btncheck').attr('disabled', true); } function recheck(){ $('#btncheck').attr('disabled', false); $('#btncheck').html('送出'); $('#btncheck').attr('class','btn btn-primary btn-lg'); $('#InOutcheck').attr('class', ''); $('#final_id').html('檢查未通過'); $('#final_od').html('檢查未通過'); $('#checkInOutval').val(0); } // final check function final_check(r_id){ $('#tab_print').attr('data-toggle','tab'); $('#tab_print').attr('onclick',''); $('#tab_print').trigger('click'); $('#printFrame').attr('src', '<?php echo web_url("/reservation/pdf_gen"); ?> ?r_id='+r_id); } $( '#datepickerStart' ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, onClose: function( selectedDate ) { $( "#datepickerEnd" ).datepicker( "option", "minDate", selectedDate ); }}); $( '#datepickerEnd' ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, onClose: function( selectedDate ) { $( "#datepickStart" ).datepicker( "option", "maxDate", selectedDate ); }}); $( '#datepickerIn' ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true,changeYear: true, onClose: function( selectedDate ) { $( "#datepickerOut" ).datepicker( "option", "minDate", selectedDate ); }}); $( '#datepickerOut' ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true,changeYear: true, onClose: function( selectedDate ) { $( "#datepickerIn" ).datepicker( "option", "maxDate", selectedDate ); }}); $( '#new_rent_date' ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true,changeYear: true}); $( '#d_date' ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true,changeYear: true}); </script> <?php }
$data = $_GP['tenth']; } if (!empty($data)) { $insert['param'] = serialize($data); } else { $insert['param'] = ''; } if ($item == false) { $temp = mysqld_insert('addon10_scene_page', $insert); } else { $temp = mysqld_update('addon10_scene_page', $insert, array('id' => $item['id'])); } if ($temp == false) { $this->ajaxmessage('数据提交失败'); } else { $this->ajaxmessage('数据提交成功', web_url('scene_page', array('listid' => $list_id, 'op' => 'display')), 'success'); } } $uploadfolder = WEB_ROOT . '/attachment/image/addon10/'; mkdirs($uploadfolder); $tmpfoldername = random(15); copy(ADDONS_ROOT . 'addon10/style/img/default_bg.jpg', $uploadfolder . $tmpfoldername . 'jpg'); $tmpfoldername2 = random(15); copy(ADDONS_ROOT . 'addon10/style/img/default_btn.png', $uploadfolder . $tmpfoldername2 . 'png'); if ($item == false) { $item = array('listorder' => 0, 'thumb' => 'image/addon10/' . $tmpfoldername . 'jpg'); $data = array(); } else { $data = $this->iunserializer($item['param']); } if (empty($data['btnimg'])) {
if (!empty($item['iscommend'])) { ?> <label data="1" class="label label-info">推荐</label><?php } ?> </td> <td class="text-center"> <input readonly="readlony" type="text" class="col-sm-10" value="<?php echo WEBSITE_ROOT; echo create_url('mobile', array('name' => 'addon8', 'do' => 'article', 'id' => $item['id'])); ?> " /> </td> <td class="text-center"> <a class="btn btn-xs btn-info" href="<?php echo web_url('article', array('op' => 'post', 'id' => $item['id'])); ?> "><i class="icon-edit"></i> 修 改 </a> <a class="btn btn-xs btn-info" onclick="return confirm('此操作不可恢复,确认删除?');return false;" href="<?php echo web_url('article', array('op' => 'delete', 'id' => $item['id'])); ?> "><i class="icon-edit"></i> 删 除 </a> </td> </td> </tr> <?php } } ?> </table> <?php include page('footer');
<td class="text-center"><?php echo $item['tname']; ?> </td> <td class="text-center"><?php echo $item['url']; ?> </td> <td class="text-center"><?php echo $item['torder']; ?> </td> <td class="text-center"> <a class="btn btn-xs btn-info" href="<?php echo web_url('fansindex_menu', array('op' => 'post', 'id' => $item['id'])); ?> "><i class="icon-edit"></i> 修 改 </a> <a class="btn btn-xs btn-info" onclick="return confirm('此操作不可恢复,确认删除?');return false;" href="<?php echo web_url('fansindex_menu', array('op' => 'delete', 'id' => $item['id'])); ?> "><i class="icon-edit"></i> 删 除 </a> </td> </td> </tr> <?php } } ?> </table> <?php include page('footer');
} if (!empty($parentid)) { $parent = mysqld_select("SELECT id, name FROM " . table('addon8_article_category') . " WHERE id = '{$parentid}'"); if (empty($parent)) { message('抱歉,上级分类不存在或是已经被删除!', web_url('post'), 'error'); } } if (checksubmit('submit')) { if (empty($_GP['catename'])) { message('抱歉,请输入分类名称!'); } $data = array('name' => $_GP['catename'], 'deleted' => 0, 'displayorder' => intval($_GP['displayorder']), 'icon' => $_GP['icon'], 'parentid' => intval($parentid)); if (!empty($id)) { unset($data['parentid']); mysqld_update('addon8_article_category', $data, array('id' => $id)); } else { mysqld_insert('addon8_article_category', $data); $id = mysqld_insertid(); } message('更新分类成功!', web_url('category', array('op' => 'display')), 'success'); } include addons_page('category'); } elseif ($operation == 'delete') { $id = intval($_GP['id']); $category = mysqld_select("SELECT id, parentid FROM " . table('addon8_article_category') . " WHERE id = '{$id}' and deleted=0 "); if (empty($category)) { message('抱歉,分类不存在或是已经被删除!', web_url('category', array('op' => 'display')), 'error'); } mysqld_update('addon8_article_category', array('deleted' => 1), array('id' => $id, 'parentid' => $id), 'OR'); message('分类删除成功!', web_url('category', array('op' => 'display')), 'success'); }
function js_section() { ?> <script type="text/javascript"> // for contractlist function printmodel(){ contract_id = $('#contract_id').val(); $('#print_iframe').attr('src', '<?php echo web_url("/contract/pdf_gen?contract_id="); ?> '+contract_id); $('#printModal').modal('toggle'); } table_refresh(); function remove_str_date(){ $("#txtSetStartday").val(''); table_refresh(); } function remove_end_date(){ $("#txtSetendday").val(''); table_refresh(); } // 關鍵字搜尋 function pagemove(page){ } function keyword_serach(){ pagemove(0); table_refresh(); } // 限制開始結束時間 function set_start(){ pagemove(0); table_refresh(); } function set_end(){ pagemove(0); table_refresh(); } // 宿舍選擇 function dorm_select(dorm_id, dorm_name){ $('#lbldorm').html(dorm_name); $('#dorm_select_value').val(dorm_id); pagemove(0); table_refresh(); } // 更新想式的數量 function table_refresh(){ var keyword = $('#txtkeyword').val(); var dorm = $('#dorm_select_value').val(); var start_value = $('#txtSetStartday').val(); var end_value = $('#txtSetendday').val(); $('#txtkeyword').focus(); // 傳送 var data = "keyword=" + keyword+"&dorm="+dorm+"&startval="+start_value+"&endval="+end_value; post('/roomengine/show_handover_list', data, callback, 0) function callback(data) { if (data.status===false) { }else{ tableparse(data); } } } function tableparse(data){ // var page = $('#page_value').val(); $('#result_table_head').html('<td colspan="3">房間資訊</td>'); $('#result_table_date_head').html('<th>#</th><th>宿舍</th><th>房號</th>'); for (var i = 0; i < data.index.length; i++) { $('#result_table_head').append('<th colspan="4">'+data.index[i]+'</th>'); $('#result_table_date_head').append('<th>姓名</th><th style="width:5%">合約</th><th>打掃</th><th>備註</th>') } $('#result_table').html(''); for (var i = 0; i < data.data.length; i++) { var classrule = ""; var state = 0; var row_txt = ''; row_txt += '<tr>'; row_txt += '<td>'+(i+1)+'</td><td>'+data.data[i][0]+'</td><td>'+data.data[i][1]+'</td>'; for (var j = 0; j < data.index.length; j++) { var text = ''; if (data.data[i][2+6*j+2]>1) { text = '等'+data.data[i][2+6*j+2]+'人'; }; var stylerule = ''; stylerule = (data.data[i][2+6*j+3]=='in')?'class="info"':((data.data[i][2+6*j+3]=='out')?'class="warning"':""); row_txt += '<td '+stylerule+'>'+((data.data[i][2+6*j+1]==null)?"":(data.data[i][2+6*j+1])+text)+'</td>'; row_txt += '<td '+stylerule+'>'+((data.data[i][2+6*j+0]==null)?"":'<a id="href_list_'+data.data[i][2+ 6*j+0]+'" onclick="showcontract('+data.data[i][2+6*j+0]+')"><span class="glyphicon glyphicon-file"></span></a>')+'</td>' row_txt += '<td '+stylerule+'>'+((data.data[i][2+6*j+4]==null)?"":data.data[i][2+6*j+4])+'</td>'; row_txt += '<td '+stylerule+'>'+((data.data[i][2+6*j+5]==null)?"":data.data[i][2+6*j+5])+'</td>'; } row_txt += '</tr>'; $('#result_table').append(row_txt); }; if (data.length<30) { $('#page_up').attr( "disabled", true ); }else{ $('#page_up').attr( "disabled", false ); } } // for 詳細合約資料 // AJAX產生合約資料 function showcontract(contract_id){ $('#viewModal').modal('toggle'); var data = "contract_id=" + contract_id; function callback(data) { document.getElementById('view_stu_info').innerHTML = ''; for (var i = 0; i < data.length; i++) { datum = data[i]; var stu_url = "<?php echo web_url('/student/index'); ?> "; document.getElementById('view_stu_info').innerHTML+='<tr>' +'<td style="width:15%" align="right" >'+((i==0)?'立約人':'')+'</td>' +'<td>' +' <div class="row">' +' <div class="col-md-4"><input class="form-control" disabled required="required" style="width:100%" type="text" name="stu[]" value="'+datum.sname+'"></div>' +' <div class="col-md-4"><input class="form-control" disabled required="required" style="width:100%" type="text" name="stu[]" value="'+datum.mobile+'"></div>' +' <div class="col-md-2"><a title="學生資料" href="'+stu_url+'?view='+datum.stu_id+'" class="btn btn-default" style="width:100%"><span class="glyphicon glyphicon-user"></span></a></div>' +' <div class="col-md-2"><a title="寄簡訊" id="view_sms_'+i+'" class="btn btn-default" style="width:100%"><span class="glyphicon glyphicon-comment"></span></a></div>' +' </div>' +'</td>' +'<input type="hidden" name="contract[]" value="'+datum.contract_id+'">' +'</tr>'; $('#view_sms_'+i).attr('onclick','sendsms("'+datum.sname+'同學你好,", "'+datum.mobile+'")') }; var datum = data[0]; document.getElementById('view_dorm_href').href = 'dorm.php?view='+datum.dorm_id; document.getElementById('view_dorm').value = datum.dname; document.getElementById('view_room').value = datum.rname; document.getElementById('view_room_href').href = 'room.php?view='+datum.room_id; document.getElementById('view_s_date').value = datum.s_date; document.getElementById('view_e_date').value = datum.e_date; document.getElementById('view_in_date').value = datum.in_date; document.getElementById('view_out_date').value = datum.out_date; document.getElementById('view_c_date').value = datum.c_date; document.getElementById('view_rent').value = datum.rent; document.getElementById('view_sales').value = datum.sales; document.getElementById('view_manager').value = datum.mname; document.getElementById('view_note').value = datum.note; document.getElementById('room_id').value = datum.room_id; document.getElementById('view_change_btn').setAttribute('data-cnum',datum.contract_id); document.getElementById('contract_id').value = datum.contract_id; //document.getElementById("room_select").innerHTML = xhr.responseText; show_rent_detail(contract_id); show_pay_rent_detail(contract_id); refresh_payment_status(contract_id) } post('/contract/show_contract', data, callback, 0) } // 檢查遷入遷出日期 function check_room(){ $('#edit_btn').attr( "disabled", true ); document.getElementById('view_out_date_check').className = "glyphicon glyphicon-refresh"; document.getElementById('view_in_date_check').className = "glyphicon glyphicon-refresh"; var in_date = $('#view_in_date').val(); var out_date = $('#view_out_date').val(); var room_id = $('#room_id').val(); var contract_id = $('#contract_id').val(); var data = "room_id=" + room_id+"&in_date=" + in_date+"&out_date=" + out_date + '&contract_id='+contract_id; function callback(data){ if (data == true) { $('#edit_btn').attr( "disabled", false ); document.getElementById('view_out_date_check').className = "glyphicon glyphicon-ok"; document.getElementById('view_in_date_check').className = "glyphicon glyphicon-ok"; }else{ document.getElementById('view_out_date_check').className = "glyphicon glyphicon-remove"; document.getElementById('view_in_date_check').className = "glyphicon glyphicon-remove"; } } post('/contract/date_check_by_room', data, callback, 0) } // 提示表單有變更 function change_alert(){ var $btn = $('#edit_btn'); $btn.html("未儲存"); // $('#edit_btn').addClass('active'); // alert($('#edit_btn').attr('class')); // $('#edit_btn').attr('class', 'btn btn-warning btn-lg'); // $('#edit_btn').html('未儲存'); // alert($('#edit_btn').html()); } // 修改合約資料 function editcontract(){ var contract_id = $('#contract_id').val(); var in_date = $('#view_in_date').val(); var out_date = $('#view_out_date').val(); var sales = $('#view_sales').val(); var note = $('#view_note').val(); var data = "contract_id=" + contract_id+"&in_date="+in_date+"&out_date="+out_date+"&sales="+sales+"¬e="+note; post('/contract/edit', data, callback, 0) function callback(data){ if (data===true) { document.getElementById('edit_btn').className = 'btn btn-info btn-lg'; document.getElementById('edit_btn').innerHTML = '已儲存'; // 更新表格裡的資訊 table_refresh(); } } } // 詳細資料裡的日期選擇 $('#view_in_date').datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true,changeYear: true}); $('#view_out_date').datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true,changeYear: true}); $('#new_rent_date').datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true,changeYear: true}); $('#new_pay_rent_date').datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true,changeYear: true}); $('#txtSetStartday').datepicker( { dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, numberOfMonths: 2, onClose: function( selectedDate ) { $( "#txtSetendday" ).datepicker( "option", "minDate", selectedDate ); } }); $('#txtSetendday').datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, numberOfMonths: 2, onClose: function( selectedDate ) { $( "#txtSetStartday" ).datepicker( "option", "maxDate", selectedDate ); }}); // 合約終止 dialogbreak = $( "#dialog-breakcontracr" ).dialog({ autoOpen: false, width: 600, modal: true, resizable: false, dialogClass: "alert", buttons: { "原合約終止後續約":breaknkeep, "原合約終止": breakonly, "刪除此合約":delete_confirm, "取消": function() { dialogbreak.dialog( "close" ); } }, close: function() { } }); // $( "#view_change_btn" ).on( "click", function() { $(document).ready(function() { $('#viewModal').modal('toggle'); $('body').removeClass('modal-open'); $('.modal-backdrop').remove(); }); var element = $( this ); if ( element.is( "[data-cnum]" ) ) { var contract_id = element.attr('data-cnum'); getbcontract(contract_id); $('#bcontract_id').val(contract_id); } dialogbreak.dialog( "open" ); }); function delete_confirm(){ if (confirm("確定要刪除?")) { var contract_id = $('#bcontract_id').val(); var data = "contract_id=" + contract_id; post('/contract/delete_contract', data, callback, 0) function callback(data){ if (data==true) { successmsg("刪除成功"); table_refresh(); dialogbreak.dialog( "close" ); }else{ errormsg("發生問題,在試一次"); dialogbreak.dialog( "close" ); } } } } function getbcontract(contract_id){ var data = "contract_id=" + contract_id; post('/contract/show_contract', data, callback, 0) function callback(data){ document.getElementById("break_stu_info").innerHTML = ''; for (var i = data.length - 1; i >= 0; i--) { document.getElementById("break_stu_info").innerHTML += '<tr><td>'+data[i].sname+'</td><td>'+data[i].mobile+'</td><td>'+data[i].id_num+'</td></tr>'; }; document.getElementById("break_contract_info").innerHTML = '<tr><td>'+data[0].dname+'</td><td>'+data[0].rname+'</td><td>'+data.length+'</td><td>'+data[0].s_date+'</td><td>'+data[0].e_date+'</td></tr>'+"<input type='hidden' name='bs_date' id='bs_date' value='"+data[0].s_date+"'>"+"<input type='hidden' name='be_date' id='be_date' value='"+data[0].e_date+"'>"; } } function breakcontract(contract_id,b_date,wtdo){ var data = "contract_id=" + contract_id+"&b_date=" + b_date; post('/contract/break_contract', data, callback, 0) function callback(data){ if (data===true) { $('#dialog-breakcontracr').dialog( "close" ); if (wtdo) { $('#keep_bcontract_id').val(contract_id); $('#keep_b_date').val(b_date); $('#bkeepalert').html('接下來進行續約'); $('#bkeepalert').css('display','inline'); } $('#dialog-update-done').dialog( "open" ); }else{ $('#dialog-update-failed').dialog( "open" ); } } } function breaknkeep () { var contract_id = $('#bcontract_id').val(); var b_date = $('#bdate').val(); if(checkdate(bdate)){ $('#bstate').html(''); breakcontract(contract_id,b_date,1); }else{ $('#bstate').html('中止日期須在原合約日期內'); } } function breakonly () { var contract_id = $('#bcontract_id').val(); var b_date = $('#bdate').val(); if(checkdate(b_date)){ $('#bstate').html(''); breakcontract(contract_id,b_date,0); }else{ $('#bstate').html('中止日期須在原合約日期內'); } } function checkdate () { var bs_date = Date.parse($('#bs_date').val()); var be_date = Date.parse($('#be_date').val()); var b_date = Date.parse($('#bdate').val()); if (be_date-b_date>0&&bs_date-b_date<0) { return 1; }else{ return 0; } } dialogbreakfailed = $( "#dialog-update-failed" ).dialog({ autoOpen: false, modal: true, resizable: false, dialogClass: "alert", buttons: { '確定': function() { $( this ).dialog( "close" ); location.reload(); } } }); dialogbreakdone = $( "#dialog-update-done" ).dialog({ autoOpen: false, modal: true, width: "50%", resizable: false, dialogClass: "alert", buttons: { '確定': function() { $( this ).dialog( "close" ); var contract_id = $('#keep_bcontract_id').val(); if (contract_id=='0') { var contract_id = $('#bcontract_id').val(); table_refresh(); showcontract(contract_id); }else{ var b_date = $('#keep_b_date').val(); var tomorrow = new Date(Date.parse(b_date)); tomorrow.setDate(tomorrow.getDate()+1); window.location.assign('<?php echo web_url("/contract/newcontract"); ?> ?keep='+contract_id); } } } }); // 合約終止 日期選擇 $('#bdate').datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true,changeYear: true}); function resetpaymodal(){ $('#new_pay_rent_value').val(''); $('#new_pay_rent_from').val(''); $('#new_pay_rent_date').val(''); // $('#new_pay_rent_r_id').val(''); $('#new_pay_rent_description').val(''); } // 結算 // 檢查可否結算 function checkout_check(){ var out_date = Date.parse($('#view_out_date').val()+' 00:00:00'); var today = new Date(); if (Math.round((today - out_date)/1000000)<0) { errormsg('學生尚未退房!!!若提早退房請先修改遷出時間'); }else{ $('#dialog-check-out-comfirm').dialog( "open" ); $('#ccontract_id').val($('#contract_id').val()); $(document).ready(function() { $('#viewModal').modal('toggle'); $('body').removeClass('modal-open'); $('.modal-backdrop').remove(); }); } } // 確認結算 dialogbreakdone = $( "#dialog-check-out-comfirm" ).dialog({ autoOpen: false, modal: true, width: "50%", resizable: false, dialogClass: "alert", buttons: { '確定結算': function() { $( this ).dialog( "close" ); var contract_id = $('#ccontract_id').val(); checkout_contract(contract_id); }, '取消': function(){ $( this ).dialog( "close" ); } } }); dialogbreakdone = $( "#dialog-universal-alert" ).dialog({ autoOpen: false, modal: true, width: "30%", resizable: false, dialogClass: "alert", buttons: { '確定': function() { $( this ).dialog( "close" ); } } }); // 結算 function checkout_contract(contract_id){ var data = "contract_id=" + contract_id; post('/contract/checkout_contract', data, callback, 0) function callback(data){ // alert(xhr.responseText); table_refresh(); if (data === true ) { $('#dialog-universal-alert').html('<div class="alert alert-success"><h2><span class="glyphicon glyphicon-ok"></span>成功!!!</h2></div>') $('#dialog-universal-alert').dialog( "open" ); } } } // 續約 // 檢查可否續約 function keep_check(){ $('#dialog-keep-comfirm').dialog( "open" ); $('#kcontract_id').val($('#contract_id').val()); $(document).ready(function() { $('#viewModal').modal('toggle'); $('body').removeClass('modal-open'); $('.modal-backdrop').remove(); }); } dialogbreakdone = $( "#dialog-keep-comfirm" ).dialog({ autoOpen: false, modal: true, width: "50%", resizable: false, dialogClass: "alert", buttons: { '確定續約': function() { $( this ).dialog( "close" ); var contract_id = $('#kcontract_id').val(); keep_contract(contract_id); }, '取消': function(){ $( this ).dialog( "close" ); } } }); function keep_contract(contract_id){ // 傳送 var data = "contract_id=" + contract_id; post('/contract/keep_contract_check', data, callback, 0) function callback(data){ if (data===true) { window.location = "<?php echo web_url('/contract/newcontract'); ?> ?keep="+contract_id; }else{ errormsg('續約時發生錯誤,可能是尚未在合約結束前三個月。'); } } } // 租金 function show_rent_detail(contract_id){ // 傳送 var data = "contract_id=" + contract_id; post('/accounting/show_rent_detail', data, callback, 0) function callback(data){ $('#rent_detail').html(''); if (data.state===true) { for (var i = 0; i < data.data.length; i++) { var datum = data.data[i]; switch(datum.type){ case '1': datum.typename = '租金'; break; case '2': datum.typename = '額外'; break; case '3': datum.typename = '獎學金'; break; case '4': datum.typename = '其他+'; break; case '5': datum.typename = '其他-'; break; default: datum.typename = ''; } $('#rent_detail').append('<tr><td>'+(i+1)+'</td><td>'+datum.typename+'</td><td>'+((datum.pm==1)?'<span class="glyphicon glyphicon-plus"></span>':'<span class="glyphicon glyphicon-minus"></span>')+'</td><td>'+datum.value+'</td><td>'+datum.description+'</td><td>'+datum.date+'</td></tr>'); }; $('#rent_total').html(data.sum); $('#rent_total_2').html(data.sum); } } } function submit_new_rent(){ var type = $('#new_rent_type_select').val(); var value = parseInt($('#new_rent_value').val()); var date = $('#new_rent_date').val(); var description = $('#new_rent_description').val(); var contract_id = $('#contract_id').val(); var state = 1; if ((type==4||type==5)&&description=='') { errormsg('選擇"其他"請輸入描述或備註'); state = 0; }; if (date=='') { errormsg('請輸入日期'); state = 0; }; if (!Number.isInteger(value)||value<=0||value=='') { errormsg('請輸入正整數金額'); state = 0; } if (type=='') { errormsg('請選擇類別'); state = 0; }; // 傳送 if (state == 1) { var data = "contract_id=" + contract_id+'&type='+type+'&value='+value+'&date='+date+'&description='+description; post('/accounting/add_rent_record', data, callback, 0) function callback(data){ if (data.state===true) { successmsg('新增成功'); show_rent_detail(contract_id); refresh_payment_status(contract_id) $('#rentModal').modal('toggle'); }else{ errormsg('新增失敗'); } } }; } function show_pay_rent_detail(contract_id){ var data = "contract_id=" + contract_id; post('/accounting/show_pay_rent_detail', data, callback, 0) function callback(data){ $('#pay_rent_detail').html(''); if (data.state===true) { for (var i = 0; i < data.data.length; i++) { datum = data.data[i]; $('#pay_rent_detail').append('<tr><td>'+(i+1)+'</td><td>'+datum.customer+'</td><td>'+datum.value+'</td><td>'+datum.description+'</td><td>'+datum.date+'</td></tr>'); }; $('#pay_rent_total').html(data.sum); } } } function refresh_payment_status(contract_id){ var data = "contract_id=" + contract_id; post('/accounting/refresh_payment_status', data, callback, 0) function callback(data){ if (data.state===true) { $('#rent_total_2').html(data.sumR); $('#pay_rent_total_2').html(data.sumP); $('#date_avail').html(data.cal.ad); if (data.cal.done===true) { $('#rent_progress').html('<div class="progress-bar progress-bar-success progress-bar-striped" style="width: '+data.cal.tdp+'%" title="已住區段"></div><div class="progress-bar progress-bar-success" style="width: '+(100-data.cal.tdp)+'%" title="已繳租金">100%</div>'); }else{ var ratio = Math.round(100*data.sumP/(data.sumR+1e-10)); // alert(ratio); // alert(data.cal.tdp) if (data.cal.tdp>ratio) { $('#date_avail').html("當月租金未繳"); $('#rent_progress').html('<div class="progress-bar progress-bar-warning" style="width: '+ratio+'%" title="已繳租金">100%</div><div class="progress-bar progress-bar-danger progress-bar-striped" style="width: '+(data.cal.tdp-ratio)+'%" title="已住區段">已住區段</div>'); }else{ $('#rent_progress').html('<div class="progress-bar progress-bar-info progress-bar-striped" style="width:'+(data.cal.tdp)+'%" title="已住區段">已住區段</div><div class="progress-bar progress-bar-warning" style="width: '+(ratio-data.cal.tdp)+'%" title="已繳租金">已繳'+ratio+'%</div>'); } } } } } function submit_new_pay_rent(){ // var source = $('#new_pay_rent_source').val(); var value = parseInt($('#new_pay_rent_value').val()); var customer = $('#new_pay_rent_from').val(); var date = $('#new_pay_rent_date').val(); // var r_id = $('#new_pay_rent_r_id').val(); var description = $('#new_pay_rent_description').val(); var contract_id = $('#contract_id').val(); var state = 1; // if ((source==3)&&r_id=='') { // errormsg('選擇"現金"請輸入收據編號'); // state = 0; // }; if (date=='') { errormsg('請輸入日期'); state = 0; }; if (customer=='') { errormsg('請輸入繳款人'); state = 0; }; if (!Number.isInteger(value)||value<=0||value=='') { errormsg('請輸入正整數金額'); state = 0; } // if (source=='') { // errormsg('請選擇類別'); // state = 0; // }; // 傳送 if (state == 1) { var data = "contract_id=" + contract_id+ '&value='+value+'&customer='+customer+'&date='+date+'&description='+description; post('/accounting/add_pay_rent_record', data, callback, 0) function callback(data){ if (data.state===true) { successmsg('新增成功'); show_pay_rent_detail(contract_id); refresh_payment_status(contract_id) $('#payrentModal').modal('toggle'); }else{ errormsg('新增失敗'); } } }; } </script> <?php }
} else { mysqld_update("shop_goods_option", $a, array('id' => $get_option_id)); $option_id = $get_option_id; } $optionids[] = $option_id; } if (count($optionids) > 0) { mysqld_query("delete from " . table('shop_goods_option') . " where goodsid={$id} and id not in ( " . implode(',', $optionids) . ")"); } else { mysqld_query("delete from " . table('shop_goods_option') . " where goodsid={$id}"); } //总库存 if ($totalstocks > 0) { mysqld_update("shop_goods", array("total" => $totalstocks), array("id" => $id)); } message('商品操作成功!', web_url('goods', array('op' => 'post', 'id' => $id)), 'success'); } include page('goods'); } elseif ($operation == 'display') { $pindex = max(1, intval($_GP['page'])); $psize = 10; $condition = ''; if (!empty($_GP['keyword'])) { $condition .= " AND title LIKE '%{$_GP['keyword']}%'"; } if (!empty($_GP['cate_2'])) { $cid = intval($_GP['cate_2']); $condition .= " AND ccate = '{$cid}'"; } elseif (!empty($_GP['cate_1'])) { $cid = intval($_GP['cate_1']); $condition .= " AND pcate = '{$cid}'";
?> <?php if ($item['status'] == -6) { ?> <span class="label label-success">已退款</span><?php } ?> </td> <td><?php echo date('Y-m-d H:i:s', $item['createtime']); ?> </td> <td><a class="btn btn-xs btn-info" href="<?php echo web_url('order', array('op' => 'detail', 'id' => $item['id'])); ?> "><i class="icon-edit"></i>查看详情</a> <?php if ($hasaddon11) { ?> <a class="btn btn-xs btn-info" href="<?php echo create_url('site', array('name' => 'addon11', 'do' => 'orderPrint', 'orderid' => $item['id'])); ?> "><i class="icon-print"></i>小票打印</a> <?php } ?> <?php if ($hasaddon16) { ?>
?> " onclick="return confirm('确认删除此分类吗?');return false;"><i class="icon-edit"></i> 删 除 </a></td> </tr> <?php } } ?> <?php } } ?> <tr> <td style="width:10px;"></td> <td colspan="4"> <a href="<?php echo web_url('category', array('op' => 'post')); ?> "><i class="icon-plus-sign-alt"></i> 添加新分类</a> </td> </tr> <tr> <td style="width:10px;"></td> <td colspan="4"> <input name="submit" type="submit" class="btn btn-primary" value=" 提 交 "> </td> </tr> </tbody> </table> </form> <?php include page('footer');
<p title=""></p> <span class="css_sprite s-bg-qr_icon icon-qr f-cur"></span> </div> <div class="con"> <div class="con"> <p> </p> <strong class="f-tr"></strong> </div> </div> </div> </div> <p class="u-btn01 f-flow222 f-tc opacity j-detail-buy" data-free="" data-msg=""> <a href="<?php echo web_url('scene', array('op' => 'import', 'theme' => 'style8')); ?> " style="background: blue;" class="f-size18 s-col-fff dingzhi"> <span class="f-size18">套用该模板</span> </a> </p> </div> <div class="con-right m-cardInfo s-bg-fff s-col-333"> <div class="bd"> <div class="bd-ui bd-txt"> <h4 class="f-size18">界面预览<span class="s-col-666 f-size14"> / Preview</span></h4> <div class="imgBox"> <ul style="width:1600px;"> <li> <img src="<?php echo WEBSITE_ROOT;
public function schedule_request() { $time = date("Y-m-d H:i:s"); $query = "SELECT id,owner_id,current_walker,TIMESTAMPDIFF(SECOND,request_start_time, '{$time}') as diff from request where status = 0 and is_cancelled = 0"; $results = DB::select(DB::raw($query)); foreach ($results as $result) { $settings = Settings::where('key', 'provider_timeout')->first(); $timeout = $settings->value; if ($result->diff >= $timeout) { // Archiving Old Walker RequestMeta::where('request_id', '=', $result->id)->where('walker_id', '=', $result->current_walker)->update(array('status' => 2)); $request_meta = RequestMeta::where('request_id', '=', $result->id)->where('status', '=', 0)->orderBy('created_at')->first(); // update request if (isset($request_meta->walker_id)) { // assign new walker Requests::where('id', '=', $result->id)->update(array('current_walker' => $request_meta->walker_id, 'request_start_time' => date("Y-m-d H:i:s"))); // Send Notification $walker = Walker::find($request_meta->walker_id); $owner_data = Owner::find($result->owner_id); $msg_array = array(); $msg_array['request_id'] = $result->id; $msg_array['id'] = $request_meta->walker_id; if ($walker) { $msg_array['token'] = $walker->token; } $msg_array['client_profile'] = array(); $msg_array['client_profile']['name'] = $owner_data->first_name . " " . $owner_data->last_name; $msg_array['client_profile']['picture'] = $owner_data->picture; $msg_array['client_profile']['bio'] = $owner_data->bio; $msg_array['client_profile']['address'] = $owner_data->address; $msg_array['client_profile']['phone'] = $owner_data->phone; $title = "New Request"; $message = $msg_array; send_notifications($request_meta->walker_id, "walker", $title, $message); } else { // request ended Requests::where('id', '=', $result->id)->update(array('current_walker' => 0, 'status' => 1)); $settings = Settings::where('key', 'sms_request_unanswered')->first(); $pattern = $settings->value; $pattern = str_replace('%id%', $result->id, $pattern); sms_notification(1, 'admin', $pattern); // send email $settings = Settings::where('key', 'email_request_unanswered')->first(); $pattern = $settings->value; $pattern = str_replace('%id%', $result->id, $pattern); $pattern = str_replace('%url%', web_url() . "/admin/request/map/" . $result->id, $pattern); $subject = "New Request Unansweres"; email_notification(1, 'admin', $pattern, $subject); } } } }