mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-12-02 20:10:30 +08:00
游客购买应用
This commit is contained in:
parent
2a6901190e
commit
a87e55e214
@ -32,41 +32,28 @@ class Hook extends Controller
|
||||
*/
|
||||
public function run($params = [])
|
||||
{
|
||||
// 是否控制器钩子
|
||||
// is_backend 当前为后端业务处理
|
||||
// hook_name 钩子名称
|
||||
if(isset($params['is_backend']) && $params['is_backend'] === true && !empty($params['hook_name']))
|
||||
if(!empty($params['hook_name']))
|
||||
{
|
||||
// 参数一 描述
|
||||
// 参数二 0 为处理成功, 负数为失败
|
||||
// 参数三 返回数据
|
||||
return DataReturn('返回描述', 0);
|
||||
|
||||
// 默认返回视图
|
||||
} else {
|
||||
if(!empty($params['hook_name']))
|
||||
switch($params['hook_name'])
|
||||
{
|
||||
switch($params['hook_name'])
|
||||
{
|
||||
case 'plugins_view_common_bottom' :
|
||||
$ret = $this->html($params);
|
||||
break;
|
||||
case 'plugins_view_common_bottom' :
|
||||
$ret = $this->html($params);
|
||||
break;
|
||||
|
||||
case 'plugins_common_page_bottom' :
|
||||
$ret = $this->js($params);
|
||||
break;
|
||||
case 'plugins_common_page_bottom' :
|
||||
$ret = $this->js($params);
|
||||
break;
|
||||
|
||||
case 'plugins_common_header' :
|
||||
$ret = $this->css($params);
|
||||
break;
|
||||
case 'plugins_common_header' :
|
||||
$ret = $this->css($params);
|
||||
break;
|
||||
|
||||
default :
|
||||
$ret = '';
|
||||
}
|
||||
return $ret;
|
||||
} else {
|
||||
return '';
|
||||
default :
|
||||
$ret = '';
|
||||
}
|
||||
return $ret;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,6 @@ class Hook extends Controller
|
||||
{
|
||||
// 获取应用数据
|
||||
$ret = PluginsService::PluginsData('touristbuy');
|
||||
$ret['data']['application_name'] = '订单查询';
|
||||
if($ret['code'] == 0 && !empty($ret['data']['application_name']))
|
||||
{
|
||||
$params['header'][] = [
|
||||
@ -114,9 +113,6 @@ class Hook extends Controller
|
||||
return '<style type="text/css">
|
||||
.plugins-touristbuy-nav-top, .plugins-touristbuy-login-info-btn { margin-left: 10px; }
|
||||
.plugins-touristbuy-nav-top { color: #FF5722; }
|
||||
.plugins-touristbuy-index { margin-top: 5%; }
|
||||
.plugins-touristbuy-index form.am-form { margin-top: 20px; }
|
||||
.plugins-touristbuy-index form.am-form .am-form-group { padding: 0 !important; }
|
||||
</style>';
|
||||
}
|
||||
|
||||
@ -130,18 +126,24 @@ class Hook extends Controller
|
||||
*/
|
||||
public function UserLoginInfoHtml($params = [])
|
||||
{
|
||||
// html
|
||||
$html = '';
|
||||
|
||||
// 获取已登录用户信息,已登录则不展示入口
|
||||
$user = UserService::LoginUserInfo();
|
||||
if(empty($user))
|
||||
{
|
||||
// 获取插件信息
|
||||
// 当前模块/控制器/方法
|
||||
$module_name = strtolower(request()->module());
|
||||
$controller_name = strtolower(request()->controller());
|
||||
$action_name = strtolower(request()->action());
|
||||
|
||||
// 当前窗口登录父级
|
||||
$is_parent = ($module_name.$controller_name.$action_name == 'indexusermodallogininfo') ? 1 : 0;
|
||||
|
||||
// 获取应用数据
|
||||
$ret = PluginsService::PluginsData('touristbuy');
|
||||
$html = '<a href="'.PluginsHomeUrl('touristbuy', 'index', 'login').'" target="_blank" class="am-btn am-btn-secondary am-btn-xs am-radius plugins-touristbuy-login-info-btn">游客登录</a>';
|
||||
$login_name = empty($ret['data']['login_name']) ? '游客登录' : $ret['data']['login_name'];
|
||||
return '<a href="'.PluginsHomeUrl('touristbuy', 'index', 'login', ['is_parent'=>$is_parent]).'" class="am-btn am-btn-warning am-btn-xs am-radius plugins-touristbuy-login-info-btn">'.$ret['data']['login_name'].'</a>';
|
||||
}
|
||||
return $html;
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -154,18 +156,16 @@ class Hook extends Controller
|
||||
*/
|
||||
public function LoginNavTopHtml($params = [])
|
||||
{
|
||||
// html
|
||||
$html = '';
|
||||
|
||||
// 获取已登录用户信息,已登录则不展示入口
|
||||
$user = UserService::LoginUserInfo();
|
||||
if(empty($user))
|
||||
{
|
||||
// 获取插件信息
|
||||
// 获取应用数据
|
||||
$ret = PluginsService::PluginsData('touristbuy');
|
||||
$html = '<a href="'.PluginsHomeUrl('touristbuy', 'index', 'login').'" class="plugins-touristbuy-nav-top">游客登录</a>';
|
||||
$login_name = empty($ret['data']['login_name']) ? '游客登录' : $ret['data']['login_name'];
|
||||
return '<a href="'.PluginsHomeUrl('touristbuy', 'index', 'login').'" class="plugins-touristbuy-nav-top">'.$login_name.'</a>';
|
||||
}
|
||||
return $html;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
?>
|
@ -14,6 +14,7 @@ use think\Controller;
|
||||
use app\plugins\touristbuy\Service;
|
||||
use app\service\SeoService;
|
||||
use app\service\OrderService;
|
||||
use app\service\PluginsService;
|
||||
|
||||
/**
|
||||
* 游客购买 - 前端独立页面入口
|
||||
@ -34,8 +35,15 @@ class Index extends Controller
|
||||
*/
|
||||
public function index($params = [])
|
||||
{
|
||||
$this->assign('home_seo_site_title', SeoService::BrowserSeoTitle('订单查询', 1));
|
||||
return $this->fetch('../../../plugins/view/touristbuy/index/index');
|
||||
$ret = PluginsService::PluginsData('touristbuy');
|
||||
if($ret['code'] == 0)
|
||||
{
|
||||
$this->assign('data', $ret['data']);
|
||||
$this->assign('home_seo_site_title', SeoService::BrowserSeoTitle('订单查询', 1));
|
||||
return $this->fetch('../../../plugins/view/touristbuy/index/index');
|
||||
} else {
|
||||
return $ret['msg'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,12 +124,16 @@ class Index extends Controller
|
||||
$ret = Service::TouristReg();
|
||||
if($ret['code'] == 0)
|
||||
{
|
||||
return $this->redirect(__MY_URL__);
|
||||
if(isset($params['is_parent']) && $params['is_parent'] == 1)
|
||||
{
|
||||
return '<script type="text/javascript">if(self.frameElement && self.frameElement.tagName == "IFRAME"){parent.location.reload();}else{window.location.href="'.__MY_URL__.'";}</script>';
|
||||
} else {
|
||||
return $this->redirect(__MY_URL__);
|
||||
}
|
||||
} else {
|
||||
$this->assign('msg', $ret['msg']);
|
||||
return $this->fetch('public/error');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -12,6 +12,7 @@ namespace app\plugins\touristbuy;
|
||||
|
||||
use think\Db;
|
||||
use app\service\UserService;
|
||||
use app\service\PluginsService;
|
||||
|
||||
/**
|
||||
* 问答系统服务层
|
||||
@ -40,23 +41,35 @@ class Service
|
||||
return DataReturn('已登录,请先退出', -1);
|
||||
}
|
||||
|
||||
// 获取应用数据
|
||||
$ret = PluginsService::PluginsData('touristbuy');
|
||||
$nickname = empty($ret['data']['nickname']) ? '游客' : $ret['data']['nickname'];
|
||||
|
||||
// 是否重复注册
|
||||
$tourist_user_id = session('tourist_user_id');
|
||||
if(!empty($tourist_user_id))
|
||||
{
|
||||
// 用户登录session纪录
|
||||
if(UserService::UserLoginRecord($tourist_user_id))
|
||||
// 更新用户信息
|
||||
$upd_data =[
|
||||
'username' => $nickname,
|
||||
'nickname' => $nickname,
|
||||
'upd_time' => time(),
|
||||
];
|
||||
if(Db::name('User')->where(['id'=>$tourist_user_id])->update($upd_data))
|
||||
{
|
||||
return DataReturn('游客登录成功', 0);
|
||||
} else {
|
||||
session('tourist_user_id', null);
|
||||
// 用户登录session纪录
|
||||
if(UserService::UserLoginRecord($tourist_user_id))
|
||||
{
|
||||
return DataReturn($nickname.'登录成功', 0);
|
||||
}
|
||||
}
|
||||
session('tourist_user_id', null);
|
||||
}
|
||||
|
||||
// 游客数据
|
||||
$data = [
|
||||
'username' => '游客',
|
||||
'nickname' => '游客',
|
||||
'username' => $nickname,
|
||||
'nickname' => $nickname,
|
||||
'status' => 0,
|
||||
'add_time' => time(),
|
||||
'upd_time' => time(),
|
||||
@ -72,10 +85,10 @@ class Service
|
||||
// 用户登录session纪录
|
||||
if(UserService::UserLoginRecord($user_id))
|
||||
{
|
||||
return DataReturn('游客登录成功', 0);
|
||||
return DataReturn($nickname.'登录成功', 0);
|
||||
}
|
||||
}
|
||||
return DataReturn('游客登录失败', -100);
|
||||
return DataReturn($nickname.'登录失败', -100);
|
||||
}
|
||||
}
|
||||
?>
|
@ -10,39 +10,53 @@
|
||||
|
||||
<div class="touristbuy-content">
|
||||
<div class="items">
|
||||
<label>公告内容</label>
|
||||
<label>应用导航名称</label>
|
||||
<div>
|
||||
{{if !empty($data['content'])}}
|
||||
{{$data.content}}
|
||||
{{if !empty($data['application_name'])}}
|
||||
{{$data.application_name}}
|
||||
{{else /}}
|
||||
无
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="items">
|
||||
<label>是否全局</label>
|
||||
<label>登录入口名称</label>
|
||||
<div>
|
||||
{{if isset($data['is_overall']) and $data['is_overall'] eq 1}}
|
||||
是
|
||||
{{if !empty($data['login_name'])}}
|
||||
{{$data.login_name}}
|
||||
{{else /}}
|
||||
否
|
||||
游客登录
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="items">
|
||||
<label>有效时间</label>
|
||||
<label>游客用户名</label>
|
||||
<div>
|
||||
{{if !empty($data['time_start']) and !empty($data['time_end'])}}
|
||||
{{$data.time_start}} ~ {{$data.time_end}}
|
||||
{{elseif !empty($data['time_start']) and empty($data['time_end'])}}
|
||||
{{$data.time_start}} ~ 长期有效
|
||||
{{elseif empty($data['time_start']) and !empty($data['time_end'])}}
|
||||
立即生效 ~ {{$data.time_end}}
|
||||
{{if !empty($data['nickname'])}}
|
||||
{{$data.nickname}}
|
||||
{{else /}}
|
||||
无限制
|
||||
游客
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="items">
|
||||
<label>订单查询提示</label>
|
||||
<div>
|
||||
{{if !empty($data['query_tips'])}}
|
||||
{{$data.query_tips}}
|
||||
{{else /}}
|
||||
无
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="items">
|
||||
<label>订单查询地址</label>
|
||||
<div>
|
||||
<a href="{{:PluginsHomeUrl('touristbuy', 'index', 'index')}}" target="_blank">{{:PluginsHomeUrl('touristbuy', 'index', 'index')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="{{:PluginsAdminUrl('touristbuy', 'admin', 'saveinfo')}}" class="am-btn am-btn-secondary am-radius btn-loading-example am-btn-sm am-btn-block edit-submit">编辑</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -10,29 +10,24 @@
|
||||
<a href="{{:PluginsAdminUrl('touristbuy', 'admin', 'index')}}" class="fr fs-14 m-t-5 am-icon-mail-reply"> 返回</a>
|
||||
</legend>
|
||||
|
||||
<div class="am-form-group am-form-file">
|
||||
<label class="block">公告内容<span class="am-form-group-label-tips">空则不显示</span></label>
|
||||
<textarea rows="3" name="content" class="am-radius am-field-valid" placeholder="公告内容" data-validation-message="请填写公告内容">{{if !empty($data['content'])}}{{$data.content}}{{/if}}</textarea>
|
||||
<div class="am-form-group">
|
||||
<label>应用导航名称<span class="am-form-group-label-tips">空则不显示,订单查询入口</span></label>
|
||||
<input type="text" name="application_name" placeholder="应用导航名称" maxlength="30" data-validation-message="应用导航名称格式最多 30 个字符" class="am-radius" {{if !empty($data['application_name'])}} value="{{$data.application_name}}"{{/if}} />
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label>是否全局<span class="am-form-group-label-tips">默认首页</span></label>
|
||||
<div>
|
||||
{{foreach $is_whether_list as $v}}
|
||||
<label class="am-radio-inline m-r-10">
|
||||
<input type="radio" name="is_overall" value="{{$v.id}}" {{if isset($data['is_overall']) and $data['is_overall'] eq $v['id']}}checked="checked"{{else /}}{{if !isset($data['is_overall']) and isset($v['checked']) and $v['checked'] eq true}}checked="checked"{{/if}}{{/if}} data-am-ucheck /> {{$v.name}}
|
||||
</label>
|
||||
{{/foreach}}
|
||||
</div>
|
||||
<label>登录入口名称<span class="am-form-group-label-tips">默认 游客登录</span></label>
|
||||
<input type="text" name="login_name" placeholder="登录入口名称" maxlength="30" data-validation-message="登录入口名称格式最多 30 个字符" class="am-radius" value="{{if !empty($data['login_name'])}}{{$data.login_name}}{{else /}}游客登录{{/if}}" />
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label>有效时间<span class="am-form-group-label-tips">留空则不限制</span></label>
|
||||
<div class="form-date">
|
||||
<input type="text" autocomplete="off" name="time_start" class="Wdate am-radius" placeholder="起始时间" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss'})" {{if !empty($data['time_start'])}}value="{{$data.time_start}}"{{/if}}/>
|
||||
<span>~</span>
|
||||
<input type="text" autocomplete="off" class="Wdate am-radius" placeholder="结束时间" name="time_end" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss'})" {{if !empty($data['time_end'])}}value="{{$data.time_end}}"{{/if}}/>
|
||||
</div>
|
||||
<label>游客用户名<span class="am-form-group-label-tips">默认 游客</span></label>
|
||||
<input type="text" name="nickname" placeholder="游客用户名" maxlength="16" data-validation-message="游客用户名格式最多 16 个字符" class="am-radius" value="{{if !empty($data['nickname'])}}{{$data.nickname}}{{else /}}游客{{/if}}" />
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="block">订单查询提示<span class="am-form-group-label-tips">空则不显示</span></label>
|
||||
<textarea rows="3" name="query_tips" class="am-radius am-field-valid" placeholder="公告内容" data-validation-message="请填写订单查询提示">{{if !empty($data['query_tips'])}}{{$data.query_tips}}{{/if}}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-form-group-refreshing">
|
||||
|
@ -183,6 +183,19 @@
|
||||
</div>
|
||||
<div class="operation">
|
||||
<!-- 0待确认, 1已确认/待支付, 2已支付/待发货, 3已发货/待收货, 4已完成, 5已取消, 6已关闭 -->
|
||||
<!-- 钩子订单操作 -->
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
|
||||
<div class="plugins-tag">
|
||||
<span>plugins_service_order_handle_operation_html</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($data['plugins_service_order_handle_operation_html']) and is_array($data['plugins_service_order_handle_operation_html'])}}
|
||||
{{foreach $data.plugins_service_order_handle_operation_html as $hook}}
|
||||
{{if is_string($hook) or is_int($hook)}}
|
||||
{{$hook|raw}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{if in_array($data['status'], [3,4])}}
|
||||
<div class="logistics">
|
||||
|
@ -19,10 +19,12 @@
|
||||
<!-- content start -->
|
||||
<div class="am-g my-content">
|
||||
<div class="am-u-md-6 am-u-sm-centered plugins-touristbuy-index">
|
||||
<div class="am-alert am-alert-warning" data-am-alert>
|
||||
<button type="button" class="am-close">×</button>
|
||||
<p>请输入订单号,收件人姓名,收件人电话即可查看订单详情</p>
|
||||
</div>
|
||||
{{if !empty($data['query_tips'])}}
|
||||
<div class="am-alert am-alert-warning" data-am-alert>
|
||||
<button type="button" class="am-close">×</button>
|
||||
<p>{{$data.query_tips}}</p>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<!-- form start -->
|
||||
<form class="am-form form-validation" method="post" action="{{:PluginsHomeUrl('touristbuy', 'index', 'detail')}}" request-type="form">
|
||||
@ -32,12 +34,12 @@
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-form-group-refreshing">
|
||||
<label>收件人-姓名</label>
|
||||
<label>收件人姓名</label>
|
||||
<input type="text" name="name" class="am-radius" minlength="1" placeholder="订单号" data-validation-message="请输入收件人姓名" required />
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-form-group-refreshing">
|
||||
<label>收件人-电话</label>
|
||||
<label>收件人电话</label>
|
||||
<input type="text" name="tel" class="am-radius" minlength="1" placeholder="订单号" data-validation-message="请输入收件人电话" required />
|
||||
</div>
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
h1 {
|
||||
font-size: 60px;
|
||||
}
|
||||
.msg {
|
||||
font-size: 68px;
|
||||
color: #4CAF50;
|
||||
}
|
||||
.plugins-touristbuy-index { margin-top: 5%; }
|
||||
.plugins-touristbuy-index form.am-form { margin-top: 20px; }
|
||||
.plugins-touristbuy-index form.am-form .am-form-group { padding: 0 !important; }
|
Loading…
Reference in New Issue
Block a user