Exemplo n.º 1
0
     $express_id = abs(intval($_GET['eid']));
     $invite = Table::Fetch('invite', $id);
     if (!$invite || $invite['pay'] != 'N') {
         json('非法操作', 'alert');
     }
     if (!$invite['team_id']) {
         json('没有发生购买行为,不能执行返利', 'alert');
     }
     $team = Table::Fetch('team', $invite['team_id']);
     $team_state = team_state($team);
     if (!in_array($team_state, array('success', 'soldout'))) {
         json('只有成功的团购才可以执行邀请返利', 'alert');
     }
     Table::UpdateCache('invite', $id, array('pay' => 'Y', 'admin_id' => $login_user_id));
     $invite = Table::FetchForce('invite', $id);
     ZFlow::CreateFromInvite($invite);
     Session::Set('notice', '邀请返利操作成功');
     json(null, 'refresh');
 } else {
     if ('inviteremove' == $action) {
         need_auth('admin');
         Table::UpdateCache('invite', $id, array('pay' => 'C', 'admin_id' => $login_user_id));
         Session::Set('notice', '不合法邀请记录取消成功!');
         json(null, 'refresh');
     } else {
         if ('subscriberemove' == $action) {
             need_auth('admin');
             $subscribe = Table::Fetch('subscribe', $id);
             if ($subscribe) {
                 ZSubscribe::Unsubscribe($subscribe);
                 Session::Set('notice', "邮件地址:{$subscribe['email']}退订成功");