<?php

/* ========================================================================
 * $Id: product.php 1964 2020-07-07 14:30:58Z onez $
 * 
 * Email: www@onez.cn
 * QQ: 6200103
 * HomePage: http://www.onez.cn
 * ========================================================================
 * Copyright 2016-2017 佳蓝科技.
 * 
 * ======================================================================== */

!defined('IN_ONEZ') && exit('Access Denied');
# 选择产品
# product
#请求数据
if($MODE=='$post'){
  $action=onez()->gp('action');
  if($action=='data'){
    $links=array();
    $ac=onez()->gp('ac');
    if($ac=='code'){
      $ptoken=onez()->gp('ptoken');
      $r=onez()->post(ONEZ_BS_APIURL,http_build_query(array(
        'action'=>'ptoken',
        'ptoken'=>$ptoken,
      )));
      $A=json_decode($r,1);
      return;
    }
    $glob=glob(onez()->root().ONEZ_NODE_PATH.'/*');
    if($glob){
      foreach($glob as $v){
        $ptoken=basename($v);
        if(strpos($ptoken,'bs.app.')===0){
          $icon=onez($ptoken)->url.'/icon.png';
          $name='';
          $summary='';
          $configFile=onez($ptoken)->path.'/lib/config.php';
          if(file_exists($configFile)){
            $config=include($configFile);
            $name=$config['name'];
            $summary=$config['summary'];
          }
          !$name && $name=$ptoken;
          $links[]=array(
            'icon'=>$icon,
            'name'=>$name,
            'summary'=>$summary,
            'type'=>'plugin',
            'ptoken'=>$ptoken,
          );
        }
      }
    }
    $links[]=array(
      'icon'=>'http://cdn.onez.cn/icons/2020/0707/2020070711052336570001.svg',
      'name'=>'手动填写产品识别码',
      'summary'=>'填写佳蓝产品识别码，极速部署云端佳蓝应用~',
      'type'=>'code',
    );
    $links[]=array(
      'icon'=>'http://cdn.onez.cn/icons/2020/0707/2020070714293271360001.svg',
      'name'=>'佳蓝BS智能开发',
      'summary'=>'佳蓝新概念网站智能开发与管理平台。选择此项可快速搭建总平台！',
      'type'=>'bs',
    );
    $A['links']=$links;
  }
  return;
}
?>
<template v-if="$links">
  <h2>请点击下面其中一种产品或安装方式</h2>
  <onez-link :data="link" :class="ptoken==link.ptoken?'current':''" islink v-for="link in links" @click="click" />
</template>