Commit ea959189 authored by zhz's avatar zhz

store

parent 4a5d0505
...@@ -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);
}
/** /**
* 获取推荐分类对应推荐店铺 * 获取推荐分类对应推荐店铺
*/ */
......
...@@ -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/';
//商品、商家头像等默认图片路径 //商品、商家头像等默认图片路径
......
...@@ -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
......
<?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;
}
}
<?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;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment