Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
施宇
/
icsales
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
55cddd21
authored
Jul 30, 2019
by
施宇
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://119.23.72.7/shiyu/icsales
parents
df3c95cb
ea59284c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
66 additions
and
20 deletions
Application/Common/Common/function.php
Application/Common/Conf/config.php
Application/Home/Controller/BaseController.class.php
Application/Home/Controller/CmsController.class.php
Application/Home/View/QuotePrice/inquirydetail.html
Application/Home/View/Search/index.html
Application/Home/View/public/navleft.html
dist/js/global/api.js
dist/js/home/index.js
Application/Common/Common/function.php
View file @
55cddd21
...
...
@@ -411,3 +411,39 @@ function S_cms($key, $field='', $column='', $sort='', $limit='')
return
$datas
;
}
//随机生成字符串
function
createNonceStr
(
$length
=
8
)
{
$chars
=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
$str
=
""
;
for
(
$i
=
0
;
$i
<
$length
;
$i
++
)
{
$str
.=
substr
(
$chars
,
mt_rand
(
0
,
strlen
(
$chars
)
-
1
),
1
);
}
return
$str
;
}
/**
* 生成签名
* @param $timeStamp 时间戳
* @param $randomStr 随机字符串
* @return string 返回签名
*/
function
createSignature
(
$timestamp
,
$random
)
{
$arr
[
'timestamp'
]
=
$timestamp
;
$arr
[
'random'
]
=
$random
;
$arr
[
'token'
]
=
C
(
'API_TOKEN'
);
// token
sort
(
$arr
,
SORT_STRING
);
// 按照首字母大小写顺序排序
$str
=
implode
(
$arr
);
// 拼接成字符串
$signature
=
sha1
(
$str
);
// 进行加密
return
strtoupper
(
$signature
);
// 转换成大写
}
Application/Common/Conf/config.php
View file @
55cddd21
...
...
@@ -37,4 +37,5 @@ return array(
'HOME_TEMPLATE_REDIS'
=>
'home_template_datas'
,
'H5_HOME_TEMPLATE_REDIS'
=>
'h5_home_template_datas'
,
'API_TOKEN'
=>
'zbPx8gDXDfIh3ZoJcO4EH'
,
// api接口token
);
\ No newline at end of file
Application/Home/Controller/BaseController.class.php
View file @
55cddd21
...
...
@@ -54,4 +54,24 @@ class BaseController extends Controller
return
$data
;
exit
;
}
}
// 校验接口
protected
function
checkApi
(
$request
)
{
$timestamp
=
I
(
'request.timestamp'
,
''
);
$random
=
I
(
'request.random'
,
''
);
$signature
=
I
(
'request.signature'
,
''
);
if
(
!
$timestamp
&&
!
$random
&&
!
$signature
)
return
false
;
if
(
$timestamp
<
time
()
-
300
)
return
false
;
$sign
=
createSignature
(
$timestamp
,
$random
);
if
(
$signature
!=
$sign
)
return
false
;
return
true
;
}
}
\ No newline at end of file
Application/Home/Controller/CmsController.class.php
View file @
55cddd21
...
...
@@ -8,6 +8,10 @@ class CmsController extends BaseController
// 获取热门商品
public
function
getHotGoods
()
{
$res
=
$this
->
checkApi
();
// 接口校验
if
(
$res
===
false
)
return
$this
->
jsonReturn
(
11001
,
'接口校验失败'
);
$datas
=
$this
->
apiBaseCache
(
'pc_hot_goods'
,
''
,
5
);
// 热门商品
return
$this
->
jsonReturn
(
0
,
''
,
$datas
[
'data'
]);
...
...
Application/Home/View/QuotePrice/inquirydetail.html
View file @
55cddd21
This diff is collapsed.
Click to expand it.
Application/Home/View/Search/index.html
View file @
55cddd21
...
...
@@ -105,7 +105,7 @@
--
{{
#
}
}}
<
/span
>
<
div
class
=
"fl name ellipsis"
>
{{
item
.
company
_name
||
'--
'
}}
<
/div
>
<
div
class
=
"fl name ellipsis"
>
{{
item
.
company
||
'
'
}}
<
/div
>
<
/div
>
<
/div
>
{{
#
});
}}
...
...
Application/Home/View/public/navleft.html
View file @
55cddd21
...
...
@@ -24,7 +24,7 @@
<span
class=
"li_right icon iconfont"
>
</a>
<dl
<
if
condition=
"(ACTION_NAME eq 'inquiry') || (ACTION_NAME eq 'releaseinquiry') || (ACTION_NAME eq 'inquirydetail') || (ACTION_NAME eq 'quote') || (ACTION_NAME eq 'quotedetail')"
>
style="display:block"
</if>
>
<dd
<
if
condition=
"(ACTION_NAME eq 'inquiry') || (ACTION_NAME eq 'releaseinquiry') || (ACTION_NAME eq 'inquirydetail')"
>
class="active"
</if>
>
<a
href=
"/inquiry"
>
我的询价
</a></dd>
<dd
<
if
condition=
"(ACTION_NAME eq 'inquiry') || (ACTION_NAME eq 'releaseinquiry') || (ACTION_NAME eq 'inquirydetail')"
>
class="active"
</if>
>
<a
href=
"
homeicsales
/inquiry"
>
我的询价
</a></dd>
<dd
<
if
condition=
"(ACTION_NAME eq 'quote') || (ACTION_NAME eq 'quotedetail')"
>
class="active"
</if>
>
<a
href=
"homeicsales/quote"
>
我的报价
</a></dd>
</dl>
</li>
...
...
dist/js/global/api.js
View file @
55cddd21
...
...
@@ -181,11 +181,7 @@
/**
* 标记会员通知(已读)
*/
userMarkmsg
:
user_url
+
'/user/markmsg'
,
/***
* 热门搜索
*/
hotgoods
:
home_url
+
'/hotgoods'
userMarkmsg
:
user_url
+
'/user/markmsg'
};
if
(
typeof
define
===
"function"
&&
define
.
amd
)
{
return
apis
;
...
...
dist/js/home/index.js
View file @
55cddd21
...
...
@@ -4,19 +4,6 @@ $(function () {
this
.
bindFun
();
this
.
getXbData
(
1
);
this
.
getNewXj
();
this
.
getHot
();
},
getHot
:
function
(){
IcController
.
getData
(
apis
.
hotgoods
,
'GET'
,
{},
function
(
res
)
{
if
(
res
.
errcode
===
0
)
{
}
else
{
}
})
},
getXbData
:
function
(
type
)
{
//1报价 2询价
var
url
;
...
...
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