public function indexAction() { $params = TZ_Request::getParams('get'); /* $sessionId = TZ_Request::checkSessionId('get'); $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sessionId); if (!$uid) { throw new Exception('您还没有登陆,无法继续操作。'); } $arUserInfo = TZ_Loader::service('User', 'User')->getInfoByUid($uid); */ $ccid = $params['ccid']; if (strlen($ccid) == 20) { $ccid = substr($ccid, 0, 19); } elseif (strlen($ccid) != 19) { throw new Exception("您输入的ICCID有误,请检查"); } if ($ccid > 0) { //应用调取接口 if (isset($params['type']) && intval($params['type']) > 0) { $result = TZ_Loader::service('UserFlow', 'Flow')->getFlowInfo($ccid); $result['demo'] = preg_replace("/<br>/is", "", $result['demo']); TZ_Request::success(array($result)); } else { $result = TZ_Loader::service('UserFlow', 'Flow')->getProductCardInfo($ccid); TZ_Request::success(array($result)); } } else { throw new Exception("参数错误"); } }
public function indexAction() { $params = TZ_Request::getParams('post'); $sessionId = TZ_Request::checkSessionId('post'); $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sessionId); if (!$uid) { throw new Exception('您还没有登陆,无法继续操作。'); } // "params":"session_id=18600622921&did=123&cid=123&fid=123" $did = $cid = $fid = 0; //可以单买盒子,也可以单买卡和流量,还可以都买。 if (isset($params['did']) && is_numeric($params['did'])) { $did = $params['did']; if (isset($params['cid']) && is_numeric($params['cid']) && isset($params['fid']) && is_numeric($params['fid'])) { $cid = $params['cid']; $fid = $params['fid']; } } elseif (isset($params['cid']) && is_numeric($params['cid']) && isset($params['fid']) && is_numeric($params['fid'])) { $cid = $params['cid']; $fid = $params['fid']; } else { throw new Exception('对不起,参数错误。'); } $arUserInfo = TZ_Loader::service('User', 'User')->getInfoByUid($uid); //1:需要绑定 其余解除绑定 $type = $params['type'] > 0 ? $params['type'] : 1; $ccid = $params['ccid']; $result = TZ_Loader::service('UserFlow', 'Flow')->setUserCard($uid, $ccid, $arUserInfo['telephone'], $type); TZ_Request::success($result); }
public function codeAction() { $n = $o = array(); $key = '7b7e7b6165923a5d'; $data[] = md5('1'); $data[] = md5('2'); $data[] = md5('3'); $data[] = md5('4'); $data[] = md5('5'); $data[] = md5('6'); $data[] = md5('7'); $data[] = md5('8'); $data[] = md5('9'); $data[] = '你好,哈哈!'; $data[] = '没什么~ 梦_1243的'; d($data); $cipher = new TZ_Mcrypt($key); foreach ($data as $v) { $n[] = $cipher->encode($v); } d($n); $cipher2 = new TZ_Mcrypt($key); foreach ($n as $v) { $o[] = $cipher2->decode($v); } d($o); //$cipher3 = new TZ_Mcrypt($key); //d($cipher3->decode('Tdl4CAKwkZ1sMfk9ty4moY6mfJFJHGk2xbD2ghkXlFX8i8YpFvtpYee1dL5n6Gqb')); TZ_Request::send(array()); }
public function indexAction() { $params = TZ_Request::getParams('get'); $sessionId = TZ_Request::checkSessionId('get'); $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sessionId); if (!$uid) { throw new Exception('您还没有登陆,无法继续操作。'); } $arUserInfo = TZ_Loader::service('User', 'User')->getInfoByUid($uid); //1:需要绑定 其余解除绑定 $type = isset($params['type']) ? $params['type'] : 1; $ccid = $params['iccid']; if (strlen($ccid) == 20) { $ccid = substr($ccid, 0, 19); } elseif (strlen($ccid) != 19) { throw new Exception("您输入的ICCID有误,请检查"); } $result = TZ_Loader::service('UserFlow', 'Flow')->setUserCard($uid, $ccid, $arUserInfo['telephone'], $type); if ($result) { if ($result == 1) { TZ_Request::success(array(array("status" => 1, "message" => "绑定成功"))); } else { TZ_Request::success(array(array("status" => 1, "message" => "恭喜你绑定成功并获得免费通话时长!"))); } } else { TZ_Request::success(array(array("status" => 2, "message" => "绑定失败"))); } }
public function indexAction() { if (!isset($_GET['iccid'])) { throw new Exception("参数错误"); } else { $iccid = $_GET['iccid']; } //通过查来的iccid,得到用户的电话号码 if (strlen($iccid) == 20) { $iccid = substr($iccid, 0, 19); } elseif (strlen($iccid) != 19) { throw new Exception("请检查您的ICCID!"); } $data = (array) TZ_Loader::service('UserFlow', 'Flow')->getFlowProductId($iccid); if (empty($data) || count($data) == 0 || !isset($data['ctelephone'])) { //不存在于我们的数据库中 throw new Exception("未查到相关信息,请确认是否为747流量卡!"); } //得到去联通官网查询时所需的电话号码 $ctelephone = $data['ctelephone']; $flow = TZ_Loader::service('Flow', 'Flow')->getSurplusFlow($ctelephone); if ($flow) { TZ_Request::success(array($flow)); } else { TZ_Request::error('网络繁忙'); } }
public function errorAction($exception) { $code = 500; $detail = $exception->getMessage(); $error = array('code' => $code, 'detail' => $detail, 'data' => array()); TZ_Request::send($error); }
public function indexAction() { $telephone = TZ_Request::checkTelephone(); $verifyCode = TZ_Request::checkVerifyCode(); $validStatus = TZ_Loader::service('VerifyCode', 'User')->valid($telephone, $verifyCode); TZ_Request::success(array(array('verified' => $validStatus))); }
public function indexAction() { $sessionId = TZ_Request::checkSessionId(); $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sessionId); if (!$uid) { throw new Exception('请先登陆。'); } $verifyCode = TZ_Request::checkVerifyCode(); $userInfo = TZ_Loader::service('User', 'User')->getInfoByUid($uid); if (empty($userInfo) || !is_array($userInfo)) { throw new Exception('请先登陆。'); } //valid $telephone = $userInfo['telephone']; $validStatus = TZ_Loader::service('VerifyCode', 'User')->valid($telephone, $verifyCode); if (!$validStatus) { throw new Exception('验证码错误。'); } //unset TZ_Loader::service('VerifyCode', 'User')->discard($telephone); //更新验证字段 TZ_Loader::service('User', 'User')->validTelphone($telephone); //response TZ_Request::success(array(array('session_id' => $sessionId))); }
public function indexAction() { $sessionId = TZ_Request::checkSessionId(); $logoutStatus = TZ_Loader::service('User', 'User')->logout($sessionId); /*if (!$logoutStatus) throw new Exception('注销登陆失败。'); */ TZ_Request::success(); }
public function indexAction() { $params = TZ_Request::getParams('get'); $tag = ''; if (isset($params['tag'])) { $tag = $params['tag']; } $resultData = TZ_loader::service('Upgrade', 'Upgrade')->getUpgrade($tag); TZ_Request::success($resultData); }
public function advertAction() { //获取广告图 $ads_info = TZ_Loader::service('Advert', 'Api')->getAdvert(); if (count($ads_info) > 0) { TZ_Request::success($ads_info); } else { TZ_Request::error($ads_info); } }
public function indexAction() { $session_id = trim($_POST['session_id']); $iccid = trim($_POST['iccid']); $flag = trim($_POST['flag']); if ($session_id != '' && $flag != '') { $uid = TZ_Loader::service('SessionManager', 'User')->getUid($session_id); if (empty($uid)) { TZ_Request::error('登录过期'); exit; } else { $iccid = trim($iccid, ','); $arrIccid = explode(',', $iccid); if ($flag == 'off') { $set = array('status' => 0); } elseif ($flag == 'on') { $set = array('status' => 1); } else { TZ_Request::error('无效参数'); exit; } $conditions = array('uid:eq' => $uid); foreach ($arrIccid as $val) { if ($val) { $conditions['ccid:eq'] = $val; } $row = TZ_Loader::model('UserSubscription', 'User')->select($conditions, 'id', 'ROW'); if ($row['id']) { TZ_Loader::model('UserSubscription', 'User')->update($set, $conditions); } else { $upUser = TZ_Loader::model('UserCard', 'User')->select($conditions, '*', 'ALL'); if ($upUser) { foreach ($upUser as $v) { $cols = array(); $cols['user_card_id'] = $v['id']; $cols['uid'] = $v['uid']; $cols['ccid'] = $v['ccid']; $cols['telephone'] = $v['telephone']; $cols['ctelephone'] = $v['ctelephone']; $cols['messages_id'] = 0; $cols['status'] = $set['status']; $cols['created_at'] = $cols['updated_at'] = date('Y-m-d H:i:s'); TZ_Loader::model('UserSubscription', 'User')->insert($cols); } } } } TZ_Request::success('ok'); exit; } } else { TZ_Request::error('无效参数'); exit; } }
public function indexAction() { $sessionId = TZ_Request::checkSessionId(); $password = TZ_Request::checkPassword(); $oldPassword = TZ_Request::checkOldPassword(); $changeStatus = TZ_Loader::service('User', 'User')->changePassword($sessionId, $oldPassword, $password); if (!$changeStatus) { throw new Exception('修改密码失败。'); } TZ_Request::success(); }
public function indexAction() { $params = TZ_Request::getParams('get'); $sessionId = TZ_Request::checkSessionId('get'); $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sessionId); if (!$uid) { throw new Exception('您还没有登陆,无法继续操作。'); } $result = TZ_Loader::service('Product', 'Device')->getCardList($uid); TZ_Request::success($result); }
public function indexAction() { $telephone = TZ_Request::checkTelephone(); $reset = TZ_Request::checkVerifyMode(); $service = TZ_Loader::service('VerifyCode', 'User'); if ($reset == '1') { $verifyCode = $service->createRegisterCode($telephone); } else { $verifyCode = $service->createResetCode($telephone); } TZ_Request::success(array(array('verify_code' => ''))); }
public function indexAction() { $params = TZ_Request::getParams('get'); $sCcid = $params['ccid']; if (strlen($sCcid) == 20) { $sCcid = substr($sCcid, 0, 19); } elseif (strlen($sCcid) != 19) { throw new Exception("您输入的ICCID有误,请检查"); } $result = TZ_Loader::service('Product', 'Device')->getPayFlowList($sCcid); TZ_Request::success($result); }
public function indexAction() { $params = TZ_Request::getParams('get'); $sessionId = TZ_Request::checkSessionId('get'); $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sessionId); if (!$uid) { throw new Exception('您还没有登陆,无法继续操作。'); } //ccid $sCcid = $params['ccid']; $result = TZ_Loader::service('UserFlow', 'Device')->getFlowNextRechargeMonth($uid, $sCcid); TZ_Request::success($result); }
public function indexAction() { $telephone = TZ_Request::checkTelephone(); $password = TZ_Request::checkPassword(); if (!empty($_POST['debug'])) { $password = hash('sha256', $password); } if (TZ_Loader::service('Blacklist')->inList($telephone)) { TZ_Request::error('系统检测你有违规操作,帐号已被冻结。', 500); } $sessionId = TZ_Loader::service('User', 'User')->login($telephone, $password); TZ_Request::success(array(array('session_id' => $sessionId))); }
public function indexAction() { $telephone = TZ_Request::checkTelephone(); $password = TZ_Request::checkPassword(); $params = TZ_Request::getParams('post'); if (isset($params['name']) && $params['name'] != '') { $name = $params['name']; } else { $name = '747er_' . substr(md5($telephone), 0, 6); } //register $sessionId = TZ_Loader::service('User', 'User')->register($telephone, $password, $name); //response TZ_Request::success(array(array('session_id' => $sessionId))); }
public function indexAction() { $params = TZ_Request::getParams('post'); $orderId = $params['orderNumber']; // $price=$params['price']; $status = $params['status']; //$key=$params['key']; // $result=0; // //判断该请求是否来源自支付中心 // $sec = hash('sha256',$orderId.$price.$status); // if($key == $sec){ // TZ_Loader::service('Order', 'Device')->setOrder($orderId,$status); // } TZ_Loader::service('Order', 'Device')->setOrder($orderId, $status); echo "SUCCESS"; //TZ_Request::success($result); }
public function indexAction() { $params = TZ_Request::getParams('post'); $orderId = $params['orderNumber']; $status = $params['status']; if ($status != 'SUCCESS') { die("Filed Request."); } $orderDetail = TZ_Loader::service('Changecardorder', 'Flow')->updateOrder($orderId, 2); if (!isset($orderDetail['uid'])) { echo "SUCCESS"; exit; } $orderInfo = TZ_Loader::service('Order', 'Device')->getOrderDetail($orderId); $ret = TZ_Loader::service('Changecardorder', 'Flow')->bindNewCard($orderInfo, $orderDetail); echo "SUCCESS"; }
public function indexAction() { $telephone = TZ_Request::checkTelephone(); $verifyCode = TZ_Request::checkVerifyCode(); $password = TZ_Request::checkPassword(); //valid $validStatus = TZ_Loader::service('VerifyCode', 'User')->valid($telephone, $verifyCode); if (!$validStatus) { throw new Exception('验证码错误。'); } $resetStatus = TZ_Loader::service('User', 'User')->resetPassword($telephone, $password); if (!$resetStatus) { throw new Exception('重置密码失败。'); } //unset TZ_Loader::service('VerifyCode', 'User')->discard($telephone); TZ_Request::success(); }
public function indexAction() { $params = TZ_Request::getParams('get'); $sessionId = TZ_Request::checkSessionId('get'); $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sessionId); if (!$uid) { throw new Exception('您还没有登陆,无法继续操作。'); } //1:需要绑定 其余解除绑定 $ccid = $params['iccid']; if (strlen($ccid) == 20) { $ccid = substr($ccid, 0, 19); } elseif (strlen($ccid) != 19) { throw new Exception("您输入的ICCID有误,请检查"); } $result = TZ_Loader::service('UserFlow', 'Flow')->delUserCard($uid, $ccid); TZ_Request::success(array(array("message" => "操作成功"))); }
public function indexAction() { $params = TZ_Request::getParams('get'); /* $sessionId = TZ_Request::checkSessionId('get'); $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sessionId); if (!$uid) { throw new Exception('您还没有登陆,无法继续操作。'); } $arUserInfo = TZ_Loader::service('User', 'User')->getInfoByUid($uid); */ $ccid = $params['ccid']; $result = TZ_Loader::service('UserFlow', 'Flow')->getFlowOderList($ccid); TZ_Request::success($result); }
public function changeAction() { $params = TZ_Request::getParams('post'); $sessionId = TZ_Request::checkSessionId('post'); $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sessionId); if (!$uid) { throw new Exception('您还没有登陆,无法继续操作。'); } // "params":"session_id=18600622921&fid=123&ccid=asfdafdafdsafdas&starttime=20141101" if (!isset($params['fid']) || !isset($params['ccid']) || !isset($params['starttime']) || !isset($params['endtime'])) { throw new Exception('对不起,参数异常。'); } $fid = $params['fid']; $ccid = $params['ccid']; $starttime = $params['starttime']; $endtime = $params['endtime']; $result = TZ_Loader::service('Order', 'Device')->buyCard($uid, $fid, $ccid, $starttime, $endtime, $sessionId); TZ_Request::success($result); }
public function indexAction() { $params = TZ_Request::getParams('post'); if (isset($params['user_id'])) { if (empty($params['user_id']) || !is_numeric($params['user_id'])) { throw new Exception('user_id不能为空。'); } $uid = $params['user_id']; $fields = array('name', 'icon', 'type', 'area', 'city', 'vip', 'gender', 'is_verified', 'invite_code'); $userInfo = TZ_Loader::service('User', 'User')->getInfoByUid($uid, $fields); if (empty($userInfo)) { throw new Exception('用户不存在。'); } $userInfo['user_type'] = $userInfo['type']; unset($userInfo['type']); } elseif (isset($params['session_id'])) { if (empty($params['session_id'])) { throw new Exception('session_id不能为空。'); } $uid = TZ_Loader::service('SessionManager', 'User')->getUid($params['session_id']); if (!$uid) { throw new Exception('请先登陆。'); } $fields = array('uid', 'telephone', 'name', 'icon', 'type', 'area', 'city', 'vip', 'gender', 'is_verified', 'invite_code'); $userInfo = TZ_Loader::service('User', 'User')->getInfoByUid($uid, $fields); if (empty($userInfo)) { throw new Exception('用户不存在。'); } $userInfo['user_type'] = $userInfo['type']; unset($userInfo['type']); $userInfo['id'] = $userInfo['uid']; unset($userInfo['uid']); } else { throw new Exception('参数不能为空。'); } //print_r($userInfo); //format $userInfo['user_type'] = intval($userInfo['user_type']); $userInfo['gender'] = intval($userInfo['gender']); $userInfo['vip'] = intval($userInfo['vip']); TZ_Request::success(array($userInfo)); }
public function indexAction() { $params = $_GET; if (empty($params['iccid'])) { throw new Exception("参数错误"); } else { $iccid = $params['iccid']; } if (!empty($params['start_time']) && !empty($params['end_time'])) { $start = date('Ym', strtotime($params['start_time'])); $end = date('Ym', strtotime($params['end_time'])); if ($start != $end) { throw new Exception("不能跨月查询"); } $startDate = $params['start_time'] . " 00:00:00"; $endDate = $params['end_time'] . " 23:59:59"; } else { $startDate = date('Y-m') . '-01' . " 00:00:00"; $endDate = date('Y-m-d') . " 23:59:59"; } if (empty($params['page'])) { $page = 1; } else { if (!is_numeric($params['page'])) { throw new Exception('页数格式错误.'); } $page = intval($params['page']); } if (empty($params['count'])) { $count = 10; } else { if (!is_numeric($params['count']) || $params['count'] > 100) { throw new Exception('页数据量格式错误.'); } $count = intval($params['count']); } $limit = ($page - 1) * $count; $UserFlowLog = TZ_Loader::service('UserFlowLog', 'Flow')->getUserFlowLogList($iccid, $startDate, $endDate, $limit, $count); TZ_Request::success($UserFlowLog); }
/** * Hello World! * * @return void */ public function indexAction() { $params = TZ_Request::getParams('get'); if (isset($params['session_id'])) { if (empty($params['session_id'])) { throw new Exception('无会话id.'); } $sessionId = TZ_Request::clean($params['session_id']); $uid = TZ_loader::service('SessionManager')->getUid($sessionId); if (!$uid) { throw new Exception('你还没有登录.'); } $userInfo = TZ_Loader::service('CallUser')->getUserInfo(array('friendlyName:eq' => $uid)); } elseif (isset($params['telephone'])) { if (empty($params['telephone'])) { throw new Exception('请输入手机号码.'); } $userInfo = TZ_Loader::service('CallUser')->getUserInfo(array('mobile:eq' => $params['telephone'])); } else { throw new Exception('请输入必要参数.'); } TZ_Request::success(array($userInfo)); }
public function indexAction() { $sessionId = TZ_Request::checkSessionId(); $name = TZ_Request::checkName(); $gender = TZ_Request::checkGender(); $params = TZ_Request::getParams('post'); $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sessionId); if (!$uid) { throw new Exception('请先登陆。'); } $userInfo['name'] = $name; $userInfo['gender'] = $gender; if (isset($params['area'])) { $userInfo['area'] = TZ_Request::clean($params['area']); } if (isset($params['city'])) { $userInfo['city'] = TZ_Request::clean($params['city']); } $updateStatus = TZ_Loader::service('User', 'User')->updateInfo($uid, $userInfo); if (!$updateStatus) { throw new Exception('更新用户信息失败。'); } TZ_Request::success(); }
/** * * 从确定订单跳转到的地址管理页面 * * 需要传值 * session_id * */ public function orderaddressmanageAction() { $host = Yaf_Application::app()->getConfig()->heimi->appstore->host; $params = TZ_Request::getParams('get'); //过滤 foreach ($params as $pk => $pv) { $params[$pk] = TZ_Request::clean($pv); } $goods_id = !empty($params['goods_id']) ? $params['goods_id'] : ""; $sid = !empty($params['session_id']) ? $params['session_id'] : ""; $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sid); //$uid = 11; if (empty($uid)) { $this->include_alert(); //throw new Exception("登录过期,请重新登录"); $url = "hmbox://cn.747.box/login?to=" . $host . "/api/addressinfo/orderaddressmanage?session_id={sessionid}&goods_id=" . $goods_id; echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/><script type='text/javascript' charset='utf-8'>like_alert_just('登录过期,请重新登录','" . $url . "');</script>"; die; } $this->_view->assign("session_id", $sid); //load service $oAddressAboutService = TZ_Loader::service('AddressAbout', 'Api'); //get data $condition = array(); $condition['uid:eq'] = $uid; $condition['status:eq'] = 1; //查找该用户使用状态的地址信息列表 $arAddressList = $oAddressAboutService->getAddressList($condition); //查找该用户使用状态的地址信息总数 $arAddressTotal = $oAddressAboutService->getAddressTotal($condition); //如果没有地址信息 跳转到没有地址页面 if (empty($arAddressList)) { $this->_view->display("mg_noaddress.html"); } else { foreach ($arAddressList as $k => $v) { if (trim($v['area']) == '0') { $arAddressList[$k]['area'] = ""; } $proLength = mb_strlen($v['province'], 'utf8'); $cityLength = mb_strlen($v['city'], 'utf8'); $areaLength = mb_strlen(trim($v['area']), 'utf8'); $lastLength = 40 - intval($proLength) - intval($cityLength) - intval($areaLength); if (mb_strlen(trim($v['detail']), 'utf8') > $lastLength) { $arAddressList[$k]['detail'] = mb_substr(trim($arAddressList['detail']), 0, $lastLength, 'utf-8') . '...'; } if ($v['is_default'] == "1") { $arDefault = $arAddressList[$k]; unset($arAddressList[$k]); } } if (!empty($arDefault)) { array_unshift($arAddressList, $arDefault); } } //var_dump($arAddressList); //得到当前使用的那一条地址 if (!empty($params['addressId'])) { $addressId = $params['addressId']; } else { $addressId = 0; } $this->_view->assign("addressId", $addressId); $this->_view->assign("goods_id", $goods_id); $this->_view->assign("arAddressList", $arAddressList); $this->_view->assign("arAddressTotal", $arAddressTotal); $this->_view->display("order_mgaddress.html"); }