购物车

parent 33e79af6
......@@ -105,7 +105,6 @@ class CartService
public static function cartLists($user_id,$gid="",$page_size=400,$page=1){
//当前用户所有可用的购物车数据
$where["status"] = 1;
if (!$user_id && !$gid){
return [];
}
......@@ -116,7 +115,7 @@ class CartService
$where["gid"] = $gid;
}
$query = CartModel::where($where)->orderBy('cart_id', 'desc');
$query = CartModel::where($where)->orderBy('status', 'desc');
$res = $query->paginate($page_size, ['*'], 'page', $page)->toArray();
$result = $res["data"];
......@@ -183,6 +182,8 @@ class CartService
$cartList[] = [
"goods_id"=>$skuInfo["goods_id"], //sku_id
"goods_name"=>$skuInfo["goods_name"], //型号名称
"status_cn"=>\Arr::get(CartModel::$status,$v["status"]), //型号名称
"status"=>$v["status"], //型号名称
"supplier_id"=>$skuInfo["supplier_id"], //供应商id
"supplier_name"=>$skuInfo["supplier_name"], //供应商id
"buy_number"=>$temp["buy_number"], //购买数量
......
......@@ -12,6 +12,10 @@ class CartModel extends Model
const status_no = -1; //状态禁用
const status_yes = 1; //状态启动
static $status =[
self::status_no => "禁用",
self::status_yes => "启动",
];
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment