示例#1
0
 public function insert()
 {
     $msg = array();
     $path = isset($_POST['path']) ? _encrypt($_POST['path'], 'DECODE') : '';
     $size = isset($_POST['size']) ? _encrypt($_POST['size'], 'DECODE') : 0;
     $type = isset($_POST['type']) ? _encrypt($_POST['type'], 'DECODE') : 'image';
     $type = explode(',', $this->getUPtype($type, true));
     $watermark = $_POST['iswatermark'] == "true" ? "yes" : "no";
     if (!is_dir(G_UPLOAD . $path)) {
         $msg['ok'] = 'no';
         $msg['text'] = $path . "文件夹不存在";
         echo json_encode($msg);
         exit;
     }
     System::load_app_class("admin", G_ADMIN_DIR, "no");
     $admincheck = admin::StaticCheckAdminInfo() ? 1 : 0;
     if (is_array($_FILES['Filedata'])) {
         System::load_sys_class('upload', 'sys', 'no');
         upload::upload_config($type, $size, $path);
         upload::go_upload($_FILES['Filedata'], $watermark);
         if (!upload::$ok) {
             $msg['ok'] = 'no';
             $msg['text'] = upload::$error;
         } else {
             $msg['ok'] = 'yes';
             $msg['text'] = $path . '/' . upload::$filedir . "/" . upload::$filename;
         }
         echo json_encode($msg);
     }
 }
示例#2
0
 public function image()
 {
     $style = $this->segment(4);
     $cun_type = $this->segment(5);
     if ($cun_type == 'cookie' || $cun_type == 'session') {
         $cun_type = $this->segment(5);
     } else {
         $cun_type = 'cookie';
     }
     $style = explode("_", $style);
     $width = isset($style[0]) ? intval($style[0]) : '';
     $height = isset($style[1]) ? intval($style[1]) : '';
     $color = isset($style[2]) ? $style[2] : '';
     $bgcolor = isset($style[3]) ? $style[3] : '';
     $lenght = isset($style[4]) ? intval($style[4]) : '';
     $type = isset($style[5]) ? intval($style[5]) : '';
     $checkcode = System::load_app_class("checkcodeimg");
     $checkcode->config($width, $height, $color, $bgcolor, $lenght, $type);
     if (isset($_GET['dian'])) {
         $checkcode->dian(50, $color);
     }
     if ($cun_type == 'cookie') {
         _setcookie("checkcode", md5($checkcode->code));
     }
     if ($cun_type == 'session') {
         _session_start();
         $_SESSION['checkcode'] = md5($checkcode->code);
     }
     $checkcode->image();
 }
示例#3
0
 private function goods_user_go($uid = null, $gid = null, $num = null)
 {
     System::load_sys_fun('user');
     $good_info = $gid;
     $gid = $good_info['id'];
     $uinfo = $uid;
     $uid = $uinfo['uid'];
     $gtitle = $good_info['title'];
     $utitle = get_user_name($uinfo);
     $paydb = System::load_app_class('pay', 'pay');
     $number = $num;
     $reg = $paydb->pay_user_go_shop($uid, $gid, $number);
     if ($reg) {
         $specify = $this->db->GetOne("select * from `@#_goodspecify` where `gid` = '{$gid}' and `uid` = '{$uid}'");
         if ($specify) {
             $number = $specify['num'] + $number;
             $this->db->Query("UPDATE `@#_goodspecify` SET `num` = '{$number}' where `id` = '{$specify['id']}'");
         } else {
             $inster = $this->db->Query("INSERT INTO `@#_goodspecify` (`uid`,`gid`,`num`,`utitle`,`gtitle`) VALUES ('{$uid}','{$gid}','{$number}','{$utitle}','{$gtitle}')");
             if (!$inster) {
                 _message("商品购买成功但准备会员插入失败!");
             }
         }
     }
     return $reg;
 }
示例#4
0
 private function get_user_go_code()
 {
     if (file_exists(G_SYSTEM . 'modules/goodspecify/lib/' . 'itocode.class.php')) {
         $itocode = System::load_app_class("itocode", "goodspecify");
         $itocode->go_itocode($this->shop, $this->go_code, $this->go_content, $this->count_time);
     }
     $this->get_code_user_html();
 }
示例#5
0
function pay_insert_shop($shop = '', $type = '')
{
    $time = sprintf("%.3f", microtime(true) + (int) System::load_sys_config('system', 'goods_end_time'));
    $db = System::load_sys_class("model");
    if ($shop['xsjx_time'] != '0') {
        return $db->Query("UPDATE `@#_shoplist` SET `canyurenshu`=`zongrenshu`,\t`shenyurenshu` = '0' where `id` = '{$shop['id']}'");
    }
    $tocode = System::load_app_class("tocode", "pay");
    $tocode->shop = $shop;
    $tocode->run_tocode($time, 100, $shop['canyurenshu'], $shop);
    $code = $tocode->go_code;
    $content = $tocode->go_content;
    $counttime = $tocode->count_time;
    $u_go_info = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}' and `goucode` LIKE  '%{$code}%'");
    $u_info = $db->GetOne("select * from `@#_member` where `uid` = '{$u_go_info['uid']}'");
    $q_user = serialize($u_info);
    //更新商品
    $query = true;
    if ($u_info) {
        $gtimes = (int) System::load_sys_config('system', 'goods_end_time');
        if ($gtimes == 0 || $gtimes == 1) {
            $q_showtime = 'N';
        } else {
            $q_showtime = 'Y';
        }
        $q = $db->Query("UPDATE `@#_shoplist` SET \n\t\t\t\t\t\t\t`canyurenshu`=`zongrenshu`,\n\t\t\t\t\t\t\t`shenyurenshu` = '0',\n\t\t\t\t\t\t\t`q_uid` = '{$u_info['uid']}',\n\t\t\t\t\t\t\t`q_user` = '{$q_user}',\n\t\t\t\t\t\t\t`q_user_code` = '{$code}',\n\t\t\t\t\t\t\t`q_content`\t= '{$content}',\n\t\t\t\t\t\t\t`q_counttime` ='{$counttime}',\n\t\t\t\t\t\t\t`q_end_time` = '{$time}',\n\t\t\t\t\t\t\t`q_showtime` = '{$q_showtime}'\n\t\t\t\t\t\t\t where `id` = '{$shop['id']}'");
        if (!$q) {
            $query = false;
        }
        $q = $db->Query("UPDATE `@#_member_go_record` SET `huode` = '{$code}' where `id` = '{$u_go_info['id']}' and `code` = '{$u_go_info['code']}' and `uid` = '{$u_go_info['uid']}' and `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}'");
        if (!$q) {
            $query = false;
        }
        $post_arr = array("uid" => $u_info['uid'], "gid" => $shop['id'], "send" => 1);
        _g_triggerRequest(WEB_PATH . '/api/send/send_shop_code', false, $post_arr);
    }
    /******************************/
    //新建
    if ($shop['qishu'] < $shop['maxqishu']) {
        $time = time();
        System::load_app_fun("content", G_ADMIN_DIR);
        $goods = $shop;
        $qishu = $goods['qishu'] + 1;
        $shenyurenshu = $goods['zongrenshu'] - $goods['def_renshu'];
        $query_table = content_get_codes_table();
        $q = $db->Query("INSERT INTO `@#_shoplist` (`sid`,`cateid`, `brandid`, `title`, `title_style`, `title2`, `keywords`, `description`, `money`, `yunjiage`, `zongrenshu`, `canyurenshu`,`shenyurenshu`,`def_renshu`, `qishu`,`maxqishu`,`thumb`, `picarr`, `content`,`codes_table`,`xsjx_time`,`renqi`,`pos`, `time`)\n\t\t\t\tVALUES\n\t\t\t\t('{$goods['sid']}','{$goods['cateid']}','{$goods['brandid']}','{$goods['title']}','{$goods['title_style']}','{$goods['title2']}','{$goods['keywords']}','{$goods['description']}','{$goods['money']}','{$goods['yunjiage']}','{$goods['zongrenshu']}','{$goods['def_renshu']}','{$shenyurenshu}','{$goods['def_renshu']}','{$qishu}','{$goods['maxqishu']}','{$goods['thumb']}','{$goods['picarr']}','{$goods['content']}','{$query_table}','{$goods['xsjx_time']}','{$goods['renqi']}','{$goods['pos']}','{$time}')\n\t\t\t\t");
        if (!$q) {
            return $query;
        }
        $id = $db->insert_id();
        $q = content_get_go_codes($goods['zongrenshu'], 3000, $id);
        if (!$q) {
            return $query;
        }
    }
    return $query;
}
示例#6
0
 public function __construct()
 {
     #                      奖项     说明     红包价格   概率
     $this->prize[] = array('七等奖', '5元红包', 5, array(800, 1000));
     $this->prize[] = array('六等奖', '10元红包', 10, array(180, 1000));
     $this->prize[] = array('五等奖', '20元红包', 20, array(10, 1000));
     $this->prize[] = array('四等奖', '50元红包', 50, array(7, 1000));
     $this->prize[] = array('三等奖', '100元红包', 100, array(2, 1000));
     $this->prize[] = array('二等奖', '150元红包', 150, array(1, 1000));
     $this->prize[] = array('一等奖', '1111元红包', 1111, array(0, 0));
     $this->db = System::load_sys_class("model");
     $this->userinfo = System::load_app_class('base', 'member')->get_user_info();
 }
示例#7
0
function uidcookie($get_name = null)
{
    $member = System::load_app_class("base", "member");
    $member = $member->get_user_info();
    if (!$member) {
        return false;
    }
    if (isset($member[$get_name])) {
        return $member[$get_name];
    } else {
        return null;
    }
}
示例#8
0
 public function __construct()
 {
     #                      奖项     说明     红包价格   概率
     $this->prize[] = array('七等奖', '1元红包', 1, array(800, 1000));
     $this->prize[] = array('六等奖', '2元红包', 2, array(180, 1000));
     $this->prize[] = array('五等奖', '3元红包', 3, array(10, 1000));
     $this->prize[] = array('四等奖', '4元红包', 4, array(7, 1000));
     $this->prize[] = array('三等奖', '6元红包', 6, array(2, 1000));
     $this->prize[] = array('二等奖', '8元红包', 8, array(1, 1000));
     $this->prize[] = array('一等奖', '10元红包', 10, array(0, 0));
     $this->db = System::load_sys_class("model");
     $this->userinfo = System::load_app_class('base', 'member')->get_user_info();
 }
示例#9
0
 private function ekepay_chuli()
 {
     $pay_type = $this->db->GetOne("SELECT * from `@#_pay` where `pay_class` = 'ekepay' and `pay_start` = '1'");
     $out_trade_no = $this->out_trade_no;
     $this->db->Autocommit_start();
     $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' for update");
     if (!$dingdaninfo) {
         return false;
     }
     //没有该订单,失败
     if ($dingdaninfo['status'] == '已付款') {
         return '已付款';
     }
     $c_money = intval($dingdaninfo['money']);
     $uid = $dingdaninfo['uid'];
     $time = time();
     $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '点卡支付', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'");
     $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$c_money} where (`uid` = '{$uid}')");
     $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$uid}', '1', '账户', '充值', '{$c_money}', '{$time}')");
     if ($up_q1 && $up_q2 && $up_q3) {
         $this->db->Autocommit_commit();
     } else {
         $this->db->Autocommit_rollback();
         return '充值失败';
     }
     if (empty($dingdaninfo['scookies'])) {
         return "充值完成";
         //充值完成
     }
     $scookies = unserialize($dingdaninfo['scookies']);
     $pay = System::load_app_class('pay', 'pay');
     $pay->scookie = $scookies;
     $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record');
     //闪购商品
     if ($ok != 'ok') {
         $_COOKIE['Cartlist'] = '';
         _setcookie('Cartlist', NULL);
         return '商品购买失败';
         //商品购买失败
     }
     $check = $pay->go_pay(1);
     if ($check) {
         $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'");
         $_COOKIE['Cartlist'] = '';
         _setcookie('Cartlist', NULL);
         return "商品购买成功";
     } else {
         return '商品购买失败';
     }
 }
示例#10
0
 public function image()
 {
     $style = $this->segment(4);
     $style = explode("_", $style);
     $width = isset($style[0]) ? intval($style[0]) : '';
     $height = isset($style[1]) ? intval($style[1]) : '';
     $color = isset($style[2]) ? $style[2] : '';
     $bgcolor = isset($style[3]) ? $style[3] : '';
     $lenght = isset($style[4]) ? intval($style[4]) : '';
     $type = isset($style[5]) ? intval($style[5]) : '';
     $checkcode = System::load_app_class("checkcodeimg");
     $checkcode->config($width, $height, $color, $bgcolor, $lenght, $type);
     if (isset($_GET['dian'])) {
         $checkcode->dian(50, $color);
     }
     _setcookie("checkcode", md5($checkcode->code));
     $checkcode->image();
 }
示例#11
0
<?php

defined('G_IN_SYSTEM') or exit('No permission resources.');
System::load_app_class('base', null, 'no');
System::load_app_fun('user', 'go');
System::load_app_fun('my', 'go');
class finduser extends SystemAction
{
    public function __construct()
    {
    }
    //找回密码
    public function findpassword()
    {
        if (isset($_POST['submit'])) {
            $name = isset($_POST['name']) ? $_POST['name'] : "";
            $txtRegSN = strtoupper($_POST['txtRegSN']);
            if (md5($txtRegSN) != _getcookie('checkcode')) {
                _message("验证码错误");
            }
            $regtype = null;
            if (_checkmobile($name)) {
                $regtype = 'mobile';
            }
            if (_checkemail($name)) {
                $regtype = 'email';
            }
            if ($regtype == null) {
                _message("帐号类型不正确!", null, 3);
            }
            $info = $this->DB()->GetOne("SELECT * FROM `@#_member` WHERE {$regtype} = '{$name}' LIMIT 1");
示例#12
0
<?php

defined('G_IN_SYSTEM') or exit('no');
System::load_app_class('admin', '', 'no');
class brand extends admin
{
    private $db;
    public function __construct()
    {
        parent::__construct();
        $this->db = System::load_sys_class("model");
        $this->ment = array(array("lists", "品牌管理", ROUTE_M . '/' . ROUTE_C . "/lists"), array("insert", "添加品牌", ROUTE_M . '/' . ROUTE_C . "/insert"));
    }
    //品牌管理
    public function lists()
    {
        $page = System::load_sys_class("page");
        $num = 20;
        $total = $this->db->GetCount("select * from `@#_brand` where 1");
        if (isset($_GET['p'])) {
            $pagenum = intval($_GET['p']);
        } else {
            $pagenum = 1;
        }
        $page->config($total, $num, $pagenum);
        $brands = $this->db->GetPage("select * from `@#_brand` where 1 order by `order` DESC", array('key' => 'id', 'num' => $num, "page" => $pagenum));
        $categorys = $this->db->GetList("SELECT * FROM `@#_category` WHERE 1 order by `parentid` ASC,`cateid` ASC", array('key' => 'cateid'));
        include $this->tpl(ROUTE_M, 'brand.list');
    }
    //品牌管理入库
    public function insert()
示例#13
0
 public function houtai()
 {
     $pay_type = $this->db->GetOne("SELECT * from `@#_pay` where `pay_class` = 'ecpss' and `pay_start` = '1'");
     $pay_type_key = unserialize($pay_type['pay_key']);
     $MD5key = $pay_type_key['key']['val'];
     //订单号
     $BillNo = $out_trade_no = $_POST["BillNo"];
     //金额
     $Amount = $_POST["Amount"];
     //支付状态
     $Succeed = $_POST["Succeed"];
     //支付结果
     $Result = $_POST["Result"];
     //取得的MD5校验信息
     $MD5info = $_POST["MD5info"];
     //校验源字符串
     $md5src = $BillNo . $Amount . $Succeed . $MD5key;
     //MD5检验结果
     $md5sign = strtoupper(md5($md5src));
     if ($MD5info == $md5sign) {
         if ($Succeed == 88) {
             $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' and `status` = '未付款'");
             if (!$dingdaninfo) {
                 echo "fail";
                 exit;
             }
             //没有该订单,失败
             $c_money = intval($dingdaninfo['money']);
             $uid = $dingdaninfo['uid'];
             $time = time();
             $this->db->Autocommit_start();
             $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '汇潮支付', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'");
             $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$c_money} where (`uid` = '{$uid}')");
             $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$uid}', '1', '账户', '充值', '{$c_money}', '{$time}')");
             if ($up_q1 && $up_q2 && $up_q3) {
                 $this->db->Autocommit_commit();
             } else {
                 $this->db->Autocommit_rollback();
                 echo "fail";
                 exit;
             }
             if (empty($dingdaninfo['scookies'])) {
                 echo "success";
                 exit;
                 //充值完成
             }
             $scookies = unserialize($dingdaninfo['scookies']);
             $pay = System::load_app_class('pay', 'pay');
             $pay->scookie = $scookies;
             $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record');
             //V购商品
             if ($ok != 'ok') {
                 _setcookie('Cartlist', NULL);
                 echo "fail";
                 exit;
                 //商品购买失败
             }
             $check = $pay->go_pay(1);
             if ($check) {
                 $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'");
                 _setcookie('Cartlist', NULL);
                 echo "ok";
                 exit;
             } else {
                 echo "fail";
                 exit;
             }
         }
     } else {
         echo "交易信息被篡改";
     }
 }
示例#14
0
 private function addmoney_record($money = null, $data = null)
 {
     $uid = $this->members['uid'];
     $dingdancode = pay_get_dingdan_code('C');
     //订单号
     if (!is_array($this->pay_type)) {
         return 'not_pay';
     }
     $pay_type = $this->pay_type['pay_name'];
     $time = time();
     if (!empty($data)) {
         $scookies = $data;
     } else {
         $scookies = '0';
     }
     $score = $this->fufen;
     $query = $this->db->Query("INSERT INTO `@#_member_addmoney_record` (`uid`, `code`, `money`, `pay_type`, `status`,`time`,`score`,`scookies`) VALUES ('{$uid}', '{$dingdancode}', '{$money}', '{$pay_type}','未付款', '{$time}','{$score}','{$scookies}')");
     if ($query) {
         $this->db->Autocommit_commit();
     } else {
         $this->db->Autocommit_rollback();
         return false;
     }
     $pay_type = $this->pay_type;
     $paydb = System::load_app_class($pay_type['pay_class'], 'pay');
     $pay_type['pay_key'] = unserialize($pay_type['pay_key']);
     $config = array();
     $config['id'] = $pay_type['pay_key']['id']['val'];
     //支付合作ID
     $config['key'] = $pay_type['pay_key']['key']['val'];
     //支付KEY
     $config['shouname'] = _cfg('web_name');
     //收款方
     $config['title'] = _cfg('web_name');
     //付款项目
     $config['money'] = $money;
     //付款金额$money
     $config['type'] = $pay_type['pay_type'];
     //支付方式:	即时到帐1   中介担保2
     $config['ReturnUrl'] = G_WEB_PATH . '/index.php/pay/' . $pay_type['pay_class'] . '_url/qiantai/';
     //前台回调
     $config['NotifyUrl'] = G_WEB_PATH . '/index.php/pay/' . $pay_type['pay_class'] . '_url/houtai/';
     //后台回调
     $config['pay_bank'] = $this->pay_type['pay_bank'];
     $config['code'] = $dingdancode;
     $config['pay_type_data'] = $pay_type['pay_key'];
     $paydb->config($config);
     $paydb->send_pay();
     return true;
 }
示例#15
0
 public function houtai()
 {
     $pay_type = $this->db->GetOne("SELECT * from `@#_pay` where `pay_class` = 'tenpay' and `pay_start` = '1'");
     $pay_type_key = unserialize($pay_type['pay_key']);
     $key = $pay_type_key['key']['val'];
     //支付KEY
     $partner = $pay_type_key['id']['val'];
     //支付商号ID
     /* 创建支付应答对象 */
     $resHandler = new ResponseHandler();
     $resHandler->setKey($key);
     //判断签名
     if (!$resHandler->isTenpaySign()) {
         echo "认证签名失败";
         exit;
     }
     //通知ID
     $notify_id = $resHandler->getParameter("notify_id");
     //通过通知ID查询,确保通知来至财付通
     //创建查询请求
     $queryReq = new RequestHandler();
     $queryReq->init();
     $queryReq->setKey($key);
     $queryReq->setGateUrl("https://gw.tenpay.com/gateway/simpleverifynotifyid.xml");
     $queryReq->setParameter("partner", $partner);
     $queryReq->setParameter("notify_id", $notify_id);
     //通信对象
     $httpClient = new TenpayHttpClient();
     $httpClient->setTimeOut(5);
     //设置请求内容
     $httpClient->setReqContent($queryReq->getRequestURL());
     //后台调用
     if ($httpClient->call()) {
         //设置结果参数
         $queryRes = new ClientResponseHandler();
         $queryRes->setContent($httpClient->getResContent());
         $queryRes->setKey($key);
     } else {
         echo "通信失败";
         exit;
     }
     //及时到账
     if ($resHandler->getParameter("trade_mode") == "1") {
         //只有签名正确,retcode为0,trade_state为0才是支付成功
         if ($queryRes->isTenpaySign() && $queryRes->getParameter("retcode") == "0" && $resHandler->getParameter("trade_state") == "0") {
             //log_result("即时到帐验签ID成功");
             //取结果参数做业务处理
             $out_trade_no = $resHandler->getParameter("out_trade_no");
             //财付通订单号
             $transaction_id = $resHandler->getParameter("transaction_id");
             //金额,以分为单位
             $total_fee = $resHandler->getParameter("total_fee");
             //如果有使用折扣券,discount有值,total_fee+discount=原请求的total_fee
             $discount = $resHandler->getParameter("discount");
             //------------------------------
             //处理业务开始
             //------------------------------
             //处理数据库逻辑
             //注意交易单不要重复处理
             //注意判断返回金额
             $total_fee_t = $total_fee / 100;
             $this->db->Autocommit_start();
             $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' and `money` = '{$total_fee_t}' and `status` = '未付款' for update");
             if (!$dingdaninfo) {
                 echo "fail";
                 exit;
             }
             $time = time();
             $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '财付通', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'");
             $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$total_fee_t} where (`uid` = '{$dingdaninfo['uid']}')");
             $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$dingdaninfo['uid']}', '1', '账户', '充值', '{$total_fee_t}', '{$time}')");
             if ($up_q1 && $up_q2 && $up_q3) {
                 $this->db->Autocommit_commit();
             } else {
                 $this->db->Autocommit_rollback();
                 echo "fail";
                 exit;
             }
             if (empty($dingdaninfo['scookies'])) {
                 echo "success";
                 exit;
             }
             $uid = $dingdaninfo['uid'];
             $scookies = unserialize($dingdaninfo['scookies']);
             $pay = System::load_app_class('pay', 'pay');
             $pay->scookie = $scookies;
             $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record');
             //闪购商品
             if ($ok != 'ok') {
                 _setcookie('Cartlist', NULL);
                 echo "fail";
                 exit;
                 //商品购买失败
             }
             $check = $pay->go_pay(1);
             if ($check) {
                 $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'");
                 _setcookie('Cartlist', NULL);
                 echo "success";
                 exit;
             } else {
                 echo "fail";
                 exit;
             }
             //------------------------------
             //处理业务完毕
             //------------------------------
             //log_result("即时到帐后台回调成功");
         } else {
             echo "fail";
         }
     } else {
         //通信失败
         //echo "fail";
         //后台调用通信失败,写日志,方便定位问题
         //echo "<br>call err:" . $httpClient->getResponseCode() ."," . $httpClient->getErrInfo() . "<br>";
     }
 }
