dever 5 years ago
parent
commit
88a8b36cb9

+ 2 - 1
assets/moltran/html/list.html

@@ -44,7 +44,8 @@
 
 .container_list th,.container_list td
 {
-    white-space: nowrap;
+    /*white-space: nowrap;*/
+    white-space: none;
 }
 .container_list .table-responsive[data-pattern="priority-columns"]
 {

+ 44 - 0
assets/moltran/html/list/photo.html

@@ -0,0 +1,44 @@
+<style>
+.pr-list {
+    color: #97a0af;
+    font-size: 12px;
+    font-weight: 400;
+    margin: 0 -20px 30px;
+    padding: 0;
+    text-transform: none;
+}
+.pr-list li {
+    list-style: none;
+    padding: 6px 20px;
+}
+#page {
+	clear: both;
+}
+</style>
+
+<div id="photo_list" class="table-wrapper">
+<div class="col-sm-6 col-md-6 col-lg-3 photo_list">
+	  <div class="pricing-item">
+	    <div class="pricing-item-inner">
+	      <div class="pricing-wrap">     
+	        <!-- Pricing Title -->
+	        <div class="pricing-title">
+	          <div class="dever-img">
+				<img width="200" layer-src="https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=527764164,2221564766&fm=173&app=25&f=JPEG?w=218&h=146&s=593ABBF1405397EB5CA8891C030010D3" layer-pid="" src="https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=527764164,2221564766&fm=173&app=25&f=JPEG?w=218&h=146&s=593ABBF1405397EB5CA8891C030010D3" alt="说好的,一起Fly" style="display:none;">
+				</div>
+	        </div>
+
+	        <div class="pr-per dever-desc">
+	          我在那男的开发的经费看见对方
+	        </div>                      
+	        <!-- Button -->                     
+	        <div class="pr-button dever-button">
+	          <button class="btn btn-success w-md waves-effect waves-light">审核</button>
+	        </div>
+	      </div>
+	    </div>
+	  </div>
+	</div>
+</div>
+
+<div id="page"></div>

+ 68 - 0
database/signature.php

@@ -0,0 +1,68 @@
+<?php
+/*
+|--------------------------------------------------------------------------
+| signature.php
+|--------------------------------------------------------------------------
+*/
+
+return array
+(
+	# 表名
+	'name' => 'signature',
+	# 显示给用户看的名称
+	'lang' => '生成的signature',
+	'menu' => false,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'signature'		=> array
+		(
+			'type' 		=> 'varchar-64',
+			'name' 		=> 'signature',
+			'default' 	=> '',
+			'desc' 		=> 'signature',
+			'match' 	=> 'is_string',
+			'list'		=> true,
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '操作时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	'manage' => array
+	(
+		'delete' => false,
+		'edit' => false,
+		'insert' => false,
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'deleteByDay' => array
+		(
+			'where' => array
+			(
+				'time' => array('yes-cdate', '<='),
+			),
+			'type' => 'delete',
+		),
+	),
+);

+ 122 - 57
src/Database.php

@@ -166,6 +166,10 @@ class Database
         } else {
             $state = '&search_option_state=' . $state;
         }
+        $page_type = Dever::input('page_type');
+        if ($page_type) {
+            $param .= '&page_type=' . $page_type . '';
+        }
         $param = 'project=' . $this->project . $param . '&table=' . $table . '&menu=' . $this->menu . '&menu_id=' . $this->menu_id . $state . $suffix;
 
         return $param;
@@ -576,7 +580,12 @@ class Database
         $key = 'page_' . $key;
 
         if (isset($config['manage'][$key])) {
-            $result['content'] = Dever::view($config['manage'][$key], 'manage', $this->project);
+            if ($config['manage'][$key] == 'photo' && isset($config['manage']['photo'])) {
+                $result['content'] = Dever::view('list/photo', false, 'manage');
+            } else {
+                $result['content'] = Dever::view($config['manage'][$key], 'manage', $this->project);
+            }
+            
             //echo $result['content'];die;
             if ($result['content']) {
                 Dever::setInput('page_content', 1);
@@ -584,7 +593,9 @@ class Database
                 $result['s2'] = 'display:none';
 
                 # 添加底部
-                $result['content'] .= Dever::view('foot', 'inc', 'manage');
+                if ($key != 'page_list_table') {
+                    $result['content'] .= Dever::view('inc/foot', false, 'manage');
+                }
             }
         }
 
@@ -1379,7 +1390,7 @@ class Database
                         $option = array($col => $v);
                         $v = Dever::load($config['manage']['search']['api'][$k]['api'], $option);
                         $result = $config['manage']['search']['api'][$k]['result'];
-                        if (is_array($v)) {
+                        if ($v && is_array($v)) {
                             if (isset($v[$result])) {
                                 $v = $v[$result];
                             } else {
@@ -1395,8 +1406,11 @@ class Database
                                 
                                 $param['option'][$k] = array('yes', 'in');
                             }
+                        } else {
+                            $v = '-100';
                         }
                     }
