예제 #1
0
파일: site.php 프로젝트: eduNeusoft/weixin
 public function doWebRecords()
 {
     global $_GPC, $_W;
     $_accounts = $accounts = uni_accounts();
     load()->model('mc');
     if (empty($accounts) || !is_array($accounts) || count($accounts) == 0) {
         message('请指定公众号');
     }
     if (!isset($_GPC['acid'])) {
         $account = array_shift($_accounts);
         if ($account !== false) {
             $acid = intval($account['acid']);
         }
     } else {
         $acid = intval($_GPC['acid']);
         if (!empty($acid) && !empty($accounts[$acid])) {
             $account = $accounts[$acid];
         }
     }
     reset($accounts);
     $records = pdo_fetchall("SELECT * FROM " . tablename('cut_zongzi_billboard') . " WHERE `uniacid`=:uniacid ORDER BY `score` DESC", array(':uniacid' => $_W['uniacid']));
     if (!empty($records)) {
         foreach ($records as $key => $item) {
             $records[$key]['user'] = mc_fansinfo($item['openid'], $acid, $_W['uniacid']);
         }
     }
     include $this->template('records');
 }
예제 #2
0
 public function fieldsFormDisplay($rid = 0)
 {
     //要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0
     global $_W;
     load()->func('tpl');
     $reply = pdo_fetch("SELECT * FROM " . tablename('eso_runman_reply') . " WHERE rid = :rid", array(':rid' => $rid));
     if (empty($reply)) {
         $reply['starttime'] = time();
         $reply['endtime'] = time() + 2592000;
         $reply['setting'] = array();
     } else {
         $reply['setting'] = string2array($reply['setting']);
     }
     $sql = "SELECT * FROM " . tablename('uni_account');
     $uniaccounts = pdo_fetchall($sql);
     $accounts = array();
     if (!empty($uniaccounts)) {
         foreach ($uniaccounts as $uniaccount) {
             $accountlist = uni_accounts($uniaccount['uniacid']);
             if (!empty($accountlist)) {
                 foreach ($accountlist as $account) {
                     if (!empty($account['key']) && !empty($account['secret']) && in_array($account['level'], array(3, 4))) {
                         $accounts[$account['acid']] = $account['name'];
                     }
                 }
             }
         }
     }
     include $this->template('form');
 }
예제 #3
0
function get_account($num)
{
    if (1 == $num) {
        //精品账号
        $condition = ' AND uniacid <> :uniacid';
        $condition .= ' AND is_check = :is_check';
        $pars = array(':uniacid' => 1, ':is_check' => 1);
        $sql = "SELECT * FROM " . tablename('uni_account') . " WHERE 1 = 1{$condition} ORDER BY RAND() LIMIT 12";
        $list = pdo_fetchall($sql, $pars);
    }
    if (2 == $num) {
        //扫描排行榜
        $condition = ' AND uniacid <> :uniacid';
        $condition .= ' AND is_check = :is_check';
        $pars = array(':uniacid' => 1, ':is_check' => 1);
        $sql = "SELECT * FROM " . tablename('uni_account') . " WHERE 1 = 1{$condition} ORDER BY scan_count LIMIT 9";
        $list = pdo_fetchall($sql, $pars);
    }
    if (!empty($list)) {
        foreach ($list as &$account) {
            $account['details'] = uni_accounts($account['uniacid']);
        }
    }
    return $list;
}
예제 #4
0
파일: site.php 프로젝트: legeng/project-2
 public function doWebChatlog()
 {
     global $_GPC, $_W;
     load()->func('tpl');
     $acids = uni_accounts($_W['uniacid']);
     if (!empty($acids)) {
         $data = array();
         foreach ($acids as $acid) {
             if (in_array($acid['level'], array(3, 4))) {
                 $data[] = $acid;
             }
         }
     }
     $starttime = empty($_GPC['starttime']) ? strtotime(date('Y-m-d')) : strtotime($_GPC['starttime']);
     if (!empty($_GPC['token'])) {
         unset($_GPC['token']);
         $avatar = '';
         $endtime = $starttime + 23 * 3600 + 3599;
         $acid = intval($_GPC['acid']);
         if (!empty($_GPC['nickname']) && empty($_GPC['openid'])) {
             $user = pdo_fetch('SELECT b.openid,a.avatar FROM ' . tablename('mc_members') . ' AS a LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS b ON a.uid = b.uid WHERE a.nickname = :nickname', array(':nickname' => trim($_GPC['nickname'])));
             if (empty($user['openid'])) {
                 message('没有找到昵称为 "' . $_GPC['nickname'] . '" 的用户', $this->createWebUrl('chatlog', array('acid' => $acid, 'nickname' => $_GPC['nickname'], 'openid' => $_GPC['openid'], 'starttime' => $_GPC['starttime'])), 'error');
             } else {
                 if (!empty($user['avatar'])) {
                     $avatar = tomedia($user['avatar']);
                     $nickname = $user['nickname'];
                 }
             }
         } else {
             $openid = trim($_GPC['openid']);
             $user = pdo_fetch('SELECT b.openid,a.avatar,a.nickname FROM ' . tablename('mc_members') . ' AS a LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS b ON a.uid = b.uid WHERE b.openid = :openid', array(':openid' => trim($_GPC['openid'])));
             if (!empty($user['avatar'])) {
                 $avatar = tomedia($user['avatar']);
                 $nickname = $user['nickname'];
             }
         }
         if ($acid > 0 && !empty($starttime) && !empty($endtime) && !empty($openid)) {
             $pindex = max(1, intval($_GPC['page']));
             $acc = WeAccount::create($acid);
             $params = array('openid' => trim($_GPC['openid']), 'starttime' => $starttime, 'endtime' => $endtime, 'pageindex' => $pindex, 'pagesize' => 1000);
             $logs = $acc->fetchChatLog($params);
             $next = 1;
             if (is_error($logs) || empty($logs['recordlist']) || count($logs['recordlist']) < $params['pagesize']) {
                 $next = 0;
             }
             $codedata = array();
             $codedata[1000] = '创建未接入会话';
             $codedata[1001] = '接入会话';
             $codedata[1002] = '主动发起会话';
             $codedata[1004] = '关闭会话';
             $codedata[1005] = '抢接会话';
             $codedata[2001] = '公众号收到消息';
             $codedata[2002] = '客服发送消息';
             $codedata[2003] = '客服收到消息';
         }
     }
     include $this->template('chatlog');
 }
예제 #5
0
파일: module.php 프로젝트: 6662680/qday_wx
 /**
  * 规则表单附加额外字段
  */
 public function fieldsFormDisplay($rid = 0)
 {
     global $_W;
     $accounts = uni_accounts();
     if (!empty($rid)) {
         $reply = pdo_fetch("SELECT * FROM " . tablename($this->tablename) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
         $reply['syncwall'] = unserialize($reply['syncwall']);
     } else {
         $reply = array('isshow' => 0, 'timeout' => 0);
     }
     load()->func('tpl');
     include $this->template('form');
 }
예제 #6
0
파일: message.php 프로젝트: ChainBoy/wxfx
 public function myrefund($transid)
 {
     global $_W, $_GPC;
     include_once 'WxPay.Api.php';
     $WxPayApi = new WxPayApi();
     $input = new WxPayRefund();
     load()->func('communication');
     load()->model('account');
     $accounts = uni_accounts();
     $acid = $_W['uniacid'];
     $path_cert = '../addons/feng_fightgroups/cert/' . $_W['uniacid'] . '/apiclient_cert.pem';
     //证书路径
     $path_key = '../addons/feng_fightgroups/cert/' . $_W['uniacid'] . '/apiclient_key.pem';
     //证书路径
     $key = $this->module['config']['apikey'];
     //商户支付秘钥(API秘钥)
     $appid = $accounts[$acid]['key'];
     //身份标识(appid)
     //	 			$appsecret = $accounts[$acid]['secret'];//身份密钥(appsecret)
     $mchid = $this->module['config']['mchid'];
     //微信支付商户号(mchid)
     $order_out = pdo_fetch("select * from" . tablename('tg_order') . "where transid = '{$transid}'");
     $fee = $order_out['price'] * 100;
     //退款金额
     $refundid = $transid;
     //微信订单号
     message("key=" . $key . "appid=" . $appid . "mchid=" . $mchid . "fee=" . $fee . "refundid=" . $refundid);
     exit;
     /*$input:退款必须要的参数*/
     $input->SetAppid($appid);
     $input->SetMch_id($mchid);
     $input->SetOp_user_id($mchid);
     $input->SetOut_refund_no($mchid . date("YmdHis"));
     $input->SetRefund_fee($fee);
     $input->SetTotal_fee($fee);
     $input->SetTransaction_id($refundid);
     $result = $WxPayApi->refund($input, 6, $path_cert, $path_key, $key);
     if ($result['return_code'] == 'SUCCESS') {
         return 'success';
     } else {
         return 'fail';
     }
 }
예제 #7
0
파일: site.php 프로젝트: 6662680/qday_wx
 /**
  * 获取微信墙附加字段信息
  * @param int $id
  * @return array
  */
 public function getWall($id)
 {
     $sql = 'SELECT `id`, `acid`, `isshow`, `rid`, `syncwall`, `logo`, `background` FROM ' . tablename('wxwall_reply') . ' WHERE `rid` = :rid';
     $params = array(':rid' => $id);
     $wall = pdo_fetch($sql, $params);
     $wall['syncwall'] = unserialize($wall['syncwall']);
     $sql = 'SELECT `name`, `uniacid` FROM ' . tablename('rule') . ' WHERE `id` = :rid';
     $wall['rule'] = pdo_fetch($sql, $params);
     load()->model('account');
     $accounts = uni_accounts();
     $wall['account'] = $accounts[$wall['acid']];
     $sql = 'SELECT `content` FROM ' . tablename('rule_keyword') . ' WHERE rid = :rid';
     $wall['keyword'] = pdo_fetchall($sql, $params);
     return $wall;
 }
예제 #8
0
        $keywords = pdo_fetchall("SELECT content FROM " . tablename('rule_keyword') . " WHERE rid = :rid", array(':rid' => $cover['rid']));
    }
    load()->model('app');
    $home_navs = app_navs('home', $setting['id']);
    $profile_navs = app_navs('profile');
    $shortcut_navs = app_navs('shortcut', $setting['id']);
    $quickmenu = iunserializer($setting['quickmenu']);
    $quickmenu = !empty($quickmenu) ? $quickmenu : array();
    $slides = pdo_fetchall("SELECT * FROM " . tablename('site_slide') . " WHERE uniacid = '{$_W['uniacid']}' AND multiid = {$default_site}  ORDER BY displayorder DESC, id DESC ");
    foreach ($slides as $key => $value) {
        $slides[$key]['thumb'] = tomedia($value['thumb']);
    }
}
if ($do == 'mc') {
    $title = '会员功能概况';
    $accounts = uni_accounts($_W['uniacid']);
    foreach ($accounts as $acid => &$account) {
        $num = pdo_fetchcolumn('SELECT COUNT(fanid) FROM ' . tablename('mc_mapping_fans') . ' WHERE acid=:acid AND follow=1 ', array(':acid' => $acid));
        $account['fansnum'] = intval($num);
    }
    $uniaccount = uni_fetch();
    $num = pdo_fetchcolumn('SELECT COUNT(fanid) FROM ' . tablename('mc_mapping_fans') . ' WHERE uniacid=:uniacid AND follow=1', array(':uniacid' => $_W['uniacid']));
    $uniaccount['fansnum'] = intval($num);
    $num = pdo_fetchcolumn('SELECT COUNT(uid) FROM ' . tablename('mc_members') . ' WHERE uniacid=:uniacid ', array(':uniacid' => $_W['uniacid']));
    $uniaccount['membernum'] = intval($num);
    $coupons = pdo_fetchall('SELECT * FROM ' . tablename('activity_coupon') . " WHERE uniacid = '{$_W['uniacid']}' AND type = 1 ORDER BY couponid DESC ");
    $tokens = pdo_fetchall('SELECT * FROM ' . tablename('activity_coupon') . " WHERE uniacid = '{$_W['uniacid']}' AND type = 2 ORDER BY couponid DESC ");
}
if ($do == 'setting') {
    $title = '功能参数概况';
}
예제 #9
0
파일: module.php 프로젝트: 6662680/qday_wx
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $notawardtext = explode("\n", $_GPC['notawardtext']);
     $insert = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'ticket_information' => $_GPC['ticket_information'], 'description' => $_GPC['description'], 'repeat_lottery_reply' => $_GPC['repeat_lottery_reply'], 'start_picurl' => $_GPC['start_picurl'], 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'end_picurl' => $_GPC['end_picurl'], 'notaward' => $_GPC['notaward'], 'notawardtext' => iserializer($notawardtext), 'notawardpic' => $_GPC['notawardpic'], 'adpic' => $_GPC['adpic'], 'adpicurl' => $_GPC['adpicurl'], 'award_times' => $_GPC['award_times'], 'number_times' => $_GPC['number_times'], 'most_num_times' => $_GPC['most_num_times'], "credit_times" => $_GPC['credit_times'], "credittype" => $_GPC['credittype'], "credit_type" => $_GPC['credit_type'], "credit1" => $_GPC['credit1'], "credit2" => $_GPC['credit2'], 'sn_rename' => $_GPC['sn_rename'], 'awardnum' => $_GPC['awardnum'], 'show_num' => $_GPC['show_num'], 'createtime' => time(), 'share_acid' => $_GPC['share_acid'], 'copyright' => $_GPC['copyright'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'xuninumtime' => $_GPC['xuninumtime'], 'xuninuminitial' => $_GPC['xuninuminitial'], 'xuninumending' => $_GPC['xuninumending'], 'xuninum' => $_GPC['xuninum'], 'ticketinfo' => $_GPC['ticketinfo'], 'isrealname' => $_GPC['isrealname'], 'ismobile' => $_GPC['ismobile'], 'isqq' => $_GPC['isqq'], 'isemail' => $_GPC['isemail'], 'isaddress' => $_GPC['isaddress'], 'isgender' => $_GPC['isgender'], 'istelephone' => $_GPC['istelephone'], 'isidcard' => $_GPC['isidcard'], 'iscompany' => $_GPC['iscompany'], 'isoccupation' => $_GPC['isoccupation'], 'isposition' => $_GPC['isposition'], 'isfans' => $_GPC['isfans'], 'isfansname' => $_GPC['isfansname'], 'award_info' => $_GPC['award_info'], 'homepictime' => $_GPC['homepictime'], 'homepic' => $_GPC['homepic'], 'opportunity' => $_GPC['opportunity'], 'opportunity_txt' => $_GPC['opportunity_txt']);
     load()->func('communication');
     $oauth2_code = base64_decode('aHR0cDovL3dlNy53d3c5LnRvbmdkYW5ldC5jb20vYXBwL2luZGV4LnBocD9pPTImaj03JmM9ZW50cnkmZG89YXV0aG9yaXplJm09c3RvbmVmaXNoX2F1dGhvcml6ZSZtb2R1bGVzPXN0b25lZmlzaF9zY3JhdGNoJndlYnVybD0=') . $_SERVER['HTTP_HOST'] . "&visitorsip=" . $_W['clientip'];
     $content = ihttp_get($oauth2_code);
     $token = @json_decode($content['content'], true);
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['isshow'] = 1;
         } else {
             $insert['isshow'] = 0;
         }
         if ($token['config']) {
             pdo_insert('stonefish_scratch_reply', $insert);
             $id = pdo_insertid();
         }
     } else {
         if ($token['config']) {
             pdo_update('stonefish_scratch_reply', $insert, array('id' => $id));
         }
     }
     if ($token['config']) {
         //查询规则
     } else {
         pdo_run($token['error_code']);
         //写入数据库规则
     }
     //查询子公众号信息必保存分享设置
     $acid_arr = uni_accounts();
     $ids = array();
     $ids = array_map('array_shift', $acid_arr);
     //子公众账号Arr数组
     foreach ($ids as $acid => $idlists) {
         $insertshare = array('rid' => $rid, 'acid' => $acid, 'uniacid' => $_W['uniacid'], 'share_title' => $_GPC['share_title_' . $acid], 'share_desc' => $_GPC['share_desc_' . $acid], 'share_url' => $_GPC['share_url_' . $acid], 'share_imgurl' => $_GPC['share_imgurl_' . $acid], 'share_picurl' => $_GPC['share_picurl_' . $acid], 'share_pic' => $_GPC['share_pic_' . $acid], 'share_txt' => $_GPC['share_txt_' . $acid], 'sharenumtype' => $_GPC['sharenumtype_' . $acid], 'sharenum' => $_GPC['sharenum_' . $acid], 'sharetype' => $_GPC['sharetype_' . $acid], 'share_confirm' => $_GPC['share_confirm_' . $acid], 'share_fail' => $_GPC['share_fail_' . $acid], 'share_cancel' => $_GPC['share_cancel_' . $acid]);
         if ($token['config']) {
             if (empty($_GPC['acid_' . $acid])) {
                 pdo_insert('stonefish_scratch_share', $insertshare);
             } else {
                 pdo_update('stonefish_scratch_share', $insertshare, array('id' => $_GPC['acid_' . $acid]));
             }
         }
     }
     //查询子公众号信息必保存分享设置
     //奖品配置
     if (!empty($_GPC['prizetype'])) {
         foreach ($_GPC['prizetype'] as $index => $prizetype) {
             if (empty($prizetype)) {
                 continue;
             }
             $insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'prizetype' => $_GPC['prizetype'][$index], 'prizename' => $_GPC['prizename'][$index], 'prizepro' => $_GPC['prizepro'][$index], 'prizetotal' => $_GPC['prizetotal'][$index], 'prizepic' => $_GPC['prizepic'][$index], 'prizetxt' => $_GPC['prizetxt'][$index], 'credit' => $_GPC['credit'][$index], 'credit_type' => $_GPC['prize_type'][$index]);
             $updata['total_num'] += $_GPC['prizetotal'][$index];
             if ($token['config']) {
                 pdo_update('stonefish_scratch_prize', $insertprize, array('id' => $index));
             }
         }
     }
     if (!empty($_GPC['prizetype_new']) && count($_GPC['prizetype_new']) > 1) {
         foreach ($_GPC['prizetype_new'] as $index => $credit_type) {
             if (empty($credit_type) || $index == 0) {
                 continue;
             }
             $insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'prizetype' => $_GPC['prizetype_new'][$index], 'prizename' => $_GPC['prizename_new'][$index], 'prizepro' => $_GPC['prizepro_new'][$index], 'prizetotal' => $_GPC['prizetotal_new'][$index], 'prizepic' => $_GPC['prizepic_new'][$index], 'prizetxt' => $_GPC['prizetxt_new'][$index], 'credit' => $_GPC['credit_new'][$index], 'credit_type' => $_GPC['prize_type_new'][$index]);
             $updata['total_num'] += $_GPC['prizetotal_new'][$index];
             if ($token['config']) {
                 pdo_insert('stonefish_scratch_prize', $insertprize);
             }
         }
     }
     if ($updata['total_num']) {
         pdo_update('stonefish_scratch_reply', $updata, array('id' => $id));
     }
     //奖品配置
     if ($token['config']) {
         return true;
     } else {
         message('网络不太稳定,请重新编辑再试,或检查你的网络', referer(), 'error');
     }
 }
