Пример #1
0
 public function get_medal()
 {
     $user_id = intval($GLOBALS['user_info']['id']);
     $medal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "medal where class_name = 'Groupuser'");
     $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
     $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_medal where medal_id = " . $medal['id'] . " and user_id = " . $user_id);
     if ($data) {
         //已经领取
         $result['status'] = 2;
         $result['info'] = "您已经领取过" . $medal['name'];
     } else {
         $group_info = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_group where user_id = " . $user_id);
         if ($group_info > 0) {
             $link_data['user_id'] = $user_id;
             $link_data['medal_id'] = $medal['id'];
             $link_data['name'] = $medal['name'];
             $link_data['icon'] = $medal['icon'];
             $link_data['create_time'] = get_gmtime();
             $GLOBALS['db']->autoExecute(DB_PREFIX . "user_medal", $link_data);
             $result['status'] = 1;
             //领取成功
             $result['info'] = "您已经成功领取" . $medal['name'];
         } else {
             $result['status'] = 0;
             $result['info'] = "您还不是小组组长,去申请一个小组";
             $result['jump'] = url("shop", "group#create");
         }
     }
     return $result;
 }
Пример #2
0
 static function set($name, $value, $expire = '', $path = '', $domain = '')
 {
     $path = app_conf("COOKIE_PATH");
     $domain = app_conf("DOMAIN_ROOT");
     $expire = !empty($expire) ? get_gmtime() + $expire : 0;
     setcookie($name, $value, $expire, $path, $domain);
 }
 public function insert()
 {
     $name = $this->getActionName();
     $model = D($name);
     $data = $model->create();
     $data['create_time'] = TIME_UTC;
     if (false === $data) {
         $this->error($model->getError());
     }
     $data['create_time'] = get_gmtime();
     $list = false;
     //保存当前数据对象
     foreach ($_REQUEST['image'] as $k => $v) {
         if ($v) {
             $data['image'] = $v;
             $data['brief'] = $_REQUEST['brief'][$k];
             $list = $model->add($data);
         }
     }
     if ($list !== false) {
         //保存成功
         $supplier_info['id'] = $data['supplier_location_id'];
         syn_supplier_locationcount($supplier_info);
         update_supplier_location_img($supplier_info['id']);
         save_log(L("INSERT_SUCCESS"), 1);
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         $dbErr = M()->getDbError();
         save_log(L("INSERT_FAILED") . $dbErr, 0);
         $this->error(L("INSERT_FAILED") . $dbErr);
     }
 }
 public function index()
 {
     $mobile = strim($GLOBALS['request']['mobile']);
     if (app_conf("SMS_ON") == 0) {
         $root['status'] = 0;
         $root['info'] = '短信功能关闭';
         output($root);
     }
     if ($mobile == '') {
         $root['status'] = 0;
         $root['info'] = '手机号码不能为空';
         output($root);
     }
     if (!check_mobile($mobile)) {
         $root['status'] = 0;
         $root['info'] = "请输入正确的手机号码";
         output($root);
     }
     if (!check_ipop_limit(CLIENT_IP, "register_verify_phone", 60, 0)) {
         $root['status'] = 0;
         $root['info'] = '发送太快了';
         output($root);
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "user WHERE mobile = " . $mobile;
     $user = $GLOBALS['db']->getRow($sql);
     if (empty($user)) {
         $root['status'] = 0;
         $root['info'] = "手机号未在本站注册过";
         output($root);
     }
     //删除超过5分钟的验证码
     $sql = "DELETE FROM " . DB_PREFIX . "sms_mobile_verify WHERE mobile_phone = '{$mobile}' and add_time <=" . (get_gmtime() - 300);
     $GLOBALS['db']->query($sql);
     $code = rand(100000, 999999);
     $message = "您正在找回密码,验证码:" . $code . ",如非本人操作,请忽略本短信【" . app_conf("SHOP_TITLE") . "】";
     require_once APP_ROOT_PATH . "system/utils/es_sms.php";
     $sms = new sms_sender();
     $send = $sms->sendSms($mobile, $message);
     if ($send['status']) {
         $add_time = get_gmtime();
         $GLOBALS['db']->query("insert into " . DB_PREFIX . "sms_mobile_verify(mobile_phone,code,add_time,send_count,ip) values('{$mobile}','{$code}','{$add_time}',1," . "'" . CLIENT_IP . "')");
         /* 插入一条发送成功记录到队列表中 */
         $msg_data['dest'] = $mobile;
         $msg_data['send_type'] = 0;
         $msg_data['content'] = addslashes($message);
         $msg_data['send_time'] = $add_time;
         $msg_data['is_send'] = 1;
         $msg_data['is_success'] = 1;
         $msg_data['create_time'] = $add_time;
         $msg_data['user_id'] = intval($user['id']);
         $msg_data['title'] = "密码找回验证";
         $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data);
         $root['info'] = "验证码发出,请注意查收";
         $root['status'] = 1;
     } else {
         $root['info'] = "发送失败" . $send['msg'];
         $root['status'] = 0;
     }
     output($root);
 }
Пример #5
0
 public function get_medal()
 {
     $user_id = intval($GLOBALS['user_info']['id']);
     $medal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "medal where class_name = 'Tencentbind'");
     $medal['config'] = unserialize($medal['config']);
     $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
     $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_medal where medal_id = " . $medal['id'] . " and user_id = " . $user_id);
     if ($data) {
         //已经领取
         $result['status'] = 2;
         $result['info'] = "您已经领取过" . $medal['name'];
     } else {
         if ($user_info['tencent_id'] != '') {
             $link_data['user_id'] = $user_id;
             $link_data['medal_id'] = $medal['id'];
             $link_data['name'] = $medal['name'];
             $link_data['icon'] = $medal['icon'];
             $link_data['create_time'] = get_gmtime();
             $GLOBALS['db']->autoExecute(DB_PREFIX . "user_medal", $link_data);
             $result['status'] = 1;
             //领取成功
             $result['info'] = "您已经成功领取" . $medal['name'];
         } else {
             $result['status'] = 0;
             $result['info'] = "领取该勋章需要绑定腾讯微博帐号";
             $result['jump'] = url("shop", "uc_center#setweibo");
         }
     }
     return $result;
 }
