| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838 |
- <?php
- /**
- * MainController
- * Feel free to delete the methods and replace them with your own code.
- *
- * @author darkredz
- */
- class MainController extends DooController{
- private $column;
- private $comart;
- function __construct() {
- include './protected/config/index.conf.php';
- $this->column=$column;
- Doo::loadModel('Article');
- $article=new Article();
- $cid=$this->column['COMPANY'];
- $this->comart=$article->getArticleByCid($cid,4);
- }
- function index() {
- Doo::loadModel('Column');
- Doo::loadModel('Product');
- $article=new Article();
- $product=new Product();
- $column=new Column();
- $cid=$this->column['SOFTAPP'].",".$this->column['WEBAPP'];
- $data['WEBAPP']=$this->column['WEBAPP'];
- $col=$column->getColumnByIdList($cid);
- //foreach ($col as $key=>$value){
- $pro=$product->getProductByCid($col[0]['cid']);
- $col[0]['product']=$pro;
- //}
- $cid=$this->column['TRAINC'];
- $train=$article->getArticleByTrain(2);
- $end=$doing=$apply=array();
- foreach ($train as $key=>$value){
- $type=getTrainTimeByStatus($value['enroll_time']);
- $date=explode(":", $value['enroll_time']);
- if($type=="end"){
- $train[$key]['timeStuts']="<p class='tData'>结束 ".$date[1]."</p>";
- array_push($end, $train[$key]);
- }elseif ($type=="doing"){
- $train[$key]['timeStuts']="<span class='tIcon'>进行中</span>";
- array_push($doing, $train[$key]);
- }elseif ($type=="apply"){
- $time = strtotime($date[0]) - 60*60*24;
- $train[$key]['timeStuts']="<span class='tIcon'>报名中</span><p class='tData'>截止".date('Y-m-d',$time)."</p>";
- array_push($apply, $train[$key]);
- }
- }
- $ta=$apply+$doing+$end;
- //print_r($ta);die;
- //$type=="apply";
- //$article->find ( array ('desc' => 'time', 'limit'=>4 , 'where' => 'cid=4 and ', 'asArray' => TRUE ) );
- //$art=$article->getArticleByCid($cid,4);
- $art=array_slice($ta,0,4);
- foreach ($art as $key=>$value){
- $art[$key]['timeStuts']=getTrainTime2($value['enroll_time']);
- $art[$key]['timeStuts3']=getTrainTime3($value['enroll_time']);
- $art[$key]['Stuts']=strlen($art[$key]['timeStuts']);
- }
- $list1=$article->getArticleByCid2($this->column['COMPANY'],5);
- foreach ($list1 as $key=>$value){
- $list1[$key]['title']=$this->cut_str($value['title'], 45);
- }
- $list2=$article->getArticleByCid($this->column['INDUSTRY'],5);
- foreach ($list2 as $key=>$value){
- $list2[$key]['title']=$this->cut_str($value['title'], 45);
- }
- Doo::loadModel('Product');
- $product=new Product();
- $data['product']=$product->getProductByCidAll($this->column['SOFTAPP']);
- $data['article']=$art;
- $data['comart']=$this->comart;
- $data['column']=$col;
- $data['map']='index';
- $data['companyNews']=$list1;
- $data['industryNews']=$list2;
- $this->render ( "/index3", $data );
- }
- function softDown2(){
- Doo::loadModel('Product');
- Doo::loadModel('Down');
- $down=new Down();
- $product=new Product();
- $data['product']=$product->getProductByCidAll($this->column['SOFTAPP']);
- $html="";
- foreach ($data['product'] as $key=>$value){
- $data['product'][$key]['down']=array();
- if(!empty($value['did']))
- $data['product'][$key]['down']=$down->getDownByIdList($value['did']);
- foreach ($data['product'][$key]['down'] as $keys=>$values){
- $t=explode("{b}", $values['down_url']);
- $i=2;
- foreach ($t as $k=>$v){
- if($i==2)
- $html.='<a href="'.$v.'">点击下载</a>';
- // elseif($i==1)
- // $html.='<a href="'.$v.'">联通线路</a>';
- $i--;
- }
- $data['product'][$key]['down'][$keys]['html']=$html;
- $i=2;$html="";
- }
- }
- $data['comart']=$this->comart;
- $data['map']='softDown';
- $this->render ( "/softDown2", $data );
- }
- function softDown(){
- Doo::loadModel('Product');
- $product=new Product();
- $data['product']=$product->getProductByCidAll($this->column['SOFTAPP']);
- $data['comart']=$this->comart;
- $data['map']='softDown';
- $this->render ( "/softDown", $data );
- }
- function ajaxSoftDown(){
- Doo::loadModel('Down');
- Doo::loadModel('Product');
- Doo::loadModel('Animation');
- $animation=new Animation();
- $product=new Product();
- $down=new Down();
- $did=$this->get_args('did');
- $pid=$this->get_args('pid');
- if(!empty($did))
- $do['dot']=$down->getDownByIdList($did);
- $info=$product->getProductById($pid);
- $MyAnimation=array();
- if(!empty($info[0]['anid']))
- $MyAnimation=$animation->getAnimationByIdList($info[0]['anid']);
- $belongAnimation=$animation->getAnimationByBelong();
- $uc='<div class="softVideo">
- <div class="videoItem">';
- if (empty($MyAnimation) ){
- $uc.='<span class="tips">该软件无专属教程,您可观看通用教程</span>';
- }else{
- $uc.='<h1>专属教程</h1>
- <ul class="clearfix">';
- foreach ($MyAnimation as $key=>$value){
- $uc.='<li>
- <img src="'.$value['img_url'].'">
- <h3>'.$value['title'].'</h3>
- <div class="videoCon">
- <span class="playBtn" data-toggle="modal" href="#myModal'.$value['aid'].'" data-keyboard="false" data-backdrop="ture"><b></b>播放</span>
- <a target="blank" href="'.$value['down_url'].'" ><span class="downBtn"><b></b>下载</span></a>
-
- </div>
- </li>';
- }
- $uc.='</ul>';
- }
- $uc.='</div>
- <div class="videoItem">
- <h1>通用教程</h1>
- <ul class="clearfix">';
- foreach ($belongAnimation as $key=>$value){
- $uc.='<li>
- <img src="'.$value['img_url'].'">
- <h3>'.$value['title'].'</h3>
- <div class="videoCon">
- <span class="playBtn" data-toggle="modal" href="#myModal'.$value['aid'].'" data-keyboard="false" data-backdrop="ture"><b></b>播放</span>
- <a target="blank" href="'.$value['down_url'].'"> <span class="downBtn"><b></b>下载</span> </a>
-
- </div>
- </li>';
- }
- $uc.='</ul>
- </div>
- <div class="bottomSpace"></div>
- </div>';
- $html='<div class="dSoftInof">
- <div class="productTab clearfix">
- <div class="title fL"><img width="32" src="'.$info[0]['logo'].'"><b>'.$info[0]['title'].'</b></div>
- <ul>
- <li class="now" id="a" onclick="changeProduct(\'info\')" title="查看版本功能更新">版本更新</li>
- <li id="c" onclick="changeProduct(\'edition\')" title="浏览软件简介" class="">软件介绍</li>
- <li id="d" onclick="changeProduct(\'animation\')" title="观看软件动画教程" class="">动画教程 </li>
- </ul>
- </div>
- <div class="contentItem" id="info" style="display: block;">
- '.$info[0]['edition'].'
- </div>
- <div class="contentItem" id="edition" style="display: none;">
- '.$info[0]['content'].'
- </div>
- <div class="contentItem" id="animation" style="display: none;">
- '.$uc.'
- </div>
- </div>';
- if($info[0]['p_type']!=2)
- $do['info']=$html;
- else
- $do['info']="";
- $show=json_encode($do);
- echo $show;
- }
- function product(){
- $pid=$this->params['pid'];
- $pid=is_numeric($pid)?$pid:0;
- Doo::loadModel('Product');
- Doo::loadModel('Down');
- Doo::loadModel('Animation');
- $animation=new Animation();
- $down=new Down();
- $product=new Product();
- $data['product']=$product->getProductByCid($this->column['SOFTAPP']);
- if (empty($pid))
- $pid=$data['product'][0]['pid'];
- //获取下载内容
- $data['productInfo']=$product->getProductById($pid);
- if(empty($data['productInfo'][0]['did']))
- $data['productInfo'][0]['did']=0;
- $do=$down->getDownByIdList($data['productInfo'][0]['did']);
- foreach ($do as $key=>$value){
- $url=explode("{b}", $value['down_url']);
- $do[$key]['down_url']=$url;
- }
- $data['productInfo'][0]['down']=$do;
- $data['MyAnimation']=array();
- if(!empty($data['productInfo'][0]['anid']))
- $data['MyAnimation']=$animation->getAnimationByIdList($data['productInfo'][0]['anid']);
- $data['belongAnimation']=$animation->getAnimationByBelong();
- $data['comart']=$this->comart;
- $data['map']='product';
- $data['title']=$data['productInfo'][0]['title'];
- $this->render ( "/product", $data );
- }
- function aboutUs(){
- $k=isset($this->params ['k'])?$this->params['k']:'';
- $data['comart']=$this->comart;
- $data['map']='aboutUs';
- if (empty($k)){
- $this->render ( "/aboutUsAbout", $data );
- }else{
- Doo::loadModel('Article');
- $article=new Article();
- //$s=strtotime(date('Y')."-01-01");
- $s=strtotime("2015-01-01");
- $list=$article->find(array ( 'where' => 'cid= 7 and time>='.$s,'desc'=>'time','asArray' => TRUE ));
- foreach ($list as $key=>$value){
- $list[$key]['month']=date('m',$value['time']);
- if(empty($value['thum']))
- $list[$key]['thum']='/global/img/2.png';
- }
- $data['list']=$list;
- $data['year']=date('Y');
- $this->render ( "/".$k, $data );
- }
- }
- function contact(){
- $data['comart']=$this->comart;
- $data['map']='contact';
- $data['iscontact'] = 1;
- $this->render ( "/contact", $data );
- }
- function contact2(){
- $data['iscontact'] = 1;
- $this->render ( "/contact2", $data );
- }
- function train(){
- $article=new Article();
- $train=$article->getArticleByTrain(2);
- $end=$doing=$apply=array();
- foreach ($train as $key=>$value){
- $type=getTrainTimeByStatus($value['enroll_time']);
- $date=explode(":", $value['enroll_time']);
- if($type=="end"){
- $train[$key]['timeStuts']="<p class='tData'>结束 ".$date[1]."</p>";
- array_push($end, $train[$key]);
- }elseif ($type=="doing"){
- $train[$key]['timeStuts']="<span class='tIcon'>进行中</span>";
- array_push($doing, $train[$key]);
- }elseif ($type=="apply"){
- $time = strtotime($date[0]) - 60*60*24;
- $train[$key]['timeStuts']="<span class='tIcon'>报名中</span><p class='tData'>截止".date('Y-m-d',$time)."</p>";
- array_push($apply, $train[$key]);
- }
- }
- $train=$article->getArticleByTrain(1);
- $end1=$doing1=$apply1=array();
- foreach ($train as $key=>$value){
- $type=getTrainTimeByStatus($value['enroll_time']);
- $date=explode(":", $value['enroll_time']);
- if($type=="end"){
- $train[$key]['timeStuts']="<p class='tData'>结束 ".$date[1]."</p>";
- array_push($end1, $train[$key]);
- }elseif ($type=="doing"){
- $train[$key]['timeStuts']="<span class='tIcon'>进行中</span>";
- array_push($doing1, $train[$key]);
- }elseif ($type=="apply"){
- $time = strtotime($date[0]) - 60*60*24;
- $train[$key]['timeStuts']="<span class='tIcon'>报名中</span><p class='tData'>截止".date('Y-m-d',$time)."</p>";
- array_push($apply1, $train[$key]);
- }
- }
- $data['end1']=$end1;
- $data['doing1']=$doing1;
- $data['apply1']=$apply1;
- $data['end']=$end;
- $data['doing']=$doing;
- $data['apply']=$apply;
- $data['comart']=$this->comart;
- $data['map']='trainI';
- $this->render ( "/train2", $data );
- }
- function trainPage(){
- $aid=$this->params['aid'];
- $aid=is_numeric($aid)?$aid:0;
- if(empty($aid)){
- return "/train";
- }
- $article=new Article();
- $trainPage=$article->getArticleByTrainAid($aid);
- $trainPage[0]['timeStuts']=getTrainTime($trainPage[0]['enroll_time']);
- $trainPage[0]['class']=getTrainTimeByStatus($trainPage[0]['enroll_time']);
- $data['trainPage']=$trainPage[0];
- $data['comart']=$this->comart;
- $data['map']='train';
- $this->render ( "/trainPage", $data );
- }
- function searchNews(){
- $kind = $this->get_args('kind') ? $this->get_args('kind') : 1;
- $k = $this->get_args('k') ? $this->get_args('k') : "";
- $onPage =$this->get_args('onPage')&&is_numeric ( $this->get_args('onPage') ) ? $this->get_args('onPage') : 1;
- $list=array();$next=0;$previous=0;
- if (!empty($k)){
- Doo::loadModel('Down');
- $down=new Down();
- $article=new Article();
- if ($onPage <= 0)
- $onPage = 1;
- $pageSize = 20;
- $o=$onPage;
- $lower = (-- $o) * $pageSize;
- $previous = $onPage != 0 ? $onPage - 1 : $onPage;
- if ($kind==2){
- $list=$down->find(array('where'=>'title like "%'.$k.'%" or key_number like "%'.$k.'%"','limit'=>$lower.','.$pageSize ,'asArray' => TRUE));
- $totalCount = $down->count(array('where'=>'title like "%'.$k.'%" or key_number like "%'.$k.'%"','limit'=>$lower.','.$pageSize ,'asArray' => TRUE));
- $total = intval ( $totalCount / $pageSize );
- $totalPage = ($totalCount % $pageSize) == 0 ? $total : $total + 1;
- $next = $onPage == $totalPage ? $totalPage : $onPage + 1;
- foreach ($list as $key=>$value){
- $url=explode("{b}", $value['down_url']);
- $list[$key]['down_url']=$url;
- }
- }elseif($kind==3){
- Doo::loadModel('ArticleDao');
- $ArticleDao=new ArticleDao();
- $list=$ArticleDao->find(array('select'=>'title,aid,cid,time','where'=>'title like "%'.$k.'%" ',
- 'limit'=>$lower.','.$pageSize ,'asArray' => TRUE));
- $totalCount = $ArticleDao->count(array('where'=>'title like "%'.$k.'%" ','asArray' => TRUE));
- $total = intval ( $totalCount / $pageSize );
- $totalPage = ($totalCount % $pageSize) == 0 ? $total : $total + 1;
- $next = $onPage == $totalPage ? $totalPage : $onPage + 1;
- }else{//or content like "%'.$k.'%"
- $list=$article->find(array('select'=>'title,aid,cid,time','where'=>'title like "%'.$k.'%" and ( cid=4 or cid=5 or cid=3 or cid=7)',
- 'limit'=>$lower.','.$pageSize ,'asArray' => TRUE));
- $totalCount = $article->count(array('where'=>'title like "%'.$k.'%" and ( cid=4 or cid=5 or cid=3 or cid=7)','asArray' => TRUE));
- $total = intval ( $totalCount / $pageSize );
- $totalPage = ($totalCount % $pageSize) == 0 ? $total : $total + 1;
- $next = $onPage == $totalPage ? $totalPage : $onPage + 1;
- foreach ($list as $key=>$value){
- if($value['cid']==4)
- $list[$key]['c']='公司新闻';
- elseif ($value['cid']==5)
- $list[$key]['c']='行业新闻';
- elseif ($value['cid']==3)
- $list[$key]['c']='培训教育';
- elseif ($value['cid']==7)
- $list[$key]['c']='软件更新';
- }
- }
- }
- $data['next']=$next;
- $data['previous']=$previous;
- $data['k']=$k;
- $data['onPage']=$onPage;
- $data['list']=$list;
- $data['kind']=$kind;
- $data['map']='sNews';
- $this->render ( "/search", $data );
- }
- function news(){
- $n = "";
- $cid=isset($this->params ['cid'])&&is_numeric($this->params['cid'])?$this->params['cid']:$this->column['COMPANY'];
- $aid=isset($this->params ['aid'])&&is_numeric($this->params['aid'])?$this->params['aid']:0;
- $on_page = isset($this->params ['page'])&&is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
- //
- if ($on_page <= 0)
- $on_page = 1;
- $page_size = 10;
- // //检索条件
- if($cid==$this->column['TRAINC'])
- $n = " and a_type=2 and cid =" . $cid .' and title!=""';
- else
- $n = " and a_type=1 and cid =" . $cid .' and title!=""';
- $condition=$n;
- $action = "/news/";
- Load::logic ( 'Admin' );
- $this->adminlogic = new AdminLogic ();
- //获取分页相关数据
- $page = $this->adminlogic->get_page ( "sc_article", $condition, $on_page, $page_size, $action );
- $limit = " order by update_time desc limit " . $page ['lower'] . " , " . $page_size . " ";
- Doo::loadModel('Article');
- $article=new Article();
- // $k=$article->getOne(array ('where' => 'aid=721' , 'asArray' => TRUE ));
- //
- // print_r();
- //echo $condition;
- $page ['article_list'] = $article->getArticleList ( array (), $condition, $limit );
- $data['articleInfo']=array();
- if(empty($aid)){
- if(!empty($page ['article_list']))
- $data['articleInfo']=$page ['article_list'][0];
- }else{
- $a=$article->getArticleById($aid);
- $data['articleInfo']=$a[0];
- }
- foreach ($page ['article_list'] as $key=>$value){
- if(empty($value['thum']))
- $page ['article_list'][$key]['thum']='/global/img/2.png';
- }
- $data ['article'] = $page;
- $k="";
- for ($i=1;$i<=$page['total_page'];$i++){
- if($on_page==$i)
- $k.="<option value='".$cid.":".$i."' selected>第".$i."页</option>";
- else
- $k.="<option value='".$cid.":".$i."'>第".$i."页</option>";
- }
- $data['page']=$page;
- $data['comart']=$this->comart;
- $data['onpage']=$on_page;
- $data['cid']=$cid;
- $data['aid']=$aid;
- $data['column']=$this->column;
- $data['map']='news';
- $this->render ( "/news2", $data );
- }
- function newsPage(){
- $aid=isset($this->params ['aid'])&&is_numeric($this->params['aid'])?$this->params['aid']:0;
- Doo::loadModel('Article');
- $article=new Article();
- $a=$article->getArticleById($aid);
- $list=$article->find(array ( 'where' => 'aid !=' . $a[0]['aid'].' and cid='.$a[0]['cid'], 'limit'=>'5','desc'=>'aid' ,'asArray' => TRUE ));
- $data['list']=$list;
- $data['cid']=$a[0]['cid'];
- $data['articleInfo']=$a[0];
- $data['comart']=$this->comart;
- $data['aid']=$aid;
- $data['column']=$this->column;
- $data['map']='news';
- $this->render ( "/newsContent", $data );
- }
- function video(){
- Doo::loadModel('Animation');
- $animation=new Animation();
- $data['comart']=$this->comart;
- $data['map']='video';
- if(isset($this->params['aid'])){
- $data['nimationInfo']=$animation->getAnimationById($this->params['aid']);
- $this->render ( "/videoPage", $data );
- }else{
- $data['nimation']=$animation->getAnimationList(array(), "", "order by aid asc");
- $this->render ( "/video", $data );
- }
- }
- function sdown(){
- $url=isset($this->params ['url'])?$this->params['url']:0;
- if(!empty($url)){
- $url=base64_decode($url);
- if(!empty($url))
- return $url;
- }else{
- return "/";
- }
- }
- function getInfo(){
- $article=new Article();
- $info=$article->getArticleByCid($this->column['COMPANY'],2);
- $k=array();
- foreach ($info as $key=>$value){
- array_push($k, array('aid'=>$value['aid'],'title'=>$value['title']));
- }
- $pa['company']=$k;
- $cid=$this->column['TRAINC'];
- $art=$article->getArticleByCid($cid,3);
- $k=array();//,'timeStuts'=>getTrainTimeTk($value['enroll_time'])
- foreach ($art as $key=>$value){
- array_push($k, array('aid'=>$value['aid'],'title'=>$value['enroll_title']));
- }
- $pa['trainc']=$k;
- echo json_encode($pa);
- }
- function getInfo2(){
- $article=new Article();
- $info=$article->getArticleByCid($this->column['COMPANY'],6);
- $k=array();
- foreach ($info as $key=>$value){
- array_push($k, array('aid'=>$value['aid'],'title'=>$value['title']));
- }
- $pa['company']=$k;
- $cid=$this->column['TRAINC'];
- $art=$article->getArticleByCid($cid,3);
- $k=array();//,'timeStuts'=>getTrainTimeTk($value['enroll_time'])
- foreach ($art as $key=>$value){
- array_push($k, array('aid'=>$value['aid'],'title'=>$value['enroll_title']));
- }
- $pa['trainc']=$k;
- echo json_encode($pa);
- }
- function newsHttp(){
- $updateTime = $this->get_args('updateTime')&&is_numeric($this->get_args('updateTime')) ? $this->get_args('updateTime') : 0;
- $page = $this->get_args('page')&&is_numeric($this->get_args('page')) ? $this->get_args('page') : 1;
- $size = $this->get_args('size')&&is_numeric($this->get_args('size')) ? $this->get_args('size') : 10;
- Doo::loadModel('Article');
- $article=new Article();
- if ($page!=1)
- $page=$page*$size-1;
- else
- $page--;
- $count=$article->count(array('where'=>'title!="" and (update_time>'.$updateTime.')','limit'=>$page.','.$size,'asArray'=>true));
- $list=$article->find(array('where'=>'title!="" and (update_time>'.$updateTime.')','limit'=>$page.','.$size,'desc'=>'update_time','asArray'=>true));
- echo json_encode(array('status'=>1,'articleList'=>$list,'count'=>$count));
- }
- function authentication(){
- $data=array();
- $this->render ( "/productSecurity", $data );
- }
- function doAuthentication(){
- $key = $this->get_args('key')? $this->get_args('key') :"";
- $data['comart']=$this->comart;
- if (!empty($key)){
- require_once (SITE_PATH . '/protected/class/client.php');
- $client = new client ( 'http://cld.smartcost.com.cn/' );
- $list = $client->zhsso_getSerialNumber ( $key );
- $list=json_decode($list,true);
- if (empty($list['list'])){
- $this->render ( "/productSecurityPiracy", $data );die;
- }
- $data['list']=$list['list'];
- $this->render ( "/productSecurityGenuine", $data );
- }else
- $this->render ( "/productSecurityPiracy", $data );die;
- }
- function authenticationHttp(){
- $SerialNumber = $this->get_args('SerialNumber')? $this->get_args('SerialNumber') :"";
- $data['comart']=$this->comart;
- if (!empty($SerialNumber)){
- require_once (SITE_PATH . '/protected/class/client.php');
- $client = new client ( 'http://cld.smartcost.com.cn/' );
- $list = $client->zhsso_getSerialNumber2 ( $SerialNumber );
- $list=json_decode($list,true);
- if (empty($list['list'])){
- $this->render ( "/productSecurityPiracy", $data );die;
- }
- $data['list']=$list['list'];
- $this->render ( "/productSecurityGenuine2", $data );
- }else{
- $this->render ( "/productSecurityPiracy", $data );die;
- }
- }
- function cut_str($string, $length, $dot = ' ...'){
- if(strlen($string) <= $length)
- {
- return $string;
- }
- $strcut = '';
- $sys_config = 'utf-8';
- if($sys_config == 'utf-8'){
- $n = $tn = $noc = 0;
- while($n < strlen($string))
- {
- $t = ord($string[$n]);
- if($t == 9 || $t == 10 || (32 <= $t && $t <= 126)) {
- $tn = 1; $n++; $noc++;
- } elseif(194 <= $t && $t <= 223) {
- $tn = 2; $n += 2; $noc += 2;
- } elseif(224 <= $t && $t < 239) {
- $tn = 3; $n += 3; $noc += 2;
- } elseif(240 <= $t && $t <= 247) {
- $tn = 4; $n += 4; $noc += 2;
- } elseif(248 <= $t && $t <= 251) {
- $tn = 5; $n += 5; $noc += 2;
- } elseif($t == 252 || $t == 253) {
- $tn = 6; $n += 6; $noc += 2;
- } else {
- $n++;
- }
- if($noc >= $length)
- {
- break;
- }
- }
- if($noc > $length)
- {
- $n -= $tn;
- }
- $strcut = mb_substr($string, 0, $n);
- }
- else
- {
- for($i = 0; $i < $length; $i++)
- {
- $strcut .= ord($string[$i]) > 127 ? $string[$i].$string[++$i] : $string[$i];
- }
- }
- return $strcut.$dot;
- }
- /**
- * 获取get或者POST值
- * @param string $name 属性名称
- * @return fixed 值
- */
- function get_args($name) {
- if (isset ( $_GET [$name] )) {
- if (is_array ( $_GET [$name] ))
- return $_GET [$name];
- else
- return addslashes ( $_GET [$name] );
- } elseif (isset ( $_POST [$name] )) {
- if (is_array ( $_POST [$name] ))
- return $_POST [$name];
- else
- return addslashes ( $_POST [$name] );
- } else {
- return false;
- }
- }
- }
- ?>
|