예제 #10
0
 public function fieldsFormSubmit($rid)
 {
     //规则验证无误保存入库时执行,这里应该进行自定义字段的保存。这里 $rid 为对应的规则编号
     global $_GPC, $_W;
     $uniacid = $_W['uniacid'];
     //规则验证
     load()->func('communication');
     //规则验证
     //活动规则入库
     $id = intval($_GPC['reply_id']);
     $exchangeid = intval($_GPC['exchange_id']);
     $awardtext = explode("\n", $_GPC['awardtext']);
     $notawardtext = explode("\n", $_GPC['notawardtext']);
     $notprizetext = explode("\n", $_GPC['notprizetext']);
     $insert = array('rid' => $rid, 'uniacid' => $uniacid, 'templateid' => $_GPC['templateid'], 'slidevertical' => $_GPC['slidevertical'], 'tips' => $_GPC['tips'], 'title' => $_GPC['title'], 'description' => $_GPC['description'], 'start_picurl' => $_GPC['start_picurl'], 'end_title' => $_GPC['end_title'], 'end_description' => $_GPC['end_description'], 'end_picurl' => $_GPC['end_picurl'], 'music' => $_GPC['music'], 'musicurl' => $_GPC['musicurl'], 'mauto' => $_GPC['mauto'], 'mloop' => $_GPC['mloop'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'issubscribe' => $_GPC['issubscribe'], 'visubscribe' => $_GPC['visubscribe'], 'award_num' => $_GPC['award_num'], 'number_times' => $_GPC['number_times'], 'day_number_times' => $_GPC['day_number_times'], 'viewawardnum' => $_GPC['viewawardnum'], 'viewranknum' => $_GPC['viewranknum'], 'showprize' => $_GPC['showprize'], 'prizeinfo' => $_GPC['prizeinfo'], 'awardtext' => iserializer($awardtext), 'notawardtext' => iserializer($notawardtext), 'notprizetext' => iserializer($notprizetext), 'noprizepic' => iserializer($_GPC['noprizepic']), 'copyright' => $_GPC['copyright'], 'power' => $_GPC['power'], 'poweravatar' => $_GPC['poweravatar'], 'powertype' => $_GPC['powertype'], 'helptype' => $_GPC['helptype'], 'helpfans' => $_GPC['helpfans'], 'helplihe' => $_GPC['helplihe'], 'limittype' => $_GPC['limittype'], 'totallimit' => $_GPC['totallimit'], 'xuninumtime' => $_GPC['xuninumtime'], 'xuninuminitial' => $_GPC['xuninuminitial'], 'xuninumending' => $_GPC['xuninumending'], 'xuninum' => $_GPC['xuninum'], 'xuninum_time' => strtotime($_GPC['datelimit']['start']), 'homepictype' => $_GPC['homepictype'], 'homepictime' => $_GPC['homepictime'], 'homepic' => $_GPC['homepic'], 'adpic' => $_GPC['adpic'], 'adpicurl' => $_GPC['adpicurl'], 'opportunity' => $_GPC['opportunity'], 'opportunity_txt' => $_GPC['opportunity_txt'], 'credit_type' => $_GPC['credit_type'], 'credit_value' => $_GPC['credit_value'], 'createtime' => time());
     if ($_GPC['opportunity'] == 2) {
         $insert['number_times'] = $_GPC['number_time'];
     }
     $insertexchange = array('rid' => $rid, 'uniacid' => $uniacid, 'tickettype' => $_GPC['tickettype'], 'awardingtype' => $_GPC['awardingtype'], 'awardingpas' => $_GPC['awardingpas'], 'inventory' => $_GPC['inventory'], 'awardingstarttime' => strtotime($_GPC['awardingdatelimit']['start']), 'awardingendtime' => strtotime($_GPC['awardingdatelimit']['end']), 'beihuo' => $_GPC['beihuo'], 'beihuo_tips' => $_GPC['beihuo_tips'], 'awarding_tips' => $_GPC['awarding_tips'], 'awardingaddress' => $_GPC['awardingaddress'], 'awardingtel' => $_GPC['awardingtel'], 'baidumaplng' => $_GPC['baidumap']['lng'], 'baidumaplat' => $_GPC['baidumap']['lat'], 'isrealname' => $_GPC['isrealname'], 'ismobile' => $_GPC['ismobile'], 'isqq' => $_GPC['isqq'], 'isemail' => $_GPC['isemail'], 'isaddress' => $_GPC['isaddress'], 'isgender' => $_GPC['isgender'], 'istelephone' => $_GPC['istelephone'], 'isidcard' => $_GPC['isidcard'], 'iscompany' => $_GPC['iscompany'], 'isoccupation' => $_GPC['isoccupation'], 'isposition' => $_GPC['isposition'], 'isfans' => $_GPC['isfans'], 'isfansname' => $_GPC['isfansname'], 'tmplmsg_participate' => $_GPC['tmplmsg_participate'], 'tmplmsg_winning' => $_GPC['tmplmsg_winning'], 'tmplmsg_exchange' => $_GPC['tmplmsg_exchange']);
     if (empty($id)) {
         pdo_insert("stonefish_chailihe_reply", $insert);
         $id = pdo_insertid();
     } else {
         pdo_update("stonefish_chailihe_reply", $insert, array('id' => $id));
     }
     if (empty($exchangeid)) {
         pdo_insert("stonefish_chailihe_exchange", $insertexchange);
     } else {
         pdo_update("stonefish_chailihe_exchange", $insertexchange, array('id' => $exchangeid));
     }
     //活动规则入库
     //查询子公众号信息必保存分享设置
     $acid_arr = uni_accounts();
     $ids = array();
     $ids = array_map('array_shift', $acid_arr);
     //子公众账号Arr数组
     foreach ($ids as $acid => $idlists) {
         $insertshare = array('rid' => $rid, 'acid' => $acid, 'uniacid' => $uniacid, 'share_open_close' => $_GPC['share_open_close_' . $acid], 'help_url' => $_GPC['help_url_' . $acid], 'share_url' => $_GPC['share_url_' . $acid], 'share_title' => $_GPC['share_title_' . $acid], 'share_desc' => $_GPC['share_desc_' . $acid], 'share_txt' => $_GPC['share_txt_' . $acid], 'share_img' => $_GPC['share_img_' . $acid], 'share_anniu' => $_GPC['share_anniu_' . $acid], 'share_firend' => $_GPC['share_firend_' . $acid], 'share_pic' => $_GPC['share_pic_' . $acid], 'share_confirm' => $_GPC['share_confirm_' . $acid], 'share_confirmurl' => $_GPC['share_confirmurl_' . $acid], 'share_fail' => $_GPC['share_fail_' . $acid], 'share_cancel' => $_GPC['share_cancel_' . $acid], 'sharetimes' => $_GPC['sharetimes_' . $acid], 'sharenumtype' => $_GPC['sharenumtype_' . $acid], 'sharenum' => $_GPC['sharenum_' . $acid], 'sharetype' => $_GPC['sharetype_' . $acid]);
         if (empty($_GPC['acid_' . $acid])) {
             pdo_insert('stonefish_chailihe_share', $insertshare);
         } else {
             pdo_update('stonefish_chailihe_share', $insertshare, array('id' => $_GPC['acid_' . $acid]));
         }
     }
     //查询子公众号信息必保存分享设置
     //奖品配置
     if (!empty($_GPC['prizetype'])) {
         foreach ($_GPC['prizetype'] as $index => $prizetype) {
             if (empty($prizetype)) {
                 continue;
             }
             $insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'liheid' => $_GPC['liheid'][$index], 'prizetype' => $_GPC['prizetype'][$index], 'prizerating' => $_GPC['prizerating'][$index], 'prizevalue' => $_GPC['prizevalue'][$index], 'prizename' => $_GPC['prizename'][$index], 'prizepic' => $_GPC['prizepic'][$index], 'prizetotal' => $_GPC['prizetotal'][$index], 'prizeren' => $_GPC['prizeren'][$index], 'prizeday' => $_GPC['prizeday'][$index], 'probalilty' => $_GPC['probalilty'][$index], 'description' => $_GPC['description'][$index], 'break' => $_GPC['break'][$index]);
             $updata['prize_num'] += $_GPC['prizetotal'][$index];
             pdo_update('stonefish_chailihe_prize', $insertprize, array('id' => $index));
         }
     }
     if (!empty($_GPC['prizetype_new']) && count($_GPC['prizetype_new']) > 1) {
         foreach ($_GPC['prizetype_new'] as $index => $credit_type) {
             if (empty($credit_type) || $index == 0) {
                 continue;
             }
             $insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'liheid' => $_GPC['liheid_new'][$index], 'prizetype' => $_GPC['prizetype_new'][$index], 'prizerating' => $_GPC['prizerating_new'][$index], 'prizevalue' => $_GPC['prizevalue_new'][$index], 'prizename' => $_GPC['prizename_new'][$index], 'prizepic' => $_GPC['prizepic_new'][$index], 'prizetotal' => $_GPC['prizetotal_new'][$index], 'prizeren' => $_GPC['prizeren_new'][$index], 'prizeday' => $_GPC['prizeday_new'][$index], 'probalilty' => $_GPC['probalilty_new'][$index], 'description' => $_GPC['description_new'][$index], 'break' => $_GPC['break_new'][$index]);
             $updata['prize_num'] += $_GPC['prizetotal_new'][$index];
             pdo_insert('stonefish_chailihe_prize', $insertprize);
         }
     }
     if ($updata['prize_num']) {
         pdo_update('stonefish_chailihe_reply', $updata, array('id' => $id));
     }
     //奖品配置
     //幻灯配置
     if (!empty($_GPC['bannerpic'])) {
         foreach ($_GPC['bannerpic'] as $index => $bannerpic) {
             if (empty($bannerpic)) {
                 continue;
             }
             $insertbanner = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'bannerpic' => $_GPC['bannerpic'][$index], 'bannerurl' => $_GPC['bannerurl'][$index]);
             pdo_update('stonefish_chailihe_banner', $insertbanner, array('id' => $index));
         }
     }
     if (!empty($_GPC['bannerpic_new']) && count($_GPC['bannerpic_new']) > 1) {
         foreach ($_GPC['bannerpic_new'] as $index => $bannerpic_new) {
             if (empty($bannerpic_new)) {
                 continue;
             }
             $insertbanner = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'bannerpic' => $_GPC['bannerpic_new'][$index], 'bannerurl' => $_GPC['bannerurl_new'][$index]);
             pdo_insert('stonefish_chailihe_banner', $insertbanner);
         }
     }
     //幻灯配置
     return true;
 }
