| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\model;
- use think\Model;
- class MiaoshaGoods extends Model
- {
- protected $connection = 'mysql';
- protected $pk = 'id';
- protected $name = 'miaosha_goods';
- public static function setGoodslist($goods)
- {
- if (!empty($goods)) {
- foreach ($goods as &$vo) {
- $goodsdata = Goods::find($vo['goods_id']);
- if (!empty($goodsdata)) {
- $vo['goods'] = $goodsdata->toArray();
- $vo['image'] = toimg($vo['goods']['image']);
- $vo['ptype'] = $vo['goods']['ptype'];
- $vo['time_amount'] = $vo['goods']['time_amount'];
- $vo['quantity_unit'] = $vo['goods']['quantity_unit'];
- $vo['is_timer'] = $vo['goods']['is_timer'];
- $vo['is_times'] = $vo['goods']['is_times'];
- $vo['timesmum'] = $vo['goods']['timesmum'];
- //$vo['price'] = floatval($vo['price']);
- $vo['price'] = floatval(Goods::setPrice($vo)["price"]);
- }
- }
- }
- return $goods;
- }
- }
|