Пример #6
0
 public function index()
 {
     $ecvSn = strim($GLOBALS['request']['ecv_sn']);
     $ecvPassword = strim($GLOBALS['request']['ecv_pwd']);
     $now = get_gmtime();
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root = array();
     $root['return'] = 1;
     $root['info'] = "";
     $root['check_ecv_state'] = 0;
     //0:无效,1:有效
     if ($user_id > 0) {
         $root['user_login_status'] = 1;
         if (!empty($ecvSn)) {
             $ecv_sql = "select e.*,et.name from " . DB_PREFIX . "ecv as e left join " . DB_PREFIX . "ecv_type as et on e.ecv_type_id = et.id where e.sn = '" . $ecvSn . "' and e.password = '******' and ((e.begin_time <> 0 and e.begin_time < " . $now . ") or e.begin_time = 0) and " . "((e.end_time <> 0 and e.end_time > " . $now . ") or e.end_time = 0) and ((e.use_limit <> 0 and e.use_limit > e.use_count) or (e.use_limit = 0)) " . "and (e.user_id = " . $user_id . " or e.user_id = 0)";
             $ecv_data = $GLOBALS['db']->getRow($ecv_sql);
             if (!$ecv_data) {
                 $root['info'] = "无效的代金券";
             } else {
                 $root['check_ecv_state'] = 1;
                 $root['info'] = "验证成功!";
             }
         } else {
             $root['info'] = "卡号不能为空!";
         }
     } else {
         $root['user_login_status'] = 0;
     }
     output($root);
 }
Пример #7
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $share_id = intval($GLOBALS['request']['share_id']);
     //没有分享ID直接退出
     if ($share_id == 0) {
         $root['status'] = -2;
         output($root);
     }
     $content = strim($GLOBALS['request']['content']);
     $source = strim($GLOBALS['request']['source']);
     $source = str_replace("来自", "", $source);
     $email = strim($GLOBALS['request']['email']);
     $pwd = strim($GLOBALS['request']['pwd']);
     $is_relay = intval($GLOBALS['request']['is_relay']);
     $parent_id = intval($GLOBALS['request']['parent_id']);
     if ($parent_id > 0) {
         $parent_reply = $GLOBALS['db']->getRow("select id,user_id,user_name from " . DB_PREFIX . "topic_reply where id = " . $parent_id);
     }
     $result = do_login_user($email, $pwd);
     $GLOBALS['user_info'] = $user_data = es_session::get('user_info');
     $user_data['id'] = intval($user_data['id']);
     if (intval($user_data['id']) == 0) {
         $root['return'] = 0;
         $root['user_login_status'] = 0;
         $root['info'] = "请先登录";
         output($root);
     }
     $root['user_login_status'] = 1;
     $topic = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0 and id = " . $share_id);
     if (empty($topic)) {
         $root['status'] = -3;
         output($root);
     }
     $reply_data = array();
     $reply_data['topic_id'] = $share_id;
     $reply_data['user_id'] = intval($user_data['id']);
     $reply_data['user_name'] = $user_data['user_name'];
     $reply_data['reply_id'] = intval($parent_reply['id']);
     $reply_data['reply_user_id'] = intval($parent_reply['user_id']);
     $reply_data['reply_user_name'] = strim($parent_reply['user_name']);
     $reply_data['create_time'] = get_gmtime();
     $reply_data['is_effect'] = 1;
     $reply_data['is_delete'] = 0;
     $reply_data['content'] = valid_str($content);
     $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_reply", $reply_data);
     $GLOBALS['db']->query("update " . DB_PREFIX . "topic set reply_count = reply_count + 1,last_time = " . get_gmtime() . ",last_user_id=" . $user_data['id'] . " where id = " . $share_id);
     increase_user_active($user_data['id'], "转发了一则分享");
     if ($is_relay == 1) {
         $cnt = $topic['content'] . "@" . $user_data['user_name'] . " 评论:" . valid_str($content);
         $id = insert_topic($cnt, $title = "", $type = "", $group = "", $relay_id = $share_id, $fav_id = 0);
         if ($id) {
             $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $source . "' where id = " . intval($id));
         }
     }
     $root['return'] = 1;
     $root['status'] = 1;
     output($root);
 }
Пример #8
0
 public function index()
 {
     $page = intval($GLOBALS['request']['page']);
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     if ($page == 0) {
         $page = 1;
     }
     $page_size = PAGE_SIZE;
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $event_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_event order by sort desc limit " . $limit);
     $count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_event");
     foreach ($event_list as $k => $v) {
         $now = get_gmtime();
         $event_list[$k]['end_time'] = $v['event_end_time'];
         $event_list[$k]['url'] = url("shop", "deal_event#show", array("id" => $v['id']));
         $event_list[$k]['event_end_time'] = to_date($v['event_end_time'], 'Y-m-d');
         $event_list[$k]['icon'] = get_abs_img_root(make_img($v['icon'], 592, 215, 1));
         $event_list[$k]['sheng_time_format'] = to_date($v['event_end_time'] - $now, "d天h小时i分");
     }
     $page_total = ceil($count / $page_size);
     $root = array();
     $root['return'] = 1;
     $root['item'] = $event_list;
     $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
     $root['page_title'] = "活动专题";
     $root['city_name'] = $city_name;
     output($root);
 }
 public function index()
 {
     $root = array();
     $email = addslashes($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = addslashes($GLOBALS['request']['pwd']);
     //密码
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id == 0) {
         $root['user_login_status'] = 0;
         //用户登陆状态:1:成功登陆;0:未成功登陆
         output($root);
     } else {
         $root['user_login_status'] = 1;
     }
     $yh_id = intval($GLOBALS['request']['yh_id']);
     $content = addslashes($GLOBALS['request']['content']);
     //$merchant_id = intval($GLOBALS['db']->getOne("select supplier_location_id from ".DB_PREFIX."youhui where id='".$yh_id."'"));
     $merchant_youhui_comment = array('user_id' => $user_id, 'rel_id' => $yh_id, 'rel_table' => 'youhui', 'title' => $content, 'content' => $content, 'is_effect' => 1, 'create_time' => get_gmtime());
     $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $merchant_youhui_comment, 'INSERT');
     $id = $GLOBALS['db']->insert_id();
     $root['id'] = $id;
     if ($id > 0) {
         increase_user_active($user_id, "点评了一个优惠券");
         $root['status'] = 1;
         $root['info'] = "添加成功";
     } else {
         $root['status'] = 0;
         $root['info'] = "添加失败";
     }
     output($root);
 }
Пример #10
0
 static function set($name, $value, $expire = '', $path = '', $domain = '')
 {
     $path = $GLOBALS['distribution_cfg']['COOKIE_PATH'];
     $domain = $GLOBALS['distribution_cfg']['DOMAIN_ROOT'];
     $expire = !empty($expire) ? get_gmtime() + $expire : 0;
     setcookie($name, $value, $expire, $path, $domain);
 }
Пример #11
0
 public function index()
 {
     $id = intval($_REQUEST['id']);
     $home_user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $id . " and is_effect = 1");
     if (!$home_user_info) {
         app_redirect(url("index"));
     }
     $home_user_info['weibo_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_weibo where user_id = " . $home_user_info['id']);
     $GLOBALS['tmpl']->assign("home_user_info", $home_user_info);
     $page_size = DEAL_PAGE_SIZE;
     $step_size = DEAL_STEP_SIZE;
     $step = intval($_REQUEST['step']);
     if ($step == 0) {
         $step = 1;
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
     $GLOBALS['tmpl']->assign("current_page", $page);
     $condition = " is_delete = 0 and is_effect = 1 and user_id = " . intval($home_user_info['id']) . " ";
     $deal_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where " . $condition . " order by sort asc limit " . $limit);
     $deal_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where " . $condition);
     foreach ($deal_list as $k => $v) {
         $deal_list[$k]['remain_days'] = floor(($v['end_time'] - get_gmtime()) / (24 * 3600));
         $deal_list[$k]['percent'] = round($v['support_amount'] / $v['limit_price'] * 100);
     }
     $GLOBALS['tmpl']->assign("deal_list", $deal_list);
     $page = new Page($deal_count, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->display("home_index.html");
 }
Пример #12
0
 public function get_payment_code($payment_notice_id)
 {
     $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
     //$order_sn = $GLOBALS['db']->getOne("select order_sn from ".DB_PREFIX."deal_order where id = ".$payment_notice['order_id']);
     $money = round($payment_notice['money'], 2);
     $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
     $payment_info['config'] = unserialize($payment_info['config']);
     /* 银行类型 */
     //$bank_id = $GLOBALS['db']->getOne("select bank_id from ".DB_PREFIX."deal_order where id = ".$payment_notice['order_id']);
     $bank_id = $payment_notice['bank_id'];
     $payChannel = $this->config['sdo_paychannel'];
     $defaultChannel = $this->config['sdo_defaultchannel'];
     if ($bank_id == '0' || trim($bank_id) == 'SDO1' || trim($bank_id) == 'SDO') {
         $bank_id = '';
     }
     $postBackURL = SITE_DOMAIN . APP_ROOT . '/index.php?ctl=payment&act=response&class_name=Sdo';
     //付款完成后的跳转页面
     $notifyURL = SITE_DOMAIN . APP_ROOT . '/index.php?ctl=payment&act=notify&class_name=Sdo';
     //通知发货页面
     $shengpay = new shengpay();
     $array = array('Name' => 'B2CPayment', 'Version' => 'V4.1.1.1.1', 'Charset' => 'UTF-8', 'MsgSender' => $payment_info['config']['sdo_account'], 'SendTime' => to_date(get_gmtime(), 'YmdHis'), 'OrderTime' => to_date(get_gmtime(), 'YmdHis'), 'PayType' => 'PT001', 'PayChannel' => '14,18,19,20', 'InstCode' => $bank_id, 'PageUrl' => $postBackURL, 'NotifyUrl' => $notifyURL, 'ProductName' => $payment_notice_id, 'BuyerContact' => '', 'BuyerIp' => '', 'Ext1' => '', 'Ext2' => '', 'SignType' => 'MD5');
     $shengpay->init($array);
     $shengpay->setKey($payment_info['config']['sdo_key']);
     /*
     /*
     	商家自行检测传入的价格与数据库订单需支付金额是否相同
     */
     $code = $shengpay->takeOrder($payment_notice_id, $money, $payment_info);
     $code .= "<br /><span class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</span>";
     return $code;
 }
Пример #13
0
 public function insert()
 {
     $id = intval($_REQUEST['id']);
     $coin_type["pay_name"] = $_REQUEST['pay_name'];
     $coin_type["pay_desc"] = $_REQUEST['pay_desc'];
     $coin_type["faccess_key"] = $_REQUEST['faccess_key'];
     $coin_type["fsecrt_key"] = $_REQUEST['fsecrt_key'];
     $coin_type["fip"] = $_REQUEST['fip'];
     $coin_type["fport"] = $_REQUEST['fport'];
     $coin_type["create_time"] = get_gmtime();
     if (!$id) {
         M("coin_type")->add($coin_type);
     } else {
         $coin_type['id'] = $id;
         M("coin_type")->save($coin_type);
     }
     if (method_exists($this, '_filter')) {
         $this->_filter($map);
     }
     $model = D("coin_type");
     if (!empty($model)) {
         $this->_list($model, $map);
     }
     $this->display("index");
 }
Пример #14
0
function insert_load_user_tip_index()
{
    //输出未读的消息数
    $msg_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "msg_box where to_user_id = " . intval($GLOBALS['user_info']['id']) . " and is_read = 0 and is_delete = 0 and type = 0");
    $GLOBALS['tmpl']->assign("msg_count", intval($msg_count));
    $expire = array();
    if ($GLOBALS['user_info']) {
        $time = get_gmtime();
        $expire_time = 6 * 30 * 24 * 3600;
        if ($GLOBALS['user_info']['workpassed'] == 1) {
            if ($time - $GLOBALS['user_info']['workpassed_time'] > $expire_time) {
                $expire['workpassed_expire'] = 1;
            }
        }
        if ($GLOBALS['user_info']['incomepassed'] == 1) {
            if ($time - $GLOBALS['user_info']['incomepassed_time'] > $expire_time) {
                $expire['incomepassed_expire'] = 1;
            }
        }
        if ($GLOBALS['user_info']['creditpassed'] == 1) {
            if ($time - $GLOBALS['user_info']['creditpassed_time'] > $expire_time) {
                $expire['creditpassed_expire'] = 1;
            }
        }
        if ($GLOBALS['user_info']['residencepassed'] == 1) {
            if ($time - $GLOBALS['user_info']['residencepassed_time'] > $expire_time) {
                $expire['residencepassed_expire'] = 1;
            }
        }
        $GLOBALS['tmpl']->assign("u_expire", $expire);
    }
    return $GLOBALS['tmpl']->fetch("inc/insert/load_user_tip_index.html");
}
Пример #15
0
 public function check_fee()
 {
     es_session::start();
     $last_visit = intval(es_session::get("last_visit_smsbao"));
     if (get_gmtime() - $last_visit > 10) {
         $sms = new transport();
         $params = array("u" => $this->sms['user_name'], "p" => md5($this->sms['password']));
         $url = "http://www.smsbao.com/query";
         $result = $sms->request($url, $params);
         $match = explode(',', $result['body']);
         if ($match[0] != '') {
             $remain = (int) $match[1];
             $str = sprintf('短信宝增值平台&nbsp;&nbsp;剩余:%d 条', $remain);
         } else {
             $str = "短信宝增值平台 (<a href='http://www.smsbao.com/reg?r=5001' target='_blank'><font color='red'>还没账号?点击这免费注册</font></a>)";
         }
         es_session::set("smsbao_info", $str);
         es_session::set("last_visit_smsbao", get_gmtime());
         return $str;
     } else {
         $qxt_info = es_session::get("smsbao_info");
         if ($smsbao_info) {
             return $smsbao_info;
         } else {
             return "短信宝增值平台 (<a href='http://www.smsbao.com/reg?r=5001' target='_blank'><font color='red'>还没账号?点击这免费注册</font></a>)";
         }
     }
 }
Пример #16
0
 public function dologin()
 {
     if (check_ipop_limit(get_client_ip(), "supplier_dologin", intval(app_conf("SUBMIT_DELAY")))) {
         $account_name = htmlspecialchars(addslashes(trim($_REQUEST['account_name'])));
         $account_password = htmlspecialchars(addslashes(trim($_REQUEST['account_password'])));
         $account = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_account where account_name = '" . $account_name . "' and account_password = '******' and is_effect = 1 and is_delete = 0");
         if ($account) {
             if (intval($_REQUEST['save_password']) == 1) {
                 es_cookie::set("sp_account_name", $account_name, 3600 * 24 * 30);
                 es_cookie::set("sp_account_password", md5($account_password), 3600 * 24 * 30);
             }
             //$account_locations = $GLOBALS['db']->getAll("select location_id from ".DB_PREFIX."supplier_account_location_link where account_id = ".$account['id']);
             $account_locations = $GLOBALS['db']->getAll("select id from " . DB_PREFIX . "supplier_location where supplier_id = " . $account['supplier_id']);
             $account_location_ids = array(0);
             foreach ($account_locations as $row) {
                 $account_location_ids[] = $row['id'];
             }
             $account['location_ids'] = $account_location_ids;
             es_session::set("account_info", $account);
             $result['status'] = 1;
             $GLOBALS['db']->query("update " . DB_PREFIX . "supplier_account set login_time = " . get_gmtime() . ",login_ip = '" . get_client_ip() . "' where id = " . $account['id']);
             ajax_return($result);
         } else {
             $result['status'] = 0;
             $result['msg'] = $GLOBALS['lang']['SUPPLIER_LOGIN_FAILED'];
             ajax_return($result);
         }
     } else {
         $result['status'] = 0;
         $result['msg'] = $GLOBALS['lang']['SUBMIT_TOO_FAST'];
         ajax_return($result);
     }
 }
 public function index()
 {
     $mobile = addslashes(htmlspecialchars(trim($GLOBALS['request']['mobile'])));
     $root = array();
     if (app_conf("SMS_ON") == 0) {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['SMS_OFF'];
         //短信未开启
         output($root);
     }
     if ($mobile == '') {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['MOBILE_EMPTY_TIP'];
         //请输入你的手机号
         output($root);
     }
     if (!check_mobile($mobile)) {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['FILL_CORRECT_MOBILE_PHONE'];
         //请填写正确的手机号码
         output($root);
     }
     if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where mobile = '" . $mobile . "'") > 0) {
         $field_show_name = $GLOBALS['lang']['USER_TITLE_mobile'];
         //手机号码
         $root['response_code'] = 0;
         $root['show_err'] = sprintf($GLOBALS['lang']['EXIST_ERROR_TIP'], $field_show_name);
         //已存在,请重新输入
         output($root);
     }
     if (!check_ipop_limit(get_client_ip(), "mobile_verify", 60, 0)) {
         $root['response_code'] = 0;
         $root['show_err'] = $GLOBALS['lang']['MOBILE_SMS_SEND_FAST'];
         //短信发送太快
         output($root);
     }
     //删除超过5分钟的验证码
     $GLOBALS['db']->query("DELETE FROM " . DB_PREFIX . "mobile_verify_code WHERE create_time <=" . get_gmtime() - 300);
     $verify_code = $GLOBALS['db']->getOne("select verify_code from " . DB_PREFIX . "mobile_verify_code where mobile = '" . $mobile . "' and create_time>=" . (TIME_UTC - 180) . " ORDER BY id DESC");
     if (intval($verify_code) == 0) {
         //如果数据库中存在验证码,则取数据库中的(上次的 );确保连接发送时,前后2条的验证码是一至的.==为了防止延时
         //开始生成手机验证
         $verify_code = rand(1111, 9999);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "mobile_verify_code", array("verify_code" => $verify_code, "mobile" => $mobile, "create_time" => get_gmtime(), "client_ip" => get_client_ip()), "INSERT");
     }
     //使用立即发送方式
     $result = send_verify_sms($mobile, $verify_code, null, true);
     //
     $root['response_code'] = $result['status'];
     if ($root['response_code'] == 1) {
         $root['show_err'] = $GLOBALS['lang']['MOBILE_VERIFY_SEND_OK'];
     } else {
         $root['show_err'] = $result['msg'];
         if ($root['show_err'] == null || $root['show_err'] == '') {
             $root['show_err'] = "验证码发送失败";
         }
     }
     //../system/sms/FW_sms.php  提示账户或密码错误地址
     output($root);
 }
Пример #18
0
 public function update()
 {
     B('FilterString');
     $data = M("ApnsMessages")->create();
     $log_info = $data['id'];
     //开始验证有效性
     $this->assign("jumpUrl", u("MApns/edit", array("id" => $data['id'])));
     if (!check_empty($data['content'])) {
         $this->error(L("CONTENT_EMPTY_TIP"));
     }
     if ($data['send_time'] == '') {
         $data['send_time'] = get_gmtime();
     }
     $data['send_time'] = to_timespan($data['send_time']);
     if (intval($_REQUEST['resend']) == 1) {
         $data['status'] = 0;
     }
     $list = M("ApnsMessages")->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
Пример #19
0
 public function insert_ticket()
 {
     if ($_REQUEST['money'] == '') {
         $this->error("券的金额不能为空");
     }
     if ($_REQUEST['amount'] == '') {
         $this->error("券的数量不能为空");
     }
     if ($_REQUEST['use_time'] == '') {
         $this->error("券的有效天数不能为空");
     }
     $ticket_data['money'] = intval($_REQUEST['money']);
     $ticket_data['quantity'] = intval($_REQUEST['amount']);
     $ticket_data['rest_quantity'] = intval($_REQUEST['amount']);
     $ticket_data['use_time'] = intval($_REQUEST['use_time']);
     $ticket_data['status'] = intval($_REQUEST['status']);
     $ticket_data['value'] = intval($_REQUEST['value']);
     $ticket_data['is_deposit'] = 1;
     //券的类型  0:赠金券 1代金券
     $ticket_data['ticket_type'] = intval($_REQUEST['type']);
     //券的使用类型  0:无条件  1:满减优惠
     $ticket_data['type'] = intval($_REQUEST['use_type']);
     //系统默认时间
     $ticket_data['create_time'] = get_gmtime();
     $ticket_data['start_use'] = to_timespan(trim($_REQUEST['start_time']));
     $ticket_data['deadline'] = to_timespan(trim($_REQUEST['end_time']));
     $rs = M("Ticket")->add($ticket_data);
     if ($rs) {
         $this->success(L("INSERT_SUCCESS"));
     } else {
         $this->error(L("INSERT_FAILED"));
     }
 }
Пример #20
0
 public function index()
 {
     $payment_id = intval($GLOBALS['request']['payment']);
     $money = floatval($GLOBALS['request']['money']);
     if ($money <= 0) {
         $root['status'] = 2;
         $root['info'] = $GLOBALS['lang']['PLEASE_INPUT_CORRECT_INCHARGE'];
         output($root);
     }
     $payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id = " . $payment_id);
     if (!$payment_info) {
         $root['status'] = 2;
         $root['info'] = $GLOBALS['lang']['PLEASE_SELECT_PAYMENT'];
         output($root);
     }
     if ($payment_info['fee_type'] == 0) {
         //定额
         $payment_fee = $payment_info['fee_amount'];
     } else {
         //比率
         $payment_fee = $money * $payment_info['fee_amount'];
     }
     //开始生成订单
     $now = NOW_TIME;
     $order['type'] = 1;
     //充值单
     $order['user_id'] = $GLOBALS['user_info']['id'];
     $order['create_time'] = $now;
     $order['total_price'] = $money + $payment_fee;
     $order['deal_total_price'] = $money;
     $order['pay_amount'] = 0;
     $order['pay_status'] = 0;
     $order['delivery_status'] = 5;
     $order['order_status'] = 0;
     $order['payment_id'] = $payment_id;
     $order['payment_fee'] = $payment_fee;
     //        $order['bank_id'] = strim($_REQUEST['bank_id']);
     do {
         $order['order_sn'] = to_date(get_gmtime(), "Ymdhis") . rand(100, 999);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_order", $order, 'INSERT', '', 'SILENT');
         $order_id = intval($GLOBALS['db']->insert_id());
     } while ($order_id == 0);
     require_once APP_ROOT_PATH . "system/model/cart.php";
     $payment_notice_id = make_payment_notice($order['total_price'], $order_id, $payment_info['id']);
     //创建支付接口的付款单
     if ($payment_notice_id) {
         $root['order_id'] = $order_id;
         $root['info'] = 1;
     }
     //        print_r($root);exit;
     output($root);
     //        $rs = order_paid($order_id);
     //        if ($rs) {
     //            app_redirect(url("index", "payment#incharge_done", array("id" => $order_id))); //充值支付成功
     //        } else {
     //            app_redirect(url("index", "payment#pay", array("id" => $payment_notice_id)));
     //        }
 }
Пример #21
0
 public function index()
 {
     $root = array();
     $root['return'] = 1;
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     if ($user_id == 0) {
         $root['user_login_status'] = 0;
         //用户登陆状态:1:成功登陆;0:未成功登陆
         output($root);
     } else {
         $root['user_login_status'] = 1;
     }
     $brand_ids = $GLOBALS['db']->getOne("select group_concat(brand_id) from " . DB_PREFIX . "brand_dy where uid = " . $user_id);
     //print_r($brand_ids);
     if (!$brand_ids) {
         $brand_ids = -1;
     }
     if (substr($brand_ids, -1, 1) == ',') {
         $brand_ids = substr($brand_ids, 0, -1);
     }
     $merchant_ids = $GLOBALS['db']->getOne("select group_concat(supplier_id) from " . DB_PREFIX . "supplier_dy where uid = " . $user_id);
     if (!$merchant_ids) {
         $merchant_ids = -1;
     }
     if (substr($merchant_ids, -1, 1) == ',') {
         $merchant_ids = substr($merchant_ids, 0, -1);
     }
     $page = intval($GLOBALS['request']['page']);
     //分页
     $page_size = PAGE_SIZE;
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $sql_count = "select count(*) from " . DB_PREFIX . "youhui ";
     //$sql = "select id,merchant_id,title,content,merchant_logo,create_time,merchant_xpoint,merchant_ypoint,merchant_api_address,image_1 from ".FDB::table("merchant_youhui");
     $sql = "select id, supplier_id as merchant_id,name as title,list_brief as content,icon as merchant_logo,create_time,xpoint,ypoint,address as api_address,icon as image_1 from " . DB_PREFIX . "youhui ";
     $now = get_gmtime();
     $where = "1 = 1 and is_effect = 1 and (end_time = 0 or end_time > " . $now . ") and  (brand_id in (" . $brand_ids . ") or supplier_id in (" . $merchant_ids . "))";
     $sql_count .= " where " . $where;
     $sql .= " where " . $where;
     $sql .= " order by create_time desc limit " . $limit;
     $total = $GLOBALS['db']->getOne($sql_count);
     $page_total = ceil($total / $page_size);
     //print_r($sql); exit;
     $list = $GLOBALS['db']->getAll($sql);
     $youhui_list = array();
     foreach ($list as $item) {
         $youhui_list[] = m_youhuiItem($item);
     }
     if ($GLOBALS['request']['from'] == 'wap') {
         $root['email'] = $email;
         $root['f_link_data'] = get_link_list();
     }
     $root['item'] = $youhui_list;
     $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
     $root['now'] = $now;
     output($root);
 }
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $event_id = intval($GLOBALS['request']['event_id']);
     //没有分享ID直接退出
     if ($event_id == 0) {
         $root['status'] = 0;
         $root['info'] = "不存在的活动ID";
         output($root);
     }
     $content = strim($GLOBALS['request']['content']);
     $source = strim($GLOBALS['request']['source']);
     $source = str_replace("来自", "", $source);
     $email = strim($GLOBALS['request']['email']);
     $pwd = strim($GLOBALS['request']['pwd']);
     $result = do_login_user($email, $pwd);
     $GLOBALS['user_info'] = $user_data = es_session::get('user_info');
     $user_data['id'] = intval($user_data['id']);
     if (intval($user_data['id']) == 0) {
         $root['status'] = 0;
         $root['user_login_status'] = 0;
         $root['info'] = "请先登录";
         output($root);
     }
     $root['user_login_status'] = 1;
     $event_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event where is_effect = 1 and id = " . $event_id);
     if (empty($event_info)) {
         $root['status'] = 0;
         $root['info'] = "不存在的活动ID";
         output($root);
     }
     $reply_data = array();
     $reply_data['rel_table'] = "event";
     $reply_data['rel_id'] = intval($event_id);
     $reply_data['content'] = valid_str($content);
     if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) {
         $message_effect = 0;
     } else {
         $message_effect = 1;
         //$message_type['is_effect'];
     }
     $reply_data['is_effect'] = $message_effect;
     $reply_data['create_time'] = get_gmtime();
     $reply_data['user_id'] = intval($user_data['id']);
     $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $reply_data);
     increase_user_active($user_data['id'], "点评了一个活动");
     $title = "对" . $event_info['name'] . "发表了点评";
     $url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'edetail', 'rel_param' => 'id=' . $event_info['id']);
     $tid = insert_topic($reply_data['content'], $title, "eventcomment", $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
     if ($tid) {
         $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $source . "' where id = " . intval($tid));
     }
     $GLOBALS['db']->query("update " . DB_PREFIX . "event set reply_count = reply_count+1 where id =" . $event_id);
     $root['status'] = 1;
     $root['info'] = "感谢您的点评";
     output($root);
 }
 static function is_expired()
 {
     if (isset($_SESSION[app_conf("AUTH_KEY") . "expire"]) && $_SESSION[app_conf("AUTH_KEY") . "expire"] < get_gmtime()) {
         return true;
     } else {
         $_SESSION[app_conf("AUTH_KEY") . "expire"] = get_gmtime() + intval(app_conf("EXPIRED_TIME")) * 60;
         return false;
     }
 }