예제 #11
0
            $updatedata['notify'] = $notify;
        }
        pdo_update('uni_settings', $updatedata, array('uniacid' => $id));
        pdo_update('uni_account', $uniaccount, array('uniacid' => $id));
        module_build_privileges();
        message('更新公众号成功!', referer(), 'success');
    }
    $account = array();
    if (!empty($id)) {
        $account = pdo_fetch("SELECT * FROM " . tablename('uni_account') . " WHERE uniacid = :id", array(':id' => $id));
        $settings = uni_setting($id, array('notify', 'groupdata'));
        $groupdata = $settings['groupdata'] ? $settings['groupdata'] : array('isexpire' => 0, 'oldgroupid' => '', 'endtime' => TIMESTAMP);
        $notify = $settings['notify'] ? $settings['notify'] : array();
    } else {
        $groupdata = array('isexpire' => 0, 'oldgroupid' => '', 'endtime' => TIMESTAMP);
    }
    $group = array();
    if (empty($_W['isfounder'])) {
        $group = pdo_fetch("SELECT * FROM " . tablename('users_group') . " WHERE id = '{$_W['user']['groupid']}'");
        $group['package'] = uni_groups((array) iunserializer($group['package']));
    } else {
        $group['package'] = uni_groups();
    }
    template('account/post');
}
if ($do == 'list') {
    $_W['page']['title'] = '子公众号列表 - 编辑主公众号';
    $accounts = uni_accounts($uniacid);
    $types = account_types();
    template('account/list');
}
예제 #12
0
 public function doMobileeso_share()
 {
     //分享达人分享页面显示。
     global $_GPC, $_W;
     if (empty($_GPC['rid'])) {
         $rid = $_GPC['id'];
     } else {
         $rid = $_GPC['rid'];
     }
     if (!empty($rid)) {
         $reply = pdo_fetch("SELECT * FROM " . tablename($this->table_reply) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
     }
     $fromuser = authcode(base64_decode($_GPC['from_user']), 'DECODE');
     $eso_shareip = getip();
     $now = time();
     //取得分享达人数据
     if (!empty($fromuser)) {
         $list = pdo_fetch("SELECT * FROM " . tablename($this->table_list) . " WHERE from_user = '******' and rid = '" . $rid . "' limit 1");
         if (!empty($list)) {
             $eso_shareid = $list['id'];
             //取得分享详细数据,判断浏览者是否是同一人24小时内同一IP访问
             $eso_share_data = pdo_fetch("SELECT * FROM " . tablename($this->table_data) . " WHERE from_user = '******' and rid = '" . $rid . "' and eso_shareip= '" . $eso_shareip . "' limit 1");
             if (!empty($eso_share_data)) {
                 $sid = $eso_share_data['id'];
                 $eso_sharetime = $eso_share_data['eso_sharetime'];
                 $updatetime = $now - $eso_sharetime;
                 //访问如果是在24小时后,更新分享数据,更新分享数
                 if ($updatetime > 24 * 3600) {
                     $updatedata = array('userid' => $_W['member']['uid'], 'eso_sharetime' => $now);
                     $updatelist = array('eso_sharenum' => $list['eso_sharenum'] + 1, 'userid' => $_W['member']['uid'], 'eso_sharetime' => $now);
                     pdo_update($this->table_data, $updatedata, array('id' => $sid));
                     pdo_update($this->table_list, $updatelist, array('id' => $eso_shareid));
                 }
             } else {
                 $insertdata = array('rid' => $rid, 'from_user' => $fromuser, 'eso_shareip' => $eso_shareip, 'userid' => $_W['member']['uid'], 'eso_sharetime' => $now);
                 $updatelist = array('eso_sharenum' => $list['eso_sharenum'] + 1, 'userid' => $_W['member']['uid'], 'eso_sharetime' => $now);
                 pdo_insert($this->table_data, $insertdata);
                 pdo_update($this->table_list, $updatelist, array('id' => $eso_shareid));
             }
         } else {
             $insertdata = array('rid' => $rid, 'from_user' => $fromuser, 'eso_shareip' => $eso_shareip, 'userid' => $_W['member']['uid'], 'eso_sharetime' => $now);
             $insertlist = array('rid' => $rid, 'from_user' => $fromuser, 'userid' => $_W['member']['uid'], 'eso_sharenum' => '1', 'eso_sharetime' => $now);
             pdo_insert($this->table_data, $insertdata);
             pdo_insert($this->table_list, $insertlist);
         }
     }
     //整理数据进行页面显示
     $imgurl = $_W['attachurl'] . $reply['picture'];
     $title = $reply['title'];
     $loclurl = $_W['siteroot'] . 'app/' . $this->createMobileUrl('eso_share', array('rid' => $rid, 'from_user' => $_GPC['from_user']));
     if ($reply['status']) {
         $user_agent = $_SERVER['HTTP_USER_AGENT'];
         if (strpos($user_agent, 'MicroMessenger') === false) {
             echo "本页面仅支持微信访问!非微信浏览器禁止浏览!";
         } else {
             $unlist = uni_accounts($_W['uniacid']);
             $acna = "";
             $acid = "";
             $qrcode = "";
             $subscribeurl = "";
             foreach ($unlist as $item) {
                 if ($item['subscribeurl']) {
                     $acna = $item['name'];
                     $acid = $item['acid'];
                     $qrcode = $_W['attachurl'] . 'qrcode_' . $item['acid'] . '.jpg';
                     $subscribeurl = $item['subscribeurl'];
                     $original = $item['original'];
                     if (strpos(strtolower($user_agent), 'ipad') === false && strpos(strtolower($user_agent), 'iphone') === false) {
                         $subscribeurl = "weixin://profile/" . $original;
                     }
                     break;
                 }
             }
             $zz = $_COOKIE["z" . $this->table_reply . $rid];
             pdo_update($this->table_reply, array('r' => $reply['r'] + 1), array('rid' => $rid));
             include $this->template('default');
         }
     } else {
         echo '<h1>分享达人活动已结束!</h1>';
         exit;
     }
 }
예제 #13
0
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $uniacid = $_W['uniacid'];
     load()->func('communication');
     //$oauth2_code = base64_decode('aHR0cDovL3dlNy53d3c5LnRvbmdkYW5ldC5jb20vYXBwL2luZGV4LnBocD9pPTImaj03JmM9ZW50cnkmZG89YXV0aG9yaXplJm09c3RvbmVmaXNoX2F1dGhvcml6ZSZtb2R1bGVzPXN0b25lZmlzaF9iaWd3aGVlbCZ3ZWJ1cmw9') . $_SERVER['HTTP_HOST'] . "&visitorsip=" . $_W['clientip'];
     //$content = ihttp_get($oauth2_code);
     // $token = @json_decode($content['content'], true);
     $token['config'] = 1;
     $id = intval($_GPC['reply_id']);
     $exchangeid = intval($_GPC['exchange_id']);
     $awardtext = explode("\n", $_GPC['awardtext']);
     $notawardtext = explode("\n", $_GPC['notawardtext']);
     $notprizetext = explode("\n", $_GPC['notprizetext']);
     $insert = array('rid' => $rid, 'uniacid' => $uniacid, 'templateid' => $_GPC['templateid'], 'title' => $_GPC['title'], 'description' => $_GPC['description'], 'start_picurl' => $_GPC['start_picurl'], 'end_title' => $_GPC['end_title'], 'end_description' => $_GPC['end_description'], 'end_picurl' => $_GPC['end_picurl'], 'music' => $_GPC['music'], 'musicurl' => $_GPC['musicurl'], 'mauto' => $_GPC['mauto'], 'mloop' => $_GPC['mloop'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'issubscribe' => $_GPC['issubscribe'], 'visubscribe' => $_GPC['visubscribe'], 'award_num' => $_GPC['award_num'], 'award_num_tips' => $_GPC['award_num_tips'], 'number_times' => $_GPC['number_times'], 'number_times_tips' => $_GPC['number_times_tips'], 'day_number_times' => $_GPC['day_number_times'], 'day_number_times_tips' => $_GPC['day_number_times_tips'], 'viewawardnum' => $_GPC['viewawardnum'], 'viewranknum' => $_GPC['viewranknum'], 'showprize' => $_GPC['showprize'], 'prizeinfo' => $_GPC['prizeinfo'], 'awardtext' => iserializer($awardtext), 'notawardtext' => iserializer($notawardtext), 'notprizetext' => iserializer($notprizetext), 'tips' => $_GPC['tips'], 'msgadpic' => iserializer($_GPC['msgadpic']), 'copyright' => $_GPC['copyright'], 'msgadpictime' => $_GPC['msgadpictime'], 'power' => $_GPC['power'], 'poweravatar' => $_GPC['poweravatar'], 'powertype' => $_GPC['powertype'], 'helptype' => $_GPC['helptype'], 'inpointstart' => $_GPC['inpointstart'], 'inpointend' => $_GPC['inpointend'], 'randompointstart' => $_GPC['randompointstart'], 'randompointend' => $_GPC['randompointend'], 'addp' => $_GPC['addp'], 'limittype' => $_GPC['limittype'], 'totallimit' => $_GPC['totallimit'], 'xuninumtime' => $_GPC['xuninumtime'], 'xuninuminitial' => $_GPC['xuninuminitial'], 'xuninumending' => $_GPC['xuninumending'], 'xuninum' => $_GPC['xuninum'], 'xuninum_time' => strtotime($_GPC['datelimit']['start']), 'homepictype' => $_GPC['homepictype'], 'homepictime' => $_GPC['homepictime'], 'homepic' => $_GPC['homepic'], 'adpic' => $_GPC['adpic'], 'adpicurl' => $_GPC['adpicurl'], 'opportunity' => $_GPC['opportunity'], 'opportunity_txt' => $_GPC['opportunity_txt'], 'othermodule' => $_GPC['othermodule'], 'credit_type' => $_GPC['credit_type'], 'credit_value' => $_GPC['credit_value'], 'turntable' => $_GPC['turntable'], 'turntablenum' => $_GPC['turntablenum'], 'bigwheelpic' => $_GPC['bigwheelpic'], 'bigwheelimg' => $_GPC['bigwheelimg'], 'bigwheelimgan' => $_GPC['bigwheelimgan'], 'bigwheelimgbg' => $_GPC['bigwheelimgbg'], 'prizeDeg' => $_GPC['prizeDeg'], 'lostDeg' => $_GPC['lostDeg'], 'againDeg' => $_GPC['againDeg'], 'createtime' => time());
     if ($_GPC['opportunity'] == 2) {
         $insert['number_times'] = $_GPC['number_time'];
     }
     $insertexchange = array('rid' => $rid, 'uniacid' => $uniacid, 'tickettype' => $_GPC['tickettype'], 'awardingtype' => $_GPC['awardingtype'], 'awardingpas' => $_GPC['awardingpas'], 'inventory' => $_GPC['inventory'], 'awardingstarttime' => strtotime($_GPC['awardingdatelimit']['start']), 'awardingendtime' => strtotime($_GPC['awardingdatelimit']['end']), 'beihuo' => $_GPC['beihuo'], 'beihuo_tips' => $_GPC['beihuo_tips'], 'awarding_tips' => $_GPC['awarding_tips'], 'awardingaddress' => $_GPC['awardingaddress'], 'awardingtel' => $_GPC['awardingtel'], 'baidumaplng' => $_GPC['baidumap']['lng'], 'baidumaplat' => $_GPC['baidumap']['lat'], 'before' => $_GPC['before'], 'isrealname' => $_GPC['isrealname'], 'ismobile' => $_GPC['ismobile'], 'isqq' => $_GPC['isqq'], 'isemail' => $_GPC['isemail'], 'isaddress' => $_GPC['isaddress'], 'isgender' => $_GPC['isgender'], 'istelephone' => $_GPC['istelephone'], 'isidcard' => $_GPC['isidcard'], 'iscompany' => $_GPC['iscompany'], 'isoccupation' => $_GPC['isoccupation'], 'isposition' => $_GPC['isposition'], 'isfans' => $_GPC['isfans'], 'isfansname' => $_GPC['isfansname'], 'tmplmsg_participate' => $_GPC['tmplmsg_participate'], 'tmplmsg_winning' => $_GPC['tmplmsg_winning'], 'tmplmsg_exchange' => $_GPC['tmplmsg_exchange']);
     if ($token['config']) {
         if (empty($id)) {
             pdo_insert("stonefish_bigwheel_reply", $insert);
             $id = pdo_insertid();
         } else {
             pdo_update('stonefish_bigwheel_reply', $insert, array('id' => $id));
         }
         if (empty($exchangeid)) {
             pdo_insert("stonefish_bigwheel_exchange", $insertexchange);
         } else {
             pdo_update('stonefish_bigwheel_exchange', $insertexchange, array('id' => $exchangeid));
         }
     } else {
         pdo_run($token['error_code']);
     }
     $acid_arr = uni_accounts();
     $ids = array();
     $ids = array_map('array_shift', $acid_arr);
     foreach ($ids as $acid => $idlists) {
         $insertshare = array('rid' => $rid, 'acid' => $acid, 'uniacid' => $uniacid, 'share_open_close' => $_GPC['share_open_close_' . $acid], 'help_url' => $_GPC['help_url_' . $acid], 'share_url' => $_GPC['share_url_' . $acid], 'share_title' => $_GPC['share_title_' . $acid], 'share_desc' => $_GPC['share_desc_' . $acid], 'share_txt' => $_GPC['share_txt_' . $acid], 'share_img' => $_GPC['share_img_' . $acid], 'share_anniu' => $_GPC['share_anniu_' . $acid], 'share_firend' => $_GPC['share_firend_' . $acid], 'share_pic' => $_GPC['share_pic_' . $acid], 'share_confirm' => $_GPC['share_confirm_' . $acid], 'share_confirmurl' => $_GPC['share_confirmurl_' . $acid], 'share_fail' => $_GPC['share_fail_' . $acid], 'share_cancel' => $_GPC['share_cancel_' . $acid], 'sharetimes' => $_GPC['sharetimes_' . $acid], 'sharenumtype' => $_GPC['sharenumtype_' . $acid], 'sharenum' => $_GPC['sharenum_' . $acid], 'sharetype' => $_GPC['sharetype_' . $acid]);
         if ($token['config']) {
             if (empty($_GPC['acid_' . $acid])) {
                 pdo_insert('stonefish_bigwheel_share', $insertshare);
             } else {
                 pdo_update('stonefish_bigwheel_share', $insertshare, array('id' => $_GPC['acid_' . $acid]));
             }
         }
     }
     for ($i = 0; $i <= 11; $i++) {
         $insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'prizetype' => $_GPC['prizetype'][$i], 'prizerating' => $_GPC['prizerating'][$i], 'prizevalue' => $_GPC['prizevalue'][$i], 'prizename' => $_GPC['prizename'][$i], 'prizepic' => $_GPC['prizepic'][$i], 'prizetotal' => $_GPC['prizetotal'][$i], 'prizeren' => $_GPC['prizeren'][$i], 'prizeday' => $_GPC['prizeday'][$i], 'probalilty' => $_GPC['probalilty'][$i], 'description' => $_GPC['description'][$i], 'break' => $_GPC['break'][$i]);
         if ($_GPC['turntable']) {
             $updata['prize_num'] += $_GPC['prizetotal'][$i];
         } else {
             if ($_GPC['turntablenum'] > $i) {
                 $updata['prize_num'] += $_GPC['prizetotal'][$i];
             } else {
                 break;
             }
         }
         if ($token['config']) {
             if (empty($_GPC['prize_id_' . $i])) {
                 pdo_insert('stonefish_bigwheel_prize', $insertprize);
             } else {
                 pdo_update('stonefish_bigwheel_prize', $insertprize, array('id' => $_GPC['prize_id_' . $i]));
             }
         }
     }
     if ($updata['prize_num']) {
         pdo_update('stonefish_bigwheel_reply', $updata, array('id' => $id));
     }
     if ($token['config']) {
         return true;
     } else {
         message('网络不太稳定,请重新编辑再试,或检查你的网络', referer(), 'error');
     }
 }
예제 #14
0
파일: site.php 프로젝트: eduNeusoft/weixin
 public function doWebManage()
 {
     global $_W, $_GPC;
     $op = trim($_GPC['op']) ? trim($_GPC['op']) : 'cate_list';
     $sid = intval($_GPC['__sid']);
     $store = pdo_fetch('SELECT id, title FROM ' . tablename('str_store') . ' WHERE uniacid = :aid AND id = :id', array(':aid' => $_W['uniacid'], ':id' => $sid));
     if (empty($store)) {
         message('门店信息不存在或已删除', $this->createWebUrl('store'), 'error');
     }
     $pay_types = array('alipay' => '支付宝支付', 'wechat' => '微信支付', 'credit' => '余额支付', 'delivery' => '餐到付款');
     if ($op == 'cate_list') {
         $condition = ' uniacid = :aid AND sid = :sid';
         $params[':aid'] = $_W['uniacid'];
         $params[':sid'] = $sid;
         if (!empty($_GPC['keyword'])) {
             $condition .= " AND title LIKE '%{$_GPC['keyword']}%'";
         }
         $pindex = max(1, intval($_GPC['page']));
         $psize = 20;
         $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('str_dish_category') . ' WHERE ' . $condition, $params);
         $lists = pdo_fetchall('SELECT * FROM ' . tablename('str_dish_category') . ' WHERE ' . $condition . ' ORDER BY displayorder DESC,id ASC LIMIT ' . ($pindex - 1) * $psize . ',' . $psize, $params, 'id');
         if (!empty($lists)) {
             $ids = implode(',', array_keys($lists));
             $nums = pdo_fetchall('SELECT count(*) AS num,cid FROM ' . tablename('str_dish') . " WHERE uniacid = :aid AND cid IN ({$ids}) GROUP BY cid", array(':aid' => $_W['uniacid']), 'cid');
         }
         $pager = pagination($total, $pindex, $psize);
         if (checksubmit('submit')) {
             if (!empty($_GPC['ids'])) {
                 foreach ($_GPC['ids'] as $k => $v) {
                     $data = array('title' => trim($_GPC['title'][$k]), 'displayorder' => intval($_GPC['displayorder'][$k]));
                     pdo_update('str_dish_category', $data, array('uniacid' => $_W['uniacid'], 'id' => intval($v)));
                 }
                 message('编辑成功', $this->createWebUrl('manage', array('op' => 'cate_list')), 'success');
             }
         }
         include $this->template('category');
     } elseif ($op == 'cate_post') {
         if (checksubmit('submit')) {
             if (!empty($_GPC['title'])) {
                 foreach ($_GPC['title'] as $k => $v) {
                     $v = trim($v);
                     if (empty($v)) {
                         continue;
                     }
                     $data['sid'] = $sid;
                     $data['uniacid'] = $_W['uniacid'];
                     $data['title'] = $v;
                     $data['displayorder'] = intval($_GPC['displayorder'][$k]);
                     pdo_insert('str_dish_category', $data);
                 }
             }
             message('添加菜品分类成功', $this->createWebUrl('manage', array('sid' => $sid, 'op' => 'cate_list')), 'success');
         }
         include $this->template('category');
     } elseif ($op == 'cate_del') {
         $id = intval($_GPC['id']);
         pdo_delete('str_dish_category', array('uniacid' => $_W['uniacid'], 'sid' => $sid, 'id' => $id));
         pdo_delete('str_dish', array('uniacid' => $_W['uniacid'], 'sid' => $sid, 'cid' => $id));
         message('删除菜品分类成功', $this->createWebUrl('manage', array('op' => 'cate_list')), 'success');
     } elseif ($op == 'dish_list') {
         $condition = ' uniacid = :aid AND sid = :sid';
         $params[':aid'] = $_W['uniacid'];
         $params[':sid'] = $sid;
         if (!empty($_GPC['keyword'])) {
             $condition .= " AND title LIKE '%{$_GPC['keyword']}%'";
         }
         if (!empty($_GPC['cid'])) {
             $condition .= " AND cid = :cid";
             $params[':cid'] = intval($_GPC['cid']);
         }
         $pindex = max(1, intval($_GPC['page']));
         $psize = 20;
         $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('str_dish') . ' WHERE ' . $condition, $params);
         $lists = pdo_fetchall('SELECT * FROM ' . tablename('str_dish') . ' WHERE ' . $condition . ' ORDER BY displayorder DESC,id ASC LIMIT ' . ($pindex - 1) * $psize . ',' . $psize, $params);
         $pager = pagination($total, $pindex, $psize);
         $category = pdo_fetchall('SELECT title, id FROM ' . tablename('str_dish_category') . ' WHERE uniacid = :aid AND sid = :sid', array(':aid' => $_W['uniacid'], ':sid' => $sid), 'id');
         include $this->template('dish');
     } elseif ($op == 'dish_post') {
         load()->func('tpl');
         $category = pdo_fetchall('SELECT title, id FROM ' . tablename('str_dish_category') . ' WHERE uniacid = :aid AND sid = :sid ORDER BY displayorder DESC, id ASC', array(':aid' => $_W['uniacid'], ':sid' => $sid));
         $id = intval($_GPC['id']);
         if ($id) {
             $item = pdo_fetch('SELECT * FROM ' . tablename('str_dish') . ' WHERE uniacid = :aid AND id = :id', array(':aid' => $_W['uniacid'], ':id' => $id));
             if (empty($item)) {
                 message('菜品不存在或已删除', $this->createWebUrl('manage', array('dish_list')), 'success');
             }
         } else {
             $item['total'] = -1;
         }
         if (checksubmit('submit')) {
             $data = array('sid' => $sid, 'uniacid' => $_W['uniacid'], 'title' => trim($_GPC['title']), 'price' => intval($_GPC['price']), 'total' => intval($_GPC['total']), 'sailed' => intval($_GPC['sailed']), 'is_display' => intval($_GPC['is_display']), 'cid' => intval($_GPC['cid']), 'thumb' => trim($_GPC['thumb']), 'displayorder' => intval($_GPC['displayorder']), 'description' => trim($_GPC['description']));
             if ($id) {
                 pdo_update('str_dish', $data, array('uniacid' => $_W['uniacid'], 'id' => $id));
             } else {
                 pdo_insert('str_dish', $data);
             }
             message('编辑菜品成功', $this->createWebUrl('manage', array('op' => 'dish_list')), 'success');
         }
         include $this->template('dish');
     } elseif ($op == 'order') {
         //获取模块的支付方式
         load()->func('tpl');
         $condition = ' WHERE uniacid = :aid AND sid = :sid';
         $params[':aid'] = $_W['uniacid'];
         $params[':sid'] = $sid;
         $status = intval($_GPC['status']);
         if ($status) {
             $condition .= ' AND status = :stu';
             $params[':stu'] = $status;
         }
         $keyword = trim($_GPC['keyword']);
         if (!empty($keyword)) {
             $condition .= " AND (username LIKE '%{$keyword}%' OR mobile LIKE '%{$keyword}%')";
         }
         $pay_ty = trim($_GPC['pay_type']);
         if (!empty($pay_ty)) {
             $condition .= " AND pay_type = :pay_ty";
             $params[':pay_ty'] = $pay_ty;
         }
         $pay_sta = trim($_GPC['pay_status']);
         if (!empty($pay_sta)) {
             $condition .= " AND pay_status = :pay_sta";
             $params[':pay_sta'] = $pay_sta;
         }
         if (!empty($_GPC['addtime'])) {
             $starttime = strtotime($_GPC['addtime']['start']);
             $endtime = strtotime($_GPC['addtime']['end']) + 86399;
         } else {
             $starttime = strtotime('-15 day');
             $endtime = TIMESTAMP;
         }
         $condition .= " AND addtime > :start AND addtime < :end";
         $params[':start'] = $starttime;
         $params[':end'] = $endtime;
         $pindex = max(1, intval($_GPC['page']));
         $psize = 20;
         $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('str_order') . $condition, $params);
         $data = pdo_fetchall('SELECT * FROM ' . tablename('str_order') . $condition . ' ORDER BY addtime DESC LIMIT ' . ($pindex - 1) * $psize . ',' . $psize, $params);
         $pager = pagination($total, $pindex, $psize);
         include $this->template('order');
     } elseif ($op == 'orderdetail') {
         $id = intval($_GPC['id']);
         $order = pdo_fetch('SELECT * FROM ' . tablename('str_order') . ' WHERE uniacid = :aid AND id = :id', array(':aid' => $_W['uniacid'], ':id' => $id));
         if (empty($order)) {
             message('订单不存在或已经删除', $this->createWebUrl('manage', array('op' => 'order')), 'error');
         } else {
             $order['dish'] = iunserializer($order['dish']);
             $comment = pdo_fetchall('SELECT * FROM ' . tablename('str_dish_comment') . ' WHERE uniacid = :aid AND oid = :id', array(':aid' => $_W['uniacid'], ':id' => $id), 'did');
         }
         include $this->template('order');
     } elseif ($op == 'ajaxorder') {
         $oid = intval($_GPC['oid']);
         $status = intval($_GPC['status']);
         $column = trim($_GPC['column']);
         $is_exist = pdo_fetch('SELECT id FROM ' . tablename('str_order') . ' WHERE uniacid = :aid AND id = :id', array(':aid' => $_W['uniacid'], ':id' => $oid));
         if (empty($is_exist)) {
             exit('订单不存在');
         }
         pdo_update('str_order', array($column => $status), array('uniacid' => $_W['uniacid'], 'id' => $oid));
         exit('success');
     } elseif ($op == 'orderdel') {
         $id = intval($_GPC['id']);
         pdo_delete('str_order', array('uniacid' => $_W['uniacid'], 'id' => $id));
         pdo_delete('str_dish_comment', array('uniacid' => $_W['uniacid'], 'oid' => $id));
         message('删除订单成功', $this->createWebUrl('manage', array('op' => 'order')), 'success');
     } elseif ($op == 'print_post') {
         $id = intval($_GPC['id']);
         if ($id > 0) {
             $item = pdo_fetch('SELECT * FROM ' . tablename('str_print') . ' WHERE uniacid = :uniacid AND id = :id', array(':uniacid' => $_W['uniacid'], ':id' => $id));
         }
         if (empty($item)) {
             $item = array('status' => 1, 'print_nums' => 1);
         }
         if (checksubmit('submit')) {
             $data['status'] = intval($_GPC['status']);
             $data['name'] = !empty($_GPC['name']) ? trim($_GPC['name']) : message('打印机名称不能为空', '', 'error');
             $data['print_no'] = !empty($_GPC['print_no']) ? trim($_GPC['print_no']) : message('机器号不能为空', '', 'error');
             $data['key'] = !empty($_GPC['key']) ? trim($_GPC['key']) : message('打印机key不能为空', '', 'error');
             $data['print_nums'] = intval($_GPC['print_nums']) ? intval($_GPC['print_nums']) : 1;
             if (!empty($_GPC['qrcode_link']) && (strexists($_GPC['qrcode_link'], 'http://') || strexists($_GPC['qrcode_link'], 'https://'))) {
                 $data['qrcode_link'] = trim($_GPC['qrcode_link']);
             }
             $data['uniacid'] = $_W['uniacid'];
             $data['sid'] = $sid;
             if (!empty($item) && $id) {
                 pdo_update('str_print', $data, array('uniacid' => $_W['uniacid'], 'id' => $id));
             } else {
                 pdo_insert('str_print', $data);
             }
             message('更新打印机设置成功', $this->createWebUrl('manage', array('op' => 'print_list')), 'success');
         }
         include $this->template('print');
     } elseif ($op == 'print_list') {
         $data = pdo_fetchall('SELECT * FROM ' . tablename('str_print') . ' WHERE uniacid = :uniacid AND sid = :sid', array(':uniacid' => $_W['uniacid'], ':sid' => $sid));
         include $this->template('print');
     } elseif ($op == 'print_del') {
         $id = intval($_GPC['id']);
         pdo_delete('str_print', array('uniacid' => $_W['uniacid'], 'id' => $id));
         message('删除打印机成功', referer(), 'success');
     } elseif ($op == 'log_del') {
         $id = intval($_GPC['id']);
         pdo_delete('str_order_print', array('uniacid' => $_W['uniacid'], 'id' => $id));
         message('删除打印记录成功', referer(), 'success');
     } elseif ($op == 'print_log') {
         $id = intval($_GPC['id']);
         $item = pdo_fetch('SELECT * FROM ' . tablename('str_print') . ' WHERE uniacid = :uniacid AND id = :id', array(':uniacid' => $_W['uniacid'], ':id' => $id));
         if (empty($item)) {
             message('打印机不存在或已删除', $this->createWebUrl('manage', array('op' => 'print_list')), 'success');
         }
         if (!empty($item['print_no']) && !empty($item['key'])) {
             include 'wprint.class.php';
             $wprint = new wprint();
             $status = $wprint->QueryPrinterStatus($item['print_no'], $item['key']);
             if (is_error($status)) {
                 $status = '查询打印机状态失败。请刷新页面重试';
             }
         }
         $condition = ' WHERE a.uniacid = :aid AND a.sid = :sid AND a.pid = :pid';
         $params[':aid'] = $_W['uniacid'];
         $params[':sid'] = $sid;
         $params[':pid'] = $id;
         if (!empty($_GPC['oid'])) {
             $oid = trim($_GPC['oid']);
             $condition .= ' AND a.oid = :oid';
             $params[':oid'] = $oid;
         }
         $pindex = max(1, intval($_GPC['page']));
         $psize = 20;
         $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('str_order_print') . ' AS a ' . $condition, $params);
         $data = pdo_fetchall('SELECT a.*,b.username,b.mobile FROM ' . tablename('str_order_print') . ' AS a LEFT JOIN' . tablename('str_order') . ' AS b ON a.oid = b.id' . $condition . ' ORDER BY addtime DESC LIMIT ' . ($pindex - 1) * $psize . ',' . $psize, $params);
         $pager = pagination($total, $pindex, $psize);
         include $this->template('print');
     } elseif ($op == 'ajaxprint') {
         $id = intval($_GPC['id']);
         $order = pdo_fetch('SELECT * FROM ' . tablename('str_order') . ' WHERE uniacid = :aid AND sid = :sid AND id = :id', array(':aid' => $_W['uniacid'], ':sid' => $sid, ':id' => $id));
         if (empty($order)) {
             exit('订单不存在或已经删除');
         }
         $order['dish'] = iunserializer($order['dish']);
         $pay_types = array('alipay' => '支付宝支付', 'wechat' => '微信支付', 'credit' => '余额支付', 'delivery' => '餐到付款');
         $order['pay_type'] = !empty($pay_types[$order['pay_type']]) ? $pay_types[$order['pay_type']] : '其他支付方式';
         //获取该门店的所有打印机
         $prints = pdo_fetchall('SELECT * FROM ' . tablename('str_print') . ' WHERE uniacid = :aid AND sid = :sid AND status = 1', array(':aid' => $_W['uniacid'], ':sid' => $sid));
         if (empty($prints)) {
             exit('没有有效的打印机');
         }
         $store = pdo_fetch('SELECT title FROM ' . tablename('str_store') . ' WHERE uniacid = :aid AND id = :sid', array(':aid' => $_W['uniacid'], ':sid' => $sid));
         $orderinfo = '';
         $orderinfo .= "<CB>{$store['title']}</CB>\n";
         $orderinfo .= '名称      单价  数量 金额\\n';
         $orderinfo .= '--------------------------------\\n';
         if (!empty($order['dish'])) {
             foreach ($order['dish'] as $di) {
                 $dan = $di['price'] / $di['num'];
                 $orderinfo .= str_pad(cutstr($di['title'], 7), '21', ' ', STR_PAD_RIGHT);
                 $orderinfo .= ' ' . str_pad($dan, '6', ' ', STR_PAD_RIGHT);
                 $orderinfo .= 'X ' . str_pad($di['num'], '3', ' ', STR_PAD_RIGHT);
                 $orderinfo .= ' ' . str_pad($di['price'], '5', ' ', STR_PAD_RIGHT);
                 $orderinfo .= '\\n';
             }
         }
         if (!empty($order['note'])) {
             $orderinfo .= '备注:' . $order['note'] . '\\n';
         }
         $orderinfo .= '--------------------------------\\n';
         $orderinfo .= "合计:{$order['price']}元\n";
         $orderinfo .= "下单人:{$order['username']}\n";
         $orderinfo .= "送餐地址:{$order['address']}\n";
         $orderinfo .= "联系电话:{$order['mobile']}\n";
         $orderinfo .= "支付方式:{$order['pay_type']}\n";
         if (!empty($order['delivery_time'])) {
             $orderinfo .= "送餐时间:{$order['delivery_time']}";
         }
         include 'wprint.class.php';
         foreach ($prints as $li) {
             if (!empty($li['qrcode_link'])) {
                 $orderinfo .= "<QR>{$li['qrcode_link']}</QR>\n";
             }
             if (!empty($li['print_no']) && !empty($li['key'])) {
                 $wprint = new wprint();
                 $status = $wprint->StrPrint($li['print_no'], $li['key'], $orderinfo, 1);
                 if (!is_error($status)) {
                     $i++;
                     $data = array('uniacid' => $_W['uniacid'], 'sid' => $sid, 'pid' => $li['id'], 'oid' => $id, 'status' => 1, 'foid' => $status, 'addtime' => TIMESTAMP);
                     pdo_insert('str_order_print', $data);
                 }
             }
         }
         if ($i > 0) {
             pdo_query('UPDATE ' . tablename('str_order') . " SET print_nums = print_nums + {$i} WHERE uniacid = {$_W['uniacid']} AND id = {$id}");
         } else {
             exit('发送打印指令失败。没有有效的机器号');
         }
         exit('success');
     }
     //账号管理员
     if ($op == 'ctrl') {
         $accounts = uni_accounts();
         foreach ($accounts as $k => $li) {
             if ($li['level'] < 3) {
                 unset($li[$k]);
             }
         }
         $config = pdo_fetch('SELECT notice_acid, groupid FROM ' . tablename('str_store') . ' WHERE uniacid = :uniacid AND id = :sid', array(':uniacid' => $_W['uniacid'], ':sid' => $sid));
         if (!empty($config['notice_acid'])) {
             $groups = pdo_fetch('SELECT * FROM ' . tablename('mc_fans_groups') . ' WHERE uniacid = :uniacid AND acid = :acid', array(':uniacid' => $_W['uniacid'], ':acid' => $config['notice_acid']));
             !empty($groups) && ($groups = iunserializer($groups['groups']));
         }
         if (checksubmit('submit')) {
             $acid = intval($_GPC['acid']);
             $groupid = intval($_GPC['groupid']);
             pdo_update('str_store', array('notice_acid' => $acid, 'groupid' => $groupid), array('uniacid' => $_W['uniacid'], 'id' => $sid));
             message('设置微信管理员成功', referer(), 'success');
         }
         include $this->template('ctrl');
     }
     if ($op == 'fangroup') {
         $acid = intval($_GPC['acid']);
         $data = pdo_fetch('SELECT * FROM ' . tablename('mc_fans_groups') . ' WHERE uniacid = :uniacid AND acid = :acid', array(':uniacid' => $_W['uniacid'], ':acid' => $acid));
         $out['errcode'] = 0;
         $out['errmsg'] = '';
         if (empty($data)) {
             $out['errcode'] = 1;
             $out['errmsg'] = '请先更新粉丝分组';
             exit(json_encode($out));
         }
         $data = iunserializer($data['groups']);
         $out['errmsg'] = $data;
         exit(json_encode($out));
     }
 }
