当前位置:网站首页>Zunpin Yongyao advertising e-commerce system -- Zunpin Yongyao advertising e-commerce app system development source code sharing
Zunpin Yongyao advertising e-commerce system -- Zunpin Yongyao advertising e-commerce app system development source code sharing
2022-06-25 12:27:00 【Procedure 15528175269】
Zunpin Yongyao advertising e-commerce system development source code sharing :
<?php
namespace app\api\controller\user;
use app\models\ad\AdSeeLog;
use app\models\ad\AdTask;
use app\models\ad\AdTaskLog;
use app\admin\model\ad\Video;
use app\Request;
use app\models\user\User;
use crmeb\services\UtilService;
/**
* Advertising task
* Class AdTaskController
* @package app\api\controller\user
*/
class AdTaskController
{
/**
* Receive advertising tasks
* @return mixed
*/
public function task(Request $request)
{
$uid = $request->uid();
list($id) = UtilService::postMore([
[['id', 'd'], 0],
], $request, true);
if (!$id || $id <= 0) return app('json')->fail(' Parameter error ');
$data = AdTask::where('id', $id)->find();
if (empty($data)) {
return app('json')->fail(' The task does not exist !');
}
$user = User::getUserInfo($uid);
if($user['buy_money'] < $data['min']){
return app('json')->fail(' Your purchase amount is not enough , You cannot claim this task !');
}
$count = AdTaskLog::where('uid', $uid)->where('task_id', $id)->count('*');
if($count){
return app('json')->fail(' You have received this task !');
}
$res = AdTask::setAdTask($uid, $data);
if ($res) {
return app('json')->success(' Claim success ');
} else {
return app('json')->fail(' Failed to collect ');
}
}
/**
* Ad task list
* @param Request $request
* @return mixed
*/
public function index(Request $request)
{
list($page, $limit) = UtilService::getMore([
['page', 0],
['limit', 0],
], $request, true);
return app('json')->successful(AdTask::getTaskList($request->uid(), $page, $limit));
}
// Get advertising data
public function getAd(Request $request){
$uid = $request->uid();
$user = User::getUserInfo($uid);
if($user['task_log_id'] == 0){
return app('json')->fail(' You didn't get the ad assignment , Please get it first ');
}
if($user['see_ad_count'] == 0){
return app('json')->fail(' You have run out of ads today , Please come back tomorrow ');
}
$time = date('Y-m-d', time());
$logList = AdSeeLog::where('uid', $uid)->whereDay('add_time', $time)->field('ad_id')->select();
if(empty($logList)){
$list = Video::where('status', 0)->orderRand()->limit(0,1)->select();
} else {
$listId = array_column($logList->toArray(),'ad_id');
$con = implode(",", $listId);
$list = Video::where('status', 0)->whereNotIn('id', $con)->orderRand()->limit(0,1)->select();
}
$list = $list->toArray();
if($list){
$ad = $list[0];
$str = substr($ad['file_add'], 0, 4);
if(!($str =='http')){
$ad['file_add'] = sys_config('site_url') . $ad['file_add'];
}
} else {
return app('json')->fail(' No advertising ');
}
$data['ad'] = $ad;
return app('json')->successful($data);
}
public function adCount(Request $request) {
$uid = $request->uid();
list($aid) = UtilService::postMore([
[['aid', 'd'], 0],
], $request, true);
$res = AdTask::adCount($uid, $aid);
if($res){
$user = User::getUserInfo($uid);
$data['msg'] = ' Successful advertising revenue ';
$data['see_ad_count'] = $user['see_ad_count'];
return app('json')->successful($data);
} else {
return app('json')->fail(' Advertising revenue acquisition failed , Please try again ');
}
}
}
边栏推荐
- Explain factor analysis in simple terms, with case teaching (full)
- R language uses ordinal or. The display function obtains the summary statistical information of the ordered logistic regression model (the odds ratio and its confidence interval corresponding to the v
- The cloud native data lake has passed the evaluation and certification of the ICT Institute with its storage, computing, data management and other capabilities
- Découvrir gaussdb (pour redis): une comparaison complète avec Codis
- 15. Notes on the button style of WPF
- Repair the error that ECSHOP background orders prompt insufficient inventory when adding goods. Please reselect
- Uncover gaussdb (for redis): comprehensive comparison of CODIS
- ARM V7 ldr str 内存访问
- The R language uses the follow up The plot function visualizes the longitudinal follow-up map of multiple ID (case) monitoring indicators, and uses stress The type parameter specifies the line type of
- 【数据中台】数据中台的OneID是个什么鬼,主数据它不香吗?
猜你喜欢
Time series analysis - how to use unit root test (ADF) correctly?
Explanation of ideas and sharing of pre-processing procedures for 2021 US game D (with pre-processing data code)
How do super rookies get started with data analysis?
A commonly used statistical modeling method -- difference analysis
Architects reveal the difference between working in Alibaba, Tencent and meituan
20. MVVM command binding of WPF
Pd1.4 to hdmi2.0 adapter cable disassembly.
plt. GCA () picture frame and label
How to use ARIMA model for prediction?
confluence7.4.X升级实录
随机推荐
动态代理
Linear regression of common mathematical modeling models for College Students
Network | indicators and test methods to measure the quality of the network
图片打标签之获取图片在ImageView中的坐标
一篇文章讲清楚MySQL的聚簇/联合/覆盖索引、回表、索引下推
Web project development process
ARM V7 连续加载/存储
黑马畅购商城---3.商品管理
Effective reading of literature
Execution order of MySQL query statements join, on and where
Gradle知识点
揭秘GaussDB(for Redis):全面對比Codis
Dark horse shopping mall ---2 Distributed file storage fastdfs
High imitation blue playing network disk file sharing to make money network disk PHP system source code
设置图片的透明度从左到右渐变
Understanding and construction of devsecops and Devops
ECSHOP video list_ ECSHOP uploading video, video classification, video list playing video function
Hook technology
做自媒体视频需要怎么做才能年收入一百万?
R语言使用scale函数对神经网络的输入数据进行最小最大缩放、把数据缩放到0到1之间、并划分数据集为训练集和测试集