pull/1/head
wanghousheng 10 months ago
parent b8ae85799f
commit 701d9f8230
  1. 37
      app/common/model/Goods.php
  2. 6
      app/store/controller/Server.php

@ -13,19 +13,18 @@ declare (strict_types=1);
namespace app\common\model;
use app\api\service\User as UserService;
use app\common\enum\goods\Status as GoodsStatusEnum;
use app\common\enum\order\DeliveryType as DeliveryTypeEnum;
use app\common\library\helper;
use app\store\model\GoodsCategoryRel as GoodsCategoryRelModel;
use cores\BaseModel;
use think\db\BaseQuery;
use think\db\exception\DbException;
use think\model\Collection;
use think\model\relation\BelongsTo;
use think\model\relation\HasMany;
use think\Paginator;
use think\model\Collection;
use think\model\relation\HasOne;
use app\store\model\GoodsCategoryRel as GoodsCategoryRelModel;
use app\common\library\helper;
use app\common\enum\goods\Status as GoodsStatusEnum;
use app\common\enum\order\DeliveryType as DeliveryTypeEnum;
use think\Paginator;
/**
* 商品模型
@ -357,25 +356,23 @@ class Goods extends BaseModel
$goodsInfo['goods_image'] = current($goodsInfo['goods_images'])['preview_url'];
// 商品销量(实际显示=初始虚拟销量+实际销量)
$goodsInfo['goods_sales'] = $goodsInfo['sales_initial'] + $goodsInfo['sales_actual'];
//商品价格判断
if (UserService::isLogin()) {
if (UserService::isStore()) {//店主
$goodsInfo['goods_price_min_plus'] = 0;
$goodsInfo['goods_price_min_dealer'] = 0;
} elseif (UserService::isDealerMember()) { //分销商
$goodsInfo['goods_price_min_dealer'] = 0;
} elseif (UserService::isPlusMember()) {//升级会员
$goodsInfo['goods_price_min_plus'] = 0;
}
}
// //商品价格判断
// if (UserService::isLogin()) {
// if (UserService::isStore()) {//店主
// $goodsInfo['goods_price_min_plus'] = 0;
// $goodsInfo['goods_price_min_dealer'] = 0;
// } elseif (UserService::isDealerMember()) { //分销商
// $goodsInfo['goods_price_min_dealer'] = 0;
// } elseif (UserService::isPlusMember()) {//升级会员
// $goodsInfo['goods_price_min_plus'] = 0;
// }
// }
// 回调函数
is_callable($callback) && call_user_func($callback, $goodsInfo);
return $goodsInfo;
}
/**
* 根据商品id集获取商品列表
* @param array $goodsIds

@ -212,7 +212,7 @@ class Server extends Controller
$order_status = intval($this->request->post('order_status'));
$where = [];
if (!empty($server_name)) {
$where[] = ['a.server_name', 'like', `%$server_name%`];
$where[] = ['a.server_name', 'like', "%$server_name%"];
}
if (!empty($order_no)) {
$where[] = ['a.order_no', '=', $order_no];
@ -229,7 +229,9 @@ class Server extends Controller
$where[] = ['b.nick_name', 'like', "%$server_name%"];
}
$list = $model->getList($where);
return $this->renderSuccess(compact('list'));
$data['list'] = $list->items();
$data['total'] = $list->total();
return $this->renderSuccess($data);
}
/**

Loading…
Cancel
Save