|
@@ -61,7 +61,7 @@ class StoreProduct extends BaseModel
|
|
|
return htmlspecialchars_decode($value);
|
|
return htmlspecialchars_decode($value);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static function getValidProduct($productId, $field = 'add_time,browse,cate_id,code_path,cost,ficti,give_integral,id,image,is_sub,is_bargain,is_benefit,is_best,is_del,is_hot,is_new,is_postage,is_seckill,is_show,keyword,mer_id,mer_use,ot_price,postage,price,sales,slider_image,sort,stock,store_info,store_name,unit_name,vip_price,spec_type,IFNULL(sales,0) + IFNULL(ficti,0) as fsales,video_link')
|
|
|
|
|
|
|
+ public static function getValidProduct($productId, $field = 'integral,add_time,browse,cate_id,code_path,cost,ficti,give_integral,id,image,is_sub,is_bargain,is_benefit,is_best,is_del,is_hot,is_new,is_postage,is_seckill,is_show,keyword,mer_id,mer_use,ot_price,postage,price,sales,slider_image,sort,stock,store_info,store_name,unit_name,vip_price,spec_type,IFNULL(sales,0) + IFNULL(ficti,0) as fsales,video_link')
|
|
|
{
|
|
{
|
|
|
$Product = self::where('is_del', 0)->where('is_show', 1)->where('id', $productId)->field($field)->find();
|
|
$Product = self::where('is_del', 0)->where('is_show', 1)->where('id', $productId)->field($field)->find();
|
|
|
if ($Product) return $Product->toArray();
|
|
if ($Product) return $Product->toArray();
|
|
@@ -116,7 +116,7 @@ class StoreProduct extends BaseModel
|
|
|
if ($salesOrder) $baseOrder = $salesOrder == 'desc' ? 'sales DESC' : 'sales ASC';//虚拟销量
|
|
if ($salesOrder) $baseOrder = $salesOrder == 'desc' ? 'sales DESC' : 'sales ASC';//虚拟销量
|
|
|
if ($baseOrder) $baseOrder .= ', ';
|
|
if ($baseOrder) $baseOrder .= ', ';
|
|
|
$model->order($baseOrder . 'sort DESC, add_time DESC');
|
|
$model->order($baseOrder . 'sort DESC, add_time DESC');
|
|
|
- $list = $model->page((int)$page, (int)$limit)->field('id,store_name,cate_id,image,IFNULL(sales,0) + IFNULL(ficti,0) as sales,price,stock')->select()->each(function ($item) use ($uid, $type) {
|
|
|
|
|
|
|
+ $list = $model->page((int)$page, (int)$limit)->field('id,store_name,cate_id,image,IFNULL(sales,0) + IFNULL(ficti,0) as sales,price,stock,integral')->select()->each(function ($item) use ($uid, $type) {
|
|
|
if ($type) {
|
|
if ($type) {
|
|
|
$item['is_att'] = StoreProductAttrValueModel::where('product_id', $item['id'])->count() ? true : false;
|
|
$item['is_att'] = StoreProductAttrValueModel::where('product_id', $item['id'])->count() ? true : false;
|
|
|
if ($uid) $item['cart_num'] = StoreCart::where('is_pay', 0)->where('is_del', 0)->where('is_new', 0)->where('type', 'product')->where('product_id', $item['id'])->where('uid', $uid)->value('cart_num');
|
|
if ($uid) $item['cart_num'] = StoreCart::where('is_pay', 0)->where('is_del', 0)->where('is_new', 0)->where('type', 'product')->where('product_id', $item['id'])->where('uid', $uid)->value('cart_num');
|