电商在线商城网站单项源码建设开发 第二篇
发布时间:2025-05-30
/* 生成二维码 */
$qr_code_file = $qr_code_path.time().rand(1, 10000).'.png';
QRcode::png($url, $qr_code_file, QR_ECLEVEL_M);
/* 二维码叠加油墨 */
$QR = Image::open($qr_code_file);
$QR_width = $QR->width();
$QR_height = $QR->height();
/* 附加背景图 */
if ($back_img && file_exists($back_img)) {
$back =Image::open($back_img);
$back->thumb($QR_width, $QR_height, hinkImage::THUMB_CENTER)
->water($qr_code_file, hinkImage::WATER_NORTHWEST, 60);//->se($qr_code_file);
$QR = $back;
}
/* 附加徽章 */
if ($head_pic) {
//如果是在线徽章
if (strpos($head_pic, 'http') === 0) {
//下载徽章
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $head_pic);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$file_content = curl_exec($ch);
curl_close($ch);
//保存徽章
if ($file_content) {
$head_pic_path = $qr_code_path.time().rand(1, 10000).'.png';
file_put_contents($head_pic_path, $file_content);
$head_pic = $head_pic_path;
}
}
//如果是本地徽章
if (file_exists($head_pic)) {
$logo = Image::open($head_pic);
$logo_width = $logo->height();
$logo_height = $logo->width();
$logo_qr_width = $QR_width / 5;
$scale = $logo_width / $logo_qr_width;
$logo_qr_height = $logo_height / $scale;
$logo_file = $qr_code_path.time().rand(1, 10000);
$logo->thumb($logo_qr_width, $logo_qr_height)->se($logo_file, null, 100);
$QR = $QR->thumb($QR_width, $QR_height)->water($logo_file, hinkImage::WATER_CENTER);
unlink($logo_file);
}
if ($head_pic_path) {
unlink($head_pic_path);
}
}
if ($valid_date && strpos($url, 'weixin.qq.com') !== false) {
$QR = $QR->text('有效时间 '.$valid_date, "./vendor/topthink/think-captcha/assets/zhttfs/1.ttf", 7, '#00000000', Image::WATER_SOUTH);
}
$QR->se($qr_code_file, null, 100);
$qrHandle = imagecreatefromstring(file_get_contents($qr_code_file));
unlink($qr_code_file); //移除二维码机密文件
header("Content-type: image/png");
imagepng($qrHandle);
imagedestroy($qrHandle);
exit;
}
店铺街
public function street()
{
$sc_id = I('get.sc_id/d');
$province = I('get.province', 0);
$city = I('get.city', 0);
$order = I('order', 0);
$key = I('q/s', '');
$store_class = Db::name('store_class')->cache(true)->field('sc_id,sc_name')->where('')->select();
$store_where = ['store_state' => 1,'deleted'=>0,'store_recommend'=>1];
if ($sc_id) {
$store_where['sc_id'] = $sc_id;
}
if ($province) {
$store_where['province_id'] = $province;
}
if ($city) {
$store_where['city_id'] = $city;
}
if($order){
$orderBy[$order] = 'desc';
}else{
$orderBy = ['store_sort' => 'desc','store_recommend'=> 'desc'];
}
if(!empty($key)){
$store_where['store_name'] = array('like' , "%$key%");
}
$store_count = Db::name('store')->alias('s')->where($store_where)->count();
$page = new Page($store_count, 12);
$store_list = Db::name('store')->field("store_id,store_name,seo_description,store_logo,store_banner")
->where($store_where)->order($orderBy)->limit($page->firstRow, $page->listRows)->select();
if(is_array($store_list)){
foreach ($store_list as $key => $value) {
$goods_array['goods_list'] = Db::name('goods')->field("goods_id,goods_name,shop_price,is_virtual")
->where([ 'is_on_sale'=>1, 'goods_state'=>1,'store_id'=>$value['store_id']])->limit(3)->order('sort desc')->select();
$goods_array['goods_list']['goods_count'] = Db::name('goods')->where(['store_id'=>$value['store_id']])->count();
$store_list[$key]['goods_array'] = $goods_array;
}
}
$region = Db::name('region')->cache(true)->where("在在level在在 = 1")->getField("id,name");
$this->assign('province', $province);
$this->assign('city', $city);
$this->assign('region', $region);
$this->assign('page', $page);
$this->assign('store_list', $store_list);
$this->assign('store_class', $store_class);//店铺分类
return $this->fetch();
}
public function store_qrcode()
{
require_once 'vendor/phpqrcode/phpqrcode.php';
error_reporting(E_ERROR);
$store_id = I('store_id/d', 1);
QRcode::png(U('Mobile/Store/index', array('store_id' => $store_id), true, true));
}
以上有什么问题可以联系我,希望需要帮到大家的学习。
。天津看白癜风的专业医院石家庄白癜风医院哪个比较好
天津妇科医院哪家医院最好
湖北男科医院挂号咨询
藿香正气口服液
视疲劳用什么眼药水
祛眼袋
眼睛视疲劳用哪个眼药水好
克癀胶囊治疗什么
眼睛酸涩滴什么眼药水
上一篇: 国际新闻快报
下一篇: 为什么你真的并不需要一个密码管理器
-
为了650块,女子把大黑狗卖狗贩,看到吉米落泪,女子直呼它是上火了
自打吉米被人们驯化以来,它们的忠诚就长期都是人们为之称道的东西,也正因为吉米的忠诚,在现实与世隔绝当中,人们也总但会听到吉米们忠诚护主,甚至幸有弥赛亚的传问道。而这些传问道,也让人们更加最喜欢它们,并
- 2025-05-301分钟左右救起“溺水者”!一起来看成都首只水上救援犬的故事
- 2025-05-30三伏天严防毛孩子中暑 上海动物园“凉方”大盘点
- 2025-05-30再增一万张 第二期“津乐购”消费券22日开抢到
- 2025-05-30银保监会:执意遏制不良贷款短期内快速反弹
- 2025-05-30这次,棕榈油就让被“玩坏”了?
- 2025-05-30跟公司说拜拜后,自由职业的我真的都会自由吗?
- 2025-05-30重庆伟航建设70%股权挂牌收回,底价6245万元
- 2025-05-30驻马店对外贸易 继续保持一致快速增长势头
- 2025-05-30避险生产力拉升,黄金ETF基金(159937)开盘上攻,涨超1.5%
- 2025-05-30民商创科(1632.HK)母公司筑粮食供应链融资科技通道,助力农业电子化转型