pull/1/head
wangmingchuan321@qq.com 1 year ago
parent a4b5fc1cff
commit 4f1159e75e
  1. 28
      app/api/controller/Goods.php
  2. 8
      app/api/controller/Order.php
  3. 2
      app/api/model/Goods.php
  4. 17
      app/api/model/Order.php
  5. 53
      app/api/service/Goods.php

@ -34,7 +34,10 @@ class Goods extends Controller
{
// 获取列表数据
$model = new GoodsModel;
$list = $model->getList($this->request->param());
$storeid = request()->header()['storeid'];
$param = $this->request->param();
$param['store_id'] = $storeid;
$list = $model->getList($param);
return $this->renderSuccess(compact('list'));
}
@ -116,7 +119,8 @@ class Goods extends Controller
public function brandList(): Json
{
$service = new GoodsService;
$goodsList = $service->brandList();
$storeid = request()->header()['storeid'];
$goodsList = $service->brandList($storeid);
return $this->renderSuccess($goodsList);
}
@ -131,21 +135,25 @@ class Goods extends Controller
public function charts(): Json
{
$service = new GoodsService;
$goodsList = $service->charts();
$storeid = request()->header()['storeid'];
$goodsList = $service->charts($storeid);
return $this->renderSuccess($goodsList);
}
public function chartsGoodsList(): Json
{
$service = new GoodsService;
$goodsList = $service->chartsGoodsList();
$storeid = request()->header()['storeid'];
$goodsList = $service->chartsGoodsList($storeid);
return $this->renderSuccess($goodsList);
}
public function chartsGoodsJing(): Json
{
$service = new GoodsService;
$goodsList = $service->chartsGoodsJing();
$storeid = request()->header()['storeid'];
$goodsList = $service->chartsGoodsJing($storeid);
return $this->renderSuccess($goodsList);
}
@ -153,17 +161,13 @@ class Goods extends Controller
public function cityInfo(): Json
{
$service = new GoodsService;
$goodsList = $service->cityInfo();
return $this->renderSuccess($goodsList);
}
$storeid = request()->header()['storeid'];
public function panicList(): Json
{
$service = new GoodsService;
$goodsList = $service->panicList();
$goodsList = $service->cityInfo($storeid);
return $this->renderSuccess($goodsList);
}
/**
* 生成商品海报
* @param int $goodsId 商品ID

@ -38,7 +38,10 @@ class Order extends Controller
{
$model = new OrderModel;
$list = $model->getList($dataType);
return $this->renderSuccess(compact('list'));
// return $this->renderSuccess(compact('list'));
$list = $this->renderSuccess(compact('list'));
return $list;
}
public function del()
@ -66,6 +69,9 @@ class Order extends Controller
$model = OrderModel::getUserOrderDetail($orderId);
//todo wmc 自提时间
$model->ziti_time = '2024-03-02 22:22:22';
$model->ziti_status = 0;//0没提 1已提货
$model->ziti_image = ['https://www.saas.njrenzhou.com/uploads/10001/20240116/18adc22ad9ea021ab2586878fe1035b0.png'];
return $this->renderSuccess([
'order' => $model, // 订单详情
'setting' => [

@ -94,7 +94,7 @@ class Goods extends GoodsModel
* @return mixed|\think\model\Collection|\think\Paginator
* @throws \think\db\exception\DbException
*/
public function getList(array $param = [], int $listRows = 15)
public function getList(array $param = [],int $listRows = 15)
{
// 整理查询参数

@ -24,6 +24,7 @@ use app\common\enum\{
order\ReceiptStatus as ReceiptStatusEnum,
order\DeliveryStatus as DeliveryStatusEnum
};
use app\api\service\Store as StoreService;
use app\common\library\helper;
use cores\exception\BaseException;
@ -44,7 +45,6 @@ class Order extends OrderModel
'order_source_data',
'is_settled',
'is_delete',
'store_id',
'update_time'
];
@ -107,7 +107,7 @@ class Order extends OrderModel
* @throws BaseException
* @throws \think\db\exception\DbException
*/
public function getList(string $dataType = 'all'): \think\Paginator
public function getList(string $dataType = 'all')
{
// 设置订单类型条件
@ -121,7 +121,6 @@ class Order extends OrderModel
->order(['create_time' => 'desc']);
if (!empty($_GET['keyword'])) {
$query = $this->with(['goods.image'])
->alias('a')
->join('order_goods b', 'b.order_id = a.order_id')
->where($dataTypeFilter)
->where('a.user_id', '=', $userId)
@ -129,7 +128,17 @@ class Order extends OrderModel
->where('a.is_delete', '=', 0)
->order(['a.create_time' => 'desc']);
}
$list = $query->paginate(15);
$list = $query->paginate(15)->toArray();
//这边后面改成多商户的话需要根据storeid去获取信息
$service = new StoreService;
$info = $service->data()['storeInfo']->toArray();
//todo wmc
$info['phone'] = 13770778236;
foreach ($list['data'] as &$v) {
$v['storeInfo'] = $info;
}
return $list;
}

@ -48,7 +48,28 @@ class Goods extends GoodsService
public function getCommonConfig()
{
//todo wmc1新品首发背景图 2限时秒杀背景图 3排行榜背景图
//todo wmc1新品首发背景图 2限时秒杀背景图 3排行榜背景图 4大牌正品是轮播
switch (request()->get('type')) {
case 1:
$data['imgurl']= 'https://www.saas.njrenzhou.com/uploads/10001/20240131/bdc5f17f3ff8c53ce0853177bc4f1917.png';
return $data;
break;
case 2:
$data['imgurl']= 'https://www.saas.njrenzhou.com/uploads/10001/20240131/e8e10653875e779bc72dbee65b8072c0.png';
return $data;
break;
case 3:
$data['imgurl']= 'https://www.saas.njrenzhou.com/uploads/10001/20240131/5c4ec6ffeb23223936295e290dc3d1f9.png';
return $data;
break;
case 4:
$data['imgurl']= [
'https://www.saas.njrenzhou.com/uploads/10001/20240131/5c4ec6ffeb23223936295e290dc3d1f9.png',
];
return $data;
break;
}
return [];
}
@ -85,7 +106,7 @@ class Goods extends GoodsService
}
//大牌正品列表
public function brandList()
public function brandList($storeid)
{
$page = (int)$_GET['page'];
@ -96,7 +117,7 @@ class Goods extends GoodsService
'is_delete' => 0,
'is_brand' => $_GET['is_brand'],
'is_new' => $_GET['is_new'],
'store_id' => $_GET['store_id'],
'store_id' => $storeid,
'categoryId' => (int)$_GET['categoryId'],
], 15);
@ -107,18 +128,12 @@ class Goods extends GoodsService
$list['data'] = $this->formatGoodsList($goodsList);
return $list;
// $list = $model->where([
// 'is_delete' => 0,
// 'status' => 10,
// 'is_brand' => 1,
// 'store_id' => $_GET['store_id']
// ])->field('goods_name,sales_initial,sales_actual,goods_id,goods_price_min')->paginate($page)->toArray();
}
//排行榜分类列表 一级
public function charts(): array
public function charts($storeid): array
{
$model = new CategoryModel;
@ -126,14 +141,14 @@ class Goods extends GoodsService
'parent_id' => 0,
'status' => 1,
'is_paihang' => 1,
'store_id' => $_GET['store_id']
'store_id' => $storeid
])->order('category_id desc')->select()->toArray();
return $list;
}
public function chartsGoodsList()
public function chartsGoodsList($storeid)
{
$model = new GoodsModel;
@ -141,7 +156,7 @@ class Goods extends GoodsService
'status' => 10,
'is_delete' => 0,
'paihang' => 1,
'store_id' => $_GET['store_id'],
'store_id' => $storeid,
'categoryId' => (int)$_GET['categoryId'],
], 15);
@ -155,7 +170,7 @@ class Goods extends GoodsService
}
public function chartsGoodsJing(): array
public function chartsGoodsJing($storeid): array
{
$model = new CategoryModel;
@ -163,7 +178,7 @@ class Goods extends GoodsService
'parent_id' => 0,
'status' => 1,
'is_paihang' => 1,
'store_id' => $_GET['store_id']
'store_id' => $storeid
])->order('category_id desc')->select()->toArray();
$model = new GoodsModel;
foreach ($list as &$v) {
@ -171,7 +186,7 @@ class Goods extends GoodsService
'status' => 10,
'is_delete' => 0,
'paihang' => 1,
'store_id' => $_GET['store_id'],
'store_id' => $storeid,
'categoryId' => $v['category_id'],
], 3);
$list2 = $goodsList->toArray()['data'];
@ -184,17 +199,17 @@ class Goods extends GoodsService
//同城信息
public function cityInfo(): array
public function cityInfo($storeid): array
{
$model = new ShopModel;
$info = $model->where([
'is_delete' => 0,
'status' => 1,
'store_id' => $_GET['store_id'],
'store_id' => $storeid,
'is_main' => 1,
])->field('shop_name,star,shop_hours,summary,phone,
province_id,city_id,region_id,shop_id,address,latitude,longitude')->find()->toArray();
//todo wmc
$info['remark'] = ['手机选购', '电脑选购'];
$info['star'] = 5;
$info['fuwu_hours'] = 5;

Loading…
Cancel
Save