现金支付插件支持手机+细节优化

feat/task1-c-wallet
gongfuxiang 2021-12-04 20:36:20 +08:00
parent 8170ff07ba
commit 36eccdb4e6
3 changed files with 43 additions and 48 deletions

View File

@ -1186,7 +1186,6 @@ function HexToRgb($hex_color) {
'b' => hexdec(substr($color, 4, 2))
];
} else {
$color = $hex_color;
$r = substr($color, 0, 1) . substr($color, 0, 1);
$g = substr($color, 1, 1) . substr($color, 1, 1);
$b = substr($color, 2, 1) . substr($color, 2, 1);

View File

@ -356,7 +356,7 @@ class OrderService
return $ret;
}
return DataReturn(empty($ret['msg']) ? '支付接口异常' : $ret['msg'], -1);
return DataReturn(empty($ret['msg']) ? '支付接口异常' : $ret['msg'], isset($ret['code']) ? $ret['code'] : -1, isset($ret['data']) ? $ret['data'] : '');
}
/**

View File

@ -124,77 +124,73 @@ class CashPayment
// 是否开启了自定义支付信息
if(!empty($this->config) && isset($this->config['is_custom_pay']) && $this->config['is_custom_pay'] == 1)
{
$html = '<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>支付信息</title>
<style>
body{color:#333;background: #f7f7f7;}
h1 {text-align:center;}
h1,.content {margin-top:50px;}
.content { text-align: left;margin:0 auto;max-width:800px;height:auto;border: 1px solid #e5e5e5;padding: 30px;background:#fff;}
ul {margin:0 0 15px 0;padding:0;background: #fcfcfc;border: 1px solid #eeeeee;}
ul li {list-style-type:none;line-height:42px;font-size:16px;padding: 0 10px;}
ul li:not(:last-child) {border-bottom: 1px solid #f2f2f2;}
.content img {width: 100%;}
.content .tips {margin-bottom: 15px;font-size: 14px;background: #ffddaa;border: 1px solid #ffb342;color: #875100;padding: 5px 10px;line-height: 22px;}
.content .pay-price strong {color:#c00;}
.content .pay-price,.content .tips-time {margin-bottom: 15px;font-size: 16px;line-height: 24px;}
.content .tips-time {color:#2196f3;}
.content .tips-time strong {color:#f00;}
.content .btn-list{text-align: center;padding: 10px 0;margin-top:30px;}
.content .btn-list a:not(:last-child) {margin-right:50px;}
.content .btn-list a {text-decoration: none;background: #666;padding: 5px 10px;border-radius: 2px;color: #fff;}
.content .btn-list a:first-child{background: #d2364c;}
.content .btn-list a:last-child{background: #4caf50;}
</style>
</head>
<body>
<h1>按照以下支付信息进行打款</h1>
<div class="content">';
if(APPLICATION == 'web')
{
$h1_margin = '50px;';
$margin = '50px;';
$padding = '30px;';
$radius = '2px;';
} else {
$h1_margin = '10px;';
$margin = '20px;';
$padding = '10px;';
$radius = '10px;';
}
$html = '<h1 style="text-align:center;margin-top:'.$h1_margin.';">按照以下支付信息进行打款</h1>
<div style="text-align: left;margin:0 auto;max-width:800px;height:auto;border: 1px solid #e5e5e5;padding: '.$padding.';background:#fff;margin-top:'.$margin.'border-radius:'.$radius.'">';
// 文本信息
if(!empty($this->config['content']))
{
$html .= '<ul>';
$html .= '<ul style="margin:0;padding:0;background: #f7f7f7;border: 1px solid #eeeeee;border-radius:'.$radius.'">';
$content = explode("\n", $this->config['content']);
foreach($content as $v)
foreach($content as $k=>$v)
{
$html .= '<li>'.$v.'</li>';
$temp_style = ($k > 0) ? 'border-top: 1px solid #f2f2f2;' : '';
$html .= '<li style="'.$temp_style.'list-style-type:none;line-height:22px;font-size:14px;padding: 5px 10px;">'.$v.'</li>';
}
$html .= '</ul>';
}
// 支付金额
$html .= '<p class="pay-price">打款金额:<strong>¥'.$params['total_price'].'</strong></p>';
$html .= '<p style="margin-top: 15px;font-size: 14px;line-height: 24px;">打款金额:<strong style="color:#c00;">¥'.$params['total_price'].'</strong></p>';
// 备注
$html .= '<p style="margin-top: 5px;font-size: 14px;line-height: 24px;">打款备注:<strong style="color:#2196f3;">'.$params['order_no'].'</strong></p>';
// 订单关闭提示
$order_close_time = time()+((MyC('common_order_close_limit_time', 30, true)-5)*60);
$html .= '<p class="tips-time">订单预计[ <strong>'.date('m月d号H点i分', $order_close_time).'</strong> ]自动关闭、请尽快完成支付,打款备注:<strong>'.$params['order_no'].'</strong></p>';
$html .= '<div style="margin-top: 15px;"><p style="color:#d39e00;font-size: 14px;line-height: 24px;">订单预计[ <span style="color:#ff5722;">'.date('m月d号H点i分', $order_close_time).'</span> ]自动关闭、请尽快完成支付!</p></div>';
// 特别提示文字
if(!empty($this->config['tips']))
{
$html .= '<p class="tips">'.$this->config['tips'].'</p>';
$html .= '<p class="tips" style="margin-top: 15px;font-size: 14px;background: #ffddaa;border: 1px solid #ffb342;color: #875100;padding: 5px 10px;line-height: 22px;border-radius:'.$radius.'">'.$this->config['tips'].'</p>';
}
// 图片信息
if(!empty($this->config['images_url']))
{
$html .= '<img src="'.$this->config['images_url'].'" alt="支付信息" />';
$html .= '<div style="margin-top: 15px;"><img src="'.$this->config['images_url'].'" alt="支付信息" style="width: 100%;" /></div>';
}
// 导航入口
$home_url = __MY_URL__;
$order_url = MyUrl('index/order/index');
$html .= '<div class="btn-list"><a href="'.$home_url.'">回到首页</a><a href="'.$order_url.'">进入我的订单</a></div>';
$html .= '</div>
</body>
</html>';
if(APPLICATION == 'web')
{
$home_url = __MY_URL__;
$order_url = MyUrl('index/order/index');
$html .= '<div style="text-align: center;padding: 10px 0;margin-top:30px;"><a href="'.$home_url.'" style="text-decoration: none;background: #666;padding: 5px 10px;border-radius: 2px;color: #fff;background: #d2364c;">回到首页</a><a href="'.$order_url.'" style="text-decoration: none;background: #666;padding: 5px 10px;border-radius: 2px;color: #fff;background: #4caf50;margin-left:50px;">进入我的订单</a></div>';
$html .= '</div>';
}
die($html);
// app则返回固定错误码和html代码、返回固定错误码
if(APPLICATION == 'app')
{
return DataReturn('success', -6666, $html);
}
// web端直接输出html
die('<!DOCTYPE html><html><head><meta charset="utf-8"><title>支付信息</title></head><body style="color: #333;background: #f7f7f7;">'.$html.'</body></html>');
}
// 默认方式
@ -202,7 +198,7 @@ class CashPayment
$url .= 'out_trade_no='.$params['order_no'];
$url .= '&subject='.$params['name'];
$url .= '&total_price='.$params['total_price'];
return DataReturn('处理成功', 0, $url);
return DataReturn('success', 0, $url);
}
/**
@ -216,7 +212,7 @@ class CashPayment
*/
public function Respond($params = [])
{
return DataReturn('处理成功', 0, $params);
return DataReturn('success', 0, $params);
}
}
?>