微赞中有一个智慧拼团这两天用了一下,其中遇到了一些问题,在这里简单记录一下
退款的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为附加参数与微赞的框架没有关系是模块自己定义的
退款的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;
}
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');
}
}