123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <?php
- # 获取电子刊分类权限
- $auth = Dever::tops();
- # 如果用linkage,那么下面这两个用不上了
- $journal = function() use ($auth)
- {
- $array = array();
- if ($auth) {
- $info = Dever::db('journal/info')->getIds(array('cate_id' => $auth, 'buy' => 1));
- } else {
- $info = Dever::db('journal/info')->state(array('buy' => 1));
- }
-
- if($info)
- {
- $array += $info;
- }
- return $array;
- };
- $cate = function() use ($auth)
- {
- $array = array();
- if ($auth) {
- $info = Dever::db('journal/cate')->getIds(array('ids' => $auth));
- } else {
- $info = Dever::db('journal/cate')->state();
- }
-
- if($info)
- {
- $array += $info;
- }
- return $array;
- };
- $zhou = Dever::input('search_zhou');
- if ($zhou) {
- $group = 'cate_id';
- } else {
- $group = 'day_int,cate_id';
- }
- $list = array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'start_day_int' => array('yes-day_int', '>='),
- 'end_day_int' => array('yes-day_int', '<='),
- 'cate_id' => 'yes',
- 'journal_id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('day_int' => 'desc', 'id' => 'desc'),
- 'group' => $group,
- 'page' => array(20, 'list'),
- //'col' => 'id,sum(order_num) as order_num,sum(order_yes_num) as order_yes_num,sum(order_no_num) as order_no_num,sum(buy_num) as buy_num,sum(buy_cash) as buy_cash,cdate,journal_id,day_int,day_string,cate_id',
- 'col' => 'id,sum(order_yes_num) as order_yes_num,sum(buy_num) as buy_num,sum(buy_cash) as buy_cash,cdate,journal_id,day_int,day_string,cate_id',
- );
- //$search = Dever::input('search_option_journal_id');
- $search = Dever::input('search_linkage_cate_journal');
- $groupState = false;
- if ($search) {
- if ($search != -1 && isset($search[1]) && $search[1] > 0) {
- $list['option']['journal_id'] = $search[1];
- Dever::setInput('search_option_journal_id', $search[1]);
- } elseif (isset($search[0]) && $search[0] == -1) {
- Dever::setInput('search_option_journal_id', 0);
- $groupState = true;
- } else {
- $groupState = true;
- }
- } else {
- $groupState = true;
- }
- if (!$zhou && !$groupState) {
- unset($list['group']);
- $list['col'] = '*';
- }
- if ($auth) {
- $list['option']['cate_id'] = array($auth, 'in');
- }
- return array
- (
- # 表名
- 'name' => 'journal',
- # 显示给用户看的名称
- 'lang' => '电子刊订单统计',
- 'order' => '10',
- # 数据结构
- 'struct' => array
- (
-
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => 'ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- //'list' => true,
- ),
- 'day_string' => array
- (
- 'type' => 'varchar-60',
- 'name' => '统计日期',
- 'default' => '',
- 'desc' => '统计日期',
- 'match' => 'is_string',
- 'update' => 'text',
- //'search' => 'fulltext',
- 'list' => $zhou ? false : true,
- ),
- 'day_int' => array
- (
- 'type' => 'int-11',
- 'name' => '统计日期',
- 'default' => '',
- 'desc' => '统计日期',
- 'match' => 'is_numeric',
- 'update' => 'text',
- 'search' => 'time',
- 'order' => 'desc',
- //'list' => true,
- ),
- 'cate_journal' => array
- (
- 'name' => '电子刊',
- 'default' => '',
- 'desc' => '电子刊',
- 'search' => 'linkage',
- 'search_col' => 'cate_id,product_id',
- 'option' => Dever::url('lib/manage.search_cate_journal', 'journal'),
- ),
- 'cate_id' => array
- (
- 'type' => 'int-11',
- 'name' => '电子刊分类',
- 'default' => '1',
- 'desc' => '电子刊分类',
- 'match' => 'is_numeric',
- 'update' => 'select',
- 'option' => $cate,
- //'search' => 'select',
- 'list' => true,
- ),
- 'journal_id' => array
- (
- 'type' => 'int-11',
- 'name' => '电子刊',
- 'default' => '',
- 'desc' => '电子刊',
- 'match' => 'is_numeric',
- 'update' => 'select',
- //'search' => 'select',
- 'option' => $journal,
- 'list' => $zhou ? false : 'Dever::load("stat/lib/manage.info", {journal_id})',
- ),
- 'order_num' => array
- (
- 'type' => 'int-11',
- 'name' => '总订单',
- 'default' => '0',
- 'match' => '总订单数',
- 'match' => 'is_numeric',
- 'update' => 'text',
- //'list' => true,
- ),
- 'order_yes_num' => array
- (
- 'type' => 'int-11',
- 'name' => '支付订单',
- 'default' => '0',
- 'match' => '支付订单数',
- 'match' => 'is_numeric',
- 'update' => 'text',
- 'list' => true,
- ),
- 'order_no_num' => array
- (
- 'type' => 'int-11',
- 'name' => '未支付订单',
- 'default' => '0',
- 'match' => '未支付订单数',
- 'match' => 'is_numeric',
- 'update' => 'text',
- //'list' => true,
- ),
- 'buy_num' => array
- (
- 'type' => 'int-11',
- 'name' => '售出本数',
- 'default' => '0',
- 'match' => '售出本数',
- 'match' => 'is_numeric',
- 'update' => 'text',
- 'list' => true,
- ),
- 'buy_cash' => array
- (
- 'type' => 'int-11',
- 'name' => '售出金额',
- 'default' => '0',
- 'match' => '售出金额',
- 'match' => 'is_numeric',
- 'update' => 'text',
- 'list' => true,
- ),
- 'state' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '状态',
- 'default' => '1',
- 'desc' => '请选择状态',
- 'match' => 'is_numeric',
- ),
-
- 'cdate' => array
- (
- 'type' => 'int-11',
- 'name' => '上次统计时间',
- 'match' => array('is_numeric', time()),
- 'desc' => '',
- # 只有insert时才生效
- 'insert' => true,
- //'search' => 'date',
- 'list' => 'date("Y-m-d H:i", {cdate})',
- ),
- ),
- //'top' => Dever::config('base')->top,
- 'top_option' => array
- (
- array
- (
- 'value' => $auth,
- 'col' => 'cate_id',
- ),
- array
- (
- 'value' => Dever::load('manage/auth.authData'),
- 'col' => 'id',
- ),
- ),
- 'manage' => array
- (
- 'insert' => false,
- 'edit' => false,
- 'delete' => false,
- 'num' => false,
- 'excel' => true,
- //'page_list' => 'journal',
- ),
- 'request' => array
- (
- 'list' => $list,
- 'getData' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'start' => array('yes-day_int', '>='),
- 'end' => array('yes-day_int', '<='),
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('day_int' => 'desc'),
- //'group' => 'day_int',
- 'col' => '*',
- ),
- 'getNumByJournal' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'journal_id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'one',
- //'group' => 'day_int',
- 'col' => 'sum(buy_num) as buy_num',
- ),
- ),
- );
|