当前位置:网站首页>Product system module of advertising e-commerce system development function
Product system module of advertising e-commerce system development function
2022-08-07 03:39:00 【weixin_2047679575】
Before writing this system technology series,Let’s talk about the advertising e-commerce system first?
The function of advertising e-commerce system,It is also an online shopping mall,In the product function system of the shopping mall,Implanted the mode of watching advertisements
The entire advertising e-commerce system architecture has multiple modules and functional points,Because there is a lot of content to develop an advertising e-commerce system,Today I will share with you the product system module of the advertising e-commerce system,This module involves all products in the entire mall system,This module is an important part of the advertising e-commerce system.
The product system module of the advertising e-commerce system
Small feature points included:产品管理,产品列表,产品搜索,产品收藏,产品详情,产品分享

1.产品管理
Product management features include product listings,下架,修改,删除的功能.Product parameter upload includes cover image、Submap upload,Product video upload.
Product videos are available2种方式,Upload videos directly in the advertising e-commerce system,And automatically generate a video-specific link for the current product,The other is to directly post the video address in the library.When the re-advertising e-commerce system is displayed in the foreground,The product detail page automatically loads the current video introduction,At the same time, in order to optimize the interference of video and sound to users,In the product video properties, you can set whether the system will enable playback sound or display sound by default.
2.产品列表
The system settings product function includes the product window list mode,There are one-line lists,也可以选择2格或者3grid list.Products have attribute screening designs,List by price range,按照价格升序排序,按照价格降序排序,Filter by brand multi-select check method.
3.产品搜索
Search by product keyword,Find the origin
3.产品收藏
Enter the product details page to add the current product to your favorites,There is a list of product favorites in the member center,At the same time, you can also cancel the current product collection in the product collection area
4.产品详情
Product details include product name introduction,产品热度,Product video playback,Product photo slideshow,Product details parameter introduction,产地,库存,Order quantity related data,Product review content list,Product collection function,加入购物车功能,Product sharing function
5.产品分享
Let's talk about the product sharing function here,If the member is not logged in,Click Share and the system will pop up the account login box;If the member is already logged in,Then when to share,The system will generate a poster.The poster content contains product images,二维码,会员昵称,And the current QR code information also includes the member's sharing and promotion information,When a new user scans the code,The system will default to the current senior member of the new user,is the current sharing member.
<?php
namespace app\api\controller\activity;
use app\admin\model\store\StoreDescription;
use app\admin\model\store\StoreProductAttrValue;
use app\Request;
use think\facade\Route;
use app\models\user\{
User, WechatUser
};
use app\admin\model\system\SystemAttachment;
use app\models\routine\{
RoutineCode, RoutineTemplate
};
use app\models\store\{StoreBargain, StoreBargainUser, StoreBargainUserHelp, StoreOrder,
StoreProductAttr, StoreVisit};
use crmeb\services\{
GroupDataService, UtilService, WechatTemplateService
};
use crmeb\services\upload\Upload;
/**
* 产品类
* Class StoreBargainController
* @package app\api\controller\activity
*/
class StoreBargainController
{
/**
* Product list top image
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function config()
{
$lovely = sys_data('routine_lovely') ?? [];//banner图
$info = isset($lovely[2]) ? $lovely[2] : [];
return app('json')->successful($info);
}
/**
* 产品列表
* @param Request $request
* @return mixed
*/
public function lst(Request $request)
{
list($page, $limit) = UtilService::getMore([
['page', 0],
['limit', 0],
], $request, true);
$bargainList = StoreBargain::getList($page, $limit);
return app('json')->successful($bargainList);
}
/**
* Product details and current login information
* @param Request $request
* @param $id
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function detail(Request $request, $id)
{
if (!$id) return app('json')->fail('参数错误');
if (!($bargain = StoreBargain::getBargainTerm($id))) return app('json')->fail('Product has ended');
StoreBargain::addBargainLook($id);
$bargain['time'] = time();
$user = $request->user();
$data['userInfo']['uid'] = $user['uid'];
$data['userInfo']['nickname'] = $user['nickname'];
$data['userInfo']['avatar'] = $user['avatar'];
$bargain['description'] = htmlspecialchars_decode(StoreDescription::getDescription($id, 2));
list($productAttr, $productValue) = StoreProductAttr::getProductAttrDetail($id, $user['uid'],
0, 2);
foreach ($productValue as $k => $v) {
$v['product_stock'] = StoreProductAttrValue::where('product_id', $bargain
['product_id'])->where('suk', $v['suk'])->where('type', 0)->value('stock');
$bargain['attr'] = $v;
}
$data['bargain'] = $bargain;
$data['bargainSumCount'] = StoreOrder::getBargainPayCount($id);
$data['userBargainStatus'] = StoreBargainUser::isBargainUser($id, $user['uid']);
StoreVisit::setView($user['uid'], $id, 'bargain',$bargain['product_id'], 'viwe');
return app('json')->successful($data);
}
/**
* 产品 观看/分享/参与次数
* @param Request $request
* @return mixed
*/
public function share(Request $request)
{
list($bargainId) = UtilService::postMore([['bargainId', 0]], $request, true);
$data['lookCount'] = StoreBargain::getBargainLook();//TODO 观看人数
$data['shareCount'] = StoreBargain::getBargainShare();//TODO 分享人数
$data['userCount'] = StoreBargainUser::count();//TODO 参与人数
if (!$bargainId) return app('json')->successful($data);
StoreBargain::addBargainShare($bargainId);
$data['shareCount'] = StoreBargain::getBargainShare();//TODO 分享人数
return app('json')->successful($data);
}
/**
* The product is turned on
* @param Request $request
* @return mixed
* @throws \think\Exception
*/
public function start(Request $request)
{
list($bargainId) = UtilService::postMore([['bargainId', 0]], $request, true);
if (!($bargain = StoreBargain::getBargainTerm($bargainId))) return app('json')->fail('产品已
结束');
if (!$bargainId) return app('json')->fail('参数错误');
$count = StoreBargainUser::isBargainUser($bargainId, $request->uid());
if ($count === false) return app('json')->fail('参数错误');
else if ($count) return app('json')->status('SUCCESSFUL', '参与成功');
else $res = StoreBargainUser::setBargain($bargainId, $request->uid());
if (!$res) return app('json')->fail('参与失败');
else return app('json')->status('SUCCESS', '参与成功');
}
/**
* 产品 Help a friend product
* @param Request $request
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function help(Request $request)
{
list($bargainId, $bargainUserUid) = UtilService::postMore([['bargainId', 0],
['bargainUserUid', 0]], $request, true);
if (!$bargainId || !$bargainUserUid) return app('json')->fail('参数错误');
$count = StoreBargainUserHelp::isBargainUserHelpCount($bargainId, $bargainUserUid, $request-
>uid());
if (!$count) return app('json')->status('SUCCESSFUL', '产品成功');
$res = StoreBargainUserHelp::setBargainUserHelp($bargainId, $bargainUserUid, $request->uid
());
if ($res) {
if (!StoreBargainUserHelp::getSurplusPrice($bargainId, $bargainUserUid)) {
$bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId,
$bargainUserUid);// TODO Get the user engagement product form number
$bargainInfo = StoreBargain::get($bargainId);//TODO 获取产品信息
$bargainUserInfo = StoreBargainUser::get($bargainUserTableId);// TODO Get users to participate in the hack
price information
//TODO The product successfully sends a template message to the user who opened the product
$openid = WechatUser::uidToOpenid($bargainUserUid, 'openid');
$routineOpenid = WechatUser::uidToOpenid($bargainUserUid, 'routine_openid');
if ($openid) {//公众号
$urlWeChat = Route::buildUrl('/activity/dargain_detail/' . $bargainId . '/' .
$bargainUserUid)->suffix('')->domain(true)->build();
WechatTemplateService::sendTemplate($openid,
WechatTemplateService::BARGAIN_SUCCESS, [
'first' => '好腻害!Your friends have already negotiated the bottom price for you!',
'keyword1' => $bargainInfo['title'],
'keyword2' => $bargainInfo['min_price'],
'remark' => '点击查看订单详情'
], $urlWeChat);
} else if ($routineOpenid) { //小程序
RoutineTemplate::sendBargainSuccess($bargainInfo, $bargainUserInfo,
$bargainUserUid);
}
}
return app('json')->status('SUCCESS', '产品成功');
} else return app('json')->fail('产品失败');
}
/**
* 产品 金额
* @param Request $request
* @return mixed
*/
public function help_price(Request $request)
{
list($bargainId, $bargainUserUid) = UtilService::postMore([['bargainId', 0],
['bargainUserUid', 0]], $request, true);
if (!$bargainId || !$bargainUserUid) return app('json')->fail('参数错误');
$bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId,
$bargainUserUid);//TODO Get the user engagement product form number
$price = StoreBargainUserHelp::getBargainUserBargainPrice($bargainId, $bargainUserTableId,
$request->uid(), 'price');// TODO Get the amount of the user's product
if ($price) return app('json')->successful(['price' => $price]);
else return app('json')->fail('获取失败');
}
/**
* 产品 The total number of products to help、剩余金额、进度条
* @param Request $request
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function help_count(Request $request)
{
list($bargainId, $bargainUserUid) = UtilService::postMore([['bargainId', 0],
['bargainUserUid', 0]], $request, true);
$data['userBargainStatus'] = StoreBargainUserHelp::isBargainUserHelpCount($bargainId,
$bargainUserUid, $request->uid());
if (!$bargainId || !$bargainUserUid) return app('json')->fail('参数错误');
$bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId,
$bargainUserUid);//TODO Get the user engagement product form number
if ($bargainUserTableId) {
$count = StoreBargainUserHelp::getBargainUserHelpPeopleCount($bargainId,
$bargainUserUid);//TODO Get the total number of product helpers
$price = StoreBargainUserHelp::getSurplusPrice($bargainId, $bargainUserUid);//TODO Get the product remaining amount
$alreadyPrice = StoreBargainUser::getBargainUserPrice($bargainUserTableId);//TODO
$pricePercent = StoreBargainUserHelp::getSurplusPricePercent($bargainId,
$bargainUserUid);//TODO Get the product progress bar
$data['count'] = $count;
$data['price'] = $price;
$data['status'] = StoreBargainUser::getBargainUserStatusEnd($bargainUserTableId);
$data['alreadyPrice'] = $alreadyPrice;
$data['pricePercent'] = $pricePercent > 10 ? $pricePercent : 10;
} else {
$data['count'] = 0;
$data['price'] = StoreBargain::where('id', $bargainId)->value('price - min_price');
$data['status'] = StoreBargainUser::getBargainUserStatusEnd($bargainUserTableId);
$data['alreadyPrice'] = 0;
$data['pricePercent'] = 0;
}
return app('json')->successful($data);
}
/**
* 产品 Product help
* @param Request $request
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function help_list(Request $request)
{
list($bargainId, $bargainUserUid, $page, $limit) = UtilService::postMore([
['bargainId', 0],
['bargainUserUid', 0],
['page', 0],
['limit', 20]
], $request, true);
if (!$bargainId || !$bargainUserUid) return app('json')->fail('参数错误');
$bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId, $bargainUserUid);
//TODO Product Help Get the participating product table number
$storeBargainUserHelp = StoreBargainUserHelp::getList($bargainUserTableId, $page, $limit);
return app('json')->successful($storeBargainUserHelp);
}
/**
* 产品 Open product user information
* @param Request $request
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function start_user(Request $request)
{
list($bargainId, $bargainUserUid) = UtilService::postMore([
['bargainId', 0],
['bargainUserUid', 0],
], $request, true);
if (!$bargainId || !$bargainUserUid) return app('json')->fail('参数错误');
// $bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId,
$bargainUserUid);//TODO Get the user engagement product form number
// if(!$bargainUserTableId) return app('json')->fail('参数错误');
$userInfo = User::getUserInfo($bargainUserUid, 'nickname,avatar');
return app('json')->successful($userInfo);
}
/**
* 产品列表(已参与)
* @param Request $request
* @return mixed
*/
public function user_list(Request $request)
{
list($page, $limit) = UtilService::getMore([
['page', 0],
['limit', 0],
], $request, true);
$uid = $request->uid();
StoreBargainUser::editBargainUserStatus($uid);// TODO Determining expired product activity
$list = StoreBargainUser::getBargainUserAll($uid, $page, $limit);
if (count($list)) return app('json')->successful($list);
else return app('json')->fail('There are currently no participating products');
}
/**
* Product cancelled
* @param Request $request
* @return mixed
*/
public function user_cancel(Request $request)
{
list($bargainId) = UtilService::postMore([['bargainId', 0]], $request, true);
if (!$bargainId) return app('json')->fail('参数错误');
$status = StoreBargainUser::getBargainUserStatus($bargainId, $request->uid());
if ($status != 1) return app('json')->fail('状态错误');
$id = StoreBargainUser::getBargainUserTableId($bargainId, $request->uid());
$res = StoreBargainUser::edit(['is_del' => 1], $id);
if ($res) return app('json')->successful('取消成功');
else return app('json')->successful('取消失败');
}
/**
* 产品海报
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function poster(Request $request)
{
list($bargainId, $from) = UtilService::postMore([['bargainId', 0], ['from', 'wechat']],
$request, true);
if (!$bargainId) return app('json')->fail('参数错误');
$user = $request->user();
$storeBargainInfo = StoreBargain::getBargain($bargainId);
$price = StoreBargainUserHelp::getSurplusPrice($bargainId, $user['uid']);//TODO Get the product remaining amount
$alreadyPrice = StoreBargainUser::getBargainUserPrice
(StoreBargainUser::getBargainUserTableId($bargainId, $user['uid']));
try {
$siteUrl = sys_config('site_url');
$data['title'] = $storeBargainInfo['title'];
$data['image'] = $storeBargainInfo['image'];
$data['price'] = bcsub($storeBargainInfo['price'], $alreadyPrice, 2);
$data['label'] = '产品';
$data['msg'] = '还差' . $price . 'Yuan can product success';
if ($from == 'routine') {
//小程序
$name = $bargainId . '_' . $user['uid'] . '_' . $user['is_promoter'] .
'_bargain_share_routine.jpg';
$imageInfo = SystemAttachment::getInfo($name, 'name');
if (!$imageInfo) {
$valueData = 'id=' . $bargainId . '&bargain=' . $user['uid'];
if ($user['is_promoter'] || sys_config('store_brokerage_statu') == 2) $valueData
.= '&pid=' . $user['uid'];
$res = RoutineCode::getPageCode('pages/activity/goods_bargain_details/index',
$valueData, 280);
if (!$res) return app('json')->fail('二维码生成失败');
$uploadType = (int)sys_config('upload_type', 1);
$upload = new Upload($uploadType, [
'accessKey' => sys_config('accessKey'),
'secretKey' => sys_config('secretKey'),
'uploadUrl' => sys_config('uploadUrl'),
'storageName' => sys_config('storage_name'),
'storageRegion' => sys_config('storage_region'),
]);
$res = $upload->to('routine/activity/bargain/code')->validate()->stream($res,
$name);
if ($res === false) {
return app('json')->fail($upload->getError());
}
$imageInfo = $upload->getUploadInfo();
$imageInfo['image_type'] = $uploadType;
if ($imageInfo['image_type'] == 1) $remoteImage = UtilService::remoteImage
($siteUrl . $imageInfo['dir']);
else $remoteImage = UtilService::remoteImage($imageInfo['dir']);
if (!$remoteImage['status']) return app('json')->fail($remoteImage['msg']);
SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'],
$imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'],
$imageInfo['time'], 2);
$url = $imageInfo['dir'];
} else $url = $imageInfo['att_dir'];
$data['url'] = $url;
if ($imageInfo['image_type'] == 1)
$data['url'] = $siteUrl . $url;
$posterImage = UtilService::setShareMarketingPoster($data,
'routine/activity/bargain/poster');
if (!is_array($posterImage)) return app('json')->fail('海报生成失败');
SystemAttachment::attachmentAdd($posterImage['name'], $posterImage['size'],
$posterImage['type'], $posterImage['dir'], $posterImage['thumb_path'], 1, $posterImage['image_type'],
$posterImage['time'], 2);
if ($posterImage['image_type'] == 1) $posterImage['dir'] = $siteUrl . $posterImage
['dir'];
$routinePosterImage = set_http_type($posterImage['dir'], 0);//Mini Program Promotion Poster
return app('json')->successful(['url' => $routinePosterImage]);
} else if ($from == 'wechat') {
//公众号
$name = $bargainId . '_' . $user['uid'] . '_' . $user['is_promoter'] .
'_bargain_share_wap.jpg';
$imageInfo = SystemAttachment::getInfo($name, 'name');
if (!$imageInfo) {
$codeUrl = set_http_type($siteUrl . '/activity/dargain_detail/' . $bargainId .
'/' . $user['uid'] . '?spread=' . $user['uid'], 1);//二维码链接
$imageInfo = UtilService::getQRCodePath($codeUrl, $name);
if (is_string($imageInfo)) {
return app('json')->fail('二维码生成失败', ['error' => $imageInfo]);
}
SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'],
$imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'],
$imageInfo['time'], 2);
$url = $imageInfo['dir'];
} else $url = $imageInfo['att_dir'];
$data['url'] = $url;
if ($imageInfo['image_type'] == 1) $data['url'] = $siteUrl . $url;
$posterImage = UtilService::setShareMarketingPoster($data,
'wap/activity/bargain/poster');
if (!is_array($posterImage)) return app('json')->fail('海报生成失败');
SystemAttachment::attachmentAdd($posterImage['name'], $posterImage['size'],
$posterImage['type'], $posterImage['dir'], $posterImage['thumb_path'], 1, $posterImage['image_type'],
$posterImage['time'], 2);
if ($posterImage['image_type'] == 1) $posterImage['dir'] = $siteUrl . $posterImage
['dir'];
$wapPosterImage = set_http_type($posterImage['dir'], 1);//Public account promotion poster
return app('json')->successful(['url' => $wapPosterImage]);
}
return app('json')->fail('参数错误');
} catch (\Exception $e) {
return app('json')->fail(['line' => $e->getLine(), 'message' => $e->getMessage()]);
}
}
}边栏推荐
- 雨水情自动监测 遥测终端机
- 5 pits that machine learning beginners are easy to step on
- Definition and operation process of OAuth2
- Scala object class basic grammar explanation
- 【FLink】Assigned key must not be null
- Parse the structure inside the wpf control
- Wechat applet's homestay room reservation uniapp applet
- 虚拟摄像头之四: 谁在调用 v4l2_camera_HAL 摄像头驱动
- 1008: series summation
- 5G/4G water resource remote control terminal
猜你喜欢

Industrial 5g router manufacturers

Automatic water quality monitoring and video monitoring to consolidate and improve the level of drinking water safety

广告电商系统开发功能之产品系统模块

4G dtu remote wireless meter reading

Parse the structure inside the wpf control

基于STM32F103C8T6最小系统板驱动灰度模块进行循迹

TensorFlow学习记录(五):卷积神经网络

'Wed Aug 03 19:48:03 +0800 2022'这种字符串,怎么转成时间格式年月日

Wonderful Review|Cloud Native Meetup Guangzhou Station

代理ip的一些基本概念与方法(更新中……)
随机推荐
5G/4G water resource remote control terminal
Parse the structure inside the wpf control
堆(溯流从源——树)
【RF】Radio Frequency Integrated Circuit and System Design
haproxy experiment
JUC源码学习笔记4——原子类,CAS,Volatile内存屏障,缓存伪共享与UnSafe相关方法
超级水王问题
“go1.15.3“ does not match go tool version “go1.13.8“
wpf中TreeView的滚动条
Interview experience with points for job hunting + future career planning
scala object class基础语法讲解
雨水情自动监测 遥测终端机
梦想照进现实|CSDN 实体奖牌 第二期
智慧路灯远程智能控制
What tools do I need to create a desktop installer?
【诡秘之主】封印物篇
基于STM32F103C8T6最小系统板驱动灰度模块进行循迹
Collections and Iterators
微信小程序当input框中的值改变时获取input框的值
【诡秘之主】真神篇