|
@@ -20,6 +20,8 @@ use app\common\library\helper;
|
|
use app\store\model\GoodsCategoryRel as GoodsCategoryRelModel;
|
|
use app\store\model\GoodsCategoryRel as GoodsCategoryRelModel;
|
|
use app\common\enum\goods\Status as GoodsStatusEnum;
|
|
use app\common\enum\goods\Status as GoodsStatusEnum;
|
|
use app\common\model\chef\ChefAreas as RegionModel;
|
|
use app\common\model\chef\ChefAreas as RegionModel;
|
|
|
|
+use app\common\model\store\Setting as SettingModel;
|
|
|
|
+use app\api\service\User as UserService;
|
|
use think\facade\Db;
|
|
use think\facade\Db;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -275,10 +277,12 @@ class Goods extends BaseModel
|
|
* @param array $param 查询条件
|
|
* @param array $param 查询条件
|
|
* @param int $listRows 分页数量
|
|
* @param int $listRows 分页数量
|
|
* @param bool $showVip 会员商品列表
|
|
* @param bool $showVip 会员商品列表
|
|
|
|
+ * @param bool $enableExchange 我能兑换
|
|
|
|
+ * @param string $userPonitsMoney 我能兑换
|
|
* @return mixed
|
|
* @return mixed
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\DbException
|
|
*/
|
|
*/
|
|
- public function getListFront(array $param = [], int $listRows = 15,bool $showVip = false)
|
|
|
|
|
|
+ public function getListFront(array $param = [], int $listRows = 15,bool $showVip = false,$enableExchange = false)
|
|
{
|
|
{
|
|
// 筛选条件
|
|
// 筛选条件
|
|
$query = $this->getQueryFilter($param);
|
|
$query = $this->getQueryFilter($param);
|
|
@@ -298,6 +302,15 @@ class Goods extends BaseModel
|
|
if ($showVip){
|
|
if ($showVip){
|
|
$list = $list->whereExists('select id from yoshop_member_goods where goods_id=goods.goods_id and status=0');
|
|
$list = $list->whereExists('select id from yoshop_member_goods where goods_id=goods.goods_id and status=0');
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if ($enableExchange){
|
|
|
|
+ $user = UserService::getCurrentLoginUser();
|
|
|
|
+ $rate = SettingModel::getItem('points_rate')['points_2_money'];
|
|
|
|
+ //dd($rate);
|
|
|
|
+ $pointsToMoney = bcdiv($user['accumulate_points'], $rate, 2);
|
|
|
|
+ dd($pointsToMoney);
|
|
|
|
+ $list = $list->where('goods_price_min','<',$pointsToMoney);
|
|
|
|
+ }
|
|
$list = $list->field($this->getAliasFields($this->name, ['content']))
|
|
$list = $list->field($this->getAliasFields($this->name, ['content']))
|
|
->where('is_delete', '=', 0)
|
|
->where('is_delete', '=', 0)
|
|
->where('is_show', '=', 1)
|
|
->where('is_show', '=', 1)
|