Пример #24
0
 public function index()
 {
     $root = array();
     $root['return'] = 1;
     $city_id = intval($GLOBALS['request']['city_id']);
     //检查用户,用户密码
     $user_info = $GLOBALS['user_info'];
     $user_id = intval($user_info['id']);
     $last_check_time = intval($GLOBALS['request']['last_check_time']);
     //print_r($user_info);exit;
     $brand_ids = $GLOBALS['db']->getOne("select group_concat(brand_id) from " . DB_PREFIX . "brand_dy where uid = " . $user_id);
     //print_r($brand_ids);
     if (!$brand_ids) {
         $brand_ids = 0;
     }
     if (substr($brand_ids, -1, 1) == ',') {
         $brand_ids = substr($brand_ids, 0, -1);
     }
     $merchant_ids = $GLOBALS['db']->getOne("select group_concat(supplier_location_id) from " . DB_PREFIX . "supplier_location_dy where uid = " . $user_id);
     if (!$merchant_ids) {
         $merchant_ids = 0;
     }
     if (substr($merchant_ids, -1, 1) == ',') {
         $merchant_ids = substr($merchant_ids, 0, -1);
     }
     $sql_count = "select count(*) from " . DB_PREFIX . "youhui";
     $now = get_gmtime();
     $where = " where 1 = 1 and create_time > " . $last_check_time . " and is_effect = 1 and begin_time<" . $now . " and (end_time = 0 or end_time > " . $now . ") and (brand_id in (" . $brand_ids . ") or supplier_location_id in (" . $merchant_ids . "))";
     $sql_count .= $where;
     //echo $sql_count; exit;
     if ($brand_ids == 0 && $merchant_ids == 0) {
         $root['count'] = 0;
     } else {
         $root['count'] = intval($GLOBALS['db']->getOne($sql_count));
     }
     $root['adv_youhui'] = m_adv_youhui($city_id);
     /*
     $root['adv_youhui'] = m_adv_youhui($city_id);
     $root['newslist'] = $GLOBALS['m_config']['newslist'];
     
     $latitude = floatval($GLOBALS['request']['latitude']);//ypoint
     $longitude = floatval($GLOBALS['request']['longitude']);//xpoint
     if ($user_id > 0 && $latitude > 0 && $longitude > 0){
     	$user_x_y_point = array(
     								'uid' => $user_id,
     								'xpoint' => $longitude,
     								'ypoint' => $latitude,
     								'locate_time' => get_gmtime(),
     	);
     	$GLOBALS['db']->autoExecute(DB_PREFIX."user_x_y_point", $user_x_y_point, 'INSERT');
     	$sql = "update ".DB_PREFIX."user set xpoint = $longitude, ypoint = $latitude, locate_time = ".get_gmtime()." where id = $user_id";
     	$GLOBALS['db']->query($sql);
     }
     */
     output($root);
 }
