public function user_list() { $order_id = $_REQUEST['order_id']; $time = $_REQUEST['time']; $type_time = $_REQUEST['type_time']; $user_id = $_REQUEST['user_id']; $refer_user_id = $_REQUEST['refer_user_id']; if (!empty($order_id)) { $where_bill['order_id'] = array('eq', $order_id); } if (!empty($time)) { $time = explode('-', $time); $where_bill['create_time'] = array('BETWEEN', date('Y-m-d H:i:s', strtotime($time[0])), date('Y-m-d H:i:s', strtotime($time[1]))); } if (!empty($type_time)) { switch ($type_time) { case '1': //本月 $where_bill['settle_time'] = array('BETWEEN', array(date('Y-m', time()) . '-01 00:00:00', date('Y-m', time()) . '-31 23:59:59')); break; case '2': //近3个月 $ti = find_createtime(4); $where_bill['settle_time'] = array('BETWEEN', array(date('Y-m-d H:i:s', $ti['createtime'][0]), date('Y-m-d H:i:s', $ti['createtime'][1]))); break; case '3': //近一年 $ti = find_createtime(5); $where_bill['settle_time'] = array('BETWEEN', array(date('Y-m-d H:i:s', $ti['createtime'][0]), date('Y-m-d H:i:s', $ti['createtime'][1]))); break; } } $where_bill['user_id'] = array('eq', $user_id); $where_bill['user_ref_share_user_id'] = array('eq', $refer_user_id); $table = M('order')->alias('a')->field('a.shop_serve_share_price,a.order_id,a.settle_time as create_time,(select mobile from ' . C("DB_PREFIX") . 'user where user_id = a.user_id),a.order_total_price,a.user_ref_share_price,(select shop_name from ' . C("DB_PREFIX") . 'shop where shop_id = a.shop_id) as shop_name ,(select (select city_name from ' . C("DB_PREFIX") . 'city where city_id = sp.city_id) from ' . C("DB_PREFIX") . 'shop as sp where sp.shop_id = a.shop_id) as city_name ,(select (select column_name from ' . C("DB_PREFIX") . 'column where column_id = sp.column_id) from ' . C("DB_PREFIX") . 'shop as sp where sp.shop_id = a.shop_id) as column_name ')->order('a.settle_time desc'); $list_bill = select_table($table, $where_bill, $_REQUEST['pageNumber']); $total = M('order')->where($where_bill)->sum('user_ref_share_price'); //推荐总收益 if (!$total) { $total = 0; } $this->assign('mobile', M('user')->where(array('user_id' => array('eq', $refer_user_id)))->getField('mobile')); $this->assign('total', $total); $this->assign('list', $list_bill); $id = $_GET['shop_id']; $shopModel = M('Shop'); $where = array(); if ($id) { $where['shop_id'] = $id; } $data = $shopModel->where($where)->find(); $this->assign('shop', $data); $this->assign('search_order_id', $order_id); $this->display(); }
public function checkShop() { $where_bill = array(); $name = I('name'); $time = I('time'); $type_time = I('type_time'); $user_id = I('user_id'); $refer_user_id = I('refer_user_id'); if (!empty($name)) { $where_bill['order_id'] = array('eq', $name); } if (!empty($time)) { $time = explode('-', $time); $where_bill['order_time'] = array('BETWEEN', array(date('Y-m-d H:i:s', strtotime($time[0])), date('Y-m-d 23:59:59', strtotime($time[1])))); } if (!empty($type_time)) { switch ($type_time) { case '1': //本月 $where_bill['shop_settle_time'] = array('BETWEEN', array(date('Y-m', time()) . '-01 00:00:00', date('Y-m', time()) . '-31 23:59:59')); break; case '2': //近3个月 $ti = find_createtime(4); $where_bill['shop_settle_time'] = array('BETWEEN', array(date('Y-m-d H:i:s', $ti['createtime'][0]), date('Y-m-d H:i:s', $ti['createtime'][1]))); break; case '3': //近一年 $ti = find_createtime(5); $where_bill['shop_settle_time'] = array('BETWEEN', array(date('Y-m-d H:i:s', $ti['createtime'][0]), date('Y-m-d H:i:s', $ti['createtime'][1]))); break; } } $type = I('type'); $shop_id = M('shop')->where(array('principal_id' => array('eq', $refer_user_id)))->Field('shop_id,city_id,column_id')->find(); if ($type == 'shopAgent') { $where_bill['shop_ref_share_user_id'] = array('eq', $user_id); $where_bill['shop_id'] = array('eq', $shop_id['shop_id']); $where_bill['shop_ref_share_settle_flag'] = array('eq', 1); $table = M('order')->alias('a')->field('a.shop_ref_share_price,a.order_id,a.shop_settle_time as create_time,(select mobile from ' . C("DB_PREFIX") . 'user where user_id = a.user_id) as mobile,a.order_total_price')->order('a.shop_settle_time desc'); $list_bill = select_table($table, $where_bill, I('pageNumber')); $total = M('order')->where($where_bill)->sum('shop_ref_share_price'); //推荐总收益 $agent['status'] = 4; } else { $where_bill['shop_id'] = array('eq', $shop_id['shop_id']); $where_bill['operator_share_user_id'] = array('eq', $user_id); $total = M('order')->where($where_bill)->sum('operator_share_price'); //推荐总收益 $table = M('order')->alias('a')->field('a.operator_share_price,a.order_id,a.shop_settle_time as create_time,(select mobile from ' . C("DB_PREFIX") . 'user where user_id = a.user_id) as mobile,a.order_total_price')->order('a.shop_settle_time desc'); $list_bill = select_table($table, $where_bill, I('pageNumber')); $agent['status'] = 1; } $this->assign('username', M('user')->where(array('user_id' => array('eq', $refer_user_id)))->getField('username')); $this->assign('area', M('city')->where(array('city_id' => array('eq', $shop_id['city_id'])))->getField('city_name')); $this->assign('column', M('column')->where(array('column_id' => array('eq', $shop_id['column_id'])))->getField('column_name')); $this->assign('total', $total); $this->assign('status', $agent['status']); $this->assign('list', $list_bill); $this->display(); }
public function check_tshoplist() { $user_id = I('uid'); $tshop_id = I('tshop_id'); $name = I('name'); $time = I('time'); $type_time = I('type_time'); $this->assign('uid', $user_id); $this->assign('type', I('type')); $this->assign('tshop_id', $tshop_id); $refer_shop_id = $tshop_id; if (!empty($name)) { $where_bill['order_id'] = array('eq', $name); } if (!empty($time)) { $time = explode('-', $time); $where_bill['order_time'] = array('BETWEEN', array(date('Y-m-d H:i:s', strtotime($time[0])), date('Y-m-d H:i:s', strtotime($time[1])))); } if (!empty($type_time)) { switch ($type_time) { case '1': //本月 $where_bill['create_time'] = array('BETWEEN', array(date('Y-m', time()) . '-01 00:00:00', date('Y-m', time()) . '-31 23:59:59')); break; case '2': //近3个月 $ti = find_createtime(4); $where_bill['create_time'] = array('BETWEEN', array(date('Y-m-d H:i:s', $ti['createtime'][0]), date('Y-m-d H:i:s', $ti['createtime'][1]))); break; case '3': //近一年 $ti = find_createtime(5); $where_bill['create_time'] = array('BETWEEN', array(date('Y-m-d H:i:s', $ti['createtime'][0]), date('Y-m-d H:i:s', $ti['createtime'][1]))); break; } } $where_bill['shop_id'] = array('eq', $refer_shop_id); $where_bill['shop_ref_share_user_id'] = array('eq', $user_id); $table = M('order')->alias('a')->field('a.shop_ref_share_price,a.order_id,a.shop_settle_time as create_time,(select mobile from ' . C("DB_PREFIX") . 'user where user_id = a.user_id),a.order_total_price,(select shop_name from ' . C("DB_PREFIX") . 'shop where shop_id = a.shop_id) as shop_name ,(select (select city_name from ' . C("DB_PREFIX") . 'city where city_id = sp.city_id) from ' . C("DB_PREFIX") . 'shop as sp where sp.shop_id = a.shop_id) as city_name ,(select (select column_name from ' . C("DB_PREFIX") . 'column where column_id = sp.column_id) from ' . C("DB_PREFIX") . 'shop as sp where sp.shop_id = a.shop_id) as column_name ')->order('a.shop_settle_time desc'); $list_bill = select_table($table, $where_bill, I('pageNumber')); $total = M('order')->where($where_bill)->sum('user_ref_share_price'); //推荐总收益 //$this->assign('area',M('city')->where(array('city_id'=>array('eq',$shop_id['city_id'])))->getField('city_name')); //$this->assign('column',M('column')->where(array('column_id'=>array('eq',$shop_id['column_id'])))->getField('column_name')); $principal_id = M('shop')->where(array('shop_id' => array('eq', $refer_shop_id)))->getField('principal_id'); $this->assign('username', M('user')->where(array('user_id' => array('eq', $principal_id)))->getField('username')); $this->assign('total', $total); $this->assign('list', $list_bill); $list = $this->getUserAddress($user_id); $this->assign('addressList', $list); $cach_info = $this->getCach($user_id); $this->assign('cach_info', $cach_info); $this->data_info(); $this->display(); }