示例#16
0
<?php

defined('G_IN_SYSTEM') or exit('no');
System::load_app_class('admin', G_ADMIN_DIR, 'no');
class user extends admin
{
    private $db;
    protected $ment;
    public function __construct()
    {
        parent::__construct();
        $this->db = System::load_sys_class("model");
        $this->ment = array(array("lists", "管理员管理", ROUTE_M . '/' . ROUTE_C . "/lists"), array("reg", "添加管理员", ROUTE_M . '/' . ROUTE_C . "/reg"), array("edit", "修改管理员", ROUTE_M . '/' . ROUTE_C . "/reg", 'hide'));
    }
    public function reg()
    {
        function randomkeys($length)
        {
            $pattern = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ';
            for ($i = 0; $i < $length; $i++) {
                $key .= $pattern[mt_rand(0, 35)];
                //生成php随机数
            }
            return $key;
        }
        if (isset($_POST['submit-1'])) {
            $username = safe_replace($_POST['username']);
            if ($username != $_POST['username'] || empty($username)) {
                _message("用户名格式错误!");
            }
            if (_strlen($username) > 15) {
示例#17
0
<?php

defined('G_IN_SYSTEM') or exit('No permission resources.');
System::load_app_class('base', 'member', 'no');
System::load_app_fun('my', 'go');
System::load_app_fun('user', 'go');
System::load_sys_fun("user");
class us extends base
{
    public function __construct()
    {
        $uid = abs(intval($this->segment(4)));
        if (!$uid) {
            _message("参数不正确!");
        }
        if ($uid > 1000000000) {
            $uid = $uid - 1000000000;
        }
        $this->uid = $uid;
    }
    public function uname()
    {
        $mysql_model = System::load_sys_class('model');
        $title = "个人主页";
        $index = $this->uid;
        $tab = $this->segment(3);
        $member = $mysql_model->GetOne("select * from `@#_member` where uid='{$index}'");
        if ($member) {
            $membergo = $mysql_model->GetList("select * from `@#_member_go_record` where uid='{$index}' order by `id` DESC limit 0,10 ");
            include templates("us", "index");
        } else {
示例#18
0
 public function houtai()
 {
     //file_put_contents("alipay.txt",var_export($_POST,true));
     include G_SYSTEM . "modules/pay/lib/alipay/alipay_notify.class.php";
     $pay_type = $this->db->GetOne("SELECT * from `@#_pay` where `pay_class` = 'alipay' and `pay_start` = '1'");
     $pay_type_key = unserialize($pay_type['pay_key']);
     $key = $pay_type_key['key']['val'];
     //支付KEY
     $partner = $pay_type_key['id']['val'];
     //支付商号ID
     $alipay_config_sign_type = strtoupper('MD5');
     //签名方式 不需修改
     $alipay_config_input_charset = strtolower('utf-8');
     //字符编码格式
     $alipay_config_cacert = G_SYSTEM . "modules/pay/lib/alipay/cacert.pem";
     //ca证书路径地址
     $alipay_config_transport = 'http';
     $alipay_config = array("partner" => $partner, "key" => $key, "sign_type" => $alipay_config_sign_type, "input_charset" => $alipay_config_input_charset, "cacert" => $alipay_config_cacert, "transport" => $alipay_config_transport);
     $alipayNotify = new AlipayNotify($alipay_config);
     $verify_result = $alipayNotify->verifyNotify();
     if (!$verify_result) {
         echo "fail";
         exit;
     }
     //验证失败
     $out_trade_no = $_POST['out_trade_no'];
     //商户订单号
     $trade_no = $_POST['trade_no'];
     //支付宝交易号
     $trade_status = $_POST['trade_status'];
     //交易状态
     //开始处理及时到账和担保交易订单
     if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS' || $trade_status == 'WAIT_SELLER_SEND_GOODS') {
         $this->db->Autocommit_start();
         $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' and `status` = '未付款' for update");
         if (!$dingdaninfo) {
             echo "fail";
             exit;
         }
         //没有该订单,失败
         $c_money = intval($dingdaninfo['money']);
         $uid = $dingdaninfo['uid'];
         $time = time();
         $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '支付宝', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'");
         $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$c_money} where (`uid` = '{$uid}')");
         $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$uid}', '1', '账户', '充值', '{$c_money}', '{$time}')");
         if ($up_q1 && $up_q2 && $up_q3) {
             $this->db->Autocommit_commit();
         } else {
             $this->db->Autocommit_rollback();
             echo "fail";
             exit;
         }
         if (empty($dingdaninfo['scookies'])) {
             echo "success";
             exit;
             //充值完成
         }
         $scookies = unserialize($dingdaninfo['scookies']);
         $pay = System::load_app_class('pay', 'pay');
         $pay->scookie = $scookies;
         $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record');
         //闪购商品
         if ($ok != 'ok') {
             _setcookie('Cartlist', NULL);
             echo "fail";
             exit;
             //商品购买失败
         }
         $check = $pay->go_pay(1);
         if ($check) {
             $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'");
             _setcookie('Cartlist', NULL);
             echo "success";
             exit;
         } else {
             echo "fail";
             exit;
         }
     }
     //开始处理订单结束
 }
function pay_insert_shop($shop = '', $type = '')
{
    $time = sprintf("%.3f", microtime(true) + (int) System::load_sys_config('system', 'goods_end_time'));
    $db = System::load_sys_class("model");
    if ($shop['xsjx_time'] != '0') {
        return $db->Query("UPDATE `@#_shoplist` SET `canyurenshu`=`zongrenshu`,\t`shenyurenshu` = '0' where `id` = '{$shop['id']}'");
    }
    $apidata = file_get_contents("http://api.caipiaokong.com/lottery/?name=xjssc&format=json&uid=195161&num=1&token=3a914fc3d237dd40f6ad71b57ef5ac61793af9d4&order=sort");
    $apiarray = json_decode($apidata, true);
    foreach ($apiarray as $key => $value) {
        $apinumberstr = str_replace(",", "", $apiarray[$key]['number']);
    }
    $apinumber = intval($apinumberstr);
    $tocode = System::load_app_class("tocode", "pay");
    $tocode->shop = $shop;
    $tocode->run_tocode($time, 50, $shop['canyurenshu'], $apinumber, $shop);
    $code = $tocode->go_code;
    $content = addslashes($tocode->go_content);
    $counttime = $tocode->count_time;
    //20140901新增,判断是否指定中奖//
    if ($shop['quyu_begin'] && $shop['quyu_end']) {
        $ex_info = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}' and `uid` >'{$shop['quyu_begin']}' and `uid` <'{$shop['quyu_end']}' order by rand() limit 1");
        if ($ex_info['goucode']) {
            $ex_code = explode(",", $ex_info['goucode']);
            $ex_count = count($ex_code);
            $ex_rand = rand(0, $ex_count - 1);
            if (!empty($ex_code[$ex_rand])) {
                $chazhi = $ex_code[$ex_rand] - $code;
                if ($chazhi > 0) {
                    $counttime = $counttime + $chazhi;
                } else {
                    $counttime = $counttime - abs($chazhi);
                }
                $code = $ex_code[$ex_rand];
                /*
                $tempinfo = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '$shop[id]' and `shopqishu` = '$shop[qishu]' and `goucode` LIKE  '%$code%'");
                //本来的中奖码对应的记录
                $str=str_replace($code,$ex_code[0],$tempinfo['goucode']);
                $db->Query("update `@#_member_go_record` set goucode='$str' where id='{$tempinfo['id']}'");
                //将系统原来的中奖吗对应的购买记录换成指定中奖会员购买的code
                $str2=str_replace($ex_code[0],$code,$ex_info['goucode']);
                $db->Query("update `@#_member_go_record` set goucode='$str2' where id='{$ex_info['id']}'");
                //将指定中奖会员的购买记录中的code换成系统计算出来的中奖吗
                */
                //添加时间校准
                if (!empty($chazhi)) {
                    $last_info = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}' order by id desc limit 1");
                    $time_t_str = str_replace('.', '', $last_info['time']);
                    $time_str = bcadd($time_t_str, $chazhi);
                    $time_arr = str_split($time_str, 10);
                    $str_t_time = $time_arr[0] . '.' . $time_arr[1];
                    $db->Query("UPDATE `@#_member_go_record` SET `time`='{$str_t_time}' where `id` = '{$last_info['id']}'");
                    $tocode = System::load_app_class("tocode", "pay");
                    $tocode->shop = $shop;
                    $tocode->run_tocode($time, 100, $shop['canyurenshu'], $shop);
                    $content = addslashes($tocode->go_content);
                }
            }
        }
    }
    /////////////////
    $u_go_info = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}' and `goucode` LIKE  '%{$code}%'");
    $u_info = $db->GetOne("select uid,username,email,mobile,img from `@#_member` where `uid` = '{$u_go_info['uid']}'");
    //更新商品
    $query = true;
    if ($u_info) {
        $u_info['username'] = _htmtocode($u_info['username']);
        $q_user = serialize($u_info);
        $gtimes = (int) System::load_sys_config('system', 'goods_end_time');
        if ($gtimes == 0 || $gtimes == 1) {
            $q_showtime = 'N';
        } else {
            $q_showtime = 'Y';
        }
        $sqlss = "UPDATE `@#_shoplist` SET\n\t\t\t\t\t\t\t`canyurenshu`=`zongrenshu`,\n\t\t\t\t\t\t\t`shenyurenshu` = '0',\n\t\t\t\t\t\t\t`q_uid` = '{$u_info['uid']}',\n\t\t\t\t\t\t\t`q_user` = '{$q_user}',\n\t\t\t\t\t\t\t`q_user_code` = '{$code}',\n\t\t\t\t\t\t\t`q_content`\t= '{$content}',\n\t\t\t\t\t\t\t`q_counttime` ='{$counttime}',\n\t\t\t\t\t\t\t`q_end_time` = '{$time}',\n\t\t\t\t\t\t\t`q_showtime` = '{$q_showtime}'\n\t\t\t\t\t\t\t where `id` = '{$shop['id']}'";
        $q = $db->Query($sqlss);
        if (!$q) {
            $query = false;
        }
        if ($q) {
            $q = $db->Query("UPDATE `@#_member_go_record` SET `huode` = '{$code}' where `id` = '{$u_go_info['id']}' and `code` = '{$u_go_info['code']}' and `uid` = '{$u_go_info['uid']}' and `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}'");
            if (!$q) {
                $query = false;
            } else {
                $post_arr = array("uid" => $u_info['uid'], "gid" => $shop['id'], "send" => 1);
                _g_triggerRequest(WEB_PATH . '/api/send/send_shop_code', false, $post_arr);
            }
        } else {
            $query = false;
        }
    } else {
        $query = false;
    }
    /******************************/
    /*新建*/
    if ($query) {
        if ($shop['qishu'] < $shop['maxqishu']) {
            $maxinfo = $db->GetOne("select * from `@#_shoplist` where `sid` = '{$shop['sid']}' order by `qishu` DESC LIMIT 1");
            if (!$maxinfo) {
                $maxinfo = array("qishu" => $shop['qishu']);
            }
            if (!$maxinfo) {
                $maxinfo = array("qishu" => $shop['qishu']);
                System::load_app_fun("content", G_ADMIN_DIR);
                $intall = content_add_shop_install($maxinfo, false);
                if (!$intall) {
                    return $query;
                }
            } else {
                if ($maxinfo['id'] == $shop['id']) {
                    System::load_app_fun("content", G_ADMIN_DIR);
                    $intall = content_add_shop_install($maxinfo, false);
                    if (!$intall) {
                        return $query;
                    }
                }
            }
        }
    }
    return $query;
}
 public function houtai()
 {
     //导入公钥文件
     $flag = buildKey(PUB_KEY);
     if (!$flag) {
         echo "导入公钥文件失败!";
         exit;
     }
     //获取交易应答的各项值
     $merid = $_REQUEST["merid"];
     $orderno = $_REQUEST["orderno"];
     $transdate = $_REQUEST["transdate"];
     $amount = $_REQUEST["amount"];
     $currencycode = $_REQUEST["currencycode"];
     $transtype = $_REQUEST["transtype"];
     $status = $_REQUEST["status"];
     $checkvalue = $_REQUEST["checkvalue"];
     $gateId = $_REQUEST["GateId"];
     $priv1 = $_REQUEST["Priv1"];
     $flag = verifyTransResponse($merid, $orderno, $amount, $currencycode, $transdate, $transtype, $status, $checkvalue);
     if (!flag) {
         echo "<h2>验证签名失败!</h2>";
         exit;
     }
     // file_put_contents(dirname(__FILE__).DIRECTORY_SEPARATOR.'aa.txt', serialize($status));
     $out_trade_no = $orderno;
     //商户订单号
     if ($status == '1001') {
         $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' and `status` = '未付款'");
         if (!$dingdaninfo) {
             echo "fail";
             exit;
         }
         //没有该订单,失败
         $c_money = intval($dingdaninfo['money']);
         $uid = $dingdaninfo['uid'];
         $time = time();
         $this->db->Autocommit_start();
         $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '支付宝', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'");
         $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$c_money} where (`uid` = '{$uid}')");
         $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$uid}', '1', '账户', '充值', '{$c_money}', '{$time}')");
         if ($up_q1 && $up_q2 && $up_q3) {
             $this->db->Autocommit_commit();
         } else {
             $this->db->Autocommit_rollback();
             echo "fail";
             exit;
         }
         if (empty($dingdaninfo['scookies'])) {
             echo "success";
             exit;
             //充值完成
         }
         $scookies = unserialize($dingdaninfo['scookies']);
         $pay = System::load_app_class('pay', 'pay');
         $pay->scookie = $scookies;
         // var_dump($pay_type['pay_id']);
         // die();
         $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record');
         //云购商品
         if ($ok != 'ok') {
             _setcookie('Cartlist', NULL);
             echo "fail";
             exit;
             //商品购买失败
         }
         $check = $pay->go_pay(1);
         if ($check) {
             $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'");
             _setcookie('Cartlist', NULL);
             echo "success";
             exit;
         } else {
             echo "fail";
             exit;
         }
     }
 }
