123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- <?php
- namespace app\api\controller;
- class Sellerindex extends MobileSeller {
- public function initialize() {
- parent::initialize();
- }
-
- public function index() {
- $seller_info = array();
- $seller_info = $this->seller_info;
- $store_info = $this->store_info;
-
- $seller_info['last_logintime_fmt'] = date('Y-m-d H:i:s', $seller_info['last_logintime']);
- $order_model = model('order');
-
- $seller_info['order_nopay_count'] = intval($order_model->getOrderCountByID('store', $store_info['store_id'], 'NewCount'));
-
- $seller_info['order_noship_count'] = intval($order_model->getOrderCountByID('store', $store_info['store_id'], 'PayCount'));
-
- $seller_info['order_noreceipt_count'] = intval($order_model->getOrderCountByID('store', $store_info['store_id'], 'SendCount'));
- $goods_model = model('goods');
-
- $seller_info['goods_online'] = $goods_model->getGoodsCommonOnlineCount(array(array('store_id' ,'=', $store_info['store_id'])));
-
- $seller_info['goods_offline'] = $goods_model->getGoodsCommonOfflineCount(array(array('store_id' ,'=', $store_info['store_id'])));
-
- $seller_info['goods_lockup'] = $goods_model->getGoodsCommonLockUpCount(array(array('store_id' ,'=', $store_info['store_id'])));
-
- $store_info['store_avatar'] = get_store_logo($store_info['store_avatar'], 'store_avatar');
-
- $store_info['store_logo'] = get_store_logo($store_info['store_logo'], 'store_logo');
-
- $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'];
-
- $field = 'COUNT(*) as ordernum,SUM(order_amount) as orderamount';
- $where = array();
- $where[] = array('store_id', '=', $this->store_info['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);
-
- $where[] = array('order_add_time', '>', strtotime(date('Y-m', TIMESTAMP)));
- $monthly_sales = model('stat')->getoneByStatorder($where, $field);
- $store_info['daily_sales'] = $daily_sales;
- $store_info['monthly_sales'] = $monthly_sales;
-
- $statics = $this->getStatics();
- ds_json_encode(10000, '', array('seller_info' => $seller_info, 'store_info' => $store_info, 'statics' => $statics));
- }
-
- private function getStatics() {
- $add_time_to = strtotime(date("Y-m-d")) + 60 * 60 * 24;
- $add_time_from = strtotime(date("Y-m-d", (strtotime(date("Y-m-d")) - 60 * 60 * 24 * 30)));
- $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' => $this->store_info['store_id']));
-
- $goods_online = $goods_model->getGoodsCommonOnlineCount(array(array('store_id' ,'=', $this->store_info['store_id'])));
- if (config('ds_config.goods_verify')) {
-
- $goods_waitverify = $goods_model->getGoodsCommonWaitVerifyCount(array(array('store_id' ,'=', $this->store_info['store_id'])));
-
- $goods_verifyfail = $goods_model->getGoodsCommonVerifyFailCount(array(array('store_id' ,'=', $this->store_info['store_id'])));
- }
-
- $goods_offline = $goods_model->getGoodsCommonOfflineCount(array(array('store_id' ,'=', $this->store_info['store_id'])));
-
- $goods_lockup = $goods_model->getGoodsCommonLockUpCount(array(array('store_id' ,'=', $this->store_info['store_id'])));
-
- $consult = model('consult')->getConsultCount(array('store_id' => $this->store_info['store_id'], 'consult_reply' => ''));
-
- $imagecount = model('album')->getAlbumpicCount(array('store_id' => $this->store_info['store_id']));
- $order_model = model('order');
-
- $progressing = $order_model->getOrderCountByID('store', $this->store_info['store_id'], 'TradeCount');
-
- $no_payment = $order_model->getOrderCountByID('store', $this->store_info['store_id'], 'NewCount');
-
- $no_delivery = $order_model->getOrderCountByID('store', $this->store_info['store_id'], 'PayCount');
- $refundreturn_model = model('refundreturn');
-
- $condition = array();
- $condition[] = array('store_id', '=', $this->store_info['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', '=', $this->store_info['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', '=', $this->store_info['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', '=', $this->store_info['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', '=', $this->store_info['store_id']);
- $condition[] = array('complain_state', 'between', array(10, 90));
- $complain_model = model('complain');
- $complain = $complain_model->getComplainCount($condition);
-
- $bill_model = model('bill');
- $condition = array();
- $condition[] = array('ob_store_id','=',$this->store_info['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
- );
- return $statistics;
- }
- }
- ?>
|