|
|
|
@ -222,6 +222,19 @@ class Goods extends GoodsService |
|
|
|
|
province_id,city_id,region_id,shop_id,address,latitude,longitude,wechat_img_id,history1,history2,history3,remark,history,parking_name,parking_desc,parking_latitude,parking_longitude,shop_image_id,fuwu_hours,fuwu_num')->find()->toArray(); |
|
|
|
|
//todo wmc |
|
|
|
|
$info['remark'] = json_decode($info['remark'],true); |
|
|
|
|
$arr = explode(" ", $info['shop_hours']); |
|
|
|
|
$arr = explode("-", $arr[1] ?? ""); |
|
|
|
|
$info['is_open'] = 0; |
|
|
|
|
// if ($arr && count($arr) == 2) { |
|
|
|
|
// $start = explode(":", $arr[0]); |
|
|
|
|
// $end = explode(":", $arr[1]); |
|
|
|
|
// $start_time = ($start[0] ?? 0) |
|
|
|
|
// if ($start[0]) { |
|
|
|
|
// // code... |
|
|
|
|
// } |
|
|
|
|
// $info['is_open'] = 0; |
|
|
|
|
// } |
|
|
|
|
// $info['is_open'] = $arr && $arr[] |
|
|
|
|
// $info['fuwu_hours'] = 5; |
|
|
|
|
// $info['fuwu_num'] = 15; |
|
|
|
|
// $info['wechat'] = 'https://www.saas.njrenzhou.com/uploads/10001/20240127/12bb1b1747e652d258443247a5c4777c.png'; |
|
|
|
@ -289,7 +302,19 @@ class Goods extends GoodsService |
|
|
|
|
// return $list; |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function getGoodsPrice($goods_id, $price, $cost_price){ |
|
|
|
|
$catService = new \app\store\model\GoodsCategoryRel(); |
|
|
|
|
$catIds = $catService->where(['goods_id' => $goods_id])->column('category_id'); |
|
|
|
|
if (UserService::isstore()) { |
|
|
|
|
$price = $cost_price; |
|
|
|
|
} elseif (UserService::isPlusMember()) { |
|
|
|
|
$price = \app\common\model\PriceSet::membershipPrice($price, $cost_price, $catIds); |
|
|
|
|
} elseif (UserService::isDealerMember()) { |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($price, $cost_price, $catIds); |
|
|
|
|
$price = $priceArr['goods_price_min_dealer']; |
|
|
|
|
} |
|
|
|
|
return $price; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 格式化商品列表 |
|
|
|
|
* @param $goodsList |
|
|
|
@ -297,56 +322,61 @@ class Goods extends GoodsService |
|
|
|
|
*/ |
|
|
|
|
private function formatGoodsList($goodsList): array |
|
|
|
|
{ |
|
|
|
|
$data = []; |
|
|
|
|
foreach ($goodsList as $goods) { |
|
|
|
|
$temp = [ |
|
|
|
|
'goods_id' => $goods['goods_id'], |
|
|
|
|
'goods_name' => $goods['goods_name'], |
|
|
|
|
'selling_point' => $goods['selling_point'], |
|
|
|
|
'goods_image' => $goods['goods_image'], |
|
|
|
|
'goods_price_min' => $goods['goods_price_min'],//商品价格 |
|
|
|
|
'goods_price_max' => $goods['goods_price_max'], |
|
|
|
|
'line_price_min' => $goods['goods_price_min'],//划线价格等于市场价 |
|
|
|
|
'line_price_max' => $goods['line_price_max'], |
|
|
|
|
'goods_sales' => $goods['goods_sales'], |
|
|
|
|
'remaizhishu' => $goods['remaizhishu'], |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
if (UserService::isLogin()) { |
|
|
|
|
$catService = new \app\store\model\GoodsCategoryRel(); |
|
|
|
|
$catIds = $catService->where(['goods_id' => $goods['goods_id']])->column('category_id'); |
|
|
|
|
// $price_list_plus = $price_list_dealer = []; |
|
|
|
|
// foreach ($catIds as $k => $v) { |
|
|
|
|
// $price_list_plus[] = GoodsPriceModel::getDiscountPrice($v, 1, $goods['goods_price_min']); |
|
|
|
|
// $price_list_dealer[] = GoodsPriceModel::getDiscountPrice($v, 2, $goods['goods_price_min']); |
|
|
|
|
// echo "<pre>"; |
|
|
|
|
// print_r($goodsList->toArray()); |
|
|
|
|
// exit(); |
|
|
|
|
// $data = []; |
|
|
|
|
// foreach ($goodsList as $goods) { |
|
|
|
|
// $temp = [ |
|
|
|
|
// 'goods_id' => $goods['goods_id'], |
|
|
|
|
// 'goods_name' => $goods['goods_name'], |
|
|
|
|
// 'selling_point' => $goods['selling_point'], |
|
|
|
|
// 'goods_image' => $goods['goods_image'], |
|
|
|
|
// 'goods_price_min' => $goods['goods_price_min'],//商品价格 |
|
|
|
|
// 'goods_price_max' => $goods['goods_price_max'], |
|
|
|
|
// 'line_price_min' => $goods['goods_price_min'],//划线价格等于市场价 |
|
|
|
|
// 'line_price_max' => $goods['line_price_max'], |
|
|
|
|
// 'goods_sales' => $goods['goods_sales'], |
|
|
|
|
// 'remaizhishu' => $goods['remaizhishu'], |
|
|
|
|
// ]; |
|
|
|
|
// var_dump($goods->toArray()); |
|
|
|
|
// var_dump($temp); |
|
|
|
|
// exit(); |
|
|
|
|
// if (UserService::isLogin()) { |
|
|
|
|
// $catService = new \app\store\model\GoodsCategoryRel(); |
|
|
|
|
// $catIds = $catService->where(['goods_id' => $goods['goods_id']])->column('category_id'); |
|
|
|
|
// // $price_list_plus = $price_list_dealer = []; |
|
|
|
|
// // foreach ($catIds as $k => $v) { |
|
|
|
|
// // $price_list_plus[] = GoodsPriceModel::getDiscountPrice($v, 1, $goods['goods_price_min']); |
|
|
|
|
// // $price_list_dealer[] = GoodsPriceModel::getDiscountPrice($v, 2, $goods['goods_price_min']); |
|
|
|
|
// // } |
|
|
|
|
|
|
|
|
|
// //价格判断 |
|
|
|
|
// if (UserService::isstore()) { |
|
|
|
|
|
|
|
|
|
// //$priceArr = \app\common\model\PriceSet::distributionPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds); |
|
|
|
|
|
|
|
|
|
// // $temp['goods_price_min_plus'] = $priceArr['membershipPrice']; |
|
|
|
|
// // $temp['goods_price_min_dealer'] = $priceArr['distributionPrice']; |
|
|
|
|
// $temp['goods_price_min'] = $goods['cost_price_min']; |
|
|
|
|
// // $temp['goods_price_min_plus'] = min($price_list_plus); |
|
|
|
|
// // $temp['goods_price_min_dealer'] = min($price_list_dealer); |
|
|
|
|
// } elseif (UserService::isPlusMember()) { |
|
|
|
|
// //$temp['goods_price_min_plus'] = \app\common\model\PriceSet::membershipPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds); |
|
|
|
|
// $temp['goods_price_min'] = \app\common\model\PriceSet::membershipPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds); |
|
|
|
|
// // $temp['goods_price_min'] = $temp['goods_price_min_plus']; |
|
|
|
|
// // $temp['goods_price_max'] = $temp['goods_price_min_plus']; |
|
|
|
|
// //$temp['goods_price_min_plus'] = min($price_list_plus); |
|
|
|
|
// } elseif (UserService::isDealerMember()) { |
|
|
|
|
// $priceArr = \app\common\model\PriceSet::distributionPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds); |
|
|
|
|
// //$temp['goods_price_min_dealer'] = $priceArr['distributionPrice']; |
|
|
|
|
// $temp['goods_price_min'] = $priceArr['goods_price_min_dealer']; |
|
|
|
|
// //$temp['goods_price_min_dealer'] = min($price_list_dealer); |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
//价格判断 |
|
|
|
|
if (UserService::isstore()) { |
|
|
|
|
|
|
|
|
|
//$priceArr = \app\common\model\PriceSet::distributionPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds); |
|
|
|
|
|
|
|
|
|
// $temp['goods_price_min_plus'] = $priceArr['membershipPrice']; |
|
|
|
|
// $temp['goods_price_min_dealer'] = $priceArr['distributionPrice']; |
|
|
|
|
$temp['goods_price_min'] = $goods['cost_price_min']; |
|
|
|
|
// $temp['goods_price_min_plus'] = min($price_list_plus); |
|
|
|
|
// $temp['goods_price_min_dealer'] = min($price_list_dealer); |
|
|
|
|
} elseif (UserService::isPlusMember()) { |
|
|
|
|
//$temp['goods_price_min_plus'] = \app\common\model\PriceSet::membershipPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds); |
|
|
|
|
$temp['goods_price_min'] = \app\common\model\PriceSet::membershipPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds); |
|
|
|
|
// $temp['goods_price_min'] = $temp['goods_price_min_plus']; |
|
|
|
|
// $temp['goods_price_max'] = $temp['goods_price_min_plus']; |
|
|
|
|
//$temp['goods_price_min_plus'] = min($price_list_plus); |
|
|
|
|
} elseif (UserService::isDealerMember()) { |
|
|
|
|
$priceArr = \app\common\model\PriceSet::distributionPrice($goods['goods_price_min'], $goods['cost_price_min'], $catIds); |
|
|
|
|
//$temp['goods_price_min_dealer'] = $priceArr['distributionPrice']; |
|
|
|
|
$temp['goods_price_min'] = $priceArr['goods_price_min_dealer']; |
|
|
|
|
//$temp['goods_price_min_dealer'] = min($price_list_dealer); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$data[] = $temp; |
|
|
|
|
} |
|
|
|
|
return $data; |
|
|
|
|
// } |
|
|
|
|
// $data[] = $temp; |
|
|
|
|
// } |
|
|
|
|
return is_array($goodsList) ? $goodsList : $goodsList->toArray(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|