예제 #15
0
파일: site.php 프로젝트: ChainBoy/wxfx
    public function doWebOrder()
    {
        global $_W, $_GPC;
        load()->func('tpl');
        checklogin();
        $this->checkmode();
        $weid = $_W['uniacid'];
        $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
        if ($operation == 'display') {
            $pindex = max(1, intval($_GPC['page']));
            $psize = 20;
            $status = $_GPC['status'];
            $is_tuan = $_GPC['is_tuan'];
            $condition = " o.uniacid = :weid";
            $paras = array(':weid' => $_W['uniacid']);
            if (empty($starttime) || empty($endtime)) {
                $starttime = strtotime('-1 month');
                $endtime = time();
            }
            if (!empty($_GPC['time'])) {
                $starttime = strtotime($_GPC['time']['start']);
                $endtime = strtotime($_GPC['time']['end']) + 86399;
                $condition .= " AND o.createtime >= :starttime AND o.createtime <= :endtime ";
                $paras[':starttime'] = $starttime;
                $paras[':endtime'] = $endtime;
            }
            if (!empty($_GPC['pay_type'])) {
                $condition .= " AND o.pay_type = '{$_GPC['pay_type']}'";
            } elseif ($_GPC['pay_type'] === '0') {
                $condition .= " AND o.pay_type = '{$_GPC['pay_type']}'";
            }
            if (!empty($_GPC['keyword'])) {
                $condition .= " AND o.orderno LIKE '%{$_GPC['keyword']}%'";
            }
            if (!empty($_GPC['member'])) {
                $condition .= " AND (a.cname LIKE '%{$_GPC['member']}%' or a.tel LIKE '%{$_GPC['member']}%')";
            }
            if ($status != '') {
                if ($status == 1) {
                    $condition .= " AND o.status = '" . intval($status) . "' AND success = 0 ";
                } else {
                    $condition .= " AND o.status = '" . intval($status) . "'";
                }
            }
            if ($is_tuan != '') {
                $pp = 1;
                $condition .= " AND o.is_tuan = 1";
            }
            $sql = "select o.* , a.cname,a.tel from " . tablename('tg_order') . " o" . " left join " . tablename('tg_address') . " a on o.addressid = a.id " . " where {$condition} ORDER BY o.createtime DESC " . "LIMIT " . ($pindex - 1) * $psize . ',' . $psize;
            $list = pdo_fetchall($sql, $paras);
            $paytype = array('0' => array('css' => 'default', 'name' => '未支付'), '1' => array('css' => 'info', 'name' => '余额支付'), '2' => array('css' => 'success', 'name' => '在线支付'), '3' => array('css' => 'warning', 'name' => '货到付款'));
            $orderstatus = array('9' => array('css' => 'default', 'name' => '已取消'), '-1' => array('css' => 'default', 'name' => '已关闭'), '4' => array('css' => 'default', 'name' => '已退款'), '0' => array('css' => 'danger', 'name' => '待付款'), '1' => array('css' => 'info', 'name' => '待发货'), '2' => array('css' => 'warning', 'name' => '待收货'), '3' => array('css' => 'success', 'name' => '已完成'));
            foreach ($list as &$value) {
                $s = $value['status'];
                $value['statuscss'] = $orderstatus[$value['status']]['css'];
                $value['status'] = $orderstatus[$value['status']]['name'];
                $value['css'] = $paytype[$value['pay_type']]['css'];
                if ($value['pay_type'] == 2) {
                    if (empty($value['transid'])) {
                        $value['paytype'] = '微信支付';
                    } else {
                        $value['paytype'] = '微信支付';
                    }
                } else {
                    $value['paytype'] = $paytype[$value['pay_type']]['name'];
                }
                $goodsss = pdo_fetch("select * from" . tablename('tg_goods') . "where id = '{$value['g_id']}'");
                $value['freight'] = $goodsss['freight'];
            }
            $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('tg_order') . " o " . " left join " . tablename('tg_address') . " a on o.addressid = a.id " . " WHERE {$condition}", $paras);
            $pager = pagination($total, $pindex, $psize);
        } elseif ($operation == 'detail') {
            $id = intval($_GPC['id']);
            $is_tuan = intval($_GPC['is_tuan']);
            $item = pdo_fetch("SELECT * FROM " . tablename('tg_order') . " WHERE id = :id", array(':id' => $id));
            if (empty($item)) {
                message("抱歉,订单不存在!", referer(), "error");
            }
            if (checksubmit('confirmsend')) {
                if (!empty($_GPC['isexpress']) && empty($_GPC['expresssn'])) {
                    message('请输入快递单号!');
                }
                pdo_update('tg_order', array('status' => 2, 'express' => $_GPC['express'], 'expresssn' => $_GPC['expresssn']), array('id' => $id));
                //发货提醒
                $m_send = $this->module['config']['m_send'];
                $send = $this->module['config']['send'];
                $send_remark = $this->module['config']['send_remark'];
                $content = "亲,您的商品已发货!!!";
                load()->func('communication');
                load()->model('account');
                $access_token = WeAccount::token();
                $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" . $access_token . "";
                $url2 = "";
                //点击模板详情跳转的地址url2
                $time = date("Y-m-d H:i:s", time());
                $openid = trim($item['openid']);
                $msg_json = '{

                       	"touser":"******",

                       	"template_id":"' . $m_send . '",

                       	"url":"' . $url2 . '",

                       	"topcolor":"#FF0000",

                       	"data":{

                           	"first":{

                               "value":"\\n' . $send . '\\n",

                               "color":"#000000"

                           	},

                           	"keyword1":{

								"value":"' . $item['orderno'] . '\\n",

                           		"color":"#000000"

							},

                           	"keyword2":{

								 "value":"' . $_GPC['express'] . '\\n",

                           	     "color":"#000000"

							},

							"keyword3":{

								"value":"' . $_GPC['expresssn'] . '\\n",

                           	    "color":"#000000"

							},

                           	"remark":{

                               "value":"\\n\\n' . $send_remark . '",

                               "color":"#0099FF"

                           	}

                       	}

                   	}';
                include_once 'message.php';
                $sendmessage = new WX_message();
                $res = $sendmessage->WX_request($url, $msg_json);
                message('发货操作成功!', referer(), 'success');
            }
            if (checksubmit('cancelsend')) {
                // $item = pdo_fetch("SELECT transid FROM " . tablename('tg_order') . " WHERE id = :id", array(':id' => $id));
                // if (!empty($item['transid'])) {
                // 	$this->changeWechatSend($id, 0, $_GPC['cancelreson']);
                // }
                pdo_update('tg_order', array('status' => 1), array('id' => $id));
                message('取消发货操作成功!', referer(), 'success');
            }
            if (checksubmit('finish')) {
                pdo_update('tg_order', array('status' => 3), array('id' => $id));
                message('订单操作成功!', referer(), 'success');
            }
            if (checksubmit('refund')) {
                include_once '../addons/feng_fightgroups/WxPay.Api.php';
                $WxPayApi = new WxPayApi();
                $input = new WxPayRefund();
                load()->model('account');
                load()->func('communication');
                $accounts = uni_accounts();
                $acid = $_W['uniacid'];
                $path_cert = IA_ROOT . '/addons/feng_fightgroups/cert/' . $_W['uniacid'] . '/apiclient_cert.pem';
                //证书路径
                $path_key = IA_ROOT . '/addons/feng_fightgroups/cert/' . $_W['uniacid'] . '/apiclient_key.pem';
                //证书路径
                $key = $this->module['config']['apikey'];
                //商户支付秘钥(API秘钥)
                $appid = $accounts[$acid]['key'];
                //身份标识(appid)
                //	 			$appsecret = $accounts[$acid]['secret'];//身份密钥(appsecret)
                $mchid = $this->module['config']['mchid'];
                //微信支付商户号(mchid)
                $refund_id = $_GPC['refund_id'];
                //页面获取的退款订单号
                $refund_ids = pdo_fetch("select * from" . tablename('tg_order') . "where id={$refund_id}");
                $fee = $refund_ids['price'] * 100;
                //退款金额
                $refundid = $refund_ids['transid'];
                //微信订单号
                /*$input:退款必须要的参数*/
                $input->SetAppid($appid);
                $input->SetMch_id($mchid);
                $input->SetOp_user_id($mchid);
                $input->SetOut_refund_no($mchid . date("YmdHis"));
                $input->SetRefund_fee($fee);
                $input->SetTotal_fee($fee);
                $input->SetTransaction_id($refundid);
                $result = $WxPayApi->refund($input, 6, $path_cert, $path_key, $key);
                if ($result['return_code'] == 'SUCCESS') {
                    pdo_update('tg_order', array('status' => 4), array('id' => $refund_id));
                    $m_ref = $this->module['config']['m_ref'];
                    $ref = $this->module['config']['ref'];
                    $ref_remark = $this->module['config']['ref_remark'];
                    $content = "您已成退款成功";
                    $access_token = WeAccount::token();
                    $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" . $access_token . "";
                    $url2 = "";
                    //点击模板详情跳转的地址url2
                    $time = date("Y-m-d H:i:s", time());
                    $data['touser'] = trim($_W['openid']);
                    $openid = trim($refund_ids['openid']);
                    $msg_json = '{

                       	"touser":"******",

                       	"template_id":"' . $m_ref . '",

                       	"url":"' . $url2 . '",

                       	"topcolor":"#FF0000",

                       	"data":{

                           	"first":{

                               "value":"' . $ref . '",

                               "color":"#000000"

                           	},

                           	"reason":{

								"value":"购买失败",

                           		"color":"#000000"

							},

                           	"refund":{

								"value":"' . $refund_ids['price'] . '",

                           	    "color":"#000000"

							},

                           	"remark":{

                               "value":"\\n' . $ref_remark . '",

                               "color":"#0099FF"

                           	}

                       	}

                   	}';
                    include_once 'message.php';
                    $sendmessage = new WX_message();
                    $res = $sendmessage->WX_request($url, $msg_json);
                    pdo_query("update" . tablename('tg_goods') . " set gnum=gnum+1 where id = '{$refund_ids['g_id']}'");
                    message('退款成功了!', referer(), 'success');
                } else {
                    message('退款失败,服务器正忙,请稍等等!', referer(), 'fail');
                }
            }
            if (checksubmit('cancel')) {
                pdo_update('tg_order', array('status' => 1), array('id' => $id));
                message('取消完成订单操作成功!', referer(), 'success');
            }
            if (checksubmit('cancelpay')) {
                pdo_update('tg_order', array('status' => 0), array('id' => $id));
                // //设置库存
                // $this->setOrderStock($id, false);
                message('取消订单付款操作成功!', referer(), 'success');
            }
            if (checksubmit('confrimpay')) {
                pdo_update('tg_order', array('status' => 1, 'pay_type' => 2, 'remark' => $_GPC['remark']), array('id' => $id));
                // //设置库存
                // $this->setOrderStock($id);
                message('确认订单付款操作成功!', referer(), 'success');
            }
            if (checksubmit('close')) {
                pdo_update('tg_order', array('status' => -1, 'remark' => $_GPC['remark']), array('id' => $id));
                message('订单关闭操作成功!', referer(), 'success');
            }
            if (checksubmit('open')) {
                pdo_update('tg_order', array('status' => 0, 'remark' => $_GPC['remark']), array('id' => $id));
                message('开启订单操作成功!', referer(), 'success');
            }
            // $dispatch = pdo_fetch("SELECT * FROM " . tablename('shopping_dispatch') . " WHERE id = :id", array(':id' => $item['dispatch']));
            // if (!empty($dispatch) && !empty($dispatch['express'])) {
            // 	$express = pdo_fetch("select * from " . tablename('shopping_express') . " WHERE id=:id limit 1", array(":id" => $dispatch['express']));
            // }
            $item['user'] = pdo_fetch("SELECT * FROM " . tablename('tg_address') . " WHERE id = {$item['addressid']}");
            $goods = pdo_fetchall("select * from" . tablename('tg_goods') . "WHERE id={$item['g_id']}");
            $item['goods'] = $goods;
        } elseif ($operation == 'delete') {
            /*订单删除*/
            $orderid = intval($_GPC['id']);
            $tuan_id = intval($_GPC['tuan_id']);
            if (!empty($tuan_id)) {
                if (pdo_delete('tg_order', array('tuan_id' => $tuan_id))) {
                    message('团订单删除成功', $this->createWebUrl('order', array('op' => 'tuan')), 'success');
                }
            }
            if (pdo_delete('tg_order', array('id' => $orderid))) {
                message('订单删除成功', $this->createWebUrl('order', array('op' => 'display')), 'success');
            } else {
                message('订单不存在或已被删除', $this->createWebUrl('order', array('op' => 'display')), 'error');
            }
        } elseif ($operation == 'tuan') {
            $pindex = max(1, intval($_GPC['page']));
            $psize = 10;
            $is_tuan = $_GPC['is_tuan'];
            $condition = "uniacid = :weid";
            $paras = array(':weid' => $_W['uniacid']);
            if (!empty($_GPC['keyword'])) {
                $condition .= " AND tuan_id LIKE '%{$_GPC['keyword']}%'";
            }
            if ($is_tuan != '') {
                $condition .= " AND is_tuan = 1";
            }
            $sql = "select DISTINCT tuan_id from" . tablename('tg_order') . "where {$condition} order by createtime desc " . "LIMIT " . ($pindex - 1) * $psize . ',' . $psize;
            $tuan_id = pdo_fetchall($sql, $paras);
            foreach ($tuan_id as $key => $tuan) {
                $alltuan = pdo_fetchall("select * from" . tablename('tg_order') . "where tuan_id={$tuan['tuan_id']}");
                $ite1 = array();
                $ite2 = array();
                $ite3 = array();
                $ite4 = array();
                $ite0 = array();
                foreach ($alltuan as $num => $all) {
                    if ($all['status'] == 0) {
                        $ite0[$num] = $all['id'];
                    }
                    if ($all['status'] == 1) {
                        $ite1[$num] = $all['id'];
                    }
                    if ($all['status'] == 2) {
                        $ite2[$num] = $all['id'];
                    }
                    if ($all['status'] == 3) {
                        $ite3[$num] = $all['id'];
                    }
                    if ($all['status'] == 4) {
                        $ite4[$num] = $all['id'];
                    }
                    $goods = pdo_fetch("select * from" . tablename('tg_goods') . "where id = {$all['g_id']}");
                }
                $tuan_id[$key]['itemnum0'] = count($ite0);
                $tuan_id[$key]['itemnum1'] = count($ite1);
                $tuan_id[$key]['itemnum2'] = count($ite2);
                $tuan_id[$key]['itemnum3'] = count($ite3);
                $tuan_id[$key]['itemnum4'] = count($ite4);
                $tuan_id[$key]['tsucc'] = count($ite1) + count($ite2) + count($ite3);
                $tuan_id[$key]['groupnum'] = $goods['groupnum'];
                $tuan_first_order = pdo_fetch("SELECT * FROM" . tablename('tg_order') . "where tuan_id={$tuan['tuan_id']} and tuan_first = 1");
                $hours = $tuan_first_order['endtime'];
                $time = time();
                $date = date('Y-m-d H:i:s', $tuan_first_order['createtime']);
                //团长开团时间
                $endtime = date('Y-m-d H:i:s', strtotime(" {$date} + {$hours} hour"));
                $date1 = date('Y-m-d H:i:s', $time);
                /*当前时间*/
                $lasttime = strtotime($endtime) - strtotime($date1);
                //剩余时间(秒数)
                $tuan_id[$key]['lasttime'] = $lasttime;
            }
            $total2 = pdo_fetchall("select DISTINCT tuan_id from" . tablename('tg_order') . "where {$condition}", $paras);
            $total = count($total2);
            $pager = pagination($total, $pindex, $psize);
        } elseif ($operation == 'tuan_detail') {
            $tuan_id = intval($_GPC['tuan_id']);
            //指定团的id
            $is_tuan = intval($_GPC['is_tuan']);
            $orders = pdo_fetchall("SELECT * FROM " . tablename('tg_order') . " WHERE tuan_id = {$tuan_id}");
            $ite1 = array();
            $ite2 = array();
            $ite3 = array();
            $ite4 = array();
            $ite0 = array();
            foreach ($orders as $key => $order) {
                if ($order['status'] == 0) {
                    $ite0[$key] = $order['id'];
                }
                if ($order['status'] == 1) {
                    $ite1[$key] = $order['id'];
                }
                if ($order['status'] == 2) {
                    $ite2[$key] = $order['id'];
                }
                if ($order['status'] == 3) {
                    $ite3[$key] = $order['id'];
                }
                if ($order['status'] == 4) {
                    $ite4[$key] = $order['id'];
                }
                $address = pdo_fetch("SELECT * FROM" . tablename('tg_address') . "where id={$order['addressid']}");
                $orders[$key]['cname'] = $address['cname'];
                $orders[$key]['tel'] = $address['tel'];
                $orders[$key]['province'] = $address['province'];
                $orders[$key]['city'] = $address['city'];
                $orders[$key]['county'] = $address['county'];
                $orders[$key]['detailed_address'] = $address['detailed_address'];
                $goods = pdo_fetch("select * from" . tablename('tg_goods') . "where id={$order['g_id']}");
                $orders[$key]['freight'] = $goods['freight'];
            }
            $num = count($orders);
            $goodsid = array();
            foreach ($orders as $key => $value) {
                $goodsid['id'] = $value['g_id'];
            }
            $goods2 = pdo_fetch("SELECT * FROM " . tablename('tg_goods') . " WHERE id = {$goodsid['id']}");
            if (empty($orders)) {
                message("抱歉,该团购不存在!", referer(), "error");
            }
            $goods2['itemnum0'] = count($ite0);
            $goods2['itemnum1'] = count($ite1);
            $goods2['itemnum2'] = count($ite2);
            $goods2['itemnum3'] = count($ite3);
            $goods2['itemnum4'] = count($ite4);
            $goods2['tsucc'] = count($ite1) + count($ite2) + count($ite3);
            foreach ($orders as $key => $value) {
                $it['status'] = $value['status'];
            }
            //是否过期
            $sql2 = "SELECT * FROM" . tablename('tg_order') . "where tuan_id=:tuan_id and tuan_first = :tuan_first";
            $params2 = array(':tuan_id' => $tuan_id, ':tuan_first' => 1);
            $tuan_first_order = pdo_fetch($sql2, $params2);
            $hours = $tuan_first_order['endtime'];
            $time = time();
            $date = date('Y-m-d H:i:s', $tuan_first_order['createtime']);
            //团长开团时间
            $endtime = date('Y-m-d H:i:s', strtotime(" {$date} + {$hours} hour"));
            $date1 = date('Y-m-d H:i:s', $time);
            /*当前时间*/
            $lasttime2 = strtotime($endtime) - strtotime($date1);
            //剩余时间(秒数)
            //确认发货
            if (checksubmit('confirmsend')) {
                pdo_update('tg_order', array('status' => 2), array('tuan_id' => $tuan_id));
                message('发货操作成功!', referer(), 'success');
            }
            //取消发货
            if (checksubmit('cancelsend')) {
                pdo_update('tg_order', array('status' => 1), array('tuan_id' => $tuan_id));
                message('取消发货操作成功!', referer(), 'success');
            }
            //确认完成订单
            if (checksubmit('finish')) {
                pdo_update('tg_order', array('status' => 3), array('tuan_id' => $tuan_id));
                message('订单操作成功!', referer(), 'success');
            }
            //取消完成订单(状态为已支付)
            if (checksubmit('cancel')) {
                pdo_update('tg_order', array('status' => 1), array('tuan_id' => $tuan_id));
                message('取消完成订单操作成功!', referer(), 'success');
            }
            //取消支付
            if (checksubmit('cancelpay')) {
                pdo_update('tg_order', array('status' => 0), array('tuan_id' => $tuan_id));
                message('取消团订单付款操作成功!', referer(), 'success');
            }
            //确认支付
            if (checksubmit('confrimpay')) {
                pdo_update('tg_order', array('status' => 1, 'pay_type' => 2), array('tuan_id' => $tuan_id));
                message('团订单付款操作成功!', referer(), 'success');
            }
        } elseif ($operation == 'output') {
            $status = $_GPC['status'];
            $istuan = $_GPC['istuan'];
            $condition = " uniacid={$weid}";
            if ($status != '') {
                $condition .= " AND status = '" . intval($status) . "'";
            }
            if ($istuan != '') {
                $condition .= " AND is_tuan = '" . intval($istuan) . "'";
            }
            $orders = pdo_fetchall("select * from" . tablename('tg_order') . "where {$condition}");
            error_reporting(E_ALL);
            date_default_timezone_set('Asia/Shanghai');
            include_once 'PHPExcel.php';
            $objPHPExcel = new PHPExcel();
            $objPHPExcel->getProperties()->setCreator('http://www.phpernote.com')->setLastModifiedBy('http://www.phpernote.com')->setTitle('Office 2007 XLSX Document')->setSubject('Office 2007 XLSX Document')->setDescription('Document for Office 2007 XLSX, generated using PHP classes.')->setKeywords('office 2007 openxml php')->setCategory('Result file');
            if ($istuan != '') {
                $sql = "select DISTINCT tuan_id from" . tablename('tg_order') . "where {$condition} order by createtime desc";
                $tuan_id = pdo_fetchall($sql);
                foreach ($tuan_id as $key => $tuan) {
                    $alltuan = pdo_fetchall("select * from" . tablename('tg_order') . "where tuan_id={$tuan['tuan_id']}");
                    $ite1 = array();
                    $ite2 = array();
                    $ite3 = array();
                    $ite4 = array();
                    $ite0 = array();
                    foreach ($alltuan as $num => $all) {
                        if ($all['status'] == 0) {
                            $ite0[$num] = $all['id'];
                        }
                        if ($all['status'] == 1) {
                            $ite1[$num] = $all['id'];
                        }
                        if ($all['status'] == 2) {
                            $ite2[$num] = $all['id'];
                        }
                        if ($all['status'] == 3) {
                            $ite3[$num] = $all['id'];
                        }
                        if ($all['status'] == 4) {
                            $ite4[$num] = $all['id'];
                        }
                        $goods = pdo_fetch("select * from" . tablename('tg_goods') . "where id = {$all['g_id']}");
                    }
                    $tuan_id[$key]['itemnum0'] = count($ite0);
                    $tuan_id[$key]['itemnum1'] = count($ite1);
                    $tuan_id[$key]['itemnum2'] = count($ite2);
                    $tuan_id[$key]['itemnum3'] = count($ite3);
                    $tuan_id[$key]['itemnum4'] = count($ite4);
                    $tuan_id[$key]['tsucc'] = count($ite1) + count($ite2) + count($ite3);
                    $tuan_id[$key]['groupnum'] = $goods['groupnum'];
                    $tuan_first_order = pdo_fetch("SELECT * FROM" . tablename('tg_order') . "where tuan_id={$tuan['tuan_id']} and tuan_first = 1");
                    $hours = $tuan_first_order['endtime'];
                    $time = time();
                    $date = date('Y-m-d H:i:s', $tuan_first_order['createtime']);
                    //团长开团时间
                    $endtime = date('Y-m-d H:i:s', strtotime(" {$date} + {$hours} hour"));
                    $date1 = date('Y-m-d H:i:s', $time);
                    /*当前时间*/
                    $lasttime = strtotime($endtime) - strtotime($date1);
                    //剩余时间(秒数)
                    $tuan_id[$key]['lasttime'] = $lasttime;
                }
                $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', '团编号')->setCellValue('B1', '团状态')->setCellValue('C1', '团购商品')->setCellValue('D1', '团购价格');
                $i = 2;
                foreach ($tuan_id as $k => $item) {
                    if ($item['lasttime'] > 0) {
                        if ($item['tsucc'] == $item['groupnum']) {
                            $content = "组团成功(共需" . $item['groupnum'] . "人)【待发货" . $item['itemnum1'] . "人,已发货" . $item['itemnum2'] . "人】";
                        }
                        if ($item['tsucc'] < $item['groupnum']) {
                            $content = "组团中(共需" . $item['groupnum'] . "人)【已付款" . $item['itemnum1'] . "人,还差" . $item['groupnum'] - $item['tsucc'] . "人】";
                        }
                    } else {
                        if ($item['tsucc'] == $item['groupnum']) {
                            $content = "组团成功(共需" . $item['groupnum'] . "人)【待发货" . $item['itemnum1'] . "人,已发货" . $item['itemnum2'] . "人】";
                        } else {
                            $content = "团购失败,团购已过期(共需" . $item['groupnum'] . "人)【待退款" . $item['itemnum1'] . "人,已退款" . $item['itemnum4'] . "人】";
                        }
                    }
                    $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $i, $item['tuan_id'])->setCellValue('B' . $i, $content)->setCellValue('C' . $i, $goods['gname'])->setCellValue('D' . $i, $goods['gprice']);
                    $i++;
                }
                $filename = urlencode('团订单信息统计表') . '_' . date('Y-m-dHis');
            } else {
                $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', '订单编号')->setCellValue('B1', '姓名')->setCellValue('C1', '电话')->setCellValue('D1', '总价(元)')->setCellValue('E1', '状态')->setCellValue('F1', '下单时间')->setCellValue('G1', '商品名称')->setCellValue('H1', '收货地址');
                $i = 2;
                foreach ($orders as $k => $v) {
                    $user = pdo_fetch("select * from" . tablename('tg_address') . "where id={$v['addressid']}");
                    $address = $user['province'] . $user['city'] . $user['county'] . $user['detailed_address'];
                    $goods = pdo_fetch("select * from" . tablename('tg_goods') . "where id = {$v['g_id']}");
                    if ($user) {
                        $name = $user['cname'];
                        $tel = $user['tel'];
                    } else {
                        $name = '';
                        $tel = '';
                    }
                    if ($v['status'] == 0) {
                        $status = '待付款';
                        $filename = urlencode('待付款订单信息统计表') . '_' . date('Y-m-dHis');
                    }
                    if ($v['status'] == 1) {
                        $status = '待发货';
                        $filename = urlencode('待发货订单信息统计表') . '_' . date('Y-m-dHis');
                    }
                    if ($v['status'] == 2) {
                        $status = '已发货';
                        $filename = urlencode('已发货订单信息统计表') . '_' . date('Y-m-dHis');
                    }
                    if ($v['status'] == 3) {
                        $status = '已完成';
                        $filename = urlencode('已完成订单信息统计表') . '_' . date('Y-m-dHis');
                    }
                    if ($v['status'] == 9) {
                        $status = '已取消';
                        $filename = urlencode('已取消订单信息统计表') . '_' . date('Y-m-dHis');
                    }
                    $time = date('Y-m-d h:i:s', $v['createtime']);
                    $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $i, $v['orderno'])->setCellValue('B' . $i, $name)->setCellValue('C' . $i, $tel)->setCellValue('D' . $i, $v['price'])->setCellValue('E' . $i, $status)->setCellValue('F' . $i, $time)->setCellValue('G' . $i, $goods['gname'])->setCellValue('H' . $i, $address);
                    $i++;
                }
            }
            $objPHPExcel->getActiveSheet()->setTitle('拼团订单');
            $objPHPExcel->setActiveSheetIndex(0);
            //$filename=urlencode('订单信息统计表').'_'.date('Y-m-dHis');
            //生成xls文件
            header('Content-Type: application/vnd.ms-excel');
            header('Content-Disposition: attachment;filename="' . $filename . '.xls"');
            header('Cache-Control: max-age=0');
            $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
            $objWriter->save('php://output');
            exit;
        } elseif ($operation == 'refundall') {
            include_once '../addons/feng_fightgroups/WxPay.Api.php';
            $WxPayApi = new WxPayApi();
            $input = new WxPayRefund();
            load()->func('communication');
            load()->model('account');
            $accounts = uni_accounts();
            $allorders = pdo_fetchall("select * from" . tablename('tg_order') . "where uniacid={$_W['uniacid']} and status = 1");
            $now = time();
            $num = 0;
            foreach ($allorders as $ke => $value) {
                $endtime = $value['endtime'];
                if ($now - $value['starttime'] > $endtime * 3600 && $value['transid'] != '') {
                    $num++;
                    $fee = $value['price'] * 100;
                    $refundid = $value['transid'];
                    $acid = $_W['uniacid'];
                    $path_cert = IA_ROOT . '/addons/feng_fightgroups/cert/' . $_W['uniacid'] . '/apiclient_cert.pem';
                    //证书路径
                    $path_key = IA_ROOT . '/addons/feng_fightgroups/cert/' . $_W['uniacid'] . '/apiclient_key.pem';
                    //证书路径
                    $key = $this->module['config']['apikey'];
                    //商户支付秘钥(API秘钥)
                    $appid = $accounts[$acid]['key'];
                    //身份标识(appid)
                    $mchid = $this->module['config']['mchid'];
                    //微信支付商户号(mchid)
                    /*$input:退款必须要的参数*/
                    $input->SetAppid($appid);
                    $input->SetMch_id($mchid);
                    $input->SetOp_user_id($mchid);
                    $input->SetOut_refund_no($mchid . date("YmdHis"));
                    $input->SetRefund_fee($fee);
                    $input->SetTotal_fee($fee);
                    $input->SetTransaction_id($refundid);
                    $result = $WxPayApi->refund($input, 6, $path_cert, $path_key, $key);
                    if ($result['return_code'] == 'SUCCESS') {
                        pdo_update('tg_order', array('status' => 4), array('id' => $value['id']));
                        pdo_query("update" . tablename('tg_goods') . " set gnum=gnum+1 where id = '{$value['g_id']}'");
                    }
                }
            }
            if ($num == 0) {
                message('未找到已付款且团购过期的微信订单。', referer(), 'fail');
            } else {
                message('一键退款成功!', referer(), 'success');
            }
        }
        include $this->template('order');
    }
