Commit d4137182 authored by luhongguang's avatar luhongguang

update:op good list

parent 2c071c87
......@@ -22,6 +22,7 @@ class GoodsAddValidate extends BaseValidate
'inventory_total' => 'require',
'life_account_id' => 'require',
'merchant_id' => 'require',
'u_id' => 'require',
];
protected $message = [
......@@ -35,5 +36,6 @@ class GoodsAddValidate extends BaseValidate
'inventory_total' => '请填写库存',
'life_account_id' => 'life_account_id 不能为空',
'merchant_id' => 'merchant_id 不能为空',
'u_id' => 'u_id 不能为空',
];
}
\ No newline at end of file
......@@ -49,4 +49,9 @@ class GoodsSku extends MysqlBase
{
return self::delete($where);
}
public static function getCount($where)
{
return self::count($where);
}
}
\ No newline at end of file
......@@ -55,7 +55,7 @@ class GoodsController extends Base
$params = $this->params;
$data = GoodsService::getGoodsSpuInfo($params);
$this->success(["data"=>$data]);
$this->success(["data" => $data]);
}
/**
......@@ -67,7 +67,7 @@ class GoodsController extends Base
$params = $this->params;
$data = GoodsService::getGoodsSkuInfo($params);
$this->success(["data"=>$data]);
$this->success(["data" => $data]);
}
/**
......@@ -113,7 +113,10 @@ class GoodsController extends Base
*/
public function goods_list_opAction()
{
$params = $this->params;
$data = GoodsService::getOpGoodsSpuList($params);
$this->success(["data" => $data]);
}
/**
......
......@@ -91,6 +91,7 @@ class GoodsService
"goods_spu_id" => $spuId,
"shop_id" => $shopId,
"life_account_id" => $spuData["life_account_id"],
"u_id" => $spuData["u_id"],
"name" => $spuData["name"],
"url" => $spuData["url"],
"desc" => $spuData["desc"],
......@@ -472,4 +473,59 @@ class GoodsService
$data["goods_info"] = $goodsSku;
return $data;
}
/**
* op后台商品列表
* @param array $params
* @return array
*/
public static function getOpGoodsSpuList($params = [])
{
$params['page'] = !empty($params['page']) ? $params['page'] : 1;
$limit = !empty($params['page_size']) ? $params['page_size'] : 20;
$page = ($params['page'] - 1) * $limit;
$where = $data = [];
if (!empty($params["goods_spu_id"])) {
$where["goods_spu_id"] = $params["goods_spu_id"];
}
if (!empty($params["name"])) {
$where["name"] = $params["name"];
}
if (!empty($params["category_1_id"])) {
$where["category_1_id"] = $params["category_1_id"];
}
if (!empty($params["category_2_id"])) {
$where["category_2_id"] = $params["category_2_id"];
}
if (!empty($params["life_account_id"])) {
$where["life_account_id"] = $params["life_account_id"];
}
if (!empty($params["status"])) {
$where["status"] = $params["status"];
}
if (!empty($params["online_status"])) {
$where["online_status"] = $params["online_status"];
}
$count = GoodsSku::getCount($where);
$where['LIMIT'] = [$page, $limit];
$where['ORDER'] = ["create_time" => "DESC"];
$list = GoodsSku::select(["goods_spu_id", "goods_sku_id", "name", "category_1_id", "category_2_id", "life_account_id",
"u_id", "update_time", "create_time", "status", "online_status"],
$where);
return ["list" => $list, "count" => $count];
}
public static function getBGoodsSpuList($params = [])
{
}
public static function getCGoodsSpuList($params = [])
{
}
}
\ No newline at end of file
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 to comment