Пример #25
0
 public function index()
 {
     $deal_id = intval($GLOBALS['request']['deal_id']);
     /*商品id*/
     $collect_status = intval($GLOBALS['request']['collect_status']);
     /*2:加载,1:增加收藏,0取消收藏;*/
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root = array();
     $root['return'] = 1;
     if ($user_id > 0) {
         //用户登陆状态:1:成功登陆;0:未成功登陆
         $root['user_login_status'] = 1;
         $root['collect_status'] = $collect_status;
         if ($collect_status == 2) {
             $root['is_collect'] = 0;
             /*1:已收藏,0:未收藏*/
             $collect_deal_id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal_collect where deal_id = " . $deal_id . " and user_id=" . $user_id . "");
             if (intval($collect_deal_id) > 0) {
                 $root['is_collect'] = 1;
             }
         } elseif ($collect_status == 1) {
             $goods_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $deal_id . " and is_effect = 1 and is_delete = 0");
             $collect_deal_id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal_collect where deal_id = " . $deal_id . " and user_id=" . $user_id . "");
             if ($goods_info) {
                 $sql = "INSERT INTO `" . DB_PREFIX . "deal_collect` (`id`,`deal_id`, `user_id`, `create_time`) select '0','" . $goods_info['id'] . "','" . $user_id . "','" . get_gmtime() . "' from dual where not exists (select * from `" . DB_PREFIX . "deal_collect` where `deal_id`= '" . $goods_info['id'] . "' and `user_id` = " . $user_id . ")";
                 $GLOBALS['db']->query($sql);
                 if ($GLOBALS['db']->affected_rows() > 0) {
                     $root['info'] = "收藏成功";
                     $root['is_collect'] = 1;
                 } else {
                     $root['info'] = "您已经收藏过该商品了";
                     $root['is_collect'] = 1;
                 }
             } else {
                 $root['info'] = "没有该商品";
                 $root['is_collect'] = 0;
             }
         } else {
             $goods_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $deal_id . " and is_effect = 1 and is_delete = 0");
             if ($goods_info) {
                 $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_collect where deal_id = " . $goods_info['id'] . " and user_id=" . $user_id . "");
                 $root['is_collect'] = 0;
                 $root['info'] = "取消成功";
             } else {
                 $root['info'] = "没有该商品";
                 $root['is_collect'] = 1;
             }
         }
     } else {
         //未登录
         $root['user_login_status'] = 0;
     }
     output($root);
 }