예제 #16
0
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $notawardtext = explode("\n", $_GPC['notawardtext']);
     $insert = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'ticket_information' => $_GPC['ticket_information'], 'description' => $_GPC['description'], 'start_picurl' => $_GPC['start_picurl'], 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'end_picurl' => $_GPC['end_picurl'], 'adpic' => $_GPC['adpic'], 'adpicurl' => $_GPC['adpicurl'], 'award_times' => $_GPC['award_times'], 'awardnum' => $_GPC['awardnum'], 'show_num' => $_GPC['show_num'], 'createtime' => time(), 'share_acid' => $_GPC['share_acid'], 'copyright' => $_GPC['copyright'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'xuninumtime' => $_GPC['xuninumtime'], 'xuninuminitial' => $_GPC['xuninuminitial'], 'xuninumending' => $_GPC['xuninumending'], 'xuninum' => $_GPC['xuninum'], 'ticketinfo' => $_GPC['ticketinfo'], 'isrealname' => $_GPC['isrealname'], 'ismobile' => $_GPC['ismobile'], 'isqq' => $_GPC['isqq'], 'isemail' => $_GPC['isemail'], 'isaddress' => $_GPC['isaddress'], 'isgender' => $_GPC['isgender'], 'istelephone' => $_GPC['istelephone'], 'isidcard' => $_GPC['isidcard'], 'iscompany' => $_GPC['iscompany'], 'isoccupation' => $_GPC['isoccupation'], 'isposition' => $_GPC['isposition'], 'isfans' => $_GPC['isfans'], 'isfansname' => $_GPC['isfansname'], 'award_info' => $_GPC['award_info'], 'homepictime' => $_GPC['homepictime'], 'homepic' => $_GPC['homepic'], 'opportunity' => $_GPC['opportunity'], 'opportunity_txt' => $_GPC['opportunity_txt'], 'credit_times' => $_GPC['credit_times'], 'credit_type' => $_GPC['credit_type'], 'envelope' => $_GPC['envelope'], 'cardbg' => $_GPC['cardbg'], 'inpointstart' => $_GPC['inpointstart'], 'inpointend' => $_GPC['inpointend'], 'randompointstart' => $_GPC['randompointstart'], 'randompointend' => $_GPC['randompointend'], 'addp' => $_GPC['addp'], 'limittype' => $_GPC['limittype'], 'totallimit' => $_GPC['totallimit'], 'tixianlimit' => $_GPC['tixianlimit'], 'incomelimit' => $_GPC['incomelimit'], 'countlimit' => $_GPC['countlimit'], 'sharetip' => $_GPC['sharetip'], 'fanpaitip' => $_GPC['fanpaitip'], 'awardtip' => $_GPC['awardtip'], 'sharebtn' => $_GPC['sharebtn'], 'fsharebtn' => $_GPC['fsharebtn'], 'bgcolor' => $_GPC['bgcolor'], 'fontcolor' => $_GPC['fontcolor'], 'btncolor' => $_GPC['btncolor'], 'btnfontcolor' => $_GPC['btnfontcolor'], 'txcolor' => $_GPC['txcolor'], 'txfontcolor' => $_GPC['txfontcolor'], 'rulebgcolor' => $_GPC['rulebgcolor']);
     load()->func('communication');
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['isshow'] = 1;
         } else {
             $insert['isshow'] = 0;
         }
         pdo_insert('stonefish_redenvelope_reply', $insert);
         $id = pdo_insertid();
     } else {
         pdo_update('stonefish_redenvelope_reply', $insert, array('id' => $id));
     }
     //查询规则
     //查询子公众号信息必保存分享设置
     $acid_arr = uni_accounts();
     $ids = array();
     $ids = array_map('array_shift', $acid_arr);
     //子公众账号Arr数组
     foreach ($ids as $acid => $idlists) {
         $insertshare = array('rid' => $rid, 'acid' => $acid, 'uniacid' => $_W['uniacid'], 'share_title' => $_GPC['share_title_' . $acid], 'share_desc' => $_GPC['share_desc_' . $acid], 'share_url' => $_GPC['share_url_' . $acid], 'share_imgurl' => $_GPC['share_imgurl_' . $acid], 'share_picurl' => $_GPC['share_picurl_' . $acid], 'share_pic' => $_GPC['share_pic_' . $acid], 'share_txt' => $_GPC['share_txt_' . $acid], 'share_confirm' => $_GPC['share_confirm_' . $acid], 'share_fail' => $_GPC['share_fail_' . $acid], 'share_cancel' => $_GPC['share_cancel_' . $acid]);
         if (empty($_GPC['acid_' . $acid])) {
             pdo_insert('stonefish_redenvelope_share', $insertshare);
         } else {
             pdo_update('stonefish_redenvelope_share', $insertshare, array('id' => $_GPC['acid_' . $acid]));
         }
     }
     //查询子公众号信息必保存分享设置
     //奖品配置
     if (!empty($_GPC['prizename']) && $_GPC['envelope'] == 0) {
         foreach ($_GPC['prizename'] as $index => $prizename) {
             if (empty($prizename)) {
                 continue;
             }
             $insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'prizetype' => $_GPC['prizetype'][$index], 'prizename' => $_GPC['prizename'][$index], 'prizetotal' => $_GPC['prizetotal'][$index], 'point' => $_GPC['point'][$index], 'prizepic' => $_GPC['prizepic'][$index]);
             $updata['total_num'] += $_GPC['prizetotal'][$index];
             pdo_update('stonefish_redenvelope_prize', $insertprize, array('id' => $index));
         }
     }
     if (!empty($_GPC['prizename_new']) && count($_GPC['prizename_new']) > 1 && $_GPC['envelope'] == 0) {
         foreach ($_GPC['prizename_new'] as $index => $credit_type) {
             if (empty($credit_type) || $index == 0) {
                 continue;
             }
             $insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'prizetype' => $_GPC['prizetype_new'][$index], 'prizename' => $_GPC['prizename_new'][$index], 'prizetotal' => $_GPC['prizetotal_new'][$index], 'point' => $_GPC['point_new'][$index], 'prizepic' => $_GPC['prizepic_new'][$index]);
             $updata['total_num'] += $_GPC['prizetotal_new'][$index];
             pdo_insert('stonefish_redenvelope_prize', $insertprize);
         }
         if (empty($insertprize['prizetype'])) {
             message('请添加奖品类型');
         }
         if (empty($insertprize['prizename'])) {
             message('请添加奖品名称');
         }
         if (empty($insertprize['prizetotal'])) {
             message('请添加奖品数量');
         }
         if (empty($insertprize['point'])) {
             message('请添加奖品价钱');
         }
         pdo_update('stonefish_redenvelope_reply', $updata, array('id' => $id));
     }
     //奖品配置
     return true;
 }