+
                     $param['option_' . $k] = $v;
                 }
             }
@@ -1552,7 +1566,49 @@ class Database
     }
 
     /**
-     * 列表页数据列表
+     * 列表页数据列表:图片形式
+     *
+     * @return array
+     */
+    public function list_photo()
+    {
+        $config = $this->config();
+        $result = array();
+        if (isset($config['manage']['photo'])) {
+
+            $high = array();
+        
+            $search = Dever::load('manage/auth.oper', 2) ? Dever::preInput('search_') : false;
+
+            $param = array();
+
+            $parent = 0;
+            if ($search) {
+                list($param, $high) = $this->list_tbody_search($config, $param, $high, $search);
+            }
+
+            if (empty($param['page'])) {
+                $num = $this->getNumConfig($config);
+                if ($num) {
+                    $param['page'][0] = $num[0];
+                }
+            }
+
+            $method = $this->project . '/' . $this->table . '-list';
+            $result = Dever::load($method, $param);
+            if ($result) {
+                foreach ($result as $k => $v) {
+                    $result[$k] = Dever::load($config['manage']['photo'], $v);
+                    $result[$k]['button'] = $this->list_tbody_button($config, $v, 'div');
+                }
+            }
+        }
+
+        return $result;
+    }
+
+    /**
+     * 列表页数据列表:表格形式
      *
      * @return array
      */
@@ -1763,58 +1819,7 @@ class Database
                     }
                 }
 
-                if (isset($config['manage']['_list']['value'])) {
-                    $result[$k] .= '<td>';
-                    if ($config['state'] == 2) {
-                        if (isset($config['manage']['_list']['value']['update'])) {
-                            unset($config['manage']['_list']['value']['update']);
-                        }
-                        if (isset($config['manage']['_list']['value']['delete'])) {
-                            $config['manage']['_list']['value']['delete'] = '恢复';
-                        }
-                    }
-                    foreach ($config['manage']['_list']['value'] as $kj => $vj) {
-                        $pj = false;
-
-                        $h = '<span class="am-icon-pencil-square-o"></span>';
-                        $oper = true;
-                        if ($kj == 'update') {
-                            $oper = Dever::load('manage/auth.oper', 3);
-                        } elseif ($kj == 'delete') {
-                            $oper = Dever::load('manage/auth.oper', 5);
-
-                            $h = '<span class="am-icon-trash-o"></span>';
-                        }
-
-                        if (is_array($vj) && isset($vj[1])) {
-                            if (isset($vj[2])) {
-                                $oper = $this->value($vj[2], $data[$k]);
-                            }
-                            if ($oper && strpos($vj[1], 'modal|') === false) {
-                                $pj = $this->value($vj[1], $data[$k]);
-                                $vjn = $vj[0];
-                            }
-                        } else {
-                            $vjn = $vj;
-                        }
-
-                        if ($oper == true) {
-                            if (strpos($kj, 'edit') !== false) {
-                                $result[$k] .= '<a href="javascript:;" onclick="fastEdit($(this), \'' . $this->url($kj, $v['id']) . '\', \''.$vj[0].'\', \''.$vj[1].'\')"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5">' . $vj[0] . '</button></a>&nbsp;&nbsp;';
-                            } elseif (strpos($kj, 'oper') !== false) {
-                                $result[$k] .= '<a href="javascript:;" onclick="load(\'' . Dever::url($pj) . '\')"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5">' . $vj[0] . '</button></a>&nbsp;&nbsp;';
-                            } elseif (isset($vj[1]) && strpos($vj[1], 'modal|') !== false) {
-                                $t = explode('|', $vj[1]);
-                                $result[$k] .= '<a href="#dever_modal" data-toggle="modal"  class="btn btn-info btn-rounded waves-effect waves-light m-b-5" onclick=' . $t[1] . ' msg-send="' . $this->value($t[2], $data[$k]) . '">' . $vj[0] . '</a>&nbsp;&nbsp;';
-                            } elseif (isset($vj[1])) {
-                                $result[$k] .= '<a href="' . $this->url($kj, $v['id'], $pj) . '" class="oper_' . $kj . '"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5">' . $h . $vjn . '</button></a>&nbsp;&nbsp;';
-                            } else {
-                                $result[$k] .= '<span style="margin-left:5px;margin-right:10px;">' . $vj[0] . '</span>';
-                            }
-                        }
-                    }
-                    $result[$k] .= '</td>';
-                }
+                $result[$k] .= $this->list_tbody_button($config, $data[$k]);
 
                 $result[$k] .= '</tr>';
             }
@@ -1837,6 +1842,65 @@ class Database
         return $result;
     }
 