示例#21
0
<?php

defined('G_IN_SYSTEM') or exit('No permission resources.');
System::load_app_class('memberbase', null, 'no');
System::load_app_fun('user', 'go');
System::load_app_fun('my', 'go');
System::load_sys_fun('send');
class weixin extends memberbase
{
    public function __construct()
    {
        parent::__construct();
        $this->db = System::load_sys_class("model");
    }
    //微信登录
    function wxlogin()
    {
        $user = $this->userinfo;
        $pro = $this->segment(4);
        file_put_contents('t.txt', "\n\r\r\n-----pro:" . $pro, FILE_APPEND);
        $this->db = System::load_sys_class('model');
        $wx_set = $this->db->GetOne("SELECT * from `@#_wxset` ");
        if (!$user) {
            $code = $this->create_code();
            if ($pro) {
                _setcookie("procode", $pro);
                $pu = $this->db->GetOne("select * from `@#_activity_code` where `code`='{$pro}'");
                if (empty($pu)) {
                    $pu = $this->db->GetOne("select * from `@#_member` where `code`='{$pro}'");
                }
            } else {
示例#22
0
 public function houtai()
 {
     $this->db = System::load_sys_class('model');
     include_once dirname(__FILE__) . "/lib/wxpay/WxPayPubHelper.php";
     //引入文件需求
     if (!isset($_POST["out_trade_no"])) {
         $out_trade_no = " ";
     } else {
         $out_trade_no = $_POST["out_trade_no"];
         //使用订单查询接口
         $orderQuery = new OrderQuery_pub();
         //设置必填参数
         //appid已填,商户无需重复填写
         //mch_id已填,商户无需重复填写
         //noncestr已填,商户无需重复填写
         //sign已填,商户无需重复填写
         $orderQuery->setParameter("out_trade_no", "{$out_trade_no}");
         //商户订单号
         $time = time();
         //file_put_contents("111.txt",$out_trade_no."----".$time."\n",FILE_APPEND);
         //非必填参数,商户可根据实际情况选填
         //$orderQuery->setParameter("sub_mch_id","XXXX");//子商户号
         //$orderQuery->setParameter("transaction_id","XXXX");//微信订单号
         //获取订单查询结果
         $orderQueryResult = $orderQuery->getResult();
         //商户根据实际情况设置相应的处理流程,此处仅作举例
         if ($orderQueryResult["return_code"] == "FAIL") {
             echo "通信出错:" . $orderQueryResult['return_msg'] . "<br>";
             //file_put_contents("wxpay_2.txt",$orderQueryResult['return_msg']);
             //file_put_contents("ccc.txt","通信出错:".$orderQueryResult['return_msg']."\n",FILE_APPEND);
         } elseif ($orderQueryResult["result_code"] == "FAIL") {
             //file_put_contents("wxpay_3.txt","qweqwe");
             echo "错误代码:" . $orderQueryResult['err_code'] . "<br>";
             echo "错误代码描述:" . $orderQueryResult['err_code_des'] . "<br>";
             //file_put_contents("ccc.txt","错误代码:".$orderQueryResult['err_code']."\n",FILE_APPEND);
             //file_put_contents("ccc.txt","错误代码描述:".$orderQueryResult['err_code_des']."\n",FILE_APPEND);
         } else {
             file_put_contents("hhyds.txt", "111");
             //file_put_contents("ccc.txt","交易状态:".$orderQueryResult['trade_state']."\n",FILE_APPEND);
             $total_fee_t = $orderQueryResult['total_fee'] / 100;
             $out_trade_no = $orderQueryResult['out_trade_no'];
             $this->db->Autocommit_start();
             $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' and `money` = '{$total_fee_t}' and `status` = '未付款' for update");
             if (!$dingdaninfo) {
                 echo "fail";
                 exit;
             }
             $time = time();
             $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '微信支付', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'");
             $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$total_fee_t} where (`uid` = '{$dingdaninfo['uid']}')");
             $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$dingdaninfo['uid']}', '1', '账户', '充值', '{$total_fee_t}', '{$time}')");
             //file_put_contents("wxpay_2.txt",$up_q3);
             if ($up_q1 && $up_q2 && $up_q3) {
                 //file_put_contents("momo.txt","yes");
                 $this->db->Autocommit_commit();
             } else {
                 //file_put_contents("momo.txt","no");
                 $this->db->Autocommit_rollback();
                 echo "fail";
                 exit;
             }
             if (empty($dingdaninfo['scookies'])) {
                 echo "success";
                 exit;
             }
             $uid = $dingdaninfo['uid'];
             $scookies = unserialize($dingdaninfo['scookies']);
             $pay = System::load_app_class('pay', 'pay');
             $pay->scookie = $scookies;
             $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record');
             //闪购商品
             if ($ok != 'ok') {
                 _setcookie('Cartlist', NULL);
                 echo "fail";
                 exit;
                 //商品购买失败
             }
             $check = $pay->go_pay(1);
             if ($check) {
                 $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'");
                 _setcookie('Cartlist', NULL);
                 echo "success";
                 exit;
             } else {
                 echo "fail";
                 exit;
             }
             //------------------------------
             //处理业务完毕
             //------------------------------
             //log_result("即时到帐后台回调成功");
         }
     }
 }
示例#23
0
 public function qq_set_config()
 {
     System::load_app_class("admin", G_ADMIN_DIR, 'no');
     $objadmin = new admin();
     $config = System::load_app_config("connect");
     if (isset($_POST['dosubmit'])) {
         $qq_off = intval($_POST['type']);
         $qq_id = $_POST['id'];
         $qq_key = $_POST['key'];
         $config['qq'] = array("off" => $qq_off, "id" => $qq_id, "key" => $qq_key);
         $html = var_export($config, true);
         $html = "<?php return " . $html . "; ?>";
         $path = dirname(__FILE__) . '/lib/connect.ini.php';
         if (!is_writable($path)) {
             _message('Please chmod  connect.ini.php  to 0777 !');
         }
         $ok = file_put_contents($path, $html);
         _message("配置更新成功!");
     }
     $config = $config['qq'];
     include $this->tpl(ROUTE_M, 'qq_set_config');
 }
示例#24
0
function pay_insert_shop($shop = '', $type = '')
{
    $time = sprintf("%.3f", microtime(true) + (int) System::load_sys_config('system', 'goods_end_time'));
    $db = System::load_sys_class("model");
    if ($shop['xsjx_time'] != '0') {
        return $db->Query("UPDATE `@#_shoplist` SET `canyurenshu`=`zongrenshu`,\t`shenyurenshu` = '0' where `id` = '{$shop['id']}'");
    }
    $tocode = System::load_app_class("tocode", "pay");
    $tocode->shop = $shop;
    $tocode->run_tocode($time, 100, $shop['canyurenshu'], $shop);
    $code = $tocode->go_code;
    $content = addslashes($tocode->go_content);
    $counttime = $tocode->count_time;
    $u_go_info = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}' and `goucode` LIKE  '%{$code}%'");
    $u_info = $db->GetOne("select uid,username,email,mobile,img from `@#_member` where `uid` = '{$u_go_info['uid']}'");
    //更新商品
    $query = true;
    if ($u_info) {
        $u_info['username'] = _htmtocode($u_info['username']);
        $q_user = serialize($u_info);
        $gtimes = (int) System::load_sys_config('system', 'goods_end_time');
        if ($gtimes == 0 || $gtimes == 1) {
            $q_showtime = 'N';
        } else {
            $q_showtime = 'Y';
        }
        $sqlss = "UPDATE `@#_shoplist` SET \n\t\t\t\t\t\t\t`canyurenshu`=`zongrenshu`,\n\t\t\t\t\t\t\t`shenyurenshu` = '0',\n\t\t\t\t\t\t\t`q_uid` = '{$u_info['uid']}',\n\t\t\t\t\t\t\t`q_user` = '{$q_user}',\n\t\t\t\t\t\t\t`q_user_code` = '{$code}',\n\t\t\t\t\t\t\t`q_content`\t= '{$content}',\n\t\t\t\t\t\t\t`q_counttime` ='{$counttime}',\n\t\t\t\t\t\t\t`q_end_time` = '{$time}',\n\t\t\t\t\t\t\t`q_showtime` = '{$q_showtime}'\n\t\t\t\t\t\t\t where `id` = '{$shop['id']}'";
        $q = $db->Query($sqlss);
        if (!$q) {
            $query = false;
        }
        if ($q) {
            $q = $db->Query("UPDATE `@#_member_go_record` SET `huode` = '{$code}' where `id` = '{$u_go_info['id']}' and `code` = '{$u_go_info['code']}' and `uid` = '{$u_go_info['uid']}' and `shopid` = '{$shop['id']}' and `shopqishu` = '{$shop['qishu']}'");
            if (!$q) {
                $query = false;
            } else {
                $post_arr = array("uid" => $u_info['uid'], "gid" => $shop['id'], "send" => 1);
                _g_triggerRequest(WEB_PATH . '/api/send/send_shop_code', false, $post_arr);
            }
        } else {
            $query = false;
        }
    } else {
        $query = false;
    }
    /******************************/
    /*新建*/
    if ($query) {
        if ($shop['qishu'] < $shop['maxqishu']) {
            $maxinfo = $db->GetOne("select * from `@#_shoplist` where `sid` = '{$shop['sid']}' order by `qishu` DESC LIMIT 1");
            if (!$maxinfo) {
                $maxinfo = array("qishu" => $shop['qishu']);
            }
            System::load_app_fun("content", G_ADMIN_DIR);
            $intall = content_add_shop_install($maxinfo, false);
            if (!$intall) {
                return $query;
            }
        }
    }
    return $query;
}
示例#25
0
 public function autolottery_ret_install()
 {
     $webname = $this->_cfg['web_name'];
     if (isset($_POST['shopid'])) {
         $id = intval($_POST['shopid']);
         $shop_info = $this->db->GetOne("select * from `@#_shoplist` where `id` = '{$id}' LIMIT 1");
         if (!$shop_info) {
             echo '-1';
             exit;
         }
         if ($shop_info['xsjx_time'] > time()) {
             echo "-4";
             exit;
         }
         $shop_info['xsjx_time'] = $shop_info['xsjx_time'] . '.000';
         if ($shop_info['q_user_code']) {
             echo $shop_info['q_user_code'];
             exit;
         }
         if ($shop_info['canyurenshu'] == 0) {
             //$shop_info['canyurenshu'] = rand(1,$shop_info['zongrenshu']);
             echo '-3';
             exit;
         }
         $tocode = System::load_app_class("tocode", "pay");
         # 我的修改
         $tocode->run_tocode($shop_info['xsjx_time'], 100, $shop_info['canyurenshu'], $shop_info);
         $code = $tocode->go_code;
         $content = $tocode->go_content;
         $counttime = $tocode->count_time;
         $u_go_info = $this->db->GetOne("select * from `@#_member_go_record` where `shopid` = '{$shop_info['id']}' and `shopqishu` = '{$shop_info['qishu']}' and `goucode` LIKE  '%{$code}%'");
         if ($u_go_info) {
             $u_info = $this->db->GetOne("select * from `@#_member` where `uid` = '{$u_go_info['uid']}'");
             $q_user = serialize($u_info);
             $q_uid = $u_info['uid'];
         } else {
             $u_go_info = $this->db->GetOne("select * from `@#_member_go_record` where `shopid` = '{$shop_info['id']}' and `shopqishu` = '{$shop_info['qishu']}' order by `gonumber` DESC");
             $u_info = $this->db->GetOne("select * from `@#_member` where `uid` = '{$u_go_info['uid']}'");
             $q_user = serialize($u_info);
             $q_uid = $u_info['uid'];
         }
         $this->db->Autocommit_start();
         $q_1 = $this->db->Query("UPDATE `@#_shoplist` SET\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t`q_uid` = '{$q_uid}',\n\t\t\t\t\t\t\t\t`q_user` = '{$q_user}',\n\t\t\t\t\t\t\t\t`q_user_code` = '{$code}',\n\t\t\t\t\t\t\t\t`q_content`\t= '{$content}',\n\t\t\t\t\t\t\t\t`q_counttime` ='{$counttime}',\n\t\t\t\t\t\t\t\t`q_end_time` = '{$shop_info['xsjx_time']}'\n\t\t\t\t\t\t\t\t where `id` = '{$id}'");
         if ($u_go_info) {
             $q_2 = $this->db->Query("UPDATE `@#_member_go_record` SET `huode` = '{$code}' where `code` = '{$u_go_info['code']}' and `uid` = '{$u_go_info['uid']}' and `shopid` = '{$id}' and `shopqishu` = '{$shop_info['qishu']}'");
         } else {
             $q_2 = true;
         }
         $q_3 = $this->autolottery_install($shop_info);
         if ($q_1 && $q_2 && $q_3) {
             $this->db->Autocommit_commit();
             echo $code . "云购码";
             exit;
         } else {
             $this->db->Autocommit_rollback();
             echo '-2';
             exit;
         }
     }
     echo '-1';
     exit;
 }
示例#26
0
<?php

defined('G_IN_SYSTEM') or exit('no');
System::load_app_class('admin', NULL, 'no');
System::load_app_fun('global');
System::load_sys_fun('user');
class qishu extends admin
{
    private $db;
    public function __construct()
    {
        parent::__construct();
        $this->db = System::load_app_model('admin_model');
        $this->ment = array(array("lists", "商品列表", ROUTE_M . "/content/goods_list"));
    }
    //期数列表
    public function qishu_list()
    {
        $shopid = intval($this->segment(4));
        $info = $this->db->GetOne("select * from `@#_shoplist` where `id` = '{$shopid}' LIMIT 1");
        $num = 20;
        $total = $this->db->GetCount("select * from `@#_shoplist` where `sid` = '{$info['sid']}'");
        $page = System::load_sys_class('page');
        if (isset($_GET['p'])) {
            $pagenum = $_GET['p'];
        } else {
            $pagenum = 1;
        }
        $page->config($total, $num, $pagenum, "0");
        if ($pagenum > $page->page) {
            $pagenum = $page->page;
示例#27
0
 public function __construct()
 {
     $this->db = System::load_sys_class("model");
     $this->categorys = $this->db->GetList("SELECT * FROM `@#_category` WHERE 1 order by `parentid` ASC,`cateid` ASC", array('key' => 'cateid'));
     $this->pay = System::load_app_class("pay", "pay");
 }
示例#28
0
 public function addmoney()
 {
     parent::__construct();
     if (!isset($_POST['submit'])) {
         _message("正在返回充值页面...", WEB_PATH . '/member/member/home/userrecharge');
         exit;
     }
     if (!$this->userinfo) {
         $this->HeaderLogin();
     }
     $pay_type_bank = isset($_POST['pay_bank']) ? $_POST['pay_bank'] : false;
     $pay_type_id = isset($_POST['account']) ? $_POST['account'] : false;
     $money = intval($_POST['money']);
     $uid = $this->userinfo['uid'];
     $pay = System::load_app_class('pay', 'pay');
     $pay->pay_type_bank = $pay_type_bank;
     $ok = $pay->init($uid, $pay_type_id, 'addmoney_record', $money);
     if ($ok === 'not_pay') {
         _message("未选择支付平台");
     }
 }
示例#29
0
<?php

defined('G_IN_SYSTEM') or exit('no');
System::load_app_fun('global', G_ADMIN_DIR);
System::load_app_fun('my', 'go');
System::load_app_fun('user', 'go');
System::load_app_class("base", "member", "no");
System::load_sys_fun('user');
class shaidan extends base
{
    public $db;
    public function __construct()
    {
        parent::__construct();
        $this->db = System::load_sys_class('model');
    }
    public function init()
    {
        $title = "晒单分享";
        $num = 40;
        $total = $this->db->GetCount("select * from `@#_shaidan` where 1");
        $page = System::load_sys_class('page');
        if (isset($_GET['p'])) {
            $pagenum = $_GET['p'];
        } else {
            $pagenum = 1;
        }
        $page->config($total, $num, $pagenum, "0");
        if ($pagenum > $page->page) {
            $pagenum = $page->page;
        }
示例#30
0
 public function wx_set_config()
 {
     System::load_app_class("admin", G_ADMIN_DIR, 'no');
     $objadmin = new admin();
     $config = System::load_app_config("connect");
     if (isset($_POST['dosubmit'])) {
         $appid = $_POST['appid'];
         $secret = $_POST['secret'];
         $wxid = $_POST['wxid'];
         $key = $_POST['key'];
         $back = $_POST['back'];
         $mappid = $_POST['mappid'];
         $msecret = $_POST['msecret'];
         $mwxid = $_POST['mwxid'];
         $mkey = $_POST['mkey'];
         $mback = $_POST['mback'];
         $this->db->Query("UPDATE `@#_wxset` SET `appid` = '{$appid}',`secret` = '{$secret}',`wxid` = '{$wxid}',`key` = '{$key}',`back` = '{$back}',`mappid` = '{$mappid}',`msecret` = '{$msecret}',`mwxid` = '{$mwxid}',`mkey` = '{$mkey}',`mback` = '{$mback}'");
         _message("配置更新成功!");
     }
     $config = $this->db->GetOne("select * from `@#_wxset` LIMIT 1");
     include $this->tpl(ROUTE_M, 'weixin_set_config');
 }