作者 anyv
1 个管道 的构建 通过 耗费 0 秒

6

... ... @@ -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{
... ...
... ... @@ -18,11 +18,15 @@ class StatisticalController extends AdminBaseController{
$where2 = [
'indent_type' => 2
];
$where3 = [
'type' => 1
];
if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){
$start_time = strtotime($_POST['start_time']);
$end_time = strtotime($_POST['end_time']);
$where['create_time'] = [['>=',$start_time],['<=',$end_time]];
$where2['create_time'] = [['>=',$start_time],['<=',$end_time]];
$where3['time'] = [['>=',$start_time],['<=',$end_time]];
}
$platform = Db::name('indent') -> where($where) -> where("state = 2 or state = 3 or state = 5") -> select();
$platform_money = 0;
... ... @@ -37,6 +41,13 @@ class StatisticalController extends AdminBaseController{
$salesman_money += $val['money'];
}
$this -> assign('salesman_money',$salesman_money);
//显示平台抽成收益
$income = Db::name('income_money') -> where($where3) -> select();
$income_money = 0;
foreach ($income as $key => $val){
$income_money += $val['money'];
}
$this -> assign('income_money',$income_money);
return $this -> fetch();
}
... ...
... ... @@ -32,6 +32,10 @@
<td>业务员订单</td>
<td>{$salesman_money}</td>
</tr>
<tr>
<td>平台抽成收益</td>
<td>{$income_money}</td>
</tr>
</tbody>
</table>
</div>
... ...