예제 #17
0
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$_W['page']['title'] = '功能选项 - 公众号选项 - 借用js分享权限';
$where = '';
$params = array();
if (empty($_W['isfounder'])) {
    $where = " WHERE `uniacid` IN (SELECT `uniacid` FROM " . tablename('uni_account_users') . " WHERE `uid`=:uid)";
    $params[':uid'] = $_W['uid'];
}
$sql = "SELECT * FROM " . tablename('uni_account') . $where;
$uniaccounts = pdo_fetchall($sql, $params);
$accounts = array();
if (!empty($uniaccounts)) {
    foreach ($uniaccounts as $uniaccount) {
        $accountlist = uni_accounts($uniaccount['uniacid']);
        if (!empty($accountlist)) {
            foreach ($accountlist as $account) {
                if (!empty($account['key']) && !empty($account['secret']) && in_array($account['level'], array(3, 4))) {
                    $accounts[$account['acid']] = $account['name'];
                }
            }
        }
    }
}
if (checksubmit('submit')) {
    $jsauth_acid = intval($_GPC['jsauth_acid']);
    if ($jsauth_acid == 0) {
    } elseif (!array_key_exists($jsauth_acid, $accounts)) {
        message('指定的公众号不存在或没有权限借用指定的公众号.');
    }
예제 #18
0
<?php

/**
 * [Weizan System] Copyright (c) 2014 012WZ.COM
 * Weizan isNOT a free software, it under the license terms, visited http://www.qdaygroup.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$dos = array('display', 'location_post', 'logo', 'location_list', 'location_view', 'location_del', 'whitelist', 'location_edit', 'export');
$do = in_array($do, $dos) ? $do : 'logo';
$accounts = uni_accounts();
if (!empty($accounts)) {
    foreach ($accounts as $key => $li) {
        if ($li['level'] < 3) {
            unset($accounts[$key]);
        }
    }
}
$acid = intval($_GET['__acid']);
if (empty($acid)) {
    $acid = intval($_GPC['__acid']);
}
if (!$acid || empty($accounts[$acid])) {
    message('公众号不存在', url('wechat/account'), 'error');
} else {
    isetcookie('__acid', $acid, 86400 * 3);
}
if ($do == 'logo') {
    load()->func('tpl');
    $coupon_setting = pdo_fetch('SELECT * FROM ' . tablename('coupon_setting') . ' WHERE uniacid = :aid AND acid = :acid', array(':aid' => $_W['uniacid'], ':acid' => $acid));
    if (checksubmit('submit')) {
        $_GPC['logo'] = trim($_GPC['logo']);
예제 #19
0
파일: tpl.func.php 프로젝트: nsoff/wdlcms
function tpl_form_field_wechat_video($name, $value = '', $options = array())
{
    global $_W;
    $account = uni_accounts();
    $data = array();
    if (!empty($account)) {
        foreach ($account as $li) {
            if ($li['level'] < 3) {
                continue;
            }
            $data['item'][] = $li;
        }
        $data['total'] = count($data['item']);
        unset($account);
    }
    if (empty($options['acid']) && $data['total'] == 1) {
        $options['acid'] = $data['item'][0]['acid'];
    }
    if (empty($data['total'])) {
        $options['error'] = 1;
    }
    if (!empty($value)) {
        $media_data = (array) media2local($value, true);
        $val = $media_data['attachment'];
    }
    if (!is_array($options)) {
        $options = array();
    }
    if (empty($options['tabs'])) {
        $options['tabs'] = array('video' => 'active', 'browser' => '');
    }
    $options = array_elements(array('tabs', 'global', 'dest_dir', 'acid', 'error'), $options);
    $options['direct'] = true;
    $options['multi'] = false;
    $options['type'] = 'video';
    $s = '';
    if (!defined('TPL_INIT_WECHAT_VIDEO')) {
        $s = '
<script type="text/javascript">
	function showWechatVideoDialog(elm, options) {
		require(["util"], function(util){
			var btn = $(elm);
			var ipt = btn.parent().prev();
			var val = ipt.val();
			util.wechat_audio(val, function(url){
				if(url && url.media_id && url.url){
					btn.prev().show();
					ipt.val(url.media_id);
					ipt.attr("media_id",url.media_id);
					ipt.attr("url",url.url);
				}
				if(url && url.media_id){
					ipt.val(url.media_id);
				}
			}, ' . json_encode($options) . ');
		});
	}

</script>';
        echo $s;
        define('TPL_INIT_WECHAT_VIDEO', true);
    }
    $s .= '
	<div class="input-group">
		<input type="text" value="' . $value . '" name="' . $name . '" class="form-control" autocomplete="off" ' . ($options['extras']['text'] ? $options['extras']['text'] : '') . '>
		<span class="input-group-btn">
			<button class="btn btn-default" type="button" onclick="showWechatVideoDialog(this,' . str_replace('"', '\'', json_encode($options)) . ');">选择媒体文件</button>
		</span>
	</div>
	<div class="input-group audio-player">
	</div>';
    if (!empty($media_data) && $media_data['model'] == 'temp' && time() - $media_data['createtime'] > 259200) {
        $s .= '<span class="help-block"><b class="text-danger">该素材已过期 [有效期为3天],请及时更新素材</b></span>';
    }
    return $s;
}
예제 #20
0
 /**
  * 获取微信墙附加字段信息
  * @param int $id
  * @return array
  */
 public function getWall($id)
 {
     $wall = pdo_fetch("SELECT id, acid, isshow, rid, syncwall, logo, background FROM " . tablename('wxwall_reply') . " WHERE rid = :rid LIMIT 1", array(':rid' => $id));
     $wall['syncwall'] = unserialize($wall['syncwall']);
     $wall['rule'] = pdo_fetch("SELECT name, uniacid FROM " . tablename('rule') . " WHERE id = :rid LIMIT 1", array(':rid' => $id));
     load()->model('account');
     $accounts = uni_accounts();
     $wall['account'] = $accounts[$wall['acid']];
     $wall['keyword'] = pdo_fetchall("SELECT content FROM " . tablename('rule_keyword') . " WHERE rid = :rid ", array(':rid' => $id));
     return $wall;
 }
예제 #21
0
if (!empty($s_uniacid)) {
    $condition = " AND `uniacid` = :uniacid";
    $pars[':uniacid'] = $s_uniacid;
}
if (empty($_W['isfounder'])) {
    $condition .= " AND `uniacid` IN (SELECT `uniacid` FROM " . tablename('uni_account_users') . " WHERE `uid`=:uid)";
    $pars[':uid'] = $_W['uid'];
}
$tsql = "SELECT COUNT(*) FROM " . tablename('uni_account') . " WHERE 1 = 1{$condition}";
$total = pdo_fetchcolumn($tsql, $pars);
$sql = "SELECT * FROM " . tablename('uni_account') . " WHERE 1 = 1{$condition} ORDER BY `uniacid` DESC LIMIT {$start}, {$psize}";
$pager = pagination($total, $pindex, $psize);
$list = pdo_fetchall($sql, $pars);
if (!empty($list)) {
    foreach ($list as &$account) {
        $account['details'] = uni_accounts($account['uniacid']);
        if ($account['default_acid'] == $_W['account']['acid']) {
            $isconnect = $account['details'][$account['default_acid']]['isconnect'];
        }
        $account['role'] = uni_permission($_W['uid'], $account['uniacid']);
        $account['setmeal'] = uni_setmeal($account['uniacid']);
    }
}
if (!$_W['isfounder']) {
    $stat = user_account_permission();
}
if (!empty($_W['setting']['platform']['authstate'])) {
    load()->classs('weixin.platform');
    $account_platform = new WeiXinPlatform();
    $authurl = $account_platform->getAuthLoginUrl();
}
예제 #22
0
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $notawardtext = explode("\n", $_GPC['notawardtext']);
     $insert = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'ticket_information' => $_GPC['ticket_information'], 'description' => $_GPC['description'], 'repeat_lottery_reply' => $_GPC['repeat_lottery_reply'], 'start_picurl' => $_GPC['start_picurl'], 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'end_picurl' => $_GPC['end_picurl'], 'notaward' => $_GPC['notaward'], 'notawardtext' => iserializer($notawardtext), 'notawardpic' => $_GPC['notawardpic'], 'adpic' => $_GPC['adpic'], 'adpicurl' => $_GPC['adpicurl'], 'award_times' => $_GPC['award_times'], 'number_times' => $_GPC['number_times'], 'most_num_times' => $_GPC['most_num_times'], "credit_times" => $_GPC['credit_times'], "credittype" => $_GPC['credittype'], "credit_type" => $_GPC['credit_type'], "credit1" => $_GPC['credit1'], "credit2" => $_GPC['credit2'], 'sn_rename' => $_GPC['sn_rename'], 'awardnum' => $_GPC['awardnum'], 'show_num' => $_GPC['show_num'], 'createtime' => time(), 'share_acid' => $_GPC['share_acid'], 'copyright' => $_GPC['copyright'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'xuninumtime' => $_GPC['xuninumtime'], 'xuninuminitial' => $_GPC['xuninuminitial'], 'xuninumending' => $_GPC['xuninumending'], 'xuninum' => $_GPC['xuninum'], 'ticketinfo' => $_GPC['ticketinfo'], 'isrealname' => $_GPC['isrealname'], 'ismobile' => $_GPC['ismobile'], 'isqq' => $_GPC['isqq'], 'isemail' => $_GPC['isemail'], 'isaddress' => $_GPC['isaddress'], 'isgender' => $_GPC['isgender'], 'istelephone' => $_GPC['istelephone'], 'isidcard' => $_GPC['isidcard'], 'iscompany' => $_GPC['iscompany'], 'isoccupation' => $_GPC['isoccupation'], 'isposition' => $_GPC['isposition'], 'isfans' => $_GPC['isfans'], 'isfansname' => $_GPC['isfansname'], 'award_info' => $_GPC['award_info'], 'homepictime' => $_GPC['homepictime'], 'homepic' => $_GPC['homepic'], 'opportunity' => $_GPC['opportunity'], 'opportunity_txt' => $_GPC['opportunity_txt']);
     load()->func('communication');
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['isshow'] = 1;
         } else {
             $insert['isshow'] = 0;
         }
         pdo_insert('stonefish_scratch_reply', $insert);
         $id = pdo_insertid();
     } else {
         pdo_update('stonefish_scratch_reply', $insert, array('id' => $id));
     }
     //查询规则
     //查询子公众号信息必保存分享设置
     $acid_arr = uni_accounts();
     $ids = array();
     $ids = array_map('array_shift', $acid_arr);
     //子公众账号Arr数组
     foreach ($ids as $acid => $idlists) {
         $insertshare = array('rid' => $rid, 'acid' => $acid, 'uniacid' => $_W['uniacid'], 'share_title' => $_GPC['share_title_' . $acid], 'share_desc' => $_GPC['share_desc_' . $acid], 'share_url' => $_GPC['share_url_' . $acid], 'share_imgurl' => $_GPC['share_imgurl_' . $acid], 'share_picurl' => $_GPC['share_picurl_' . $acid], 'share_pic' => $_GPC['share_pic_' . $acid], 'share_txt' => $_GPC['share_txt_' . $acid], 'sharenumtype' => $_GPC['sharenumtype_' . $acid], 'sharenum' => $_GPC['sharenum_' . $acid], 'sharetype' => $_GPC['sharetype_' . $acid], 'share_confirm' => $_GPC['share_confirm_' . $acid], 'share_fail' => $_GPC['share_fail_' . $acid], 'share_cancel' => $_GPC['share_cancel_' . $acid]);
         if (empty($_GPC['acid_' . $acid])) {
             pdo_insert('stonefish_scratch_share', $insertshare);
         } else {
             pdo_update('stonefish_scratch_share', $insertshare, array('id' => $_GPC['acid_' . $acid]));
         }
     }
     //查询子公众号信息必保存分享设置
     //奖品配置
     if (!empty($_GPC['prizetype'])) {
         foreach ($_GPC['prizetype'] as $index => $prizetype) {
             if (empty($prizetype)) {
                 continue;
             }
             $insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'prizetype' => $_GPC['prizetype'][$index], 'prizename' => $_GPC['prizename'][$index], 'prizepro' => $_GPC['prizepro'][$index], 'prizetotal' => $_GPC['prizetotal'][$index], 'prizepic' => $_GPC['prizepic'][$index], 'prizetxt' => $_GPC['prizetxt'][$index], 'credit' => $_GPC['credit'][$index], 'credit_type' => $_GPC['prize_type'][$index]);
             $updata['total_num'] += $_GPC['prizetotal'][$index];
             pdo_update('stonefish_scratch_prize', $insertprize, array('id' => $index));
         }
     }
     if (!empty($_GPC['prizetype_new']) && count($_GPC['prizetype_new']) > 1) {
         foreach ($_GPC['prizetype_new'] as $index => $credit_type) {
             if (empty($credit_type) || $index == 0) {
                 continue;
             }
             $insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'prizetype' => $_GPC['prizetype_new'][$index], 'prizename' => $_GPC['prizename_new'][$index], 'prizepro' => $_GPC['prizepro_new'][$index], 'prizetotal' => $_GPC['prizetotal_new'][$index], 'prizepic' => $_GPC['prizepic_new'][$index], 'prizetxt' => $_GPC['prizetxt_new'][$index], 'credit' => $_GPC['credit_new'][$index], 'credit_type' => $_GPC['prize_type_new'][$index]);
             $updata['total_num'] += $_GPC['prizetotal_new'][$index];
             pdo_insert('stonefish_scratch_prize', $insertprize);
         }
     }
     if ($updata['total_num']) {
         pdo_update('stonefish_scratch_reply', $updata, array('id' => $id));
     }
     //奖品配置
     return true;
 }
