后台总平台用户管理下用户数据删除问题
修改文件:application\admin\controller\user\User
修改方法;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('删除失败');
}