本文整理匯總了PHP中Node::action方法的典型用法代碼示例。如果您正苦於以下問題:PHP Node::action方法的具體用法?PHP Node::action怎麽用?PHP Node::action使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Node
的用法示例。
在下文中一共展示了Node::action方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: order_success_after
/**
* 訂單成功後的操作,如送分、送票等
*
* @param integer $order_id
*/
static function order_success_after($order_id)
{
if (empty($order_id)) {
return false;
}
$oinfo = D()->get_one("SELECT `user_id`,`player_id`,`goods_type`,`goods_amount` FROM {order_info} WHERE `order_id`=%d", $order_id);
//送花/吻等付費操作
if (!empty($oinfo)) {
Node::action($oinfo['goods_type'], $oinfo['player_id'], $oinfo['user_id'], $oinfo['goods_amount']);
}
}
示例2: vote
/**
* 投票操作
*
* @param Request $request
* @param Response $response
*/
function vote(Request $request, Response $response)
{
if ($request->is_post()) {
//提交數據
$player_id = $request->post('player_id', 0);
$token = $request->post('token', '');
$res = ['flag' => 'FAIL', 'msg' => ''];
if (empty($player_id)) {
$res['msg'] = 'player_id empty';
$response->sendJSON($res);
}
$uid = $GLOBALS['user']->uid;
if (empty($uid)) {
$res['msg'] = '您沒登錄,請先在微信端登錄';
$response->sendJSON($res);
}
$maybe_spam = $request->is_token_post() ? 0 : 1;
$ret = Node::action('vote', $player_id, $uid, 1, FALSE, FALSE, ['maybe_spam' => $maybe_spam]);
if ($ret >= 0) {
$time_from = 0;
$vote_field = 'votecnt';
$player_info = Match_Model::getPlayerInfo($player_id);
if ($player_info['stage'] > 0) {
$time_from = Node::getMatchStageTime($player_info['match_id']);
$vote_field = Node::getVoteFiled($player_info['stage']);
}
//返回當前player總投票數(包括flower加權)
$votedcnt = $player_info[$vote_field];
//返回當前player投票數
$votedcnt_single = Node::getActionNum($player_id, 'vote', $time_from);
$res['flag'] = 'SUC';
$res['msg'] = "投票成功!";
$res['votedcnt'] = $votedcnt;
$res['votedcnt_single'] = $votedcnt_single;
if ($ret > 0) {
$res['msg'] .= "您今天還可以投<em style=\"color:red\">{$ret}</em>票!";
} else {
//您已投票成功!請關注大賽微信公眾平台帳號:FEOfeel,隨時關注比賽動態
$res['msg'] .= '您今天的票數已用完,明天再來,還可以給女神<em style="color:red">送花</em>或為其他女神投票哦~';
}
$response->sendJSON($res);
} else {
if (-11 == $ret) {
$res['msg'] = '票數已用完,明天再來,還可以給女神<em style="color:red">送花</em>或為其他女神投票哦~';
} elseif (-12 == $ret) {
$res['msg'] = '連續投票時間間隔要在2小時以上';
} elseif (-13 == $ret) {
$res['msg'] = '投票太頻繁,請稍後再試';
} elseif (-14 == $ret) {
$res['msg'] = '本次大賽投票已截止,感謝您的關注';
} else {
$res['msg'] = '發生未知錯誤';
}
$response->sendJSON($res);
}
}
}
示例3: array
<?php
if ($_GET['page'] == 'content/delete-page' && is_numeric($_POST['id'])) {
$type = Content::getType($_POST['id']);
$res = Node::action('delete', $type, array($_POST['id']));
if ($res !== false) {
echo Message::success(__('admin', 'page-delete-success'));
exit;
}
var_dump($res);
exit;
}
示例4: player_edit
/**
* action 'player_edit'
* @param Request $request
* @param Response $response
*/
public function player_edit(Request $request, Response $response)
{
if ($request->is_post()) {
$ret = ['flag' => 'ERR', 'msg' => ''];
$player_id = $request->post('player_id', 0);
$truename = $request->post('truename', '');
$mobile = $request->post('mobile', '');
$weixin = $request->post('weixin', '');
$idcard = $request->post('idcard', '');
$video = $request->post('video', '');
$province = $request->post('province', 0);
$city = $request->post('city', 0);
$inc_vote = $request->post('inc_vote', 0);
$inc_flower = $request->post('inc_flower', 0);
$cover_pic_id = $request->post('cover_pic_id', 0);
$imgs = $request->post('imgs', []);
$player_info = Member_Model::getPlayerInfo($player_id);
if (empty($player_info)) {
$ret['msg'] = '參賽者不存在';
$response->sendJSON($ret);
}
$uid = 10000;
//10000 為係統管理員帳號
$ret['flag'] = 'SUC';
$ret['msg'] = '更新成功';
$data = ['cover_pic_id' => $cover_pic_id];
if ('' != $truename) {
$data['truename'] = $truename;
}
if ('' != $mobile) {
$data['mobile'] = $mobile;
}
if ('' != $weixin) {
$data['weixin'] = $weixin;
}
if ('' != $idcard && strlen($idcard) <= 18) {
$data['idcard'] = $idcard;
}
if ('' != $video && preg_match('/^http(s?):\\/\\//', $video)) {
$data['video'] = $video;
}
//將省份、城市平均成: "40:北京"這樣的結構
if ($province) {
$loc = Member_Model::getLocationName($province);
if ($loc) {
$province = $province . ':' . $loc;
}
} else {
$province = '';
}
if ($city) {
$loc = Member_Model::getLocationName($city);
if ($loc) {
$city = $city . ':' . $loc;
}
} else {
$city = '';
}
$data['province'] = $province;
$data['city'] = $city;
//更新pic_cover_id
D()->update("player", $data, ['player_id' => $player_id]);
//更新圖片
if (!empty($imgs) && is_array($imgs)) {
//! 務必檢查嚴格
$imgs_idstr = implode(',', $imgs);
$existed_rids = D()->from("player_gallery")->where("`rid` IN(%s)", $imgs_idstr)->select("`rid`")->fetch_column('rid');
if (!empty($existed_rids)) {
//! 務必檢查嚴格,否則容易出現丟失圖片數據
//先將原有的記錄的player_id設為0
D()->query("UPDATE `{player_gallery}` SET `old_player_id`=`player_id`,`player_id`=0 WHERE `player_id`=%d", $player_id);
//緊接著重新關聯新的記錄
D()->query("UPDATE `{player_gallery}` SET `player_id`=%d,`old_player_id`=%d WHERE `rid` IN(%s)", $player_id, $player_id, $imgs_idstr);
//更新排序
$o = 1;
foreach ($imgs as $rid) {
D()->query("UPDATE `{player_gallery}` SET `sortorder`=%d WHERE `rid`=%d", $o, $rid);
$o++;
}
}
}
if ($inc_vote) {
$action_id = Node::action('vote', $player_id, $uid, $inc_vote, TRUE, FALSE, ['from' => 'admin']);
$ret['msg'] .= ',增加了' . $inc_vote . '票';
}
if ($inc_flower) {
$action_id = Node::action('flower', $player_id, $uid, $inc_flower);
$ret['msg'] .= ',增加了' . $inc_flower . '花';
}
$response->sendJSON($ret);
} else {
// GET request
$this->_nav_second = 'player';
$this->v->set_tplname('mod_member_player_edit');
// Player Info
//.........這裏部分代碼省略.........
示例5: nodeDisplay
public static function nodeDisplay($action, $type, $row)
{
return Node::action($action, $type, array($row));
}