GoodsSkuValue.php 555 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class GoodsSkuValue extends Model
  5. {
  6. protected $connection = 'mysql';
  7. protected $pk = 'id';
  8. protected $name = 'goods_sku_value';
  9. //取得商品选项
  10. static public function get_goods_sku_value($id)
  11. {
  12. $data = self::where(['goods_id' => $id])->order('id asc')->select()->toArray();
  13. if (empty($data)) {
  14. $data = [];
  15. }else{
  16. foreach($data as &$vo){
  17. $vo['number'] = 1;
  18. }
  19. }
  20. return $data;
  21. }
  22. }