初始化项目

This commit is contained in:
2016-06-21 17:12:08 +08:00
commit 7ea154d684
903 changed files with 226100 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
<?php
namespace app\common\widget;
/**
* 分类widget
* 用于动态调用分类信息
*/
class Ad{
public function run($name){
$map['name'] = $name;
$place = db('AdPlace')->where($map)->find();
if (empty($place) || !$place) {
echo "";return;
}
if ($place['status'] != '1') {
echo "";return;
}
$ad = db('Ad')->where(array('place_id'=>$place['id'],'status'=>1))->select();
foreach ($ad as $key => $value) {
if ($value['photolist'] != '') {
$photolist = explode(',', $value['photolist']);
$listurl = explode("\n", $value['listurl']);
foreach ($photolist as $k => $val) {
$value['image'][] = array('img'=>get_cover($val,'path'),'url'=>$listurl[$k]);
}
}else{
$value['image'] = array();
}
if ($value['cover_id']) {
$value['cover'] = get_cover($value['cover_id'],'path');
}
$list[] = $value;
}
switch ($place['show_type']) {
//幻灯片显示
case '1':
$template = $place['template'] ? $place['template'] : "sider";
break;
//对联广告
case '2':
$template = $place['template'] ? $place['template'] : "couplet";
break;
//图片列表广告
case '3':
$template = $place['template'] ? $place['template'] : "image";
break;
//图文列表广告
case '4':
$template = $place['template'] ? $place['template'] : "images";
break;
//文字列表广告
case '5':
$template = $place['template'] ? $place['template'] : "text";
break;
//代码广告广告
case '6':
$template = $place['template'] ? $place['template'] : "code";
break;
default:
$template = $place['template'] ? $place['template'] : "default";
break;
}
$data = array(
'place' => $place,
'ad' => $list,
);
$view = new \think\View();
$view->assign($data);
return $view->fetch('common@default/ad/'.$template);
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace app\common\widget;
/**
* 上传插件widget
* 用于动态调用分类信息
*/
class Form {
public function show($field, $info){
$type = isset($field['type']) ? $field['type'] : 'text';
//类型合并
if (in_array($type, array('string'))) {
$type = 'text';
}
if (in_array($type, array('picture'))) {
$type = 'image';
}
$data = array(
'type' => $type,
'field' => isset($field['name']) ? $field['name'] : '',
'value' => isset($info[$field['name']]) ? $info[$field['name']] : '',
'size' => isset($field['size']) ? $field['size'] : 12,
'option' =>isset($field['option']) ? $field['option'] : ''
);
$no_tem = array('readonly', 'text', 'password', 'textarea', 'select', 'bind', 'checkbox', 'radio', 'num','bool','decimal');
$type = !in_array($type, $no_tem) ? $type : 'show';
$view = new \think\View();
$view->assign($data);
return $view->fetch('common@default/form/'.$type);
}
}