摘要: 增加商品的时候最好一次性添加,校验让前端来做。 优点: 1. 少掉很多交互逻辑。 2. 创建的时候不会出现=>属性填写一半退出后数据保存到数据库的问题。 部分实现细节(创建sku,并更新sku属性): 阅读全文
posted @ 2019-02-17 15:33 泥土里的绽放 阅读(156) 评论(0) 推荐(0) 编辑
摘要: foreach ($skuList as $sku) { $productToSkuMap[$sku['product_id']][] = $sku; } 阅读全文
posted @ 2019-02-17 15:29 泥土里的绽放 阅读(103) 评论(0) 推荐(0) 编辑
摘要: public function scopeSku($q) { return $q->where(['related_type' => self::RELATED_TYPE_SKU]); } 阅读全文
posted @ 2019-02-17 15:28 泥土里的绽放 阅读(110) 评论(0) 推荐(0) 编辑
摘要: trim(string,charlist) 阅读全文
posted @ 2019-02-17 15:26 泥土里的绽放 阅读(215) 评论(0) 推荐(0) 编辑
摘要: php函数保留所有键值 阅读全文
posted @ 2019-02-17 15:23 泥土里的绽放 阅读(185) 评论(0) 推荐(0) 编辑
摘要: php 函数 阅读全文
posted @ 2019-02-17 15:21 泥土里的绽放 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 1. 将旧数据全部设为无效 2. 使用updateOrCreate,有则更新,无则创建,优秀啊!!!! 阅读全文
posted @ 2019-02-17 15:16 泥土里的绽放 阅读(95) 评论(0) 推荐(0) 编辑
摘要: while ($parentId) { $categoryBack = CategoryBack::query()->where('id', $parentId)->first(); $categoryBackNameArr[] = $categoryBack; $parentId = data_... 阅读全文
posted @ 2019-02-17 15:11 泥土里的绽放 阅读(157) 评论(0) 推荐(0) 编辑
摘要: $names = implode('|', array_column($categoryBackNameArr, 'name')); 阅读全文
posted @ 2019-02-17 15:10 泥土里的绽放 阅读(295) 评论(0) 推荐(0) 编辑
摘要: $minPrice = array_get($productMinAndMaxPriceMap, $product['id'] . '.minPrice', 0); 阅读全文
posted @ 2019-02-17 15:08 泥土里的绽放 阅读(1148) 评论(0) 推荐(0) 编辑
摘要: ->selectRaw('max(marking_price) as maxPrice, min(marking_price) as minPrice, product_id') ->groupBy('product_id') 阅读全文
posted @ 2019-02-17 15:07 泥土里的绽放 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 从记录集中取出 last_name 列,用相应的 "id" 列作为键值: 5698, 'first_name' => 'Bill', 'last_name' => 'Gates', ), array( 'id' => 4767, 'first_name' => 'Steve', 'last_name' => 'Jobs', ) arra... 阅读全文
posted @ 2019-02-17 15:06 泥土里的绽放 阅读(1012) 评论(0) 推荐(0) 编辑