本文整理匯總了PHP中CommonUtil類的典型用法代碼示例。如果您正苦於以下問題:PHP CommonUtil類的具體用法?PHP CommonUtil怎麽用?PHP CommonUtil使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了CommonUtil類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create_hongbao_xml
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());
}
}
示例2: addAction
/**
* 添加焦點圖
*/
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');
}
示例3: listAction
/**
* 活動列表
*/
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');
}
示例4: createRefundOrder
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;
}
示例5: excecuteCommand
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;
}
示例6: listAction
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');
}
示例7: listAction
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');
}
示例8: listAction
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');
}
示例9: listAction
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');
}
示例10: createForUser
/**
* @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;
}
示例11: list2Action
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');
}
示例12: defaultAction
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');
}
示例13: defaultAction
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');
}
示例14: getCityId
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;
}
示例15: listAction
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');
}