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
ea959189
Commit
ea959189
authored
Nov 22, 2018
by
zhz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store
parent
4a5d0505
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
184 additions
and
1 deletion
+184
-1
Store.php
application/controllers/Store.php
+7
-0
ImageConst.php
application/library/Our/ImageConst.php
+3
-0
StoreService.php
application/models/Business/Store/StoreService.php
+11
-1
QmStoreApplyClass.php
application/models/DAO/Store/QmStoreApplyClass.php
+95
-0
StoreJoinin.php
application/models/DAO/Store/StoreJoinin.php
+68
-0
No files found.
application/controllers/Store.php
View file @
ea959189
...
@@ -60,6 +60,13 @@ class StoreController extends \Our\Controller_AbstractIndex {
...
@@ -60,6 +60,13 @@ class StoreController extends \Our\Controller_AbstractIndex {
$this
->
success
(
$recommendWord
);
$this
->
success
(
$recommendWord
);
}
}
/**
* 获取商家资质
*/
public
function
getStoreQualificationAction
()
{
$pics
=
$this
->
storeService
->
getStoreQualification
(
$this
->
req
[
\Our\NameConst
::
data
]);
$this
->
success
(
$pics
);
}
/**
/**
* 获取推荐分类对应推荐店铺
* 获取推荐分类对应推荐店铺
*/
*/
...
...
application/library/Our/ImageConst.php
View file @
ea959189
...
@@ -37,6 +37,9 @@ class ImageConst{
...
@@ -37,6 +37,9 @@ class ImageConst{
//商家头像/banner/资质图片存放路径
//商家头像/banner/资质图片存放路径
const
storeLabel
=
'mall/store/'
;
const
storeLabel
=
'mall/store/'
;
//注册相关图片存放路径
const
Register
=
'mall/register/'
;
const
advPath
=
'mall/adv/'
;
const
advPath
=
'mall/adv/'
;
//商品、商家头像等默认图片路径
//商品、商家头像等默认图片路径
...
...
application/models/Business/Store/StoreService.php
View file @
ea959189
...
@@ -419,7 +419,17 @@ class StoreServiceModel extends \Business\AbstractModel{
...
@@ -419,7 +419,17 @@ class StoreServiceModel extends \Business\AbstractModel{
return
true
;
return
true
;
}
}
public
function
getStoreQualification
(
$param
)
{
$storeId
=
$param
[
'storeId'
];
if
(
!
$storeId
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
emptyStoreId
);
}
$storeInfo
=
\DAO\StoreModel
::
getInstance
()
->
get
(
$param
[
'storeId'
],
false
);
$pics
=
\DAO\Store\QmStoreApplyClassModel
::
getInstance
()
->
getApplyPicCache
(
$storeId
,
'file_name'
);
$join
=
\DAO\Store\StoreJoininModel
::
getInstance
()
->
getOneByMemberIdCache
(
$storeInfo
[
'member_id'
],
'business_licence_photo'
);
$join
[
'business_licence_photo'
]
&&
$pics
[]
=
\Our\Common
::
getStaticFile
(
$join
[
'business_licence_photo'
],
\Our\ImageConst
::
Register
,
'ossHost'
);
return
array
(
'qualificationPics'
=>
\DAO\Store\QmStoreApplyClassModel
::
getInstance
()
->
addWaterMark
(
$pics
));
}
/**
/**
* 获取搜索页推荐关键字
* 获取搜索页推荐关键字
* @param $param
* @param $param
...
...
application/models/DAO/Store/QmStoreApplyClass.php
0 → 100644
View file @
ea959189
<?php
namespace
DAO\Store
;
class
QmStoreApplyClassModel
extends
\DAO\AbstractModel
{
/**
* 表名
*
* @var string
*/
protected
$_tableName
=
'han_qm_store_apply_class'
;
/**
* 主键
*
* @var string
*/
protected
$_primaryKey
=
'id'
;
public
function
init
()
{
}
public
function
getList
(
$where
,
$field
)
{
$this
->
setDb
();
$data
=
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchAll
();
return
$data
;
}
public
function
getListByStoreId
(
$storeId
,
$field
)
{
$where
[
'store_id'
]
=
$storeId
;
return
$this
->
getList
(
$where
,
$field
);
}
public
function
getApplyPicCache
(
$storeId
,
$field
)
{
return
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db6\StoreRedisModel
::
getInstance
(),
array
(
&
$this
,
'getApplyPic'
),
array
(
$storeId
,
$field
),
\Our\ApiConst
::
oneDaySecond
,
array
(
$storeId
));
}
public
function
getApplyPic
(
$storeId
,
$field
)
{
$list
=
$this
->
getListByStoreId
(
$storeId
,
$field
);
$pics
=
[];
if
(
$list
)
{
foreach
(
$list
as
$v
)
{
if
(
$file_name
=
unserialize
(
$v
[
'file_name'
]))
{
if
(
in_array
(
substr
(
strrchr
(
$file_name
,
'.'
),
1
),
\Our\ArrayConst
::
imageExtensions
)){
$pics
[]
=
\Our\Common
::
getStaticFile
(
$file_name
,
\Our\ImageConst
::
Register
,
'ossHost'
);
}
}
}
}
return
$pics
;
}
public
function
addWaterMark
(
$pics
,
$filename
=
'watermark.png?x-oss-process=image/resize,P_30'
)
{
$waterPics
=
[];
if
(
is_array
(
$pics
)
&&
$pics
)
{
$position
=
[
'g_se'
,
'g_nw'
,
'g_south'
,
'g_north'
,
'g_sw'
,
'g_ne'
,
'g_east'
,
'g_west'
,
'g_center'
];
$pic
=
base64_encode
(
$filename
);
$str
=
'?x-oss-process=image/resize,w_400'
;
for
(
$i
=
0
;
$i
<
count
(
$position
);
$i
++
)
{
$str
.=
sprintf
(
'/watermark,image_%s,t_90,%s,x_10,y_10'
,
$pic
,
$position
[
$i
]);
}
foreach
(
$pics
as
$v
)
{
$waterPics
[]
=
$v
.
$str
;
}
}
return
$waterPics
;
}
/**
* 类实例
*
* @var \DAO\UserModel
*/
private
static
$_instance
=
null
;
/**
* 获取类实例
*
* @return \DAO\UserModel
*/
public
static
function
getInstance
()
{
if
(
!
(
self
::
$_instance
instanceof
self
))
{
self
::
$_instance
=
new
self
();
}
return
self
::
$_instance
;
}
}
application/models/DAO/Store/StoreJoinin.php
0 → 100644
View file @
ea959189
<?php
namespace
DAO\Store
;
class
StoreJoininModel
extends
\DAO\AbstractModel
{
/**
* 表名
*
* @var string
*/
protected
$_tableName
=
'han_store_joinin'
;
/**
* 主键
*
* @var string
*/
protected
$_primaryKey
=
'member_id'
;
public
function
init
()
{
}
public
function
getOne
(
$where
,
$field
)
{
$this
->
setDb
();
$data
=
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchOne
();
return
$data
;
}
public
function
getOneByMemberId
(
$memberId
,
$field
)
{
$where
[
'member_id'
]
=
$memberId
;
return
$this
->
getOne
(
$where
,
$field
);
}
public
function
getOneByMemberIdCache
(
$memberId
,
$field
)
{
return
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db6\StoreRedisModel
::
getInstance
(),
array
(
&
$this
,
'getOneByMemberId'
),
array
(
$memberId
,
$field
),
\Our\ApiConst
::
oneDaySecond
,
array
(
$memberId
));
}
/**
* 类实例
*
* @var \DAO\UserModel
*/
private
static
$_instance
=
null
;
/**
* 获取类实例
*
* @return \DAO\UserModel
*/
public
static
function
getInstance
()
{
if
(
!
(
self
::
$_instance
instanceof
self
))
{
self
::
$_instance
=
new
self
();
}
return
self
::
$_instance
;
}
}
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