对于微赞的智慧拼团的退款代码分析

微赞中有一个智慧拼团这两天用了一下,其中遇到了一些问题,在这里简单记录一下
退款的URL代码分析一下
web/index.php?c=site&a=entry&m=feng_fightgroups&do=order&ac=order&op=refund&&id=24
a代表了去entry这个控制器去中执行
m代表了是哪个模块
do代表了是调用site哪个函数
ac,op为附加参数与微赞的框架没有关系是模块自己定义的

op代表了operation

site.php调用了魔术方法,这个方法中实现了前台的页面调用去本目录下的app中去调用index.php ,后台的管理调用web目录下的文件

	public function __call($name, $arguments) {
		global $_W;
		$isWeb = stripos($name, 'doWeb') === 0;
		$isMobile = stripos($name, 'doMobile') === 0;
		if($isWeb || $isMobile) {
			$dir = IA_ROOT . '/addons/' . $this->modulename . '/';
			if($isWeb) {
				$dir .= 'web/';
				$controller = strtolower(substr($name, 5));
			}
			if($isMobile) {
				$dir .= 'app/';
				$controller = strtolower(substr($name, 8));
			}
			$file = $dir . 'index.php';
			if(file_exists($file)) {
				require $file;
				exit;
			}
		}
		trigger_error("访问的方法 {$name} 不存在.", E_USER_WARNING);
		return null;
	}



index.php中跳转到对应的order.ctrl.php中,在文件中根据$op 的值进行执行操作


if($op=='refund'){
	$id = $_GPC['id'];
	$item = pdo_fetch("SELECT * FROM " . tablename('tg_order') . " WHERE id = :id", array(':id' => $id));
	$orderno = $item['orderno'];
	$res=refund($orderno,2);
	if($res=='success'){
		$oplogdata = serialize($item);
		oplog('admin', "后台订单详情退款", web_url('order/order/refund'), $oplogdata);
		/*退款成功消息提醒*/
		$url = app_url('order/order/detail', array('id' => $item['id']));
		refund_success($item['openid'],  $item['price'], $url);
		message('退款成功了!', referer(), 'success');
	} else {
		message('退款失败,服务器正忙,请稍等等!', referer(), 'fail');
	}
}



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值