|
@@ -5,6 +5,7 @@ namespace app\api\controller\mall;
|
|
|
use app\admin\model\GoodsViewFavCart;
|
|
|
use app\common\controller\Api;
|
|
|
use app\common\model\Category;
|
|
|
+use app\common\model\GoodsInstallLink;
|
|
|
use app\common\model\GoodsSku;
|
|
|
use app\common\model\UserCategoryView;
|
|
|
use app\common\service\OrderService;
|
|
@@ -192,16 +193,20 @@ class Goods extends Api
|
|
|
* 计算商品价格
|
|
|
* @ApiParams (name=sku,description=sku)
|
|
|
* @ApiParams (name=num,description=num)
|
|
|
+ * @ApiParams (name=num_install,description=num_install)
|
|
|
*/
|
|
|
public function amount(){
|
|
|
$data=$this->_validate([
|
|
|
'sku'=>['require','integer'],
|
|
|
'num'=>['require','integer','gt:0'],
|
|
|
+ 'num_install'=>['require','integer','gt:0'],
|
|
|
]);
|
|
|
$sku=GoodsSku::findOrFail($data['sku']);
|
|
|
list($_,$__,$amount)=OrderService::getAmount($sku,$sku->goods,$data['num']);
|
|
|
+ $amount_install=GoodsInstallLink::getFee($sku,$data['num_install'],true);
|
|
|
$this->success('',[
|
|
|
- 'amount'=>$amount
|
|
|
+ 'amount'=>$amount,
|
|
|
+ 'amount_install'=>$amount_install,
|
|
|
]);
|
|
|
}
|
|
|
}
|