Пример #26
0
 public function index()
 {
     $email = addslashes($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = addslashes($GLOBALS['request']['pwd']);
     //密码
     //检查用户,用户密码
     $user_info = user_check($email, $pwd);
     $user_id = intval($user_info['id']);
     if (!$user_info) {
         $root['status'] = 0;
         $root['message'] = "用户已失效,无法上传";
         output($root);
     } else {
         //上传
         $content = addslashes(htmlspecialchars(trim($GLOBALS['request']['content'])));
         if ($content == '') {
             $root['status'] = 0;
             $root['message'] = "发布内容不能为空";
             output($root);
         }
         $dir = "u_" . to_date(get_gmtime(), "Ym");
         if (!is_dir(APP_ROOT_PATH . "public/attachment/" . $dir)) {
             @mkdir(APP_ROOT_PATH . "public/attachment/" . $dir);
             @chmod(APP_ROOT_PATH . "public/attachment/" . $dir, 0777);
         }
         $img_result = save_image_upload($_FILES, 'image_1', 'attachment/' . $dir, array('origin' => array(0, 0, 0, 0)), 0, 1);
         if (intval($img_result['error']) != 0) {
             $root['status'] = 0;
             $root['message'] = "图片上传失败:" . $img_result['message'];
             output($root);
         }
         $image_1 = $img_result['image_1']['url'];
         $youhui['user_id'] = $user_id;
         $youhui['icon'] = $image_1;
         $youhui['image'] = $image_1;
         $youhui['is_effect'] = 0;
         $youhui['name'] = $content;
         $youhui['content'] = $content;
         $youhui['create_time'] = get_gmtime();
         $youhui['pub_by'] = 1;
         $GLOBALS['db']->autoExecute(DB_PREFIX . "youhui", $youhui, 'INSERT');
         $id = $GLOBALS['db']->insert_id();
         if ($id) {
             $root['status'] = 1;
             $root['message'] = "发布信息成功";
             output($root);
         } else {
             $root['status'] = 0;
             $root['message'] = "发布信息失败,请稍候再发";
             output($root);
         }
         //上传
     }
 }
Пример #27
0
 public function index()
 {
     $root = array();
     $root['return'] = 1;
     $city_id = intval($GLOBALS['request']['city_id']);
     $ytop = $latitude_top = floatval($GLOBALS['request']['latitude_top']);
     //最上边纬线值 ypoint
     $ybottom = $latitude_bottom = floatval($GLOBALS['request']['latitude_bottom']);
     //最下边纬线值 ypoint
     $xleft = $longitude_left = floatval($GLOBALS['request']['longitude_left']);
     //最左边经度值  xpoint
     $xright = $longitude_right = floatval($GLOBALS['request']['longitude_right']);
     //最右边经度值 xpoint
     $m_distance = doubleval($GLOBALS['request']['m_distance']);
     //范围(米)
     $ypoint = $m_latitude = doubleval($GLOBALS['request']['m_latitude']);
     //ypoint
     $xpoint = $m_longitude = doubleval($GLOBALS['request']['m_longitude']);
     //xpoint
     $page = intval($GLOBALS['request']['page']);
     //分页
     $page = $page == 0 ? 1 : $page;
     $page_size = PAGE_SIZE;
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $pi = 3.14159265;
     //圆周率
     $r = 6378137;
     //地球平均半径(米)
     $now = get_gmtime();
     $sql_count = "select count(*) from " . DB_PREFIX . "youhui ";
     $sql = "select id, supplier_id as merchant_id,name as title,list_brief as content,icon as merchant_logo,create_time,xpoint,ypoint,address as api_address,icon as image_1,\n\t\t\t\t(ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (xpoint * {$pi}) / 180 ) ) * {$r}) as distance  \n\t\t\t\tfrom " . DB_PREFIX . "youhui";
     if ($ybottom != 0 && $ytop != 0 && $xleft != 0 && $xright != 0) {
         $where = " ypoint > {$ybottom} and ypoint < {$ytop} and xpoint > {$xleft} and xpoint < {$xright} and is_effect = 1 and begin_time<" . $now . " and (end_time = 0 or end_time > " . $now . ") ";
     } else {
         $where = " is_effect = 1 and begin_time<" . $now . " and (end_time = 0 or end_time > " . $now . ") ";
     }
     $sql .= " where " . $where;
     $sql .= " order by distance asc ";
     $sql_count .= " where " . $where;
     $sql .= " limit " . $limit;
     $total = $GLOBALS['db']->getOne($sql_count);
     $page_total = ceil($total / $page_size);
     $list = $GLOBALS['db']->getAll($sql);
     $youhui_list = array();
     foreach ($list as $item) {
         $item = m_youhuiItem($item);
         $item['distance'] = round($item['distance']);
         $youhui_list[] = $item;
     }
     $root['item'] = $youhui_list;
     $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
     output($root);
 }
 public function refund()
 {
     $coupon_id = intval($_REQUEST['id']);
     $coupon_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_coupon where id = " . $coupon_id . " and is_valid = 1 and is_delete = 0  and balance_time = 0 and confirm_time=0 and user_id = " . intval($GLOBALS['user_info']['id']));
     if ($coupon_data['any_refund'] == 1 || $coupon_data['expire_refund'] == 1 && $coupon_data['end_time'] > 0 && get_gmtime() > $coupon_data['end_time']) {
         $GLOBALS['db']->query("update " . DB_PREFIX . "deal_coupon set refund_status = 1 where id = " . $coupon_data['id']);
         $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_status = 1 where id = " . intval($coupon_data['order_id']));
         showSuccess("退款申请已提交,等待管理员审核");
     } else {
         showErr($GLOBALS['lang']['INVALID_ACCESS']);
     }
 }
 public function index()
 {
     $mobile = addslashes(htmlspecialchars(trim($GLOBALS['request']['mobile'])));
     $root = array();
     if (app_conf("SMS_ON") == 0) {
         $root['response_code'] = 0;
         $root['show_err'] = '短信未开启';
         output($root);
     }
     if ($mobile == '') {
         $root['response_code'] = 0;
         $root['show_err'] = '请输入你的手机号';
         output($root);
     }
     if (!check_mobile($mobile)) {
         $root['response_code'] = 0;
         $root['show_err'] = '请填写正确的手机号码';
         output($root);
     }
     if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where mobile = '" . $mobile . "'") > 0) {
         $field_show_name = '手机号码';
         $root['response_code'] = 0;
         $root['show_err'] = sprintf('%s已存在,请重新输入', $field_show_name);
         output($root);
     }
     if (!check_ipop_limit(get_client_ip(), "mobile_verify", 60, 0)) {
         $root['response_code'] = 0;
         $root['show_err'] = '短信发送太快,请稍后再试';
         output($root);
     }
     //删除超过5分钟的验证码
     $GLOBALS['db']->query("DELETE FROM " . DB_PREFIX . "mobile_verify_code WHERE create_time <=" . get_gmtime() - 300);
     $verify_code = $GLOBALS['db']->getOne("select verify_code from " . DB_PREFIX . "mobile_verify_code where mobile = '" . $mobile . "' and create_time>=" . (TIME_UTC - 180) . " ORDER BY id DESC");
     if (intval($verify_code) == 0) {
         //如果数据库中存在验证码,则取数据库中的(上次的 );确保连接发送时,前后2条的验证码是一至的.==为了防止延时
         //开始生成手机验证
         $verify_code = rand(1111, 9999);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "mobile_verify_code", array("verify_code" => $verify_code, "mobile" => $mobile, "create_time" => get_gmtime(), "client_ip" => get_client_ip()), "INSERT");
     }
     //使用立即发送方式
     $result = send_verify_sms($mobile, $verify_code, null, true);
     //
     $root['response_code'] = $result['status'];
     if ($root['response_code'] == 1) {
         $root['show_err'] = '验证短信已经发送,请注意查收';
     } else {
         $root['show_err'] = $result['msg'];
         if ($root['show_err'] == null || $root['show_err'] == '') {
             $root['show_err'] = "验证码发送失败";
         }
     }
     output($root);
 }
