{"id":30844077,"url":"https://github.com/edenleung/sku","last_synced_at":"2025-09-06T22:08:45.421Z","repository":{"id":57083981,"uuid":"288079461","full_name":"edenleung/sku","owner":"edenleung","description":"sku package for vant","archived":false,"fork":false,"pushed_at":"2020-08-19T08:33:08.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-19T14:21:26.802Z","etag":null,"topics":["sku","thinkphp","vant"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edenleung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-17T04:00:08.000Z","updated_at":"2024-05-19T14:21:26.803Z","dependencies_parsed_at":"2022-08-24T14:59:09.598Z","dependency_job_id":null,"html_url":"https://github.com/edenleung/sku","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/edenleung/sku","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenleung%2Fsku","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenleung%2Fsku/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenleung%2Fsku/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenleung%2Fsku/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edenleung","download_url":"https://codeload.github.com/edenleung/sku/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenleung%2Fsku/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273968673,"owners_count":25199653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sku","thinkphp","vant"],"created_at":"2025-09-06T22:08:44.516Z","updated_at":"2025-09-06T22:08:45.373Z","avatar_url":"https://github.com/edenleung.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sku\n\n## 安装\n\n```bash\n$ composer require xiaodi/sku:dev-master\n```\n\n## 使用\n\n```php\nuse xiaodi\\Sku\\Service\\SkuAttr;\nuse xiaodi\\Sku\\Service\\SkuGoods;\n\nuse app\\model\\SkuAttr;\nuse app\\model\\SkuGoods;\n\n$sku_a = new SkuAttr(new \\app\\model\\SkuAttr);\n$sku_a-\u003ecreate('内存');\n$sku_a-\u003ecreate('存储');\n\n$sku_a-\u003ecreate('4g', [\n\t'pid' =\u003e 1\n]);\n\n$sku_a-\u003ecreate('128G', [\n\t'pid' =\u003e 2\n]);\n\n$sku_a-\u003ecreate('8g', [\n\t'pid' =\u003e 1\n]);\n\n$sku_a-\u003ecreate('256G', [\n\t'pid' =\u003e 2\n]);\n\n$sku_g = new SkuAttr(new \\app\\model\\SkuGoods);\n\n$sku = new Sku($sku_g, $sku_a);\n\n// add\n$mem = $sku_a-\u003ename('4g');\n$storage = $sku_a-\u003ename('128G');\n$sku-\u003egoods(1)-\u003eattrs($mem, $storage)-\u003estock(1000)-\u003eprice(1999)-\u003eadd();\n\n// update\n$mem = $sku_a-\u003ename('8g');\n$storage = $sku_a-\u003ename('256G');\n$sku-\u003egoods(1)-\u003eattrs($mem, $storage)-\u003estock(2000)-\u003eprice(2999)-\u003eupdate(1);\n\n// delete\n$sku-\u003edelete(1);\n\n// vant\n$data = $sku-\u003egoods(1)-\u003evant();\ndump($data);\n```\n\n## Tables\n```sql\nCREATE TABLE `sku_goods` (\n\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t`goods_id` INT(11) NOT NULL,\n\t`sku_attrs` VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_ci',\n\t`price` INT(11) NOT NULL DEFAULT '0',\n\t`stock_num` INT(11) NOT NULL DEFAULT '0',\n\t`create_time` INT(11) NOT NULL DEFAULT '0',\n\t`update_time` INT(11) NOT NULL DEFAULT '0',\n\t`delete_time` INT(11) NOT NULL DEFAULT '0',\n\tPRIMARY KEY (`id`)\n)\nCOLLATE='utf8mb4_unicode_ci'\nENGINE=InnoDB;\n```\n\n```sql\nCREATE TABLE `sku_attr` (\n\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t`name` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',\n\t`pid` INT(11) NULL DEFAULT '0',\n\t`create_time` INT(11) NOT NULL DEFAULT '0',\n\t`update_time` INT(11) NOT NULL DEFAULT '0',\n\t`delete_time` INT(11) NOT NULL DEFAULT '0',\n\tPRIMARY KEY (`id`),\n\tUNIQUE INDEX `name_pid` (`name`, `pid`)\n)\nCOLLATE='utf8mb4_unicode_ci'\nENGINE=InnoDB\n;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedenleung%2Fsku","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedenleung%2Fsku","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedenleung%2Fsku/lists"}