|
@@ -78,7 +78,7 @@ class Product extends Api
|
|
|
->alias('a')
|
|
->alias('a')
|
|
|
->join("product_list b", "a.product_id = b.id", "left")
|
|
->join("product_list b", "a.product_id = b.id", "left")
|
|
|
->group('a.product_id')
|
|
->group('a.product_id')
|
|
|
- ->field('a.id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,min(a.price) as price,a.product_id,b.type_id')
|
|
|
|
|
|
|
+ ->field('a.id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,min(a.price) as price,a.product_id,b.type_id,b.issue_num as issue')
|
|
|
->where($map)
|
|
->where($map)
|
|
|
->order($order)
|
|
->order($order)
|
|
|
->paginate($this->pageSize);
|
|
->paginate($this->pageSize);
|
|
@@ -110,7 +110,7 @@ class Product extends Api
|
|
|
->join("product_list b", "a.product_id = b.id", "left")
|
|
->join("product_list b", "a.product_id = b.id", "left")
|
|
|
->join("user_collect c", "c.product_id = a.product_id and c.user_id = {$this->auth->id}")
|
|
->join("user_collect c", "c.product_id = a.product_id and c.user_id = {$this->auth->id}")
|
|
|
->group('a.product_id')
|
|
->group('a.product_id')
|
|
|
- ->field('a.id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,min(a.price) as price,a.product_id,b.type_id')
|
|
|
|
|
|
|
+ ->field('a.id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,min(a.price) as price,a.product_id,b.type_id,b.issue_num as issue')
|
|
|
->where('a.status', $productTransfer::Normal)
|
|
->where('a.status', $productTransfer::Normal)
|
|
|
->where($map)
|
|
->where($map)
|
|
|
->order($order)
|
|
->order($order)
|
|
@@ -135,11 +135,10 @@ class Product extends Api
|
|
|
$list = $productLists->with('producttransfer,collect')
|
|
$list = $productLists->with('producttransfer,collect')
|
|
|
->where('product_list.id', $ids)
|
|
->where('product_list.id', $ids)
|
|
|
->where('product_list.status', $productLists::Normal)
|
|
->where('product_list.status', $productLists::Normal)
|
|
|
- ->field('id,'.$this->lan .'_name as name,thum,details')
|
|
|
|
|
|
|
+ ->field('id,'.$this->lan .'_name as name,issue_num as issue,thum,details')
|
|
|
->find();
|
|
->find();
|
|
|
if(empty($list)) $this->error('数据不存在');
|
|
if(empty($list)) $this->error('数据不存在');
|
|
|
-
|
|
|
|
|
- $list->issue = $orderLogic::getProductIssue($list->id); //发行: 是产品的库存总量(卖出和没卖出的都算,最保险的计算方式是剩余库存量+所有用户的持有量;因为空投产品不是从库存出去的
|
|
|
|
|
|
|
+
|
|
|
$list->circulation = $orderLogic::getProductCirculation($list->id); //流通: 所有用户的持有量
|
|
$list->circulation = $orderLogic::getProductCirculation($list->id); //流通: 所有用户的持有量
|
|
|
$this->success('', $list);
|
|
$this->success('', $list);
|
|
|
}
|
|
}
|
|
@@ -160,7 +159,6 @@ class Product extends Api
|
|
|
$userCollect = Loader::model('UserCollect');
|
|
$userCollect = Loader::model('UserCollect');
|
|
|
foreach ($list as &$item) {
|
|
foreach ($list as &$item) {
|
|
|
if($isCollect) $item['collect'] = $userCollect::where('user_id', $uid)->where('product_id', $item->product_id)->count();
|
|
if($isCollect) $item['collect'] = $userCollect::where('user_id', $uid)->where('product_id', $item->product_id)->count();
|
|
|
- $item['issue'] = $orderLogic::getProductIssue($item->product_id); //发行: 是产品的库存总量(卖出和没卖出的都算,最保险的计算方式是剩余库存量+所有用户的持有量;因为空投产品不是从库存出去的
|
|
|
|
|
$item['circulation'] = $orderLogic::getProductCirculation($item->product_id); //流通: 所有用户的持有量
|
|
$item['circulation'] = $orderLogic::getProductCirculation($item->product_id); //流通: 所有用户的持有量
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|