您的位置:首页 > 运维架构

opensns转发行为模拟

2016-05-16 21:28 246 查看

第一步:实现简单的在源函数修改

转发行为包括:源微博id(即如果该微博本来就是转发的微博,那么该id是转发的源头),现被转发微博id(当前微博id),微博content。初级实现方法:IndexController.class.php文件中sendrepost方法,
public function sendrepost() {
$aSourceId = I ( 'get.sourceId', 0, 'intval' );
$aWeiboId = I ( 'get.weiboId', 0, 'intval' );

// 		$aSourceId = 121;
// 		$aWeiboId = 121;

$weiboModel = D ( 'Weibo' );
$result = $weiboModel->getWeiboDetail ( $aSourceId );

$this->assign ( 'sourceWeibo', $result );
$weiboContent = '';
if ($aSourceId != $aWeiboId) {//$aSourceId:源微博id ; $aWeiboId:当前被转发微博id
$weibo1 = $weiboModel->getWeiboDetail ( $aWeiboId );
$weiboContent = '//@' . $weibo1 ['user'] ['nickname'] . ' :' . $weibo1 ['content'];
// 			$weiboContent = '自己写的,作为标志';
}
$this->assign ( 'weiboId', $aWeiboId );
$this->assign ( 'weiboContent', $weiboContent );
$this->assign ( 'sourceId', $aSourceId );

$this->display ();
}
其中注释部分就是修改的部分,初级修改可以实现按照给定的微博id(即121)给定的weibocontent,然后现在实现的是无论点击哪个位置的转发,都是根据设定好的sourceId和WeiboId转发博文。
$weiboContent = '自己写的,作为标志';
<span style="font-size:14px;color:#FF0000;">第二步:</span><span style="font-size:14px;color:#FF0000;">实现了增加转发页面,具有一个正常转发页面,一个模拟转发页面</span>
实现逻辑:
index1.html(最后应改为inrepost)页面(index.html后台部分在IndexController.class.php的index函数,里面有widget组建中的WeiboDetail.class.php),
其中include loadweibo.html,(而loadweibo有两个实现部分,一个是loadweibo.html负责前端展示,一个是IndexController.class.php负责数据后端处理),
loadweibo.html中指向了weibo文件夹下的widget组建下的WeiboDetailWidget.class.php,WeiboDetailWidget.class.php文件里面有两个方法,detail和weibo_html方法,
此处的detail方法指向了view文件夹下的default文件夹下的Widget文件夹下的detail.html,(里面指向index文件weibodetail.html和_operation.html,
其中weibodetail也指向_operation.html),然后就进入_operation.html,_operation.html文件内部指向index文件sendrepost.html,sendrepost.html后台处理文件在
IndexController.class.php有sendrepost方法,其中sendrepost.html文件内部指向doSendRepost.html(其实没有这个文件,这个文件是在点击转发后的弹窗形式),
然后在IndexController.class.php的dosendrepost方法做修改)。
具体方法:
1.index:

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: