Commit 2dd6a3ea authored by wwccw0591's avatar wwccw0591

Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into ccw

parents a2810dab a17774ec
......@@ -13,7 +13,8 @@ class GoodsController extends \Our\Controller_AbstractIndex {
* 商品详情页
*/
public function getAction(){
$goodsInfo = $this->goodsService->getCommonDetail($this->req[\Our\NameConst::data],$this->memberId);
$address = \Business\User\AddressServiceModel::getInstance()->getMyAddress($this->req[\Our\NameConst::data],$this->memberId,false);
$goodsInfo = $this->goodsService->getCommonDetail($this->req[\Our\NameConst::data],$this->memberId,$address);
$store = $this->goodsService->getStore($goodsInfo['storeId']);
$goodsInfo['freeShippingPrice'] = $store['freeShippingPrice'];
$goodsInfo['isQuality'] = $store['isQuality'];
......
......@@ -19,7 +19,8 @@ class GroupController extends \Our\Controller_AbstractIndex {
}
public function getAction(){
$goods = $this->GroupSaleService->getGroupGoods($this->req[\Our\NameConst::data]);
$address = \Business\User\AddressServiceModel::getInstance()->getMyAddress($this->req[\Our\NameConst::data],$this->memberId,false);
$goods = $this->GroupSaleService->getGroupGoods($this->req[\Our\NameConst::data],$address);
// $data = $this->GroupSaleService->getOnePBundingCache($this->req[\Our\NameConst::data]['groupId']);
// $this->GroupSaleService->handleData($data);
$storeInfo = \Business\Goods\GoodsCommonServiceModel::getInstance()->getStore($goods['store_id']);
......
......@@ -351,11 +351,26 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
* @throws \Exception
* @throws \Our\Exception
*/
public function getCommonDetail($param,$memberId){
public function getCommonDetail($param,$memberId,$address){
$goodsCommonId = intval($param['goodsCommonId']);
$attrs = $this->getAttr($goodsCommonId,$memberId);
$commonInfo = $attrs['commonInfo'];
$commonInfo['goods_image'] = \Our\ImageUtil::getGoodsImgUrl($commonInfo['goods_image']);
//位置相关
if($address) {
$lng = $address['lng'];
$lat = $address['lat'];
}else{
$lng = $param['lng'];
$lat = $param['lat'];
}
$in_store_service_flag=0;
if($lng && $lat){
$location = array('lat'=>$lat,'lng'=>$lng);
$in_store_service = \Store\StoreUtil::getInstance()->checkAddressInServiceArea($location,$storeId);
$in_store_service && $in_store_service_flag = 1;
}
//所在地
$area = '';
if($commonInfo['areaid_1'] && $commonInfo['areaid_2']){
......@@ -398,7 +413,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$html = array('width'=>750,'height'=>$commonInfo['goods_height'],'url'=>\Our\Common::getBaseUrl().'/index/goodsDetail?goodsCommonId='.$goodsCommonId);
if($commonInfo['is_del'] == 1) $commonInfo['goods_state'] = 0;
unset($attrs['commonInfo']);
return array_merge(array('storeId'=>$commonInfo['store_id'],'goodsId'=>$commonInfo['goodsId'],'goodsName'=>$commonInfo['goods_name'],'goodsVerify'=>$commonInfo['goods_verify'],'goodsState'=>$commonInfo['goods_state'],'saleCount'=>$commonInfo['sale_num'],'collectionState'=>$collectionState,'isOwn'=>$isOwn,'isHot'=>$commonInfo['goods_hot'],'isRecoment'=>$commonInfo['goods_commend'],'isFree'=>$commonInfo['goods_free'],'isVirtual'=>$commonInfo['is_virtual'],'goodsMostLimit'=>$commonInfo['goods_most_limit'],'goodsLeastLimit'=>$commonInfo['goods_least_limit'],'goodsTotalLimit'=>$commonInfo['goods_total_limit'],'address'=>$area,'range'=>$rangePrice,'productData'=>$productData,'htmlContent'=>$html,'videoUrl'=>$commonInfo['goods_youku_url']),$attrs);
return array_merge(array('storeId'=>$commonInfo['store_id'],'goodsId'=>$commonInfo['goodsId'],'goodsName'=>$commonInfo['goods_name'],'goodsVerify'=>$commonInfo['goods_verify'],'goodsState'=>$commonInfo['goods_state'],'saleCount'=>$commonInfo['sale_num'],'collectionState'=>$collectionState,'isOwn'=>$isOwn,'isHot'=>$commonInfo['goods_hot'],'isRecoment'=>$commonInfo['goods_commend'],'isFree'=>$commonInfo['goods_free'],'isVirtual'=>$commonInfo['is_virtual'],'goodsMostLimit'=>$commonInfo['goods_most_limit'],'goodsLeastLimit'=>$commonInfo['goods_least_limit'],'goodsTotalLimit'=>$commonInfo['goods_total_limit'],'address'=>$area,'range'=>$rangePrice,'productData'=>$productData,'htmlContent'=>$html,'videoUrl'=>$commonInfo['goods_youku_url'],'inStoreService'=>$in_store_service_flag),$attrs);
}
public function getAttr($goodsCommonId,$memberId = null){
$goodsCommonId = (int)$goodsCommonId;
......
......@@ -22,13 +22,30 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
* @param $param
* @return mixed
*/
public function getGroupGoods($param){
public function getGroupGoods($param,$address){
$groupId = intval($param['groupId']);
$groupList = $this->getPBundlingListByBlIds(array($groupId),\Our\DbNameConst::salveDBConnectName,array(),false,\Our\ApiConst::one);
if(!$groupList){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyPBundlingdForOrder);
}
$data = $groupList[0];
//位置相关
if($address) {
$lng = $address['lng'];
$lat = $address['lat'];
}else{
$lng = $param['lng'];
$lat = $param['lat'];
}
$in_store_service_flag=0;
if($lng && $lat){
$location = array('lat'=>$lat,'lng'=>$lng);
$in_store_service = \Store\StoreUtil::getInstance()->checkAddressInServiceArea($location,$storeId);
$in_store_service && $in_store_service_flag = 1;
}
$data['inStoreService'] = $in_store_service_flag;
$data['state'] = \Our\ApiConst::cartGoodsOnline;
if($data['bl_state'] == \Our\ApiConst::zero) {
$data['state'] = \Our\ApiConst::zero;
......
......@@ -28,16 +28,7 @@ class StoreServiceModel extends \Business\AbstractModel{
if(!$storeId){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyStoreId);
}
if($address) {
$lng = $address['lng'];
$lat = $address['lat'];
}else{
$lng = $param['lng'];
$lat = $param['lat'];
}
if(!$lng || !$lat){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyLatLngParam);
}
list($storeInfo,$storeLabel) = \DAO\StoreModel::getInstance()->get($storeId);
if((int)$param['isScan'] > 0) {
//扫码进入
......@@ -100,14 +91,21 @@ class StoreServiceModel extends \Business\AbstractModel{
$monthlySalesCount = $monthlySalesCount ? $monthlySalesCount : 0;
//位置相关
$distince = \Our\CommonExtension::getDistance($lat,$lng,$storeInfo['store_latitude'],$storeInfo['store_longitude']);
if($address) {
$lng = $address['lng'];
$lat = $address['lat'];
}else{
$lng = $param['lng'];
$lat = $param['lat'];
}
$defaultDeliveryTime = 0;
if($distince>0){
$in_store_service_flag=0;
if($lng && $lat){
$location = array('lat'=>$lat,'lng'=>$lng);
$in_store_service_flag = \Store\StoreUtil::getInstance()->checkAddressInServiceArea($location,$storeId);
if($in_store_service_flag){
$in_store_service_flag=1;
$in_store_service = \Store\StoreUtil::getInstance()->checkAddressInServiceArea($location,$storeId);
$in_store_service && $in_store_service_flag = 1;
if($in_store_service_flag) {
$distince = \Our\CommonExtension::getDistance($lat,$lng,$storeInfo['store_latitude'],$storeInfo['store_longitude']);
$DeliveryFormulaInstance = \DAO\DeliveryFormulaModel::getInstance();
$deliveryFormula = \Our\RedisHelper::cachedFunction(\Redis\Db6\DeliveryFormulaRedisModel::getInstance(),array(&$DeliveryFormulaInstance, 'getOne'),array('*',array('store_id'=>$storeId)),\Our\ApiConst::sevenDaySecond,array($storeId));
$formula = $DeliveryFormulaInstance->getDeliveryFormulaByDistince($storeId,$distince,$deliveryFormula);
......@@ -116,12 +114,8 @@ class StoreServiceModel extends \Business\AbstractModel{
$defaultDeliveryTime = (empty($formula['default_time'])?$formula[2]['time']:$formula['default_time']);
}
if(!$defaultDeliveryTime){
//$in_store_service_flag = 0;
$defaultDeliveryTime = 0;
}
}else{
$in_store_service_flag=0;
$defaultDeliveryTime = 0;
}
}
//关注
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment