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() { $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() { $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() { $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() { $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(); $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() { $param = TZ_Request::getParams('get'); $goods_id = isset($param['gid']) ? $param['gid'] : 0; $category_id = isset($param['cid']) ? $param['cid'] : 0; $page = isset($param['page']) ? $param['page'] : 1; $size = isset($param['size']) ? $param['size'] : 6; $info = array('goods_id' => $goods_id, 'category_id' => $category_id, 'page' => $page, 'size' => $size); //获取商品信息 $goods_info = TZ_Loader::service('Goods', 'Api')->getGoods($info); if (count($goods_info['data']) > 0) { TZ_Request::success($goods_info['data'], array('pages' => $goods_info['pages'])); } else { TZ_Request::error($goods_info); } }
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() { $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)); }
/** * 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"); }
public function ischangeAction() { $params = TZ_Request::getParams('get'); $ccid = $params['ccid']; $result = TZ_Loader::service('Changecardorder', 'Flow')->ischanged($ccid); if ($result) { die("ok"); } else { die("no"); } }
/** * 处理用户修改收货信息 * @param $session_id 用户sessionID */ public function upaddressdataAction() { $strparams = TZ_Request::getParams('get'); $params = TZ_Request::getParams('post'); $sid = $strparams['session_id']; $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sid); if (empty($uid)) { throw new Exception('登录过期,请重新登录'); } $userInfo = TZ_Loader::service("User", "User")->getInfoByUid($uid); if (empty($userInfo)) { throw new Exception('登录过期,请重新登录!'); } $upArr = array('name' => $params['username'], 'receive_tel' => $params['usertelephone'], 'province' => $params['homeprov'], 'city' => $params['homecity'], 'area' => $params['homedistrict'], 'detail' => $params['userdetail'], 'mailCode' => $params['postcode'], 'updated_at' => date('Y-m-d H:i:s')); $upCondition = array('uid:eq' => $uid); $upAddress = TZ_Loader::model('Address', 'Device')->update($upArr, $upCondition); if (empty($upAddress)) { throw new Exception('系统繁忙,请稍后重试'); } else { header("Location:/api/payinfo/index?ccid=" . $strparams['ccid'] . "&session_id=" . $strparams['session_id']); } }
/** * 查看用户订单详情 * * @param $session_id 用户session * @param $osn 用户订单ID * * @Return array */ public function detailAction() { $this->include_alert(); $params = TZ_Request::getParams('get'); $sid = TZ_Request::clean($params['session_id']); $order_sn = TZ_Request::clean($params['osn']); $num = TZ_Request::clean($params['num']); if (!empty($order_sn) && !empty($sid)) { $uid = TZ_Loader::service('SessionManager', 'User')->getUid($sid); $mallHost = Yaf_Registry::get('config')->heimi->appstore->host; if (empty($uid)) { //登录过期 $url = "hmbox://cn.747.box/login?to=" . $mallHost . "/api/order/detail?osn=" . $order_sn . "&num=" . $num . "&session_id={sessionid}"; 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; } //获取订单详细信息 $iCondition = array('uid:eq' => $uid, 'order_sn:eq' => $order_sn, 'status:neq' => 5); $arOrderInfo = TZ_Loader::model('Orders', 'Order')->select($iCondition, '*', 'ROW'); if (empty($arOrderInfo) || !is_array($arOrderInfo) || count($arOrderInfo) < 1) { throw new Exception('没有该订单'); } $arOrderInfo['saving_price'] = $arOrderInfo['total_price'] - $arOrderInfo['real_price'] > 0 ? $arOrderInfo['total_price'] - $arOrderInfo['real_price'] : '0.00'; switch ($arOrderInfo['status']) { case 1: $arOrderInfo['goto_name'] = '去支付'; $arOrderInfo['status_name'] = '未付款'; break; case 2: $arOrderInfo['goto_name'] = '再次购买'; $arOrderInfo['status_name'] = '已付款未发货'; break; case 3: $arOrderInfo['goto_name'] = '再次购买'; $arOrderInfo['status_name'] = '已发货'; break; case 4: $arOrderInfo['goto_name'] = '再次购买'; $arOrderInfo['status_name'] = '已关闭'; break; default: $arOrderInfo['goto_name'] = '再次购买'; $arOrderInfo['status_name'] = '处理中'; } } else { throw new Exception('Parameter error'); } $this->_view->assign('sid', $sid); $this->_view->assign('arOrderInfo', $arOrderInfo); $this->_view->display('order_info_detail.html'); }