知识付费后台管理员删除用户已获得的专题时无法删除专栏专题问题
修改方法:del_special_buy()
public function del_special_buy($id = 0)
{
if ($id == 0) return Json::fail('缺少参数');
$specialBuy = SpecialBuy::get($id);
if (!$specialBuy) return Json::fail('记录不存在');
$type = SpecialBuy::where('id',$id)->value('type');
$special_type = Special::where('id',$specialBuy['special_id'])->value('type');
$res = SpecialBuy::where('id', $id)->update(['is_del' => 1]);
if ($special_type == SPECIAL_COLUMN) {
$res2 = true;
if(SpecialBuy::be(['uid' => $specialBuy['uid'], 'type' => $type, 'column_id' => $specialBuy['special_id'], 'is_del' => 0])){
$res2 = SpecialBuy::where(['uid' => $specialBuy['uid'], 'type' => $type, 'column_id' => $specialBuy['special_id'], 'is_del' => 0])->update(['is_del' => 1]);
}
$res = $res && $res2;
}
if ($res) {
switch ($type) {
case 0:
case 1:
case 2:
case 4:
$source = 2;
$type = 1;
break;
case 3:
case 5:
$source = 3;
$type = 2;
break;
default:
$source = 1;
$type = 0;
}
TestPaperObtain::delTestPaper($specialBuy['order_id'], $specialBuy['uid'], $specialBuy['special_id'], $source);
DataDownloadBuy::delDataDownload($specialBuy['order_id'], $specialBuy['uid'], $specialBuy['special_id'], $type);
return Json::successful('删除成功');
} else
return Json::fail('删除失败');
}
{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}
作者 管理员 企业
{{itemf.name}}
{{itemc.user_info.nickname}}
{{itemc.user_name}}
回复 {{itemc.comment_user_info.nickname}}
{{itemf.name}}