GoodsModel.php 685 字节
<?php
namespace app\goods\model;
use think\Model;
use think\Db;

class GoodsModel extends Model
{

    public function getGoods($is_shove = null, $cid = null)
    {
        $map['is_sta'] = ['eq', 1];
        $map['delete_time'] = ['eq', 0];
        if ($cid != null) {
            $map['cid'] = ['eq', $cid];
        }
        if($is_shove != null) {
            $map['is_shove'] = ['eq', $is_shove];
        }
        $res = Db::name('zj_goods')->field('id,name,intro,price,thumb')
            ->where($map)
            ->select()->toArray();
        foreach ($res as $k => $v) {
            $res[$k]['thumb'] = cmf_get_image_url($v['thumb']);
        }
        return $res;
    }

}