Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenchuanwen
my-yaf-project
Commits
c79355a2
Commit
c79355a2
authored
Dec 20, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into lyz_version1
parents
7cf64fa0
d3fe816a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
282 additions
and
184 deletions
+282
-184
Index.php
application/controllers/Index.php
+9
-1
ApiConst.php
application/library/Our/ApiConst.php
+2
-2
Common.php
application/library/Our/Common.php
+199
-148
PathConst.php
application/library/Our/PathConst.php
+2
-1
WechatCommon.php
application/library/Our/WechatCommon.php
+1
-1
OrderService.php
application/models/Business/Order/OrderService.php
+6
-3
ShareService.php
application/models/Business/User/ShareService.php
+43
-15
goods.phtml
application/views/index/goods.phtml
+6
-8
saleShare.phtml
application/views/index/saleShare.phtml
+1
-0
store.phtml
application/views/index/store.phtml
+13
-5
No files found.
application/controllers/Index.php
View file @
c79355a2
...
@@ -21,6 +21,14 @@ class IndexController extends \Our\Controller_Abstract {
...
@@ -21,6 +21,14 @@ class IndexController extends \Our\Controller_Abstract {
return
false
;
return
false
;
}
}
public
function
getQrcodeFlowAction
(){
$imageKey
=
$_GET
[
'imageKey'
];
$memberDb0Redis
=
\Redis\Db0\MemberRedisModel
::
getInstance
();
$imageFlow
=
$memberDb0Redis
->
tableCacheGet
(
$imageKey
);
header
(
'Content-type: image/jpg'
);
echo
$imageFlow
;
exit
;
}
public
function
getHtmlAction
(){
public
function
getHtmlAction
(){
$this
->
req
=
$this
->
getRequest
()
->
getQuery
();
$this
->
req
=
$this
->
getRequest
()
->
getQuery
();
$postData
=
$this
->
req
;
$postData
=
$this
->
req
;
...
@@ -37,7 +45,7 @@ class IndexController extends \Our\Controller_Abstract {
...
@@ -37,7 +45,7 @@ class IndexController extends \Our\Controller_Abstract {
}
}
$this
->
memberDb0Redis
=
\Redis\Db0\MemberRedisModel
::
getInstance
();
$this
->
memberDb0Redis
=
\Redis\Db0\MemberRedisModel
::
getInstance
();
$paramsStr
=
$this
->
memberDb0Redis
->
table
lpop
(
$this
->
key
);
$paramsStr
=
$this
->
memberDb0Redis
->
table
CacheGet
(
$this
->
key
);
if
(
$_GET
[
'debug'
]
==
1
){
if
(
$_GET
[
'debug'
]
==
1
){
$paramsStr
=
'{
$paramsStr
=
'{
"desc": "最优质的产品,最实惠的价格,最好的服务质量,欢迎选购",
"desc": "最优质的产品,最实惠的价格,最好的服务质量,欢迎选购",
...
...
application/library/Our/ApiConst.php
View file @
c79355a2
...
@@ -368,7 +368,7 @@ class ApiConst
...
@@ -368,7 +368,7 @@ class ApiConst
//等于0表示没有选中地址时是选中当前传入经纬度,等于1表示没有命中地址是选中地址列表中按照is_default desc,address_id desc倒序的第一条地址
//等于0表示没有选中地址时是选中当前传入经纬度,等于1表示没有命中地址是选中地址列表中按照is_default desc,address_id desc倒序的第一条地址
const
defaultAddressRoute
=
0
;
const
defaultAddressRoute
=
0
;
const
shareLimitProgrameError
=
40001
;
const
addGoodsToCart
=
1
;
//将商品加入购物车
const
addGoodsToCart
=
1
;
//将商品加入购物车
const
addBundingToCart
=
2
;
//将组合销售商品加入购物车
const
addBundingToCart
=
2
;
//将组合销售商品加入购物车
const
positionPickupCodeBegin
=
12
;
const
positionPickupCodeBegin
=
12
;
...
@@ -430,7 +430,7 @@ class ApiConst
...
@@ -430,7 +430,7 @@ class ApiConst
const
xpClientAppVersionOnline
=
'1.0.0'
;
const
xpClientAppVersionOnline
=
'1.0.0'
;
const
winClientAppVersionOnline
=
'1.0.0'
;
const
winClientAppVersionOnline
=
'1.0.0'
;
//微信小是否发布
//微信小是否发布
const
isWxPublish
=
0
;
const
isWxPublish
=
1
;
//消息模板类型
//消息模板类型
const
reachRemindMessageType
=
1
;
const
reachRemindMessageType
=
1
;
...
...
application/library/Our/Common.php
View file @
c79355a2
...
@@ -4,7 +4,8 @@ namespace Our;
...
@@ -4,7 +4,8 @@ namespace Our;
class
Common
class
Common
{
{
public
static
$requestTime
;
public
static
$requestTime
;
/**
/**
* 获取http状态码
* 获取http状态码
*
*
...
@@ -58,40 +59,42 @@ class Common
...
@@ -58,40 +59,42 @@ class Common
return
isset
(
$httpStatusCodes
[
$num
])
?
$httpStatusCodes
[
$num
]
:
''
;
return
isset
(
$httpStatusCodes
[
$num
])
?
$httpStatusCodes
[
$num
]
:
''
;
}
}
public
static
function
isCurentTimeInSection
(
$begin
,
$end
)
public
static
function
isCurentTimeInSection
(
$begin
,
$end
)
{
{
$checkDayStr
=
date
(
'Y-m-d '
,
time
());
$checkDayStr
=
date
(
'Y-m-d '
,
time
());
$timeBegin1
=
strtotime
(
$checkDayStr
.
$begin
.
":00"
);
$timeBegin1
=
strtotime
(
$checkDayStr
.
$begin
.
":00"
);
$timeEnd1
=
strtotime
(
$checkDayStr
.
$end
.
":00"
);
$timeEnd1
=
strtotime
(
$checkDayStr
.
$end
.
":00"
);
$curr_time
=
time
();
$curr_time
=
time
();
if
(
$curr_time
>=
$timeBegin1
&&
$curr_time
<=
$timeEnd1
)
if
(
$curr_time
>=
$timeBegin1
&&
$curr_time
<=
$timeEnd1
)
{
{
return
true
;
return
true
;
}
}
return
false
;
return
false
;
}
}
public
static
function
isSerialized
(
$data
)
{
$data
=
trim
(
$data
);
public
static
function
isSerialized
(
$data
)
if
(
'N;'
==
$data
)
{
$data
=
trim
(
$data
);
if
(
'N;'
==
$data
)
return
true
;
return
true
;
if
(
!
preg_match
(
'/^([adObis]):/'
,
$data
,
$badions
)
)
if
(
!
preg_match
(
'/^([adObis]):/'
,
$data
,
$badions
)
)
return
false
;
return
false
;
switch
(
$badions
[
1
]
)
{
switch
(
$badions
[
1
]
)
{
case
'a'
:
case
'a'
:
case
'O'
:
case
'O'
:
case
's'
:
case
's'
:
if
(
preg_match
(
"/^
{
$badions
[
1
]
}
:[0-9]+:.*[;}]
\$
/s"
,
$data
)
)
if
(
preg_match
(
"/^
{
$badions
[
1
]
}
:[0-9]+:.*[;}]
\$
/s"
,
$data
)
)
return
true
;
return
true
;
break
;
break
;
case
'b'
:
case
'b'
:
case
'i'
:
case
'i'
:
case
'd'
:
case
'd'
:
if
(
preg_match
(
"/^
{
$badions
[
1
]
}
:[0-9.E-]+;
\$
/"
,
$data
)
)
if
(
preg_match
(
"/^
{
$badions
[
1
]
}
:[0-9.E-]+;
\$
/"
,
$data
)
)
return
true
;
return
true
;
break
;
break
;
}
}
return
false
;
return
false
;
}
}
/**
/**
* 获取客户端IP
* 获取客户端IP
*
*
...
@@ -120,41 +123,46 @@ class Common
...
@@ -120,41 +123,46 @@ class Common
{
{
return
'http://'
.
$_SERVER
[
'HTTP_HOST'
]
.
$_SERVER
[
'REQUEST_URI'
];
return
'http://'
.
$_SERVER
[
'HTTP_HOST'
]
.
$_SERVER
[
'REQUEST_URI'
];
}
}
public
static
function
getConfig
(
$key
){
$config
=
\Yaf\Registry
::
get
(
'config'
);
public
static
function
getConfig
(
$key
)
$configValue
=
$config
->
get
(
$key
);
{
$config
=
\Yaf\Registry
::
get
(
'config'
);
$configValue
=
$config
->
get
(
$key
);
return
$configValue
;
return
$configValue
;
}
}
public
static
function
getBaseUrl
(){
public
static
function
getBaseUrl
()
{
$prefix
=
'http'
;
$prefix
=
'http'
;
if
(
self
::
is_https
())
{
if
(
self
::
is_https
())
{
$prefix
=
'https'
;
$prefix
=
'https'
;
}
}
$url
=
$prefix
.
'://'
.
$_SERVER
[
'SERVER_NAME'
];
$url
=
$prefix
.
'://'
.
$_SERVER
[
'SERVER_NAME'
];
return
$url
;
return
$url
;
}
}
public
static
function
is_https
()
{
public
static
function
is_https
()
if
(
!
empty
(
$_SERVER
[
'HTTPS'
])
&&
strtolower
(
$_SERVER
[
'HTTPS'
])
!==
'off'
)
{
{
if
(
!
empty
(
$_SERVER
[
'HTTPS'
])
&&
strtolower
(
$_SERVER
[
'HTTPS'
])
!==
'off'
)
{
return
true
;
return
true
;
}
elseif
(
isset
(
$_SERVER
[
'HTTP_X_FORWARDED_PROTO'
])
&&
$_SERVER
[
'HTTP_X_FORWARDED_PROTO'
]
===
'https'
)
{
}
elseif
(
isset
(
$_SERVER
[
'HTTP_X_FORWARDED_PROTO'
])
&&
$_SERVER
[
'HTTP_X_FORWARDED_PROTO'
]
===
'https'
)
{
return
true
;
return
true
;
}
elseif
(
!
empty
(
$_SERVER
[
'HTTP_FRONT_END_HTTPS'
])
&&
strtolower
(
$_SERVER
[
'HTTP_FRONT_END_HTTPS'
])
!==
'off'
)
{
}
elseif
(
!
empty
(
$_SERVER
[
'HTTP_FRONT_END_HTTPS'
])
&&
strtolower
(
$_SERVER
[
'HTTP_FRONT_END_HTTPS'
])
!==
'off'
)
{
return
true
;
return
true
;
}
elseif
(
$_SERVER
[
'SERVER_PORT'
]
==
89
)
{
}
elseif
(
$_SERVER
[
'SERVER_PORT'
]
==
89
)
{
return
true
;
return
true
;
}
}
return
false
;
return
false
;
}
}
/**
/**
* 获取静态资源文件
* 获取静态资源文件
*
*
* @param unknown_type $filename
* @param unknown_type $filename
*/
*/
public
static
function
getStaticFile
(
$filename
,
$directory
=
'image/'
,
$urlName
=
'ossHost'
)
public
static
function
getStaticFile
(
$filename
,
$directory
=
'image/'
,
$urlName
=
'ossHost'
)
{
{
$files
=
array
();
$files
=
array
();
$static
=
array
();
$static
=
array
();
...
@@ -197,12 +205,12 @@ class Common
...
@@ -197,12 +205,12 @@ class Common
case
'.png'
:
case
'.png'
:
case
'.apk'
:
case
'.apk'
:
foreach
(
$files
as
$f
)
{
foreach
(
$files
as
$f
)
{
$output
=
$staticUrl
.
'/'
.
$directory
.
$f
;
$output
=
$staticUrl
.
'/'
.
$directory
.
$f
;
}
}
break
;
break
;
default
:
default
:
foreach
(
$files
as
$f
)
{
foreach
(
$files
as
$f
)
{
$output
=
$staticUrl
.
'/'
.
$directory
.
$f
.
\Our\NameConst
::
jpgSuffix
;
$output
=
$staticUrl
.
'/'
.
$directory
.
$f
.
\Our\NameConst
::
jpgSuffix
;
}
}
break
;
break
;
}
}
...
@@ -222,7 +230,6 @@ class Common
...
@@ -222,7 +230,6 @@ class Common
}
}
public
static
function
generatePassword
(
$length
=
8
)
public
static
function
generatePassword
(
$length
=
8
)
{
{
// 密码字符集,可任意添加你需要的字符
// 密码字符集,可任意添加你需要的字符
...
@@ -243,17 +250,17 @@ class Common
...
@@ -243,17 +250,17 @@ class Common
*/
*/
public
static
function
bulidToken
(
$mobilePhone
=
null
,
$password
=
null
,
$zenid
=
null
,
$iso
=
null
)
public
static
function
bulidToken
(
$mobilePhone
=
null
,
$password
=
null
,
$zenid
=
null
,
$iso
=
null
)
{
{
$bassStr
=
self
::
getClientIp
();
$bassStr
=
self
::
getClientIp
();
if
(
$zenid
)
{
if
(
$zenid
)
{
$bassStr
.=
$zenid
;
$bassStr
.=
$zenid
;
}
}
if
(
$iso
)
{
if
(
$iso
)
{
$bassStr
.=
$zenid
;
$bassStr
.=
$zenid
;
}
}
if
(
empty
(
$mobilePhone
)
||
empty
(
$password
))
{
if
(
empty
(
$mobilePhone
)
||
empty
(
$password
))
{
$md5Key
=
md5
(
$bassStr
.
TIMESTAMP
);
$md5Key
=
md5
(
$bassStr
.
TIMESTAMP
);
}
else
{
}
else
{
$md5Key
=
md5
(
$bassStr
.
self
::
generatePassword
(
ApiConst
::
randLengh
)
.
TIMESTAMP
);
$md5Key
=
md5
(
$bassStr
.
self
::
generatePassword
(
ApiConst
::
randLengh
)
.
TIMESTAMP
);
}
}
return
$md5Key
;
return
$md5Key
;
}
}
...
@@ -263,34 +270,49 @@ class Common
...
@@ -263,34 +270,49 @@ class Common
* @param unknown $phone
* @param unknown $phone
* @return boolean
* @return boolean
*/
*/
public
static
function
checkMobilePhone
(
$phone
){
public
static
function
checkMobilePhone
(
$phone
)
if
(
empty
(
$phone
)
){
{
if
(
empty
(
$phone
))
{
return
false
;
return
false
;
}
}
if
(
!
preg_match
(
'/^1[3456789]\d{9}$/'
,
$phone
)
)
{
if
(
!
preg_match
(
'/^1[3456789]\d{9}$/'
,
$phone
))
{
return
false
;
return
false
;
}
}
return
true
;
return
true
;
}
}
public
static
function
getRealStr
(
$originStr
){
$result
=
str_replace
(
array
(
"
\r\n
"
,
"
\r
"
,
"
\n
"
),
""
,
$originStr
);
public
static
function
getRealStr
(
$originStr
)
$result
=
trim
(
$result
);
{
$result
=
str_replace
(
array
(
"
\r\n
"
,
"
\r
"
,
"
\n
"
),
""
,
$originStr
);
$result
=
trim
(
$result
);
return
$result
;
return
$result
;
}
}
public
static
function
getDivNum
(
$num
){
return
bcdiv
(
$num
,
100
,
2
);
public
static
function
getDivNum
(
$num
)
{
return
bcdiv
(
$num
,
100
,
2
);
}
public
static
function
mutiplicative
(
$num
)
{
return
intval
(
bcmul
(
$num
,
\Our\ApiConst
::
oneHandred
));
}
}
public
static
function
mutiplicative
(
$num
){
return
intval
(
bcmul
(
$num
,
\Our\ApiConst
::
oneHandred
));
public
static
function
isJson
(
$string
)
{
json_decode
(
$string
);
return
(
json_last_error
()
==
JSON_ERROR_NONE
);
}
}
/**
/**
* sql字符串格式化
* sql字符串格式化
* @param unknown $phone
* @param unknown $phone
* @return boolean
* @return boolean
*/
*/
public
static
function
format
()
{
public
static
function
format
()
{
$args
=
func_get_args
();
$args
=
func_get_args
();
if
(
count
(
$args
)
==
0
)
{
if
(
count
(
$args
)
==
0
)
{
return
;
return
;
...
@@ -302,45 +324,58 @@ class Common
...
@@ -302,45 +324,58 @@ class Common
$str
=
preg_replace_callback
(
'/\\{(0|[1-9]\\d*)\\}/'
,
create_function
(
'$match'
,
'$args = '
.
var_export
(
$args
,
true
)
.
'; return isset($args[$match[1]]) ? $args[$match[1]] : $match[0];'
),
$str
);
$str
=
preg_replace_callback
(
'/\\{(0|[1-9]\\d*)\\}/'
,
create_function
(
'$match'
,
'$args = '
.
var_export
(
$args
,
true
)
.
'; return isset($args[$match[1]]) ? $args[$match[1]] : $match[0];'
),
$str
);
return
$str
;
return
$str
;
}
}
//
//
public
static
function
getDriverType
(
$isstring
=
false
){
public
static
function
getDriverType
(
$isstring
=
false
)
{
$agent
=
strtolower
(
$_SERVER
[
'HTTP_USER_AGENT'
]);
$agent
=
strtolower
(
$_SERVER
[
'HTTP_USER_AGENT'
]);
//分析数据
//分析数据
$is_wx
=
(
strpos
(
$agent
,
'miniprogram'
)
||
strpos
(
$agent
,
'micromessenger'
))
?
true
:
false
;
$is_wx
=
(
strpos
(
$agent
,
'miniprogram'
)
||
strpos
(
$agent
,
'micromessenger'
))
?
true
:
false
;
$is_pc
=
(
strpos
(
$agent
,
'windows nt'
))
?
true
:
false
;
$is_pc
=
(
strpos
(
$agent
,
'windows nt'
))
?
true
:
false
;
$is_iphone
=
(
strpos
(
$agent
,
'iphone'
))
?
true
:
false
;
$is_iphone
=
(
strpos
(
$agent
,
'iphone'
))
?
true
:
false
;
$is_ipad
=
(
strpos
(
$agent
,
'ipad'
))
?
true
:
false
;
$is_ipad
=
(
strpos
(
$agent
,
'ipad'
))
?
true
:
false
;
//$is_android = (strpos($agent, 'android')) ? true : false;
//$is_android = (strpos($agent, 'android')) ? true : false;
//输出数据
//输出数据
$driverType
=
ApiConst
::
adroidType
;
$driverType
=
ApiConst
::
adroidType
;
if
(
$is_pc
){
if
(
$is_pc
)
{
$driverType
=
ApiConst
::
pcType
;
$driverType
=
ApiConst
::
pcType
;
}
}
if
(
$is_iphone
){
if
(
$is_iphone
)
{
$driverType
=
ApiConst
::
iphoneType
;
$driverType
=
ApiConst
::
iphoneType
;
}
}
if
(
$is_ipad
){
if
(
$is_ipad
)
{
$driverType
=
ApiConst
::
ipadType
;
$driverType
=
ApiConst
::
ipadType
;
}
}
if
(
$is_wx
){
if
(
$is_wx
)
{
$driverType
=
ApiConst
::
wxType
;
$driverType
=
ApiConst
::
wxType
;
}
}
if
(
$isstring
){
if
(
$isstring
)
{
switch
(
$driverType
){
switch
(
$driverType
)
{
case
ApiConst
::
pcType
:
$driverType
=
NameConst
::
pc
;
break
;
case
ApiConst
::
pcType
:
case
ApiConst
::
iphoneType
:
$driverType
=
NameConst
::
iphone
;
break
;
$driverType
=
NameConst
::
pc
;
case
ApiConst
::
adroidType
:
$driverType
=
NameConst
::
android
;
break
;
break
;
case
ApiConst
::
ipadType
:
$driverType
=
NameConst
::
ipad
;
break
;
case
ApiConst
::
iphoneType
:
default
:
ApiConst
::
zero
;
break
;
$driverType
=
NameConst
::
iphone
;
break
;
case
ApiConst
::
adroidType
:
$driverType
=
NameConst
::
android
;
break
;
case
ApiConst
::
ipadType
:
$driverType
=
NameConst
::
ipad
;
break
;
default
:
ApiConst
::
zero
;
break
;
}
}
}
}
return
$driverType
;
return
$driverType
;
}
}
public
static
function
getIdentify
(){
public
static
function
getIdentify
()
return
self
::
getClientIp
()
.
'-'
.
self
::
getDriverType
();
{
return
self
::
getClientIp
()
.
'-'
.
self
::
getDriverType
();
}
}
/**
/**
...
@@ -350,33 +385,38 @@ class Common
...
@@ -350,33 +385,38 @@ class Common
*/
*/
public
static
function
underlineToHump
(
$str
)
public
static
function
underlineToHump
(
$str
)
{
{
$str
=
preg_replace_callback
(
'/([-_]+([a-z]{1}))/i'
,
function
(
$matches
)
{
$str
=
preg_replace_callback
(
'/([-_]+([a-z]{1}))/i'
,
function
(
$matches
)
{
return
strtoupper
(
$matches
[
2
]);
return
strtoupper
(
$matches
[
2
]);
},
$str
);
},
$str
);
return
$str
;
return
$str
;
}
}
/**
/**
* 驼峰转下划线
* 驼峰转下划线
*/
*/
public
static
function
humpToLine
(
$str
){
public
static
function
humpToLine
(
$str
)
$str
=
preg_replace_callback
(
'/([A-Z]{1})/'
,
function
(
$matches
){
{
return
'_'
.
strtolower
(
$matches
[
0
]);
$str
=
preg_replace_callback
(
'/([A-Z]{1})/'
,
function
(
$matches
)
{
},
$str
);
return
'_'
.
strtolower
(
$matches
[
0
]);
},
$str
);
return
$str
;
return
$str
;
}
}
public
static
function
getTodayBeginTimpSpan
(){
$totayTimeSpan
=
strtotime
(
date
(
'Y-m-d'
));
public
static
function
getTodayBeginTimpSpan
()
{
$totayTimeSpan
=
strtotime
(
date
(
'Y-m-d'
));
return
$totayTimeSpan
;
return
$totayTimeSpan
;
}
}
/**
/**
* 驼峰数组转下划线数组
* 驼峰数组转下划线数组
* @param array $data
* @param array $data
* @return array
* @return array
*/
*/
public
static
function
convertHump
(
$data
=
array
()){
public
static
function
convertHump
(
$data
=
array
())
{
$result
=
[];
$result
=
[];
if
(
$data
)
{
if
(
$data
)
{
foreach
(
$data
as
$key
=>
$item
)
{
foreach
(
$data
as
$key
=>
$item
)
{
if
(
is_array
(
$item
)
||
is_object
(
$item
))
{
if
(
is_array
(
$item
)
||
is_object
(
$item
))
{
$result
[
self
::
humpToLine
(
$key
)]
=
self
::
convertHump
((
array
)
$item
);
$result
[
self
::
humpToLine
(
$key
)]
=
self
::
convertHump
((
array
)
$item
);
...
@@ -394,9 +434,10 @@ class Common
...
@@ -394,9 +434,10 @@ class Common
* @param array $data
* @param array $data
* @return array
* @return array
*/
*/
public
static
function
convertUnderline
(
$data
=
array
()){
public
static
function
convertUnderline
(
$data
=
array
())
{
$result
=
[];
$result
=
[];
if
(
$data
)
{
if
(
$data
)
{
foreach
(
$data
as
$key
=>
$item
)
{
foreach
(
$data
as
$key
=>
$item
)
{
if
(
is_array
(
$item
)
||
is_object
(
$item
))
{
if
(
is_array
(
$item
)
||
is_object
(
$item
))
{
$result
[
self
::
underlineToHump
(
$key
)]
=
self
::
convertUnderline
((
array
)
$item
);
$result
[
self
::
underlineToHump
(
$key
)]
=
self
::
convertUnderline
((
array
)
$item
);
...
@@ -412,19 +453,19 @@ class Common
...
@@ -412,19 +453,19 @@ class Common
public
static
function
sendTcpMessage
(
$data
,
$uid
=
false
)
public
static
function
sendTcpMessage
(
$data
,
$uid
=
false
)
{
{
$push
=
\Yaf\Registry
::
get
(
"push"
);
$push
=
\Yaf\Registry
::
get
(
"push"
);
if
(
$push
[
'open'
])
{
if
(
$push
[
'open'
])
{
$argv
=
$GLOBALS
[
'argv'
];
$argv
=
$GLOBALS
[
'argv'
];
$isDebug
=
isset
(
$argv
[
1
])
?
intval
(
$argv
[
1
])
:
false
;
$isDebug
=
isset
(
$argv
[
1
])
?
intval
(
$argv
[
1
])
:
false
;
$message
[
'data'
]
=
$data
;
$message
[
'data'
]
=
$data
;
$message
[
'uid'
]
=
$uid
;
$message
[
'uid'
]
=
$uid
;
$message
=
json_encode
(
$message
);
$message
=
json_encode
(
$message
);
$message
=
$message
.
"
\r\n
"
;
$message
=
$message
.
"
\r\n
"
;
$socket
=
socket_create
(
AF_INET
,
SOCK_STREAM
,
SOL_TCP
);
$socket
=
socket_create
(
AF_INET
,
SOCK_STREAM
,
SOL_TCP
);
if
(
!@
socket_connect
(
$socket
,
$push
[
'host'
],
$push
[
'port'
]))
{
if
(
!@
socket_connect
(
$socket
,
$push
[
'host'
],
$push
[
'port'
]))
{
return
false
;
return
false
;
}
}
// @socket_connect($socket, $push['host'], $push['port']) or die("推送连接失败");
// @socket_connect($socket, $push['host'], $push['port']) or die("推送连接失败");
$num
=
0
;
$num
=
0
;
$length
=
strlen
(
$message
);
$length
=
strlen
(
$message
);
do
{
do
{
...
@@ -448,34 +489,38 @@ class Common
...
@@ -448,34 +489,38 @@ class Common
return
$server_data
[
'data'
][
'error_code'
];
return
$server_data
[
'data'
][
'error_code'
];
}
}
}
}
}
else
{
}
else
{
return
false
;
return
false
;
}
}
}
}
public
static
function
getSortArr
(
$sortArray
){
public
static
function
getSortArr
(
$sortArray
)
{
ksort
(
$sortArray
);
ksort
(
$sortArray
);
$str
=
''
;
$str
=
''
;
foreach
(
$sortArray
as
$val
)
{
foreach
(
$sortArray
as
$val
)
{
$str
.=
$val
;
$str
.=
$val
;
}
}
return
$str
;
return
$str
;
}
}
//合并一对多列表
//合并一对多列表
public
static
function
intergrateOneToMany
(
$list1
,
$list2
,
$mergekey1
,
$mergekey2
,
$listName
=
'orderGoods'
,
$sortField
=
'gmtUpdate'
){
public
static
function
intergrateOneToMany
(
$list1
,
$list2
,
$mergekey1
,
$mergekey2
,
$listName
=
'orderGoods'
,
$sortField
=
'gmtUpdate'
)
$mergeArray
=
array
();
{
$list2key
=
array
();
$mergeArray
=
array
();
foreach
(
$list1
as
$value
){
$list2key
=
array
();
$list2key
[
$value
[
$mergekey1
]]
=
$value
;
foreach
(
$list1
as
$value
)
{
}
$list2key
[
$value
[
$mergekey1
]]
=
$value
;
$value
[
$listName
]
=
array
();
}
foreach
(
$list2
as
&
$value
){
$value
[
$listName
]
=
array
();
if
(
isset
(
$list2key
[
$value
[
$mergekey2
]])
&&!
empty
(
$list2key
[
$value
[
$mergekey2
]])){
foreach
(
$list2
as
&
$value
)
{
$list2key
[
$value
[
$mergekey2
]][
$listName
][]
=
$value
;
if
(
isset
(
$list2key
[
$value
[
$mergekey2
]])
&&
!
empty
(
$list2key
[
$value
[
$mergekey2
]]))
{
$list2key
[
$value
[
$mergekey2
]][
$listName
][]
=
$value
;
}
}
}
}
$orders
=
array_values
(
$list2key
);
$orders
=
array_values
(
$list2key
);
array_multisort
(
array_column
(
$orders
,
$sortField
),
SORT_DESC
,
$orders
);
array_multisort
(
array_column
(
$orders
,
$sortField
),
SORT_DESC
,
$orders
);
return
$orders
;
return
$orders
;
}
}
// //合并一对多列表
// //合并一对多列表
...
@@ -496,45 +541,47 @@ class Common
...
@@ -496,45 +541,47 @@ class Common
// }
// }
//合并一对一数组
//合并一对一数组
//合并一对多列表
//合并一对多列表
public
static
function
intergrateOneToOne
(
$list1
,
$list2
,
$mergekey1
,
$mergekey2
){
public
static
function
intergrateOneToOne
(
$list1
,
$list2
,
$mergekey1
,
$mergekey2
)
$mergeArray
=
array
();
{
$list2key
=
array
();
$mergeArray
=
array
();
foreach
(
$list2
as
$value
){
$list2key
=
array
();
$list2key
[
$value
[
$mergekey2
]]
=
$value
;
foreach
(
$list2
as
$value
)
{
}
$list2key
[
$value
[
$mergekey2
]]
=
$value
;
foreach
(
$list1
as
&
$value
){
}
if
(
isset
(
$list2key
[
$value
[
$mergekey1
]])
&&!
empty
(
$list2key
[
$value
[
$mergekey1
]])){
foreach
(
$list1
as
&
$value
)
{
$value
=
array_merge
(
$value
,
$list2key
[
$value
[
$mergekey1
]]);
if
(
isset
(
$list2key
[
$value
[
$mergekey1
]])
&&
!
empty
(
$list2key
[
$value
[
$mergekey1
]]))
{
$value
=
array_merge
(
$value
,
$list2key
[
$value
[
$mergekey1
]]);
}
}
array_push
(
$mergeArray
,
$value
);
array_push
(
$mergeArray
,
$value
);
}
}
return
$mergeArray
;
return
$mergeArray
;
}
}
public
static
function
sendurl
(
$url
,
$access_token
=
''
,
$data
,
$method
=
'get'
)
{
public
static
function
sendurl
(
$url
,
$access_token
=
''
,
$data
,
$method
=
'get'
)
{
//$data = str_replace("\'","'",$data);
//$data = str_replace("\'","'",$data);
if
(
strtolower
(
$method
)
==
'post'
)
{
if
(
strtolower
(
$method
)
==
'post'
)
{
$curl
=
curl_init
();
$curl
=
curl_init
();
curl_setopt
(
$curl
,
CURLOPT_URL
,
$url
.
$access_token
);
curl_setopt
(
$curl
,
CURLOPT_URL
,
$url
.
$access_token
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYPEER
,
FALSE
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYPEER
,
FALSE
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYHOST
,
FALSE
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYHOST
,
FALSE
);
}
else
{
}
else
{
$curl
=
curl_init
(
$url
.
$access_token
);
$curl
=
curl_init
(
$url
.
$access_token
);
}
}
//$curl = curl_init($url.$access_token);
//$curl = curl_init($url.$access_token);
curl_setopt
(
$curl
,
CURLOPT_FAILONERROR
,
1
);
curl_setopt
(
$curl
,
CURLOPT_FAILONERROR
,
1
);
//设置允许页面重定向
//设置允许页面重定向
curl_setopt
(
$curl
,
CURLOPT_FOLLOWLOCATION
,
1
);
curl_setopt
(
$curl
,
CURLOPT_FOLLOWLOCATION
,
1
);
//设置返回值赋给变量
//设置返回值赋给变量
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
1
);
//设置操作时间
//设置操作时间
curl_setopt
(
$curl
,
CURLOPT_TIMEOUT
,
5
);
curl_setopt
(
$curl
,
CURLOPT_TIMEOUT
,
5
);
if
(
$method
==
'post'
)
{
if
(
$method
==
'post'
)
{
if
(
!
$data
)
$data
=
''
;
if
(
!
$data
)
$data
=
''
;
// 使用post 请
// 使用post 请
curl_setopt
(
$curl
,
CURLOPT_POST
,
1
);
curl_setopt
(
$curl
,
CURLOPT_POST
,
1
);
// 设置请求参数
// 设置请求参数
curl_setopt
(
$curl
,
CURLOPT_POSTFIELDS
,
$data
);
curl_setopt
(
$curl
,
CURLOPT_POSTFIELDS
,
$data
);
}
}
//开始事务
//开始事务
...
@@ -543,14 +590,15 @@ class Common
...
@@ -543,14 +590,15 @@ class Common
return
$r
;
return
$r
;
}
}
public
static
function
aliyunExpressApi
(
$expressNo
,
$expressType
){
public
static
function
aliyunExpressApi
(
$expressNo
,
$expressType
)
{
$host
=
SecretKeys
::
expressUrl
;
$host
=
SecretKeys
::
expressUrl
;
$path
=
SecretKeys
::
expressPath
;
$path
=
SecretKeys
::
expressPath
;
$method
=
"GET"
;
$method
=
"GET"
;
$appcode
=
SecretKeys
::
expressAppCode
;
$appcode
=
SecretKeys
::
expressAppCode
;
$headers
=
array
();
$headers
=
array
();
array_push
(
$headers
,
"Authorization:APPCODE "
.
$appcode
);
array_push
(
$headers
,
"Authorization:APPCODE "
.
$appcode
);
$querys
=
self
::
format
(
"no=
{
0}&type={1
}
"
,
$expressNo
,
$expressType
);
$querys
=
self
::
format
(
"no=
{
0}&type={1
}
"
,
$expressNo
,
$expressType
);
$bodys
=
""
;
$bodys
=
""
;
$url
=
$host
.
$path
.
"?"
.
$querys
;
$url
=
$host
.
$path
.
"?"
.
$querys
;
$curl
=
curl_init
();
$curl
=
curl_init
();
...
@@ -560,22 +608,23 @@ class Common
...
@@ -560,22 +608,23 @@ class Common
curl_setopt
(
$curl
,
CURLOPT_FAILONERROR
,
false
);
curl_setopt
(
$curl
,
CURLOPT_FAILONERROR
,
false
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
true
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
true
);
curl_setopt
(
$curl
,
CURLOPT_HEADER
,
false
);
curl_setopt
(
$curl
,
CURLOPT_HEADER
,
false
);
if
(
ApiConst
::
one
==
strpos
(
"$"
.
$host
,
"https://"
))
if
(
ApiConst
::
one
==
strpos
(
"$"
.
$host
,
"https://"
))
{
{
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYPEER
,
false
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYPEER
,
false
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYHOST
,
false
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYHOST
,
false
);
}
}
$res
=
curl_exec
(
$curl
);
$res
=
curl_exec
(
$curl
);
return
json_decode
(
$res
,
true
);
return
json_decode
(
$res
,
true
);
}
}
/**
/**
* 价格格式化
* 价格格式化
*
*
* @param int
$price
* @param int
$price
* @return string
$price_format
* @return string
$price_format
*/
*/
public
static
function
priceFormat
(
$price
)
{
public
static
function
priceFormat
(
$price
)
$price_format
=
number_format
(
$price
,
2
,
'.'
,
''
);
{
$price_format
=
number_format
(
$price
,
2
,
'.'
,
''
);
return
$price_format
;
return
$price_format
;
}
}
...
@@ -584,10 +633,11 @@ class Common
...
@@ -584,10 +633,11 @@ class Common
* 获取当前访问用户地址
* 获取当前访问用户地址
* @return string
* @return string
*/
*/
public
static
function
getIP
(){
public
static
function
getIP
()
{
static
$realip
;
static
$realip
;
if
(
isset
(
$_SERVER
)){
if
(
isset
(
$_SERVER
))
{
if
(
isset
(
$_SERVER
[
"HTTP_X_FORWARDED_FOR"
])){
if
(
isset
(
$_SERVER
[
"HTTP_X_FORWARDED_FOR"
]))
{
$realip
=
$_SERVER
[
"HTTP_X_FORWARDED_FOR"
];
$realip
=
$_SERVER
[
"HTTP_X_FORWARDED_FOR"
];
}
else
if
(
isset
(
$_SERVER
[
"HTTP_CLIENT_IP"
]))
{
}
else
if
(
isset
(
$_SERVER
[
"HTTP_CLIENT_IP"
]))
{
$realip
=
$_SERVER
[
"HTTP_CLIENT_IP"
];
$realip
=
$_SERVER
[
"HTTP_CLIENT_IP"
];
...
@@ -595,7 +645,7 @@ class Common
...
@@ -595,7 +645,7 @@ class Common
$realip
=
$_SERVER
[
"REMOTE_ADDR"
];
$realip
=
$_SERVER
[
"REMOTE_ADDR"
];
}
}
}
else
{
}
else
{
if
(
getenv
(
"HTTP_X_FORWARDED_FOR"
)){
if
(
getenv
(
"HTTP_X_FORWARDED_FOR"
))
{
$realip
=
getenv
(
"HTTP_X_FORWARDED_FOR"
);
$realip
=
getenv
(
"HTTP_X_FORWARDED_FOR"
);
}
else
if
(
getenv
(
"HTTP_CLIENT_IP"
))
{
}
else
if
(
getenv
(
"HTTP_CLIENT_IP"
))
{
$realip
=
getenv
(
"HTTP_CLIENT_IP"
);
$realip
=
getenv
(
"HTTP_CLIENT_IP"
);
...
@@ -611,10 +661,11 @@ class Common
...
@@ -611,10 +661,11 @@ class Common
* @param $ip
* @param $ip
* @return array|bool
* @return array|bool
*/
*/
public
static
function
getIpCity
(
$ip
){
public
static
function
getIpCity
(
$ip
)
$url
=
"http://ip.taobao.com/service/getIpInfo.php?ip="
.
$ip
;
{
$ip
=
json_decode
(
file_get_contents
(
$url
));
$url
=
"http://ip.taobao.com/service/getIpInfo.php?ip="
.
$ip
;
if
((
string
)
$ip
->
code
==
'1'
){
$ip
=
json_decode
(
file_get_contents
(
$url
));
if
((
string
)
$ip
->
code
==
'1'
)
{
return
false
;
return
false
;
}
}
$data
=
(
array
)
$ip
->
data
;
$data
=
(
array
)
$ip
->
data
;
...
...
application/library/Our/PathConst.php
View file @
c79355a2
...
@@ -17,7 +17,8 @@ class PathConst {
...
@@ -17,7 +17,8 @@ class PathConst {
const
wxGoodsParams
=
"id=
{
0
}
"
;
const
wxGoodsParams
=
"id=
{
0
}
"
;
//1:店铺小程序二维码生成路径,2:商品小程序二维码路径
//1:店铺小程序二维码生成路径,2:商品小程序二维码路径
const
wxStorePath
=
"pages/shops/home/index"
;
const
wxStorePath
=
"pages/shops/home/index"
;
const
wxGoodsPath
=
"pages/products/home/index"
;
const
wxGoodsPath
=
"pages/products/details/index"
;
// const wxGoodsPath="pages/goods/home/index";
//默认小程序的图片
//默认小程序的图片
const
wxDefaultPath
=
"/data/img/qrcode.jpg"
;
const
wxDefaultPath
=
"/data/img/qrcode.jpg"
;
//下载app的页面
//下载app的页面
...
...
application/library/Our/WechatCommon.php
View file @
c79355a2
...
@@ -73,7 +73,7 @@ class WechatCommon
...
@@ -73,7 +73,7 @@ class WechatCommon
}
}
public
function
httpsPostJson
(
$url
,
$data
=
''
,
$array
=
tru
e
)
public
function
httpsPostJson
(
$url
,
$data
=
''
,
$array
=
fals
e
)
{
{
$curl
=
curl_init
(
$url
);
$curl
=
curl_init
(
$url
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYPEER
,
FALSE
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYPEER
,
FALSE
);
...
...
application/models/Business/Order/OrderService.php
View file @
c79355a2
...
@@ -670,9 +670,12 @@ class OrderServiceModel extends \Business\AbstractModel
...
@@ -670,9 +670,12 @@ class OrderServiceModel extends \Business\AbstractModel
//更新订单信息
//更新订单信息
$updateData
=
array
(
'order_state'
=>
ApiConst
::
orderStateCancel
,
'is_effective'
=>
ApiConst
::
cancelOrderAuto
);
$updateData
=
array
(
'order_state'
=>
ApiConst
::
orderStateCancel
,
'is_effective'
=>
ApiConst
::
cancelOrderAuto
);
$update
=
$orderDao
->
update
(
array
(
'order_id'
=>
$order
[
'orderId'
]),
$updateData
);
$update
=
$orderDao
->
update
(
array
(
'order_id'
=>
$order
[
'orderId'
]),
$updateData
);
$updateCommonData
[
'order_message'
]
=
DescribeConst
::
cancelOrderMessage
;
// $updateCommonData['order_message']=DescribeConst::cancelOrderMessage;
$res
=
$orderCommonDao
->
update
(
array
(
'order_id'
=>
$order
[
'orderId'
]),
$updateCommonData
);
// $res=$orderCommonDao->update(array('order_id'=>$order['orderId']),$updateCommonData);
if
(
!
$update
||
!
$res
){
// if(!$update || !$res){
// echo '订单:'.$order['orderId'].'没取消成功!';
// }
if
(
!
$update
){
echo
'订单:'
.
$order
[
'orderId'
]
.
'没取消成功!'
;
echo
'订单:'
.
$order
[
'orderId'
]
.
'没取消成功!'
;
}
}
//$orderGoodsUpdateData['refund_state_name']='退款成功';
//$orderGoodsUpdateData['refund_state_name']='退款成功';
...
...
application/models/Business/User/ShareService.php
View file @
c79355a2
...
@@ -79,7 +79,7 @@ class ShareServiceModel extends \Business\AbstractModel
...
@@ -79,7 +79,7 @@ class ShareServiceModel extends \Business\AbstractModel
}
}
public
function
saveDataToSession
(
$data
){
public
function
saveDataToSession
(
$data
){
$this
->
memberDb0Redis
=
\Redis\Db0\MemberRedisModel
::
getInstance
();
$this
->
memberDb0Redis
=
\Redis\Db0\MemberRedisModel
::
getInstance
();
$res
=
$this
->
memberDb0Redis
->
table
rpush
(
$data
[
'key'
],
json_encode
(
$data
)
);
$res
=
$this
->
memberDb0Redis
->
table
CacheSet
(
$data
[
'key'
],
json_encode
(
$data
),
ApiConst
::
oneDaySecond
);
return
$res
;
return
$res
;
}
}
//二进制转图片image/png
//二进制转图片image/png
...
@@ -111,6 +111,12 @@ class ShareServiceModel extends \Business\AbstractModel
...
@@ -111,6 +111,12 @@ class ShareServiceModel extends \Business\AbstractModel
return
Common
::
format
(
PathConst
::
shareGroups
,
$data
[
'groupId'
],
$data
[
'storeId'
]);
return
Common
::
format
(
PathConst
::
shareGroups
,
$data
[
'groupId'
],
$data
[
'storeId'
]);
}
}
if
(
$type
=
'smallPrograme'
){
$host
=
\Bootstrap
::
getUrlIniConfig
(
'resourcesHost'
);
$url
=
Common
::
format
(
$host
.
"/index/getQrcodeFlow?imageKey=
{
0
}
"
,
$data
);
return
$url
;
}
}
}
public
function
growQrcode
(
$data
){
public
function
growQrcode
(
$data
){
...
@@ -121,12 +127,21 @@ class ShareServiceModel extends \Business\AbstractModel
...
@@ -121,12 +127,21 @@ class ShareServiceModel extends \Business\AbstractModel
$scene
=
\Our\Common
::
format
(
\Our\PathConst
::
wxStoreParams
,
$data
[
'id'
]);
$scene
=
\Our\Common
::
format
(
\Our\PathConst
::
wxStoreParams
,
$data
[
'id'
]);
$page
=
\Our\PathConst
::
wxStorePath
;
$page
=
\Our\PathConst
::
wxStorePath
;
$res
=
$this
->
getQrcode
(
$page
,
$scene
);
$res
=
$this
->
getQrcode
(
$page
,
$scene
);
$fileName
=
md5
(
$page
.
$res
);
if
(
Common
::
isJson
(
$res
)){
$fileName
=
$fileName
.
NameConst
::
jpgSuffix
;
$res
=
json_decode
(
$res
,
true
);
$base64image
=
$this
->
dataUri
(
$res
,
ImageConst
::
imagePgn
);
if
(
$res
[
'errcode'
]
==
ApiConst
::
shareLimitProgrameError
){
$url
=
ImageUtil
::
uploadBase64Image
(
$base64image
,
ImageConst
::
shareImage
,
$fileName
);
$memberRedis
=
\Redis\Db0\MemberRedisModel
::
getInstance
();
$this
->
memberDb0Redis
->
tableCacheSet
(
$fileName
,
$url
,
ApiConst
::
zero
);
$memberRedis
->
tableDel
(
'wechatAccessToken'
);
return
$url
;
$res
=
$this
->
getQrcode
(
$page
,
$scene
);
}
}
$fileName
=
md5
(
$res
);
//$fileName=$fileName.NameConst::jpgSuffix;
// $base64image=$this->dataUri($res,ImageConst::imagePgn);
// $url= ImageUtil::uploadBase64Image($base64image,ImageConst::shareImage,$fileName);
$this
->
memberDb0Redis
->
tableCacheSet
(
$fileName
,
$res
,
ApiConst
::
oneDaySecond
);
$qrcodeUrl
=
$this
->
getQrUrl
(
$fileName
,
'smallPrograme'
);
return
$qrcodeUrl
;
}
else
{
}
else
{
return
$this
->
getQrUrl
(
$data
);
return
$this
->
getQrUrl
(
$data
);
// return PathConst::wxDefaultPath;
// return PathConst::wxDefaultPath;
...
@@ -140,15 +155,28 @@ class ShareServiceModel extends \Business\AbstractModel
...
@@ -140,15 +155,28 @@ class ShareServiceModel extends \Business\AbstractModel
if
(
$data
[
'type'
]
==
\Our\ApiConst
::
shareGoods
){
if
(
$data
[
'type'
]
==
\Our\ApiConst
::
shareGoods
){
if
((
$data
[
'shareType'
]
==
ApiConst
::
shareWxFriend
||
$data
[
'shareType'
]
==
ApiConst
::
shareWxFriends
)){
if
((
$data
[
'shareType'
]
==
ApiConst
::
shareWxFriend
||
$data
[
'shareType'
]
==
ApiConst
::
shareWxFriends
)){
if
(
\Our\ApiConst
::
isWxPublish
){
if
(
\Our\ApiConst
::
isWxPublish
){
$scene
=
\Our\Common
::
format
(
\Our\PathConst
::
wxGoodsParams
,
$data
[
'id'
]);
//$scene= \Our\Common::format(\Our\PathConst::wxGoodsParams,$data['id']);
$page
=
\Our\PathConst
::
wxGoodsPath
;
$scene
=
\Our\Common
::
format
(
\Our\PathConst
::
wxGoodsParams
,
$data
[
'goodsCommonid'
]);
$page
=
\Our\PathConst
::
wxStorePath
;
$res
=
$this
->
getQrcode
(
$page
,
$scene
);
$res
=
$this
->
getQrcode
(
$page
,
$scene
);
$fileName
=
md5
(
$page
.
$res
);
if
(
Common
::
isJson
(
$res
)){
$fileName
=
$fileName
.
NameConst
::
jpgSuffix
;
$res
=
json_decode
(
$res
,
true
);
$base64image
=
$this
->
dataUri
(
$res
,
ImageConst
::
imagePgn
);
if
(
$res
[
'errcode'
]
==
ApiConst
::
shareLimitProgrameError
){
$url
=
ImageUtil
::
uploadBase64Image
(
$base64image
,
ImageConst
::
shareImage
,
$fileName
);
$memberRedis
=
\Redis\Db0\MemberRedisModel
::
getInstance
();
$this
->
memberDb0Redis
->
tableCacheSet
(
$fileName
,
$url
,
ApiConst
::
zero
);
$memberRedis
->
tableDel
(
'wechatAccessToken'
);
return
$url
;
$res
=
$this
->
getQrcode
(
$page
,
$scene
);
}
}
// var_dump($res);exit;
// header('Content-type: image/jpg');
// echo $res;exit;
$fileName
=
md5
(
$res
);
//$fileName=$fileName.NameConst::jpgSuffix;
// $base64image=$this->dataUri($res,ImageConst::imagePgn);
// $url= ImageUtil::uploadBase64Image($base64image,ImageConst::shareImage,$fileName);
$this
->
memberDb0Redis
->
tableCacheSet
(
$fileName
,
$res
,
ApiConst
::
oneDaySecond
);
$qrcodeUrl
=
$this
->
getQrUrl
(
$fileName
,
'smallPrograme'
);
return
$qrcodeUrl
;
}
else
{
}
else
{
return
$this
->
getQrUrl
(
$data
,
'goods'
);
return
$this
->
getQrUrl
(
$data
,
'goods'
);
//return PathConst::wxDefaultPath;
//return PathConst::wxDefaultPath;
...
...
application/views/index/goods.phtml
View file @
c79355a2
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
<span
id=
"price"
></span>
<span
id=
"price"
></span>
</div>
</div>
<div
class=
"qrcode"
id=
"qrcode"
>
<div
class=
"qrcode"
id=
"qrcode"
>
<img
id=
"qrImg"
src=
""
/>
<img
id=
"qrImg"
width=
"250"
height=
"250"
src=
""
/>
<div
id=
"qrcodeImg"
></div>
<div
id=
"qrcodeImg"
></div>
<p
id=
"tip"
></p>
<p
id=
"tip"
></p>
</div>
</div>
...
@@ -63,13 +63,11 @@
...
@@ -63,13 +63,11 @@
if
(
pageObj
.
price
!=
pageObj
.
discount
)
if
(
pageObj
.
price
!=
pageObj
.
discount
)
document
.
getElementById
(
"price"
).
innerHTML
=
"<span style='font-size:30px;'>¥</span>"
+
(
pageObj
.
price
/
100
).
toFixed
(
2
);
document
.
getElementById
(
"price"
).
innerHTML
=
"<span style='font-size:30px;'>¥</span>"
+
(
pageObj
.
price
/
100
).
toFixed
(
2
);
if
(
pageObj
.
type
<=
2
){
new
QRCode
(
document
.
getElementById
(
'qrcodeImg'
),
pageObj
.
url
);
document
.
getElementById
(
"qrImg"
).
src
=
pageObj
.
qrImg
;}
// if(pageObj.type
<=
2
){
else
{
// document.getElementById("qrImg").src = pageObj.qrImg;}
new
QRCode
(
document
.
getElementById
(
'qrcodeImg'
),
pageObj
.
url
);
// else{
}
// new QRCode(document.getElementById('qrcodeImg'), pageObj.url);
// }
...
...
application/views/index/saleShare.phtml
View file @
c79355a2
...
@@ -161,6 +161,7 @@
...
@@ -161,6 +161,7 @@
</div>
</div>
</body>
</body>
<script>
<script>
// new QRCode(document.getElementById('qrcodeImg'), {
// new QRCode(document.getElementById('qrcodeImg'), {
// text: '
<?php
//echo $params['qrCode']."?x-oss-process=image/resize,m_fill,h_186,w_186";?>//',
// text: '
<?php
//echo $params['qrCode']."?x-oss-process=image/resize,m_fill,h_186,w_186";?>//',
// width: 250,
// width: 250,
...
...
application/views/index/store.phtml
View file @
c79355a2
...
@@ -162,11 +162,19 @@
...
@@ -162,11 +162,19 @@
</div>
</div>
</body>
</body>
<script>
<script>
new
QRCode
(
document
.
getElementById
(
'qrcodeImg'
),
{
var
shareType
=
"
<?php
echo
$params
[
'shareType'
];
?>
"
;
text
:
'
<?php
echo
$params
[
'qrCode'
];
?>
'
,
var
qrCode
=
'
<?php
echo
$params
[
'qrCode'
];
?>
'
;
width
:
250
,
var
shareType
=
parseInt
(
shareType
);
height
:
250
if
(
shareType
==
1
||
shareType
==
2
){
document
.
getElementById
(
'qrcodeImg'
).
innerHTML
=
'<img id="qrcodeImg" src="'
+
qrCode
+
'" alt="">'
;
}
else
{
new
QRCode
(
document
.
getElementById
(
'qrcodeImg'
),
{
text
:
'
<?php
echo
$params
[
'qrCode'
];
?>
'
,
width
:
250
,
height
:
250
});
}
});
</script>
</script>
</html>
</html>
\ No newline at end of file
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