|
@@ -215,16 +215,16 @@ class Programme extends Api
|
|
|
}
|
|
|
/**
|
|
|
* 删除方案商品
|
|
|
- *@ApiParams (name=id,description=方案id)
|
|
|
- * @ApiParams (name=goods_ids,description=商品id,删除多个商品用逗号分割)
|
|
|
+ * @ApiParams (name=ids,description=方案详情id)
|
|
|
*/
|
|
|
public function deleteGoods(){
|
|
|
- $id = input('id');
|
|
|
- $goodsId = input('goods_ids');
|
|
|
- Db('ProgrammeGoods')->where('programme_id',$id)->where('goods_id','in',$goodsId)->delete();
|
|
|
- if(!Db('ProgrammeGoods')->where('programme_id',$id)->find()){
|
|
|
- Db('Programme')->where('id',$id)->delete();
|
|
|
- }
|
|
|
+ $id = input('ids');
|
|
|
+ $user=$this->auth->getUser();
|
|
|
+ ProgrammeGoods::whereIn('id',$id)
|
|
|
+ ->whereExists(
|
|
|
+ \app\common\model\Programme::where('user_id',$user->id)->where('id',Db::raw((new ProgrammeGoods)->getTable().'.programme_id'))
|
|
|
+ )
|
|
|
+ ->delete();
|
|
|
$this->success('删除成功');
|
|
|
}
|
|
|
|