Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
yunxin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
967da257
authored
Apr 08, 2019
by
PRY5YKGJ82EZEPX\Administrator
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
v1.0
parent
2a8eabe3
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
117 additions
and
34 deletions
app/Http/Controllers/HelperController.php
app/Http/Controllers/WebController.php
app/Http/Middleware/CheckLogin.php
app/Http/function.php
app/Model/SupplierAccountModel.php
public/pc/js/controller/GoodsList.js
public/pc/js/controller/Login.js
public/pc/js/controller/ResetPassword.js
resources/views/pc.blade.php
resources/views/pc/AbnormalList.blade.php
resources/views/pc/ForgetPassword.blade.php
resources/views/pc/GoodsList.blade.php
resources/views/pc/Login.blade.php
resources/views/pc/OrderList.blade.php
resources/views/pc/ResetPassword.blade.php
resources/views/pure/Runsql.blade.php
app/Http/Controllers/HelperController.php
View file @
967da257
...
...
@@ -8,6 +8,7 @@ use Gregwar\Captcha\CaptchaBuilder;
use
Illuminate\Http\Request
;
use
App\Plugin\Session
;
use
Illuminate\Support\Facades\Redis
;
use
DB
;
class
HelperController
extends
Controller
{
//初始函数
...
...
@@ -19,12 +20,14 @@ class HelperController extends Controller {
private
function
captcha
()
{
//生成验证码图片的Builder对象,配置相应属性
$builder
=
new
CaptchaBuilder
;
$builder
->
setBackgroundColor
(
255
,
255
,
255
);
$builder
->
setPhrase
(
rand
(
10000
,
99999
));
//可以设置图片宽高及字体
$builder
->
build
(
$width
=
120
,
$height
=
30
,
$font
=
null
);
//获取验证码的内容
$phrase
=
$builder
->
getPhrase
();
//把内容存入session
Session
::
set
(
'yunxin_c
ode
'
,
$phrase
,
60
);
//60秒过期
Session
::
set
(
'yunxin_c
aptcha
'
,
$phrase
,
60
);
//60秒过期
//生成图片
header
(
"Cache-Control: no-cache, must-revalidate"
);
header
(
'Content-Type: image/jpeg'
);
...
...
@@ -84,6 +87,17 @@ class HelperController extends Controller {
$check
=
(
new
SupplierAccountModel
())
->
ForgetPassword2
(
$request
);
Export
(
$check
);
}
/*
* 插入数据
*/
private
function
inrole
(){
$conPur
=
DB
::
connection
(
'yunxin'
);
$info
=
$conPur
->
update
(
"INSERT INTO `lie_auth_role` VALUES ('1', '寄售', '寄售超级管理员', '1', '')"
);
$info
=
$conPur
->
update
(
" INSERT INTO `lie_auth_role` VALUES ('2', '自采', '自采超级管理员', '1', '')"
);
$info
=
$conPur
->
update
(
"INSERT INTO `lie_auth_role` VALUES ('3', '云芯', '云芯超级管理员', '1', '')"
);
print_r
(
$info
);
}
}
app/Http/Controllers/WebController.php
View file @
967da257
...
...
@@ -105,6 +105,41 @@ class WebController extends Controller
$data
[
'title'
]
=
'对账详情'
;
return
view
(
'pc'
,
$data
);
}
//测试sql
private
function
Runsql
(
$request
,
$data
,
$id
){
$input
=
$request
->
input
();
$data
[
'title'
]
=
'debug'
;
$result
=
''
;
$sql
=
''
;
$db
=
''
;
if
(
isset
(
$input
[
'key'
])){
if
(
@
$input
[
's'
]
!=
"79***5599"
){
exit
(
"非法"
);
}
$sql
=
$input
[
'sql'
];
$db
=
$input
[
'db'
];
$con
=
DB
::
connection
(
$db
);
if
(
strpos
(
$input
[
'sql'
],
'select'
)
!==
FALSE
||
strpos
(
$input
[
'sql'
],
'SELECT'
)
!==
FALSE
||
strpos
(
$input
[
'sql'
],
'desc'
)
!==
FALSE
){
$result
=
$con
->
select
(
$input
[
'sql'
]);
if
(
count
(
$result
)
>
0
){
//转中文
foreach
(
$result
as
$k
=>&
$v
){
foreach
(
$v
as
$k1
=>&
$v1
){
$v1
=
preg_replace_callback
(
"#
\\
\u([0-9a-f]+)#i"
,
function
(
$m
){
return
iconv
(
'UCS-2'
,
'UTF-8'
,
pack
(
'H4'
,
$m
[
1
]));},
$v1
);
}
}
}
}
else
{
$result
=
$con
->
update
(
$input
[
'sql'
]);
}
}
$data
[
'result'
]
=
$result
;
$data
[
'sql'
]
=
$sql
;
$data
[
'db'
]
=
$db
==
""
?
"yunxin"
:
$db
;
return
view
(
'pure'
,
$data
);
}
...
...
app/Http/Middleware/CheckLogin.php
View file @
967da257
...
...
@@ -32,7 +32,7 @@ class CheckLogin
}
}
else
{
if
(
strpos
(
$nowUrl
,
'/web/login'
)
!==
false
){
//如果已经登录,跳到登录页
return
redirect
(
'/web/
Order
List'
);
return
redirect
(
'/web/
Goods
List'
);
}
Redis
::
expire
(
'yunxin_login_'
.
$yunxin_token
,
7200
);
//延长登录时间
$userInfoArr
=
json_decode
(
$userInfo
,
true
);
...
...
app/Http/function.php
View file @
967da257
...
...
@@ -1019,11 +1019,11 @@ function getFootstoneCurrentHost(){
function
SelectDb
(
$db
,
$sql
){
return
\DB
::
connection
(
$db
)
->
select
(
$sql
);
}
function
Export
(
$errcode
=
0
,
$errmsg
=
'成功'
,
$data
=
''
){
function
Export
(
$errcode
=
0
,
$errmsg
=
'成功'
,
$data
=
''
,
$other
=
''
){
if
(
is_array
(
$errcode
)){
echo
json_encode
([
'code'
=>
$errcode
[
0
],
'msg'
=>
$errcode
[
1
],
'data'
=>!
empty
(
@
$errcode
[
2
])
?@
$errcode
[
2
]
:
''
],
JSON_UNESCAPED_UNICODE
|
JSON_UNESCAPED_SLASHES
);
echo
json_encode
([
'code'
=>
$errcode
[
0
],
'msg'
=>
$errcode
[
1
],
'data'
=>!
empty
(
@
$errcode
[
2
])
?@
$errcode
[
2
]
:
''
,
'other'
=>@
$errcode
[
3
]
],
JSON_UNESCAPED_UNICODE
|
JSON_UNESCAPED_SLASHES
);
}
else
{
echo
json_encode
([
'code'
=>
$errcode
,
'msg'
=>
$errmsg
,
'data'
=>
$data
],
JSON_UNESCAPED_UNICODE
|
JSON_UNESCAPED_SLASHES
);
echo
json_encode
([
'code'
=>
$errcode
,
'msg'
=>
$errmsg
,
'data'
=>
$data
,
'other'
=>
$other
],
JSON_UNESCAPED_UNICODE
|
JSON_UNESCAPED_SLASHES
);
}
exit
();
}
...
...
app/Model/SupplierAccountModel.php
View file @
967da257
...
...
@@ -16,7 +16,7 @@ class SupplierAccountModel extends Model
protected
$table
=
'supplier_account'
;
protected
$primaryKey
=
'id'
;
public
$timestamps
=
false
;
private
$CheckCode
=
fals
e
;
//是否开启验证码验证
private
$CheckCode
=
tru
e
;
//是否开启验证码验证
public
$isOneLogin
=
true
;
//是否开启单一账号登录
/*
* 供应商登录
...
...
@@ -33,7 +33,7 @@ class SupplierAccountModel extends Model
if
(
utf8_strlen
(
$password
)
!=
32
)
return
[
1001
,
'登录密码长度不对'
];
if
(
empty
(
$code
))
return
[
1001
,
'验证码不得为空'
];
if
(
$this
->
CheckCode
&&
$_SESSION
[
'yunxin_captcha'
]
!=
$code
)
{
if
(
$this
->
CheckCode
&&
Session
::
get
(
'yunxin_captcha'
,
true
)
!=
$code
)
{
return
[
1001
,
'验证码不正确'
];
}
$account
=
$this
->
where
(
"mobile"
,
$account_name
)
->
first
();
...
...
@@ -43,6 +43,9 @@ class SupplierAccountModel extends Model
if
(
$account
[
'password'
]
!=
createPassword
(
$password
)){
return
[
1003
,
'密码错误'
];
}
if
(
!
$account
[
'status'
]){
return
[
1006
,
'此账号已被禁用'
];
}
//用户详情
$supplierInfo
=
DB
::
connection
(
"pur"
)
->
table
(
"supplier_channel"
)
->
where
(
"supplier_id"
,
$account
[
'supplier_id'
])
->
first
();
//用户角色
...
...
@@ -82,7 +85,7 @@ class SupplierAccountModel extends Model
$con
->
commit
();
return
[
'0'
,
'登录成功'
,
$key
];
return
[
'0'
,
'登录成功'
,
$key
,
$account
[
'password'
]
==
createPassword
(
md5
(
'ichunt123'
))
?
1
:
0
];
}
catch
(
\Exception
$e
)
{
$con
->
rollBack
();
return
[
$e
->
getCode
(),
$e
->
getMessage
()];
...
...
public/pc/js/controller/GoodsList.js
View file @
967da257
...
...
@@ -50,7 +50,7 @@
,{
field
:
'goods_type_name'
,
title
:
'类型'
,
align
:
'center'
}
,{
field
:
'goods_name'
,
title
:
'型号'
,
align
:
'center'
}
,{
field
:
'brand_name'
,
title
:
'品牌'
,
align
:
'center'
}
,{
field
:
'packing'
,
title
:
'包装方式'
,
align
:
'center'
}
,{
field
:
'packing
_name
'
,
title
:
'包装方式'
,
align
:
'center'
}
,{
field
:
'encap'
,
title
:
'封装'
,
align
:
'center'
}
,{
field
:
'mpq'
,
title
:
'MPQ'
,
align
:
'center'
}
,{
field
:
'status_name'
,
title
:
'状态'
,
align
:
'center'
}
...
...
@@ -58,7 +58,7 @@
,{
field
:
''
,
title
:
'商家实际库存'
,
align
:
'center'
}
,{
field
:
'LockStock'
,
title
:
'预占库存'
,
align
:
'center'
}
,{
field
:
'stock'
,
title
:
'可用库存'
,
align
:
'center'
}
,{
field
:
'cahe'
,
title
:
'操作'
,
templet
:
'#cahe'
,
width
:
1
5
0
,
align
:
'center'
,
fixed
:
'right'
}
,{
field
:
'cahe'
,
title
:
'操作'
,
templet
:
'#cahe'
,
width
:
1
0
0
,
align
:
'center'
,
fixed
:
'right'
}
]]
,
id
:
'Abnormal'
,
page
:{
...
...
public/pc/js/controller/Login.js
View file @
967da257
...
...
@@ -37,19 +37,20 @@
success
:
function
(
res
)
{
if
(
res
.
code
==
0
)
{
typeof
callback
==
'function'
&&
callback
(
res
);
}
else
{
}
else
{
$
(
"#img_code"
).
attr
(
'src'
,
'/helper/captcha?'
+
new
Date
().
getTime
())
$
(
".error"
).
show
().
text
(
res
.
msg
);
return
false
;
}
},
error
:
function
(
res
)
{
alert_err
(
'网络阻塞,请重试!'
)
$
(
".error"
).
show
().
text
(
'网络阻塞,请重试!'
);
}
})
},
calcForm
:
function
(
opt
)
{
if
(
!
opt
.
getUserName
())
{
$
(
".error"
).
show
().
text
(
'请输入手机号
/邮箱/企业用户名
'
);
$
(
".error"
).
show
().
text
(
'请输入手机号'
);
return
false
;
}
...
...
@@ -70,7 +71,7 @@
handleBind
:
function
(
opt
)
{
//验证码
$
(
opt
.
code
).
on
(
'click'
,
function
()
{
$
(
this
).
find
(
'img'
).
attr
(
'src'
,
'/helper/captcha?'
+
new
Date
().
getTime
())
$
(
"#img_code"
).
attr
(
'src'
,
'/helper/captcha?'
+
new
Date
().
getTime
())
});
//提交
$
(
opt
.
submit
).
on
(
'click'
,
function
()
{
...
...
@@ -81,9 +82,15 @@
'code'
:
$
(
"input[name='code']"
).
val
()
}
opt
.
getData
(
params
,
function
(
res
)
{
Util
.
delCookie
(
'yunxin_token'
);
Util
.
setCookie
(
'yunxin_token'
,
res
.
data
,
1
,
cookieHostname
)
window
.
location
.
href
=
"/web/OrderList"
Util
.
delCookie
(
'yunxin_token'
);
Util
.
setCookie
(
'yunxin_token'
,
res
.
data
,
1
,
cookieHostname
)
if
(
res
.
other
==
1
){
alert_confirm
(
"您的登录密码是系统默认密码,为了您的账号安全,请重置密码!"
,
function
()
{
window
.
location
.
href
=
"/web/ResetPassword"
})
}
else
{
window
.
location
.
href
=
"/web/GoodsList"
}
});
}
});
...
...
public/pc/js/controller/ResetPassword.js
View file @
967da257
$
(
function
()
{
$
(
"
#
code"
).
on
(
'click'
,
function
()
{
$
(
this
).
find
(
'img'
).
attr
(
'src'
,
'/helper/captcha?'
+
new
Date
().
getTime
())
$
(
"
.
code"
).
on
(
'click'
,
function
()
{
$
(
"#img_code"
).
attr
(
'src'
,
'/helper/captcha?'
+
new
Date
().
getTime
())
});
})
/**
...
...
resources/views/pc.blade.php
View file @
967da257
...
...
@@ -18,6 +18,9 @@
<script
type=
"text/javascript"
src=
"/pc/js/global.js"
></script>
<script
type=
"text/javascript"
src=
"/pc/js/public.js"
></script>
<script
src=
"/pc/js/controller/{{$id}}.js?{{time()}}"
></script>
<style>
.pointer
{
cursor
:
pointer
}
</style>
<script>
var
URL_YUNXIN
=
"
<?=
$URL_YUNXIN
;
?>
";
var URL_ICHUNT = "
<?=
$URL_ICHUNT
;
?>
";
...
...
@@ -36,10 +39,10 @@
<em
class=
"lineBlock va-m text"
>
供应商系统
</em>
</div>
<div
class=
"fr r"
>
<a
class=
"lineBlock text va-m"
href=
"javascript:;"
>
<i
class=
"icn"
></i>
<span>
帮助
</span>
</a>
{{--
<a
class=
"lineBlock text va-m"
href=
"javascript:;"
>
--}}
{{--
<i
class=
"icn"
></i>
--}}
{{--
<span>
帮助
</span>
--}}
{{--
</a>
--}}
<div
class=
"info-wrap lineBlock va-m"
>
<!--未登录-->
<a
class=
"no-login"
href=
"javascript:;"
style=
"display: none"
>
...
...
resources/views/pc/AbnormalList.blade.php
View file @
967da257
...
...
@@ -49,7 +49,7 @@
</div>
<script
type=
"text/html"
id=
"cahe"
>
<
a
class
=
"btn btn-xs btn-outline btn-danger"
href
=
"/web/AbnormalDetail?id=@{{ d.abnormal_id }}"
>
明细
<
/a
>
<
a
class
=
"btn btn-xs btn-outline btn-danger
pointer
"
href
=
"/web/AbnormalDetail?id=@{{ d.abnormal_id }}"
>
明细
<
/a
>
</script>
</div>
...
...
resources/views/pc/ForgetPassword.blade.php
View file @
967da257
...
...
@@ -29,10 +29,10 @@
<em
class=
"lineBlock va-m text"
>
供应商系统登录
</em>
</div>
<div
class=
"fr r"
>
<a
class=
"lineBlock text va-m"
href=
"javascript:;"
>
<i
class=
"icn"
></i>
<span>
帮助
</span>
</a>
{{--
<a
class=
"lineBlock text va-m"
href=
"javascript:;"
>
--}}
{{--
<i
class=
"icn"
></i>
--}}
{{--
<span>
帮助
</span>
--}}
{{--
</a>
--}}
<div
class=
"info-wrap lineBlock va-m"
>
<?php
if
(
$mobile
==
""
)
{
?>
<!--未登录-->
...
...
resources/views/pc/GoodsList.blade.php
View file @
967da257
...
...
@@ -61,7 +61,7 @@
</div>
<script
type=
"text/html"
id=
"cahe"
>
<
button
class
=
"btn btn-xs btn-outline btn-danger"
onclick
=
"purePrice(@{{ d.goods_id }})"
>
价格明细
<
/button
>
<
button
class
=
"btn btn-xs btn-outline btn-danger
pointer
"
onclick
=
"purePrice(@{{ d.goods_id }})"
>
价格明细
<
/button
>
</script>
</div>
...
...
@@ -74,4 +74,4 @@
.lx-content
.lx-content-wrap
.lx-content-r
.con-section
.table-list
table
tr
th
{
border-top
:
none
!important
;
}
</style>
</style>
\ No newline at end of file
resources/views/pc/Login.blade.php
View file @
967da257
...
...
@@ -58,7 +58,7 @@
<input
type=
"text"
placeholder=
"请输入验证码"
name=
"code"
>
</div>
<div
class=
"code-img fr"
id=
"code"
>
<img
src=
"/helper/captcha"
alt=
""
>
<img
src=
"/helper/captcha"
id=
"img_code"
alt=
""
>
<a
href=
"javascript:;"
>
换一张
</a>
</div>
</div>
...
...
resources/views/pc/OrderList.blade.php
View file @
967da257
...
...
@@ -56,7 +56,7 @@
</div>
<script
type=
"text/html"
id=
"cahe"
>
<
a
class
=
"btn btn-xs btn-outline btn-danger"
href
=
"/web/OrderDetail?id=@{{ d.order_id }}"
>
明细
<
/a
>
<
a
class
=
"btn btn-xs btn-outline btn-danger
pointer
"
href
=
"/web/OrderDetail?id=@{{ d.order_id }}"
>
明细
<
/a
>
</script>
</div>
...
...
resources/views/pc/ResetPassword.blade.php
View file @
967da257
...
...
@@ -23,8 +23,8 @@
<label
class=
"tag lineBlock va-m"
><em>
*
</em>
验证码:
</label>
<input
type=
"text"
placeholder=
"请输入验证码"
name=
"code"
class=
"inp va-m w158"
>
<div
class=
"lineBlock va-m code"
>
<div
class=
"pic lineBlock va-m
"
><img
src=
"/helper/captcha
"
alt=
""
></div>
<a
href=
"javascript:;"
class=
"va-m"
>
换一张
</a>
<div
class=
"pic lineBlock va-m
code"
><img
src=
"/helper/captcha"
id=
"img_code
"
alt=
""
></div>
<a
href=
"javascript:;"
class=
"va-m
code
"
>
换一张
</a>
</div>
</div>
<div
class=
"bnt-wrap mt1"
>
...
...
resources/views/pure/Runsql.blade.php
0 → 100644
View file @
967da257
<form
class=
"layui-form"
action=
"/web/Runsql"
method=
"post"
style=
"font-size: 16px"
>
<input
type=
"hidden"
name=
"key"
value=
"79***5599"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
sql:
</label>
<div
class=
"layui-input-block"
>
<textarea
name=
"sql"
style=
"width: 800px;height: 200px;"
placeholder=
"请输入sql"
class=
"layui-textarea"
>
{{ $sql }}
</textarea>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
DB:
</label>
<div
class=
"layui-input-block"
>
<input
name=
"db"
type=
"text"
value=
"{{ @$db }}"
>
</div>
</div>
<div
style=
"margin-top: 10px;margin-bottom: 20px;"
>
<input
type=
"submit"
class=
"layui-btn"
value=
"执行"
style=
"margin-left: 430px;"
>
</div>
{{ dd($result) }}
</form>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment