Пример #1
0
 public function edit($runtime, $id)
 {
     $bean = Boxs::i($id);
     if ($bean->mac) {
         $bean->runtime = $runtime;
         $flag = $bean->save();
     }
     return $flag;
 }
Пример #2
0
 function view()
 {
     COMFilter::$_jump = false;
     $clientmac = $_COOKIE['CLIENTMAC'];
     if (!$clientmac) {
         $boxmac = new COMGetmac();
         // print 'getmac';
         $clientmac = 'M' . $boxmac->getmac();
         setcookie("CLIENTMAC", $clientmac);
     }
     // print $clientmac;
     $clientboxid = intval($_COOKIE['CLIENTBOXID']);
     if (!$clientboxid) {
         $clientbox = new Boxs();
         $one = $clientbox->getOne("mac=?", $clientmac);
         if ($one) {
             $clientboxid = $one->id;
             setcookie("CLIENTMAC", $clientmac);
         }
     }
     // print 'id:'.$clientboxid;
     //实例化模板
     $tp = PHP_Templates::factory();
     $LOGGEDUSER = $_COOKIE['LOGGEDUSER'];
     if ($LOGGEDUSER) {
         $tp->title = "后台";
         //设置模板文件
         $tp->setFiles('default_back');
     } else {
         $tp->title = "测试";
         //设置模板文件
         $tp->setFiles('default');
         //统计
         Statistics::hitscounter(intval($clientboxid), "login", "login");
     }
     //输出页面
     $tp->execute();
     //释放模板变量
     unset($tp, $dataFilter);
 }
Пример #3
0
 private function boxlist()
 {
     $keyword = strtoupper(Core::$_dataFilter->valueCheck(Core::get("keyword"), "Limit", "关键字最多20个字符", false, 20));
     $_where = "";
     if ($keyword) {
         $_where .= " mac like '%{$keyword}%'";
     }
     $_order = Core::$_dataFilter->valueCheck(Core::get("order"), "Limit", "关键字最多20个字符", false, 20);
     $_asc = isset($_GET['asc']) ? $_GET['asc'] : 1;
     if ($_order) {
         if ($_asc) {
             $_asc = 0;
             $_order = "{$_order} desc";
         } else {
             $_asc = 1;
             $_order = "{$_order} asc";
         }
     } else {
         $_order = 'id desc ';
     }
     //实例化分页数据获取
     $pager = Pagination::factory();
     //设置每显示记录条数
     $pageSize = 10;
     //设置显示的数字页码数
     $showSize = 10;
     $page = Boxs::getPage($_where, null, $_order, $pageSize);
     $pager->dataTotal = $page['total'];
     //获取当前页
     $currPage = $page['curr'];
     //创建分页实例
     $pager->pagerInit(ROOT . 'class/plus/pagination/pagerstatictemplate.htm', $pageSize, $showSize, $currPage, 'page');
     //获取页数据
     $result = $page['list'];
     if (!empty($result)) {
         //设置表头
         $url = $pager->getPageUrl("order=update_time&asc={$_asc}", 'order');
         $pager->setHeader(array('序号', '盒子CODE', '更新时间', '运行时间'));
         //设置显示的字段
         $showFields = array('id', 'order', 'mac', 'update_time', 'runtime');
         //设置处理字段函数
         $multFunction = array('id' => array('PaginalTable', 'createCheckBox'), 'order' => array('Core', 'order'));
         //复合字段处理
         $multFields = array('order' => array('id'));
         //设置表格标签
         $pager->setTableTag(true);
         //设置表格样式
         $pager->setTableClass('newblog');
         //设置选择框
         $pager->setCheckBox();
         $pager->setRowNumber(($currPage - 1) * $showSize);
         //$pager->setDetailButton();
         //$pager->setCustomButton(array('设置版本','设置码率'));
         $this->_showpage = $pager->showGet('', '<em>|</em>');
         return $pager->createTable($result, $showFields, $multFunction, $multFields);
     }
 }
Пример #4
0
 /**
  * 功能号:12080
  * 订单接口
  * */
 public function order_create()
 {
     COMFilter::$_jump = false;
     $clientmac = $_COOKIE['CLIENTMAC'];
     if (!$clientmac) {
         $boxmac = new COMGetmac();
         // print 'getmac';
         $clientmac = 'M' . $boxmac->getmac();
         setcookie("CLIENTMAC", $clientmac);
     }
     // print $clientmac;
     $clientboxid = intval($_COOKIE['CLIENTBOXID']);
     if (!$clientboxid) {
         $clientbox = new Boxs();
         $one = $clientbox->getOne("mac=?", $clientmac);
         if ($one) {
             $clientboxid = $one->id;
             setcookie("CLIENTMAC", $clientmac);
         }
     }
     $phone = Core::$_dataFilter->valueCheck(Core::get("phone"), "Require,Limit", "手机号不能为空,手机号最多11个字符", false, 11);
     $goodsid = 10001;
     if ($phone) {
         //统计
         Statistics::hitscounter(intval($clientboxid), "logined", "logined");
         $user = new Users();
         $addate = COMCommon::sysTime();
         $one = $user->getOne('user_name=?', $phone);
         if (empty($one)) {
             $id = $user->add($phone, $addate);
         } else {
             $id = $one->id;
         }
         setcookie("CLIENTPHONE", $phone);
         $token = new Users_token();
         //$host = '115.28.92.216';
         $host = $this->_host;
         $network = Core::connect_check($host);
         if ($network) {
             $param = array("m" => 12080, "phone" => $phone, "goods" => $goodsid);
             if (!$clientboxid) {
                 $param['mac'] = $clientmac;
             } else {
                 $param['box'] = $clientboxid;
             }
             $param['at'] = $_SERVER['REQUEST_TIME'];
             $one = $token->getOne("id = ? and end_time - UNIX_TIMESTAMP() > 0", $id);
             if (empty($one)) {
                 $param['pal'] = 1;
             }
             $sign = Core::get_signature($param);
             $param["sign"] = $sign;
             $url = "http://{$host}/tvmv/?m=12080";
             $temp = Core::request_url($url, $param, 1);
             $return = json_decode($temp);
             if ($return->status === 1) {
                 $data = $return->data;
                 if ($data->token) {
                     if (!$data->status) {
                         $order = new Orders();
                         $one = $order->getOne("order_sn=?", $data->ordersn, "pay_time desc");
                         if ($one) {
                             $one->status = 1;
                             $one->pay_time = date("Y-m-d H:i:s", $data->start_time);
                             $flag = $one->save();
                             if ($flag) {
                                 $one = $token->getOne("id = ?", $id);
                                 if ($one) {
                                     $flag = $token->edit(1, $data->ordersn, $data->token, $data->start_time, $data->end_time, 1, $data->code, $id);
                                 } else {
                                     $flag = $token->add($id, 1, $data->ordersn, $data->token, $data->start_time, $data->end_time, 1, $data->code);
                                 }
                                 if ($flag) {
                                     $this->notify_server($one, $data->token);
                                 }
                             }
                         }
                     }
                     setcookie("CLIENTTOKEN", $data->token);
                     $retval['token'] = $data->token;
                     Core::json_result($retval, '已支付');
                 } elseif ($data->ordersn) {
                     $order = new Orders();
                     $one = $order->getOne("order_sn=?", $data->ordersn, "pay_time desc");
                     if (empty($one)) {
                         $orderid = $order->add($data->ordersn, $id, 0, $clientboxid, 0, "", $goodsid, 0, 0, "", 1);
                         if ($orderid) {
                             $ordersn = $data->ordersn;
                         }
                     } else {
                         $ordersn = $one->order_sn;
                     }
                     setcookie("CLIENTORDERSN", $ordersn);
                     $retval['ordersn'] = $ordersn;
                     Core::json_result($retval, '订单生成');
                 }
             } else {
                 $msg = $return->msg;
                 Core::json_error($msg);
             }
         } else {
             $flag = $token->del("id = {$id} and end_time - UNIX_TIMESTAMP() < 0");
             $one = $token->getOne("id = ? and end_time - UNIX_TIMESTAMP() > 0", $id);
             if ($one) {
                 if ($one->status == 1) {
                     $flag = $this->notify_server($one, $one->token_id);
                 }
                 setcookie("CLIENTTOKEN", $one->token_id);
                 $retval['token'] = $one->token_id;
                 Core::json_result($retval, '已支付');
             } else {
                 $msg = "请购买观影服务!";
                 Core::json_error($msg);
             }
         }
     }
 }
Пример #5
0
 /**
  * 功能号:13060
  * 点击量计数
  */
 function click_counter()
 {
     $urltitle = Core::$_dataFilter->valueCheck(Core::get("title"), "Limit", "数据非法", false, 100);
     $xurl = Core::$_dataFilter->valueCheck(Core::get("url"), "Limit", "数据非法", false, 255);
     $boxmac = new COMGetmac();
     $clientmac = 'M' . $boxmac->getmac();
     $clientbox = new Boxs();
     $one = $clientbox->getOne("mac=?", $clientmac);
     if (empty($one)) {
         Core::json_error("fail");
     }
     $clientboxid = intval($one->id);
     if ($clientboxid > 0) {
         self::hitscounter($clientboxid, $urltitle, $xurl);
     }
     Core::json_result("", "ok");
 }