mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-12-03 04:19:37 +08:00
订单管理
This commit is contained in:
parent
d198c9e3f4
commit
04eb9aa61c
@ -73,6 +73,12 @@ class OrderController extends CommonController
|
|||||||
// 快递公司
|
// 快递公司
|
||||||
$this->assign('express_list', ResourcesService::ExpressList());
|
$this->assign('express_list', ResourcesService::ExpressList());
|
||||||
|
|
||||||
|
// 发起支付 - 支付方式
|
||||||
|
$pay_where = [
|
||||||
|
'where' => ['is_enable'=>1, 'is_open_user'=>1, 'payment'=>['in', C('under_line_list')]],
|
||||||
|
];
|
||||||
|
$this->assign('buy_payment_list', ResourcesService::BuyPaymentList($pay_where));
|
||||||
|
|
||||||
// 参数
|
// 参数
|
||||||
$this->assign('param', $param);
|
$this->assign('param', $param);
|
||||||
|
|
||||||
@ -311,5 +317,22 @@ class OrderController extends CommonController
|
|||||||
$ret = OrderService::OrderConfirm($params);
|
$ret = OrderService::OrderConfirm($params);
|
||||||
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
|
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单支付
|
||||||
|
* @author Devil
|
||||||
|
* @blog http://gong.gg/
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2018-09-28
|
||||||
|
* @desc description
|
||||||
|
*/
|
||||||
|
public function Pay()
|
||||||
|
{
|
||||||
|
$params = $_POST;
|
||||||
|
$params['user'] = $this->admin;
|
||||||
|
$params['user']['user_name_view'] = L('common_admin_name').':'.$this->admin['username'];
|
||||||
|
$ret = OrderService::AdminPay($params);
|
||||||
|
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
@ -66,10 +66,11 @@ class PayLogController extends CommonController
|
|||||||
$this->assign('common_gender_list', L('common_gender_list'));
|
$this->assign('common_gender_list', L('common_gender_list'));
|
||||||
|
|
||||||
// 支付日志类型
|
// 支付日志类型
|
||||||
$this->assign('common_pay_type_list', L('common_pay_type_list'));
|
$pay_list = $m->field('payment AS id, payment_name AS name')->group('payment')->select();
|
||||||
|
$this->assign('common_pay_type_list', $pay_list);
|
||||||
|
|
||||||
// 业务类型
|
// 业务类型
|
||||||
$this->assign('common_business_type_list', L('common_business_type_list'));
|
$this->assign('common_busines_type_list', L('common_busines_type_list'));
|
||||||
|
|
||||||
// 参数
|
// 参数
|
||||||
$this->assign('param', $param);
|
$this->assign('param', $param);
|
||||||
@ -96,15 +97,11 @@ class PayLogController extends CommonController
|
|||||||
if(!empty($data))
|
if(!empty($data))
|
||||||
{
|
{
|
||||||
$common_gender_list = L('common_gender_list');
|
$common_gender_list = L('common_gender_list');
|
||||||
$common_pay_type_list = L('common_pay_type_list');
|
$common_busines_type_list = L('common_busines_type_list');
|
||||||
$common_business_type_list = L('common_business_type_list');
|
|
||||||
foreach($data as &$v)
|
foreach($data as &$v)
|
||||||
{
|
{
|
||||||
// 支付日志类型
|
|
||||||
$v['pay_type_text'] = $common_pay_type_list[$v['pay_type']]['name'];
|
|
||||||
|
|
||||||
// 业务类型
|
// 业务类型
|
||||||
$v['business_type_text'] = $common_business_type_list[$v['business_type']]['name'];
|
$v['busines_type_text'] = $common_busines_type_list[$v['busines_type']]['name'];
|
||||||
|
|
||||||
// 性别
|
// 性别
|
||||||
$v['gender_text'] = $common_gender_list[$v['gender']]['name'];
|
$v['gender_text'] = $common_gender_list[$v['gender']]['name'];
|
||||||
@ -144,13 +141,13 @@ class PayLogController extends CommonController
|
|||||||
if(I('is_more', 0) == 1)
|
if(I('is_more', 0) == 1)
|
||||||
{
|
{
|
||||||
// 等值
|
// 等值
|
||||||
if(I('pay_type', -1) > -1)
|
if(!empty($_REQUEST['pay_type']))
|
||||||
{
|
{
|
||||||
$where['p.pay_type'] = intval(I('pay_type', 0));
|
$where['p.payment'] = I('pay_type');
|
||||||
}
|
}
|
||||||
if(I('business_type', -1) > -1)
|
if(I('busines_type', -1) > -1)
|
||||||
{
|
{
|
||||||
$where['p.business_type'] = intval(I('business_type', 0));
|
$where['p.busines_type'] = intval(I('busines_type', 0));
|
||||||
}
|
}
|
||||||
if(I('gender', -1) > -1)
|
if(I('gender', -1) > -1)
|
||||||
{
|
{
|
||||||
|
@ -577,8 +577,13 @@ require './ThinkPHP/ThinkPHP.php';
|
|||||||
?>
|
?>
|
||||||
php;
|
php;
|
||||||
$name = strtolower($v['name']);
|
$name = strtolower($v['name']);
|
||||||
@file_put_contents(ROOT_PATH.'payment_'.$name.'_'.strtolower($payment).'_notify.php', $notify);
|
|
||||||
@file_put_contents(ROOT_PATH.'payment_'.$name.'_'.strtolower($payment).'_respond.php', $respond);
|
@file_put_contents(ROOT_PATH.'payment_'.$name.'_'.strtolower($payment).'_respond.php', $respond);
|
||||||
|
|
||||||
|
// 线下支付不生成异步入口文件
|
||||||
|
if(!in_array($payment, C('under_line_list')))
|
||||||
|
{
|
||||||
|
@file_put_contents(ROOT_PATH.'payment_'.$name.'_'.strtolower($payment).'_notify.php', $notify);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,5 +36,9 @@ return array(
|
|||||||
'order_preferential_price_text' => '优惠',
|
'order_preferential_price_text' => '优惠',
|
||||||
'order_total_price_text' => '总价',
|
'order_total_price_text' => '总价',
|
||||||
'order_pay_price_text' => '支付',
|
'order_pay_price_text' => '支付',
|
||||||
|
|
||||||
|
'order_pay_popup_title' => '支付操作',
|
||||||
|
'order_business_pay_title' => '选择支付',
|
||||||
|
'order_payment_not_data_tips' => '没有支付方式',
|
||||||
);
|
);
|
||||||
?>
|
?>
|
@ -14,7 +14,7 @@ return array(
|
|||||||
|
|
||||||
'paylog_user_name' => '用户信息',
|
'paylog_user_name' => '用户信息',
|
||||||
'paylog_pay_type_name' => '支付类型',
|
'paylog_pay_type_name' => '支付类型',
|
||||||
'paylog_business_type_name' => '业务类型',
|
'paylog_busines_type_name' => '业务类型',
|
||||||
'paylog_order_id_name' => '业务订单id',
|
'paylog_order_id_name' => '业务订单id',
|
||||||
'paylog_trade_no_name' => '支付平台交易号',
|
'paylog_trade_no_name' => '支付平台交易号',
|
||||||
'paylog_platform_user_name' => '支付平台用户帐号',
|
'paylog_platform_user_name' => '支付平台用户帐号',
|
||||||
|
@ -214,6 +214,9 @@
|
|||||||
<td class="view-operation">
|
<td class="view-operation">
|
||||||
<if condition="in_array($v['status'], [0,1])">
|
<if condition="in_array($v['status'], [0,1])">
|
||||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-paint-brush am-btn-block submit-ajax" data-url="{{:U('Admin/Order/Cancel')}}" data-id="{{$v.id}}" data-value="{{$v.user_id}}" data-view="reload" data-msg="{{:L('common_cancel_tips')}}"> {{:L('common_operation_cancel')}}</button>
|
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-paint-brush am-btn-block submit-ajax" data-url="{{:U('Admin/Order/Cancel')}}" data-id="{{$v.id}}" data-value="{{$v.user_id}}" data-view="reload" data-msg="{{:L('common_cancel_tips')}}"> {{:L('common_operation_cancel')}}</button>
|
||||||
|
<if condition="in_array($v['status'], [1])">
|
||||||
|
<button class="am-btn am-btn-default am-btn-xs am-radius am-btn-block submit-pay" data-id="{{$v.id}}" data-payment-id="{{$v.payment_id}}" data-am-modal="{target: '#order-pay-popup'}">{{:L('common_operation_pay')}}</button>
|
||||||
|
</if>
|
||||||
</if>
|
</if>
|
||||||
<if condition="$v['status'] eq 2">
|
<if condition="$v['status'] eq 2">
|
||||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-send-o am-btn-block submit-delivery" data-url="{{:U('Admin/Order/Delivery')}}" data-id="{{$v.id}}" data-user-id="{{$v.user_id}}" data-express-id="{{$v.express_id}}" data-am-modal="{target: '#order-delivery-popup'}"> {{:L('common_delivery_submit')}}</button>
|
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-send-o am-btn-block submit-delivery" data-url="{{:U('Admin/Order/Delivery')}}" data-id="{{$v.id}}" data-user-id="{{$v.user_id}}" data-express-id="{{$v.express_id}}" data-am-modal="{target: '#order-delivery-popup'}"> {{:L('common_delivery_submit')}}</button>
|
||||||
@ -237,49 +240,89 @@
|
|||||||
<!-- 发货弹窗 -->
|
<!-- 发货弹窗 -->
|
||||||
<div class="am-popup" id="order-delivery-popup">
|
<div class="am-popup" id="order-delivery-popup">
|
||||||
<div class="am-popup-inner">
|
<div class="am-popup-inner">
|
||||||
<div class="am-popup-hd">
|
<div class="am-popup-hd">
|
||||||
<h4 class="am-popup-title">{{:L('order_delivery_popup_title')}}</h4>
|
<h4 class="am-popup-title">{{:L('order_delivery_popup_title')}}</h4>
|
||||||
<span data-am-modal-close class="am-close">×</span>
|
<span data-am-modal-close class="am-close">×</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="am-popup-bd">
|
<div class="am-popup-bd">
|
||||||
<form class="am-form form-validation delivery-form" method="post" action="{{:U('Admin/Order/Delivery')}}" request-type="ajax-reload">
|
<form class="am-form form-validation delivery-form" method="post" action="{{:U('Admin/Order/Delivery')}}" request-type="ajax-reload">
|
||||||
<!-- 支付方式 -->
|
<!-- 支付方式 -->
|
||||||
<div class="business-item">
|
<div class="business-item">
|
||||||
<h3>{{:L('order_business_express_title')}}</h3>
|
<h3>{{:L('order_business_express_title')}}</h3>
|
||||||
<notempty name="express_list">
|
<notempty name="express_list">
|
||||||
<ul class="express-list" data-type="express">
|
<ul class="express-list" data-type="express">
|
||||||
<foreach name="express_list" item="express">
|
<foreach name="express_list" item="express">
|
||||||
<if condition="$express.is_enable eq 1">
|
<if condition="$express.is_enable eq 1">
|
||||||
<li class="express-items-{{$express.id}}" data-value="{{$express.id}}">
|
<li class="express-items-{{$express.id}}" data-value="{{$express.id}}">
|
||||||
<notempty name="express.icon">
|
<notempty name="express.icon">
|
||||||
<img src="{{$express.icon}}" />
|
<img src="{{$express.icon}}" />
|
||||||
</notempty>
|
</notempty>
|
||||||
<span>{{$express.name}}</span>
|
<span>{{$express.name}}</span>
|
||||||
<i class="icon-active"></i>
|
<i class="icon-active"></i>
|
||||||
</li>
|
</li>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</ul>
|
</ul>
|
||||||
</notempty>
|
</notempty>
|
||||||
<empty name="express_list">
|
<empty name="express_list">
|
||||||
<div class="table-no"><i class="am-icon-warning"></i> {{:L('order_express_not_data_tips')}}</div>
|
<div class="table-no"><i class="am-icon-warning"></i> {{:L('order_express_not_data_tips')}}</div>
|
||||||
</empty>
|
</empty>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="am-form-group">
|
<div class="am-form-group">
|
||||||
<label>{{:L('order_express_number_text')}}</label>
|
<label>{{:L('order_express_number_text')}}</label>
|
||||||
<input type="text" name="express_number" placeholder="{{:L('order_express_number_text')}}" minlength="1" data-validation-message="{{:L('order_express_number_format')}}" class="am-radius" required />
|
<input type="text" name="express_number" placeholder="{{:L('order_express_number_text')}}" minlength="1" data-validation-message="{{:L('order_express_number_format')}}" class="am-radius" required />
|
||||||
</div>
|
</div>
|
||||||
<div class="am-form-group">
|
<div class="am-form-group">
|
||||||
<input type="hidden" name="id" value="0" />
|
<input type="hidden" name="id" value="0" />
|
||||||
<input type="hidden" name="express_id" value="0" />
|
<input type="hidden" name="express_id" value="0" />
|
||||||
<input type="hidden" name="user_id" value="0" />
|
<input type="hidden" name="user_id" value="0" />
|
||||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'{{:L('common_form_loading_tips')}}'}">{{:L('common_operation_confirm')}}</button>
|
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'{{:L('common_form_loading_tips')}}'}">{{:L('common_operation_confirm')}}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 支付弹窗 -->
|
||||||
|
<div class="am-popup" id="order-pay-popup">
|
||||||
|
<div class="am-popup-inner">
|
||||||
|
<div class="am-popup-hd">
|
||||||
|
<h4 class="am-popup-title">{{:L('order_pay_popup_title')}}</h4>
|
||||||
|
<span data-am-modal-close class="am-close">×</span>
|
||||||
|
</div>
|
||||||
|
<div class="am-popup-bd">
|
||||||
|
<form class="am-form form-validation-pay pay-form" action="{{:U('Admin/Order/Pay')}}" method="POST" request-type="ajax-reload">
|
||||||
|
<!-- 支付方式 -->
|
||||||
|
<div class="business-item">
|
||||||
|
<h3>{{:L('order_business_pay_title')}}</h3>
|
||||||
|
<notempty name="buy_payment_list">
|
||||||
|
<ul class="payment-list" data-type="payment">
|
||||||
|
<foreach name="buy_payment_list" item="payment">
|
||||||
|
<li class="payment-items-{{$payment.id}}" data-value="{{$payment.id}}">
|
||||||
|
<notempty name="payment.logo">
|
||||||
|
<img src="{{$payment.logo}}" />
|
||||||
|
</notempty>
|
||||||
|
<span>{{$payment.name}}</span>
|
||||||
|
<i class="icon-active"></i>
|
||||||
|
</li>
|
||||||
|
</foreach>
|
||||||
|
</ul>
|
||||||
|
</notempty>
|
||||||
|
<empty name="buy_payment_list">
|
||||||
|
<div class="table-no"><i class="am-icon-warning"></i> {{:L('order_payment_not_data_tips')}}</div>
|
||||||
|
</empty>
|
||||||
|
</div>
|
||||||
|
<div class="am-form-group">
|
||||||
|
<input type="hidden" name="id" value="0" />
|
||||||
|
<input type="hidden" name="payment_id" value="0" />
|
||||||
|
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'{{:L('common_form_loading_tips')}}'}">{{:L('common_operation_confirm')}}</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- page start -->
|
<!-- page start -->
|
||||||
<if condition="!empty($list)">
|
<if condition="!empty($list)">
|
||||||
{{$page_html}}
|
{{$page_html}}
|
||||||
|
@ -22,15 +22,17 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
<select name="pay_type" class="am-radius c-p m-t-10 m-l-5 param-where">
|
<select name="pay_type" class="am-radius c-p m-t-10 m-l-5 param-where">
|
||||||
<option value="-1">{{:L('paylog_pay_type_name')}}</option>
|
<option value="">{{:L('paylog_pay_type_name')}}</option>
|
||||||
<foreach name="common_pay_type_list" item="v">
|
<foreach name="common_pay_type_list" item="v">
|
||||||
<option value="{{$v.id}}" <if condition="isset($param['pay_type']) and $param['pay_type'] eq $v['id']">selected</if>>{{$v.name}}</option>
|
<if condition="!empty($v['id']) && !empty($v['name'])">
|
||||||
|
<option value="{{$v.id}}" <if condition="isset($param['pay_type']) and $param['pay_type'] eq $v['id']">selected</if>>{{$v.name}}</option>
|
||||||
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
<select name="business_type" class="am-radius c-p m-t-10 m-l-5 param-where">
|
<select name="busines_type" class="am-radius c-p m-t-10 m-l-5 param-where">
|
||||||
<option value="-1">{{:L('paylog_business_type_name')}}</option>
|
<option value="-1">{{:L('paylog_busines_type_name')}}</option>
|
||||||
<foreach name="common_business_type_list" item="v">
|
<foreach name="common_busines_type_list" item="v">
|
||||||
<option value="{{$v.id}}" <if condition="isset($param['business_type']) and $param['business_type'] eq $v['id']">selected</if>>{{$v.name}}</option>
|
<option value="{{$v.id}}" <if condition="isset($param['busines_type']) and $param['busines_type'] eq $v['id']">selected</if>>{{$v.name}}</option>
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
<div class="param-date param-where m-l-5">
|
<div class="param-date param-where m-l-5">
|
||||||
@ -49,7 +51,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>{{:L('paylog_user_name')}}</th>
|
<th>{{:L('paylog_user_name')}}</th>
|
||||||
<th>{{:L('paylog_pay_type_name')}}</th>
|
<th>{{:L('paylog_pay_type_name')}}</th>
|
||||||
<th>{{:L('paylog_business_type_name')}}</th>
|
<th>{{:L('paylog_busines_type_name')}}</th>
|
||||||
<th class="am-hide-sm-only">{{:L('paylog_order_id_name')}}</th>
|
<th class="am-hide-sm-only">{{:L('paylog_order_id_name')}}</th>
|
||||||
<th class="am-hide-sm-only">{{:L('paylog_trade_no_name')}}</th>
|
<th class="am-hide-sm-only">{{:L('paylog_trade_no_name')}}</th>
|
||||||
<th class="am-hide-sm-only">{{:L('paylog_platform_user_name')}}</th>
|
<th class="am-hide-sm-only">{{:L('paylog_platform_user_name')}}</th>
|
||||||
@ -77,10 +79,10 @@
|
|||||||
{{$v.gender_text}}
|
{{$v.gender_text}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<if condition="empty($v['pay_type_text'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.pay_type_text}}</if>
|
<if condition="empty($v['payment_name'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.payment_name}}</if>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<if condition="empty($v['business_type_text'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.business_type_text}}</if>
|
<if condition="empty($v['busines_type_text'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.busines_type_text}}</if>
|
||||||
</td>
|
</td>
|
||||||
<td class="am-hide-sm-only">
|
<td class="am-hide-sm-only">
|
||||||
<if condition="empty($v['order_id'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.order_id}}</if>
|
<if condition="empty($v['order_id'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.order_id}}</if>
|
||||||
|
@ -129,4 +129,7 @@ return array(
|
|||||||
'payment_business_type_all' => [
|
'payment_business_type_all' => [
|
||||||
['name' => 'Order', 'desc' => '订单'],
|
['name' => 'Order', 'desc' => '订单'],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// 线下支付方式
|
||||||
|
'under_line_list' => ['CashPayment', 'DeliveryPayment'],
|
||||||
);
|
);
|
@ -160,6 +160,7 @@ return array(
|
|||||||
'common_delivery_submit' => '发货',
|
'common_delivery_submit' => '发货',
|
||||||
'common_operation_install' => '安装',
|
'common_operation_install' => '安装',
|
||||||
'common_operation_uninstall' => '卸载',
|
'common_operation_uninstall' => '卸载',
|
||||||
|
'common_operation_pay' => '支付',
|
||||||
'common_delivery_tips' => '是否操作发货,操作后不可恢复!',
|
'common_delivery_tips' => '是否操作发货,操作后不可恢复!',
|
||||||
'common_collect_submit' => '收货',
|
'common_collect_submit' => '收货',
|
||||||
'common_collect_tips' => '是否操作收货,操作后不可恢复!',
|
'common_collect_tips' => '是否操作收货,操作后不可恢复!',
|
||||||
@ -433,9 +434,8 @@ return array(
|
|||||||
),
|
),
|
||||||
|
|
||||||
// 支付日志 - 业务类型
|
// 支付日志 - 业务类型
|
||||||
'common_business_type_list' => array(
|
'common_busines_type_list' => array(
|
||||||
0 => array('id' => 0, 'name' => '用户购买服务', 'checked' => true),
|
0 => array('id' => 0, 'name' => '订单', 'checked' => true),
|
||||||
1 => array('id' => 1, 'name' => '寄件支付'),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// 用户积分 - 操作类型
|
// 用户积分 - 操作类型
|
||||||
|
@ -70,8 +70,10 @@ class CashPayment
|
|||||||
*/
|
*/
|
||||||
public function Pay($params = [])
|
public function Pay($params = [])
|
||||||
{
|
{
|
||||||
|
$url = $params['call_back_url'].'?';
|
||||||
$url = __MY_URL__.'payment_order_'.strtolower(substr(__CLASS__, strripos(__CLASS__, '\\')+1)).'_respond.php';
|
$url .= 'out_trade_no='.$params['order_no'];
|
||||||
|
$url .= '&subject='.$params['name'];
|
||||||
|
$url .= '&total_price='.$params['total_price'];
|
||||||
return DataReturn('处理成功', 0, $url);
|
return DataReturn('处理成功', 0, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +88,7 @@ class CashPayment
|
|||||||
*/
|
*/
|
||||||
public function Respond($params = [])
|
public function Respond($params = [])
|
||||||
{
|
{
|
||||||
return DataReturn('处理成功', 0);
|
return DataReturn('处理成功', 0, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
@ -70,7 +70,10 @@ class DeliveryPayment
|
|||||||
*/
|
*/
|
||||||
public function Pay($params = [])
|
public function Pay($params = [])
|
||||||
{
|
{
|
||||||
$url = __MY_URL__.'payment_order_'.strtolower(substr(__CLASS__, strripos(__CLASS__, '\\')+1)).'_respond.php';
|
$url = $params['call_back_url'].'?';
|
||||||
|
$url .= 'out_trade_no='.$params['order_no'];
|
||||||
|
$url .= '&subject='.$params['name'];
|
||||||
|
$url .= '&total_price='.$params['total_price'];
|
||||||
return DataReturn('处理成功', 0, $url);
|
return DataReturn('处理成功', 0, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +88,7 @@ class DeliveryPayment
|
|||||||
*/
|
*/
|
||||||
public function Respond($params = [])
|
public function Respond($params = [])
|
||||||
{
|
{
|
||||||
return DataReturn('处理成功', 0);
|
return DataReturn('处理成功', 0, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
//000000000000a:135:{i:41;s:12:"config_index";i:42;s:11:"config_save";i:81;s:10:"site_index";i:103;s:10:"site_index";i:105;s:9:"site_save";i:104;s:9:"sms_index";i:107;s:8:"sms_save";i:219;s:11:"email_index";i:220;s:10:"email_save";i:221;s:15:"email_emailtest";i:199;s:9:"seo_index";i:200;s:8:"seo_save";i:1;s:11:"power_index";i:22;s:11:"admin_index";i:19;s:14:"admin_saveinfo";i:20;s:10:"admin_save";i:21;s:12:"admin_delete";i:4;s:10:"power_role";i:17;s:18:"power_rolesaveinfo";i:18;s:14:"power_rolesave";i:23;s:16:"power_roledelete";i:13;s:11:"power_index";i:15;s:15:"power_powersave";i:16;s:17:"power_powerdelete";i:126;s:10:"user_index";i:127;s:10:"user_index";i:128;s:13:"user_saveinfo";i:129;s:9:"user_save";i:130;s:11:"user_delete";i:146;s:16:"user_excelexport";i:38;s:11:"goods_index";i:39;s:11:"goods_index";i:57;s:14:"goods_saveinfo";i:58;s:10:"goods_save";i:59;s:12:"goods_delete";i:181;s:19:"goods_statusshelves";i:218;s:27:"goods_statushomerecommended";i:201;s:19:"goodscategory_index";i:202;s:18:"goodscategory_save";i:203;s:20:"goodscategory_delete";i:177;s:11:"order_index";i:178;s:11:"order_index";i:179;s:12:"order_delete";i:180;s:12:"order_cancel";i:267;s:14:"order_delivery";i:268;s:13:"order_collect";i:213;s:12:"answer_index";i:214;s:12:"answer_index";i:215;s:11:"answer_save";i:216;s:13:"answer_delete";i:217;s:19:"answer_statusupdate";i:222;s:16:"navigation_index";i:223;s:16:"navigation_index";i:226;s:15:"navigation_save";i:227;s:17:"navigation_delete";i:228;s:23:"navigation_statusupdate";i:234;s:16:"customview_index";i:235;s:19:"customview_saveinfo";i:236;s:15:"customview_save";i:237;s:17:"customview_delete";i:238;s:23:"customview_statusupdate";i:239;s:10:"link_index";i:240;s:13:"link_saveinfo";i:241;s:9:"link_save";i:242;s:11:"link_delete";i:243;s:17:"link_statusupdate";i:244;s:11:"theme_index";i:245;s:10:"theme_save";i:246;s:12:"theme_upload";i:247;s:12:"theme_delete";i:252;s:11:"brand_index";i:249;s:11:"brand_index";i:256;s:14:"brand_saveinfo";i:250;s:10:"brand_save";i:257;s:17:"brand_stateupdate";i:251;s:12:"brand_delete";i:253;s:19:"brandcategory_index";i:254;s:18:"brandcategory_save";i:255;s:20:"brandcategory_delete";i:204;s:13:"article_index";i:205;s:13:"article_index";i:206;s:16:"article_saveinfo";i:207;s:12:"article_save";i:208;s:14:"article_delete";i:209;s:20:"article_statusupdate";i:248;s:29:"article_statushomerecommended";i:210;s:21:"articlecategory_index";i:211;s:20:"articlecategory_save";i:212;s:22:"articlecategory_delete";i:162;s:15:"marketing_index";i:163;s:12:"coupon_index";i:164;s:18:"coupon_stateupdate";i:165;s:15:"coupon_saveinfo";i:166;s:11:"coupon_save";i:167;s:11:"coupon_user";i:168;s:13:"coupon_delete";i:169;s:15:"coupon_sendinfo";i:170;s:11:"coupon_send";i:171;s:16:"coupon_userquery";i:182;s:10:"data_index";i:183;s:13:"message_index";i:184;s:14:"message_delete";i:185;s:12:"paylog_index";i:186;s:21:"userintegrallog_index";i:187;s:15:"complaint_index";i:188;s:14:"complaint_save";i:189;s:16:"complaint_delete";i:152;s:15:"resources_index";i:153;s:12:"region_index";i:154;s:11:"region_save";i:155;s:13:"region_delete";i:156;s:13:"express_index";i:157;s:12:"express_save";i:158;s:14:"express_delete";i:172;s:11:"slide_index";i:173;s:14:"slide_saveinfo";i:174;s:10:"slide_save";i:175;s:17:"slide_stateupdate";i:176;s:12:"slide_delete";i:193;s:20:"screeningprice_index";i:194;s:19:"screeningprice_save";i:258;s:21:"screeningprice_delete";i:259;s:13:"payment_index";i:260;s:16:"payment_saveinfo";i:261;s:12:"payment_save";i:262;s:14:"payment_delete";i:263;s:15:"payment_install";i:264;s:20:"payment_statusupdate";i:265;s:17:"payment_uninstall";i:266;s:14:"payment_upload";i:118;s:10:"tool_index";i:119;s:11:"cache_index";i:120;s:16:"cache_siteupdate";i:121;s:20:"cache_templateupdate";i:122;s:18:"cache_moduleupdate";}
|
//000000000000a:136:{i:41;s:12:"config_index";i:42;s:11:"config_save";i:81;s:10:"site_index";i:103;s:10:"site_index";i:105;s:9:"site_save";i:104;s:9:"sms_index";i:107;s:8:"sms_save";i:219;s:11:"email_index";i:220;s:10:"email_save";i:221;s:15:"email_emailtest";i:199;s:9:"seo_index";i:200;s:8:"seo_save";i:1;s:11:"power_index";i:22;s:11:"admin_index";i:19;s:14:"admin_saveinfo";i:20;s:10:"admin_save";i:21;s:12:"admin_delete";i:4;s:10:"power_role";i:17;s:18:"power_rolesaveinfo";i:18;s:14:"power_rolesave";i:23;s:16:"power_roledelete";i:13;s:11:"power_index";i:15;s:15:"power_powersave";i:16;s:17:"power_powerdelete";i:126;s:10:"user_index";i:127;s:10:"user_index";i:128;s:13:"user_saveinfo";i:129;s:9:"user_save";i:130;s:11:"user_delete";i:146;s:16:"user_excelexport";i:38;s:11:"goods_index";i:39;s:11:"goods_index";i:57;s:14:"goods_saveinfo";i:58;s:10:"goods_save";i:59;s:12:"goods_delete";i:181;s:19:"goods_statusshelves";i:218;s:27:"goods_statushomerecommended";i:201;s:19:"goodscategory_index";i:202;s:18:"goodscategory_save";i:203;s:20:"goodscategory_delete";i:177;s:11:"order_index";i:178;s:11:"order_index";i:179;s:12:"order_delete";i:180;s:12:"order_cancel";i:267;s:14:"order_delivery";i:268;s:13:"order_collect";i:269;s:9:"order_pay";i:213;s:12:"answer_index";i:214;s:12:"answer_index";i:215;s:11:"answer_save";i:216;s:13:"answer_delete";i:217;s:19:"answer_statusupdate";i:222;s:16:"navigation_index";i:223;s:16:"navigation_index";i:226;s:15:"navigation_save";i:227;s:17:"navigation_delete";i:228;s:23:"navigation_statusupdate";i:234;s:16:"customview_index";i:235;s:19:"customview_saveinfo";i:236;s:15:"customview_save";i:237;s:17:"customview_delete";i:238;s:23:"customview_statusupdate";i:239;s:10:"link_index";i:240;s:13:"link_saveinfo";i:241;s:9:"link_save";i:242;s:11:"link_delete";i:243;s:17:"link_statusupdate";i:244;s:11:"theme_index";i:245;s:10:"theme_save";i:246;s:12:"theme_upload";i:247;s:12:"theme_delete";i:252;s:11:"brand_index";i:249;s:11:"brand_index";i:256;s:14:"brand_saveinfo";i:250;s:10:"brand_save";i:257;s:17:"brand_stateupdate";i:251;s:12:"brand_delete";i:253;s:19:"brandcategory_index";i:254;s:18:"brandcategory_save";i:255;s:20:"brandcategory_delete";i:204;s:13:"article_index";i:205;s:13:"article_index";i:206;s:16:"article_saveinfo";i:207;s:12:"article_save";i:208;s:14:"article_delete";i:209;s:20:"article_statusupdate";i:248;s:29:"article_statushomerecommended";i:210;s:21:"articlecategory_index";i:211;s:20:"articlecategory_save";i:212;s:22:"articlecategory_delete";i:162;s:15:"marketing_index";i:163;s:12:"coupon_index";i:164;s:18:"coupon_stateupdate";i:165;s:15:"coupon_saveinfo";i:166;s:11:"coupon_save";i:167;s:11:"coupon_user";i:168;s:13:"coupon_delete";i:169;s:15:"coupon_sendinfo";i:170;s:11:"coupon_send";i:171;s:16:"coupon_userquery";i:182;s:10:"data_index";i:183;s:13:"message_index";i:184;s:14:"message_delete";i:185;s:12:"paylog_index";i:186;s:21:"userintegrallog_index";i:187;s:15:"complaint_index";i:188;s:14:"complaint_save";i:189;s:16:"complaint_delete";i:152;s:15:"resources_index";i:153;s:12:"region_index";i:154;s:11:"region_save";i:155;s:13:"region_delete";i:156;s:13:"express_index";i:157;s:12:"express_save";i:158;s:14:"express_delete";i:172;s:11:"slide_index";i:173;s:14:"slide_saveinfo";i:174;s:10:"slide_save";i:175;s:17:"slide_stateupdate";i:176;s:12:"slide_delete";i:193;s:20:"screeningprice_index";i:194;s:19:"screeningprice_save";i:258;s:21:"screeningprice_delete";i:259;s:13:"payment_index";i:260;s:16:"payment_saveinfo";i:261;s:12:"payment_save";i:262;s:14:"payment_delete";i:263;s:15:"payment_install";i:264;s:20:"payment_statusupdate";i:265;s:17:"payment_uninstall";i:266;s:14:"payment_upload";i:118;s:10:"tool_index";i:119;s:11:"cache_index";i:120;s:16:"cache_siteupdate";i:121;s:20:"cache_templateupdate";i:122;s:18:"cache_moduleupdate";}
|
||||||
?>
|
?>
|
@ -46,7 +46,7 @@ class OrderService
|
|||||||
|
|
||||||
// 获取订单信息
|
// 获取订单信息
|
||||||
$where = ['id'=>intval($params['id']), 'user_id' => $params['user']['id']];
|
$where = ['id'=>intval($params['id']), 'user_id' => $params['user']['id']];
|
||||||
$order = M('Order')->where($where)->field('id,order_no,status,total_price,payment_id')->find();
|
$order = M('Order')->where($where)->find();
|
||||||
if(empty($order))
|
if(empty($order))
|
||||||
{
|
{
|
||||||
return DataReturn(L('common_data_no_exist_error'), -1);
|
return DataReturn(L('common_data_no_exist_error'), -1);
|
||||||
@ -83,11 +83,114 @@ class OrderService
|
|||||||
$ret = (new $pay_name($payment[0]['config']))->Pay($pay_data);
|
$ret = (new $pay_name($payment[0]['config']))->Pay($pay_data);
|
||||||
if(isset($ret['code']) && $ret['code'] == 0)
|
if(isset($ret['code']) && $ret['code'] == 0)
|
||||||
{
|
{
|
||||||
|
// 非线上支付处理
|
||||||
|
self::OrderPaymentUnderLine([
|
||||||
|
'order' => $order,
|
||||||
|
'payment' => $payment[0],
|
||||||
|
'user' => $params['user'],
|
||||||
|
'subject' => $params,
|
||||||
|
]);
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
return DataReturn('支付接口异常', -1);
|
return DataReturn('支付接口异常', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员订单支付
|
||||||
|
* @author Devil
|
||||||
|
* @blog http://gong.gg/
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2018-09-26
|
||||||
|
* @desc description
|
||||||
|
* @param [array] $params [输入参数]
|
||||||
|
*/
|
||||||
|
public static function AdminPay($params = [])
|
||||||
|
{
|
||||||
|
// 请求参数
|
||||||
|
$p = [
|
||||||
|
[
|
||||||
|
'checked_type' => 'empty',
|
||||||
|
'key_name' => 'id',
|
||||||
|
'error_msg' => '订单id有误',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'checked_type' => 'empty',
|
||||||
|
'key_name' => 'user',
|
||||||
|
'error_msg' => '管理员信息有误',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$ret = params_checked($params, $p);
|
||||||
|
if($ret !== true)
|
||||||
|
{
|
||||||
|
return DataReturn($ret, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取订单信息
|
||||||
|
$where = ['id'=>intval($params['id'])];
|
||||||
|
$order = M('Order')->where($where)->find();
|
||||||
|
if(empty($order))
|
||||||
|
{
|
||||||
|
return DataReturn(L('common_data_no_exist_error'), -1);
|
||||||
|
}
|
||||||
|
if($order['total_price'] <= 0.00)
|
||||||
|
{
|
||||||
|
return DataReturn('金额不能为0', -1);
|
||||||
|
}
|
||||||
|
if($order['status'] != 1)
|
||||||
|
{
|
||||||
|
$status_text = L('common_order_admin_status')[$order['status']]['name'];
|
||||||
|
return DataReturn('状态不可操作['.$status_text.']', -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付方式
|
||||||
|
$payment_id = empty($params['payment_id']) ? $order['payment_id'] : intval($params['payment_id']);
|
||||||
|
$payment = ResourcesService::PaymentList(['where'=>['id'=>$payment_id]]);
|
||||||
|
if(empty($payment[0]))
|
||||||
|
{
|
||||||
|
return DataReturn('支付方式有误', -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 非线上支付处理
|
||||||
|
return self::OrderPaymentUnderLine([
|
||||||
|
'order' => $order,
|
||||||
|
'payment' => $payment[0],
|
||||||
|
'user' => $params['user'],
|
||||||
|
'subject' => $params,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [OrderPaymentUnderLine 线下支付处理]
|
||||||
|
* @author Devil
|
||||||
|
* @blog http://gong.gg/
|
||||||
|
* @version 1.0.0
|
||||||
|
* @datetime 2018-10-05T22:40:57+0800
|
||||||
|
* @param [array] $params [输入参数]
|
||||||
|
*/
|
||||||
|
private static function OrderPaymentUnderLine($params = [])
|
||||||
|
{
|
||||||
|
if(!empty($params['order']) && !empty($params['payment']) && !empty($params['user']))
|
||||||
|
{
|
||||||
|
if(in_array($params['payment']['payment'], C('under_line_list')))
|
||||||
|
{
|
||||||
|
// 支付处理
|
||||||
|
$pay_params = [
|
||||||
|
'order' => $params['order'],
|
||||||
|
'payment' => $params['payment'],
|
||||||
|
'pay' => [
|
||||||
|
'trade_no' => '',
|
||||||
|
'subject' => isset($params['params']['subject']) ? $params['params']['subject'] : '',
|
||||||
|
'buyer_email' => $params['user']['user_name_view'],
|
||||||
|
'total_amount' => $params['order']['total_price'],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
return self::OrderPayHandle($pay_params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DataReturn('无需处理', 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付同步处理
|
* 支付同步处理
|
||||||
* @author Devil
|
* @author Devil
|
||||||
@ -122,7 +225,22 @@ class OrderService
|
|||||||
|
|
||||||
// 支付数据校验
|
// 支付数据校验
|
||||||
$pay_name = '\Library\Payment\\'.PAYMENT_TYPE;
|
$pay_name = '\Library\Payment\\'.PAYMENT_TYPE;
|
||||||
return (new $pay_name($payment[0]['config']))->Respond();
|
$ret = (new $pay_name($payment[0]['config']))->Respond(array_merge($_GET, $_POST));
|
||||||
|
if(isset($ret['code']) && $ret['code'] == 0)
|
||||||
|
{
|
||||||
|
// 获取订单信息
|
||||||
|
$where = ['order_no'=>$ret['data']['out_trade_no'], 'is_delete_time'=>0, 'user_is_delete_time'=>0];
|
||||||
|
$order = M('Order')->where($where)->find();
|
||||||
|
|
||||||
|
// 非线上支付处理
|
||||||
|
self::OrderPaymentUnderLine([
|
||||||
|
'order' => $order,
|
||||||
|
'payment' => $payment[0],
|
||||||
|
'user' => $params['user'],
|
||||||
|
'params' => $params,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,51 +263,86 @@ class OrderService
|
|||||||
|
|
||||||
// 支付数据校验
|
// 支付数据校验
|
||||||
$pay_name = '\Library\Payment\\'.PAYMENT_TYPE;
|
$pay_name = '\Library\Payment\\'.PAYMENT_TYPE;
|
||||||
$ret = (new $pay_name($payment[0]['config']))->Respond();
|
$ret = (new $pay_name($payment[0]['config']))->Respond(array_merge($_GET, $_POST));
|
||||||
if(!isset($ret['code']) || $ret['code'] != 0)
|
if(!isset($ret['code']) || $ret['code'] != 0)
|
||||||
{
|
{
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取订单信息
|
// 获取订单信息
|
||||||
$m = M('Order');
|
|
||||||
$where = ['order_no'=>$ret['data']['out_trade_no'], 'is_delete_time'=>0, 'user_is_delete_time'=>0];
|
$where = ['order_no'=>$ret['data']['out_trade_no'], 'is_delete_time'=>0, 'user_is_delete_time'=>0];
|
||||||
$order = $m->where($where)->field('id,status,total_price,payment_id,user_id,shop_id')->find();
|
$order = M('Order')->where($where)->find();
|
||||||
if(empty($order))
|
|
||||||
{
|
|
||||||
return DataReturn(L('common_data_no_exist_error'), -1);
|
|
||||||
}
|
|
||||||
if($order['status'] > 1)
|
|
||||||
{
|
|
||||||
$status_text = L('common_order_user_status')[$order['status']]['name'];
|
|
||||||
return DataReturn('状态不可操作['.$status_text.']', 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 兼容web版本支付参数
|
// 兼容web版本支付参数
|
||||||
$buyer_email = isset($ret['data']['buyer_logon_id']) ? $ret['data']['buyer_logon_id'] : (isset($ret['data']['buyer_email']) ? $ret['data']['buyer_email'] : '');
|
$buyer_email = isset($ret['data']['buyer_logon_id']) ? $ret['data']['buyer_logon_id'] : (isset($ret['data']['buyer_email']) ? $ret['data']['buyer_email'] : '');
|
||||||
$total_amount = isset($ret['data']['total_amount']) ? $ret['data']['total_amount'] : (isset($ret['data']['total_fee']) ? $ret['data']['total_fee'] : '');
|
$total_amount = isset($ret['data']['total_amount']) ? $ret['data']['total_amount'] : (isset($ret['data']['total_fee']) ? $ret['data']['total_fee'] : '');
|
||||||
|
|
||||||
|
// 支付处理
|
||||||
|
$pay_params = [
|
||||||
|
'order' => $order,
|
||||||
|
'payment' => $payment[0],
|
||||||
|
'pay' => [
|
||||||
|
'trade_no' => $ret['data']['trade_no'],
|
||||||
|
'subject' => $ret['data']['subject'],
|
||||||
|
'buyer_email' => $buyer_email,
|
||||||
|
'total_amount' => $total_amount,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
return self::OrderPayHandle($pay_params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [OrderPayHandle 订单支付处理]
|
||||||
|
* @author Devil
|
||||||
|
* @blog http://gong.gg/
|
||||||
|
* @version 1.0.0
|
||||||
|
* @datetime 2018-10-05T23:02:14+0800
|
||||||
|
* @param [array] $params [输入参数]
|
||||||
|
*/
|
||||||
|
private static function OrderPayHandle($params = [])
|
||||||
|
{
|
||||||
|
// 订单信息
|
||||||
|
if(empty($params['order']))
|
||||||
|
{
|
||||||
|
return DataReturn(L('common_data_no_exist_error'), -1);
|
||||||
|
}
|
||||||
|
if($params['order']['status'] > 1)
|
||||||
|
{
|
||||||
|
$status_text = L('common_order_user_status')[$params['order']['status']]['name'];
|
||||||
|
return DataReturn('状态不可操作['.$status_text.']', 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付方式
|
||||||
|
if(empty($params['payment']))
|
||||||
|
{
|
||||||
|
return DataReturn('支付方式有误', -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付参数
|
||||||
|
$total_amount = isset($params['pay']['total_amount']) ? $params['pay']['total_amount'] : 0;
|
||||||
|
|
||||||
// 写入支付日志
|
// 写入支付日志
|
||||||
$pay_log_data = [
|
$pay_log_data = [
|
||||||
'user_id' => $order['user_id'],
|
'user_id' => $params['order']['user_id'],
|
||||||
'order_id' => $order['id'],
|
'order_id' => $params['order']['id'],
|
||||||
'trade_no' => $ret['data']['trade_no'],
|
'amount' => $params['order']['total_price'],
|
||||||
'user' => $buyer_email,
|
'trade_no' => isset($params['pay']['trade_no']) ? $params['pay']['trade_no'] : '',
|
||||||
|
'user' => isset($params['pay']['buyer_email']) ? $params['pay']['buyer_email'] : '',
|
||||||
'total_fee' => $total_amount,
|
'total_fee' => $total_amount,
|
||||||
'amount' => $order['total_price'],
|
'subject' => isset($params['pay']['subject']) ? $params['pay']['subject'] : '订单支付',
|
||||||
'subject' => $ret['data']['subject'],
|
'payment' => $params['payment']['payment'],
|
||||||
'payment' => PAYMENT_TYPE,
|
'payment_name' => $params['payment']['name'],
|
||||||
'payment_name' => $payment[0]['name'],
|
|
||||||
'business_type' => 0,
|
'business_type' => 0,
|
||||||
'add_time' => time(),
|
'add_time' => time(),
|
||||||
];
|
];
|
||||||
M('PayLog')->add($pay_log_data);
|
M('PayLog')->add($pay_log_data);
|
||||||
|
|
||||||
// 消息通知
|
// 消息通知
|
||||||
$detail = '订单支付成功,金额'.PriceBeautify($order['total_price']).'元';
|
$detail = '订单支付成功,金额'.PriceBeautify($params['order']['total_price']).'元';
|
||||||
ResourcesService::MessageAdd($order['user_id'], '订单支付', $detail, 1, $order['id']);
|
ResourcesService::MessageAdd($params['order']['user_id'], '订单支付', $detail, 1, $params['order']['id']);
|
||||||
|
|
||||||
// 开启事务
|
// 开启事务
|
||||||
|
$m = M('Order');
|
||||||
$m->startTrans();
|
$m->startTrans();
|
||||||
|
|
||||||
// 更新订单状态
|
// 更新订单状态
|
||||||
@ -197,20 +350,20 @@ class OrderService
|
|||||||
'status' => 2,
|
'status' => 2,
|
||||||
'pay_status' => 1,
|
'pay_status' => 1,
|
||||||
'pay_price' => $total_amount,
|
'pay_price' => $total_amount,
|
||||||
'payment_id' => $payment['id'],
|
'payment_id' => $params['payment']['id'],
|
||||||
'pay_time' => time(),
|
'pay_time' => time(),
|
||||||
'upd_time' => time(),
|
'upd_time' => time(),
|
||||||
);
|
);
|
||||||
if($m->where(['id'=>$order['id']])->save($upd_data))
|
if($m->where(['id'=>$params['order']['id']])->save($upd_data))
|
||||||
{
|
{
|
||||||
// 添加状态日志
|
// 添加状态日志
|
||||||
if(self::OrderHistoryAdd($order['id'], 2, $order['status'], '支付', 0, '系统'))
|
if(self::OrderHistoryAdd($params['order']['id'], 2, $params['order']['status'], '支付', 0, '系统'))
|
||||||
{
|
{
|
||||||
// 提交事务
|
// 提交事务
|
||||||
$m->commit();
|
$m->commit();
|
||||||
|
|
||||||
// 成功
|
// 成功
|
||||||
return DataReturn('处理成功', 0);
|
return DataReturn('支付成功', 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,15 +24,15 @@ $(function()
|
|||||||
{
|
{
|
||||||
if($(this).hasClass('selected'))
|
if($(this).hasClass('selected'))
|
||||||
{
|
{
|
||||||
$('form.delivery-form input[name='+$(this).parent().data('type')+'_id]').val(0);
|
$('form input[name='+$(this).parent().data('type')+'_id]').val(0);
|
||||||
$(this).removeClass('selected');
|
$(this).removeClass('selected');
|
||||||
} else {
|
} else {
|
||||||
$('form.delivery-form input[name='+$(this).parent().data('type')+'_id]').val($(this).data('value'));
|
$('form input[name='+$(this).parent().data('type')+'_id]').val($(this).data('value'));
|
||||||
$(this).addClass('selected').siblings('li').removeClass('selected');
|
$(this).addClass('selected').siblings('li').removeClass('selected');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 发货表单
|
// 发货操作表单
|
||||||
$('form.delivery-form button[type=submit]').on('click', function()
|
$('form.delivery-form button[type=submit]').on('click', function()
|
||||||
{
|
{
|
||||||
var id = $('form.delivery-form input[name=id]').val() || 0;
|
var id = $('form.delivery-form input[name=id]').val() || 0;
|
||||||
@ -48,4 +48,39 @@ $(function()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// 支付操作
|
||||||
|
$('.submit-pay').on('click', function()
|
||||||
|
{
|
||||||
|
$('form.pay-form input[name=id]').val($(this).data('id'));
|
||||||
|
var payment_id = $(this).data('payment-id') || 0;
|
||||||
|
if($('.payment-items-'+payment_id).length > 0)
|
||||||
|
{
|
||||||
|
$('form.pay-form input[name=payment_id]').val(payment_id);
|
||||||
|
$('.payment-items-'+payment_id).addClass('selected').siblings('li').removeClass('selected');
|
||||||
|
} else {
|
||||||
|
$('form.pay-form input[name=payment_id]').val(0);
|
||||||
|
$('ul.payment-list li.selected').removeClass('selected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 支付操作表单
|
||||||
|
FromInit('form.form-validation-pay');
|
||||||
|
$('form.pay-form button[type=submit]').on('click', function()
|
||||||
|
{
|
||||||
|
var id = $('form.pay-form input[name=id]').val() || 0;
|
||||||
|
if(id == 0)
|
||||||
|
{
|
||||||
|
PromptCenter('订单id有误');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var payment_id = $('form.pay-form input[name=payment_id]').val() || 0;
|
||||||
|
if(payment_id == 0)
|
||||||
|
{
|
||||||
|
PromptCenter('请选择支付方式');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单支付异步入口
|
|
||||||
*/
|
|
||||||
|
|
||||||
// 默认绑定模块
|
|
||||||
$_GET['m'] = 'Api';
|
|
||||||
$_GET['c'] = 'OrderNotify';
|
|
||||||
$_GET['a'] = 'Notify';
|
|
||||||
|
|
||||||
// 支付模块标记
|
|
||||||
define('PAYMENT_TYPE', 'CashPayment');
|
|
||||||
|
|
||||||
// 引入公共入口文件
|
|
||||||
require './core.php';
|
|
||||||
|
|
||||||
// 引入ThinkPHP入口文件
|
|
||||||
require './ThinkPHP/ThinkPHP.php';
|
|
||||||
|
|
||||||
?>
|
|
@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单支付异步入口
|
|
||||||
*/
|
|
||||||
|
|
||||||
// 默认绑定模块
|
|
||||||
$_GET['m'] = 'Api';
|
|
||||||
$_GET['c'] = 'OrderNotify';
|
|
||||||
$_GET['a'] = 'Notify';
|
|
||||||
|
|
||||||
// 支付模块标记
|
|
||||||
define('PAYMENT_TYPE', 'DeliveryPayment');
|
|
||||||
|
|
||||||
// 引入公共入口文件
|
|
||||||
require './core.php';
|
|
||||||
|
|
||||||
// 引入ThinkPHP入口文件
|
|
||||||
require './ThinkPHP/ThinkPHP.php';
|
|
||||||
|
|
||||||
?>
|
|
69
shopxo.sql
Executable file → Normal file
69
shopxo.sql
Executable file → Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user