Exemplo n.º 1
0
 public function Activation($id)
 {
     $User = M("User");
     $BaseConfig = M("BaseConfig");
     $objUser = $User->where('id=' . $id)->find();
     $unit_count = $objUser['unit_count'];
     //累计左右区用户数
     self::DoUserSubcount($id, 1, $unit_count);
     $Award = new Award();
     //推荐奖
     $Award->AwardRec($id);
     //组织业绩
     //$Award->AwardOrg($id);
     //对碰奖
     $Award->AwardCom($id);
     //见点奖
     $Award->AwardDot($id);
     //层碰奖
     $Award->AwardLayerCom();
     //把激活对象写到激活表中
     $unitusers = $User->where("id={$id}")->find();
     //dump($unitusers);
     $Active_line = M("ActiceLine");
     $data['user_id'] = $id;
     $data['active_time'] = date('Y-m-d H:i:s');
     $data['status'] = 0;
     $data['pid'] = $Active_line->order('id DESC')->getField('id');
     $data['unit_count'] = $unitusers['unit_count'];
     $Active_line->add($data);
     //排网奖
     $Award->AwardNet($id);
     $Award->AwardLayerCom();
     //更新用户状态
     $datas['status'] = 1;
     $User->where("id={$id}")->data($datas)->save();
     return true;
 }