/** * 操作数据库 * @param int $tid 帖子id * @param int $fid 版块id */ function insertData($tid, $fid) { /*操作数据库*/ global $action, $atc_title; $this->data['default'] = $this->data['act']['0']; $this->data['default']['tid'] = $tid; $this->data['default']['fid'] = $fid; $this->data['default']['actmid'] = $this->actmid; $this->data['user'] = array(); !S::isArray($this->data['act']['1']) && ($this->data['act']['1'] = array()); foreach ($this->data['act']['1'] as $key => $value) { if ($value) { $this->data['user'][$key] = $value; } } $this->data['user']['tid'] = $tid; $this->data['user']['fid'] = $fid; unset($this->data['act']); $defaultValueTableName = getActivityValueTableNameByActmid(); $userDefinedValueTableName = getActivityValueTableNameByActmid($this->actmid, 1, 1); $this->db->pw_update("SELECT tid FROM {$defaultValueTableName} WHERE tid=" . S::sqlEscape($tid), "UPDATE {$defaultValueTableName} SET " . S::sqlSingle($this->data['default']) . "WHERE tid=" . S::sqlEscape($tid), "INSERT INTO {$defaultValueTableName} SET " . S::sqlSingle($this->data['default'])); $this->db->pw_update("SELECT tid FROM {$userDefinedValueTableName} WHERE tid=" . S::sqlEscape($tid), "UPDATE {$userDefinedValueTableName} SET " . S::sqlSingle($this->data['user']) . "WHERE tid=" . S::sqlEscape($tid), "INSERT INTO {$userDefinedValueTableName} SET " . S::sqlSingle($this->data['user'])); $subject = $this->db->get_value('SELECT subject FROM pw_threads WHERE tid=' . S::sqlEscape($tid)); if ($subject) { $this->db->update('UPDATE pw_activitypaylog SET subject=' . S::sqlEscape($subject) . ' WHERE tid=' . S::sqlEscape($tid)); } /*选择支付宝+没有绑定支付宝+没有通过支付宝实名认证 or 创建AA活动号*/ if ($this->data['default']['paymethod'] == 1) { $tradeinfo = $this->db->get_one("SELECT tradeinfo FROM pw_memberinfo WHERE uid=" . S::sqlEscape($this->winduid)); $tradeinfo = unserialize($tradeinfo['tradeinfo']); $alipay = $tradeinfo['alipay']; $isBinded = $tradeinfo['isbinded']; $isCertified = $tradeinfo['iscertified']; if (!$alipay || $isBinded != 'T' || $isCertified != 'T') { //选择支付宝+没有绑定支付宝+没有通过支付宝实名认证 $this->db->update("UPDATE {$defaultValueTableName} SET iscertified=0 WHERE tid=" . S::sqlEscape($tid)); } elseif ($alipay && $isBinded == 'T' && $isCertified == 'T') { //绑定支付宝+通过支付宝实名认证 $this->db->update("UPDATE {$defaultValueTableName} SET iscertified=1 WHERE tid=" . S::sqlEscape($tid)); require_once R_P . 'lib/activity/alipay_push.php'; $alipayPush = new AlipayPush(); if ($action == 'new') { $alipayPush->create_aa_payment($tid, $this->winduid, $this->actmid, $atc_title); //创建AA活动号 } elseif ($action == 'modify') { $alipayPush->modify_aa_payment($tid, $this->actmid, $atc_title); //修改AA活动号 } } } /*选择支付宝+没有绑定支付宝+没有通过支付宝实名认证 or 创建AA活动号*/ /*附件上传*/ L::loadClass('activityupload', 'upload', false); $img = new ActivityUpload($tid, $this->actmid); PwUpload::upload($img); require_once R_P . 'require/functions.php'; pwFtpClose($GLOBALS['ftp']); }
/** * 返回活动是否认证 * @param array $data 字段的数据 形如array(int 行ID => array(int 字段ID => array 字段内容)) * @param int $tid 帖子id * @param int $actmid 分类id * @return string HTML * @access private */ function isCertified($data, $tid, $actmid) { global $subject, $tdtime; $isCertifiedHtml = ''; $signupStaus = true; $defaultValueTableName = getActivityValueTableNameByActmid(); if (!$data['iscertified'] && $data['paymethod'] == 1) { $tradeinfo = $this->db->get_value("SELECT tradeinfo FROM pw_memberinfo WHERE uid=" . S::sqlEscape($data['authorid'])); $tradeinfo = unserialize($tradeinfo); $alipay = $tradeinfo['alipay']; $isBinded = $tradeinfo['isbinded']; $isCertified = $tradeinfo['iscertified']; if ($isBinded != 'T') { //尚未绑定 if ($data['authorid'] == $this->winduid) { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_unbind_alipay') . '</p>'; } else { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_author_unbind') . '</p>'; } } elseif ($isCertified != 'T') { //尚未实名认证 require_once R_P . 'lib/activity/alipay_push.php'; $alipayPush = new AlipayPush(); $is_success = $alipayPush->user_query($data['authorid']); //查询是否实名认证 if ($is_success != 'T') { if ($data['authorid'] == $this->winduid) { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_unauth_alipay') . '</p>'; } else { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_author_unpass') . '</p>'; } } else { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_activity_unNo') . '</p>'; $this->db->update("UPDATE {$defaultValueTableName} SET iscertified=1 WHERE tid=" . S::sqlEscape($tid)); //活动通过认证 } } else { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_activity_unNo') . '</p>'; $this->db->update("UPDATE {$defaultValueTableName} SET iscertified=1 WHERE tid=" . S::sqlEscape($tid)); //活动通过认证 } $signupStaus = false; } elseif ($data['iscertified'] && !$data['batch_no'] && $data['paymethod'] == 1) { require_once R_P . 'lib/activity/alipay_push.php'; $alipayPush = new AlipayPush(); $certStatus = $alipayPush->create_aa_payment($tid, $data['authorid'], $actmid, $subject); //创建AA活动号 if ($certStatus != 'T') { if ($certStatus == 'AA_FAIL_TO_CREATE_AA_NOT_T') { if ($data['authorid'] == $this->winduid) { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_alipayinfo_un') . '</p>'; } else { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_alipayAccount') . '</p>'; } } elseif ($certStatus == 'AA_FAIL_TO_CREATE_AA_FREEZED') { if ($data['authorid'] == $this->winduid) { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_alipay_freeze') . '</p>'; } else { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_author_freeze') . '</p>'; } } elseif ($certStatus == 'AA_FAIL_TO_CREATE_AA_NEED_CERTIFY') { if ($data['authorid'] == $this->winduid) { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_unauth_alipay') . '</p>'; } else { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_alipayAccount') . '</p>'; } } elseif ($certStatus == 'AA_FAIL_TO_CREATE_AA_BEYOND_LIMIT' && $data['signupstarttime'] > $tdtime && $data['signupstarttime'] < $tdtime + 86400) { //报名时间不是今天 if ($data['authorid'] == $this->winduid) { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_max_activity') . '</p>'; } else { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_max_activity2') . '</p>'; } } else { if ($data['authorid'] == $this->winduid) { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_fail_No') . '</p>'; } else { $isCertifiedHtml .= '<p class="aa_err">' . getLangInfo('other', 'act_err_system_error') . '</p>'; } } $signupStaus = false; } } return array($signupStaus, $isCertifiedHtml); }