function create_hongbao_xml($retcode = 0, $reterrmsg = "ok") { try { $this->setParameter('sign', $this->get_sign()); $commonUtil = new CommonUtil(); return $commonUtil->arrayToXml($this->parameters); } catch (SDKRuntimeException $e) { die($e->errorMessage()); } }
/** * 添加焦点图 */ function addAction() { if ($this->isPost()) { $text = FRequest::getPostString('text'); $pic = FRequest::getPostString('pic'); $url = FRequest::getPostString('url'); $title = FRequest::getPostString('title'); $position = CommonUtil::getComParam(FRequest::getPostInt('position'), 0); if (!$pic) { $this->showMessage("图片不能为空", error); return; } if (!$title) { $this->showMessage("标题不能为空", error); return; } //打开网页 //print_r($content); $data2 = array('title' => $title, 'text' => $text, 'pic' => $pic, 'url' => $url, 'position' => $position); $mumu_youxi_table = new FTable("mumu_youxi"); $mumu_youxi_table->insert($data2); $this->showMessage("添加成功", "success", "/MumuYouxi/list"); return; } $this->display('admin/mumu_youxi_add'); }
/** * 活动列表 */ function listAction() { //global $_F; // $_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $title = FRequest::getString('title'); $where = array(); $shanchu_id = FRequest::getInt('shanchu_id'); if ($shanchu_id) { $events = new FTable('events'); $events->where(array('id' => $shanchu_id))->remove(true); } if ($title) { $where["title"] = array('like' => $title); } $table = new FTable("events"); $events = $table->fields(array("id", "style", "title", "pic", "content", "tm"))->where($where)->page($page)->limit(20)->order(array("id" => "desc"))->select(); foreach ($events as &$event) { $event["pic"] = CommonUtil::getMoreSizeImg($event["pic"], 100, 100); $event["content"] = json_decode($event["content"]); } $page_info = $table->getPagerInfo(); $this->assign('page_info', $page_info); $this->assign('events', $events); $this->assign('title', $title); $this->display('admin/events_list'); }
public function createRefundOrder($fields) { $account = AccountBiz::getInstance()->getOrCreateAccount($fields['user_id'], $fields['channel']); $refund = new RefundModel(); $refund->id = CommonUtil::longId(); $refund->user_id = $fields['user_id']; $refund->account_id = $account['id']; $refund->channel = $fields['channel']; $refund->gateway = $fields['gateway']; $refund->recharge_id = $fields['recharge_id']; $refund->mer_refund_no = $refund->id . substr(sprintf('%012s', $fields['user_id']), -12); if (null !== ($localEnv = \GlobalConfig::getLocalEnv())) { $refund->mer_refund_no = substr($refund->mer_refund_no, 0, -strlen($localEnv)) . $localEnv; } $refund->amount = $fields['refund_amount']; $refund->create_time = time(); $refund->callback_url = $fields['callback_url']; $refund->subject = $fields['subject']; $refund->body = isset($fields['body']) ? $fields['body'] : ''; $refund->busi_refund_no = isset($fields['busi_refund_no']) ? $fields['busi_refund_no'] : ''; $refund->seller_partner = isset($fields['seller_partner']) ? $fields['seller_partner'] : ''; if (true !== $refund->save()) { throw new PayException(ErrCode::ERR_ORDER_CREATE_FAIL); } return $refund; }
public static function excecuteCommand($facade, $data) { $jsonstr = ''; try { if ($data->btn_action == 'save') { $jsonstr = CommonUtil::getSuccessFailureJson($facade->create($data)); } else { if ($data->btn_action == 'update') { $jsonstr = CommonUtil::getSuccessFailureJson($facade->update($data)); } else { if ($data->btn_action == 'delete') { $jsonstr = CommonUtil::getSuccessFailureJson($facade->delete($data)); } else { if ($data->btn_action == 'getAll') { $jsonstr = $facade->getAll(); } else { $jsonstr = '{"message":"action not found"}'; } } } } } catch (Exception $e) { $jsonstr = CommonUtil::getExceptionMessage($e); } return $jsonstr; }
function listAction() { //global $_F; //$_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $uid = FRequest::getInt('uid'); $nickname = FRequest::getString('nickname'); $where = array('ub.count' => array('gte' => '1'), 'um.stat' => '0', 'ud.uid' => array('gte' => '5000000')); if ($uid > 0) { $where["ud.uid"] = $uid; } if ($nickname) { $where["ud.nickname"] = array('like' => $nickname); } $table = new FTable("user_ban", "ub"); $users = $table->fields(array("um.uid", "um.stat", "um.gender", "um.reg_time", "ud.nickname", "ud.avatar", "ud.province", "ud.city", "ud.age", "ud.height", "ud.marry", "ud.aboutme", "ub.count"))->leftJoin("user_detail", "ud", "ub.uid=ud.uid")->leftJoin("user_main", "um", "ub.uid=um.uid")->where($where)->page($page)->limit(10)->order(array("ub.count" => "desc"))->select(); foreach ($users as &$user) { $marry_id = $user["marry"]; $user["marry"] = self::$MARRY[$marry_id]; $user["avatar"] = CommonUtil::getMoreSizeImg($user["avatar"], 50, 50); } $page_info = $table->getPagerInfo(); $this->assign('page_info', $page_info); $this->assign('users', $users); $this->assign('uid', $uid); $this->assign('nickname', $nickname); $this->display('admin/userreport_list'); }
function listAction() { //global $_F; // $_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $uid = FRequest::getInt('uid'); $query_str = " ( mm.type='pic' or mm.type='text' ) "; $where = array(); if ($uid > 0) { $where["mm.from"] = $uid; //$query_str=$query_str." and (mm.from='$uid' or mm.to='$uid') and mm.from<>1 and mm.to<>1 "; $where["str"] = $query_str; $user_detail_table = new FTable("user_detail"); $user_detail = $user_detail_table->where(array('uid' => $uid))->find(); $user_avatar = CommonUtil::getMoreSizeImg($user_detail["avatar"], 100, 100); $table = new FTable("message", "mm", FDB::$DB_MUMU_MESSAGE); $user_messages = $table->fields(array("mm.tm", "mm.from", "mm.to", "mm.content"))->where($where)->groupBy("mm.to")->page($page)->limit(20)->order(array("mm.tm" => "desc"))->select(); $user_messages1 = $table->fields(array("mm.tm", "mm.from", "mm.to", "mm.content"))->where($where)->groupBy("mm.to")->order(array("mm.tm" => "desc"))->select(); $total = count($user_messages1); foreach ($user_messages as &$user_message) { $user_detail_table = new FTable("user_detail"); $user_detail = $user_detail_table->where(array('uid' => $user_message["to"]))->find(); $user_message["to_avatar"] = CommonUtil::getMoreSizeImg($user_detail["avatar"], 100, 100); $user_message["content"] = json_decode($user_message["content"]); } } if ($uid > 0) { $page_info = $table->getPagerInfo(); $this->assign('page_info', FPager::getPagerInfo($total, $page, '20')); $this->assign('user_messages', $user_messages); $this->assign('user_avatar', $user_avatar); } $this->assign('uid', $uid); $this->display('admin/usermessage_list'); }
function listAction() { //global $_F; // $_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $uid = FRequest::getInt('uid'); $where = array('tp.status' => '1'); if ($uid > 0) { $where["ud.uid"] = $uid; } else { $where["1"] = 0; } $table = new FTable("topic", "tp"); $topics = $table->fields(array("tp.id", "tp.uid", "tp.title", "tp.pics", "ud.nickname", "tp.picslevel"))->leftJoin("user_detail", "ud", "tp.uid=ud.uid")->where($where)->page($page)->limit(20)->order(array("tp.id" => "desc"))->select(); foreach ($topics as &$topic) { $topic_tupian = explode(",", $topic['pics']); $pics = ""; foreach ($topic_tupian as $topic_pics) { if ($topic_pics) { $pics = $pics . CommonUtil::getMoreSizeImg($topic_pics, 100, 100) . ","; } } $topic["pics"] = $pics; $discovery_table = new FTable("discovery", "mmd", FDB::$DB_MUMU_SORT); $discovery = $discovery_table->where(array('tid' => $topic["id"]))->find(); $topic["priority"] = $discovery["priority"]; } $page_info = $table->getPagerInfo(); $this->assign('page_info', $page_info); $this->assign('topics', $topics); $this->assign('uid', $uid); $this->display('admin/user_topic_zhiding_list'); }
function listAction() { //global $_F; //$_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $uid = FRequest::getInt('uid'); $nickname = FRequest::getString('nickname'); $gender = FRequest::getInt('gender'); $where = array(); if ($uid || $nickname) { if ($uid) { $where["ud.uid"] = $uid; } if ($nickname) { $where["ud.nickname"] = array('like' => $nickname); } } else { $where["um.stat"] = '0'; $where["ud.avatarlevel"] = '-2'; $where["ud.uid"] = array('gte' => '5000000'); } if ($gender) { $where["um.gender"] = $gender; } $table = new FTable("user_detail", "ud"); $users = $table->fields(array("ud.uid", "um.gender", "ud.nickname", "ud.avatar", "ud.avatarlevel"))->leftJoin("user_main", "um", "ud.uid=um.uid")->where($where)->page($page)->limit(50)->order(array("ud.uid" => "asc"))->select(); foreach ($users as &$user) { $uid_d = $user["uid"]; $table2 = new FTable("image_md5", "im"); $image_md5 = $table2->fields(array("im.md5"))->where(array("im.url" => $user["avatar"]))->find(); // echo($user["avatar"]); $table3 = new FTable("image_md5", "im"); $images = $table3->fields(array("im.url"))->where(array("im.md5" => $image_md5["md5"], "str" => " im.url<>'" . $user["avatar"] . "' ", "im.type" => "avatar"))->select(); $i = 1; foreach ($images as $image) { $i++; $table4 = new FTable("user_detail", "ud"); $users4 = $table4->fields(array("ud.uid"))->where(array("ud.avatar" => $image['url']))->find(); if ($users4) { $uid_d = $uid_d . "," . $users4['uid']; } } $user["uid_d"] = $uid_d; $user["uid_i"] = $i; $user["avatar"] = CommonUtil::getMoreSizeImg($user["avatar"], 222, 222); } $page_info = $table->getPagerInfo(); $this->assign('page_info', $page_info); $this->assign('users', $users); $this->assign('uid', $uid); $this->assign('nickname', $nickname); $this->assign('gender', $gender); $this->display('admin/user_avatar_list'); }
/** * @param $user User * @param $sessionOnly boolean * @param null $expireDate int * @return UserSession */ public static function createForUser($user, $expireDate) { $session = new UserSession(); $session->user = $user->id; $session->token = Auth::generateSessionToken($user->salt); $session->createDate = Database::now(); $session->expireDate = CommonUtil::sqlTimeStamp($expireDate); $session->expired = 0; $session->save(); return $session; }
function list2Action() { //global $_F; //$_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $uid = FRequest::getInt('uid'); $nickname = FRequest::getString('nickname'); $gender = FRequest::getInt('gender'); $where = array(); $query_str = " im.status = '1' "; $table = new FTable("image_md5", "im"); $images = $table->fields(array("im.url", "im.status", "im.type"))->where(array('str' => $query_str))->page($page)->limit(50)->order(array("im.tm" => "asc"))->select(); foreach ($images as &$image) { //头像 if ($image['type'] == "avatar") { $table2 = new FTable("user_detail", "ud"); $users = $table2->fields(array("ud.uid"))->where(array("ud.avatar" => $image['url']))->find(); $image["uid"] = $users['uid']; $image["type_w"] = "头像"; } //大头像 if ($image['type'] == "avatar_big") { $image["type_w"] = "大头像"; } //相册 if ($image['type'] == "photo") { $table2 = new FTable("user_photo_album", "upa"); $users = $table2->fields(array("upa.uid"))->where(array("upa.pic" => $image['url']))->find(); $image["uid"] = $users['uid']; $image["type_w"] = "相册"; } //聊天 if ($image['type'] == "chat") { $table2 = new FTable("bad_message", "bm", FDB::$DB_MUMU_MESSAGE); $users = $table2->fields(array("bm.from"))->where(array("bm.origin" => $image['url']))->find(); $image["uid"] = $users['from']; $image["type_w"] = "聊天"; } //视屏认证 if ($image['type'] == "video_certify") { $table2 = new FTable("video_record", "vr"); $users = $table2->fields(array("vr.uid"))->where(array("vr.video_img" => $image['url']))->find(); $image["uid"] = $users['uid']; $image["type_w"] = "视屏认证"; } $image["url_xiao"] = CommonUtil::getMoreSizeImg($image["url"], 111, 111); } $page_info = $table->getPagerInfo(); $this->assign('page_info', $page_info); $this->assign('images', $images); $this->display('admin/user_image_list2'); }
public function defaultAction() { //global $_F; //$_F["debug"] = true; $table = new FTable("mumu_youxi"); $mumu_youxis = $table->fields(array("id", "title", "text", "pic", "url", "position"))->limit(20)->order(array("position" => "asc", "id" => "desc"))->select(); foreach ($mumu_youxis as &$mumu_youxi) { $mumu_youxi["pic"] = CommonUtil::getMoreSizeImg($mumu_youxi["pic"], 280, 280); $mumu_youxi["text"] = mb_substr($mumu_youxi["text"], 0, 50, "utf-8"); } $this->assign('mumu_youxi', $mumu_youxis); $this->assign('title', '慕慕游戏'); $this->display('mumu_youxi'); }
public function defaultAction() { //global $_F; //$_F["debug"] = true; $table = new FTable("weixin_huodong"); $weixin_huodongs = $table->fields(array("id", "title", "text", "pic", "url", "position"))->limit(20)->order(array("position" => "asc", "id" => "desc"))->select(); foreach ($weixin_huodongs as &$weixin_huodong) { $weixin_huodong["pic"] = CommonUtil::getMoreSizeImg($weixin_huodong["pic"], 280, 280); $weixin_huodong["text"] = mb_substr($weixin_huodong["text"], 0, 50, "utf-8"); } $this->assign('weixin_huodong', $weixin_huodongs); $this->assign('title', '微信活动-慕慕'); $this->display('weixin_huodong'); }
public static function getCityId($location) { if (is_object($location)) { $location = CommonUtil::object2array($location); } if (!is_array($location)) { return 0; } if ($location['cid']) { $cityId = $location["cid"]; } else { $cityId = $location["pid"]; } return $cityId; }
function listAction() { //global $_F; // $_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $uid = FRequest::getInt('uid'); $tiaojian = FRequest::getString('tiaojian'); $where = array('tp.picslevel' => array('gte' => '3'), 'tp.uid' => array('gte' => '5000000'), 'tp.status' => '1'); if ($uid > 0) { $where["tp.uid"] = $uid; } $datetime_riqi = date("Y-m-d", time()); $datetime_riqi_zuotian = date("Y-m-d", time() - 86400); $datetime_riqi_qiantian = date("Y-m-d", time() - 172800); if ($tiaojian == "dangri") { $query_str = " tp.tm >= '" . $datetime_riqi . " 00:00:00' "; $where["str"] = $query_str; } if ($tiaojian == "zuori") { $query_str = " tp.tm >= '" . $datetime_riqi_zuotian . " 00:00:00' and tp.tm < '" . $datetime_riqi . " 00:00:00' "; $where["str"] = $query_str; } if ($tiaojian == "qianri") { $query_str = " tp.tm >= '" . $datetime_riqi_qiantian . " 00:00:00' and tp.tm < '" . $datetime_riqi_zuotian . " 00:00:00' "; $where["str"] = $query_str; } if ($tiaojian == "fengsuo") { $where["tp.status"] = '2'; } else { $where["tp.status"] = '1'; } $table = new FTable("topic", "tp"); $topics = $table->fields(array("tp.id", "tp.uid", "tp.status", "um.gender", "tp.title", "tp.pics", "tp.tm", "ud.nickname", "ud.province", "ud.city", "tp.picslevel"))->leftJoin("user_detail", "ud", "tp.uid=ud.uid")->leftJoin("user_main", "um", "tp.uid=um.uid")->where($where)->page($page)->limit(20)->order(array("tp.id" => "desc"))->select(); foreach ($topics as &$topic) { $topic_tupian = explode(",", $topic['pics']); $pics = ""; foreach ($topic_tupian as $topic_pics) { if ($topic_pics) { $pics = $pics . CommonUtil::getMoreSizeImg($topic_pics, 100, 100) . ","; } } $topic["pics"] = $pics; } $page_info = $table->getPagerInfo(); $this->assign('page_info', $page_info); $this->assign('topics', $topics); $this->display('admin/user_topicpics_list'); }
/** * 运行socket服务端 */ public function index() { require 'socketConfig.php'; if (!CommonUtil::add_lock('lock')) { //用于判断是否已经开启 die('Running'); } //设置超时时间 ignore_user_abort(true); set_time_limit(0); //修改内存 ini_set('memory_limit', WEBSOCKET_MEMORY); $webSocket = new SocketService(); $webSocket->run(); echo socket_strerror($webSocket->error()); }
public function filterSiteAccess($filterChain) { $actionId = $this->getAction()->getId(); if ($actionId != 'login' && $actionId != 'captcha' && $actionId != 'test' && (Yii::app()->user->isGuest || CommonUtil::getUserStatus(Yii::app()->user->signid) != 0)) { if ($actionId == 'refreshJson') { $this->layout = false; header('Content-type: application/json'); echo "this.location.href='/main/login.do'"; Yii::app()->end(); } $this->redirect("/main/login.do"); } date_default_timezone_set("PRC"); $this->term = CommonUtil::getCachedTerm(); //$auth=Yii::app()->authManager; //if($auth->getRoles(Yii::app()->user->id)) $filterChain->run(); }
/** * 列表 */ function listAction() { // global $_F; // $_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $where = array(); $shanchu_id = FRequest::getInt('shanchu_id'); if ($shanchu_id) { $mumu_bas = new FTable('mumu_ba'); $mumu_bas->where(array('id' => $shanchu_id))->remove(true); } $table = new FTable("mumu_ba"); $mumu_bas = $table->fields(array("id", "title", "text", "pic", "riqi", "position"))->where($where)->page($page)->limit(20)->order(array("id" => "desc"))->select(); foreach ($mumu_bas as &$mumu_ba) { $mumu_ba["pic"] = CommonUtil::getMoreSizeImg($mumu_ba["pic"], 100, 100); } $page_info = $table->getPagerInfo(); $this->assign('page_info', $page_info); $this->assign('mumu_ba', $mumu_bas); $this->display('admin/mumu_ba_list'); }
public function defaultAction() { //global $_F; //$_F["debug"] = true; $table = new FTable("mumu_ba"); $mumu_bas = $table->fields(array("id", "title", "text", "pic", "riqi", "position"))->limit(20)->order(array("position" => "asc", "id" => "desc"))->select(); $domList = array(); foreach ($mumu_bas as &$mumu_ba) { $riqi = explode("-", $mumu_ba["riqi"]); $mumu_ba["pic"] = CommonUtil::getMoreSizeImg($mumu_ba["pic"], 400, 450); $mumu_ba["riqi_nian"] = $riqi[0]; $mumu_ba["riqi_yue"] = $riqi[1]; $mumu_ba["riqi_ri"] = $riqi[2]; $sub_arr = array("height" => "100%", "width" => "100%", "content" => '<div><div style="line-height:30px; text-align:left; padding-left: 20px; font-size: 18px; font-weight: bold;">' . $mumu_ba["title"] . '</div><div style=" text-align:center;"><img src="' . $mumu_ba["pic"] . '"></div><div style="height:100px;overflow: hidden;"><div style="float:left; width:100px; margin-right:10px;"><div style=" line-height:45px;font-size:36px; font-weight:bold; color:#0099FF; text-align:center;">' . $riqi[2] . '</div><div style="line-height:25px; text-align:center;">' . self::NumChinese(intval($riqi[1])) . ' ' . $riqi[0] . '</div></div><div style="line-height:25px;overflow: hidden; padding-right: 15px;">' . $mumu_ba["text"] . '</div></div></div>'); array_push($domList, $sub_arr); } //echo( json_encode($domList)); $this->assign('domList', json_encode($domList)); $this->assign('title', '慕慕语录-慕慕'); $this->display('mumu_ba'); }
function youxiuAction() { //global $_F; //$_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $uid = FRequest::getInt('uid'); $nickname = FRequest::getString('nickname'); $where = array("ud.uid" => array('gte' => '5000000'), "ud.avatarlevel" => 9, "um.stat" => 0); $datetime_riqi_qiantian = date("Y-m-d", time() - 172800); $query_str = " um.reg_time >= '" . $datetime_riqi_qiantian . " 00:00:00' "; $where["str"] = $query_str; $table = new FTable("user_detail", "ud"); $users = $table->fields(array("um.uid", "um.stat", "um.gender", "um.reg_time", "ud.nickname", "ud.avatar", "ud.province", "ud.city", "ud.birthday", "ud.height", "ud.marry", "ud.aboutme"))->leftJoin("user_main", "um", "ud.uid=um.uid")->where($where)->page($page)->limit(100)->order(array("ud.uid" => "desc"))->select(); foreach ($users as &$user) { $user["age"] = CommonUtil::birthdayToAge($user["birthday"]); $user["avatar"] = CommonUtil::getMoreSizeImg($user["avatar"], 50, 50); } $page_info = $table->getPagerInfo(); $this->assign('page_info', $page_info); $this->assign('users', $users); $this->display('admin/user_list_youxiu'); }
function listAction() { //global $_F; //$_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $uid = FRequest::getInt('uid'); $where = array(); if ($uid) { $where["vr.uid"] = $uid; } else { $where["vr.status"] = 0; } $table = new FTable("video_record", "vr"); $users = $table->fields(array("vr.uid", "vr.id", "vr.photos", "vr.status", "vr.tm", "ud.video_img", "ud.nickname", "um.reg_ip", "um.model", "um.sysver"))->leftJoin("user_detail", "ud", "vr.uid=ud.uid")->leftJoin("user_main", "um", "vr.uid=um.uid")->where($where)->page($page)->limit(20)->order(array("vr.id" => "asc"))->select(); foreach ($users as &$user) { $user["video_img"] = CommonUtil::getMoreSizeImg($user["video_img"], 222, 222); } $page_info = $table->getPagerInfo(); $this->assign('page_info', $page_info); $this->assign('users', $users); $this->assign('uid', $uid); $this->display('admin/user_video_record'); }
/** * Gets Message based upon some filters * @param mixed $start The date to start querying from. * @param mixed $end The last possible time in the query. * @param integer $index The number of results to skip from the result set. The default is 0. * @param integer $limit The maximum number of results to return. This has a hard limit of 1000 messages. * @param boolean $pending A true or false value used to indicate if only scheduled messages should be returned in the result set. By default only sent message are returned * @param string $direction Used to filter the result by the direction of the message. Possible values are "in" (to return only inbound messages) and "out" (to return only outbound messages). * @return ApiList|HttpResponse|null * @throws ErrorException */ public function getMessages($start = null, $end = null, $index = null, $limit = null, $pending = null, $direction = null) { $resource = "/messages/"; if (!is_null($start)) { if (!is_int($start) || !is_string($start)) { throw new ErrorException("Parameter 'start' must be an integer Unix timestamp or a string time in this format (YYYY-MM-DD HH:MM:SS)"); } if (is_string($start)) { if (!CommonUtil::is_datetime($time)) { throw new ErrorException("Parameter 'start' must be a string time in this format (YYYY-MM-DD HH:MM:SS)"); } } if (is_int($start) && $start < 0) { throw new ErrorException("Parameter 'start' must be a positive integer"); } } if (!is_null($end)) { if (!is_int($end) || !is_string($end)) { throw new ErrorException("Parameter 'end' must be an integer Unix timestamp or a string time in this format (YYYY-MM-DD HH:MM:SS)"); } if (is_string($end)) { if (!CommonUtil::is_datetime($time)) { throw new ErrorException("Parameter 'end' must be a string time in this format (YYYY-MM-DD HH:MM:SS)"); } } if (is_int($end) && $end < 0) { throw new ErrorException("Parameter 'end' must be a positive integer"); } } if (!is_null($index) && !is_int($index)) { throw new ErrorException("Parameter 'index' must be an integer"); } if (!is_null($limit) && !is_int($limit)) { throw new ErrorException("Parameter 'limit' must be an integer"); } if (!is_null($pending) && (!CommonUtil::is_boolean($pending) || !is_bool($pending))) { throw new ErrorException("Parameter 'pending' must be a boolean (1, 0, true, false)"); } if (!is_null($direction)) { if (!is_string($direction)) { throw new ErrorException("Parameter 'direction' must be string"); } elseif ($direction !== MessageDirection::IN || $direction !== MessageDirection::OUT) { throw new ErrorException("Parameter 'direction' must be string. Possible values are in or out"); } } try { $params = array(); if (!is_null($start)) { $params["start"] = is_string($start) ? $start : gmdate('Y-m-d H:i:s', $start); } if (!is_null($end)) { $params["end"] = is_string($end) ? $end : gmdate('Y-m-d H:i:s', $end); } if (!is_null($index)) { $params["index"] = $index > 0 ? $index : 0; } if (!is_null($limit)) { $params["limit"] = $limit > 0 && $limit <= 1000 ? $limit : 1000; } if (!is_null($pending)) { if ($pending === "true" || $pending || $pending === "1") { $params["pending"] = "true"; } if ($pending === "false" || $pending === false || $pending === "0") { $params["pending"] = "false"; } } if (!is_null($direction)) { $params["direction"] = $direction; } $response = $this->httpClient->get($resource, $params); if ($response instanceof HttpResponse) { if ($response->getStatus() === HttpStatusCode::HTTP_OK) { $json = JsonHelper::getJson($response->getBody()); if (isset($json)) { return new ApiList($json); } } else { return $response; } } } catch (Exception $ex) { echo $ex->getTraceAsString(); } return null; }
function redirectAndExit($url) { CommonUtil::redirect($url); exit(0); }
function get_sign($obj) { try { if (null == $this->partnerkey || "" == $this->partnerkey) { throw new SDKRuntimeException("密钥不能为空!" . "<br>"); } $commonUtil = new CommonUtil(); ksort($obj); $unSignParaString = $commonUtil->formatQueryParaMap($obj, false); $paraString = $commonUtil->formatQueryParaMap($obj, true); return sha1($paraString); } catch (SDKRuntimeException $e) { die($e->errorMessage()); } }
function create_native_package($retcode = 0, $reterrmsg = "ok") { try { if ($this->check_cft_parameters() == false && $retcode == 0) { //如果是正常的返回, 检查财付通的参数 throw new SDKRuntimeException("生成package参数缺失!" . "<br>"); } $nativeObj["AppId"] = $this->appid; $nativeObj["Package"] = $this->get_cft_package(); $nativeObj["TimeStamp"] = time(); $nativeObj["NonceStr"] = $this->create_noncestr(); $nativeObj["RetCode"] = $retcode; $nativeObj["RetErrMsg"] = $reterrmsg; $nativeObj["AppSignature"] = $this->get_biz_sign($nativeObj); $nativeObj["SignMethod"] = SIGNTYPE; $commonUtil = new CommonUtil(); return $commonUtil->arrayToXml($nativeObj); } catch (SDKRuntimeException $e) { die($e->errorMessage()); } }
/** * 图片url加密 * @param $url 图片URL * @param $params 加密参数 */ public static function encodeImgUrl($url, $params = array()) { // 参数为空,则不进行URL加密 if (empty($url)) { return $url; } //$url = Yii::app()->params['imgdomain'].ltrim($url,"/"); // 加密功能是否启动 if (empty($params) || !($params['enable'] === true)) { return $url; } // 图片根目录 $dir = $params['dir']; // 加密密钥 $key = $params['key']; // 加密串过期时间,单位秒 $expiry = (int) $params['expiry']; // 变化密钥的长度,大于0时每次生产的加密串都不同 $ckey_len = (int) $params['ckey_len']; // 加密串前缀 $prefix = $params['prefix']; // 取图片主路径 http://zzz//主目录 $url_tmp = str_replace('http://', '', $url); $pos = stripos($url_tmp, $dir); $signurl = ""; if (!($pos === false)) { $signurl = 'http://' . substr($url_tmp, 0, $pos) . $dir; } // 图片后缀 $suffixPos = strrpos($url, "."); $suffix = ""; if (!($suffixPos === false)) { $suffix = "." . substr($url, $suffixPos + 1); } $sign = CommonUtil::authcode($url, 'ENCODE', $key, $expiry, $ckey_len); // 加密串中 /转换为 !, +转换为 - ,因为/ + 两个特殊字符会影响后续的解码 $sign = str_replace("/", "!", $sign); $sign = str_replace("+", "-", $sign); //$sign = urlencode($sign); // 组合最后的图片URL $signurl = rtrim($signurl, "/") . "/" . $prefix . $sign . $suffix; return $signurl; }
<?php require_once "../inc/init.php"; if (!Session::canAccess(AccessLevels::CONTENT_PROVIDER)) { CommonUtil::redirect("index"); exit(0); }
<?php include_once "WxPayHelper.php"; $commonUtil = new CommonUtil(); $wxPayHelper = new WxPayHelper(); $wxPayHelper->setParameter("bank_type", "WX"); $wxPayHelper->setParameter("body", "test"); $wxPayHelper->setParameter("partner", "1900000109"); $wxPayHelper->setParameter("out_trade_no", $commonUtil->create_noncestr()); $wxPayHelper->setParameter("total_fee", "1"); $wxPayHelper->setParameter("fee_type", "1"); $wxPayHelper->setParameter("notify_url", "htttp://www.baidu.com"); $wxPayHelper->setParameter("spbill_create_ip", "127.0.0.1"); $wxPayHelper->setParameter("input_charset", "GBK"); echo $wxPayHelper->create_app_package("test"); echo "<br>"; echo $wxPayHelper->create_biz_package(); echo "<br>"; echo $wxPayHelper->create_native_package();
/** * 进行临时统计 */ public function doTempReportAction() { $time_str = date("Y-m-d"); $stm = date('Y-m-d 00:00:00', strtotime($time_str)); $time = FRequest::getString("time"); if (CommonUtil::parmIsEmpty($time)) { $time = $stm; } // $time = "2014-11-15 00:00:00"; $sql = "select count(*) as count from user where reg_time > '" . $time . "' "; // 注册人数 $sql2 = "select count(*) as count from user where reg_time > '" . $time . "' and cell_phone>0"; // 注册绑定 $sql3 = "select count(*) as count from user where reg_time > '" . $time . "' and cell_phone>0 and common_status = 1 "; // 注帮领 $sql4 = "select count(*) as count from user where reg_time > '" . $time . "' and cell_phone>0 and common_status = 1 and rename_reward = 2 "; $sql5 = "select count(*) as count from user where reg_time > '" . $time . "' and cell_phone>0 and common_status = 1 and addpic_reward = 2 "; $sql6 = "select count(distinct uid) as count from bid where uid in (select uid from user where reg_time>'" . $time . " and cell_phone>0 and common_status = 1') "; // 领出价 $sql7 = "select count(*) as count from user where reg_time > '" . $time . "' and addpic_reward = 2 "; $sql8 = "select count(*) as count from user where reg_time > '" . $time . "' and rename_reward = 2 "; $sql9 = "select count(distinct uid) as count from bid where uid in (select uid from user where reg_time>'" . $time . "') "; // 领出价 $reg_data = FDB::fetch($sql); $reg_bind_data = FDB::fetch($sql2); $reg_bind_ling = FDB::fetch($sql3); $reg_b_l_rename = FDB::fetch($sql4); $reg_b_l_addpic = FDB::fetch($sql5); $reg_b_l_bid = FDB::fetch($sql6); $reg_rename = FDB::fetch($sql7); $reg_addpic = FDB::fetch($sql8); $reg_bid = FDB::fetch($sql9); $reg_b_l_name_num = $reg_b_l_rename[0]["count"]; $reg_b_l_num = $reg_bind_ling[0]["count"]; $reg_b_l_pic_num = $reg_b_l_addpic[0]["count"]; $reg_b_l_bid_num = $reg_b_l_bid[0]["count"]; echo "注册人数 :" . $reg_data[0]["count"] . " <br>"; echo "注册绑定人数 :" . $reg_bind_data[0]["count"] . " <br>"; echo "注册绑定领取礼包人数 :" . $reg_b_l_num . " <br>"; echo "注改昵称 :" . $reg_rename[0]["count"] . " <br>"; echo "注该头像 :" . $reg_addpic[0]["count"] . " <br>"; echo "注册出价 :" . $reg_bid[0]["count"] . " <br>"; echo "注绑领改昵称 :" . $reg_b_l_name_num . " ----- " . sprintf("%.2f", $reg_b_l_name_num * 100 / $reg_b_l_num) . "% <br>"; echo "注绑领改头像 :" . $reg_b_l_pic_num . " ----- " . sprintf("%.2f", $reg_b_l_pic_num * 100 / $reg_b_l_num) . "% <br>"; echo "注绑领出价 :" . $reg_b_l_bid[0]["count"] . " ----- " . sprintf("%.2f", $reg_b_l_bid_num * 100 / $reg_b_l_num) . "% <br>"; }
<?php include_once "WxPayHelper.php"; $commonUtil = new CommonUtil(); $wxPayHelper = new WxPayHelper(); $user_ip = $_SERVER["REMOTE_ADDR"]; $notify_failed_url = "http://www.inink.cn/mobile/index.php"; $notify_url = "http://www.inink.cn/mobile/user.php"; $out_trade_no = $commonUtil->create_noncestr(); $wx_goods_name = ''; $wxPayHelper->setParameter("bank_type", "WX"); $wxPayHelper->setParameter("body", $wx_goods_name); $wxPayHelper->setParameter("partner", "1218290401"); $wxPayHelper->setParameter("out_trade_no", $out_trade_no); $wxPayHelper->setParameter("total_fee", "1"); $wxPayHelper->setParameter("fee_type", "1"); $wxPayHelper->setParameter("notify_url", $notify_url); $wxPayHelper->setParameter("spbill_create_ip", $user_ip); $wxPayHelper->setParameter("input_charset", "UTF-8"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <head> <meta name="Generator" content="ECSHOP v2.7.3" /> <META content="IE=7.0000" http-equiv="X-UA-Compatible"> <TITLE>微信支付测试</TITLE> <META content="text/html; charset=utf-8" http-equiv=Content-Type> <META name=viewport content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <META name=apple-themes-web-app-capable content=yes>