+    private function list_tbody_button($config, $data, $type = 'td')
+    {
+        $result = '';
+        if (isset($config['manage']['_list']['value'])) {
+            $result = '<'.$type.'>';
+            if ($config['state'] == 2) {
+                if (isset($config['manage']['_list']['value']['update'])) {
+                    unset($config['manage']['_list']['value']['update']);
+                }
+                if (isset($config['manage']['_list']['value']['delete'])) {
+                    $config['manage']['_list']['value']['delete'] = '恢复';
+                }
+            }
+            foreach ($config['manage']['_list']['value'] as $kj => $vj) {
+                $pj = false;
+
+                $h = '<span class="am-icon-pencil-square-o"></span>';
+                $oper = true;
+                if ($kj == 'update') {
+                    $oper = Dever::load('manage/auth.oper', 3);
+                } elseif ($kj == 'delete') {
+                    $oper = Dever::load('manage/auth.oper', 5);
+
+                    $h = '<span class="am-icon-trash-o"></span>';
+                }
+
+                if (is_array($vj) && isset($vj[1])) {
+                    if (isset($vj[2])) {
+                        $oper = $this->value($vj[2], $data);
+                    }
+                    if ($oper && strpos($vj[1], 'modal|') === false) {
+                        $pj = $this->value($vj[1], $data);
+                        $vjn = $vj[0];
+                    }
+                } else {
+                    $vjn = $vj;
+                }
+
+                if ($oper == true) {
+                    if (strpos($kj, 'edit') !== false) {
+                        $result .= '<a href="javascript:;" onclick="fastEdit($(this), \'' . $this->url($kj, $data['id']) . '\', \''.$vj[0].'\', \''.$vj[1].'\')"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5">' . $vj[0] . '</button></a>&nbsp;&nbsp;';
+                    } elseif (strpos($kj, 'oper') !== false) {
+                        $result .= '<a href="javascript:;" onclick="load(\'' . Dever::url($pj) . '\')"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5">' . $vj[0] . '</button></a>&nbsp;&nbsp;';
+                    } elseif (isset($vj[1]) && strpos($vj[1], 'modal|') !== false) {
+                        $t = explode('|', $vj[1]);
+                        $result .= '<a href="#dever_modal" data-toggle="modal"  class="btn btn-info btn-rounded waves-effect waves-light m-b-5" onclick=' . $t[1] . ' msg-send="' . $this->value($t[2], $data) . '">' . $vj[0] . '</a>&nbsp;&nbsp;';
+                    } elseif (isset($vj[1])) {
+                        $result .= '<a href="' . $this->url($kj, $data['id'], $pj) . '" class="oper_' . $kj . '"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5">' . $h . $vjn . '</button></a>&nbsp;&nbsp;';
+                    } else {
+                        $result .= '<span style="margin-left:5px;margin-right:10px;">' . $vj[0] . '</span>';
+                    }
+                }
+            }
+            $result .= '</'.$type.'>';
+        }
+
+        return $result;
+    }
+
     /**
      * 多级分类
      *
@@ -2019,9 +2083,10 @@ class Database
         //print_r($config['manage']['update']);die;
         $data = $this->getAdminInfo($data);
         $col = Dever::input('col');
+
         foreach ($config['struct'] as $k => $v) {
             if (isset($v['update'])) {
-                if ($col && !strstr($col, $k)) {
+                if ($col && !strstr(',' . $col . ',', ',' . $k . ',')) {
                     continue;
                 }
                 //处理权限

+ 16 - 0
src/Project.php

@@ -159,4 +159,20 @@ class Project
             }
         }
     }
+
+    /**
+     * 将昨天的signature数据删除
+     *
+     * @return string
+     */
+    public function signature()
+    {
+        $time = time() - 86400;
+
+        Dever::db('manage/signature')->deleteByDay(array('where_time' => $time));
+
+        $path = Path::month('signature');
+        $file = $path . 'signature_' . date('Y_m_d', $time);
+        unlink($file);
+    }
 }

+ 34 - 0
template/default/list/photo.php

@@ -0,0 +1,34 @@
+<?php
+/*
+|--------------------------------------------------------------------------
+| home
+|--------------------------------------------------------------------------
+*/
+
+$view
+
+->loop('#photo_list .photo_list', 'manage/database.list_photo', array
+(
+	'.dever-img' => array
+	(
+		'id' => 'dever-img-<{$v.id}>',
+
+		'img|$v.pic' => array
+		(
+			'layer-src' => '$v1.src',
+			'alt' => '$v1.name',
+			'src' => '$v1.show',
+			'style' => '<{if($v1.index == 0):}>display:block<{else:}>display:none<{endif;}>',
+		),
+	),
+
+	'.dever-desc' => '$v.desc',
+
+	'.dever-button' => '$v.button',
+))
+
+# 分页
+->fetch('#page','<{Dever::page("current")}>') 
+
+# 将上边fetch的都显示出来
+->display();