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 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() { $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 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(); $logoutStatus = TZ_Loader::service('User', 'User')->logout($sessionId); /*if (!$logoutStatus) throw new Exception('注销登陆失败。'); */ TZ_Request::success(); }
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() { $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 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() { $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() { $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(); $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() { $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 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('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 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(); }
public function getFlowInfoAction() { $params = TZ_Request::getParams('get'); $ccid = $params['ccid']; if ($ccid > 0) { if (strlen($ccid) == 20) { $ccid = substr($ccid, 0, 19); } elseif (strlen($ccid) != 19) { throw new Exception("您输入的ICCID有误,请检查"); } $result = TZ_Loader::service('UserFlow', 'Flow')->getCurrentFlowInfo($ccid); //var_dump($result); TZ_Request::success($result); } else { throw new Exception("参数错误"); } }
/** * 用户订单支付 * * @param $session_id 用户session * @param $osn 订单ID * * @Return array */ public function payOrderAction() { $params = TZ_Request::getParams('post'); $sid = TZ_Request::clean($params['session_id']); $order_sn = TZ_Request::clean($params['osn']); $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sid); if (empty($uid) || empty($order_sn)) { throw new Exception('Parameter error'); } $oContidion = array('uid:eq' => $uid, 'status:eq' => 1, 'order_sn:eq' => $order_sn); $arOrder = TZ_Loader::model('Orders', 'Order')->select($oContidion, '*', 'ROW'); if (count($arOrder) > 0 && $arOrder['real_price'] > 0) { $payOrder = TZ_Loader::service('Order', 'Order')->payOrder($uid, $arOrder); TZ_Request::success($payOrder); } else { throw new Exception('没有该订单'); } }
public function indexAction() { $data = TZ_Loader::service('Blacklist', 'Flow')->getList(); TZ_Request::success($data); }
public function indexAction() { TZ_loader::service('PayWork', 'Api')->setWork(); TZ_Request::success(); }