M::sendNotice(array($memberdb['username']), array('title' => getLangInfo('writemsg', 'activity_payed_signuper_title', array('uid' => $memberdb['authorid'], 'username' => $memberdb['author'], 'tid' => $tid, 'subject' => $memberdb['subject'], 'totalcash' => $memberdb['totalcash'])), 'content' => getLangInfo('writemsg', $signupermsg, array('uid' => $memberdb['fromuid'], 'username' => $memberdb['fromusername'], 'tid' => $tid, 'subject' => $memberdb['subject'], 'totalcash' => $memberdb['totalcash']))), 'notice_active', 'notice_active');
    }
    paymsg("read.php?tid={$tid}", 'act_aa_detail_success');
} elseif ($action == 'refund_aa_payment') {
    //退款
    S::gp(array('is_success', 'out_trade_no', 'refund_fee'));
    //创建订单有问题。
    $is_success != 'T' && paymsg("read.php?tid={$tid}", 'act_refund_alipay_fail');
    list(, $tid, $actuid) = explode("_", $out_trade_no);
    $ifpay = $db->get_value("SELECT ifpay FROM pw_activitymembers WHERE actuid=" . S::sqlEscape($actuid));
    if ($ifpay != 1) {
        //未收到支付通知,但退款通知过来
        /*查询订单状态*/
        require_once R_P . 'lib/activity/alipay_push.php';
        $alipayPush = new AlipayPush();
        $alipayPush->query_aa_detail_payment($tid, $actuid);
        /*查询订单状态*/
    }
    $memberdb = $db->get_one("SELECT am.ifpay,am.actmid,am.uid,am.username,am.totalcash,am.refundreason,am.refundcost,am.totalcash,am.isadditional,am.isrefund,t.subject,t.authorid,t.author FROM pw_activitymembers am LEFT JOIN pw_threads t ON am.tid=t.tid WHERE actuid=" . S::sqlEscape($actuid));
    $memberdb['ifpay'] != 1 && paymsg("read.php?tid={$tid}", 'act_refund_fail');
    if ($memberdb['isrefund']) {
        //退款交易无法操作
        paymsg("read.php?tid={$tid}", 'act_undefined_operate');
    }
    $defaultValueTableName = getActivityValueTableNameByActmid();
    $defaultValue = $db->get_one("SELECT paymethod FROM {$defaultValueTableName} WHERE tid=" . S::sqlEscape($tid));
    $defaultValue['paymethod'] != 1 && paymsg("read.php?tid={$tid}", 'act_undefined_operate');
    //只有支付方式为支付宝才可以退款
    $tempcost = $db->get_value("SELECT SUM(totalcash) as sum FROM pw_activitymembers WHERE isrefund=1 AND fupid=" . S::sqlEscape($actuid));
    if ($refund_fee > number_format($memberdb['totalcash'] - $tempcost, 2, '.', '')) {
        paymsg("read.php?tid={$tid}", 'act_refund_cost_error');