Пример #30
0
/**
 * 创建新帐户
 * @param int $user_id
 * @param int $user_type 0:普通用户xd_user.id;1:担保用户xd_deal_agency.id
 * @param unknown_type $MerCode
 * @param unknown_type $cert_md5
 * @param unknown_type $post_url
 * @return string
 */
function CreateNewAcct($user_id, $user_type, $MerCode, $cert_md5, $post_url)
{
    $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Ips&class_act=CreateNewAcct&from=" . $_REQUEST['from'];
    //web方式返回
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Ips&class_act=CreateNewAcct&from=" . $_REQUEST['from'];
    //s2s方式返回
    $user = array();
    if ($user_type == 0) {
        $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
    } else {
        $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_agency where id = " . $user_id);
    }
    $data = array();
    $data['user_type'] = $user_type;
    $data['user_id'] = $user_id;
    $data['argMerCode'] = $MerCode;
    // '“平台”账号 否 由IPS颁发的商户号 ',
    $data['pMerBillNo'] = $user_id . 'U' . get_gmtime();
    //$user_id;//'pMerBillNo商户开户流水号 否 商户系统唯一丌重复 针对用户在开户中途中断(开户未完成,但关闭了IPS开 户界面)时,必须重新以相同的商户订单号发起再次开户 ',
    $data['pIdentType'] = 1;
    //'证件类型 否 1#身份证,默认:1',
    $data['pIdentNo'] = $user['idno'];
    //'证件号码 否 真实身份证 ',
    $data['pRealName'] = $user['real_name'];
    //'姓名 否 真实姓名(中文) '
    $data['pMobileNo'] = $user['mobile'];
    //'手机号 否 用户发送短信 '
    $data['pEmail'] = $user['email'];
    //'注册邮箱 否 用于登录账号,IPS系统内唯一丌能重复',
    $data['pSmDate'] = to_date(get_gmtime(), 'Ymd');
    //'提交日期 否 时间格式“yyyyMMdd”,商户提交日期,。如:20140323 ',
    $GLOBALS['db']->autoExecute(DB_PREFIX . "ips_create_new_acct", $data, 'INSERT');
    $id = $GLOBALS['db']->insert_id();
    $strxml = CreateNewAcctXml($data, $pWebUrl, $pS2SUrl);
    //echo $strxml;exit;
    $Crypt3Des = new Crypt3Des();
    //new 3des class
    $p3DesXmlPara = $Crypt3Des->DESEncrypt($strxml);
    //3des 加密
    $str = $MerCode . $p3DesXmlPara . $cert_md5;
    //print_r($cert_md5); exit;
    $pSign = md5($str);
    $html = '
		<form name="form1" id="form1" method="post" action="' . $post_url . 'CreateNewIpsAcct.aspx" target="_self">
		<input type="hidden" name="argMerCode" value="' . $MerCode . '" />
		<input type="hidden" name="arg3DesXmlPara" value="' . $p3DesXmlPara . '" />
		<input type="hidden" name="argSign" value="' . $pSign . '" />
		</form>
		<script language="javascript">document.form1.submit();</script>';
    //echo $html; exit;
    return $html;
}