...
|
...
|
@@ -392,8 +392,25 @@ class SalesmanController extends AdminBaseController{ |
|
|
public function set_free_man(){
|
|
|
|
|
|
$id = $_POST['id'];
|
|
|
//删除老师购物车 浏览记录 收藏 订单待付款信息
|
|
|
$teacher = Db::name('my_user') -> where('id',$id) -> find();
|
|
|
Db::name('shopping_cart') -> where('uid',$teacher['uid']) -> delete();
|
|
|
Db::name('browsing_history') -> where('uid',$teacher['uid']) -> delete();
|
|
|
Db::name('collect') -> where('uid',$teacher['uid']) -> delete();
|
|
|
Db::name('indent') -> where("uid=".$teacher['uid']." and state=4") -> delete();
|
|
|
//获取这个老师下的所有学生信息
|
|
|
$student = Db::name('my_user') -> where('pid',$id) -> select();
|
|
|
//循环删除学生的购物车 浏览记录 收藏 订单待付款信息
|
|
|
foreach ($student as $key => $val){
|
|
|
Db::name('shopping_cart') -> where('uid',$val['uid']) -> delete();
|
|
|
Db::name('browsing_history') -> where('uid',$val['uid']) -> delete();
|
|
|
Db::name('collect') -> where('uid',$val['uid']) -> delete();
|
|
|
Db::name('indent') -> where("uid=".$val['uid']." and state=4") -> delete();
|
|
|
}
|
|
|
//改变老师的身份状态
|
|
|
$data = Db::name('my_user') -> where('id',$id) -> update(['status'=>0,'pid'=>0,'is_pro'=>0,'bind_status'=>0,'is_withdrawal'=>1]);
|
|
|
$student = Db::name('my_user') -> where('pid',$id) -> update(['status'=>0,'pid'=>0,'bind_status'=>0]);
|
|
|
//改变学生的身份状态
|
|
|
Db::name('my_user') -> where('pid',$id) -> update(['status'=>0,'pid'=>0,'bind_status'=>0]);
|
|
|
if($data){
|
|
|
return true;
|
|
|
}else{
|
...
|
...
|
|