pull/5/head
zengyyh 3 months ago
parent 86fcaf7357
commit 300e5a6919
  1. 7
      app/api/controller/sharp/Goods.php
  2. 7
      app/common/model/sharp/Goods.php
  3. 27
      app/common/model/successful.php
  4. 4
      app/store/controller/Successful.php

@ -18,6 +18,7 @@ use app\api\service\User as UserService;
use app\api\service\sharp\Active as ActiveService;
use app\common\service\qrcode\sharp\Goods as GoodsPoster;
use cores\exception\BaseException;
use app\api\service\Setting as SettingService;
/**
* 整点秒杀-商品管理
@ -57,6 +58,12 @@ class Goods extends Controller
// 获取秒杀活动商品详情
$service = new ActiveService;
$data = $service->getActiveGoodsDetail($activeTimeId, $sharpGoodsId);
$storeId = $data['active']['store_id'];
$merchantId = $data['goods']['merchant_id'];
//获取客服设置
$service = new SettingService;
$setting = $service->getGoodsCustomer($merchantId,$storeId);
$data['setting'] = $setting;
return $this->renderSuccess($data);
}

@ -112,7 +112,12 @@ class Goods extends BaseModel
$item['goods_image'] = !empty($item['goods']['goods_image']) ? $item['goods']['goods_image'] : '';
// 秒杀商品原价 (获取主商品价格)
//$item['original_price'] = !empty($item['goods']['original_price']) ? $item['goods']['original_price']: $item['goods']['goods_price_min'];
$item['original_price'] = isset($item['goods']['original_price']) ? $item['goods']['original_price'] : $item['goods']['goods_price_min'];
if (isset($item['goods']) && $item['goods'] !== null) {
$item['original_price'] = isset($item['goods']['original_price']) ? $item['goods']['original_price'] : $item['goods']['goods_price_min'];
} else {
// 可以设置一个默认值或处理逻辑
$item['original_price'] = null; // 或者其他默认值
}
// 回调函数
is_callable($callback) && call_user_func($callback, $item);
}

@ -32,13 +32,13 @@ class successful extends BaseModel
* @param array $param 查询参数
* @return \think\Paginator
*/
public function list($page ,$pageSize): \think\Paginator
public function list(array $param): \think\Paginator
{
// 假设从数据库查询数据
$query = self::order('sort', 'asc')->paginate($pageSize);
$filter = $this->getFilter($param);
// 使用分页方法
return $query;
$list = $this->where($filter)->order('sort', 'asc')->paginate($param['pageSize'] ?? 15);;
return $list;
}
/**
@ -65,4 +65,23 @@ class successful extends BaseModel
}
return false;
}
/**
* 设置查询条件
* @param array $param
* @return array
*/
private function getFilter(array $param): array
{
// 设置默认的检索数据
$params = $this->setQueryDefaultValue($param, [
'successful' => '', // 查询内容
]);
// 检索查询条件
$filter = [];
// 用户昵称/订单号
!empty($params['successful']) && $filter[] = ['successful', 'like', "%{$params['successful']}%"];
return $filter;
}
}

@ -25,9 +25,7 @@ class Successful extends Controller
public function getList()
{
$model = new SuccessfulModel;
$page = $this->request->param('page',1);
$pageSize = $this->request->param('pageSize',15);
$list = $model->list($page,$pageSize);
$list = $model->list($this->request->param());
if(empty($list)){
return $this->renderSuccess('暂无数据');
}

Loading…
Cancel
Save