-
-
+
+
设为默认地址
diff --git a/service/Application/Admin/Controller/GoodsController.class.php b/service/Application/Admin/Controller/GoodsController.class.php
index ec5bf22a1..c917aa3ec 100755
--- a/service/Application/Admin/Controller/GoodsController.class.php
+++ b/service/Application/Admin/Controller/GoodsController.class.php
@@ -102,7 +102,7 @@ class GoodsController extends CommonController
$v['category_text'] = implode(',', $category_name);
// 产地
- $v['place_origin_text'] = M('Region')->where(['id'=>$v['place_origin']])->getField('name');
+ $v['place_origin_name'] = ResourcesService::RegionName($v['place_origin']);
// 品牌
$v['brand_name'] = empty($v['brand_id']) ? null : M('Brand')->where(['id'=>$v['brand_id']])->getField('name');
diff --git a/service/Application/Admin/Lang/zh-cn/goods.php b/service/Application/Admin/Lang/zh-cn/goods.php
index 37df73c4a..30ddd3962 100755
--- a/service/Application/Admin/Lang/zh-cn/goods.php
+++ b/service/Application/Admin/Lang/zh-cn/goods.php
@@ -21,7 +21,7 @@ return array(
'goods_category_id_text' => '商品分类',
'goods_category_id_format' => '请至少选择一个商品分类',
- 'goods_place_origin_text' => '生产地',
+ 'goods_place_origin_name' => '生产地',
'goods_place_origin_format' => '请选择生产地',
'goods_inventory_text' => '库存数量',
diff --git a/service/Application/Admin/View/Default/Goods/Index.html b/service/Application/Admin/View/Default/Goods/Index.html
index 9cec81f8f..cdb6a2389 100755
--- a/service/Application/Admin/View/Default/Goods/Index.html
+++ b/service/Application/Admin/View/Default/Goods/Index.html
@@ -123,8 +123,8 @@
{{:L('goods_brand_id_text')}}
{{$v.brand_name}}
- {{:L('goods_place_origin_text')}}
- {{$v.place_origin_text}}
+ {{:L('goods_place_origin_name')}}
+ {{$v.place_origin_name}}
{{:L('goods_category_id_text')}}
{{$v.category_text}}
diff --git a/service/Application/Admin/View/Default/Goods/SaveInfo.html b/service/Application/Admin/View/Default/Goods/SaveInfo.html
index d4b4f5238..cd27d0aae 100755
--- a/service/Application/Admin/View/Default/Goods/SaveInfo.html
+++ b/service/Application/Admin/View/Default/Goods/SaveInfo.html
@@ -98,7 +98,7 @@
-
+
-
+
+
-
+
diff --git a/service/Application/Service/BuyService.class.php b/service/Application/Service/BuyService.class.php
index 45e5674e4..470d99e5c 100755
--- a/service/Application/Service/BuyService.class.php
+++ b/service/Application/Service/BuyService.class.php
@@ -111,8 +111,12 @@ class BuyService
private static function GoodsAttrParsing($params = [])
{
$data = [];
- if(!empty($params['attr']) && is_array($params['attr']) && !empty($params['goods_id']))
+ if(!empty($params['attr']) && !empty($params['goods_id']))
{
+ if(!is_array($params['attr']))
+ {
+ $params['attr'] = json_decode($params['attr'], true);
+ }
foreach($params['attr'] as $k=>$v)
{
$attr_type_name = M('GoodsAttributeType')->where(['goods_id'=>$params['goods_id'], 'id'=>$k])->getField('name');
@@ -161,21 +165,21 @@ class BuyService
$field = 'c.*, g.title, g.images, g.original_price, g.price, g.inventory, g.inventory_unit, g.is_shelves, g.is_delete_time, g.buy_min_number, g.buy_max_number';
$data = M('Cart')->alias('c')->join(' __GOODS__ AS g ON g.id=c.goods_id')->where($where)->field($field)->select();
- if(empty($data) || !is_array($data))
- {
- return DataReturn(L('common_not_data_tips'), -100);
- }
+
// 数据处理
- $images_host = C('IMAGE_HOST');
- foreach($data as &$v)
+ if(!empty($data))
{
- $v['goods_url'] = HomeUrl('Goods', 'Index', ['id'=>$v['goods_id']]);
- $v['images_old'] = $v['images'];
- $v['images'] = empty($v['images']) ? null : $images_host.$v['images'];
- $v['attribute'] = empty($v['attribute']) ? null : json_decode($v['attribute'], true);
- $v['total_price'] = $v['stock']*$v['price'];
- $v['buy_max_number'] = ($v['buy_max_number'] <= 0) ? $v['inventory']: $v['buy_max_number'];
+ $images_host = C('IMAGE_HOST');
+ foreach($data as &$v)
+ {
+ $v['goods_url'] = HomeUrl('Goods', 'Index', ['id'=>$v['goods_id']]);
+ $v['images_old'] = $v['images'];
+ $v['images'] = empty($v['images']) ? null : $images_host.$v['images'];
+ $v['attribute'] = empty($v['attribute']) ? null : json_decode($v['attribute'], true);
+ $v['total_price'] = $v['stock']*$v['price'];
+ $v['buy_max_number'] = ($v['buy_max_number'] <= 0) ? $v['inventory']: $v['buy_max_number'];
+ }
}
return DataReturn(L('common_operation_success'), 0, $data);
diff --git a/service/Application/Service/GoodsService.class.php b/service/Application/Service/GoodsService.class.php
index c35f60227..327b5a645 100755
--- a/service/Application/Service/GoodsService.class.php
+++ b/service/Application/Service/GoodsService.class.php
@@ -196,6 +196,7 @@ class GoodsService
$is_photo = (isset($params['is_photo']) && $params['is_photo'] == true) ? true : false;
$is_attribute = (isset($params['is_attribute']) && $params['is_attribute'] == true) ? true : false;
+ $is_content_app = (isset($params['is_content_app']) && $params['is_content_app'] == true) ? true : false;
$is_category = (isset($params['is_category']) && $params['is_category'] == true) ? true : false;
$m = isset($params['m']) ? intval($params['m']) : 0;
@@ -242,7 +243,7 @@ class GoodsService
// 产地
if(!empty($v['place_origin']))
{
- $v['place_origin_text'] = M('Region')->where(['id'=>$v['place_origin']])->getField('name');
+ $v['place_origin_name'] = ResourcesService::RegionName($goods['place_origin']);
}
// 时间
@@ -281,11 +282,44 @@ class GoodsService
{
$v['attribute'] = self::GoodsAttribute(['goods_id'=>$v['id']]);
}
+
+ // 获取app内容
+ if($is_content_app && !empty($v['id']))
+ {
+ $v['content_app'] = self::GoodsContentApp(['goods_id'=>$v['id']]);
+ }
}
}
return $data;
}
+ /**
+ * 获取商品手机详情
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-07-10
+ * @desc description
+ * @param [array] $params [输入参数]
+ * @return [array] [app内容]
+ */
+ public static function GoodsContentApp($params = [])
+ {
+ $data = M('GoodsContentApp')->where(['goods_id'=>$params['goods_id']])->field('id,images,content')->order('sort asc')->select();
+ if(!empty($data))
+ {
+ $images_host = C('IMAGE_HOST');
+ foreach($data as &$v)
+ {
+ $v['images'] = empty($v['images']) ? null : $images_host.$v['images'];
+ $v['content'] = empty($v['content']) ? null : explode("\n", $v['content']);
+ }
+ } else {
+ $data = [];
+ }
+ return $data;
+ }
+
/**
* 获取商品属性
* @author Devil
@@ -348,6 +382,7 @@ class GoodsService
$temp = $m->where($data)->find();
if(empty($temp))
{
+ // 添加收藏
$data['add_time'] = time();
if($m->add($data) > 0)
{
@@ -360,6 +395,17 @@ class GoodsService
return DataReturn(L('common_favor_error'));
}
} else {
+ // 是否强制收藏
+ if(isset($params['is_mandatory_favor']) && $params['is_mandatory_favor'] == 1)
+ {
+ return DataReturn(L('common_favor_success'), 0, [
+ 'text' => L('common_favor_ok_text'),
+ 'status' => 1,
+ 'count' => self::GoodsFavorTotal(['goods_id'=>$data['goods_id']]),
+ ]);
+ }
+
+ // 删除收藏
if($m->where($data)->delete() > 0)
{
return DataReturn(L('common_cancel_success'), 0, [