Esempio n. 1
0
 /**
  * @brief 保存品牌分类
  */
 function category_save()
 {
     $category_id = IFilter::act(IReq::get('category_id'), 'int');
     $name = IFilter::act(IReq::get('name'));
     $category_info = array();
     $tb_brand_category = new IModel('brand_category');
     $category_info['name'] = $name;
     $tb_brand_category->setData($category_info);
     if ($category_id) {
         $where = "id=" . $category_id;
         $tb_brand_category->update($where);
     } else {
         $tb_cate = new IQuery('brand_category');
         //查询数据库,判断该分类是否存在,如存在则不存储
         $tb_cate->fields = 'name';
         $tb_info = $tb_cate->find();
         if (count($tb_info) > 0) {
             foreach ($tb_info as $value) {
                 if ($category_info['name'] == $value['name']) {
                     $this->redirect('category_edit', false);
                     Util::showMessage("添加的品牌分类已存在!");
                 }
             }
         }
         $tb_brand_category->add();
     }
     $this->category_list();
 }
Esempio n. 2
0
 /**
  * @brief 获取所有已添加的支付插件
  * @return array 返回支付插件
  */
 public function paymentList()
 {
     $query = new IQuery('payment as a');
     $query->join = " join pay_plugin as b on a.plugin_id = b.id";
     $query->fields = " a.id,a.plugin_id,a.name,a.status,b.description,b.logo ";
     $list = $query->find();
     return $list;
 }
Esempio n. 3
0
 public function getPropTongJi($propIds)
 {
     $query = new IQuery('prop');
     $query->fields = "count(id) as prop_num";
     $query->where = "id in (" . $propIds . ") and type = 0";
     $info = $query->find();
     return $info[0];
 }
Esempio n. 4
0
 /**
  * @brief 获取订单信息
  * @param $orderId int 订单ID
  * @return array 订单信息
  */
 private static function getOrderInfo($orderId)
 {
     $orderDB = new IQuery('order as o');
     $orderDB->fields = 'p.class_name,o.trade_no,dd.delivery_code,fc.freight_type,o.pay_type';
     $orderDB->join = 'left join payment as p on o.pay_type = p.id left join delivery_doc as dd on o.id = dd.order_id left join delivery as d on d.id = o.distribution left join freight_company as fc on fc.id = dd.freight_id';
     $orderDB->where = 'o.id = ' . $orderId;
     $result = $orderDB->find();
     return current($result);
 }
Esempio n. 5
0
 private function setUser($user_id)
 {
     $user_id = intval($user_id);
     $query = new IQuery("user AS u");
     $query->join = "left join member AS m ON u.id = m.user_id";
     $query->where = "u.id = {$user_id} ";
     $user = $query->find();
     if (!$user) {
         $this->error[] = "没有id为{$user_id}的用户";
     } else {
         $this->user = current($user);
         $this->time = date('Y-m-d H:i:s');
     }
 }
Esempio n. 6
0
 /**
  * @brief 添加会员
  */
 function member_edit()
 {
     $uid = IFilter::act(IReq::get('uid'), 'int');
     //编辑会员信息读取会员信息
     if ($uid) {
         $userDB = new IQuery('user as u');
         $userDB->join = 'left join member as m on u.id = m.user_id';
         $userDB->where = 'u.id = ' . $uid;
         $userInfo = $userDB->find();
         if ($userInfo) {
             $this->userInfo = current($userInfo);
         } else {
             $this->member_list();
             Util::showMessage("没有找到相关记录!");
             exit;
         }
     }
     $this->redirect('member_edit');
 }
Esempio n. 7
0
 public function getBrandListByGoodsCategoryId($id, $limit = 14)
 {
     $result = array();
     $tb_brand_category = new IModel('brand_category');
     $info = $tb_brand_category->query("goods_category_id=" . $id);
     if ($info) {
         $query = new IQuery('brand');
         foreach ($info as $key => $val) {
             $query->where = " FIND_IN_SET(" . $val['id'] . ",category_ids) ";
             $query->order = 'sort asc';
             $query->limit = $limit;
             $list = $query->find();
             $result = array_merge($result, $list);
             if (count($result) >= $limit) {
                 $result = array_slice($result, 0, $limit);
                 break;
             }
         }
     }
     return $result;
 }
Esempio n. 8
0
 /**
  * 获取某个商品的有关分数的评论数据
  *
  * 获取好评、中评、差评数量及平均分
  * 返回的值里包含以下几个计算出来的索引
  *	<ul>
  *		<li>point_total,总分</li>
  *		<li>comment_total,评论总数</li>
  *		<li>average_point,平均分</li>
  *	</ul>
  *
  * @param int $id  goods_id
  * @return array()
  */
 public static function get_comment_info($id)
 {
     $data = array();
     $query = new IQuery("comment");
     $query->fields = "COUNT(*) AS num,point";
     $query->where = "goods_id = {$id} AND status=1 ";
     $query->group = "point";
     $data['point_grade'] = array('none' => 0, 'good' => 0, 'middle' => 0, 'bad' => 0);
     $config = array(0 => 'none', '1' => 'bad', '2' => 'middle', 3 => 'middle', 4 => 'middle', 5 => 'good');
     $data['point_total'] = 0;
     foreach ($query->find() as $value) {
         if ($value['point'] >= 0 && $value['point'] <= 5) {
             $data['point_total'] += $value['point'] * $value['num'];
             $data['point_grade'][$config[$value['point']]] += $value['num'];
         }
     }
     $data['comment_total'] = array_sum($data['point_grade']);
     $data['average_point'] = 0;
     if ($data['point_total'] > 0) {
         $data['average_point'] = round($data['point_total'] / $data['comment_total'], 1);
     }
     return $data;
 }
Esempio n. 9
0
 function refundment_show()
 {
     //获得post传来的退款单id值
     $refundment_id = IFilter::act(IReq::get('id'), 'int');
     $data = array();
     if ($refundment_id) {
         $tb_refundment = new IQuery('refundment_doc as c');
         $tb_refundment->join = ' left join order as o on c.order_id=o.id left join user as u on u.id = c.user_id';
         $tb_refundment->fields = 'o.order_no,o.create_time,u.username,c.*';
         $tb_refundment->where = 'c.id=' . $refundment_id . ' and seller_id = ' . $this->seller['seller_id'];
         $refundment_info = $tb_refundment->find();
         if ($refundment_info) {
             $data = current($refundment_info);
             $this->setRenderData($data);
             $this->redirect('refundment_show', false);
         }
     }
     if (!$data) {
         $this->redirect('refundment_list');
     }
 }