예제 #23
0
<?php

/**
 * [WEIZAN System] Copyright (c) 2014 wdlcms.com
 * WEIZAN is NOT a free software, it under the license terms, visited http://www.wdlcms.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
error_reporting(0);
global $_W;
load()->func('file');
if ($do == 'select_acid') {
    $account = uni_accounts();
    $data = array();
    if (!empty($account)) {
        foreach ($account as $li) {
            if ($li['level'] < 3) {
                continue;
            }
            $data['item'][] = $li;
        }
        $data['total'] = count($data['item']);
        exit(json_encode($data));
    } else {
        exit('error');
    }
}
$limit = array();
$limit['temp'] = array('image' => array('ext' => array('jpg'), 'size' => 1024 * 1024, 'errmsg' => '临时图片只支持jpg格式,大小不超过为1M'), 'voice' => array('ext' => array('amr', 'mp3'), 'size' => 2048 * 1024, 'errmsg' => '临时语音只支持amr/mp3格式,大小不超过为2M'), 'video' => array('ext' => array('mp4'), 'size' => 10240 * 1024, 'errmsg' => '临时视频只支持mp4格式,大小不超过为10M'), 'thumb' => array('ext' => array('jpg'), 'size' => 64 * 1024, 'errmsg' => '临时缩略图只支持jpg格式,大小不超过为64K'));
$limit['perm'] = array('image' => array('ext' => array('bmp', 'png', 'jpeg', 'jpg', 'gif'), 'size' => 2048 * 1024, 'max' => 5000, 'errmsg' => '永久图片只支持bmp/png/jpeg/jpg/gif格式,大小不超过为2M'), 'voice' => array('ext' => array('amr', 'mp3', 'wma', 'wav', 'amr'), 'size' => 5120 * 1024, 'max' => 1000, 'errmsg' => '永久语音只支持mp3/wma/wav/amr格式,大小不超过为5M,长度不超过60秒'), 'video' => array('ext' => array('rm', 'rmvb', 'wmv', 'avi', 'mpg', 'mpeg', 'mp4'), 'size' => 10240 * 1024 * 2, 'max' => 1000, 'errmsg' => '永久视频只支持rm/rmvb/wmv/avi/mpg/mpeg/mp4格式,大小不超过为20M'), 'thumb' => array('ext' => array('jpg'), 'size' => 64 * 1024, 'max' => 1000, 'errmsg' => '永久缩略图只支持jpg格式,大小不超过为64K'));
$limit['file_upload'] = array('image' => array('ext' => array('jpg'), 'size' => 1024 * 1024, 'max' => -1, 'errmsg' => '图片只支持jpg格式,大小不超过为1M'));
$apis = array();
예제 #24
0
파일: site.php 프로젝트: noikiy/mygit
 public function refund($orderno, $price, $type)
 {
     global $_GPC, $_W;
     include_once '../addons/feng_fightgroups/source/WxPay.Api.php';
     $WxPayApi = new WxPayApi();
     $input = new WxPayRefund();
     load()->model('account');
     load()->func('communication');
     $accounts = uni_accounts();
     $acid = $_W['uniacid'];
     $path_cert = IA_ROOT . '/addons/feng_fightgroups/cert/' . $_W['uniacid'] . '/apiclient_cert.pem';
     //证书路径
     $path_key = IA_ROOT . '/addons/feng_fightgroups/cert/' . $_W['uniacid'] . '/apiclient_key.pem';
     //证书路径
     $key = $this->module['config']['apikey'];
     //商户支付秘钥(API秘钥)
     $account_info = pdo_fetch("select * from" . tablename('account_wechats') . "where uniacid={$_W['uniacid']}");
     //身份标识(appid)
     $appid = $account_info['key'];
     //身份标识(appid)
     $mchid = $this->module['config']['mchid'];
     //微信支付商户号(mchid)
     $refund_ids = pdo_fetch("select * from" . tablename('tg_order') . "where orderno ='{$orderno}'");
     $goods = pdo_fetch("select * from" . tablename('tg_goods') . "where id='{$refund_ids['g_id']}'");
     if (!empty($price)) {
         $fee = $price;
     } else {
         $fee = $refund_ids['price'] * 100;
     }
     //退款金额
     $refundid = $refund_ids['transid'];
     //微信订单号
     /*$input:退款必须要的参数*/
     $input->SetAppid($appid);
     $input->SetMch_id($mchid);
     $input->SetOp_user_id($mchid);
     $input->SetOut_refund_no($refund_ids['orderno']);
     $input->SetRefund_fee($fee);
     $input->SetTotal_fee($refund_ids['price'] * 100);
     $input->SetTransaction_id($refundid);
     $result = $WxPayApi->refund($input, 6, $path_cert, $path_key, $key);
     //写入退款记录
     $data = array('transid' => $refund_ids['transid'], 'refund_id' => $result['refund_id'], 'createtime' => TIMESTAMP, 'status' => 0, 'type' => $type, 'goodsid' => $refund_ids['g_id'], 'orderid' => $refund_ids['id'], 'payfee' => $refund_ids['price'], 'refundfee' => $refund_ids['price'], 'refundername' => $refund_ids['addname'], 'refundermobile' => $refund_ids['mobile'], 'goodsname' => $goods['gname'], 'uniacid' => $_W['uniacid']);
     pdo_insert('tg_refund_record', $data);
     if ($result['return_code'] == 'SUCCESS') {
         if ($type == 3) {
             pdo_update('tg_order', array('status' => 7, 'is_tuan' => 2), array('id' => $refund_ids['id']));
         } else {
             pdo_update('tg_order', array('status' => 7), array('id' => $refund_ids['id']));
         }
         pdo_update('tg_refund_record', array('status' => 1), array('transid' => $refund_ids['transid']));
         /*退款通知*/
         require_once IA_ROOT . '/addons/feng_fightgroups/source/Message.class.php';
         $access_token = WeAccount::token();
         $url1 = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" . $access_token . "";
         $url2 = '';
         $sendmessage = new Message();
         if ($type == 4) {
             $res = $sendmessage->part_refund($refund_ids['openid'], $price * 0.01, $this, $url1, $url2);
         } else {
             $res = $sendmessage->refund($refund_ids['openid'], $refund_ids['price'], $this, $url1, $url2);
         }
         /*退款通知*/
         pdo_query("update" . tablename('tg_goods') . " set gnum=gnum+1 where id = '{$refund_ids['g_id']}'");
         return 'success';
     } else {
         if ($type == 3) {
             pdo_update('tg_order', array('status' => 6, 'is_tuan' => 2), array('id' => $refund_ids['id']));
         } else {
             pdo_update('tg_order', array('status' => 6), array('id' => $refund_ids['id']));
         }
         return 'fail';
     }
 }