当前位置:网站首页>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 ');
}
}
}边栏推荐
- 网络 | traceroute,路由跟踪命令,用于确定 IP 数据包访问目标地址所经过的路径。
- Web project development process
- Mpai data science platform SVM support vector machine classification \ explanation of regression parameter adjustment
- New and old cluster migration of Minio data
- Arm V7 coprocessor
- Explain AHP in human language (very detailed principle + simple tool implementation)
- Uncover gaussdb (for redis): comprehensive comparison of CODIS
- R语言使用nnet包的multinom函数构建无序多分类logistic回归模型、使用epiDisplay包的lrtest函数执行多个模型似然比检验对比两个模型的性能是否有差异
- SDN system method | 9 Access network
- 刷入Magisk通用方法
猜你喜欢

Dark horse shopping mall ---6 Brand, specification statistics, condition filtering, paging sorting, highlighting

Use PHP script to view the opened extensions

plt. GCA () picture frame and label

Uncover gaussdb (for redis): comprehensive comparison of CODIS

Explain factor analysis in simple terms, with case teaching (full)

20、wpf之MVVM命令绑定

The source code of the hottest online disk money making system in 2022 imitates Lanzou online disk / Chengtong online disk / sharing money making cloud disk system / online disk VIP Download System

Time series analysis - how to use unit root test (ADF) correctly?
![[论]Learning Dynamic and Hierarchical Traffic Spatiotemporal Features with Transformer](/img/58/d68112a3d019de66150e2f5102f436.png)
[论]Learning Dynamic and Hierarchical Traffic Spatiotemporal Features with Transformer

2022 meisai topic C idea sharing + translation
随机推荐
ECSHOP video list_ ECSHOP uploading video, video classification, video list playing video function
R language dplyr package summary_ The at function calculates the count number, mean and median of multiple data columns (specified by vectors) in the dataframe data, and specifies na RM parameter, spe
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
Dark horse shopping mall ---6 Brand, specification statistics, condition filtering, paging sorting, highlighting
什么是Flink?Flink能用来做什么?
Web project development process
R语言dplyr包filter函数过滤dataframe数据中指定数据列的内容不是(不等于指定向量中的其中一个)指定列表中的数据行
Time series analysis - how to use unit root test (ADF) correctly?
Explain AHP in human language (very detailed principle + simple tool implementation)
[oceanbase] Introduction to oceanbase and its comparison with MySQL
Recyclerview scrolls to the specified location
实现领域驱动设计 - 使用ABP框架 - 系列文章汇总
【OceanBase】OceanBase简介及其与MySQL的比较
What is the primordial universe
Thinkphp3 count ` *'problem
Use PHP script to view the opened extensions
The network traceroute command is used to determine the path through which IP packets access the destination address.
R语言使用glm函数构建泊松对数线性回归模型处理三维列联表数据构建饱和模型、epiDisplay包的poisgof函数对拟合的泊松回归模型进行拟合优度检验(检验模型效果)
网络 | traceroute,路由跟踪命令,用于确定 IP 数据包访问目标地址所经过的路径。
Does sklearex make your sklearn machine learning model training fly fast?