Esempio n. 10
0
 public static function getGoodsCategoryId($goods_id)
 {
     $gcQuery = new IQuery('category_extend as ce');
     $gcQuery->join = "left join category as c on c.id = ce.category_id";
     $gcQuery->where = "ce.goods_id = '{$goods_id}'";
     $gcQuery->fields = 'c.id';
     $gcList = $gcQuery->find();
     $strCategoryIds = '';
     foreach ($gcList as $val) {
         $strCategoryIds .= $val['id'] . ',';
     }
     unset($gcQuery, $gcList);
     return $strCategoryIds;
 }
Esempio n. 11
0
	</div>
</div>

<script type='text/javascript'>
//DOM加载完毕
$(function(){
	//默认系统定义
	select_tab("<?php 
echo isset($this->confRow['form_index']) ? $this->confRow['form_index'] : "";
?>
");
	show_mail(1);

	//生成导航
	<?php 
$query = new IQuery("guide");
$guideList = $query->find();
foreach ($guideList as $key => $item) {
}
?>
	<?php 
if ($guideList) {
    ?>
	var guideList = <?php 
    echo JSON::encode($guideList);
    ?>
;
	for(var index in guideList)
	{
		add_guide(guideList[index]);
	}
Esempio n. 12
0
 /**
  * @brief 单纯数据库查询api统一处理方法
  * @param array $queryInfo 数据查询配置信息
  * @param array $aguments  排序和限制条数(order,limit)
  * @return array
  */
 private static function query($queryInfo, $aguments)
 {
     //参数重置order,limit参数
     if (!empty($aguments)) {
         foreach ($aguments as $param) {
             if (is_numeric($param)) {
                 $queryInfo['limit'] = $param;
             } else {
                 if (is_array($param)) {
                     //分页模式
                     if ($param[0] == 'page') {
                         unset($queryInfo['limit']);
                         $queryInfo['page'] = $param[1];
                     } else {
                         $queryInfo['where'] = strtr($queryInfo['where'], array($param[0] => $param[1]));
                     }
                 } else {
                     $queryInfo['order'] = str_replace(array('+', '-'), array(' asc', ' desc'), $param);
                 }
             }
         }
     }
     $tableObj = new IQuery($queryInfo['name']);
     unset($queryInfo['name']);
     foreach ($queryInfo as $key => $val) {
         $tableObj->{$key} = $val;
     }
     //存在分页
     if (isset($queryInfo['page']) && $queryInfo['page']) {
         return $tableObj;
     } else {
         $dataResult = $tableObj->find();
         if (isset($queryInfo['type']) && $queryInfo['type'] == 'row' && $dataResult) {
             $dataResult = current($dataResult);
         }
         return $dataResult;
     }
 }
Esempio n. 13
0
 /**
  * @brief 用户筛选
  */
 function member_filter()
 {
     $search = IFilter::string(IReq::get('search'));
     $keywords = IFilter::string(IReq::get('keywords'));
     $where = ' 1 ';
     if ($search && $keywords) {
         $where .= " and {$search} like '%{$keywords}%' ";
     }
     $this->data['search'] = $search;
     $this->data['keywords'] = $keywords;
     $this->data['where'] = $where;
     $tb_user_group = new IModel('user_group');
     $data_group = $tb_user_group->query();
     $data_group = is_array($data_group) ? $data_group : array();
     $group = array();
     foreach ($data_group as $value) {
         $group[$value['id']] = $value['group_name'];
     }
     $this->data['group'] = $group;
     $page = IReq::get('page');
     $page = intval($page) ? intval($page) : 1;
     $and = ' and ';
     $where = 'm.status="1"' . $and;
     $group_key = IFilter::string(IReq::get('group_key'));
     $group_v = IFilter::act(IReq::get('group_value'), 'int');
     if ($group_key && $group_v) {
         if ($group_key == 'eq') {
             $where .= "m.group_id='{$group_v}' {$and}";
         } else {
             $where .= "m.group_id!='{$group_v}' {$and} ";
         }
     }
     $username_key = IFilter::string(IReq::get('username_key'));
     $username_v = IFilter::act(IReq::get('username_value'), 'string');
     if ($username_key && $username_v) {
         if ($username_key == 'eq') {
             $where .= "u.username='******' {$and}";
         } else {
             $where .= 'u.username like "%' . $username_v . '%"' . $and;
         }
     }
     $truename_key = IFilter::string(IReq::get('truename_key'));
     $truename_v = IFilter::act(IReq::get('truename_value'), 'string');
     if ($truename_key && $truename_v) {
         if ($truename_key == 'eq') {
             $where .= "m.true_name='{$truename_v}' {$and}";
         } else {
             $where .= 'm.true_name like "%' . $truename_v . '%"' . $and;
         }
     }
     $mobile_key = IFilter::string(IReq::get('mobile_key'));
     $mobile_v = IFilter::act(IReq::get('mobile_value'), 'string');
     if ($mobile_key && $mobile_v) {
         if ($mobile_key == 'eq') {
             $where .= "m.mobile='{$mobile_v}' {$and} ";
         } else {
             $where .= 'm.mobile like "%' . $mobile_v . '%"' . $and;
         }
     }
     $telephone_key = IFilter::string(IReq::get('telephone_key'));
     $telephone_v = IFilter::act(IReq::get('telephone_value'), 'string');
     if ($telephone_key && $telephone_v) {
         if ($telephone_key == 'eq') {
             $where .= "m.telephone='{$telephone_v}' {$and} ";
         } else {
             $where .= 'm.telephone like "%' . $telephone_v . '%"' . $and;
         }
     }
     $email_key = IFilter::string(IReq::get('email_key'));
     $email_v = IFilter::act(IReq::get('email_value'), 'string');
     if ($email_key && $email_v) {
         if ($email_key == 'eq') {
             $where .= "u.email='{$email_v}' {$and} ";
         } else {
             $where .= 'u.email like "%' . $email_v . '%"' . $and;
         }
     }
     $zip_key = IFilter::string(IReq::get('zip_key'));
     $zip_v = IFilter::act(IReq::get('zip_value'), 'string');
     if ($zip_key && $zip_v) {
         if ($zip_key == 'eq') {
             $where .= "m.zip='{$zip_v}' {$and} ";
         } else {
             $where .= 'm.zip like "%' . $zip_v . '%"' . $and;
         }
     }
     $sex = intval(IReq::get('sex'));
     if ($sex && $sex != '-1') {
         $where .= 'm.sex=' . $sex . $and;
     }
     $point_key = IFilter::string(IReq::get('point_key'));
     $point_v = intval(IReq::get('point_value'));
     if ($point_key && $point_v) {
         if ($point_key == 'eq') {
             $where .= 'm.point= "' . $point_v . '"' . $and;
         } elseif ($point_key == 'gt') {
             $where .= 'm.point > "' . $point_v . '"' . $and;
         } else {
             $where .= 'm.point < "' . $point_v . '"' . $and;
         }
     }
     $regtimeBegin = IFilter::string(IReq::get('regtimeBegin'));
     if ($regtimeBegin) {
         $where .= 'm.time > "' . $regtimeBegin . '"' . $and;
     }
     $regtimeEnd = IFilter::string(IReq::get('regtimeEnd'));
     if ($regtimeEnd) {
         $where .= 'm.time < "' . $regtimeEnd . '"' . $and;
     }
     $where .= ' 1 ';
     $query = new IQuery("member as m");
     $query->join = "left join user as u on m.user_id = u.id left join user_group as gp on m.group_id = gp.id";
     $query->fields = "m.*,u.username,u.email,gp.group_name";
     $query->where = $where;
     $query->page = $page;
     $query->pagesize = "20";
     $this->data['member_list'] = $query->find();
     $this->data['pageBar'] = $query->getPageBar('/member/member_filter/');
     $this->setRenderData($this->data);
     $this->redirect('member_filter');
 }
Esempio n. 14
0
 function help_list()
 {
     $query = new IQuery("help AS help");
     $query->join = "LEFT JOIN help_category AS cat ON help.cat_id=cat.id";
     if (IReq::get('cat_id') !== null) {
         $query->where = "help.cat_id = " . intval(IReq::get('cat_id'));
     }
     $query->fields = "help.*,cat.name AS cat_name";
     $query->order = "help.`sort` ASC,help.id DESC";
     $query->page = isset($_GET['page']) ? $_GET['page'] : 1;
     $this->query = $query;
     $this->list = $query->find();
     $this->redirect("help_list");
 }
Esempio n. 15
0
 /**
  * @brief 商品检索,可以直接读取 $_GET 全局变量:attr,order,brand,min_price,max_price
  *        在检索商品过程中计算商品结果中的进一步属性和规格的筛选
  * @param mixed $defaultWhere string(条件) or array('search' => '模糊查找','category_extend' => '商品分类ID','字段' => 对应数据)
  * @param int $limit 读取数量
  * @param bool $isCondition 是否筛选出商品的属性,价格等数据
  * @return IQuery
  */
 public static function find($defaultWhere = '', $limit = 21, $isCondition = true)
 {
     //获取配置信息
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     $orderArray = array();
     //排序
     //开始查询
     $goodsObj = new IQuery("goods as go");
     $goodsObj->page = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $goodsObj->fields = ' go.* ';
     $goodsObj->pagesize = $limit;
     /*where条件拼接*/
     //(1),当前产品分类
     $where = ' go.is_del = 0 ';
     //(2),商品属性,规格筛选
     $attrCond = array();
     $childSql = '';
     $attrArray = IReq::get('attr') ? IFilter::act(IReq::get('attr')) : array();
     foreach ($attrArray as $key => $val) {
         if ($key && $val) {
             $attrCond[] = ' attribute_id = ' . intval($key) . ' and FIND_IN_SET("' . $val . '",attribute_value)';
         }
     }
     //合并规格与属性的值,并且生成SQL查询语句
     $GoodsId = null;
     if ($attrCond) {
         $tempArray = array();
         foreach ($attrCond as $key => $cond) {
             $tempArray[] = '(' . $cond . ')';
         }
         $childSql = join(' or ', $tempArray);
         $goodsAttrObj = new IQuery('goods_attribute');
         $goodsAttrObj->fields = 'goods_id';
         $goodsAttrObj->where = $childSql;
         $goodsAttrObj->group = 'goods_id';
         $goodsAttrObj->having = 'count(goods_id) >= ' . count($attrCond);
         //每个子条件都有一条记录,则存在几个count(条件)必须包含count(goods_id)条数量
         $goodsIdArray = $goodsAttrObj->find();
         $goodsIds = array();
         foreach ($goodsIdArray as $key => $val) {
             $goodsIds[] = $val['goods_id'];
         }
         $GoodsId = $GoodsId === null ? array_unique($goodsIds) : array_unique(array_intersect($goodsIds, $GoodsId));
     }
     //(3),处理defaultWhere条件 goods, category_extend
     if ($defaultWhere) {
         //兼容array 和 string 数据类型的goods条件筛选
         $goodsCondArray = array();
         if (is_string($defaultWhere)) {
             $goodsCondArray[] = $defaultWhere;
         } else {
             if (is_array($defaultWhere)) {
                 foreach ($defaultWhere as $key => $val) {
                     if (!$val) {
                         continue;
                     }
                     //商品分类检索
                     if ($key == 'category_extend') {
                         $currentCatGoods = array();
                         $categoryExtendObj = new IModel('category_extend');
                         $categoryExtendList = $categoryExtendObj->query("category_id in (" . $val . ")", 'goods_id', 'id', 'desc');
                         foreach ($categoryExtendList as $key => $val) {
                             $currentCatGoods[] = $val['goods_id'];
                         }
                         $GoodsId = $GoodsId === null ? array_unique($currentCatGoods) : array_unique(array_intersect($currentCatGoods, $GoodsId));
                     } else {
                         if ($key == 'search') {
                             $wordWhere = array();
                             $wordLikeOrder = array();
                             //检查输入的内容是否为分词形式
                             if (preg_match("#\\s+#", $defaultWhere['search']) == false) {
                                 $wordWhere[] = ' name like "%' . $defaultWhere['search'] . '%" or find_in_set("' . $defaultWhere['search'] . '",search_words) ';
                                 $wordLikeOrder[] = $defaultWhere['search'];
                             }
                             //进行分词
                             if (IString::getStrLen($defaultWhere['search']) >= 4 || IString::getStrLen($defaultWhere['search']) <= 100) {
                                 $wordData = words_facade::run($defaultWhere['search']);
                                 if (isset($wordData['data']) && count($wordData['data']) >= 2) {
                                     foreach ($wordData['data'] as $word) {
                                         $wordWhere[] = ' name like "%' . $word . '%" ';
                                         $wordLikeOrder[] = $word;
                                     }
                                 }
                             }
                             //分词排序
                             if (count($wordLikeOrder) > 1) {
                                 $orderTempArray = array();
                                 foreach ($wordLikeOrder as $key => $val) {
                                     $orderTempArray[] = "(CASE WHEN name LIKE '%" . $val . "%' THEN " . $key . " ELSE 100 END)";
                                 }
                                 $orderArray[] = " (" . join('+', $orderTempArray) . ") asc ";
                             }
                             $goodsCondArray[] = join(' or ', $wordWhere);
                         } else {
                             $goodsCondArray[] = $key . ' = "' . $val . '"';
                         }
                     }
                 }
             }
         }
         //goods 条件
         if ($goodsCondArray) {
             $goodsDB = new IModel('goods as go');
             $goodsCondData = $goodsDB->query(join(" and ", $goodsCondArray), "id");
             $goodsCondId = array();
             foreach ($goodsCondData as $key => $val) {
                 $goodsCondId[] = $val['id'];
             }
             $GoodsId = $GoodsId === null ? array_unique($goodsCondId) : array_unique(array_intersect($goodsCondId, $GoodsId));
         }
     }
     //过滤商品ID被删除的情况
     if ($GoodsId) {
         if (!isset($goodsDB)) {
             $goodsDB = new IModel("goods as go");
         }
         $goodsCondData = $goodsDB->query("go.id in (" . join(',', $GoodsId) . ") and go.is_del = 0 ", "id");
         $GoodsId = array();
         foreach ($goodsCondData as $key => $val) {
             $GoodsId[] = $val['id'];
         }
     }
     $GoodsId = $GoodsId === array() || $GoodsId === null ? array(0) : array_unique($GoodsId);
     //存在商品ID数据
     if ($GoodsId) {
         $GoodsId = array_slice($GoodsId, 0, search_goods::MAX_GOODSID);
         $where .= " and go.id in (" . join(',', $GoodsId) . ") ";
         //商品属性进行检索
         if ($isCondition == true) {
             /******属性 开始******/
             $attrTemp = array();
             $goodsAttrDB = new IModel('goods_attribute');
             $attrData = $goodsAttrDB->query("goods_id in (" . join(',', $GoodsId) . ")");
             foreach ($attrData as $key => $val) {
                 //属性
                 if ($val['attribute_id']) {
                     if (!isset($attrTemp[$val['attribute_id']])) {
                         $attrTemp[$val['attribute_id']] = array();
                     }
                     $checkSelectedArray = explode(",", $val['attribute_value']);
                     foreach ($checkSelectedArray as $k => $v) {
                         if (!in_array($v, $attrTemp[$val['attribute_id']])) {
                             $attrTemp[$val['attribute_id']][] = $v;
                         }
                     }
                 }
             }
             //属性的数据拼接
             if ($attrTemp) {
                 $attrDB = new IModel('attribute');
                 $attrData = $attrDB->query("id in (" . join(',', array_keys($attrTemp)) . ") and search = 1", "*", "id", "asc", 8);
                 foreach ($attrData as $key => $val) {
                     self::$attrSearch[] = array('id' => $val['id'], 'name' => $val['name'], 'value' => $attrTemp[$val['id']]);
                 }
             }
             /******属性 结束******/
             /******品牌 开始******/
             $brandQuery = new IModel('brand as b,goods as go');
             self::$brandSearch = $brandQuery->query("go.brand_id = b.id and go.id in (" . join(',', $GoodsId) . ")", "distinct b.id,b.name", "b.sort", "asc", 10);
             /******品牌 结束******/
             /******价格 开始******/
             self::$priceSearch = goods_class::getGoodsPrice(join(',', $GoodsId));
             /******价格 结束******/
         }
     }
     //(4),商品价格
     $where .= floatval(IReq::get('min_price')) ? ' and go.sell_price >= ' . floatval(IReq::get('min_price')) : '';
     $where .= floatval(IReq::get('max_price')) ? ' and go.sell_price <= ' . floatval(IReq::get('max_price')) : '';
     //(5),商品品牌
     $where .= intval(IReq::get('brand')) ? ' and go.brand_id = ' . intval(IReq::get('brand')) : '';
     //排序类别
     $order = IFilter::act(IReq::get('order'), 'url');
     if ($order == null) {
         $order = isset($site_config['order_by']) ? $site_config['order_by'] : 'new';
         $asc = isset($site_config['order_type']) ? $site_config['order_type'] : 'desc';
     } else {
         if (stripos($order, '_toggle')) {
             $order = str_replace('_toggle', '', $order);
             $asc = 'asc';
         } else {
             $asc = 'desc';
         }
     }
     switch ($order) {
         //销售量
         case "sale":
             $orderArray[] = ' go.sale ' . $asc;
             break;
             //评分
         //评分
         case "cpoint":
             $orderArray[] = ' go.grade ' . $asc;
             break;
             //最新上架
         //最新上架
         case "new":
             $orderArray[] = ' go.id ' . $asc;
             break;
             //价格
         //价格
         case "price":
             $orderArray[] = ' go.sell_price ' . $asc;
             break;
             //根据排序字段
         //根据排序字段
         default:
             $orderArray[] = ' go.sort asc ';
     }
     //设置IQuery类的各个属性
     $goodsObj->where = $where;
     $goodsObj->order = join(',', $orderArray);
     return $goodsObj;
 }
Esempio n. 16
0
 function get_favorite(&$favoriteObj)
 {
     //获取收藏夹信息
     $page = isset($_GET['page']) && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1;
     $favoriteObj = new IQuery("favorite");
     $cat_id = intval(IReq::get('cat_id'));
     $where = '';
     if ($cat_id != 0) {
         $where = ' and cat_id = ' . $cat_id;
     }
     $favoriteObj->where = "user_id = " . $this->user['user_id'] . $where;
     $favoriteObj->page = $page;
     $items = $favoriteObj->find();
     $goodsIdArray = array();
     foreach ($items as $val) {
         $goodsIdArray[] = $val['rid'];
     }
     //商品数据
     if (!empty($goodsIdArray)) {
         $goodsIdStr = join(',', $goodsIdArray);
         $goodsObj = new IModel('goods');
         $goodsList = $goodsObj->query('id in (' . $goodsIdStr . ')');
     }
     foreach ($items as $key => $val) {
         foreach ($goodsList as $gkey => $goods) {
             if ($goods['id'] == $val['rid']) {
                 $items[$key]['data'] = $goods;
                 //效率考虑,让goodsList循环次数减少
                 unset($goodsList[$gkey]);
             }
         }
         //如果相应的商品或者货品已经被删除了,
         if (!isset($items[$key]['data'])) {
             $favoriteModel = new IModel('favorite');
             $favoriteModel->del("id={$val['id']}");
             unset($items[$key]);
         }
     }
     return $items;
 }
Esempio n. 17
0
 /**
  * @brief 统计退款申请的数量
  * @param int $seller_id
  */
 public static function refundsCount($seller_id = '')
 {
     $refundDB = new IQuery('refundment_doc');
     $where = 'pay_status = 0 and if_del = 0';
     if ($seller_id) {
         $where .= ' and seller_id = ' . $seller_id;
     }
     $refundDB->where = $where;
     $refundDB->fields = 'count(*) as num';
     $data = $refundDB->find();
     return $data[0]['num'];
 }
Esempio n. 18
0
 /**
  * 筛选用户
  */
 public function filter_user()
 {
     $email = IFilter::act(IReq::get('email'));
     $username = IFilter::act(IReq::get('username'));
     $true_name = IFilter::act(IReq::get('true_name'));
     $group_id = IFilter::act(IReq::get('group_id'));
     $where = '1';
     $userIds = '';
     if ($email) {
         $where .= ' and u.email = "' . $email . '"';
     }
     if ($username) {
         $where .= ' and u.username = "******"';
     }
     if ($true_name) {
         $where .= ' and m.true_name = "' . $true_name . '"';
     }
     if ($group_id) {
         $where .= ' and m.group_id = "' . $group_id . '"';
     }
     //有筛选条件
     if ($where != '1') {
         $userDB = new IQuery('user as u');
         $userDB->join = 'left join member as m on u.id = m.user_id';
         $userDB->fields = 'u.id';
         $userDB->where = $where;
         $userData = $userDB->find();
         $tempArray = array();
         foreach ($userData as $key => $item) {
             $tempArray[] = $item['id'];
         }
         $userIds = join(',', $tempArray);
     }
     die('<script type="text/javascript">parent.searchUserCallback("' . $userIds . '");</script>');
 }
Esempio n. 19
0
 public function goods_report()
 {
     //搜索条件
     $search = IFilter::act(IReq::get('search'), 'strict');
     //条件筛选处理
     list($join, $where) = goods_class::getSearchCondition($search);
     //拼接sql
     $goodsHandle = new IQuery('goods as go');
     $goodsHandle->order = "go.sort asc,go.id desc";
     $goodsHandle->distinct = "go.id";
     $goodsHandle->fields = "go.id, go.name,go.sell_price,go.store_nums,go.sale,go.is_del,go.create_time,seller.true_name";
     $goodsHandle->join = $join;
     $goodsHandle->where = $where;
     $goodsHandle->limit = 'all';
     $goodsList = $goodsHandle->find();
     //构建 Excel table;
     $strTable = '<table width="500" border="1">';
     $strTable .= '<tr>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">商品名称</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="160">分类</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="60">售价</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="60">库存</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="60">销量</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="60">发布时间</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="60">状态</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="60">隶属商户</td>';
     $strTable .= '</tr>';
     foreach ($goodsList as $k => $val) {
         $strTable .= '<tr>';
         $strTable .= '<td style="text-align:center;font-size:12px;">&nbsp;' . $val['name'] . '</td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . goods_class::getGoodsCategory($val['id']) . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['sell_price'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['store_nums'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['sale'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['create_time'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . goods_class::statusText($val['is_del']) . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['true_name'] . '&nbsp;</td>';
         $strTable .= '</tr>';
     }
     $strTable .= '</table>';
     unset($goodsList);
     $reportObj = new report();
     $reportObj->setFileName('goods');
     $reportObj->toDownload($strTable);
     exit;
 }
Esempio n. 20
0
 public function freight()
 {
     $id = IFilter::act(IReq::get('id'), 'int');
     if ($id) {
         $tb_freight = new IQuery('delivery_doc as d');
         $tb_freight->join = 'left join freight_company as f on f.id = d.freight_id';
         $tb_freight->where = 'd.id = ' . $id;
         $tb_freight->fields = 'd.*,f.freight_type';
         $freightData = $tb_freight->find();
         if ($freightData) {
             $freightData = current($freightData);
             if ($freightData['freight_type'] && $freightData['delivery_code']) {
                 $result = freight_facade::line($freightData['freight_type'], $freightData['delivery_code']);
                 if ($result['result'] == 'success') {
                     $this->data = $result['data'];
                     $this->redirect('freight');
                     exit;
                 } else {
                     die(isset($result['reason']) ? $result['reason'] : '物流接口发生错误');
                 }
             } else {
                 die('缺少物流信息');
             }
         }
     }
     die('发货单信息不存在');
 }
Esempio n. 21
0
 /**
  * 修改商品
  */
 public function edit($type, $goods_info)
 {
     $data = array();
     $data['goods_id'] = $type['gid'];
     $data['form'] = array('goods_name' => $goods_info['name'], 'goods_no' => $goods_info['goods_no'], 'goods_model' => $goods_info['model_id'], 'brand_id' => $goods_info['brand_id'], 'is_del' => $goods_info['is_del'], 'up_time' => $goods_info['up_time'], 'down_time' => $goods_info['down_time'], 'sell_price' => $goods_info['sell_price'], 'market_price' => $goods_info['market_price'], 'cost_price' => $goods_info['cost_price'], 'store_nums' => $goods_info['store_nums'], 'weight' => $goods_info['weight'], 'unit' => $goods_info['unit'], 'point' => $goods_info['point'], 'focus_photo' => $goods_info['img'], 'content' => $goods_info['content'], 'seo_keywords' => $goods_info['keywords'], 'seo_description' => $goods_info['description'], 'sort' => $goods_info['sort'], 'exp' => $goods_info['exp'], 'spec_array' => $goods_info['spec_array'], 'keywords_for_search' => array());
     $data['admin_name'] = $type['admin_name'];
     $data['admin_pwd'] = $type['admin_pwd'];
     //获得配置文件中的数据
     $config = new Config("site_config");
     $config_info = $config->getInfo();
     $show_thumb_width = isset($config_info['show_thumb_width']) ? $config_info['show_thumb_width'] : 85;
     $show_thumb_height = isset($config_info['show_thumb_height']) ? $config_info['show_thumb_height'] : 85;
     //show
     $show_img = '_' . $show_thumb_width . '_' . $show_thumb_height;
     $data['form']['thumb'] = $show_img;
     //获取keywords信息
     $obj = new IModel('goods_keywords');
     $keywords_for_search = $obj->getObj('goods_id=' . $type['gid']);
     if ($keywords_for_search) {
         $data['form']['keywords_for_search'] = explode(",", $keywords_for_search['keywords']);
     }
     //加载推荐类型
     $tb_commend_goods = new IModel('commend_goods');
     $commend_goods = $tb_commend_goods->query('goods_id=' . $type['gid']);
     $data['commend_goods'] = '';
     if (count($commend_goods) > 0) {
         foreach ($commend_goods as $value) {
             $data['commend_goods'] .= $value['commend_id'];
         }
     }
     //加载分类
     $tb_category = new IModel('category');
     $data['category'] = $this->sortdata($tb_category->query(false, '*', 'sort', 'asc'), 0, ' &nbsp;&nbsp; ');
     //所有扩展属性
     $tb_attribute = new IModel('attribute');
     $attribute_info = $tb_attribute->query('model_id=' . $data['form']['goods_model']);
     $data['attribute'] = $attribute_info;
     $data['attribute_ids'] = '';
     if (count($attribute_info) > 0) {
         foreach ($attribute_info as $value) {
             $data['attribute_ids'] .= $value['id'] . ',';
         }
         $data['attribute_ids'] = substr($data['attribute_ids'], 0, -1);
     }
     //goods_attribute
     $tb_goods_attribute = new IQuery('goods_attribute');
     $tb_goods_attribute->fields = 'attribute_id,attribute_value';
     $tb_goods_attribute->where = "goods_id=" . $type['gid'] . " and attribute_id!=''";
     $goods_attribute = $tb_goods_attribute->find();
     $data['goods_attribute'] = ',';
     if (count($goods_attribute) > 0) {
         foreach ($goods_attribute as $value) {
             $data['goods_attribute'] .= $value['attribute_id'] . '|' . $value['attribute_value'] . ',';
         }
     }
     //相册
     $tb_goods_photo = new IQuery('goods_photo_relation as ghr');
     $tb_goods_photo->join = 'left join goods_photo as gh on ghr.photo_id=gh.id';
     $tb_goods_photo->fields = 'gh.img';
     $tb_goods_photo->where = 'ghr.goods_id=' . $type['gid'];
     $tb_goods_photo->order = 'ghr.id asc';
     $goods_photo_info = $tb_goods_photo->find();
     $data['goods_photo'] = $goods_photo_info;
     if (count($goods_photo_info) > 0) {
         $data['photo_name'] = '';
         foreach ($goods_photo_info as $value) {
             $data['photo_name'] .= $value['img'] . ',';
         }
     }
     //相册属性
     //获得配置文件中的数据
     $config = new Config("site_config");
     $config_info = $config->getInfo();
     $show_thumb_width = isset($config_info['show_thumb_width']) ? $config_info['show_thumb_width'] : 85;
     $show_thumb_height = isset($config_info['show_thumb_height']) ? $config_info['show_thumb_height'] : 85;
     $data['show_attr'] = '_' . $show_thumb_width . '_' . $show_thumb_height;
     //规格属性
     $tb_spec_attr = new IQuery('goods_attribute as ga');
     $tb_spec_attr->fields = 'ga.spec_id';
     $tb_spec_attr->group = 'spec_id';
     $tb_spec_attr->where = "goods_id=" . $type['gid'] . " and ga.spec_id!=''";
     $spec_attr_info = $tb_spec_attr->find();
     $data['spec_attr'] = count($spec_attr_info);
     $data['spec_id'] = '';
     if (count($spec_attr_info) > 0) {
         foreach ($spec_attr_info as $value) {
             $data['spec_id'] .= $value['spec_id'] . ',';
         }
         $data['spec_id'] = substr($data['spec_id'], 0, -1);
     }
     //加载会员级别
     $tb_user_group = new IModel('user_group');
     $info = $tb_user_group->query();
     $ids = '';
     if (count($info) > 0) {
         foreach ($info as $value) {
             $ids .= $value['id'] . ',';
         }
         $ids = substr($ids, 0, -1);
     }
     $data['ids'] = $ids;
     return $data;
 }
Esempio n. 22
0
 /**
  * @brief 显示讨论信息
  */
 function discussion_edit()
 {
     $did = intval(IReq::get('did'));
     if (!$did) {
         $this->discussion_list();
         return false;
     }
     $query = new IQuery("discussion as d");
     $query->join = "right join goods as goods on d.goods_id = goods.id left join user as u on d.user_id = u.id";
     $query->fields = "d.id,d.time,d.contents,u.id as userid,u.username,goods.id as goods_id,goods.name as goods_name";
     $query->where = "d.id=" . $did;
     $items = $query->find();
     if ($items) {
         $this->discussion = $items[0];
         $this->redirect('discussion_edit');
     } else {
         $this->discussion_list();
         $msg = '没有找到相关记录!';
         Util::showMessage($msg);
     }
 }
Esempio n. 23
0
</div>
<form action="<?php 
echo IUrl::creatUrl("/member/group_del");
?>
" method="post" name="group_list" onsubmit="return checkboxCheck('check[]','尚未选中任何记录!')">
<div class="content">
	<table id="list_table" class="list_table">
		<col width="40px" />
		<col />
		<col />
		<col />
		<col />
		<col />
		<tbody>
			<?php 
$query = new IQuery("user_group");
$items = $query->find();
foreach ($items as $key => $item) {
    ?>
			<tr>
				<td class="t_c"><input name="check[]" type="checkbox" value="<?php 
    echo isset($item['id']) ? $item['id'] : "";
    ?>
" /></td>
				<td><?php 
    echo isset($item['group_name']) ? $item['group_name'] : "";
    ?>
</td>
				<td><?php 
    echo isset($item['discount']) ? $item['discount'] : "";
    ?>
 /**
  * @param IQuery $query
  * @return Filter
  */
 public static function filter(IQuery $query)
 {
     $className = self::_getClassForTable(Helper::prepareTable($query->getTable()), self::TYPE_FILTER);
     /** @var Filter $filter */
     return new $className($query);
 }
Esempio n. 25
0
 /**
  * Ensures that aliased properties are correctly converted in query
  *
  * @param Object $object
  * @param IQuery $query
  */
 private function getRawQuery(Object $object, IQuery $query)
 {
     $rawQuery = array();
     foreach ($query->getRawQuery() as $field => $value) {
         $storageName = $object->__getPropertySet()->getStorageName($field);
         $rawQuery[$storageName] = $value;
     }
     return $rawQuery;
 }
Esempio n. 26
0
 static function get_order_pri_num_del($ogid)
 {
     $total = 0;
     $goods_id = '';
     $p_id = '';
     $number = '';
     //先根据ogid查询出order_goods单价和数量,然后从order表总价格中删除
     $query = new IQuery('order_goods');
     $query->where = 'id = ' . $ogid;
     $order_goods_info = $query->find();
     if (count($order_goods_info) > 0) {
         $order_id = $order_goods_info[0]['order_id'];
         $goods_price = $order_goods_info[0]['goods_price'];
         $real_price = $order_goods_info[0]['real_price'];
         $goods_nums = $order_goods_info[0]['goods_nums'];
         $number = $goods_nums;
         $goods_id = $order_goods_info[0]['goods_id'];
         $p_id = $order_goods_info[0]['product_id'];
         $tb_order = new IModel('order');
         $tb_order->setData(array('payable_amount' => 'payable_amount-' . $goods_price * $goods_nums, 'real_amount' => 'real_amount-' . $real_price * $goods_nums, 'order_amount' => 'order_amount-' . $real_price * $goods_nums));
         $arr = array('payable_amount', 'real_amount', 'order_amount');
         $tb_order->update('id=' . $order_id, $arr);
     }
     $islog = 0;
     $tb_order_goods = new IModel('order_goods');
     if ($tb_order_goods->del('id=' . $ogid)) {
         $islog = 1;
     }
     //修改goods表中数量,获得goods表的对象
     $tb_goods = new IModel('goods');
     $tb_goods->setData(array('store_nums' => 'store_nums+' . $number));
     $grr = array('store_nums');
     $tb_goods->update('id=' . $goods_id, $grr);
     //判断p_id是否有值如果有则修改products中的数量
     if ($p_id != 0) {
         $tb_products = new IModel('products');
         $tb_products->setData(array('store_nums' => 'store_nums+' . $number));
         $prr = array('store_nums');
         $tb_products->update('id=' . $p_id, $prr);
     }
     return $islog;
 }
Esempio n. 27
0
 /**
  * 快递单
  * */
 function exdelivry()
 {
     $id = IReq::get('id');
     $tb_delivery_doc = new IQuery('delivery_doc as dd');
     $tb_delivery_doc->fields = 'd.name,dd.delivery_code,fc.freight_name';
     $tb_delivery_doc->where = 'order_id=' . $id;
     $tb_delivery_doc->join = 'left join delivery as d on dd.delivery_type=d.id left join freight_company as fc on d.freight_id=fc.id';
     $delivery_info = $tb_delivery_doc->find();
     $get_content = '暂无相关信息!';
     if (count($delivery_info) > 0) {
         //获得用户申请的id
         $config = new Config("site_config");
         $config_info = $config->getInfo();
         $express_key = isset($config_info['express_key']) ? $config_info['express_key'] : '';
         if ($express_key) {
             //获得物流名称和物流单号
             $delivery_code = $delivery_info[0]['delivery_code'];
             $name = $delivery_info[0]['freight_name'];
             $get_content = '物流公司或者货运单号错误';
             $type = '1';
             if ($delivery_code != '' && $name != '') {
                 $name = str_replace(' ', '', $name);
                 $delivery_code = str_replace(' ', '', $delivery_code);
                 $sUrl = $this->module->getBasePath();
                 include $sUrl . 'plugins/freight/company.php';
                 $company = new Company();
                 $name = $company->getCompany($name);
                 $AppKey = $express_key;
                 $url = 'http://api.kuaidi100.com/api?id=' . $AppKey . '&com=' . $name . '&nu=' . $delivery_code . '&show=2&muti=1&order=asc';
                 //请勿删除变量$powered 的信息,否者本站将不再为你提供快递接口服务。
                 $powered = '查询数据由:<a href="http://kuaidi100.com" target="_blank">KuaiDi100.Com (快递100)</a> 网站提供 ';
                 //优先使用curl模式发送数据
                 if (function_exists('curl_init') == 1) {
                     $curl = curl_init();
                     curl_setopt($curl, CURLOPT_URL, $url);
                     curl_setopt($curl, CURLOPT_HEADER, 0);
                     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                     curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
                     curl_setopt($curl, CURLOPT_TIMEOUT, 5);
                     $get_content = curl_exec($curl);
                     $type = '2';
                     curl_close($curl);
                 } else {
                     include $sUrl . 'plugins/freight/snoopy.php';
                     $snoopy = new snoopy();
                     $snoopy->referer = 'http://www.google.com/';
                     //伪装来源
                     $snoopy->fetch($url);
                     $get_content = $snoopy->results;
                     $type = '2';
                 }
             }
         } else {
             $get_content = '您还没有申请ID,请到<a href="http://kuaidi100.com" target="_blank">KuaiDi100.Com (快递100)</a>申请!';
         }
     }
     $this->setRenderData(array('conent' => $get_content, 'type' => $type));
     $this->redirect('exdelivry');
 }
Esempio n. 28
0
 /**
  * @brief 计算商品价格
  * @param Array $buyInfo ,购物车格式
  * @return array or bool
  */
 public function goodsCount($buyInfo)
 {
     $this->sum = 0;
     //原始总额(优惠前)
     $this->final_sum = 0;
     //应付总额(优惠后)
     $this->weight = 0;
     //总重量
     $this->reduce = 0;
     //减少总额
     $this->count = 0;
     //总数量
     $this->promotion = array();
     //促销活动规则文本
     $this->proReduce = 0;
     //促销活动规则优惠额
     $this->point = 0;
     //增加积分
     $this->exp = 0;
     //增加经验
     $this->isFreeFreight = false;
     //是否免运费
     $user_id = $this->user_id;
     $group_id = $this->group_id;
     $goodsList = array();
     $productList = array();
     /*开始计算goods和product的优惠信息 , 会根据条件分析出执行以下哪一种情况:
      *(1)查看此商品(货品)是否已经根据不同会员组设定了优惠价格;
      *(2)当前用户是否属于某个用户组中的成员,并且此用户组享受折扣率;
      *(3)优惠价等于商品(货品)原价;
      */
     //获取商品或货品数据
     /*Goods 拼装商品优惠价的数据*/
     if (isset($buyInfo['goods']['id']) && $buyInfo['goods']['id']) {
         //购物车中的商品数据
         $goodsIdStr = join(',', $buyInfo['goods']['id']);
         $goodsObj = new IModel('goods as go');
         $goodsList = $goodsObj->query('go.id in (' . $goodsIdStr . ')', 'go.name,go.id as goods_id,go.img,go.sell_price,go.point,go.weight,go.store_nums,go.exp,go.goods_no,0 as product_id');
         //开始优惠情况判断
         foreach ($goodsList as $key => $val) {
             //检查库存
             if ($buyInfo['goods']['data'][$val['goods_id']]['count'] <= 0 || $buyInfo['goods']['data'][$val['goods_id']]['count'] > $val['store_nums']) {
                 return "商品:" . $val['name'] . "购买数量超出库存,请重新调整购买数量";
             }
             $groupPrice = $this->getGroupPrice($val['goods_id'], 'goods');
             $goodsList[$key]['reduce'] = $groupPrice === null ? 0 : $val['sell_price'] - $groupPrice;
             $goodsList[$key]['count'] = $buyInfo['goods']['data'][$val['goods_id']]['count'];
             $current_sum_all = $goodsList[$key]['sell_price'] * $goodsList[$key]['count'];
             $current_reduce_all = $goodsList[$key]['reduce'] * $goodsList[$key]['count'];
             $goodsList[$key]['sum'] = $current_sum_all - $current_reduce_all;
             //全局统计
             $this->weight += $val['weight'] * $goodsList[$key]['count'];
             $this->point += $val['point'] * $goodsList[$key]['count'];
             $this->exp += $val['exp'] * $goodsList[$key]['count'];
             $this->sum += $current_sum_all;
             $this->reduce += $current_reduce_all;
             $this->count += $goodsList[$key]['count'];
         }
     }
     /*Product 拼装商品优惠价的数据*/
     if (isset($buyInfo['product']['id']) && $buyInfo['product']['id']) {
         //购物车中的货品数据
         $productIdStr = join(',', $buyInfo['product']['id']);
         $productObj = new IQuery('products as pro,goods as go');
         $productObj->where = 'pro.id in (' . $productIdStr . ') and go.id = pro.goods_id';
         $productObj->fields = 'pro.sell_price,pro.weight,pro.id as product_id,pro.spec_array,pro.goods_id,pro.store_nums,pro.products_no as goods_no,go.name,go.point,go.exp,go.img';
         $productList = $productObj->find();
         //开始优惠情况判断
         foreach ($productList as $key => $val) {
             //检查库存
             if ($buyInfo['product']['data'][$val['product_id']]['count'] <= 0 || $buyInfo['product']['data'][$val['product_id']]['count'] > $val['store_nums']) {
                 return "货品:" . $val['name'] . "购买数量超出库存,请重新调整购买数量";
             }
             $groupPrice = $this->getGroupPrice($val['product_id'], 'product');
             $productList[$key]['reduce'] = $groupPrice === null ? 0 : $val['sell_price'] - $groupPrice;
             $productList[$key]['count'] = $buyInfo['product']['data'][$val['product_id']]['count'];
             $current_sum_all = $productList[$key]['sell_price'] * $productList[$key]['count'];
             $current_reduce_all = $productList[$key]['reduce'] * $productList[$key]['count'];
             $productList[$key]['sum'] = $current_sum_all - $current_reduce_all;
             //全局统计
             $this->weight += $val['weight'] * $productList[$key]['count'];
             $this->point += $val['point'] * $productList[$key]['count'];
             $this->exp += $val['exp'] * $productList[$key]['count'];
             $this->sum += $current_sum_all;
             $this->reduce += $current_reduce_all;
             $this->count += $productList[$key]['count'];
         }
     }
     $final_sum = $this->sum - $this->reduce;
     //总金额满足的促销规则
     if ($user_id) {
         $proObj = new ProRule($final_sum);
         $proObj->setUserGroup($group_id);
         $this->isFreeFreight = $proObj->isFreeFreight();
         $this->promotion = $proObj->getInfo();
         $this->proReduce = $final_sum - $proObj->getSum();
     } else {
         $this->promotion = array();
         $this->proReduce = 0;
     }
     $this->final_sum = $final_sum - $this->proReduce;
     return array('final_sum' => $this->final_sum, 'promotion' => $this->promotion, 'proReduce' => $this->proReduce, 'sum' => $this->sum, 'goodsList' => array_merge($goodsList, $productList), 'count' => $this->count, 'reduce' => $this->reduce, 'weight' => $this->weight, 'freeFreight' => $this->isFreeFreight, 'point' => $this->point, 'exp' => $this->exp);
 }
Esempio n. 29
0
			<?php 
foreach ($search as $key => $item) {
    ?>
			<?php 
    if ($item !== "") {
        $where .= " and " . $key . "'" . $item . "'";
    }
    ?>
			<?php 
}
?>
			<?php 
$page = isset($_GET['page']) && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1;
?>
			<?php 
$query = new IQuery("bill as b");
$query->join = "left join seller as s on s.id = b.seller_id left join admin as a on b.admin_id = a.id";
$query->where = "{$where}";
$query->page = "{$page}";
$query->fields = "b.*,s.seller_name,a.admin_name";
$items = $query->find();
foreach ($items as $key => $item) {
    ?>
			<tr>
				<td><?php 
    echo isset($item['start_time']) ? $item['start_time'] : "";
    ?>
 ~ <?php 
    echo isset($item['end_time']) ? $item['end_time'] : "";
    ?>
</td>
Esempio n. 30
0
 /**
  * @brief 获取订单基本数据资料
  * @param $order_id int 订单的id
  * @return array()
  */
 public function getOrderShow($order_id)
 {
     $data = array();
     //获得对象
     $tb_order = new IModel('order');
     $data = $tb_order->getObj('id=' . $order_id);
     if ($data) {
         $data['order_id'] = $order_id;
         //获取配送方式
         $tb_delivery = new IModel('delivery');
         $delivery_info = $tb_delivery->getObj('id=' . $data['distribution']);
         if ($delivery_info) {
             $data['delivery'] = $delivery_info['name'];
         }
         //获取支付方式
         $tb_payment = new IModel('payment');
         $payment_info = $tb_payment->getObj('id=' . $data['pay_type']);
         if ($payment_info) {
             $data['payment'] = $payment_info['name'];
         }
         //获取商品总重量和总金额
         $tb_order_goods = new IModel('order_goods');
         $order_goods_info = $tb_order_goods->query('order_id=' . $order_id);
         $data['goods_amount'] = 0;
         $data['goods_weight'] = 0;
         if ($order_goods_info) {
             foreach ($order_goods_info as $value) {
                 $data['goods_amount'] += $value['real_price'] * $value['goods_nums'];
                 $data['goods_weight'] += $value['goods_weight'] * $value['goods_nums'];
             }
         }
         //获取用户信息
         $query = new IQuery('user as u');
         $query->join = ' left join member as m on u.id=m.user_id ';
         $query->fields = 'u.username,u.email,m.mobile,m.contact_addr,m.true_name';
         $query->where = 'u.id=' . $data['user_id'];
         $user_info = $query->find();
         if ($user_info) {
             $user_info = $user_info[0];
             $data['username'] = $user_info['username'];
             $data['email'] = $user_info['email'];
             $data['u_mobile'] = $user_info['mobile'];
             $data['contact_addr'] = $user_info['contact_addr'];
             $data['true_name'] = $user_info['true_name'];
         }
     }
     return $data;
 }