123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <?php
- namespace app\home\controller;
- use think\facade\View;
- use think\facade\Lang;
- class Seller extends BaseSeller
- {
- public function initialize()
- {
- parent::initialize();
- Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/seller.lang.php');
- }
-
- public function index()
- {
-
- $store_info = $this->store_info;
- $store_info['reopen_tip'] = FALSE;
- if (intval($store_info['store_endtime']) > 0) {
- $store_info['store_endtime_text'] = date('Y-m-d', $store_info['store_endtime']);
- $reopen_time = $store_info['store_endtime'] - 3600 * 24 + 1 - TIMESTAMP;
- if (!session('is_platform_store') && $store_info['store_endtime'] - TIMESTAMP >= 0 && $reopen_time < 2592000) {
-
- $store_info['reopen_tip'] = true;
- }
- } else {
- $store_info['store_endtime_text'] = lang('store_no_limit');
- }
-
- $store_info['grade_name'] = $this->store_grade['storegrade_name'];
- $store_info['grade_goodslimit'] = $this->store_grade['storegrade_goods_limit'];
- $store_info['grade_albumlimit'] = $this->store_grade['storegrade_album_limit'];
- View::assign('store_info', $store_info);
-
- $help_model = model('help');
- $condition = array();
- $condition[] = array('helptype_show', '=', '1');
- $help_list = $help_model->getStoreHelptypeList($condition, '', 6);
- View::assign('help_list', $help_list);
-
- $field = ' COUNT(*) as ordernum,SUM(order_amount) as orderamount ';
- $where = array();
- $where[] = array('store_id', '=', session('store_id'));
- $where[] = array('order_isvalid', '=', 1);
-
- $where[] = array('order_add_time', 'between', array(strtotime(date('Y-m-d', (TIMESTAMP - 3600 * 24))), strtotime(date('Y-m-d', TIMESTAMP)) - 1));
- $daily_sales = model('stat')->getoneByStatorder($where, $field);
- View::assign('daily_sales', $daily_sales);
- $where = array();
- $where[] = array('store_id', '=', session('store_id'));
- $where[] = array('order_isvalid', '=', 1);
-
- $where[] = array('order_add_time', '>', strtotime(date('Y-m', TIMESTAMP)));
- $monthly_sales = model('stat')->getoneByStatorder($where, $field);
- View::assign('monthly_sales', $monthly_sales);
- unset($field, $where);
-
-
- $stime = strtotime(date('Y-m-d', (TIMESTAMP - 3600 * 24))) - (86400 * 29);
- $etime = strtotime(date('Y-m-d', TIMESTAMP)) - 1;
- $where = array();
- $where[] = array('store_id', '=', session('store_id'));
- $where[] = array('order_isvalid', '=', 1);
- $where[] = array('order_add_time', 'between', array($stime, $etime));
- $field = ' goods_id,goods_name,SUM(goods_num) as goodsnum,goods_image ';
- $orderby = 'goodsnum desc,goods_id';
- $goods_list = model('stat')->statByStatordergoods($where, $field, 0, 8, $orderby, 'goods_id');
- unset($stime, $etime, $where, $field, $orderby);
- View::assign('goods_list', $goods_list);
- if (!session('is_platform_store')) {
- if (config('ds_config.groupbuy_allow') == 1) {
-
- $groupquota_info = model('groupbuyquota')->getGroupbuyquotaCurrent(session('store_id'));
- View::assign('groupquota_info', $groupquota_info);
- }
- if (intval(config('ds_config.promotion_allow')) == 1) {
-
- $xianshiquota_info = model('pxianshiquota')->getXianshiquotaCurrent(session('store_id'));
- View::assign('xianshiquota_info', $xianshiquota_info);
-
- $mansongquota_info = model('pmansongquota')->getMansongquotaCurrent(session('store_id'));
- View::assign('mansongquota_info', $mansongquota_info);
-
- $binglingquota_info = model('pbundling')->getBundlingQuotaInfoCurrent(session('store_id'));
- View::assign('binglingquota_info', $binglingquota_info);
-
- $boothquota_info = model('pbooth')->getBoothquotaInfoCurrent(session('store_id'));
- View::assign('boothquota_info', $boothquota_info);
- }
- if (config('ds_config.voucher_allow') == 1) {
- $voucherquota_info = model('voucher')->getVoucherquotaCurrent(session('store_id'));
- View::assign('voucherquota_info', $voucherquota_info);
- }
- } else {
- View::assign('isPlatformStore', true);
- }
- $phone_array = explode(',', config('ds_config.site_phone'));
- View::assign('phone_array', $phone_array);
- View::assign('menu_sign', 'index');
-
- $this->setSellerCurMenu('seller_index');
-
- $this->setSellerCurItem();
- return View::fetch($this->template_dir . 'index');
- }
-
- public function statistics()
- {
-
-
- $goods_online = 0;
- $goods_waitverify = 0;
- $goods_verifyfail = 0;
- $goods_offline = 0;
- $goods_lockup = 0;
- $consult = 0;
- $no_payment = 0;
- $no_delivery = 0;
- $no_receipt = 0;
- $refund_lock = 0;
- $refund = 0;
- $return_lock = 0;
- $return = 0;
- $complain = 0;
- $goods_model = model('goods');
-
- $goodscount = $goods_model->getGoodsCommonCount(array('store_id' => session('store_id')));
-
- $goods_online = $goods_model->getGoodsCommonOnlineCount(array(array('store_id', '=', session('store_id'))));
- if (config('ds_config.goods_verify')) {
-
- $goods_waitverify = $goods_model->getGoodsCommonWaitVerifyCount(array(array('store_id', '=', session('store_id'))));
-
- $goods_verifyfail = $goods_model->getGoodsCommonVerifyFailCount(array(array('store_id', '=', session('store_id'))));
- }
-
- $goods_offline = $goods_model->getGoodsCommonOfflineCount(array(array('store_id', '=', session('store_id'))));
-
- $goods_lockup = $goods_model->getGoodsCommonLockUpCount(array(array('store_id', '=', session('store_id'))));
-
- $consult = model('consult')->getConsultCount(array('store_id' => session('store_id'), 'consult_reply' => ''));
-
- $imagecount = model('album')->getAlbumpicCount(array('store_id' => session('store_id')));
- $order_model = model('order');
-
- $progressing = $order_model->getOrderCountByID('store', session('store_id'), 'TradeCount');
-
- $no_payment = $order_model->getOrderCountByID('store', session('store_id'), 'NewCount');
-
- $no_delivery = $order_model->getOrderCountByID('store', session('store_id'), 'PayCount');
- $refundreturn_model = model('refundreturn');
-
- $condition = array();
- $condition[] = array('store_id', '=', session('store_id'));
- $condition[] = array('refund_type', '=', 1);
- $condition[] = array('order_lock', '=', 2);
- $condition[] = array('refund_state', '<', 3);
- $refund_lock = $refundreturn_model->getRefundreturnCount($condition);
-
- $condition = array();
- $condition[] = array('store_id', '=', session('store_id'));
- $condition[] = array('refund_type', '=', 1);
- $condition[] = array('order_lock', '=', 1);
- $condition[] = array('refund_state', '<', 3);
- $refund = $refundreturn_model->getRefundreturnCount($condition);
-
- $condition = array();
- $condition[] = array('store_id', '=', session('store_id'));
- $condition[] = array('refund_type', '=', 2);
- $condition[] = array('order_lock', '=', 2);
- $condition[] = array('refund_state', '<', 3);
- $return_lock = $refundreturn_model->getRefundreturnCount($condition);
-
- $condition = array();
- $condition[] = array('store_id', '=', session('store_id'));
- $condition[] = array('refund_type', '=', 2);
- $condition[] = array('order_lock', '=', 1);
- $condition[] = array('refund_state', '<', 3);
- $return = $refundreturn_model->getRefundreturnCount($condition);
- $condition = array();
- $condition[] = array('accused_id', '=', session('store_id'));
- $condition[] = array('complain_state', 'between', array(10, 90));
- $complain_mod = model('complain');
- $complain = $complain_mod->getComplainCount($condition);
-
- $bill_model = model('bill');
- $condition = array();
- $condition[] = array('ob_store_id', '=', session('store_id'));
- $condition[] = array('ob_state', '=', BILL_STATE_CREATE);
- $bill_confirm_count = $bill_model->getOrderbillCount($condition);
-
- $statistics = array(
- 'goodscount' => $goodscount,
- 'online' => $goods_online,
- 'waitverify' => $goods_waitverify,
- 'verifyfail' => $goods_verifyfail,
- 'offline' => $goods_offline,
- 'lockup' => $goods_lockup,
- 'imagecount' => $imagecount,
- 'consult' => $consult,
- 'progressing' => $progressing,
- 'payment' => $no_payment,
- 'delivery' => $no_delivery,
- 'refund_lock' => $refund_lock,
- 'refund' => $refund,
- 'return_lock' => $return_lock,
- 'return' => $return,
- 'complain' => $complain,
- 'bill_confirm' => $bill_confirm_count
- );
- exit(json_encode($statistics));
- }
- }
|