提交 e430c7bb 编写于 作者: G gongfuxiang

支持新增线下支付订单进入正常流程开关

上级 07628140
......@@ -61,6 +61,16 @@
</select>
</div>
<!-- 线下支付 -->
<div class="am-form-group">
<label>{{$data.common_is_under_line_order_normal.name}}<span class="am-form-group-label-tips">{{$data.common_is_under_line_order_normal.describe}}</span></label>
<select name="{{$data.common_is_under_line_order_normal.only_tag}}" class="am-radius chosen-select" data-validation-message="{{$data.common_is_under_line_order_normal.error_tips}}" required>
{{foreach $common_is_text_list as $v}}
<option value="{{$v.id}}" {{if isset($data['common_is_under_line_order_normal']['value']) and $data['common_is_under_line_order_normal']['value'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
</div>
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="nav_type" value="{{$nav_type}}" />
<input type="hidden" name="view_type" value="{{$view_type}}" />
......
{
"name":"默认主题",
"ver":"2.2.2",
"ver":"2.2.3",
"author":"Devil",
"home":"https://shopxo.net/"
}
\ No newline at end of file
......@@ -61,7 +61,6 @@ class AppCenterNavService
// 图片地址
if(isset($v['images_url']))
{
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
}
......@@ -274,23 +273,19 @@ class AppCenterNavService
*/
public static function AppCenterNav($params = [])
{
// 平台
$platform = ApplicationClientType();
// 缓存
$key = MyConfig('shopxo.cache_app_user_center_navigation_key').$platform;
$key = MyConfig('shopxo.cache_app_user_center_navigation_key').APPLICATION_CLIENT_TYPE;
$data = MyCache($key);
if(empty($data))
{
$field = 'id,name,images_url,event_value,event_type,desc';
$order_by = 'sort asc,id asc';
$data = Db::name('AppCenterNav')->field($field)->where(['platform'=>$platform, 'is_enable'=>1])->order($order_by)->select()->toArray();
$data = Db::name('AppCenterNav')->field($field)->where(['platform'=>APPLICATION_CLIENT_TYPE, 'is_enable'=>1])->order($order_by)->select()->toArray();
if(!empty($data))
{
foreach($data as &$v)
{
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
$v['event_value'] = empty($v['event_value']) ? null : htmlspecialchars_decode($v['event_value']);
}
......@@ -300,7 +295,7 @@ class AppCenterNavService
}
// 手机用户中心导航钩子
$hook_name = 'plugins_service_app_user_center_navigation_'.$platform;
$hook_name = 'plugins_service_app_user_center_navigation_'.APPLICATION_CLIENT_TYPE;
MyEventTrigger($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
......
......@@ -61,7 +61,6 @@ class AppHomeNavService
// 图片地址
if(isset($v['images_url']))
{
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
}
......@@ -269,24 +268,20 @@ class AppHomeNavService
*/
public static function AppHomeNav($params = [])
{
// 平台
$platform = ApplicationClientType();
// 缓存
$key = MyConfig('shopxo.cache_app_home_navigation_key').$platform;
$key = MyConfig('shopxo.cache_app_home_navigation_key').APPLICATION_CLIENT_TYPE;
$data = MyCache($key);
if($data === null || MyEnv('app_debug'))
{
// 获取导航数据
$field = 'id,name,images_url,event_value,event_type,bg_color,is_need_login';
$order_by = 'sort asc,id asc';
$data = Db::name('AppHomeNav')->field($field)->where(['platform'=>$platform, 'is_enable'=>1])->order($order_by)->select()->toArray();
$data = Db::name('AppHomeNav')->field($field)->where(['platform'=>APPLICATION_CLIENT_TYPE, 'is_enable'=>1])->order($order_by)->select()->toArray();
if(!empty($data))
{
foreach($data as &$v)
{
// 图片地址
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
$v['event_value'] = empty($v['event_value']) ? null : $v['event_value'];
......@@ -306,7 +301,7 @@ class AppHomeNavService
}
// 手机首页导航钩子
$hook_name = 'plugins_service_app_home_navigation_'.$platform;
$hook_name = 'plugins_service_app_home_navigation_'.APPLICATION_CLIENT_TYPE;
MyEventTrigger($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
......
......@@ -33,24 +33,20 @@ class BannerService
*/
public static function Banner($params = [])
{
// 平台
$platform = ApplicationClientType();
// 缓存
$key = MyConfig('shopxo.cache_banner_list_key').$platform;
$key = MyConfig('shopxo.cache_banner_list_key').APPLICATION_CLIENT_TYPE;
$data = MyCache($key);
if($data === null || MyEnv('app_debug'))
{
// 获取banner数据
$field = 'name,images_url,event_value,event_type,bg_color';
$order_by = 'sort asc,id asc';
$data = Db::name('Slide')->field($field)->where(['platform'=>$platform, 'is_enable'=>1])->order($order_by)->select()->toArray();
$data = Db::name('Slide')->field($field)->where(['platform'=>APPLICATION_CLIENT_TYPE, 'is_enable'=>1])->order($order_by)->select()->toArray();
if(!empty($data))
{
foreach($data as &$v)
{
// 图片地址
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
// 事件值
......
......@@ -1058,9 +1058,6 @@ class BuyService
// 订单默认状态
$order_status = (intval(MyC('common_order_is_booking', 0)) == 1) ? 0 : 1;
// 订单来源
$client_type = ApplicationClientType();
// 支付方式
$payment_id = 0;
$is_under_line = 0;
......@@ -1075,7 +1072,8 @@ class BuyService
$is_under_line = in_array($payment[0]['payment'], MyConfig('shopxo.under_line_list')) ? 1 : 0;
// 线下支付订单是否直接成功
if($is_under_line == 1)
// 是否开启线下订单正常进入流程
if($is_under_line == 1 && MyC('common_is_under_line_order_normal') == 1)
{
$order_status = 2;
}
......@@ -1125,7 +1123,7 @@ class BuyService
'extension_data' => empty($v['order_base']['extension_data']) ? '' : json_encode($v['order_base']['extension_data'], JSON_UNESCAPED_UNICODE),
'payment_id' => $payment_id,
'buy_number_count' => $v['order_base']['buy_count'],
'client_type' => $client_type,
'client_type' => APPLICATION_CLIENT_TYPE,
'order_model' => $site_model,
'is_under_line' => $is_under_line,
];
......
......@@ -88,6 +88,7 @@ class ConstService
'2.2.0' => ['value' => '2.2.0', 'name' => 'v2.2.0'],
'2.2.1' => ['value' => '2.2.1', 'name' => 'v2.2.1'],
'2.2.2' => ['value' => '2.2.2', 'name' => 'v2.2.2'],
'2.2.3' => ['value' => '2.2.3', 'name' => 'v2.2.3'],
],
// 用户注册类型列表
......
......@@ -172,7 +172,7 @@ class OrderService
// 是否直接跳转
if($success_count > 0 && $success_count == count($order_data))
{
return DataReturn('支付成功', 0, ['data'=>MyUrl('index/order/respond', ['appoint_status'=>0]), 'is_success'=>1]);
return DataReturn('操作成功', 0, ['data'=>MyUrl('index/order/respond', ['appoint_status'=>0]), 'is_success'=>1]);
}
// 支付入口文件检查
......@@ -289,7 +289,7 @@ class OrderService
}
// 微信中打开并且webopenid为空
if(ApplicationClientType() == 'h5' && IsWeixinEnv() && empty($pay_data['user']['weixin_web_openid']))
if(APPLICATION_CLIENT_TYPE == 'pc' && IsWeixinEnv() && empty($pay_data['user']['weixin_web_openid']))
{
// 授权成功后回调订单详情页面重新自动发起支付
// 单个订单进入详情,则进入列表
......@@ -341,9 +341,17 @@ class OrderService
$ret['data']['is_payment_type'] = 1;
// 线下支付处理
// 0 订单状态操作支付成功
// -8888 订单提交成功,等待用户线下支付
// 其他错误
$pay_ret = self::UserOrderPayUnderLine($pay_log['data']['log_no']);
if($pay_ret['code'] != 0)
if($pay_ret['code'] == 0)
{
$ret['data']['is_success'] = 1;
} elseif($pay_ret['code'] == -8888)
{
$ret['msg'] = $pay_ret['msg'];
} else {
return $pay_ret;
}
} else {
......@@ -626,57 +634,62 @@ class OrderService
*/
public static function UserOrderPayUnderLine($pay_log_no)
{
// 支付订单数据
$pay_data = self::OrderPayLogValueList($pay_log_no);
if($pay_data['code'] != 0)
{
return $pay_data;
}
// 订单支付日志已支付则直接返回
if($pay_data['data']['pay_log_data']['status'] == 1)
// 是否开启线下支付订单状态正常进行
if(MyC('common_is_under_line_order_normal') == 1)
{
return DataReturn('操作成功', 0);
}
// 启动事务
Db::startTrans();
// 捕获异常
try {
// 更新订单状态
$order_ids = array_column($pay_data['data']['order_list'], 'id');
$upd_data = [
'status' => 2,
'upd_time' => time(),
];
if(!Db::name('Order')->where(['id'=>$order_ids])->update($upd_data))
// 支付订单数据
$pay_data = self::OrderPayLogValueList($pay_log_no);
if($pay_data['code'] != 0)
{
throw new \Exception('订单更新失败');
return $pay_data;
}
// 循环处理订单
foreach($pay_data['data']['order_list'] as $order)
// 订单支付日志已支付则直接返回
if($pay_data['data']['pay_log_data']['status'] == 1)
{
if(!self::OrderHistoryAdd($order['id'], $upd_data['status'], $order['status'], '用户线下支付', 0, '系统'))
return DataReturn('操作成功', 0);
}
// 启动事务
Db::startTrans();
// 捕获异常
try {
// 更新订单状态
$order_ids = array_column($pay_data['data']['order_list'], 'id');
$upd_data = [
'status' => 2,
'upd_time' => time(),
];
if(!Db::name('Order')->where(['id'=>$order_ids])->update($upd_data))
{
throw new \Exception('订单日志添加失败['.$order['id'].']');
throw new \Exception('订单更新失败');
}
}
// 更改日志订单状态
if(!Db::name('PayLog')->where(['log_no'=>$pay_log_no])->update(['status'=>1]))
{
throw new \Exception('日志订单更新失败');
}
// 循环处理订单
foreach($pay_data['data']['order_list'] as $order)
{
if(!self::OrderHistoryAdd($order['id'], $upd_data['status'], $order['status'], '用户线下支付', 0, '系统'))
{
throw new \Exception('订单日志添加失败['.$order['id'].']');
}
}
// 完成
Db::commit();
return DataReturn('操作成功', 0);
} catch(\Exception $e) {
Db::rollback();
return DataReturn($e->getMessage(), -1);
// 更改日志订单状态
if(!Db::name('PayLog')->where(['log_no'=>$pay_log_no])->update(['status'=>1]))
{
throw new \Exception('日志订单更新失败');
}
// 完成
Db::commit();
return DataReturn('操作成功', 0);
} catch(\Exception $e) {
Db::rollback();
return DataReturn($e->getMessage(), -1);
}
}
return DataReturn('操作成功、请尽快联系管理员确认支付信息', -8888);
}
/**
......
......@@ -61,7 +61,6 @@ class QuickNavService
// 图片地址
if(isset($v['images_url']))
{
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
}
......@@ -268,31 +267,27 @@ class QuickNavService
*/
public static function QuickNav($params = [])
{
// 平台
$platform = ApplicationClientType();
// 缓存
$key = MyConfig('shopxo.cache_quick_navigation_key').$platform;
$key = MyConfig('shopxo.cache_quick_navigation_key').APPLICATION_CLIENT_TYPE;
$data = MyCache($key);
if($data === null || MyEnv('app_debug'))
{
// 获取导航数据
$field = 'id,name,images_url,event_value,event_type,bg_color';
$order_by = 'sort asc,id asc';
$data = Db::name('QuickNav')->field($field)->where(['platform'=>$platform, 'is_enable'=>1])->order($order_by)->select()->toArray();
$data = Db::name('QuickNav')->field($field)->where(['platform'=>APPLICATION_CLIENT_TYPE, 'is_enable'=>1])->order($order_by)->select()->toArray();
if(!empty($data))
{
foreach($data as &$v)
{
// 图片地址
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
$v['event_value'] = empty($v['event_value']) ? null : $v['event_value'];
// 事件值
if(!empty($v['event_value']))
{
// 地图
// 地图018064
if($v['event_type'] == 3)
{
$v['event_value_data'] = explode('|', $v['event_value']);
......@@ -307,7 +302,7 @@ class QuickNavService
// 快捷导航钩子
// web端数据参数可以自定义新增 class_name 名称、方便非url事件使用js控制点击事件
// 支持标签自定义数据值 data_value 名称、方便自定义事件响应需要依赖的数据
$hook_name = 'plugins_service_quick_navigation_'.$platform;
$hook_name = 'plugins_service_quick_navigation_'.APPLICATION_CLIENT_TYPE;
MyEventTrigger($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册