/**
 * @name 导入参会人名单
 */
function importParticipants_cb($job)
{
    global $log;
    $log->log(PHP_EOL . '-----------------------------');
    $arg = $job->workload();
    $invest_info = json_decode($arg, true);
    $log->log('接收参数');
    if (!is_array($invest_info)) {
        $log->log("importParticipants 数据错误 " . json_encode($arg));
        return false;
    }
    $log->log($invest_info);
    $log->log('处理开始');
    $data = getExcelData($invest_info['fileDir']);
    if (is_array($data) && count($data) > 0) {
        $log->log('处理成功');
        foreach ($data as $val) {
            $val['fromId'] = -1;
            $val['activeId'] = $invest_info['activeId'];
            $val['applyTime'] = time();
            Sp_Account_Attendee::add($val);
            //Da_Wrapper::insert()->table("sp.huitong.ht_apply_data")->data($val)->execute();
        }
        $log->log('插入成功');
    } else {
        $log->log('处理失败');
    }
    return TRUE;
}
 public function addAttendee()
 {
     $data = $_POST;
     unset($data['action']);
     $flag = true;
     if (false == $data['name']) {
         $flag = false;
     } else {
         if (false == preg_match(Sp_Dictionary::getOtherOption('patternMobile'), $data['phone'])) {
             $flag = false;
         } else {
             if ($data['email']) {
                 if (false == preg_match(Sp_Dictionary::getOtherOption('patternEmail'), $data['email'])) {
                     $flag = false;
                 }
             }
         }
     }
     if (false == $flag) {
         return array('status' => 0, 'msg' => '数据有误请从新填写');
     } else {
         $data['firstChater'] = Sp_Dictionary::getFirstCharter($data['name']);
         $data['fromId'] = -1;
         $data['applyTime'] = time();
         $return = Sp_Account_Attendee::add($data);
         if ($return == -2) {
             return array('status' => -2, 'msg' => '此人已经存在');
         } else {
             if (-3 == $return) {
                 return array('status' => -3, 'msg' => '此人已经签到');
             } else {
                 if (-4 == $return) {
                     return array('status' => -4, 'msg' => '添加失败');
                 } else {
                     if ($return) {
                         return array('status' => 1, 'msg' => '添加成功');
                     }
                 }
             }
         }
         return array('status' => 0, 'msg' => '数据有误请从新填写');
     }
 }
Esempio n. 3
0
 public function insert($data)
 {
     $data['applyTime'] = time();
     $data['firstChater'] = Sp_Dictionary::getFirstCharter($data['name']);
     try {
         $id = Sp_Account_Attendee::add($data);
     } catch (PDOException $e) {
         $id = false;
     }
     return $id < 1 ? false : $id;
 }