Commit cf520fa1 authored by jianghaiming's avatar jianghaiming

update:set

parent e2dcf593
...@@ -10,7 +10,7 @@ class SubShop extends MysqlBase ...@@ -10,7 +10,7 @@ class SubShop extends MysqlBase
{ {
const TABLE_NAME = 'sub_shop'; const TABLE_NAME = 'sub_shop';
const CONFIG_INDEX = 'goods'; const CONFIG_INDEX = 'goods';
const PRIMARY_KEY = 'stores_id'; const PRIMARY_KEY = 'sub_shop_id';
public static function getRecord($where, $colums = []) public static function getRecord($where, $colums = [])
......
...@@ -21,15 +21,15 @@ class ShopService ...@@ -21,15 +21,15 @@ class ShopService
*/ */
public static function addShop($params) public static function addShop($params)
{ {
$life_account_id = !empty($params['life_account_id']) ? $params['life_account_id'] : ''; $lifeAccountId = !empty($params['life_account_id']) ? $params['life_account_id'] : '';
$phone = !empty($params['phone']) ? $params['phone'] : ''; $phone = !empty($params['phone']) ? $params['phone'] : '';
$shop_id = !empty($params['shop_id']) ? $params['shop_id'] : ''; $shopId = !empty($params['shop_id']) ? $params['shop_id'] : '';
$name = !empty($params['name']) ? $params['name'] : ''; $name = !empty($params['name']) ? $params['name'] : '';
$address_lng = !empty($params['address_lng']) ? $params['address_lng'] : ''; $addressLng = !empty($params['address_lng']) ? $params['address_lng'] : '';
$address_lat = !empty($params['address_lat']) ? $params['address_lat'] : ''; $addressLat = !empty($params['address_lat']) ? $params['address_lat'] : '';
$address = !empty($params['address']) ? $params['address'] : ''; $address = !empty($params['address']) ? $params['address'] : '';
if (empty($life_account_id)) { if (empty($lifeAccountId)) {
throw new ShopException(['cus'=>0]); throw new ShopException(['cus'=>0]);
} }
...@@ -70,14 +70,14 @@ class ShopService ...@@ -70,14 +70,14 @@ class ShopService
throw new ShopException(['cus'=>7]); throw new ShopException(['cus'=>7]);
} }
$res = self::getIdgenId(1, 'goods', $count = 1); $res = self::getIdgenId(1, 'goods', $count = 1);
$stores_id = !empty($res[0]) ? $res[0] : ''; $subShopId = !empty($res[0]) ? $res[0] : '';
$colums = [ $colums = [
'stores_id' => $stores_id, 'sub_shop_id' => $subShopId,
'life_account_id' => $life_account_id, 'life_account_id' => $lifeAccountId,
'shop_id' => $shop_id, 'shop_id' => $shopId,
'name' => $name, 'name' => $name,
'address_lng' => $address_lng, 'address_lng' => $addressLng,
'address_lat' => $address_lat, 'address_lat' => $addressLat,
'address' => $address, 'address' => $address,
'phone' => $phone, 'phone' => $phone,
'create_time' => date("Y-m-d H:i:s"), 'create_time' => date("Y-m-d H:i:s"),
...@@ -129,8 +129,8 @@ class ShopService ...@@ -129,8 +129,8 @@ class ShopService
public static function updateShop($params, $where) public static function updateShop($params, $where)
{ {
$name = !empty($params['name']) ? $params['name'] : ''; $name = !empty($params['name']) ? $params['name'] : '';
$address_lng = !empty($params['address_lng']) ? $params['address_lng'] : ''; $addressLng = !empty($params['address_lng']) ? $params['address_lng'] : '';
$address_lat = !empty($params['address_lat']) ? $params['address_lat'] : ''; $addressLat = !empty($params['address_lat']) ? $params['address_lat'] : '';
$address = !empty($params['address']) ? $params['address'] : ''; $address = !empty($params['address']) ? $params['address'] : '';
$phone = !empty($params['phone']) ? $params['phone'] : ''; $phone = !empty($params['phone']) ? $params['phone'] : '';
...@@ -147,12 +147,12 @@ class ShopService ...@@ -147,12 +147,12 @@ class ShopService
$colums['name'] = $name; $colums['name'] = $name;
} }
if (!empty($address_lng)) { if (!empty($addressLng)) {
$colums['address_lng'] = $address_lng; $colums['address_lng'] = $addressLng;
} }
if (!empty($address_lat)) { if (!empty($addressLat)) {
$colums['address_lat'] = $address_lat; $colums['address_lat'] = $addressLat;
} }
if (!empty($address)) { if (!empty($address)) {
......
<?php
namespace App\Services\goods;
use App\Models\goods\mysql\Category;
class CategoryService
{
public static function getCategoryList()
{
//todo::加上redis
$allCaregoryList = Category::getRecordList([], ['category_id', 'parent_category_id', 'name', 'level']);
$data = [];
if (!empty($allCaregoryList)) {
foreach ($allCaregoryList as $caregory) {
if ($caregory["level"] == Category::LEVEL_1) {
$data["level_1"][] = [
"category_id" => $caregory["category_id"],
"name" => $caregory["name"]
];
}
if ($caregory["level"] == Category::LEVEL_2) {
$data["level_2"][$caregory["parent_category_id"]][] = [
"category_id" => $caregory["category_id"],
"name" => $caregory["name"]
];
}
}
}
return $data;
}
}
\ 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