|
@@ -41,7 +41,7 @@ class GoodsController extends Controller
|
41
|
41
|
if($cate_name) $query->where('goodsCategoryName', '=', $cate_name);
|
42
|
42
|
if($stime) $query->where('createTime', '>=', $stime);
|
43
|
43
|
if($etime) $query->where('createTime', '<=', $etime);
|
44
|
|
- })->count();
|
|
44
|
+ })->where('is_del', '<', 2)->count();
|
45
|
45
|
if ($count > 1) {
|
46
|
46
|
// 总页数
|
47
|
47
|
$pages = ceil($count/$pageSize);
|
|
@@ -55,7 +55,7 @@ class GoodsController extends Controller
|
55
|
55
|
if($cate_name) $query->where('goodsCategoryName', '=', $cate_name);
|
56
|
56
|
if($stime) $query->where('createTime', '>=', $stime);
|
57
|
57
|
if($etime) $query->where('createTime', '<=', $etime);
|
58
|
|
- })->orderBy('id', 'desc')->offset($offset)->limit($pageSize)->get();
|
|
58
|
+ })->where('is_del', '<', 2)->orderBy('id', 'desc')->offset($offset)->limit($pageSize)->get();
|
59
|
59
|
$result = json_decode(json_encode($result),true);
|
60
|
60
|
|
61
|
61
|
foreach($result as $k=>&$v){
|
|
@@ -342,7 +342,7 @@ class GoodsController extends Controller
|
342
|
342
|
* @param Request $request
|
343
|
343
|
* @return \Illuminate\Http\RedirectResponse
|
344
|
344
|
*/
|
345
|
|
- public function delete($id)
|
|
345
|
+ public function down($id)
|
346
|
346
|
{
|
347
|
347
|
$goods = Goods::find($id);
|
348
|
348
|
$goods->is_del = 1;
|
|
@@ -384,6 +384,30 @@ class GoodsController extends Controller
|
384
|
384
|
}
|
385
|
385
|
|
386
|
386
|
/**
|
|
387
|
+ * 下架操作
|
|
388
|
+ * @param Request $request
|
|
389
|
+ * @return \Illuminate\Http\RedirectResponse
|
|
390
|
+ */
|
|
391
|
+ public function delete($id)
|
|
392
|
+ {
|
|
393
|
+ $goods = Goods::find($id);
|
|
394
|
+ $goods->is_del = 2;
|
|
395
|
+ if ($goods ->save()){
|
|
396
|
+ #记录操作日志
|
|
397
|
+ $self_id = session('admin_id');
|
|
398
|
+ $self_name = session('real_name');
|
|
399
|
+ $context = "删除商品";
|
|
400
|
+ $type = 0;
|
|
401
|
+ $tables = 'goods';
|
|
402
|
+ $data_id = $id;
|
|
403
|
+ Oplog::addLog($self_id, $self_name, $context, $type, $tables, $data_id);
|
|
404
|
+ exit('1');
|
|
405
|
+ }
|
|
406
|
+ exit('0');
|
|
407
|
+ }
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+ /**
|
387
|
411
|
* 搜索商品
|
388
|
412
|
*/
|
389
|
413
|
public function searchSkus(Request $request){
|